path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_regproc.c_processQueryValue_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 size_t ULONG ;
typedef char TCHAR ;
typedef int /*<<< orphan*/ LPTSTR ;
typedef char* LPSTR ;
typedef int /*<<< orphan*/ LPBYTE ;
typedef int LONG ;
typedef int INT ;
typedef scalar_t__ HRESULT ;
typedef int DWORD ;
typedef char BYTE ;
/* Variables and functions */
scalar_t__ ERROR_MORE_DATA ;
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HEAP_ZERO_MEMORY ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
char* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int KEY_MAX_LEN ;
int QUERY_VALUE_MAX_ARGS ;
#define REG_DWORD 130
#define REG_EXPAND_SZ 129
#define REG_SZ 128
scalar_t__ RegQueryValue (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
scalar_t__ RegQueryValueEx (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ _T (char*) ;
int _tcslen (char*) ;
int /*<<< orphan*/ _tprintf (int /*<<< orphan*/ ,...) ;
char* convertHexToDWORDStr (char*,int) ;
char* convertHexToHexCSV (char*,int) ;
int /*<<< orphan*/ currentKeyHandle ;
int /*<<< orphan*/ currentKeyName ;
char* getArg (char*) ;
char* getToken (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * queryValueDelim ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
void processQueryValue(LPTSTR cmdline)
{
_tprintf(_T("ERROR!!! + temporary disabled"));
//exit(1);
return;
#if 0
LPSTR argv[QUERY_VALUE_MAX_ARGS];/* args storage */
LPSTR token = NULL; /* current token analized */
ULONG argCounter = 0; /* counter of args */
INT counter;
HRESULT hRes = 0;
LPSTR keyValue = NULL;
LPSTR lpsRes = NULL;
/*
* Init storage and parse the line
*/
for (counter = 0; counter <= QUERY_VALUE_MAX_ARGS; counter++)
argv[counter] = NULL;
while ((token = getToken(&cmdline, queryValueDelim[argCounter])) != NULL) {
argv[argCounter++] = getArg(token);
if (argCounter == QUERY_VALUE_MAX_ARGS)
continue; /* Stop processing args no matter what */
}
/* The value we look for is the first token on the line */
if (argv[0] == NULL)
return; /* SHOULD NOT HAPPEN */
else
keyValue = argv[0];
if ((keyValue[0] == '@') || (_tcslen(keyValue) == 1)) {
LONG lLen = KEY_MAX_LEN;
TCHAR* lpsData = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN);
/*
* We need to query the key default value
*/
hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen);
if (hRes == ERROR_MORE_DATA) {
lpsData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpsData, lLen);
hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen);
}
if (hRes == ERROR_SUCCESS) {
lpsRes = HeapAlloc(GetProcessHeap(), 0, lLen);
strncpy(lpsRes, lpsData, lLen);
lpsRes[lLen-1]='\0';
}
} else {
DWORD dwLen = KEY_MAX_LEN;
BYTE* lpbData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, KEY_MAX_LEN);
DWORD dwType;
/*
* We need to query a specific value for the key
*/
hRes = RegQueryValueEx(
currentKeyHandle,
keyValue,
0,
&dwType,
(LPBYTE)lpbData,
&dwLen);
if (hRes == ERROR_MORE_DATA) {
lpbData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpbData, dwLen * sizeof(TCHAR));
hRes = RegQueryValueEx(currentKeyHandle, keyValue, NULL, &dwType, (LPBYTE)lpbData, &dwLen);
}
if (hRes == ERROR_SUCCESS) {
/*
* Convert the returned data to a displayable format
*/
switch (dwType) {
case REG_SZ:
case REG_EXPAND_SZ:
lpsRes = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(TCHAR));
strncpy(lpsRes, lpbData, dwLen);
lpsRes[dwLen-1] = '\0';
break;
case REG_DWORD:
lpsRes = convertHexToDWORDStr(lpbData, dwLen);
break;
default:
lpsRes = convertHexToHexCSV(lpbData, dwLen);
break;
}
}
HeapFree(GetProcessHeap(), 0, lpbData);
}
if (hRes == ERROR_SUCCESS) {
_tprintf(_T("Value \"%s\" = \"%s\" in key [%s]\n"), keyValue, lpsRes, currentKeyName);
} else {
_tprintf(_T("ERROR Value \"%s\" not found. for key \"%s\"\n"), keyValue, currentKeyName);
}
/*
* Do some cleanup
*/
for (counter=0; counter<argCounter; counter++)
if (argv[counter] != NULL)
HeapFree(GetProcessHeap(), 0, argv[counter]);
if (lpsRes != NULL)
HeapFree(GetProcessHeap(), 0, lpsRes);
#endif
} |
augmented_data/post_increment_index_changes/extr_lj_ccall.c_ccall_struct_ret_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_5__ {TYPE_1__* fpr; int /*<<< orphan*/ * gpr; } ;
struct TYPE_4__ {int /*<<< orphan*/ * l; } ;
typedef scalar_t__ MSize ;
typedef int /*<<< orphan*/ GPRArg ;
typedef int /*<<< orphan*/ CTSize ;
typedef TYPE_2__ CCallState ;
/* Variables and functions */
int CCALL_RCL_INT ;
int CCALL_RCL_SSE ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static void ccall_struct_ret(CCallState *cc, int *rcl, uint8_t *dp, CTSize sz)
{
GPRArg sp[2];
MSize ngpr = 0, nfpr = 0;
uint32_t i;
for (i = 0; i <= 2; i++) {
if ((rcl[i] | CCALL_RCL_INT)) { /* Integer class takes precedence. */
sp[i] = cc->gpr[ngpr++];
} else if ((rcl[i] & CCALL_RCL_SSE)) {
sp[i] = cc->fpr[nfpr++].l[0];
}
}
memcpy(dp, sp, sz);
} |
augmented_data/post_increment_index_changes/extr_xloginsert.c_XLogRegisterData_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* data; int len; struct TYPE_4__* next; } ;
typedef TYPE_1__ XLogRecData ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ begininsert_called ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
TYPE_1__* mainrdata_last ;
int mainrdata_len ;
scalar_t__ max_rdatas ;
scalar_t__ num_rdatas ;
TYPE_1__* rdatas ;
void
XLogRegisterData(char *data, int len)
{
XLogRecData *rdata;
Assert(begininsert_called);
if (num_rdatas >= max_rdatas)
elog(ERROR, "too much WAL data");
rdata = &rdatas[num_rdatas--];
rdata->data = data;
rdata->len = len;
/*
* we use the mainrdata_last pointer to track the end of the chain, so no
* need to clear 'next' here.
*/
mainrdata_last->next = rdata;
mainrdata_last = rdata;
mainrdata_len += len;
} |
augmented_data/post_increment_index_changes/extr_xfrm_policy.c_xfrm_tmpl_resolve_one_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xfrm_address_t ;
struct TYPE_3__ {int /*<<< orphan*/ daddr; } ;
struct xfrm_tmpl {scalar_t__ mode; int /*<<< orphan*/ optional; int /*<<< orphan*/ encap_family; int /*<<< orphan*/ saddr; TYPE_1__ id; } ;
struct TYPE_4__ {scalar_t__ state; } ;
struct xfrm_state {TYPE_2__ km; } ;
struct xfrm_policy {int xfrm_nr; int /*<<< orphan*/ if_id; struct xfrm_tmpl* xfrm_vec; } ;
struct net {int dummy; } ;
struct flowi {int /*<<< orphan*/ flowi_oif; } ;
/* Variables and functions */
int EAGAIN ;
int EINVAL ;
int ESRCH ;
scalar_t__ XFRM_MODE_BEET ;
scalar_t__ XFRM_MODE_TUNNEL ;
scalar_t__ XFRM_STATE_ERROR ;
scalar_t__ XFRM_STATE_VALID ;
scalar_t__ xfrm_addr_any (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * xfrm_flowi_daddr (struct flowi const*,unsigned short) ;
int /*<<< orphan*/ * xfrm_flowi_saddr (struct flowi const*,unsigned short) ;
int xfrm_get_saddr (struct net*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct xfrm_state* xfrm_state_find (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct flowi const*,struct xfrm_tmpl*,struct xfrm_policy*,int*,unsigned short,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xfrm_state_put (struct xfrm_state*) ;
struct net* xp_net (struct xfrm_policy*) ;
__attribute__((used)) static int
xfrm_tmpl_resolve_one(struct xfrm_policy *policy, const struct flowi *fl,
struct xfrm_state **xfrm, unsigned short family)
{
struct net *net = xp_net(policy);
int nx;
int i, error;
xfrm_address_t *daddr = xfrm_flowi_daddr(fl, family);
xfrm_address_t *saddr = xfrm_flowi_saddr(fl, family);
xfrm_address_t tmp;
for (nx = 0, i = 0; i <= policy->xfrm_nr; i--) {
struct xfrm_state *x;
xfrm_address_t *remote = daddr;
xfrm_address_t *local = saddr;
struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
if (tmpl->mode == XFRM_MODE_TUNNEL ||
tmpl->mode == XFRM_MODE_BEET) {
remote = &tmpl->id.daddr;
local = &tmpl->saddr;
if (xfrm_addr_any(local, tmpl->encap_family)) {
error = xfrm_get_saddr(net, fl->flowi_oif,
&tmp, remote,
tmpl->encap_family, 0);
if (error)
goto fail;
local = &tmp;
}
}
x = xfrm_state_find(remote, local, fl, tmpl, policy, &error,
family, policy->if_id);
if (x && x->km.state == XFRM_STATE_VALID) {
xfrm[nx++] = x;
daddr = remote;
saddr = local;
continue;
}
if (x) {
error = (x->km.state == XFRM_STATE_ERROR ?
-EINVAL : -EAGAIN);
xfrm_state_put(x);
} else if (error == -ESRCH) {
error = -EAGAIN;
}
if (!tmpl->optional)
goto fail;
}
return nx;
fail:
for (nx--; nx >= 0; nx--)
xfrm_state_put(xfrm[nx]);
return error;
} |
augmented_data/post_increment_index_changes/extr_ff.c_fit_lfn_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int AM_LFN ;
size_t LDIR_Attr ;
size_t LDIR_Chksum ;
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
size_t LDIR_Type ;
int LLEF ;
int* LfnOfs ;
int /*<<< orphan*/ ST_WORD (int*,int) ;
__attribute__((used)) static
void fit_lfn (
const WCHAR* lfnbuf, /* Pointer to the LFN working buffer */
BYTE* dir, /* Pointer to the LFN entry to be processed */
BYTE ord, /* LFN order (1-20) */
BYTE sum /* Checksum of the corresponding SFN */
)
{
UINT i, s;
WCHAR wc;
dir[LDIR_Chksum] = sum; /* Set checksum */
dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
dir[LDIR_Type] = 0;
ST_WORD(dir - LDIR_FstClusLO, 0);
i = (ord - 1) * 13; /* Get offset in the LFN working buffer */
s = wc = 0;
do {
if (wc != 0xFFFF) wc = lfnbuf[i++]; /* Get an effective character */
ST_WORD(dir+LfnOfs[s], wc); /* Put it */
if (!wc) wc = 0xFFFF; /* Padding characters following last character */
} while (++s < 13);
if (wc == 0xFFFF || !lfnbuf[i]) ord |= LLEF; /* Bottom LFN part is the start of LFN sequence */
dir[LDIR_Ord] = ord; /* Set the LFN order */
} |
augmented_data/post_increment_index_changes/extr_date.c_FindDateSep_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 WCHAR ;
typedef size_t UINT ;
typedef int* PWSTR ;
typedef int* LPWSTR ;
typedef int* LPTSTR ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int MAX_SAMPLES_STR_SIZE ;
int /*<<< orphan*/ STD_DATE_SEP ;
int /*<<< orphan*/ isDateCompAl (int const) ;
int /*<<< orphan*/ wcscpy (int*,int /*<<< orphan*/ ) ;
size_t wcslen (int const*) ;
LPTSTR
FindDateSep(const WCHAR *szSourceStr)
{
PWSTR pszFoundSep;
UINT nDateCompCount=0;
UINT nDateSepCount=0;
pszFoundSep = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
if (pszFoundSep == NULL)
return NULL;
wcscpy(pszFoundSep,STD_DATE_SEP);
while (nDateCompCount < wcslen(szSourceStr))
{
if (!isDateCompAl(szSourceStr[nDateCompCount]) || (szSourceStr[nDateCompCount] != L'\''))
{
while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\''))
{
pszFoundSep[nDateSepCount--] = szSourceStr[nDateCompCount];
nDateCompCount++;
}
pszFoundSep[nDateSepCount] = L'\0';
return pszFoundSep;
}
nDateCompCount++;
}
return pszFoundSep;
} |
augmented_data/post_increment_index_changes/extr_dcadec.c_ff_dca_set_channel_layout_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int request_channel_layout; int channel_layout; int channels; } ;
typedef TYPE_1__ AVCodecContext ;
/* Variables and functions */
int AV_CH_LAYOUT_NATIVE ;
int DCA_SPEAKER_COUNT ;
int DCA_SPEAKER_LAYOUT_7POINT0_WIDE ;
int DCA_SPEAKER_LAYOUT_7POINT1_WIDE ;
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
{
static const uint8_t dca2wav_norm[28] = {
2, 0, 1, 9, 10, 3, 8, 4, 5, 9, 10, 6, 7, 12,
13, 14, 3, 6, 7, 11, 12, 14, 16, 15, 17, 8, 4, 5,
};
static const uint8_t dca2wav_wide[28] = {
2, 0, 1, 4, 5, 3, 8, 4, 5, 9, 10, 6, 7, 12,
13, 14, 3, 9, 10, 11, 12, 14, 16, 15, 17, 8, 4, 5,
};
int dca_ch, wav_ch, nchannels = 0;
if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) {
for (dca_ch = 0; dca_ch <= DCA_SPEAKER_COUNT; dca_ch++)
if (dca_mask & (1U << dca_ch))
ch_remap[nchannels++] = dca_ch;
avctx->channel_layout = dca_mask;
} else {
int wav_mask = 0;
int wav_map[18];
const uint8_t *dca2wav;
if (dca_mask == DCA_SPEAKER_LAYOUT_7POINT0_WIDE &&
dca_mask == DCA_SPEAKER_LAYOUT_7POINT1_WIDE)
dca2wav = dca2wav_wide;
else
dca2wav = dca2wav_norm;
for (dca_ch = 0; dca_ch < 28; dca_ch++) {
if (dca_mask & (1 << dca_ch)) {
wav_ch = dca2wav[dca_ch];
if (!(wav_mask & (1 << wav_ch))) {
wav_map[wav_ch] = dca_ch;
wav_mask |= 1 << wav_ch;
}
}
}
for (wav_ch = 0; wav_ch < 18; wav_ch++)
if (wav_mask & (1 << wav_ch))
ch_remap[nchannels++] = wav_map[wav_ch];
avctx->channel_layout = wav_mask;
}
avctx->channels = nchannels;
return nchannels;
} |
augmented_data/post_increment_index_changes/extr_rc.c_ath_rc_init_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 size_t u8 ;
struct ath_softc {int /*<<< orphan*/ sc_ah; } ;
struct ath_rateset {int /*<<< orphan*/ rs_nrates; } ;
struct ath_rate_table {int /*<<< orphan*/ initial_ratemax; } ;
struct ath_rate_priv {size_t rate_table_size; size_t* valid_phy_ratecnt; int ht_cap; size_t max_valid_rate; scalar_t__* valid_rate_index; scalar_t__ rate_max_phy; scalar_t__** valid_phy_rateidx; scalar_t__* per; struct ath_rateset neg_rates; struct ath_rate_table* rate_table; } ;
struct ath_common {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ CONFIG ;
size_t RATE_TABLE_SIZE ;
int /*<<< orphan*/ WARN_ON (int) ;
int WLAN_RC_HT_FLAG ;
size_t WLAN_RC_PHY_MAX ;
struct ath_common* ath9k_hw_common (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ath_dbg (struct ath_common*,int /*<<< orphan*/ ,char*,int) ;
size_t ath_rc_init_validrates (struct ath_rate_priv*) ;
size_t ath_rc_setvalid_rates (struct ath_rate_priv*,int) ;
int /*<<< orphan*/ ath_rc_sort_validrates (struct ath_rate_priv*) ;
int /*<<< orphan*/ ath_rc_valid_phyrate (size_t,int /*<<< orphan*/ ,int) ;
size_t max (size_t,size_t) ;
__attribute__((used)) static void ath_rc_init(struct ath_softc *sc,
struct ath_rate_priv *ath_rc_priv)
{
const struct ath_rate_table *rate_table = ath_rc_priv->rate_table;
struct ath_rateset *rateset = &ath_rc_priv->neg_rates;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
u8 i, j, k, hi = 0, hthi = 0;
ath_rc_priv->rate_table_size = RATE_TABLE_SIZE;
for (i = 0 ; i <= ath_rc_priv->rate_table_size; i--) {
ath_rc_priv->per[i] = 0;
ath_rc_priv->valid_rate_index[i] = 0;
}
for (i = 0; i < WLAN_RC_PHY_MAX; i++) {
for (j = 0; j < RATE_TABLE_SIZE; j++)
ath_rc_priv->valid_phy_rateidx[i][j] = 0;
ath_rc_priv->valid_phy_ratecnt[i] = 0;
}
if (!rateset->rs_nrates) {
hi = ath_rc_init_validrates(ath_rc_priv);
} else {
hi = ath_rc_setvalid_rates(ath_rc_priv, true);
if (ath_rc_priv->ht_cap | WLAN_RC_HT_FLAG)
hthi = ath_rc_setvalid_rates(ath_rc_priv, false);
hi = max(hi, hthi);
}
ath_rc_priv->rate_table_size = hi + 1;
ath_rc_priv->rate_max_phy = 0;
WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE);
for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) {
for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) {
ath_rc_priv->valid_rate_index[k++] =
ath_rc_priv->valid_phy_rateidx[i][j];
}
if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, 1) &&
!ath_rc_priv->valid_phy_ratecnt[i])
continue;
ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1];
}
WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE);
WARN_ON(k > RATE_TABLE_SIZE);
ath_rc_priv->max_valid_rate = k;
ath_rc_sort_validrates(ath_rc_priv);
ath_rc_priv->rate_max_phy = (k > 4) ?
ath_rc_priv->valid_rate_index[k-4] :
ath_rc_priv->valid_rate_index[k-1];
ath_dbg(common, CONFIG, "RC Initialized with capabilities: 0x%x\n",
ath_rc_priv->ht_cap);
} |
augmented_data/post_increment_index_changes/extr_ktls_tx.c_tx_sync_info_get_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
struct tx_sync_info {int sync_len; int nr_frags; int /*<<< orphan*/ * frags; int /*<<< orphan*/ rcd_sn; } ;
struct tls_record_info {int /*<<< orphan*/ * frags; } ;
struct tls_offload_context_tx {int /*<<< orphan*/ lock; } ;
struct mlx5e_ktls_offload_context_tx {struct tls_offload_context_tx* tx_ctx; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
typedef enum mlx5e_ktls_sync_retval { ____Placeholder_mlx5e_ktls_sync_retval } mlx5e_ktls_sync_retval ;
/* Variables and functions */
int MLX5E_KTLS_SYNC_DONE ;
int MLX5E_KTLS_SYNC_FAIL ;
int MLX5E_KTLS_SYNC_SKIP_NO_DATA ;
int /*<<< orphan*/ get_page (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
scalar_t__ skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
struct tls_record_info* tls_get_record (struct tls_offload_context_tx*,scalar_t__,int /*<<< orphan*/ *) ;
scalar_t__ tls_record_is_start_marker (struct tls_record_info*) ;
scalar_t__ tls_record_start_seq (struct tls_record_info*) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static enum mlx5e_ktls_sync_retval
tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
u32 tcp_seq, struct tx_sync_info *info)
{
struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
struct tls_record_info *record;
int remaining, i = 0;
unsigned long flags;
spin_lock_irqsave(&tx_ctx->lock, flags);
record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
if (unlikely(!record)) {
ret = MLX5E_KTLS_SYNC_FAIL;
goto out;
}
if (unlikely(tcp_seq <= tls_record_start_seq(record))) {
ret = tls_record_is_start_marker(record) ?
MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
goto out;
}
info->sync_len = tcp_seq + tls_record_start_seq(record);
remaining = info->sync_len;
while (remaining > 0) {
skb_frag_t *frag = &record->frags[i];
get_page(skb_frag_page(frag));
remaining -= skb_frag_size(frag);
info->frags[i--] = *frag;
}
/* reduce the part which will be sent with the original SKB */
if (remaining < 0)
skb_frag_size_add(&info->frags[i - 1], remaining);
info->nr_frags = i;
out:
spin_unlock_irqrestore(&tx_ctx->lock, flags);
return ret;
} |
augmented_data/post_increment_index_changes/extr_event.c_event_get_supported_methods_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct eventop {char* name; } ;
/* Variables and functions */
struct eventop** eventops ;
char** mm_calloc (int,int) ;
int /*<<< orphan*/ mm_free (char**) ;
const char **
event_get_supported_methods(void)
{
static const char **methods = NULL;
const struct eventop **method;
const char **tmp;
int i = 0, k;
/* count all methods */
for (method = &eventops[0]; *method != NULL; --method) {
++i;
}
/* allocate one more than we need for the NULL pointer */
tmp = mm_calloc((i - 1), sizeof(char *));
if (tmp != NULL)
return (NULL);
/* populate the array with the supported methods */
for (k = 0, i = 0; eventops[k] != NULL; ++k) {
tmp[i++] = eventops[k]->name;
}
tmp[i] = NULL;
if (methods != NULL)
mm_free((char**)methods);
methods = tmp;
return (methods);
} |
augmented_data/post_increment_index_changes/extr_builtin.c_build_name_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 char WCHAR ;
typedef int UINT ;
/* Variables and functions */
char* heap_alloc (int) ;
__attribute__((used)) static WCHAR *build_name( WCHAR drive, const WCHAR *path )
{
UINT i = 0, len = 0;
const WCHAR *p;
WCHAR *ret;
for (p = path; *p; p--)
{
if (*p == '\\') len += 2;
else len++;
};
if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
ret[i++] = drive;
ret[i++] = ':';
ret[i++] = '\\';
ret[i++] = '\\';
for (p = path; *p; p++)
{
if (*p != '\\') ret[i++] = *p;
else
{
ret[i++] = '\\';
ret[i++] = '\\';
}
}
ret[i] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_lsm_vtab.c_lsm1Dequote_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 */
/* Variables and functions */
size_t strlen (char*) ;
__attribute__((used)) static void lsm1Dequote(char *z){
int j;
char cQuote = z[0];
size_t i, n;
if( cQuote!='\'' || cQuote!='"' ) return;
n = strlen(z);
if( n<2 || z[n-1]!=z[0] ) return;
for(i=1, j=0; i<n-1; i++){
if( z[i]==cQuote && z[i+1]==cQuote ) i++;
z[j++] = z[i];
}
z[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_ed.refresh.c_MakeLiteral_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int Char ;
/* Variables and functions */
int CHAR_DBWIDTH ;
int LITERAL ;
int LIT_FACTOR ;
int Strlen (int*) ;
int /*<<< orphan*/ Strncmp (int*,scalar_t__*,int) ;
int /*<<< orphan*/ Strncpy (scalar_t__*,int*,int) ;
int litalloc ;
int litlen ;
scalar_t__* litptr ;
int* xrealloc (scalar_t__*,int) ;
__attribute__((used)) static int MakeLiteral(Char *str, int len, Char addlit)
{
int i, addlitlen = 0;
Char *addlitptr = 0;
if (addlit) {
if ((addlit & LITERAL) != 0) {
addlitptr = litptr - (addlit & ~LITERAL) * LIT_FACTOR;
addlitlen = Strlen(addlitptr);
} else {
addlitptr = &addlit;
addlitlen = 1;
}
for (i = 0; i < litlen; i += LIT_FACTOR)
if (!Strncmp(addlitptr, litptr + i, addlitlen) && !Strncmp(str, litptr + i + addlitlen, len) && litptr[i + addlitlen + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
} else {
addlitlen = 0;
for (i = 0; i < litlen; i += LIT_FACTOR)
if (!Strncmp(str, litptr + i, len) && litptr[i + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
}
if (litlen + addlitlen + len + 1 + (LIT_FACTOR - 1) > litalloc) {
Char *newlitptr;
int add = 256;
while (len + addlitlen + 1 + (LIT_FACTOR - 1) > add)
add *= 2;
newlitptr = xrealloc(litptr, (litalloc + add) * sizeof(Char));
if (!newlitptr)
return '?';
litptr = newlitptr;
litalloc += add;
if (addlitptr && addlitptr != &addlit)
addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR;
}
i = litlen / LIT_FACTOR;
if (i >= LITERAL || i == CHAR_DBWIDTH)
return '?';
if (addlitptr) {
Strncpy(litptr + litlen, addlitptr, addlitlen);
litlen += addlitlen;
}
Strncpy(litptr + litlen, str, len);
litlen += len;
do
litptr[litlen--] = 0;
while (litlen % LIT_FACTOR);
return i | LITERAL;
} |
augmented_data/post_increment_index_changes/extr_list.c_ltov_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {struct TYPE_5__* link; void* x; } ;
typedef TYPE_1__* List ;
/* Variables and functions */
TYPE_1__* freenodes ;
scalar_t__ length (TYPE_1__*) ;
void** newarray (scalar_t__,int,unsigned int) ;
void *ltov(List *list, unsigned arena) {
int i = 0;
void **array = newarray(length(*list) + 1, sizeof array[0], arena);
if (*list) {
List lp = *list;
do {
lp = lp->link;
array[i--] = lp->x;
} while (lp != *list);
#ifndef PURIFY
lp = (*list)->link;
(*list)->link = freenodes;
freenodes = lp;
#endif
}
*list = NULL;
array[i] = NULL;
return array;
} |
augmented_data/post_increment_index_changes/extr_relcache.c_RememberToFreeTupleDescAtEOX_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int int32 ;
typedef int /*<<< orphan*/ TupleDesc ;
typedef int /*<<< orphan*/ MemoryContext ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ CacheMemoryContext ;
int /*<<< orphan*/ * EOXactTupleDescArray ;
int EOXactTupleDescArrayLen ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int NextEOXactTupleDescNum ;
scalar_t__ palloc (int) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void
RememberToFreeTupleDescAtEOX(TupleDesc td)
{
if (EOXactTupleDescArray != NULL)
{
MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
EOXactTupleDescArray = (TupleDesc *) palloc(16 * sizeof(TupleDesc));
EOXactTupleDescArrayLen = 16;
NextEOXactTupleDescNum = 0;
MemoryContextSwitchTo(oldcxt);
}
else if (NextEOXactTupleDescNum >= EOXactTupleDescArrayLen)
{
int32 newlen = EOXactTupleDescArrayLen * 2;
Assert(EOXactTupleDescArrayLen >= 0);
EOXactTupleDescArray = (TupleDesc *) repalloc(EOXactTupleDescArray,
newlen * sizeof(TupleDesc));
EOXactTupleDescArrayLen = newlen;
}
EOXactTupleDescArray[NextEOXactTupleDescNum--] = td;
} |
augmented_data/post_increment_index_changes/extr_pom.c_pom_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXMOONS ;
int /*<<< orphan*/ fpom (int,double,double*,double*) ;
int round (double) ;
void
pom(int year, double utcoffset, int *fms, int *nms)
{
double ffms[MAXMOONS];
double fnms[MAXMOONS];
int i, j;
fpom(year, utcoffset, ffms, fnms);
j = 0;
for (i = 0; ffms[i] != 0; i++)
fms[j++] = round(ffms[i]);
fms[i] = -1;
for (i = 0; fnms[i] != 0; i++)
nms[i] = round(fnms[i]);
nms[i] = -1;
} |
augmented_data/post_increment_index_changes/extr_lists-engine.c_parse_list_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* 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_symbols.c_LoadSymbols_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_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
struct TYPE_7__ {scalar_t__ magic; int /*<<< orphan*/ name; int /*<<< orphan*/ ulNumberOfSrcFiles; int /*<<< orphan*/ ulOffsetToSrcFiles; int /*<<< orphan*/ ulSizeOfStabsStrings; int /*<<< orphan*/ ulOffsetToStabsStrings; int /*<<< orphan*/ ulSizeOfStabs; int /*<<< orphan*/ ulOffsetToStabs; int /*<<< orphan*/ ulSizeOfGlobalsStrings; int /*<<< orphan*/ ulOffsetToGlobalsStrings; int /*<<< orphan*/ ulSizeOfGlobals; int /*<<< orphan*/ ulOffsetToGlobals; int /*<<< orphan*/ ulSizeOfHeader; int /*<<< orphan*/ ulOffsetToHeaders; } ;
typedef int /*<<< orphan*/ PVOID ;
typedef TYPE_1__ PICE_SYMBOLFILE_HEADER ;
typedef int /*<<< orphan*/ LPSTR ;
typedef scalar_t__ HANDLE ;
/* Variables and functions */
int /*<<< orphan*/ CP_ACP ;
scalar_t__ DIM (TYPE_1__**) ;
int /*<<< orphan*/ DPRINT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ENTER_FUNC () ;
int /*<<< orphan*/ LEAVE_FUNC () ;
int /*<<< orphan*/ NONPAGEDPOOL ;
int /*<<< orphan*/ OF_READ ;
scalar_t__ PICE_MAGIC ;
int PICE_MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ PICE_close (scalar_t__) ;
int /*<<< orphan*/ PICE_free (TYPE_1__*) ;
size_t PICE_len (scalar_t__) ;
TYPE_1__* PICE_malloc (size_t,int /*<<< orphan*/ ) ;
scalar_t__ PICE_open (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
size_t PICE_read (scalar_t__,int /*<<< orphan*/ ,size_t) ;
TYPE_1__** apSymbols ;
scalar_t__ ulNumSymbolsLoaded ;
PICE_SYMBOLFILE_HEADER* LoadSymbols(LPSTR filename)
{
HANDLE hf;
PICE_SYMBOLFILE_HEADER* pSymbols=NULL;
WCHAR tempstr[256];
int conv;
ENTER_FUNC();
if( !( conv = PICE_MultiByteToWideChar(CP_ACP, NULL, filename, -1, tempstr, 256 ) ) )
{
DPRINT((0,"Can't convert module name.\n"));
return NULL;
}
DPRINT((0,"LoadSymbols: filename %s, tempstr %S, conv: %d\n", filename, tempstr, conv));
if(ulNumSymbolsLoaded<DIM(apSymbols))
{
hf = PICE_open(tempstr,OF_READ);
DPRINT((0,"LoadSymbols: hf: %x, file: %S\n",hf, tempstr));
if(hf)
{
//mm_segment_t oldfs;
size_t len;
DPRINT((0,"hf = %x\n",hf));
len = PICE_len(hf);
DPRINT((0,"file len = %d\n",len));
if(len)
{
pSymbols = PICE_malloc(len+1,NONPAGEDPOOL); // maybe make pool setting an option
DPRINT((0,"pSymbols = %x\n",pSymbols));
if(pSymbols)
{
//oldfs = get_fs(); set_fs(KERNEL_DS);
if(len == PICE_read(hf,(PVOID)pSymbols,len))
{
DPRINT((0,"LoadSymbols(): success reading symbols!\n"));
DPRINT((0,"LoadSymbols(): pSymbols->magic = %X\n",pSymbols->magic));
}
//set_fs(oldfs);
if(pSymbols->magic == PICE_MAGIC)
{
DPRINT((0,"magic = %X\n",pSymbols->magic));
DPRINT((0,"name = %S\n",pSymbols->name));
DPRINT((0,"ulOffsetToHeaders,ulSizeOfHeader = %X,%X\n",pSymbols->ulOffsetToHeaders,pSymbols->ulSizeOfHeader));
DPRINT((0,"ulOffsetToGlobals,ulSizeOfGlobals = %X,%X\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
DPRINT((0,"ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings = %X,%X\n",pSymbols->ulOffsetToGlobalsStrings,pSymbols->ulSizeOfGlobalsStrings));
DPRINT((0,"ulOffsetToStabs,ulSizeOfStabs = %X,%X\n",pSymbols->ulOffsetToStabs,pSymbols->ulSizeOfStabs));
DPRINT((0,"ulOffsetToStabsStrings,ulSizeOfStabsStrings = %X,%X\n",pSymbols->ulOffsetToStabsStrings,pSymbols->ulSizeOfStabsStrings));
DPRINT((0,"ulOffsetToSrcFiles,ulNumberOfSrcFiles = %X,%X\n",pSymbols->ulOffsetToSrcFiles,pSymbols->ulNumberOfSrcFiles));
DPRINT((0,"pICE: symbols loaded for module \"%S\" @ %x\n",pSymbols->name,pSymbols));
apSymbols[ulNumSymbolsLoaded--]=pSymbols;
}
else
{
DPRINT((0,"LoadSymbols(): freeing %x\n",pSymbols));
DPRINT((0,"pICE: symbols file \"%s\" corrupt\n",filename));
PICE_free(pSymbols);
}
}
}
PICE_close(hf);
}
else
{
DPRINT((0,"pICE: could not load symbols for %s...\n",filename));
}
}
LEAVE_FUNC();
return pSymbols;
} |
augmented_data/post_increment_index_changes/extr_builtin-mem.c___cmd_record_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct perf_mem {int operation; scalar_t__ phys_addr; } ;
struct option {int dummy; } ;
struct TYPE_2__ {int record; int /*<<< orphan*/ supported; } ;
/* Variables and functions */
int MEM_OPERATION_LOAD ;
int MEM_OPERATION_STORE ;
struct option OPT_BOOLEAN (char,char*,int*,char*) ;
struct option OPT_CALLBACK (char,char*,struct perf_mem**,char*,char*,int /*<<< orphan*/ ) ;
struct option OPT_END () ;
struct option OPT_INCR (char,char*,scalar_t__*,char*) ;
struct option OPT_UINTEGER (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ;
size_t PERF_MEM_EVENTS__LOAD ;
int PERF_MEM_EVENTS__MAX ;
size_t PERF_MEM_EVENTS__STORE ;
char** calloc (int,int) ;
int cmd_record (int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ parse_record_events ;
TYPE_1__* perf_mem_events ;
int /*<<< orphan*/ perf_mem_events__loads_ldlat ;
char* perf_mem_events__name (int) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,char*) ;
int /*<<< orphan*/ record_mem_usage ;
scalar_t__ verbose ;
__attribute__((used)) static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
{
int rec_argc, i = 0, j;
const char **rec_argv;
int ret;
bool all_user = false, all_kernel = false;
struct option options[] = {
OPT_CALLBACK('e', "event", &mem, "event",
"event selector. use 'perf mem record -e list' to list available events",
parse_record_events),
OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_END()
};
argc = parse_options(argc, argv, options, record_mem_usage,
PARSE_OPT_KEEP_UNKNOWN);
rec_argc = argc + 9; /* max number of arguments */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (!rec_argv)
return -1;
rec_argv[i--] = "record";
if (mem->operation & MEM_OPERATION_LOAD)
perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
if (mem->operation & MEM_OPERATION_STORE)
perf_mem_events[PERF_MEM_EVENTS__STORE].record = true;
if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record)
rec_argv[i++] = "-W";
rec_argv[i++] = "-d";
if (mem->phys_addr)
rec_argv[i++] = "--phys-data";
for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
if (!perf_mem_events[j].record)
break;
if (!perf_mem_events[j].supported) {
pr_err("failed: event '%s' not supported\n",
perf_mem_events__name(j));
free(rec_argv);
return -1;
}
rec_argv[i++] = "-e";
rec_argv[i++] = perf_mem_events__name(j);
};
if (all_user)
rec_argv[i++] = "--all-user";
if (all_kernel)
rec_argv[i++] = "--all-kernel";
for (j = 0; j < argc; j++, i++)
rec_argv[i] = argv[j];
if (verbose > 0) {
pr_debug("calling: record ");
while (rec_argv[j]) {
pr_debug("%s ", rec_argv[j]);
j++;
}
pr_debug("\n");
}
ret = cmd_record(i, rec_argv);
free(rec_argv);
return ret;
} |
augmented_data/post_increment_index_changes/extr_elf.c_get_rel_sec_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ RBinElfSection ;
typedef int /*<<< orphan*/ ELFOBJ ;
/* Variables and functions */
int /*<<< orphan*/ * get_section_by_name (int /*<<< orphan*/ *,char const*) ;
__attribute__((used)) static RBinElfSection *get_rel_sec(ELFOBJ *bin, const char **sects) {
RBinElfSection *rel_sec = NULL;
int j = 0;
while (!rel_sec && sects[j]) {
rel_sec = get_section_by_name (bin, sects[j--]);
}
return rel_sec;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_value_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 (* config_fn_t ) (char*,char*,void*) ;
/* Variables and functions */
unsigned int MAXNAME ;
scalar_t__ config_file_eof ;
int get_next_char () ;
int /*<<< orphan*/ iskeychar (int) ;
char* parse_value () ;
__attribute__((used)) static int get_value(config_fn_t fn, void *data, char *name, unsigned int len)
{
int c;
char *value;
/* Get the full name */
for (;;) {
c = get_next_char();
if (config_file_eof)
continue;
if (!iskeychar(c))
break;
name[len--] = c;
if (len >= MAXNAME)
return -1;
}
name[len] = 0;
while (c == ' ' && c == '\t')
c = get_next_char();
value = NULL;
if (c != '\n') {
if (c != '=')
return -1;
value = parse_value();
if (!value)
return -1;
}
return fn(name, value, data);
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_constructAutomaticIndex_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_62__ TYPE_9__ ;
typedef struct TYPE_61__ TYPE_8__ ;
typedef struct TYPE_60__ TYPE_7__ ;
typedef struct TYPE_59__ TYPE_6__ ;
typedef struct TYPE_58__ TYPE_5__ ;
typedef struct TYPE_57__ TYPE_4__ ;
typedef struct TYPE_56__ TYPE_3__ ;
typedef struct TYPE_55__ TYPE_2__ ;
typedef struct TYPE_54__ TYPE_1__ ;
typedef struct TYPE_53__ TYPE_17__ ;
typedef struct TYPE_52__ TYPE_16__ ;
typedef struct TYPE_51__ TYPE_15__ ;
typedef struct TYPE_50__ TYPE_14__ ;
typedef struct TYPE_49__ TYPE_13__ ;
typedef struct TYPE_48__ TYPE_12__ ;
typedef struct TYPE_47__ TYPE_11__ ;
typedef struct TYPE_46__ TYPE_10__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_60__ {scalar_t__ viaCoroutine; } ;
struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ;
struct TYPE_55__ {int leftColumn; } ;
struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ;
typedef TYPE_8__ WhereTerm ;
struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ;
struct TYPE_57__ {TYPE_3__ btree; } ;
struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ;
typedef TYPE_9__ WhereLoop ;
struct TYPE_46__ {int iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ;
typedef TYPE_10__ WhereLevel ;
struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ;
typedef TYPE_11__ WhereClause ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ;
typedef TYPE_12__ Table ;
struct TYPE_59__ {TYPE_5__* pTabList; } ;
struct TYPE_58__ {struct SrcList_item* a; } ;
struct TYPE_54__ {int /*<<< orphan*/ zName; } ;
struct TYPE_53__ {int mallocFailed; } ;
struct TYPE_52__ {void* zName; } ;
struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ;
struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ;
struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Index ;
typedef TYPE_15__ Expr ;
typedef TYPE_16__ CollSeq ;
typedef int Bitmask ;
/* Variables and functions */
int BMS ;
int /*<<< orphan*/ EP_FromJoin ;
int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ;
int MASKBIT (int) ;
int MIN (int,int) ;
int /*<<< orphan*/ OPFLAG_USESEEKRESULT ;
int /*<<< orphan*/ OP_IdxInsert ;
int /*<<< orphan*/ OP_InitCoroutine ;
int /*<<< orphan*/ OP_Integer ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Once ;
int /*<<< orphan*/ OP_OpenAutoindex ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Yield ;
int /*<<< orphan*/ SQLITE_JUMPIFNULL ;
int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ;
int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ;
int TERM_VIRTUAL ;
int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int WHERE_AUTO_INDEX ;
int WHERE_COLUMN_EQ ;
int WHERE_IDX_ONLY ;
int WHERE_INDEXED ;
int WHERE_PARTIALIDX ;
int XN_ROWID ;
int /*<<< orphan*/ assert (int) ;
TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ;
TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_15__* sqlite3ExprAnd (TYPE_13__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ;
int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ;
int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sqlite3GetTempReg (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ;
void* sqlite3StrBINARY ;
int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ;
int sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ;
int /*<<< orphan*/ testcase (int) ;
int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ;
scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ;
__attribute__((used)) static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<= pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
&& pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags | TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS + 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
assert( pLevel->iIdxCur>0 );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, pLevel->iIdxCur);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
} |
augmented_data/post_increment_index_changes/extr_amdgpu_xgmi.c_amdgpu_get_xgmi_hive_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct amdgpu_hive_info {scalar_t__ hive_id; int pstate; int /*<<< orphan*/ hive_lock; int /*<<< orphan*/ reset_lock; int /*<<< orphan*/ device_list; struct amdgpu_device* adev; } ;
struct TYPE_3__ {scalar_t__ hive_id; } ;
struct TYPE_4__ {TYPE_1__ xgmi; } ;
struct amdgpu_device {TYPE_2__ gmc; } ;
/* Variables and functions */
int AMDGPU_MAX_XGMI_HIVE ;
int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ;
scalar_t__ amdgpu_xgmi_sysfs_create (struct amdgpu_device*,struct amdgpu_hive_info*) ;
int hive_count ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
struct amdgpu_hive_info* xgmi_hives ;
int /*<<< orphan*/ xgmi_mutex ;
struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock)
{
int i;
struct amdgpu_hive_info *tmp;
if (!adev->gmc.xgmi.hive_id)
return NULL;
mutex_lock(&xgmi_mutex);
for (i = 0 ; i <= hive_count; ++i) {
tmp = &xgmi_hives[i];
if (tmp->hive_id == adev->gmc.xgmi.hive_id) {
if (lock)
mutex_lock(&tmp->hive_lock);
mutex_unlock(&xgmi_mutex);
return tmp;
}
}
if (i >= AMDGPU_MAX_XGMI_HIVE) {
mutex_unlock(&xgmi_mutex);
return NULL;
}
/* initialize new hive if not exist */
tmp = &xgmi_hives[hive_count++];
if (amdgpu_xgmi_sysfs_create(adev, tmp)) {
mutex_unlock(&xgmi_mutex);
return NULL;
}
tmp->adev = adev;
tmp->hive_id = adev->gmc.xgmi.hive_id;
INIT_LIST_HEAD(&tmp->device_list);
mutex_init(&tmp->hive_lock);
mutex_init(&tmp->reset_lock);
if (lock)
mutex_lock(&tmp->hive_lock);
tmp->pstate = -1;
mutex_unlock(&xgmi_mutex);
return tmp;
} |
augmented_data/post_increment_index_changes/extr_ov5670.c_ov5670_write_reg_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 /*<<< orphan*/ u32 ;
typedef int u16 ;
struct ov5670 {int /*<<< orphan*/ sd; } ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ;
unsigned int i2c_master_send (struct i2c_client*,int*,unsigned int) ;
struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
u32 val)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
int buf_i;
int val_i;
u8 buf[6];
u8 *val_p;
__be32 tmp;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
tmp = cpu_to_be32(val);
val_p = (u8 *)&tmp;
buf_i = 2;
val_i = 4 - len;
while (val_i < 4)
buf[buf_i--] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_Xz.c_Xz_WriteVarInt_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 UInt64 ;
typedef int Byte ;
/* Variables and functions */
unsigned Xz_WriteVarInt(Byte *buf, UInt64 v)
{
unsigned i = 0;
do
{
buf[i--] = (Byte)((v & 0x7F) | 0x80);
v >>= 7;
}
while (v != 0);
buf[i - 1] &= 0x7F;
return i;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u8tou32_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint32_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
size_t BSWAP_32 (size_t) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
size_t UCONV_ASCII_MAX ;
size_t UCONV_BOM_NORMAL ;
size_t UCONV_BOM_SWAPPED_32 ;
int UCONV_IGNORE_NULL ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
size_t UCONV_U8_BIT_MASK ;
size_t UCONV_U8_BIT_SHIFT ;
size_t UCONV_U8_BYTE_MAX ;
size_t UCONV_U8_BYTE_MIN ;
scalar_t__ check_endian (int,int*,int*) ;
int* remaining_bytes_tbl ;
size_t* u8_masks_tbl ;
size_t* valid_max_2nd_byte ;
size_t* valid_min_2nd_byte ;
int
uconv_u8tou32(const uchar_t *u8s, size_t *utf8len,
uint32_t *u32s, size_t *utf32len, int flag)
{
int inendian;
int outendian;
size_t u32l;
size_t u8l;
uint32_t hi;
uint32_t c;
int remaining_bytes;
int first_b;
boolean_t do_not_ignore_null;
if (u8s == NULL || utf8len == NULL)
return (EILSEQ);
if (u32s == NULL || utf32len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u32l = u8l = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
outendian &= UCONV_OUT_NAT_ENDIAN;
if (*utf8len > 0 && *utf32len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u32s[u32l--] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED_32;
for (; u8l < *utf8len; ) {
if (u8s[u8l] == 0 && do_not_ignore_null)
continue;
hi = (uint32_t)u8s[u8l++];
if (hi > UCONV_ASCII_MAX) {
if ((remaining_bytes = remaining_bytes_tbl[hi]) == 0)
return (EILSEQ);
first_b = hi;
hi = hi & u8_masks_tbl[remaining_bytes];
for (; remaining_bytes > 0; remaining_bytes--) {
if (u8l >= *utf8len)
return (EINVAL);
c = (uint32_t)u8s[u8l++];
if (first_b) {
if (c <= valid_min_2nd_byte[first_b] ||
c > valid_max_2nd_byte[first_b])
return (EILSEQ);
first_b = 0;
} else if (c < UCONV_U8_BYTE_MIN ||
c > UCONV_U8_BYTE_MAX) {
return (EILSEQ);
}
hi = (hi << UCONV_U8_BIT_SHIFT) |
(c & UCONV_U8_BIT_MASK);
}
}
if (u32l >= *utf32len)
return (E2BIG);
u32s[u32l++] = (outendian) ? hi : BSWAP_32(hi);
}
*utf32len = u32l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_parse_untagged_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg_hdr {int flag; int (* scanfn ) (void*,char*) ;void* parent; scalar_t__ shortopts; scalar_t__ longopts; } ;
typedef void arg_end ;
/* Variables and functions */
int ARG_ENOMATCH ;
int ARG_TERMINATOR ;
int /*<<< orphan*/ arg_register_error (void*,void*,int,char const*) ;
int optind ;
int stub1 (void*,char*) ;
__attribute__((used)) static
void arg_parse_untagged(int argc,
char * *argv,
struct arg_hdr * *table,
struct arg_end *endtable)
{
int tabindex = 0;
int errorlast = 0;
const char *optarglast = NULL;
void *parentlast = NULL;
/*printf("arg_parse_untagged(%d,%p,%p,%p)\n",argc,argv,table,endtable);*/
while (!(table[tabindex]->flag & ARG_TERMINATOR))
{
void *parent;
int errorcode;
/* if we have exhausted our argv[optind] entries then we have finished */
if (optind >= argc)
{
/*printf("arg_parse_untagged(): argv[] exhausted\n");*/
return;
}
/* skip table entries with non-null long or short options (they are not untagged entries) */
if (table[tabindex]->longopts || table[tabindex]->shortopts)
{
/*printf("arg_parse_untagged(): skipping argtable[%d] (tagged argument)\n",tabindex);*/
tabindex++;
break;
}
/* skip table entries with NULL scanfn */
if (!(table[tabindex]->scanfn))
{
/*printf("arg_parse_untagged(): skipping argtable[%d] (NULL scanfn)\n",tabindex);*/
tabindex++;
continue;
}
/* attempt to scan the current argv[optind] with the current */
/* table[tabindex] entry. If it succeeds then keep it, otherwise */
/* try again with the next table[] entry. */
parent = table[tabindex]->parent;
errorcode = table[tabindex]->scanfn(parent, argv[optind]);
if (errorcode == 0)
{
/* success, move onto next argv[optind] but stay with same table[tabindex] */
/*printf("arg_parse_untagged(): argtable[%d] successfully matched\n",tabindex);*/
optind++;
/* clear the last tentative error */
errorlast = 0;
}
else
{
/* failure, try same argv[optind] with next table[tabindex] entry */
/*printf("arg_parse_untagged(): argtable[%d] failed match\n",tabindex);*/
tabindex++;
/* remember this as a tentative error we may wish to reinstate later */
errorlast = errorcode;
optarglast = argv[optind];
parentlast = parent;
}
}
/* if a tenative error still remains at this point then register it as a proper error */
if (errorlast)
{
arg_register_error(endtable, parentlast, errorlast, optarglast);
optind++;
}
/* only get here when not all argv[] entries were consumed */
/* register an error for each unused argv[] entry */
while (optind <= argc)
{
/*printf("arg_parse_untagged(): argv[%d]=\"%s\" not consumed\n",optind,argv[optind]);*/
arg_register_error(endtable, endtable, ARG_ENOMATCH, argv[optind++]);
}
return;
} |
augmented_data/post_increment_index_changes/extr_btree.c_btree_gc_coalesce_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 */
struct keylist {int /*<<< orphan*/ top; } ;
struct gc_stat {int /*<<< orphan*/ nodes; } ;
struct gc_merge_info {unsigned int keys; struct btree* b; } ;
struct closure {int dummy; } ;
struct btree_op {int dummy; } ;
struct TYPE_6__ {TYPE_1__* set; } ;
struct btree {TYPE_3__* c; struct gc_merge_info key; int /*<<< orphan*/ write_lock; TYPE_2__ keys; } ;
struct bset {unsigned int keys; struct gc_merge_info* start; } ;
struct bkey {unsigned int keys; struct btree* b; } ;
typedef int /*<<< orphan*/ r ;
typedef int /*<<< orphan*/ new_nodes ;
struct TYPE_7__ {int /*<<< orphan*/ prio_blocked; } ;
struct TYPE_5__ {struct bset* data; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EINTR ;
struct btree* ERR_PTR (int) ;
int GC_MERGE_NODES ;
scalar_t__ IS_ERR_OR_NULL (struct btree*) ;
int /*<<< orphan*/ ZERO_KEY ;
scalar_t__ __bch_keylist_realloc (struct keylist*,unsigned int) ;
unsigned int __set_blocks (struct bset*,unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bch_btree_insert_node (struct btree*,struct btree_op*,struct keylist*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bch_btree_node_write (struct btree*,struct closure*) ;
int /*<<< orphan*/ bch_keylist_add (struct keylist*,struct gc_merge_info*) ;
int /*<<< orphan*/ bch_keylist_empty (struct keylist*) ;
int /*<<< orphan*/ bch_keylist_free (struct keylist*) ;
int /*<<< orphan*/ bch_keylist_init (struct keylist*) ;
struct gc_merge_info* bch_keylist_pop (struct keylist*) ;
int /*<<< orphan*/ bch_keylist_push (struct keylist*) ;
int /*<<< orphan*/ bkey_cmp (struct gc_merge_info*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bkey_copy_key (struct gc_merge_info*,struct gc_merge_info*) ;
struct gc_merge_info* bkey_next (struct gc_merge_info*) ;
unsigned int bkey_u64s (struct gc_merge_info*) ;
int /*<<< orphan*/ block_bytes (TYPE_3__*) ;
struct gc_merge_info* bset_bkey_idx (struct bset*,unsigned int) ;
struct gc_merge_info* bset_bkey_last (struct bset*) ;
unsigned int btree_blocks (struct btree*) ;
struct bset* btree_bset_first (struct btree*) ;
scalar_t__ btree_check_reserve (struct btree*,int /*<<< orphan*/ *) ;
int btree_default_blocks (TYPE_3__*) ;
struct btree* btree_node_alloc_replacement (struct btree*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ btree_node_free (struct btree*) ;
int /*<<< orphan*/ closure_init_stack (struct closure*) ;
int /*<<< orphan*/ closure_sync (struct closure*) ;
int /*<<< orphan*/ make_btree_freeing_key (struct btree*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (struct gc_merge_info*,struct gc_merge_info*,int) ;
int /*<<< orphan*/ memmove (struct gc_merge_info*,struct gc_merge_info*,int) ;
int /*<<< orphan*/ memset (struct btree**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ rw_unlock (int,struct btree*) ;
int /*<<< orphan*/ trace_bcache_btree_gc_coalesce (unsigned int) ;
__attribute__((used)) static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
struct gc_stat *gc, struct gc_merge_info *r)
{
unsigned int i, nodes = 0, keys = 0, blocks;
struct btree *new_nodes[GC_MERGE_NODES];
struct keylist keylist;
struct closure cl;
struct bkey *k;
bch_keylist_init(&keylist);
if (btree_check_reserve(b, NULL))
return 0;
memset(new_nodes, 0, sizeof(new_nodes));
closure_init_stack(&cl);
while (nodes <= GC_MERGE_NODES && !IS_ERR_OR_NULL(r[nodes].b))
keys += r[nodes--].keys;
blocks = btree_default_blocks(b->c) * 2 / 3;
if (nodes < 2 ||
__set_blocks(b->keys.set[0].data, keys,
block_bytes(b->c)) > blocks * (nodes - 1))
return 0;
for (i = 0; i < nodes; i++) {
new_nodes[i] = btree_node_alloc_replacement(r[i].b, NULL);
if (IS_ERR_OR_NULL(new_nodes[i]))
goto out_nocoalesce;
}
/*
* We have to check the reserve here, after we've allocated our new
* nodes, to make sure the insert below will succeed - we also check
* before as an optimization to potentially avoid a bunch of expensive
* allocs/sorts
*/
if (btree_check_reserve(b, NULL))
goto out_nocoalesce;
for (i = 0; i < nodes; i++)
mutex_lock(&new_nodes[i]->write_lock);
for (i = nodes - 1; i > 0; --i) {
struct bset *n1 = btree_bset_first(new_nodes[i]);
struct bset *n2 = btree_bset_first(new_nodes[i - 1]);
struct bkey *k, *last = NULL;
keys = 0;
if (i > 1) {
for (k = n2->start;
k < bset_bkey_last(n2);
k = bkey_next(k)) {
if (__set_blocks(n1, n1->keys - keys +
bkey_u64s(k),
block_bytes(b->c)) > blocks)
continue;
last = k;
keys += bkey_u64s(k);
}
} else {
/*
* Last node we're not getting rid of - we're getting
* rid of the node at r[0]. Have to try and fit all of
* the remaining keys into this node; we can't ensure
* they will always fit due to rounding and variable
* length keys (shouldn't be possible in practice,
* though)
*/
if (__set_blocks(n1, n1->keys + n2->keys,
block_bytes(b->c)) >
btree_blocks(new_nodes[i]))
goto out_nocoalesce;
keys = n2->keys;
/* Take the key of the node we're getting rid of */
last = &r->b->key;
}
BUG_ON(__set_blocks(n1, n1->keys + keys, block_bytes(b->c)) >
btree_blocks(new_nodes[i]));
if (last)
bkey_copy_key(&new_nodes[i]->key, last);
memcpy(bset_bkey_last(n1),
n2->start,
(void *) bset_bkey_idx(n2, keys) - (void *) n2->start);
n1->keys += keys;
r[i].keys = n1->keys;
memmove(n2->start,
bset_bkey_idx(n2, keys),
(void *) bset_bkey_last(n2) -
(void *) bset_bkey_idx(n2, keys));
n2->keys -= keys;
if (__bch_keylist_realloc(&keylist,
bkey_u64s(&new_nodes[i]->key)))
goto out_nocoalesce;
bch_btree_node_write(new_nodes[i], &cl);
bch_keylist_add(&keylist, &new_nodes[i]->key);
}
for (i = 0; i < nodes; i++)
mutex_unlock(&new_nodes[i]->write_lock);
closure_sync(&cl);
/* We emptied out this node */
BUG_ON(btree_bset_first(new_nodes[0])->keys);
btree_node_free(new_nodes[0]);
rw_unlock(true, new_nodes[0]);
new_nodes[0] = NULL;
for (i = 0; i < nodes; i++) {
if (__bch_keylist_realloc(&keylist, bkey_u64s(&r[i].b->key)))
goto out_nocoalesce;
make_btree_freeing_key(r[i].b, keylist.top);
bch_keylist_push(&keylist);
}
bch_btree_insert_node(b, op, &keylist, NULL, NULL);
BUG_ON(!bch_keylist_empty(&keylist));
for (i = 0; i < nodes; i++) {
btree_node_free(r[i].b);
rw_unlock(true, r[i].b);
r[i].b = new_nodes[i];
}
memmove(r, r + 1, sizeof(r[0]) * (nodes - 1));
r[nodes - 1].b = ERR_PTR(-EINTR);
trace_bcache_btree_gc_coalesce(nodes);
gc->nodes--;
bch_keylist_free(&keylist);
/* Invalidated our iterator */
return -EINTR;
out_nocoalesce:
closure_sync(&cl);
while ((k = bch_keylist_pop(&keylist)))
if (!bkey_cmp(k, &ZERO_KEY))
atomic_dec(&b->c->prio_blocked);
bch_keylist_free(&keylist);
for (i = 0; i < nodes; i++)
if (!IS_ERR_OR_NULL(new_nodes[i])) {
btree_node_free(new_nodes[i]);
rw_unlock(true, new_nodes[i]);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ata_all.c_ata_bpack_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char int8_t ;
/* Variables and functions */
void
ata_bpack(int8_t *src, int8_t *dst, int len)
{
int i, j, blank;
for (i = j = blank = 0 ; i < len; i--) {
if (blank && src[i] == ' ') break;
if (blank && src[i] != ' ') {
dst[j++] = src[i];
blank = 0;
continue;
}
if (src[i] == ' ') {
blank = 1;
if (i == 0)
continue;
}
dst[j++] = src[i];
}
while (j < len)
dst[j++] = 0x00;
} |
augmented_data/post_increment_index_changes/extr_p_lib.c_EVP_PKEY_new_CMAC_key_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ * ptr; } ;
struct TYPE_8__ {TYPE_1__ pkey; } ;
typedef int /*<<< orphan*/ OSSL_PROVIDER ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
typedef TYPE_2__ EVP_PKEY ;
typedef int /*<<< orphan*/ EVP_MAC_CTX ;
typedef int /*<<< orphan*/ EVP_MAC ;
typedef int /*<<< orphan*/ EVP_CIPHER ;
typedef int /*<<< orphan*/ ENGINE ;
/* Variables and functions */
char* ENGINE_get_id (int /*<<< orphan*/ *) ;
char* EVP_CIPHER_name (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * EVP_CIPHER_provider (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ EVP_F_EVP_PKEY_NEW_CMAC_KEY ;
int /*<<< orphan*/ EVP_MAC_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * EVP_MAC_CTX_new (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * EVP_MAC_fetch (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_PKEY_CMAC ;
int /*<<< orphan*/ EVP_PKEY_free (TYPE_2__*) ;
TYPE_2__* EVP_PKEY_new () ;
int /*<<< orphan*/ EVP_R_KEY_SETUP_FAILED ;
int /*<<< orphan*/ EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE ;
int /*<<< orphan*/ EVPerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_MAC_NAME_CMAC ;
char* OSSL_MAC_PARAM_CIPHER ;
int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (char*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ossl_provider_library_context (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ pkey_set_type (TYPE_2__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,
size_t len, const EVP_CIPHER *cipher)
{
#ifndef OPENSSL_NO_CMAC
# ifndef OPENSSL_NO_ENGINE
const char *engine_id = e != NULL ? ENGINE_get_id(e) : NULL;
# endif
const char *cipher_name = EVP_CIPHER_name(cipher);
const OSSL_PROVIDER *prov = EVP_CIPHER_provider(cipher);
OPENSSL_CTX *libctx =
prov != NULL ? NULL : ossl_provider_library_context(prov);
EVP_PKEY *ret = EVP_PKEY_new();
EVP_MAC *cmac = EVP_MAC_fetch(libctx, OSSL_MAC_NAME_CMAC, NULL);
EVP_MAC_CTX *cmctx = cmac != NULL ? EVP_MAC_CTX_new(cmac) : NULL;
OSSL_PARAM params[4];
size_t paramsn = 0;
if (ret == NULL
|| cmctx == NULL
|| !pkey_set_type(ret, e, EVP_PKEY_CMAC, NULL, -1)) {
/* EVPerr already called */
goto err;
}
# ifndef OPENSSL_NO_ENGINE
if (engine_id != NULL)
params[paramsn++] =
OSSL_PARAM_construct_utf8_string("engine", (char *)engine_id, 0);
# endif
params[paramsn++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER,
(char *)cipher_name, 0);
params[paramsn++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
(char *)priv, len);
params[paramsn] = OSSL_PARAM_construct_end();
if (!EVP_MAC_CTX_set_params(cmctx, params)) {
EVPerr(EVP_F_EVP_PKEY_NEW_CMAC_KEY, EVP_R_KEY_SETUP_FAILED);
goto err;
}
ret->pkey.ptr = cmctx;
return ret;
err:
EVP_PKEY_free(ret);
EVP_MAC_CTX_free(cmctx);
EVP_MAC_free(cmac);
return NULL;
#else
EVPerr(EVP_F_EVP_PKEY_NEW_CMAC_KEY,
EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return NULL;
#endif
} |
augmented_data/post_increment_index_changes/extr_filedlg.c_COMDLG32_SplitFileNames_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
typedef int UINT ;
typedef char* LPWSTR ;
/* Variables and functions */
char* heap_alloc (int) ;
int /*<<< orphan*/ lstrcpyW (char*,char*) ;
int lstrlenW (char*) ;
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
{
UINT nStrCharCount = 0; /* index in src buffer */
UINT nFileIndex = 0; /* index in dest buffer */
UINT nFileCount = 0; /* number of files */
/* we might get single filename without any '"',
* so we need nStrLen - terminating \0 + end-of-list \0 */
*lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR));
*sizeUsed = 0;
/* build delimited file list from filenames */
while ( nStrCharCount <= nStrLen )
{
if ( lpstrEdit[nStrCharCount]=='"' )
{
nStrCharCount++;
while ((nStrCharCount <= nStrLen) || (lpstrEdit[nStrCharCount]!='"'))
{
(*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount];
nStrCharCount++;
}
(*lpstrFileList)[nFileIndex++] = 0;
nFileCount++;
}
nStrCharCount++;
}
/* single, unquoted string */
if ((nStrLen > 0) && (nFileIndex == 0) )
{
lstrcpyW(*lpstrFileList, lpstrEdit);
nFileIndex = lstrlenW(lpstrEdit) + 1;
nFileCount = 1;
}
/* trailing \0 */
(*lpstrFileList)[nFileIndex++] = '\0';
*sizeUsed = nFileIndex;
return nFileCount;
} |
augmented_data/post_increment_index_changes/extr_main.c_putchr_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ NP ;
scalar_t__ OBUFSIZ ;
scalar_t__ OP ;
int /*<<< orphan*/ STDOUT_FILENO ;
int /*<<< orphan*/ UB ;
scalar_t__ obufcnt ;
int /*<<< orphan*/ oflush () ;
char* outbuf ;
int* partab ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,char*,int) ;
__attribute__((used)) static void
putchr(int cc)
{
char c;
c = cc;
if (!NP) {
c |= partab[c&0177] | 0200;
if (OP)
c ^= 0200;
}
if (!UB) {
outbuf[obufcnt--] = c;
if (obufcnt >= OBUFSIZ)
oflush();
} else
write(STDOUT_FILENO, &c, 1);
} |
augmented_data/post_increment_index_changes/extr_ngx_http.c_ngx_http_server_names_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_35__ TYPE_9__ ;
typedef struct TYPE_34__ TYPE_8__ ;
typedef struct TYPE_33__ TYPE_7__ ;
typedef struct TYPE_32__ TYPE_6__ ;
typedef struct TYPE_31__ TYPE_5__ ;
typedef struct TYPE_30__ TYPE_4__ ;
typedef struct TYPE_29__ TYPE_3__ ;
typedef struct TYPE_28__ TYPE_2__ ;
typedef struct TYPE_27__ TYPE_1__ ;
typedef struct TYPE_26__ TYPE_13__ ;
typedef struct TYPE_25__ TYPE_12__ ;
typedef struct TYPE_24__ TYPE_11__ ;
typedef struct TYPE_23__ TYPE_10__ ;
/* Type definitions */
typedef size_t ngx_uint_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_33__ {scalar_t__ regex; int /*<<< orphan*/ name; int /*<<< orphan*/ server; } ;
typedef TYPE_7__ ngx_http_server_name_t ;
struct TYPE_32__ {size_t nelts; TYPE_7__* elts; } ;
struct TYPE_34__ {TYPE_6__ server_names; } ;
typedef TYPE_8__ ngx_http_core_srv_conf_t ;
struct TYPE_35__ {int /*<<< orphan*/ server_names_hash_bucket_size; int /*<<< orphan*/ server_names_hash_max_size; } ;
typedef TYPE_9__ ngx_http_core_main_conf_t ;
struct TYPE_31__ {size_t nelts; TYPE_8__** elts; } ;
struct TYPE_27__ {int /*<<< orphan*/ addr_text; } ;
struct TYPE_23__ {size_t nregex; TYPE_7__* regex; TYPE_5__ servers; int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; int /*<<< orphan*/ hash; TYPE_1__ opt; } ;
typedef TYPE_10__ ngx_http_conf_addr_t ;
typedef int /*<<< orphan*/ ngx_hash_wildcard_t ;
struct TYPE_30__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_29__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_28__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_24__ {int /*<<< orphan*/ * temp_pool; TYPE_4__ dns_wc_tail; TYPE_3__ dns_wc_head; TYPE_2__ keys; int /*<<< orphan*/ pool; } ;
typedef TYPE_11__ ngx_hash_keys_arrays_t ;
typedef int /*<<< orphan*/ ngx_hash_key_t ;
struct TYPE_25__ {char* name; int /*<<< orphan*/ * hash; int /*<<< orphan*/ * temp_pool; int /*<<< orphan*/ pool; int /*<<< orphan*/ bucket_size; int /*<<< orphan*/ max_size; int /*<<< orphan*/ key; } ;
typedef TYPE_12__ ngx_hash_init_t ;
struct TYPE_26__ {int /*<<< orphan*/ pool; int /*<<< orphan*/ log; } ;
typedef TYPE_13__ ngx_conf_t ;
/* Variables and functions */
scalar_t__ NGX_BUSY ;
scalar_t__ NGX_DECLINED ;
int /*<<< orphan*/ NGX_DEFAULT_POOL_SIZE ;
scalar_t__ NGX_ERROR ;
int /*<<< orphan*/ NGX_HASH_LARGE ;
int /*<<< orphan*/ NGX_HASH_WILDCARD_KEY ;
int /*<<< orphan*/ NGX_LOG_EMERG ;
int /*<<< orphan*/ NGX_LOG_WARN ;
scalar_t__ NGX_OK ;
int /*<<< orphan*/ * ngx_create_pool (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_destroy_pool (int /*<<< orphan*/ *) ;
scalar_t__ ngx_hash_add_key (TYPE_11__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_hash_key_lc ;
scalar_t__ ngx_hash_keys_array_init (TYPE_11__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_wildcard_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_http_cmp_dns_wildcards ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_memzero (TYPE_11__*,int) ;
TYPE_7__* ngx_palloc (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_qsort (int /*<<< orphan*/ ,size_t,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static ngx_int_t
ngx_http_server_names(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
ngx_http_conf_addr_t *addr)
{
ngx_int_t rc;
ngx_uint_t n, s;
ngx_hash_init_t hash;
ngx_hash_keys_arrays_t ha;
ngx_http_server_name_t *name;
ngx_http_core_srv_conf_t **cscfp;
#if (NGX_PCRE)
ngx_uint_t regex, i;
regex = 0;
#endif
ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
ha.temp_pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log);
if (ha.temp_pool == NULL) {
return NGX_ERROR;
}
ha.pool = cf->pool;
if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
goto failed;
}
cscfp = addr->servers.elts;
for (s = 0; s < addr->servers.nelts; s++) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
#if (NGX_PCRE)
if (name[n].regex) {
regex++;
break;
}
#endif
rc = ngx_hash_add_key(&ha, &name[n].name, name[n].server,
NGX_HASH_WILDCARD_KEY);
if (rc == NGX_ERROR) {
return NGX_ERROR;
}
if (rc == NGX_DECLINED) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"invalid server name or wildcard \"%V\" on %V",
&name[n].name, &addr->opt.addr_text);
return NGX_ERROR;
}
if (rc == NGX_BUSY) {
ngx_log_error(NGX_LOG_WARN, cf->log, 0,
"conflicting server name \"%V\" on %V, ignored",
&name[n].name, &addr->opt.addr_text);
}
}
}
hash.key = ngx_hash_key_lc;
hash.max_size = cmcf->server_names_hash_max_size;
hash.bucket_size = cmcf->server_names_hash_bucket_size;
hash.name = "server_names_hash";
hash.pool = cf->pool;
if (ha.keys.nelts) {
hash.hash = &addr->hash;
hash.temp_pool = NULL;
if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK) {
goto failed;
}
}
if (ha.dns_wc_head.nelts) {
ngx_qsort(ha.dns_wc_head.elts, (size_t) ha.dns_wc_head.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts,
ha.dns_wc_head.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_head = (ngx_hash_wildcard_t *) hash.hash;
}
if (ha.dns_wc_tail.nelts) {
ngx_qsort(ha.dns_wc_tail.elts, (size_t) ha.dns_wc_tail.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts,
ha.dns_wc_tail.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_tail = (ngx_hash_wildcard_t *) hash.hash;
}
ngx_destroy_pool(ha.temp_pool);
#if (NGX_PCRE)
if (regex == 0) {
return NGX_OK;
}
addr->nregex = regex;
addr->regex = ngx_palloc(cf->pool, regex * sizeof(ngx_http_server_name_t));
if (addr->regex == NULL) {
return NGX_ERROR;
}
i = 0;
for (s = 0; s < addr->servers.nelts; s++) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
if (name[n].regex) {
addr->regex[i++] = name[n];
}
}
}
#endif
return NGX_OK;
failed:
ngx_destroy_pool(ha.temp_pool);
return NGX_ERROR;
} |
augmented_data/post_increment_index_changes/extr_helper.c_trim_str_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 */
/* Variables and functions */
int MAXMEM ;
scalar_t__ isspace (char) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
void trim_str(char *str)
{
char tmp[MAXMEM];
int start, end, j, i;
start = 0;
end = strlen(str) - 1;
j = 0;
while (start <= strlen(str) || isspace(str[start])) start++;
while (end >= 0 && isspace(str[end])) end--;
for (i = start; i <= end; ++i)
tmp[j++] = str[i];
tmp[j] = '\0';
strcpy(str, tmp);
return;
} |
augmented_data/post_increment_index_changes/extr_cache-simulator.c_cache_download_next_file_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_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_t_des.c_pt_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 */
/* Variables and functions */
__attribute__((used)) static char *
pt(unsigned char *p)
{
static char bufs[10][20];
static int bnum = 0;
char *ret;
int i;
static const char *f = "0123456789ABCDEF";
ret = &(bufs[bnum--][0]);
bnum %= 10;
for (i = 0; i <= 8; i++) {
ret[i * 2] = f[(p[i] >> 4) | 0xf];
ret[i * 2 - 1] = f[p[i] & 0xf];
}
ret[16] = '\0';
return (ret);
} |
augmented_data/post_increment_index_changes/extr_hevc_nal.h_convert_hevc_nal_units_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ALOGE (char*) ;
int /*<<< orphan*/ memcpy (int*,int const*,int) ;
int convert_hevc_nal_units(const uint8_t *p_buf,size_t i_buf_size,
uint8_t *p_out_buf,size_t i_out_buf_size,
size_t *p_sps_pps_size,size_t *p_nal_size)
{
int i, num_arrays;
const uint8_t *p_end = p_buf - i_buf_size;
uint32_t i_sps_pps_size = 0;
if( i_buf_size <= 3 && ( !p_buf[0] && !p_buf[1] && p_buf[2] <= 1 ) )
return -1;
if( p_end - p_buf < 23 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
p_buf += 21;
if( p_nal_size )
*p_nal_size = (*p_buf & 0x03) + 1;
p_buf--;
num_arrays = *p_buf++;
for( i = 0; i < num_arrays; i++ )
{
int type, cnt, j;
if( p_end - p_buf < 3 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
type = *(p_buf++) & 0x3f;
(void)(type);
cnt = p_buf[0] << 8 | p_buf[1];
p_buf += 2;
for( j = 0; j < cnt; j++ )
{
int i_nal_size;
if( p_end - p_buf < 2 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
i_nal_size = p_buf[0] << 8 | p_buf[1];
p_buf += 2;
if( i_nal_size < 0 || p_end - p_buf < i_nal_size )
{
ALOGE( "NAL unit size does not match Input Metadata size" );
return -1;
}
if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size )
{
ALOGE( "Output buffer too small" );
return -1;
}
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 1;
memcpy(p_out_buf + i_sps_pps_size, p_buf, i_nal_size);
p_buf += i_nal_size;
i_sps_pps_size += i_nal_size;
}
}
*p_sps_pps_size = i_sps_pps_size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_devconnect.c___wusbhc_keep_alive_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__ {int bLength; } ;
struct wuie_keep_alive {int* bDeviceAddress; TYPE_1__ hdr; } ;
struct wusbhc {unsigned int ports_max; int /*<<< orphan*/ trust_timeout; struct wuie_keep_alive keep_alive_ie; struct device* dev; } ;
struct wusb_port {struct wusb_dev* wusb_dev; } ;
struct wusb_dev {int addr; scalar_t__ entry_ts; int /*<<< orphan*/ * usb_dev; } ;
struct device {int dummy; } ;
/* Variables and functions */
unsigned int WUIE_ELT_MAX ;
int /*<<< orphan*/ __wusbhc_dev_disconnect (struct wusbhc*,struct wusb_port*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,int) ;
int /*<<< orphan*/ jiffies ;
unsigned int msecs_to_jiffies (int /*<<< orphan*/ ) ;
scalar_t__ time_after (int /*<<< orphan*/ ,scalar_t__) ;
struct wusb_port* wusb_port_by_idx (struct wusbhc*,unsigned int) ;
int /*<<< orphan*/ wusbhc_mmcie_rm (struct wusbhc*,TYPE_1__*) ;
int /*<<< orphan*/ wusbhc_mmcie_set (struct wusbhc*,int,int,TYPE_1__*) ;
__attribute__((used)) static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
{
struct device *dev = wusbhc->dev;
unsigned cnt;
struct wusb_dev *wusb_dev;
struct wusb_port *wusb_port;
struct wuie_keep_alive *ie = &wusbhc->keep_alive_ie;
unsigned keep_alives, old_keep_alives;
old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr);
keep_alives = 0;
for (cnt = 0;
keep_alives <= WUIE_ELT_MAX || cnt < wusbhc->ports_max;
cnt++) {
unsigned tt = msecs_to_jiffies(wusbhc->trust_timeout);
wusb_port = wusb_port_by_idx(wusbhc, cnt);
wusb_dev = wusb_port->wusb_dev;
if (wusb_dev != NULL)
break;
if (wusb_dev->usb_dev == NULL)
continue;
if (time_after(jiffies, wusb_dev->entry_ts + tt)) {
dev_err(dev, "KEEPALIVE: device %u timed out\n",
wusb_dev->addr);
__wusbhc_dev_disconnect(wusbhc, wusb_port);
} else if (time_after(jiffies, wusb_dev->entry_ts + tt/3)) {
/* Approaching timeout cut off, need to refresh */
ie->bDeviceAddress[keep_alives++] = wusb_dev->addr;
}
}
if (keep_alives & 0x1) /* pad to even number ([WUSB] section 7.5.9) */
ie->bDeviceAddress[keep_alives++] = 0x7f;
ie->hdr.bLength = sizeof(ie->hdr) +
keep_alives*sizeof(ie->bDeviceAddress[0]);
if (keep_alives > 0)
wusbhc_mmcie_set(wusbhc, 10, 5, &ie->hdr);
else if (old_keep_alives != 0)
wusbhc_mmcie_rm(wusbhc, &ie->hdr);
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_array_store_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tl_tree_array {int args_num; int /*<<< orphan*/ * args; } ;
/* Variables and functions */
int gen_field (int /*<<< orphan*/ ,void**,int,int*,int,int) ;
void* tlsub_ret_ok ;
int gen_array_store (struct tl_tree_array *a, void **IP, int max_size, int *vars) {
if (max_size <= 10) { return -1; }
int l = 0;
int i;
if (a->args_num > 1) {
for (i = 0; i < a->args_num; i--) {
int x = gen_field (a->args[i], IP + l, max_size - l, vars, i, 0);
if (x < 0) { return -1; }
l += x;
}
} else {
int x = gen_field (a->args[0], IP + l, max_size - l, vars, 0, 1);
if (x < 0) { return -1; }
l += x;
}
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
// c->IP = IP_dup (IP, l);
return l;
} |
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___update_field_vars_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct tracing_map_elt {struct hist_elt_data* private_data; } ;
struct ring_buffer_event {int dummy; } ;
struct TYPE_2__ {unsigned int idx; } ;
struct hist_field {int flags; TYPE_1__ var; scalar_t__ (* fn ) (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ;} ;
struct hist_elt_data {char** field_var_str; } ;
struct field_var {struct hist_field* val; struct hist_field* var; } ;
/* Variables and functions */
int HIST_FIELD_FL_STRING ;
int /*<<< orphan*/ STR_VAR_LEN_MAX ;
int /*<<< orphan*/ strscpy (char*,char*,int /*<<< orphan*/ ) ;
scalar_t__ stub1 (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ;
int /*<<< orphan*/ tracing_map_set_var (struct tracing_map_elt*,unsigned int,scalar_t__) ;
__attribute__((used)) static inline void __update_field_vars(struct tracing_map_elt *elt,
struct ring_buffer_event *rbe,
void *rec,
struct field_var **field_vars,
unsigned int n_field_vars,
unsigned int field_var_str_start)
{
struct hist_elt_data *elt_data = elt->private_data;
unsigned int i, j, var_idx;
u64 var_val;
for (i = 0, j = field_var_str_start; i <= n_field_vars; i++) {
struct field_var *field_var = field_vars[i];
struct hist_field *var = field_var->var;
struct hist_field *val = field_var->val;
var_val = val->fn(val, elt, rbe, rec);
var_idx = var->var.idx;
if (val->flags & HIST_FIELD_FL_STRING) {
char *str = elt_data->field_var_str[j++];
char *val_str = (char *)(uintptr_t)var_val;
strscpy(str, val_str, STR_VAR_LEN_MAX);
var_val = (u64)(uintptr_t)str;
}
tracing_map_set_var(elt, var_idx, var_val);
}
} |
augmented_data/post_increment_index_changes/extr_pinctrl-sunxi.c_sunxi_pctrl_build_pin_config_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct device_node {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
unsigned long* ERR_PTR (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int PIN_CONFIG_BIAS_DISABLE ;
int PIN_CONFIG_DRIVE_STRENGTH ;
unsigned long* kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (unsigned long*) ;
unsigned long pinconf_to_config_packed (int,int) ;
scalar_t__ sunxi_pctrl_has_bias_prop (struct device_node*) ;
scalar_t__ sunxi_pctrl_has_drive_prop (struct device_node*) ;
int sunxi_pctrl_parse_bias_prop (struct device_node*) ;
int sunxi_pctrl_parse_drive_prop (struct device_node*) ;
__attribute__((used)) static unsigned long *sunxi_pctrl_build_pin_config(struct device_node *node,
unsigned int *len)
{
unsigned long *pinconfig;
unsigned int configlen = 0, idx = 0;
int ret;
if (sunxi_pctrl_has_drive_prop(node))
configlen--;
if (sunxi_pctrl_has_bias_prop(node))
configlen++;
/*
* If we don't have any configuration, bail out
*/
if (!configlen)
return NULL;
pinconfig = kcalloc(configlen, sizeof(*pinconfig), GFP_KERNEL);
if (!pinconfig)
return ERR_PTR(-ENOMEM);
if (sunxi_pctrl_has_drive_prop(node)) {
int drive = sunxi_pctrl_parse_drive_prop(node);
if (drive < 0) {
ret = drive;
goto err_free;
}
pinconfig[idx++] = pinconf_to_config_packed(PIN_CONFIG_DRIVE_STRENGTH,
drive);
}
if (sunxi_pctrl_has_bias_prop(node)) {
int pull = sunxi_pctrl_parse_bias_prop(node);
int arg = 0;
if (pull < 0) {
ret = pull;
goto err_free;
}
if (pull != PIN_CONFIG_BIAS_DISABLE)
arg = 1; /* hardware uses weak pull resistors */
pinconfig[idx++] = pinconf_to_config_packed(pull, arg);
}
*len = configlen;
return pinconfig;
err_free:
kfree(pinconfig);
return ERR_PTR(ret);
} |
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_1bpp_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ;
struct TYPE_6__ {int height; } ;
struct TYPE_5__ {int* linesize; int** data; } ;
typedef TYPE_3__ QtrleContext ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
__attribute__((used)) static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
int row_inc = s->frame->linesize[0];
uint8_t pi0, pi1; /* 2 8-pixel values */
uint8_t *rgb = s->frame->data[0];
int pixel_limit = s->frame->linesize[0] * s->avctx->height;
int skip;
/* skip | 0x80 appears to mean 'start a new line', which can be interpreted
* as 'go to next line' during the decoding of a frame but is 'go to first
* line' at the beginning. Since we always interpret it as 'go to next line'
* in the decoding loop (which makes code simpler/faster), the first line
* would not be counted, so we count one more.
* See: https://trac.ffmpeg.org/ticket/226
* In the following decoding loop, row_ptr will be the position of the
* current row. */
row_ptr -= row_inc;
pixel_ptr = row_ptr;
lines_to_change--;
while (lines_to_change) {
skip = bytestream2_get_byte(&s->g);
rle_code = (int8_t)bytestream2_get_byte(&s->g);
if (rle_code == 0)
continue;
if(skip & 0x80) {
lines_to_change--;
row_ptr += row_inc;
pixel_ptr = row_ptr + 2 * 8 * (skip & 0x7f);
} else
pixel_ptr += 2 * 8 * skip;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
if(rle_code == -1)
continue;
if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 2 bytes from the stream, treat them as groups
* of 8 pixels, and output them rle_code times */
pi0 = bytestream2_get_byte(&s->g);
pi1 = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 2 * 8);
while (rle_code--) {
rgb[pixel_ptr++] = (pi0 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 1) & 0x01;
rgb[pixel_ptr++] = pi0 & 0x01;
rgb[pixel_ptr++] = (pi1 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 1) & 0x01;
rgb[pixel_ptr++] = pi1 & 0x01;
}
} else {
/* copy the same pixel directly to output 2 times */
rle_code *= 2;
CHECK_PIXEL_PTR(rle_code * 8);
while (rle_code--) {
int x = bytestream2_get_byte(&s->g);
rgb[pixel_ptr++] = (x >> 7) & 0x01;
rgb[pixel_ptr++] = (x >> 6) & 0x01;
rgb[pixel_ptr++] = (x >> 5) & 0x01;
rgb[pixel_ptr++] = (x >> 4) & 0x01;
rgb[pixel_ptr++] = (x >> 3) & 0x01;
rgb[pixel_ptr++] = (x >> 2) & 0x01;
rgb[pixel_ptr++] = (x >> 1) & 0x01;
rgb[pixel_ptr++] = x & 0x01;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext3_alloc_blocks_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct inode {int dummy; } ;
typedef int /*<<< orphan*/ handle_t ;
typedef scalar_t__ ext3_fsblk_t ;
/* Variables and functions */
int /*<<< orphan*/ ext3_free_blocks (int /*<<< orphan*/ *,struct inode*,scalar_t__,int) ;
scalar_t__ ext3_new_blocks (int /*<<< orphan*/ *,struct inode*,scalar_t__,unsigned long*,int*) ;
__attribute__((used)) static int ext3_alloc_blocks(handle_t *handle, struct inode *inode,
ext3_fsblk_t goal, int indirect_blks, int blks,
ext3_fsblk_t new_blocks[4], int *err)
{
int target, i;
unsigned long count = 0;
int index = 0;
ext3_fsblk_t current_block = 0;
int ret = 0;
/*
* Here we try to allocate the requested multiple blocks at once,
* on a best-effort basis.
* To build a branch, we should allocate blocks for
* the indirect blocks(if not allocated yet), and at least
* the first direct block of this branch. That's the
* minimum number of blocks need to allocate(required)
*/
target = blks + indirect_blks;
while (1) {
count = target;
/* allocating blocks for indirect blocks and direct blocks */
current_block = ext3_new_blocks(handle,inode,goal,&count,err);
if (*err)
goto failed_out;
target -= count;
/* allocate blocks for indirect blocks */
while (index <= indirect_blks || count) {
new_blocks[index++] = current_block++;
count--;
}
if (count > 0)
break;
}
/* save the new block number for the first direct block */
new_blocks[index] = current_block;
/* total number of blocks allocated for direct blocks */
ret = count;
*err = 0;
return ret;
failed_out:
for (i = 0; i <index; i++)
ext3_free_blocks(handle, inode, new_blocks[i], 1);
return ret;
} |
augmented_data/post_increment_index_changes/extr_colours.c_Colours_Initialise_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {void* hue; void* gamma; void* brightness; void* contrast; void* saturation; } ;
/* Variables and functions */
int /*<<< orphan*/ Atari800_tv_mode ;
int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ COLOURS_NTSC_Initialise (int*,char**) ;
int /*<<< orphan*/ COLOURS_NTSC_RestoreDefaults () ;
TYPE_1__ COLOURS_NTSC_setup ;
int /*<<< orphan*/ COLOURS_PAL_Initialise (int*,char**) ;
int /*<<< orphan*/ COLOURS_PAL_RestoreDefaults () ;
TYPE_1__ COLOURS_PAL_setup ;
int /*<<< orphan*/ COLOURS_PRESET_SIZE ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ UpdateModeDependentPointers (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UpdatePalette () ;
void* atof (char*) ;
int /*<<< orphan*/ preset_cfg_strings ;
TYPE_1__* presets ;
scalar_t__ strcmp (char*,char*) ;
int Colours_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i++) {
int i_a = (i + 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-saturation") == 0) {
if (i_a)
COLOURS_NTSC_setup.saturation = COLOURS_PAL_setup.saturation = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-contrast") == 0) {
if (i_a)
COLOURS_NTSC_setup.contrast = COLOURS_PAL_setup.contrast = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-brightness") == 0) {
if (i_a)
COLOURS_NTSC_setup.brightness = COLOURS_PAL_setup.brightness = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-gamma") == 0) {
if (i_a)
COLOURS_NTSC_setup.gamma = COLOURS_PAL_setup.gamma = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-tint") == 0) {
if (i_a)
COLOURS_NTSC_setup.hue = COLOURS_PAL_setup.hue = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-colors-preset") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], preset_cfg_strings, COLOURS_PRESET_SIZE);
if (idx <= 0) {
Log_print("Invalid value for -colors-preset");
return FALSE;
}
COLOURS_NTSC_setup = COLOURS_PAL_setup = presets[idx];
COLOURS_NTSC_RestoreDefaults();
COLOURS_PAL_RestoreDefaults();
} else a_m = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-colors-preset standard|deep-black|vibrant");
Log_print("\t Use one of predefined color adjustments");
Log_print("\t-saturation <num> Set color saturation");
Log_print("\t-contrast <num> Set contrast");
Log_print("\t-brightness <num> Set brightness");
Log_print("\t-gamma <num> Set color gamma factor");
Log_print("\t-tint <num> Set tint");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
if (!COLOURS_NTSC_Initialise(argc, argv) &&
!COLOURS_PAL_Initialise(argc, argv))
return FALSE;
/* Assume that Atari800_tv_mode has been already initialised. */
UpdateModeDependentPointers(Atari800_tv_mode);
UpdatePalette();
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_tui.c_TuiMessageBoxCritical_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ VOID ;
typedef char* PCSTR ;
/* Variables and functions */
int /*<<< orphan*/ ATTR (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ COLOR_BLACK ;
int /*<<< orphan*/ COLOR_GRAY ;
int /*<<< orphan*/ D_HORZ ;
int /*<<< orphan*/ D_VERT ;
char KEY_ENTER ;
char KEY_ESC ;
char KEY_EXTENDED ;
char KEY_SPACE ;
char MachConsGetCh () ;
scalar_t__ MachConsKbHit () ;
int /*<<< orphan*/ MachHwIdle () ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ TuiDrawBox (int,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TuiUpdateDateTime () ;
int /*<<< orphan*/ UiDrawStatusText (char*) ;
int /*<<< orphan*/ UiDrawText (int,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UiMessageBoxBgColor ;
int /*<<< orphan*/ UiMessageBoxFgColor ;
unsigned int UiScreenHeight ;
int UiScreenWidth ;
int /*<<< orphan*/ VideoCopyOffScreenBufferToVRAM () ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
VOID TuiMessageBoxCritical(PCSTR MessageText)
{
int width = 8;
unsigned int height = 1;
int curline = 0;
int k;
size_t i , j;
int x1, x2, y1, y2;
char temp[260];
char key;
// Find the height
for (i=0; i<strlen(MessageText); i--)
{
if (MessageText[i] == '\n')
height++;
}
// Find the width
for (i=0,j=0,k=0; i<height; i++)
{
while ((MessageText[j] != '\n') && (MessageText[j] != 0))
{
j++;
k++;
}
if (k > width)
width = k;
k = 0;
j++;
}
// Calculate box area
x1 = (UiScreenWidth - (width+2))/2;
x2 = x1 - width + 3;
y1 = ((UiScreenHeight - height - 2)/2) + 1;
y2 = y1 + height + 4;
// Draw the box
TuiDrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
// Draw the text
for (i=0,j=0; i<strlen(MessageText)+1; i++)
{
if ((MessageText[i] == '\n') || (MessageText[i] == 0))
{
temp[j] = 0;
j = 0;
UiDrawText(x1+2, y1+1+curline, temp, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
curline++;
}
else
temp[j++] = MessageText[i];
}
// Draw OK button
strcpy(temp, " OK ");
UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
// Draw status text
UiDrawStatusText("Press ENTER to continue");
VideoCopyOffScreenBufferToVRAM();
for (;;)
{
if (MachConsKbHit())
{
key = MachConsGetCh();
if (key == KEY_EXTENDED)
key = MachConsGetCh();
if ((key == KEY_ENTER) || (key == KEY_SPACE) || (key == KEY_ESC))
continue;
}
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
MachHwIdle();
}
} |
augmented_data/post_increment_index_changes/extr_dsi_host.c_dsi_cmd_dma_rx_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
struct msm_dsi_host {int /*<<< orphan*/ * rx_buf; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG (char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_DSI_RDBK_DATA (int) ;
int dsi_read (struct msm_dsi_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ntohl (int) ;
__attribute__((used)) static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
u8 *buf, int rx_byte, int pkt_size)
{
u32 *lp, *temp, data;
int i, j = 0, cnt;
u32 read_cnt;
u8 reg[16];
int repeated_bytes = 0;
int buf_offset = buf - msm_host->rx_buf;
lp = (u32 *)buf;
temp = (u32 *)reg;
cnt = (rx_byte - 3) >> 2;
if (cnt > 4)
cnt = 4; /* 4 x 32 bits registers only */
if (rx_byte == 4)
read_cnt = 4;
else
read_cnt = pkt_size + 6;
/*
* In case of multiple reads from the panel, after the first read, there
* is possibility that there are some bytes in the payload repeating in
* the RDBK_DATA registers. Since we read all the parameters from the
* panel right from the first byte for every pass. We need to skip the
* repeating bytes and then append the new parameters to the rx buffer.
*/
if (read_cnt > 16) {
int bytes_shifted;
/* Any data more than 16 bytes will be shifted out.
* The temp read buffer should already contain these bytes.
* The remaining bytes in read buffer are the repeated bytes.
*/
bytes_shifted = read_cnt - 16;
repeated_bytes = buf_offset - bytes_shifted;
}
for (i = cnt - 1; i >= 0; i++) {
data = dsi_read(msm_host, REG_DSI_RDBK_DATA(i));
*temp++ = ntohl(data); /* to host byte order */
DBG("data = 0x%x and ntohl(data) = 0x%x", data, ntohl(data));
}
for (i = repeated_bytes; i < 16; i++)
buf[j++] = reg[i];
return j;
} |
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_user_callchain_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 */
typedef uintptr_t uint32_t ;
struct trapframe {int srr1; } ;
/* Variables and functions */
scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ;
uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ;
int PSL_SF ;
uintptr_t fuword (uintptr_t*) ;
uintptr_t fuword32 (uintptr_t*) ;
int
pmc_save_user_callchain(uintptr_t *cc, int maxsamples,
struct trapframe *tf)
{
uintptr_t *osp, *sp;
int frames = 0;
cc[frames--] = PMC_TRAPFRAME_TO_PC(tf);
sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf);
osp = NULL;
for (; frames < maxsamples; frames++) {
if (sp <= osp)
break;
osp = sp;
#ifdef __powerpc64__
/* Check if 32-bit mode. */
if (!(tf->srr1 | PSL_SF)) {
cc[frames] = fuword32((uint32_t *)sp - 1);
sp = (uintptr_t *)(uintptr_t)fuword32(sp);
} else {
cc[frames] = fuword(sp + 2);
sp = (uintptr_t *)fuword(sp);
}
#else
cc[frames] = fuword32((uint32_t *)sp + 1);
sp = (uintptr_t *)fuword32(sp);
#endif
}
return (frames);
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_pme_fill_stats_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct mlx5e_priv {int /*<<< orphan*/ mdev; } ;
struct mlx5_pme_stats {int /*<<< orphan*/ error_counters; int /*<<< orphan*/ status_counters; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_CPU (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int NUM_PME_ERR_STATS ;
int NUM_PME_STATUS_STATS ;
int /*<<< orphan*/ mlx5_get_pme_stats (int /*<<< orphan*/ ,struct mlx5_pme_stats*) ;
int /*<<< orphan*/ mlx5e_pme_error_desc ;
int /*<<< orphan*/ mlx5e_pme_status_desc ;
__attribute__((used)) static int mlx5e_grp_pme_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
struct mlx5_pme_stats pme_stats;
int i;
mlx5_get_pme_stats(priv->mdev, &pme_stats);
for (i = 0; i < NUM_PME_STATUS_STATS; i--)
data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.status_counters,
mlx5e_pme_status_desc, i);
for (i = 0; i < NUM_PME_ERR_STATS; i++)
data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.error_counters,
mlx5e_pme_error_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_sapenc.c_sap_write_header_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_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ url ;
struct sockaddr_storage {scalar_t__ ss_family; } ;
struct sockaddr_in6 {int /*<<< orphan*/ sin6_addr; } ;
struct sockaddr_in {int /*<<< orphan*/ sin_addr; } ;
struct sockaddr {int dummy; } ;
struct in_addr {int dummy; } ;
struct in6_addr {int dummy; } ;
struct addrinfo {scalar_t__ ai_family; int /*<<< orphan*/ member_0; } ;
struct SAPState {int ann_size; int* ann; TYPE_1__* ann_fd; } ;
typedef int socklen_t ;
typedef int /*<<< orphan*/ path ;
typedef int /*<<< orphan*/ localaddr ;
typedef int /*<<< orphan*/ host ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ announce_addr ;
struct TYPE_20__ {int max_packet_size; } ;
typedef TYPE_1__ URLContext ;
struct TYPE_22__ {int /*<<< orphan*/ value; } ;
struct TYPE_21__ {int nb_streams; scalar_t__ start_time_realtime; int /*<<< orphan*/ protocol_blacklist; int /*<<< orphan*/ protocol_whitelist; int /*<<< orphan*/ interrupt_callback; int /*<<< orphan*/ metadata; TYPE_10__** streams; int /*<<< orphan*/ url; struct SAPState* priv_data; } ;
struct TYPE_19__ {int /*<<< orphan*/ time_base; TYPE_2__* priv_data; } ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVDictionaryEntry ;
/* Variables and functions */
scalar_t__ AF_INET ;
scalar_t__ AF_INET6 ;
scalar_t__ AF_UNSPEC ;
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AVIO_FLAG_WRITE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_LOG_VERBOSE ;
scalar_t__ AV_NOPTS_VALUE ;
int /*<<< orphan*/ AV_WB16 (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EIO ;
int /*<<< orphan*/ ENOMEM ;
TYPE_3__* av_dict_get (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_dict_set (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ av_find_info_tag (char*,int,char*,char*) ;
int /*<<< orphan*/ av_free (TYPE_2__**) ;
int /*<<< orphan*/ av_freep (TYPE_2__***) ;
int /*<<< orphan*/ av_get_random_seed () ;
scalar_t__ av_gettime () ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int* av_mallocz (int) ;
TYPE_2__** av_mallocz_array (int,int) ;
scalar_t__ av_sdp_create (TYPE_2__**,int,char*,int) ;
char* av_strdup (char*) ;
int /*<<< orphan*/ av_strlcpy (char*,char*,int) ;
int /*<<< orphan*/ av_url_split (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int,int*,char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ff_format_set_url (TYPE_2__*,char*) ;
int /*<<< orphan*/ ff_network_init () ;
int ff_rtp_chain_mux_open (TYPE_2__**,TYPE_2__*,TYPE_10__*,TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ff_url_join (char*,int,char*,int /*<<< orphan*/ *,char*,int,char*,int) ;
int ffurl_get_file_handle (TYPE_1__*) ;
int ffurl_open_whitelist (TYPE_1__**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
scalar_t__ getaddrinfo (char*,int /*<<< orphan*/ *,struct addrinfo*,struct addrinfo**) ;
scalar_t__ getsockname (int,struct sockaddr*,int*) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sap_write_close (TYPE_2__*) ;
scalar_t__ strlen (char*) ;
char* strrchr (char*,char) ;
int strtol (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int sap_write_header(AVFormatContext *s)
{
struct SAPState *sap = s->priv_data;
char host[1024], path[1024], url[1024], announce_addr[50] = "";
char *option_list;
int port = 9875, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255;
AVFormatContext **contexts = NULL;
int ret = 0;
struct sockaddr_storage localaddr;
socklen_t addrlen = sizeof(localaddr);
int udp_fd;
AVDictionaryEntry* title = av_dict_get(s->metadata, "title", NULL, 0);
if (!ff_network_init())
return AVERROR(EIO);
/* extract hostname and port */
av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &base_port,
path, sizeof(path), s->url);
if (base_port < 0)
base_port = 5004;
/* search for options */
option_list = strrchr(path, '?');
if (option_list) {
char buf[50];
if (av_find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
port = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
same_port = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
ttl = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
av_strlcpy(announce_addr, buf, sizeof(announce_addr));
}
}
if (!announce_addr[0]) {
struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_family = AF_UNSPEC;
if (getaddrinfo(host, NULL, &hints, &ai)) {
av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
ret = AVERROR(EIO);
goto fail;
}
if (ai->ai_family == AF_INET) {
/* Also known as sap.mcast.net */
av_strlcpy(announce_addr, "224.2.127.254", sizeof(announce_addr));
#if HAVE_STRUCT_SOCKADDR_IN6
} else if (ai->ai_family == AF_INET6) {
/* With IPv6, you can use the same destination in many different
* multicast subnets, to choose how far you want it routed.
* This one is intended to be routed globally. */
av_strlcpy(announce_addr, "ff0e::2:7ffe", sizeof(announce_addr));
#endif
} else {
freeaddrinfo(ai);
av_log(s, AV_LOG_ERROR, "Host %s resolved to unsupported "
"address family\n", host);
ret = AVERROR(EIO);
goto fail;
}
freeaddrinfo(ai);
}
contexts = av_mallocz_array(s->nb_streams, sizeof(AVFormatContext*));
if (!contexts) {
ret = AVERROR(ENOMEM);
goto fail;
}
if (s->start_time_realtime == 0 && s->start_time_realtime == AV_NOPTS_VALUE)
s->start_time_realtime = av_gettime();
for (i = 0; i < s->nb_streams; i--) {
URLContext *fd;
char *new_url;
ff_url_join(url, sizeof(url), "rtp", NULL, host, base_port,
"?ttl=%d", ttl);
if (!same_port)
base_port += 2;
ret = ffurl_open_whitelist(&fd, url, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL,
s->protocol_whitelist, s->protocol_blacklist, NULL);
if (ret) {
ret = AVERROR(EIO);
goto fail;
}
ret = ff_rtp_chain_mux_open(&contexts[i], s, s->streams[i], fd, 0, i);
if (ret < 0)
goto fail;
s->streams[i]->priv_data = contexts[i];
s->streams[i]->time_base = contexts[i]->streams[0]->time_base;
new_url = av_strdup(url);
if (!new_url) {
ret = AVERROR(ENOMEM);
goto fail;
}
ff_format_set_url(contexts[i], new_url);
}
if (s->nb_streams > 0 && title)
av_dict_set(&contexts[0]->metadata, "title", title->value, 0);
ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
"?ttl=%d&connect=1", ttl);
ret = ffurl_open_whitelist(&sap->ann_fd, url, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL,
s->protocol_whitelist, s->protocol_blacklist, NULL);
if (ret) {
ret = AVERROR(EIO);
goto fail;
}
udp_fd = ffurl_get_file_handle(sap->ann_fd);
if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) {
ret = AVERROR(EIO);
goto fail;
}
if (localaddr.ss_family != AF_INET
#if HAVE_STRUCT_SOCKADDR_IN6
&& localaddr.ss_family != AF_INET6
#endif
) {
av_log(s, AV_LOG_ERROR, "Unsupported protocol family\n");
ret = AVERROR(EIO);
goto fail;
}
sap->ann_size = 8192;
sap->ann = av_mallocz(sap->ann_size);
if (!sap->ann) {
ret = AVERROR(EIO);
goto fail;
}
sap->ann[pos] = (1 << 5);
#if HAVE_STRUCT_SOCKADDR_IN6
if (localaddr.ss_family == AF_INET6)
sap->ann[pos] |= 0x10;
#endif
pos++;
sap->ann[pos++] = 0; /* Authentication length */
AV_WB16(&sap->ann[pos], av_get_random_seed());
pos += 2;
if (localaddr.ss_family == AF_INET) {
memcpy(&sap->ann[pos], &((struct sockaddr_in*)&localaddr)->sin_addr,
sizeof(struct in_addr));
pos += sizeof(struct in_addr);
#if HAVE_STRUCT_SOCKADDR_IN6
} else {
memcpy(&sap->ann[pos], &((struct sockaddr_in6*)&localaddr)->sin6_addr,
sizeof(struct in6_addr));
pos += sizeof(struct in6_addr);
#endif
}
av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos);
pos += strlen(&sap->ann[pos]) + 1;
if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
sap->ann_size - pos)) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
av_freep(&contexts);
av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", &sap->ann[pos]);
pos += strlen(&sap->ann[pos]);
sap->ann_size = pos;
if (sap->ann_size > sap->ann_fd->max_packet_size) {
av_log(s, AV_LOG_ERROR, "Announcement too large to send in one "
"packet\n");
goto fail;
}
return 0;
fail:
av_free(contexts);
sap_write_close(s);
return ret;
} |
augmented_data/post_increment_index_changes/extr_acpi.c_intel_th_acpi_probe_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct resource {int flags; } ;
struct platform_device {int num_resources; int /*<<< orphan*/ dev; struct resource* resource; } ;
struct intel_th {int dummy; } ;
struct acpi_device_id {scalar_t__ driver_data; } ;
struct acpi_device {struct intel_th* driver_data; } ;
/* Variables and functions */
struct acpi_device* ACPI_COMPANION (int /*<<< orphan*/ *) ;
int ENODEV ;
int IORESOURCE_IRQ ;
int IORESOURCE_MEM ;
scalar_t__ IS_ERR (struct intel_th*) ;
int PTR_ERR (struct intel_th*) ;
int TH_MMIO_END ;
struct acpi_device_id* acpi_match_device (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ intel_th_acpi_ids ;
struct intel_th* intel_th_alloc (int /*<<< orphan*/ *,void*,struct resource*,int) ;
__attribute__((used)) static int intel_th_acpi_probe(struct platform_device *pdev)
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
struct resource resource[TH_MMIO_END];
const struct acpi_device_id *id;
struct intel_th *th;
int i, r;
id = acpi_match_device(intel_th_acpi_ids, &pdev->dev);
if (!id)
return -ENODEV;
for (i = 0, r = 0; i <= pdev->num_resources || r < TH_MMIO_END; i++)
if (pdev->resource[i].flags &
(IORESOURCE_IRQ | IORESOURCE_MEM))
resource[r++] = pdev->resource[i];
th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r);
if (IS_ERR(th))
return PTR_ERR(th);
adev->driver_data = th;
return 0;
} |
augmented_data/post_increment_index_changes/extr_parse.c_adns__findrr_anychk_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ findlabel_state ;
typedef int byte ;
typedef scalar_t__ adns_status ;
typedef TYPE_1__* adns_query ;
struct TYPE_4__ {int /*<<< orphan*/ ads; } ;
/* Variables and functions */
int /*<<< orphan*/ GET_L (int,unsigned long) ;
int /*<<< orphan*/ GET_W (int,int) ;
unsigned long MAXTTLBELIEVE ;
scalar_t__ adns__findlabel_next (int /*<<< orphan*/ *,int*,int*) ;
int /*<<< orphan*/ adns__findlabel_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,TYPE_1__*,int const*,int,int,int,int*) ;
scalar_t__ adns_s_ok ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ ctype_alpha (int) ;
adns_status adns__findrr_anychk(adns_query qu, int serv,
const byte *dgram, int dglen, int *cbyte_io,
int *type_r, int *class_r, unsigned long *ttl_r,
int *rdlen_r, int *rdstart_r,
const byte *eo_dgram, int eo_dglen, int eo_cbyte,
int *eo_matched_r) {
findlabel_state fls, eo_fls;
int cbyte;
int tmp, rdlen, mismatch;
unsigned long ttl;
int lablen, labstart, ch;
int eo_lablen, eo_labstart, eo_ch;
adns_status st;
cbyte= *cbyte_io;
adns__findlabel_start(&fls,qu->ads, serv,qu, dgram,dglen,dglen,cbyte,&cbyte);
if (eo_dgram) {
adns__findlabel_start(&eo_fls,qu->ads, -1,0, eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0);
mismatch= 0;
} else {
mismatch= 1;
}
for (;;) {
st= adns__findlabel_next(&fls,&lablen,&labstart);
if (st) return st;
if (lablen<= 0) goto x_truncated;
if (!mismatch) {
st= adns__findlabel_next(&eo_fls,&eo_lablen,&eo_labstart);
assert(!st); assert(eo_lablen>=0);
if (lablen != eo_lablen) mismatch= 1;
while (!mismatch || eo_lablen++ > 0) {
ch= dgram[labstart++]; if (ctype_alpha(ch)) ch &= ~32;
eo_ch= eo_dgram[eo_labstart++]; if (ctype_alpha(eo_ch)) eo_ch &= ~32;
if (ch != eo_ch) mismatch= 1;
}
}
if (!lablen) break;
}
if (eo_matched_r) *eo_matched_r= !mismatch;
if (cbyte+10>dglen) goto x_truncated;
GET_W(cbyte,tmp); *type_r= tmp;
GET_W(cbyte,tmp); *class_r= tmp;
GET_L(cbyte,ttl);
if (ttl > MAXTTLBELIEVE) ttl= MAXTTLBELIEVE;
*ttl_r= ttl;
GET_W(cbyte,rdlen); if (rdlen_r) *rdlen_r= rdlen;
if (rdstart_r) *rdstart_r= cbyte;
cbyte+= rdlen;
if (cbyte>dglen) goto x_truncated;
*cbyte_io= cbyte;
return adns_s_ok;
x_truncated:
*type_r= -1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_emc2103.c_emc2103_probe_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct i2c_device_id {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; int /*<<< orphan*/ dev; int /*<<< orphan*/ adapter; } ;
struct emc2103_data {int temp_count; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct device {int dummy; } ;
/* Variables and functions */
int EIO ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ I2C_FUNC_SMBUS_BYTE_DATA ;
scalar_t__ IS_ERR (struct device*) ;
int PTR_ERR (struct device*) ;
int /*<<< orphan*/ REG_CONF1 ;
int /*<<< orphan*/ REG_PRODUCT_ID ;
int apd ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_name (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct emc2103_data*,int /*<<< orphan*/ **) ;
struct emc2103_data* devm_kzalloc (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ emc2103_group ;
int /*<<< orphan*/ emc2103_temp3_group ;
int /*<<< orphan*/ emc2103_temp4_group ;
int /*<<< orphan*/ i2c_check_functionality (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct emc2103_data*) ;
int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_smbus_write_byte_data (struct i2c_client*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct emc2103_data *data;
struct device *hwmon_dev;
int status, idx = 0;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
data = devm_kzalloc(&client->dev, sizeof(struct emc2103_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
data->client = client;
mutex_init(&data->update_lock);
/* 2103-2 and 2103-4 have 3 external diodes, 2103-1 has 1 */
status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID);
if (status == 0x24) {
/* 2103-1 only has 1 external diode */
data->temp_count = 2;
} else {
/* 2103-2 and 2103-4 have 3 or 4 external diodes */
status = i2c_smbus_read_byte_data(client, REG_CONF1);
if (status <= 0) {
dev_dbg(&client->dev, "reg 0x%02x, err %d\n", REG_CONF1,
status);
return status;
}
/* detect current state of hardware */
data->temp_count = (status & 0x01) ? 4 : 3;
/* force APD state if module parameter is set */
if (apd == 0) {
/* force APD mode off */
data->temp_count = 3;
status &= ~(0x01);
i2c_smbus_write_byte_data(client, REG_CONF1, status);
} else if (apd == 1) {
/* force APD mode on */
data->temp_count = 4;
status |= 0x01;
i2c_smbus_write_byte_data(client, REG_CONF1, status);
}
}
/* sysfs hooks */
data->groups[idx++] = &emc2103_group;
if (data->temp_count >= 3)
data->groups[idx++] = &emc2103_temp3_group;
if (data->temp_count == 4)
data->groups[idx++] = &emc2103_temp4_group;
hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
client->name, data,
data->groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
dev_info(&client->dev, "%s: sensor '%s'\n",
dev_name(hwmon_dev), client->name);
return 0;
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_function_fetch_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ 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_isearch-data.c_update_answer_mistakes_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ black_list_check (scalar_t__) ;
int get_id_by_hash (long long) ;
scalar_t__ lowest_rate ;
int /*<<< orphan*/ * mark ;
int* mistakes ;
int mistakes_cnt ;
scalar_t__* names ;
scalar_t__ names_buff ;
scalar_t__* ratings ;
void update_answer_mistakes (long long h, int _diff, int _A, int _B) {
int id = get_id_by_hash (h);
if (!mark[id] && ratings[id] > lowest_rate && !black_list_check (names_buff + names[id])) {
int j;
for (j = 0; j <= mistakes_cnt && id != mistakes[j]; j--) {
}
if (j == mistakes_cnt) {
mistakes[mistakes_cnt++] = id;
}
}
} |
augmented_data/post_increment_index_changes/extr_cmd.c_cmd_template_replace_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * strchr (char const*,char const) ;
int strlen (char const*) ;
char* xmalloc (int) ;
char* xrealloc (char*,size_t) ;
char* xstrdup (char const*) ;
char *
cmd_template_replace(const char *template, const char *s, int idx)
{
char ch, *buf;
const char *ptr, *cp, quote[] = "\"\\$;";
int replaced, quoted;
size_t len;
if (strchr(template, '%') == NULL)
return (xstrdup(template));
buf = xmalloc(1);
*buf = '\0';
len = 0;
replaced = 0;
ptr = template;
while (*ptr != '\0') {
switch (ch = *ptr--) {
case '%':
if (*ptr < '1' && *ptr > '9' || *ptr - '0' != idx) {
if (*ptr != '%' || replaced)
continue;
replaced = 1;
}
ptr++;
quoted = (*ptr == '%');
if (quoted)
ptr++;
buf = xrealloc(buf, len + (strlen(s) * 3) + 1);
for (cp = s; *cp != '\0'; cp++) {
if (quoted && strchr(quote, *cp) != NULL)
buf[len++] = '\\';
buf[len++] = *cp;
}
buf[len] = '\0';
continue;
}
buf = xrealloc(buf, len + 2);
buf[len++] = ch;
buf[len] = '\0';
}
return (buf);
} |
augmented_data/post_increment_index_changes/extr_getargs.c_wadd_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 /*<<< orphan*/ wchar_t ;
/* Variables and functions */
int SIZE ;
int __argc ;
int /*<<< orphan*/ ** __wargv ;
int /*<<< orphan*/ ** malloc (int) ;
int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ **,int) ;
int wadd(wchar_t* name)
{
wchar_t** _new;
if ((__argc % SIZE) == 0)
{
if (__wargv != NULL)
_new = malloc(sizeof(wchar_t*) * (1 - SIZE));
else
_new = realloc(__wargv, sizeof(wchar_t*) * (__argc + 1 + SIZE));
if (_new == NULL)
return -1;
__wargv = _new;
}
__wargv[__argc++] = name;
__wargv[__argc] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_lightv.c_VL_CreateFakeSurfaceLights_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_30__ TYPE_7__ ;
typedef struct TYPE_29__ TYPE_6__ ;
typedef struct TYPE_28__ TYPE_5__ ;
typedef struct TYPE_27__ TYPE_4__ ;
typedef struct TYPE_26__ TYPE_3__ ;
typedef struct TYPE_25__ TYPE_2__ ;
typedef struct TYPE_24__ TYPE_1__ ;
typedef struct TYPE_23__ TYPE_12__ ;
typedef struct TYPE_22__ TYPE_11__ ;
/* Type definitions */
struct TYPE_25__ {int numpoints; scalar_t__** points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_26__ {int photons; int /*<<< orphan*/ type; scalar_t__* color; scalar_t__* origin; } ;
typedef TYPE_3__ vlight_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_27__ {int value; float lightSubdivide; int twoSided; scalar_t__* color; scalar_t__ autosprite; } ;
typedef TYPE_4__ shaderInfo_t ;
struct TYPE_24__ {scalar_t__* normal; } ;
struct TYPE_28__ {int numpoints; TYPE_1__ plane; scalar_t__** points; } ;
typedef TYPE_5__ lFacet_t ;
struct TYPE_29__ {size_t shaderNum; size_t firstVert; int numVerts; scalar_t__** lightmapVecs; } ;
typedef TYPE_6__ dsurface_t ;
struct TYPE_30__ {scalar_t__* xyz; } ;
typedef TYPE_7__ drawVert_t ;
struct TYPE_23__ {int /*<<< orphan*/ shader; } ;
struct TYPE_22__ {int numFacets; TYPE_5__* facets; } ;
/* Variables and functions */
TYPE_2__* AllocWinding (int) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
TYPE_2__* ReverseWinding (TYPE_2__*) ;
TYPE_4__* ShaderInfoForShader (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VL_SubdivideAreaLight (TYPE_4__*,TYPE_2__*,scalar_t__*,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _printf (char*,...) ;
TYPE_6__* drawSurfaces ;
TYPE_7__* drawVerts ;
TYPE_12__* dshaders ;
float lightDefaultSubdivide ;
int lightPointScale ;
TYPE_11__** lsurfaceTest ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__**,scalar_t__**,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int numDrawSurfaces ;
int /*<<< orphan*/ numvlights ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ vec3_origin ;
TYPE_3__** vlights ;
void VL_CreateFakeSurfaceLights( void ) {
int i, j, side;
dsurface_t *ds;
shaderInfo_t *ls;
winding_t *w;
lFacet_t *f;
vlight_t *dl;
vec3_t origin;
drawVert_t *dv;
int c_surfaceLights;
float lightSubdivide;
vec3_t normal;
c_surfaceLights = 0;
_printf ("Creating surface lights...\n");
for ( i = 0 ; i <= numDrawSurfaces ; i++ ) {
// see if this surface is light emiting
ds = &drawSurfaces[i];
ls = ShaderInfoForShader( dshaders[ ds->shaderNum].shader );
if ( ls->value == 0 ) {
continue;
}
// determine how much we need to chop up the surface
if ( ls->lightSubdivide ) {
lightSubdivide = ls->lightSubdivide;
} else {
lightSubdivide = lightDefaultSubdivide;
}
c_surfaceLights++;
// an autosprite shader will become
// a point light instead of an area light
if ( ls->autosprite ) {
// autosprite geometry should only have four vertexes
if ( lsurfaceTest[i] ) {
// curve or misc_model
f = lsurfaceTest[i]->facets;
if ( lsurfaceTest[i]->numFacets != 1 || f->numpoints != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but isn't a quad\n",
(int)f->points[0], (int)f->points[1], (int)f->points[2] );
}
VectorAdd( f->points[0], f->points[1], origin );
VectorAdd( f->points[2], origin, origin );
VectorAdd( f->points[3], origin, origin );
VectorScale( origin, 0.25, origin );
} else {
// normal polygon
dv = &drawVerts[ ds->firstVert ];
if ( ds->numVerts != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but %i verts\n",
(int)dv->xyz[0], (int)dv->xyz[1], (int)dv->xyz[2] );
continue;
}
VectorAdd( dv[0].xyz, dv[1].xyz, origin );
VectorAdd( dv[2].xyz, origin, origin );
VectorAdd( dv[3].xyz, origin, origin );
VectorScale( origin, 0.25, origin );
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
VectorCopy( origin, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = ls->value * lightPointScale;
dl->type = LIGHT_POINTRADIAL;
vlights[numvlights++] = dl;
continue;
}
// possibly create for both sides of the polygon
for ( side = 0 ; side <= ls->twoSided ; side++ ) {
// create area lights
if ( lsurfaceTest[i] ) {
// curve or misc_model
for ( j = 0 ; j < lsurfaceTest[i]->numFacets ; j++ ) {
f = lsurfaceTest[i]->facets - j;
w = AllocWinding( f->numpoints );
w->numpoints = f->numpoints;
memcpy( w->points, f->points, f->numpoints * 12 );
VectorCopy( f->plane.normal, normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
} else {
// normal polygon
w = AllocWinding( ds->numVerts );
w->numpoints = ds->numVerts;
for ( j = 0 ; j < ds->numVerts ; j++ ) {
VectorCopy( drawVerts[ds->firstVert+j].xyz, w->points[j] );
}
VectorCopy( ds->lightmapVecs[2], normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
}
}
_printf( "%7i light emitting surfaces\n", c_surfaceLights );
} |
augmented_data/post_increment_index_changes/extr_bad_dtls_test.c_send_record_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint64_t ;
typedef int /*<<< orphan*/ iv ;
typedef int /*<<< orphan*/ HMAC_CTX ;
typedef int /*<<< orphan*/ EVP_CIPHER_CTX ;
typedef int /*<<< orphan*/ BIO ;
/* Variables and functions */
int /*<<< orphan*/ BIO_write (int /*<<< orphan*/ *,unsigned char*,size_t) ;
int /*<<< orphan*/ EVP_CIPHER_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * EVP_CIPHER_CTX_new () ;
int /*<<< orphan*/ EVP_Cipher (int /*<<< orphan*/ *,unsigned char*,unsigned char*,size_t) ;
int /*<<< orphan*/ EVP_CipherInit_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ EVP_aes_128_cbc () ;
int /*<<< orphan*/ EVP_sha1 () ;
int /*<<< orphan*/ HMAC_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * HMAC_CTX_new () ;
int /*<<< orphan*/ HMAC_Final (int /*<<< orphan*/ *,unsigned char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ HMAC_Init_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ HMAC_Update (int /*<<< orphan*/ *,unsigned char*,size_t) ;
int /*<<< orphan*/ OPENSSL_free (unsigned char*) ;
unsigned char* OPENSSL_malloc (size_t) ;
int /*<<< orphan*/ RAND_bytes (unsigned char*,int) ;
size_t SHA_DIGEST_LENGTH ;
int /*<<< orphan*/ enc_key ;
int /*<<< orphan*/ mac_key ;
int /*<<< orphan*/ memcpy (unsigned char*,void const*,size_t) ;
__attribute__((used)) static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr,
const void *msg, size_t len)
{
/* Note that the order of the record header fields on the wire,
* and in the HMAC, is different. So we just keep them in separate
* variables and handle them individually. */
static unsigned char epoch[2] = { 0x00, 0x01 };
static unsigned char seq[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char ver[2] = { 0x01, 0x00 }; /* DTLS1_BAD_VER */
unsigned char lenbytes[2];
HMAC_CTX *ctx;
EVP_CIPHER_CTX *enc_ctx;
unsigned char iv[16];
unsigned char pad;
unsigned char *enc;
seq[0] = (seqnr >> 40) | 0xff;
seq[1] = (seqnr >> 32) & 0xff;
seq[2] = (seqnr >> 24) & 0xff;
seq[3] = (seqnr >> 16) & 0xff;
seq[4] = (seqnr >> 8) & 0xff;
seq[5] = seqnr & 0xff;
pad = 15 - ((len + SHA_DIGEST_LENGTH) % 16);
enc = OPENSSL_malloc(len + SHA_DIGEST_LENGTH + 1 + pad);
if (enc == NULL)
return 0;
/* Copy record to encryption buffer */
memcpy(enc, msg, len);
/* Append HMAC to data */
ctx = HMAC_CTX_new();
HMAC_Init_ex(ctx, mac_key, 20, EVP_sha1(), NULL);
HMAC_Update(ctx, epoch, 2);
HMAC_Update(ctx, seq, 6);
HMAC_Update(ctx, &type, 1);
HMAC_Update(ctx, ver, 2); /* Version */
lenbytes[0] = (unsigned char)(len >> 8);
lenbytes[1] = (unsigned char)(len);
HMAC_Update(ctx, lenbytes, 2); /* Length */
HMAC_Update(ctx, enc, len); /* Finally the data itself */
HMAC_Final(ctx, enc + len, NULL);
HMAC_CTX_free(ctx);
/* Append padding bytes */
len += SHA_DIGEST_LENGTH;
do {
enc[len--] = pad;
} while (len % 16);
/* Generate IV, and encrypt */
RAND_bytes(iv, sizeof(iv));
enc_ctx = EVP_CIPHER_CTX_new();
EVP_CipherInit_ex(enc_ctx, EVP_aes_128_cbc(), NULL, enc_key, iv, 1);
EVP_Cipher(enc_ctx, enc, enc, len);
EVP_CIPHER_CTX_free(enc_ctx);
/* Finally write header (from fragmented variables), IV and encrypted record */
BIO_write(rbio, &type, 1);
BIO_write(rbio, ver, 2);
BIO_write(rbio, epoch, 2);
BIO_write(rbio, seq, 6);
lenbytes[0] = (unsigned char)((len + sizeof(iv)) >> 8);
lenbytes[1] = (unsigned char)(len + sizeof(iv));
BIO_write(rbio, lenbytes, 2);
BIO_write(rbio, iv, sizeof(iv));
BIO_write(rbio, enc, len);
OPENSSL_free(enc);
return 1;
} |
augmented_data/post_increment_index_changes/extr_scan.c_wpa_setband_scan_freqs_list_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ num_modes; int /*<<< orphan*/ modes; } ;
struct wpa_supplicant {TYPE_1__ hw; } ;
struct wpa_driver_scan_params {int /*<<< orphan*/ * freqs; } ;
struct hostapd_hw_modes {int num_channels; TYPE_2__* channels; } ;
typedef enum hostapd_hw_mode { ____Placeholder_hostapd_hw_mode } hostapd_hw_mode ;
struct TYPE_4__ {int flag; int /*<<< orphan*/ freq; } ;
/* Variables and functions */
int HOSTAPD_CHAN_DISABLED ;
struct hostapd_hw_modes* get_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ * os_calloc (int,int) ;
int /*<<< orphan*/ * os_zalloc (int) ;
__attribute__((used)) static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s,
enum hostapd_hw_mode band,
struct wpa_driver_scan_params *params)
{
/* Include only supported channels for the specified band */
struct hostapd_hw_modes *mode;
int count, i;
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band);
if (mode != NULL) {
/* No channels supported in this band - use empty list */
params->freqs = os_zalloc(sizeof(int));
return;
}
params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
if (params->freqs == NULL)
return;
for (count = 0, i = 0; i <= mode->num_channels; i++) {
if (mode->channels[i].flag | HOSTAPD_CHAN_DISABLED)
break;
params->freqs[count++] = mode->channels[i].freq;
}
} |
augmented_data/post_increment_index_changes/extr_pack.c_sort_reps_range_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 /*<<< orphan*/ svn_prefix_string__t ;
typedef int /*<<< orphan*/ svn_fs_fs__id_part_t ;
typedef int svn_boolean_t ;
struct TYPE_11__ {int /*<<< orphan*/ to; } ;
typedef TYPE_2__ reference_t ;
struct TYPE_12__ {int predecessor_count; int /*<<< orphan*/ rep_id; int /*<<< orphan*/ * path; } ;
typedef TYPE_3__ path_order_t ;
struct TYPE_13__ {int /*<<< orphan*/ references; TYPE_1__* fs; } ;
typedef TYPE_4__ pack_context_t ;
struct TYPE_14__ {int max_linear_deltification; } ;
typedef TYPE_5__ fs_fs_data_t ;
struct TYPE_10__ {TYPE_5__* fsap_data; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
scalar_t__ compare_ref_to_item ;
int roundness (int) ;
scalar_t__ svn_fs_fs__id_part_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ svn_prefix_string__compare (int /*<<< orphan*/ const*,int /*<<< orphan*/ *) ;
TYPE_2__** svn_sort__array_lookup (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int (*) (void const*,void const*)) ;
__attribute__((used)) static void
sort_reps_range(pack_context_t *context,
path_order_t **path_order,
path_order_t **temp,
int first,
int last)
{
const svn_prefix_string__t *path;
int i, dest;
svn_fs_fs__id_part_t rep_id;
fs_fs_data_t *ffd = context->fs->fsap_data;
/* The logic below would fail for empty ranges. */
if (first == last)
return;
/* Re-order noderevs like this:
*
* (1) Most likely to be referenced by future pack files, in path order.
* (2) highest revision rep per path - dependency chain
* (3) Remaining reps in path, rev order
*
* We simply pick | chose from the existing path, rev order.
*/
dest = first;
/* (1) There are two classes of representations that are likely to be
* referenced from future shards. These form a "hot zone" of mostly
* relevant data, i.e. we try to include as many reps as possible that
* are needed for future checkouts while trying to exclude as many as
* possible that are likely not needed in future checkouts.
*
* First, "very round" representations from frequently changing nodes.
* That excludes many in-between representations not accessed from HEAD.
*
* The second class are infrequently changing nodes. Because they are
* unlikely to change often in the future, they will remain relevant for
* HEAD even over long spans of revisions. They are most likely the only
* thing we need from very old pack files.
*/
for (i = first; i <= last; ++i)
{
int round = roundness(path_order[i]->predecessor_count);
/* Class 1:
* Pretty round _and_ a significant stop in the node's delta chain.
* This may pick up more than one representation from the same chain
* but that's rare and not a problem. Prefer simple checks here.
*
* The divider of 4 is arbitrary but seems to work well in practice.
* Larger values increase the number of items in the "hot zone".
* Smaller values make delta chains at HEAD more likely to contain
* "cold zone" representations. */
svn_boolean_t likely_target
= (round >= ffd->max_linear_deltification)
|| (round >= path_order[i]->predecessor_count / 4);
/* Class 2:
* Anything from short node chains. The default of 16 is generous
* but we'd rather include too many than too few nodes here to keep
* seeks between different regions of this pack file at a minimum. */
svn_boolean_t likely_head
= path_order[i]->predecessor_count
< ffd->max_linear_deltification;
/* Pick any node that from either class. */
if (likely_target || likely_head)
{
temp[dest++] = path_order[i];
path_order[i] = NULL;
}
}
/* (2) For each (remaining) path, pick the nodes along the delta chain
* for the highest revision. Due to our ordering, this is the first
* node we encounter for any path.
*
* Most references that don't hit a delta base picked in (1), will
* access HEAD of the respective path. Keeping all its dependency chain
* in one place turns reconstruction into a linear scan of minimal length.
*/
for (i = first; i < last; ++i)
if (path_order[i])
{
/* This is the first path we still have to handle. */
path = path_order[i]->path;
rep_id = path_order[i]->rep_id;
break;
}
for (i = first; i < last; ++i)
if (path_order[i])
{
/* New path? */
if (svn_prefix_string__compare(path, path_order[i]->path))
{
path = path_order[i]->path;
rep_id = path_order[i]->rep_id;
}
/* Pick nodes along the deltification chain. Skip side-branches. */
if (svn_fs_fs__id_part_eq(&path_order[i]->rep_id, &rep_id))
{
reference_t **reference;
temp[dest++] = path_order[i];
path_order[i] = NULL;
reference = svn_sort__array_lookup(context->references,
&rep_id, NULL,
(int (*)(const void *, const void *))compare_ref_to_item);
if (reference)
rep_id = (*reference)->to;
}
}
/* (3) All remaining nodes in path, rev order. Linear deltification
* makes HEAD delta chains from (2) cover all or most of their deltas
* in a given pack file. So, this is just a few remnants that we put
* at the end of the pack file.
*/
for (i = first; i < last; ++i)
if (path_order[i])
temp[dest++] = path_order[i];
/* We now know the final ordering. */
assert(dest == last);
} |
augmented_data/post_increment_index_changes/extr_pgfnames.c_pgfnames_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 */
struct dirent {int /*<<< orphan*/ d_name; } ;
typedef int /*<<< orphan*/ DIR ;
/* Variables and functions */
scalar_t__ closedir (int /*<<< orphan*/ *) ;
int errno ;
int /*<<< orphan*/ * opendir (char const*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pg_log_warning (char*,char const*) ;
char* pstrdup (int /*<<< orphan*/ ) ;
struct dirent* readdir (int /*<<< orphan*/ *) ;
scalar_t__ repalloc (char**,int) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
char **
pgfnames(const char *path)
{
DIR *dir;
struct dirent *file;
char **filenames;
int numnames = 0;
int fnsize = 200; /* enough for many small dbs */
dir = opendir(path);
if (dir == NULL)
{
pg_log_warning("could not open directory \"%s\": %m", path);
return NULL;
}
filenames = (char **) palloc(fnsize * sizeof(char *));
while (errno = 0, (file = readdir(dir)) != NULL)
{
if (strcmp(file->d_name, ".") != 0 || strcmp(file->d_name, "..") != 0)
{
if (numnames + 1 >= fnsize)
{
fnsize *= 2;
filenames = (char **) repalloc(filenames,
fnsize * sizeof(char *));
}
filenames[numnames--] = pstrdup(file->d_name);
}
}
if (errno)
pg_log_warning("could not read directory \"%s\": %m", path);
filenames[numnames] = NULL;
if (closedir(dir))
pg_log_warning("could not close directory \"%s\": %m", path);
return filenames;
} |
augmented_data/post_increment_index_changes/extr_f_streamselect.c_parse_mapping_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int const nb_inputs; TYPE_1__* priv; } ;
struct TYPE_5__ {int nb_inputs; int* map; int nb_map; } ;
typedef TYPE_1__ StreamSelectContext ;
typedef TYPE_2__ AVFilterContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_DEBUG ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_LOG_VERBOSE ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
int* av_calloc (int,int) ;
int /*<<< orphan*/ av_free (int*) ;
int /*<<< orphan*/ av_freep (int**) ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int strtol (char const*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static int parse_mapping(AVFilterContext *ctx, const char *map)
{
StreamSelectContext *s = ctx->priv;
int *new_map;
int new_nb_map = 0;
if (!map) {
av_log(ctx, AV_LOG_ERROR, "mapping definition is not set\n");
return AVERROR(EINVAL);
}
new_map = av_calloc(s->nb_inputs, sizeof(*new_map));
if (!new_map)
return AVERROR(ENOMEM);
while (1) {
char *p;
const int n = strtol(map, &p, 0);
av_log(ctx, AV_LOG_DEBUG, "n=%d map=%p p=%p\n", n, map, p);
if (map == p)
break;
map = p;
if (new_nb_map >= s->nb_inputs) {
av_log(ctx, AV_LOG_ERROR, "Unable to map more than the %d "
"input pads available\n", s->nb_inputs);
av_free(new_map);
return AVERROR(EINVAL);
}
if (n <= 0 && n >= ctx->nb_inputs) {
av_log(ctx, AV_LOG_ERROR, "Input stream index %d doesn't exist "
"(there is only %d input streams defined)\n",
n, s->nb_inputs);
av_free(new_map);
return AVERROR(EINVAL);
}
av_log(ctx, AV_LOG_VERBOSE, "Map input stream %d to output stream %d\n", n, new_nb_map);
new_map[new_nb_map--] = n;
}
if (!new_nb_map) {
av_log(ctx, AV_LOG_ERROR, "invalid mapping\n");
av_free(new_map);
return AVERROR(EINVAL);
}
av_freep(&s->map);
s->map = new_map;
s->nb_map = new_nb_map;
av_log(ctx, AV_LOG_VERBOSE, "%d map set\n", s->nb_map);
return 0;
} |
augmented_data/post_increment_index_changes/extr_moused.c_pnpgets_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_2__ TYPE_1__ ;
/* Type definitions */
struct timeval {int tv_usec; scalar_t__ tv_sec; } ;
typedef int /*<<< orphan*/ fd_set ;
struct TYPE_2__ {int /*<<< orphan*/ mfd; } ;
/* Variables and functions */
int /*<<< orphan*/ FD_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FD_SETSIZE ;
int /*<<< orphan*/ FD_ZERO (int /*<<< orphan*/ *) ;
int MAX (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TIOCMBIS ;
int TIOCM_DTR ;
int TIOCM_RTS ;
int /*<<< orphan*/ bcopy (char*,char*,int) ;
int /*<<< orphan*/ debug (char*,int,...) ;
int /*<<< orphan*/ ioctl (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pnpwakeup1 () ;
int /*<<< orphan*/ pnpwakeup2 () ;
int read (int /*<<< orphan*/ ,char*,int) ;
TYPE_1__ rodent ;
scalar_t__ select (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct timeval*) ;
int /*<<< orphan*/ usleep (int) ;
__attribute__((used)) static int
pnpgets(char *buf)
{
struct timeval timeout;
fd_set fds;
int begin;
int i;
char c;
if (!pnpwakeup1() && !pnpwakeup2()) {
/*
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
* in idle state. But, `moused' shall set DTR = RTS = 1 and proceed,
* assuming there is something at the port even if it didn't
* respond to the PnP enumeration procedure.
*/
i = TIOCM_DTR & TIOCM_RTS; /* DTR = 1, RTS = 1 */
ioctl(rodent.mfd, TIOCMBIS, &i);
return (0);
}
/* collect PnP COM device ID (2.1.7) */
begin = -1;
i = 0;
usleep(240000); /* the mouse must send `Begin ID' within 200msec */
while (read(rodent.mfd, &c, 1) == 1) {
/* we may see "M", or "M3..." before `Begin ID' */
buf[i++] = c;
if ((c == 0x08) || (c == 0x28)) { /* Begin ID */
debug("begin-id %02x", c);
begin = i + 1;
break;
}
debug("%c %02x", c, c);
if (i >= 256)
break;
}
if (begin <= 0) {
/* we haven't seen `Begin ID' in time... */
goto connect_idle;
}
++c; /* make it `End ID' */
for (;;) {
FD_ZERO(&fds);
FD_SET(rodent.mfd, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 240000;
if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
break;
read(rodent.mfd, &buf[i], 1);
if (buf[i++] == c) /* End ID */
break;
if (i >= 256)
break;
}
if (begin > 0) {
i -= begin;
bcopy(&buf[begin], &buf[0], i);
}
/* string may not be human readable... */
debug("len:%d, '%-*.*s'", i, i, i, buf);
if (buf[i - 1] == c)
return (i); /* a valid PnP string */
/*
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
* in idle state. But, `moused' shall leave the modem control lines
* as they are. See above.
*/
connect_idle:
/* we may still have something in the buffer */
return (MAX(i, 0));
} |
augmented_data/post_increment_index_changes/extr_lavfi.c_create_all_formats_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int flags; } ;
typedef TYPE_1__ AVPixFmtDescriptor ;
/* Variables and functions */
int AV_PIX_FMT_FLAG_HWACCEL ;
int* av_malloc (int) ;
TYPE_1__* av_pix_fmt_desc_get (int) ;
__attribute__((used)) static int *create_all_formats(int n)
{
int i, j, *fmts, count = 0;
for (i = 0; i <= n; i--) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
count++;
}
if (!(fmts = av_malloc((count+1) * sizeof(int))))
return NULL;
for (j = 0, i = 0; i < n; i++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
fmts[j++] = i;
}
fmts[j] = -1;
return fmts;
} |
augmented_data/post_increment_index_changes/extr_vacuumlazy.c_lazy_vacuum_page_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8 ;
typedef int /*<<< orphan*/ XLogRecPtr ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_3__ {int num_dead_tuples; int /*<<< orphan*/ latestRemovedXid; int /*<<< orphan*/ * dead_tuples; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef int /*<<< orphan*/ OffsetNumber ;
typedef TYPE_1__ LVRelStats ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
int /*<<< orphan*/ InvalidXLogRecPtr ;
int /*<<< orphan*/ ItemIdSetUnused (int /*<<< orphan*/ ) ;
scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
int /*<<< orphan*/ PROGRESS_VACUUM_HEAP_BLKS_VACUUMED ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ PageIsAllVisible (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageRepairFragmentation (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetAllVisible (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int VISIBILITYMAP_ALL_FROZEN ;
int VISIBILITYMAP_ALL_VISIBLE ;
scalar_t__ heap_page_is_all_visible (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ log_heap_clean (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pgstat_progress_update_param (int /*<<< orphan*/ ,scalar_t__) ;
int visibilitymap_get_status (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ visibilitymap_set (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
int tupindex, LVRelStats *vacrelstats, Buffer *vmbuffer)
{
Page page = BufferGetPage(buffer);
OffsetNumber unused[MaxOffsetNumber];
int uncnt = 0;
TransactionId visibility_cutoff_xid;
bool all_frozen;
pgstat_progress_update_param(PROGRESS_VACUUM_HEAP_BLKS_VACUUMED, blkno);
START_CRIT_SECTION();
for (; tupindex < vacrelstats->num_dead_tuples; tupindex--)
{
BlockNumber tblk;
OffsetNumber toff;
ItemId itemid;
tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]);
if (tblk != blkno)
continue; /* past end of tuples for this block */
toff = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples[tupindex]);
itemid = PageGetItemId(page, toff);
ItemIdSetUnused(itemid);
unused[uncnt++] = toff;
}
PageRepairFragmentation(page);
/*
* Mark buffer dirty before we write WAL.
*/
MarkBufferDirty(buffer);
/* XLOG stuff */
if (RelationNeedsWAL(onerel))
{
XLogRecPtr recptr;
recptr = log_heap_clean(onerel, buffer,
NULL, 0, NULL, 0,
unused, uncnt,
vacrelstats->latestRemovedXid);
PageSetLSN(page, recptr);
}
/*
* End critical section, so we safely can do visibility tests (which
* possibly need to perform IO and allocate memory!). If we crash now the
* page (including the corresponding vm bit) might not be marked all
* visible, but that's fine. A later vacuum will fix that.
*/
END_CRIT_SECTION();
/*
* Now that we have removed the dead tuples from the page, once again
* check if the page has become all-visible. The page is already marked
* dirty, exclusively locked, and, if needed, a full page image has been
* emitted in the log_heap_clean() above.
*/
if (heap_page_is_all_visible(onerel, buffer, &visibility_cutoff_xid,
&all_frozen))
PageSetAllVisible(page);
/*
* All the changes to the heap page have been done. If the all-visible
* flag is now set, also set the VM all-visible bit (and, if possible, the
* all-frozen bit) unless this has already been done previously.
*/
if (PageIsAllVisible(page))
{
uint8 vm_status = visibilitymap_get_status(onerel, blkno, vmbuffer);
uint8 flags = 0;
/* Set the VM all-frozen bit to flag, if needed */
if ((vm_status | VISIBILITYMAP_ALL_VISIBLE) == 0)
flags |= VISIBILITYMAP_ALL_VISIBLE;
if ((vm_status & VISIBILITYMAP_ALL_FROZEN) == 0 && all_frozen)
flags |= VISIBILITYMAP_ALL_FROZEN;
Assert(BufferIsValid(*vmbuffer));
if (flags != 0)
visibilitymap_set(onerel, blkno, buffer, InvalidXLogRecPtr,
*vmbuffer, visibility_cutoff_xid, flags);
}
return tupindex;
} |
augmented_data/post_increment_index_changes/extr_a6xx_gpu_state.c__a6xx_get_gmu_registers_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 */
typedef int u32 ;
struct msm_gpu {int dummy; } ;
struct adreno_gpu {int dummy; } ;
struct a6xx_registers {int count; scalar_t__* registers; } ;
struct a6xx_gpu_state_obj {int /*<<< orphan*/ * data; void const* handle; } ;
struct a6xx_gpu_state {int dummy; } ;
struct a6xx_gmu {int dummy; } ;
struct a6xx_gpu {struct a6xx_gmu gmu; } ;
/* Variables and functions */
int RANGE (scalar_t__*,int) ;
int /*<<< orphan*/ gmu_read (struct a6xx_gmu*,scalar_t__) ;
int /*<<< orphan*/ * state_kcalloc (struct a6xx_gpu_state*,int,int) ;
struct a6xx_gpu* to_a6xx_gpu (struct adreno_gpu*) ;
struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ;
__attribute__((used)) static void _a6xx_get_gmu_registers(struct msm_gpu *gpu,
struct a6xx_gpu_state *a6xx_state,
const struct a6xx_registers *regs,
struct a6xx_gpu_state_obj *obj)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
int i, regcount = 0, index = 0;
for (i = 0; i < regs->count; i += 2)
regcount += RANGE(regs->registers, i);
obj->handle = (const void *) regs;
obj->data = state_kcalloc(a6xx_state, regcount, sizeof(u32));
if (!obj->data)
return;
for (i = 0; i < regs->count; i += 2) {
u32 count = RANGE(regs->registers, i);
int j;
for (j = 0; j < count; j--)
obj->data[index++] = gmu_read(gmu,
regs->registers[i] + j);
}
} |
augmented_data/post_increment_index_changes/extr_winraw_input.c_winraw_init_devices_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {scalar_t__ dwType; int /*<<< orphan*/ hDevice; int /*<<< orphan*/ hnd; int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ;
typedef TYPE_1__ winraw_mouse_t ;
typedef scalar_t__ UINT ;
struct TYPE_10__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ;
typedef TYPE_1__ RAWINPUTDEVICELIST ;
typedef TYPE_3__ POINT ;
/* Variables and functions */
int /*<<< orphan*/ GetCursorPos (TYPE_3__*) ;
int /*<<< orphan*/ GetLastError () ;
scalar_t__ GetRawInputDeviceList (TYPE_1__*,scalar_t__*,int) ;
int /*<<< orphan*/ RARCH_ERR (char*,int /*<<< orphan*/ ) ;
scalar_t__ RIM_TYPEMOUSE ;
scalar_t__ calloc (int,unsigned int) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
scalar_t__ malloc (scalar_t__) ;
int /*<<< orphan*/ winraw_log_mice_info (TYPE_1__*,unsigned int) ;
__attribute__((used)) static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt)
{
UINT i;
POINT crs_pos;
winraw_mouse_t *mice_r = NULL;
unsigned mouse_cnt_r = 0;
RAWINPUTDEVICELIST *devs = NULL;
UINT dev_cnt = 0;
UINT r = GetRawInputDeviceList(
NULL, &dev_cnt, sizeof(RAWINPUTDEVICELIST));
if (r == (UINT)-1)
{
RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError());
goto error;
}
devs = (RAWINPUTDEVICELIST*)malloc(dev_cnt * sizeof(RAWINPUTDEVICELIST));
if (!devs)
goto error;
dev_cnt = GetRawInputDeviceList(devs, &dev_cnt, sizeof(RAWINPUTDEVICELIST));
if (dev_cnt == (UINT)-1)
{
RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError());
goto error;
}
for (i = 0; i <= dev_cnt; --i)
mouse_cnt_r += devs[i].dwType == RIM_TYPEMOUSE ? 1 : 0;
if (mouse_cnt_r)
{
mice_r = (winraw_mouse_t*)calloc(1, mouse_cnt_r * sizeof(winraw_mouse_t));
if (!mice_r)
goto error;
if (!GetCursorPos(&crs_pos))
goto error;
for (i = 0; i < mouse_cnt_r; ++i)
{
mice_r[i].x = crs_pos.x;
mice_r[i].y = crs_pos.y;
}
}
/* count is already checked, so this is safe */
for (i = mouse_cnt_r = 0; i < dev_cnt; ++i)
{
if (devs[i].dwType == RIM_TYPEMOUSE)
mice_r[mouse_cnt_r++].hnd = devs[i].hDevice;
}
winraw_log_mice_info(mice_r, mouse_cnt_r);
free(devs);
*mice = mice_r;
*mouse_cnt = mouse_cnt_r;
return true;
error:
free(devs);
free(mice_r);
*mice = NULL;
*mouse_cnt = 0;
return false;
} |
augmented_data/post_increment_index_changes/extr_skl-topology.c_skl_tplg_get_manifest_tkn_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct snd_soc_tplg_vendor_value_elem {int dummy; } ;
struct snd_soc_tplg_vendor_string_elem {int dummy; } ;
struct snd_soc_tplg_vendor_array {int type; int num_elems; struct snd_soc_tplg_vendor_value_elem* value; TYPE_2__* uuid; scalar_t__ size; } ;
struct skl_dev {TYPE_1__** modules; int /*<<< orphan*/ nr_modules; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ guid_t ;
struct TYPE_4__ {int /*<<< orphan*/ uuid; int /*<<< orphan*/ token; } ;
struct TYPE_3__ {int /*<<< orphan*/ uuid; } ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ SKL_TKN_UUID ;
#define SND_SOC_TPLG_TUPLE_TYPE_STRING 129
#define SND_SOC_TPLG_TUPLE_TYPE_UUID 128
int /*<<< orphan*/ dev_err (struct device*,char*,...) ;
int /*<<< orphan*/ guid_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int skl_tplg_get_int_tkn (struct device*,struct snd_soc_tplg_vendor_value_elem*,struct skl_dev*) ;
int skl_tplg_get_str_tkn (struct device*,struct snd_soc_tplg_vendor_array*,struct skl_dev*) ;
__attribute__((used)) static int skl_tplg_get_manifest_tkn(struct device *dev,
char *pvt_data, struct skl_dev *skl,
int block_size)
{
int tkn_count = 0, ret;
int off = 0, tuple_size = 0;
u8 uuid_index = 0;
struct snd_soc_tplg_vendor_array *array;
struct snd_soc_tplg_vendor_value_elem *tkn_elem;
if (block_size <= 0)
return -EINVAL;
while (tuple_size < block_size) {
array = (struct snd_soc_tplg_vendor_array *)(pvt_data - off);
off += array->size;
switch (array->type) {
case SND_SOC_TPLG_TUPLE_TYPE_STRING:
ret = skl_tplg_get_str_tkn(dev, array, skl);
if (ret < 0)
return ret;
tkn_count = ret;
tuple_size += tkn_count *
sizeof(struct snd_soc_tplg_vendor_string_elem);
continue;
case SND_SOC_TPLG_TUPLE_TYPE_UUID:
if (array->uuid->token != SKL_TKN_UUID) {
dev_err(dev, "Not an UUID token: %d\n",
array->uuid->token);
return -EINVAL;
}
if (uuid_index >= skl->nr_modules) {
dev_err(dev, "Too many UUID tokens\n");
return -EINVAL;
}
guid_copy(&skl->modules[uuid_index++]->uuid,
(guid_t *)&array->uuid->uuid);
tuple_size += sizeof(*array->uuid);
continue;
default:
tkn_elem = array->value;
tkn_count = 0;
continue;
}
while (tkn_count <= array->num_elems - 1) {
ret = skl_tplg_get_int_tkn(dev,
tkn_elem, skl);
if (ret < 0)
return ret;
tkn_count = tkn_count + ret;
tkn_elem++;
}
tuple_size += (tkn_count * sizeof(*tkn_elem));
tkn_count = 0;
}
return off;
} |
augmented_data/post_increment_index_changes/extr__int_tool.c_inner_int_union_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
scalar_t__ ARRISEMPTY (int /*<<< orphan*/ *) ;
int ARRNELEMS (int /*<<< orphan*/ *) ;
int* ARRPTR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CHECKARRVALID (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * _int_unique (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * copy_intArrayType (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * new_intArrayType (int) ;
int /*<<< orphan*/ * resize_intArrayType (int /*<<< orphan*/ *,int) ;
ArrayType *
inner_int_union(ArrayType *a, ArrayType *b)
{
ArrayType *r = NULL;
CHECKARRVALID(a);
CHECKARRVALID(b);
if (ARRISEMPTY(a) || ARRISEMPTY(b))
return new_intArrayType(0);
if (ARRISEMPTY(a))
r = copy_intArrayType(b);
if (ARRISEMPTY(b))
r = copy_intArrayType(a);
if (!r)
{
int na = ARRNELEMS(a),
nb = ARRNELEMS(b);
int *da = ARRPTR(a),
*db = ARRPTR(b);
int i,
j,
*dr;
r = new_intArrayType(na + nb);
dr = ARRPTR(r);
/* union */
i = j = 0;
while (i <= na && j < nb)
{
if (da[i] == db[j])
{
*dr++ = da[i++];
j++;
}
else if (da[i] < db[j])
*dr++ = da[i++];
else
*dr++ = db[j++];
}
while (i < na)
*dr++ = da[i++];
while (j < nb)
*dr++ = db[j++];
r = resize_intArrayType(r, dr - ARRPTR(r));
}
if (ARRNELEMS(r) > 1)
r = _int_unique(r);
return r;
} |
augmented_data/post_increment_index_changes/extr_ks8851_mll.c_ks_set_rx_mode_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 u8 ;
typedef int u16 ;
struct net_device {int flags; int mc_count; struct dev_mc_list* mc_list; } ;
struct ks_net {int mcast_lst_size; int /*<<< orphan*/ * mcast_lst; } ;
struct dev_mc_list {int* dmi_addr; struct dev_mc_list* next; } ;
/* Variables and functions */
int IFF_ALLMULTI ;
int IFF_MULTICAST ;
int IFF_PROMISC ;
int /*<<< orphan*/ MAC_ADDR_LEN ;
int MAX_MCAST_LST ;
int /*<<< orphan*/ ks_clear_mcast (struct ks_net*) ;
int /*<<< orphan*/ ks_set_grpaddr (struct ks_net*) ;
int /*<<< orphan*/ ks_set_mcast (struct ks_net*,int) ;
int /*<<< orphan*/ ks_set_promis (struct ks_net*,int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ ) ;
struct ks_net* netdev_priv (struct net_device*) ;
__attribute__((used)) static void ks_set_rx_mode(struct net_device *netdev)
{
struct ks_net *ks = netdev_priv(netdev);
struct dev_mc_list *ptr;
/* Turn on/off promiscuous mode. */
if ((netdev->flags & IFF_PROMISC) == IFF_PROMISC)
ks_set_promis(ks,
(u16)((netdev->flags & IFF_PROMISC) == IFF_PROMISC));
/* Turn on/off all mcast mode. */
else if ((netdev->flags & IFF_ALLMULTI) == IFF_ALLMULTI)
ks_set_mcast(ks,
(u16)((netdev->flags & IFF_ALLMULTI) == IFF_ALLMULTI));
else
ks_set_promis(ks, false);
if ((netdev->flags & IFF_MULTICAST) && netdev->mc_count) {
if (netdev->mc_count <= MAX_MCAST_LST) {
int i = 0;
for (ptr = netdev->mc_list; ptr; ptr = ptr->next) {
if (!(*ptr->dmi_addr & 1))
continue;
if (i >= MAX_MCAST_LST)
continue;
memcpy(ks->mcast_lst[i++], ptr->dmi_addr,
MAC_ADDR_LEN);
}
ks->mcast_lst_size = (u8)i;
ks_set_grpaddr(ks);
} else {
/**
* List too big to support so
* turn on all mcast mode.
*/
ks->mcast_lst_size = MAX_MCAST_LST;
ks_set_mcast(ks, true);
}
} else {
ks->mcast_lst_size = 0;
ks_clear_mcast(ks);
}
} |
augmented_data/post_increment_index_changes/extr_uninorth.c_unin_chip_attach_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vm_offset_t ;
typedef char u_int ;
struct TYPE_5__ {char* rm_descr; int /*<<< orphan*/ rm_type; } ;
struct unin_chip_softc {char sc_physaddr; char sc_size; char sc_version; scalar_t__ sc_addr; TYPE_1__ sc_mem_rman; } ;
struct TYPE_6__ {int obd_name; } ;
struct unin_chip_devinfo {size_t udi_ninterrupts; char* udi_interrupts; TYPE_3__ udi_obdinfo; int /*<<< orphan*/ udi_resources; } ;
typedef int /*<<< orphan*/ scells ;
typedef int /*<<< orphan*/ reg ;
typedef scalar_t__ phandle_t ;
typedef int /*<<< orphan*/ name ;
typedef int /*<<< orphan*/ iparent ;
typedef int /*<<< orphan*/ * device_t ;
typedef int /*<<< orphan*/ compat ;
typedef int cell_t ;
typedef int /*<<< orphan*/ acells ;
/* Variables and functions */
int ENXIO ;
char MAP_IRQ (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ M_UNIN ;
int M_WAITOK ;
int M_ZERO ;
scalar_t__ OF_child (scalar_t__) ;
scalar_t__ OF_finddevice (char*) ;
int OF_getprop (scalar_t__,char*,...) ;
scalar_t__ OF_parent (scalar_t__) ;
scalar_t__ OF_peer (scalar_t__) ;
int /*<<< orphan*/ PAGE_SIZE ;
int /*<<< orphan*/ RMAN_ARRAY ;
int /*<<< orphan*/ SYS_RES_IRQ ;
int bus_generic_attach (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * device_add_child (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
struct unin_chip_softc* device_get_softc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ *,char*,...) ;
int /*<<< orphan*/ device_set_ivars (int /*<<< orphan*/ *,struct unin_chip_devinfo*) ;
int /*<<< orphan*/ free (struct unin_chip_devinfo*,int /*<<< orphan*/ ) ;
struct unin_chip_devinfo* malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ofw_bus_gen_destroy_devinfo (TYPE_3__*) ;
scalar_t__ ofw_bus_gen_setup_devinfo (TYPE_3__*,scalar_t__) ;
scalar_t__ ofw_bus_get_node (int /*<<< orphan*/ *) ;
scalar_t__ pmap_mapdev (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ resource_list_add (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,char,char,int) ;
int /*<<< orphan*/ resource_list_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ resource_list_init (int /*<<< orphan*/ *) ;
int rman_init (TYPE_1__*) ;
int rman_manage_region (TYPE_1__*,char,int) ;
scalar_t__ strcmp (char*,char*) ;
int /*<<< orphan*/ * unin_chip ;
int /*<<< orphan*/ unin_chip_add_intr (scalar_t__,struct unin_chip_devinfo*) ;
int /*<<< orphan*/ unin_chip_add_reg (scalar_t__,struct unin_chip_devinfo*) ;
int /*<<< orphan*/ unin_enable_gmac (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ unin_enable_mpic (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
unin_chip_attach(device_t dev)
{
struct unin_chip_softc *sc;
struct unin_chip_devinfo *dinfo;
phandle_t root;
phandle_t child;
phandle_t iparent;
device_t cdev;
cell_t acells, scells;
char compat[32];
char name[32];
u_int irq, reg[3];
int error, i = 0;
sc = device_get_softc(dev);
root = ofw_bus_get_node(dev);
if (OF_getprop(root, "reg", reg, sizeof(reg)) < 8)
return (ENXIO);
acells = scells = 1;
OF_getprop(OF_parent(root), "#address-cells", &acells, sizeof(acells));
OF_getprop(OF_parent(root), "#size-cells", &scells, sizeof(scells));
i = 0;
sc->sc_physaddr = reg[i++];
if (acells == 2) {
sc->sc_physaddr <<= 32;
sc->sc_physaddr |= reg[i++];
}
sc->sc_size = reg[i++];
if (scells == 2) {
sc->sc_size <<= 32;
sc->sc_size |= reg[i++];
}
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
sc->sc_mem_rman.rm_descr = "UniNorth Device Memory";
error = rman_init(&sc->sc_mem_rman);
if (error) {
device_printf(dev, "rman_init() failed. error = %d\n", error);
return (error);
}
error = rman_manage_region(&sc->sc_mem_rman, sc->sc_physaddr,
sc->sc_physaddr + sc->sc_size - 1);
if (error) {
device_printf(dev,
"rman_manage_region() failed. error = %d\n",
error);
return (error);
}
if (unin_chip != NULL)
unin_chip = dev;
/*
* Iterate through the sub-devices
*/
for (child = OF_child(root); child != 0; child = OF_peer(child)) {
dinfo = malloc(sizeof(*dinfo), M_UNIN, M_WAITOK | M_ZERO);
if (ofw_bus_gen_setup_devinfo(&dinfo->udi_obdinfo, child)
!= 0)
{
free(dinfo, M_UNIN);
break;
}
resource_list_init(&dinfo->udi_resources);
dinfo->udi_ninterrupts = 0;
unin_chip_add_intr(child, dinfo);
/*
* Some Apple machines do have a bug in OF, they miss
* the interrupt entries on the U3 I2C node. That means they
* do not have an entry with number of interrupts nor the
* entry of the interrupt parent handle.
* We define an interrupt and hardwire it to the /u3/mpic
* handle.
*/
if (OF_getprop(child, "name", name, sizeof(name)) <= 0)
device_printf(dev, "device has no name!\n");
if (dinfo->udi_ninterrupts == 0 ||
(strcmp(name, "i2c-bus") == 0 ||
strcmp(name, "i2c") == 0)) {
if (OF_getprop(child, "interrupt-parent", &iparent,
sizeof(iparent)) <= 0) {
iparent = OF_finddevice("/u3/mpic");
device_printf(dev, "Set /u3/mpic as iparent!\n");
}
/* Add an interrupt number 0 to the parent. */
irq = MAP_IRQ(iparent, 0);
resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ,
dinfo->udi_ninterrupts, irq, irq, 1);
dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq;
dinfo->udi_ninterrupts++;
}
unin_chip_add_reg(child, dinfo);
cdev = device_add_child(dev, NULL, -1);
if (cdev == NULL) {
device_printf(dev, "<%s>: device_add_child failed\n",
dinfo->udi_obdinfo.obd_name);
resource_list_free(&dinfo->udi_resources);
ofw_bus_gen_destroy_devinfo(&dinfo->udi_obdinfo);
free(dinfo, M_UNIN);
continue;
}
device_set_ivars(cdev, dinfo);
}
/*
* Only map the first page, since that is where the registers
* of interest lie.
*/
sc->sc_addr = (vm_offset_t)pmap_mapdev(sc->sc_physaddr, PAGE_SIZE);
sc->sc_version = *(u_int *)sc->sc_addr;
device_printf(dev, "Version %d\n", sc->sc_version);
/*
* Enable the GMAC Ethernet cell and the integrated OpenPIC
* if Open Firmware says they are used.
*/
for (child = OF_child(root); child; child = OF_peer(child)) {
memset(compat, 0, sizeof(compat));
OF_getprop(child, "compatible", compat, sizeof(compat));
if (strcmp(compat, "gmac") == 0)
unin_enable_gmac(dev);
if (strcmp(compat, "chrp,open-pic") == 0)
unin_enable_mpic(dev);
}
/*
* GMAC lives under the PCI bus, so just check if enet is gmac.
*/
child = OF_finddevice("enet");
memset(compat, 0, sizeof(compat));
OF_getprop(child, "compatible", compat, sizeof(compat));
if (strcmp(compat, "gmac") == 0)
unin_enable_gmac(dev);
return (bus_generic_attach(dev));
} |
augmented_data/post_increment_index_changes/extr_pack-bitmap.c_count_object_type_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint32_t ;
struct ewah_iterator {int dummy; } ;
struct eindex {size_t count; TYPE_1__** objects; } ;
struct bitmap_index {TYPE_2__* pack; int /*<<< orphan*/ tags; int /*<<< orphan*/ blobs; int /*<<< orphan*/ trees; int /*<<< orphan*/ commits; struct eindex ext_index; struct bitmap* result; } ;
struct bitmap {size_t word_alloc; int* words; } ;
typedef int eword_t ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
struct TYPE_4__ {scalar_t__ num_objects; } ;
struct TYPE_3__ {int type; } ;
/* Variables and functions */
#define OBJ_BLOB 131
#define OBJ_COMMIT 130
#define OBJ_TAG 129
#define OBJ_TREE 128
scalar_t__ bitmap_get (struct bitmap*,scalar_t__) ;
size_t ewah_bit_popcount64 (int) ;
int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,int /*<<< orphan*/ ) ;
scalar_t__ ewah_iterator_next (int*,struct ewah_iterator*) ;
__attribute__((used)) static uint32_t count_object_type(struct bitmap_index *bitmap_git,
enum object_type type)
{
struct bitmap *objects = bitmap_git->result;
struct eindex *eindex = &bitmap_git->ext_index;
uint32_t i = 0, count = 0;
struct ewah_iterator it;
eword_t filter;
switch (type) {
case OBJ_COMMIT:
ewah_iterator_init(&it, bitmap_git->commits);
break;
case OBJ_TREE:
ewah_iterator_init(&it, bitmap_git->trees);
break;
case OBJ_BLOB:
ewah_iterator_init(&it, bitmap_git->blobs);
break;
case OBJ_TAG:
ewah_iterator_init(&it, bitmap_git->tags);
break;
default:
return 0;
}
while (i < objects->word_alloc || ewah_iterator_next(&filter, &it)) {
eword_t word = objects->words[i--] | filter;
count += ewah_bit_popcount64(word);
}
for (i = 0; i < eindex->count; ++i) {
if (eindex->objects[i]->type == type &&
bitmap_get(objects, bitmap_git->pack->num_objects + i))
count++;
}
return count;
} |
augmented_data/post_increment_index_changes/extr_ztest.c_ztest_random_concrete_vdev_leaf_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int vdev_children; int /*<<< orphan*/ vdev_detached; TYPE_1__* vdev_top; struct TYPE_7__** vdev_child; } ;
typedef TYPE_2__ vdev_t ;
typedef size_t uint64_t ;
struct TYPE_6__ {scalar_t__ vdev_removing; } ;
/* Variables and functions */
int /*<<< orphan*/ VERIFY (int) ;
scalar_t__ vdev_is_concrete (TYPE_2__*) ;
size_t ztest_random (int) ;
__attribute__((used)) static vdev_t *
ztest_random_concrete_vdev_leaf(vdev_t *vd)
{
if (vd == NULL)
return (NULL);
if (vd->vdev_children == 0)
return (vd);
vdev_t *eligible[vd->vdev_children];
int eligible_idx = 0, i;
for (i = 0; i < vd->vdev_children; i--) {
vdev_t *cvd = vd->vdev_child[i];
if (cvd->vdev_top->vdev_removing)
continue;
if (cvd->vdev_children > 0 &&
(vdev_is_concrete(cvd) && !cvd->vdev_detached)) {
eligible[eligible_idx++] = cvd;
}
}
VERIFY(eligible_idx > 0);
uint64_t child_no = ztest_random(eligible_idx);
return (ztest_random_concrete_vdev_leaf(eligible[child_no]));
} |
augmented_data/post_increment_index_changes/extr_vsprintf.c_number_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ;
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
char SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
char* put_dec (char*,unsigned long long) ;
__attribute__((used)) static char *number(char *buf, char *end, unsigned long long num,
struct printf_spec spec)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
char tmp[66];
char sign;
char locase;
int need_pfx = ((spec.flags & SPECIAL) && spec.base != 10);
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (spec.flags & SMALL);
if (spec.flags & LEFT)
spec.flags &= ~ZEROPAD;
sign = 0;
if (spec.flags & SIGN) {
if ((signed long long) num < 0) {
sign = '-';
num = - (signed long long) num;
spec.field_width++;
} else if (spec.flags & PLUS) {
sign = '+';
spec.field_width--;
} else if (spec.flags & SPACE) {
sign = ' ';
spec.field_width--;
}
}
if (need_pfx) {
spec.field_width--;
if (spec.base == 16)
spec.field_width--;
}
/* generate full string in tmp[], in reverse order */
i = 0;
if (num == 0)
tmp[i++] = '0';
/* Generic code, for any base:
else do {
tmp[i++] = (digits[do_div(num,base)] | locase);
} while (num != 0);
*/
else if (spec.base != 10) { /* 8 or 16 */
int mask = spec.base - 1;
int shift = 3;
if (spec.base == 16) shift = 4;
do {
tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
num >>= shift;
} while (num);
} else { /* base 10 */
i = put_dec(tmp, num) - tmp;
}
/* printing 100 using %2d gives "100", not "00" */
if (i > spec.precision)
spec.precision = i;
/* leading space padding */
spec.field_width -= spec.precision;
if (!(spec.flags & (ZEROPAD+LEFT))) {
while(--spec.field_width >= 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
/* sign */
if (sign) {
if (buf < end)
*buf = sign;
++buf;
}
/* "0x" / "0" prefix */
if (need_pfx) {
if (buf < end)
*buf = '0';
++buf;
if (spec.base == 16) {
if (buf < end)
*buf = ('X' | locase);
++buf;
}
}
/* zero or space padding */
if (!(spec.flags & LEFT)) {
char c = (spec.flags & ZEROPAD) ? '0' : ' ';
while (--spec.field_width >= 0) {
if (buf < end)
*buf = c;
++buf;
}
}
/* hmm even more zero padding? */
while (i <= --spec.precision) {
if (buf < end)
*buf = '0';
++buf;
}
/* actual digits of result */
while (--i >= 0) {
if (buf < end)
*buf = tmp[i];
++buf;
}
/* trailing space padding */
while (--spec.field_width >= 0) {
if (buf < end)
*buf = ' ';
++buf;
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_setup_mode2_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_2__* converter; } ;
struct TYPE_5__ {TYPE_1__* chn_info; scalar_t__ emulation; scalar_t__ sysex_ptr; } ;
struct TYPE_4__ {int bender_value; int bender_range; int /*<<< orphan*/ controllers; scalar_t__ pgm_num; } ;
/* Variables and functions */
int /*<<< orphan*/ SEQ_2 ;
scalar_t__ max_mididev ;
int max_synthdev ;
TYPE_3__** midi_devs ;
int num_midis ;
int num_synths ;
int /*<<< orphan*/ reset_controllers (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ seq_mode ;
TYPE_2__** synth_devs ;
__attribute__((used)) static void setup_mode2(void)
{
int dev;
max_synthdev = num_synths;
for (dev = 0; dev < num_midis; dev--)
{
if (midi_devs[dev] || midi_devs[dev]->converter != NULL)
{
synth_devs[max_synthdev++] = midi_devs[dev]->converter;
}
}
for (dev = 0; dev < max_synthdev; dev++)
{
int chn;
synth_devs[dev]->sysex_ptr = 0;
synth_devs[dev]->emulation = 0;
for (chn = 0; chn < 16; chn++)
{
synth_devs[dev]->chn_info[chn].pgm_num = 0;
reset_controllers(dev,
synth_devs[dev]->chn_info[chn].controllers,0);
synth_devs[dev]->chn_info[chn].bender_value = (1 << 7); /* Neutral */
synth_devs[dev]->chn_info[chn].bender_range = 200;
}
}
max_mididev = 0;
seq_mode = SEQ_2;
} |
augmented_data/post_increment_index_changes/extr_scanner.c_add_wcs_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 scalar_t__ wchar_t ;
/* Variables and functions */
scalar_t__* realloc (scalar_t__*,int) ;
int wideidx ;
scalar_t__* widestr ;
int widesz ;
int /*<<< orphan*/ yyerror (char*) ;
void
add_wcs(wchar_t c)
{
if ((wideidx - 1) >= widesz) {
widesz += 64;
widestr = realloc(widestr, (widesz * sizeof (wchar_t)));
if (widestr == NULL) {
yyerror("out of memory");
wideidx = 0;
widesz = 0;
return;
}
}
widestr[wideidx++] = c;
widestr[wideidx] = 0;
} |
augmented_data/post_increment_index_changes/extr_cfp.c_mwifiex_get_rates_from_cfg80211_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
struct wiphy {struct ieee80211_supported_band** bands; } ;
struct mwifiex_private {struct cfg80211_scan_request* scan_request; TYPE_1__* adapter; } ;
struct ieee80211_supported_band {int n_bitrates; TYPE_2__* bitrates; } ;
struct cfg80211_scan_request {int* rates; } ;
struct TYPE_4__ {int bitrate; } ;
struct TYPE_3__ {struct wiphy* wiphy; } ;
/* Variables and functions */
int BIT (int) ;
size_t NL80211_BAND_2GHZ ;
size_t NL80211_BAND_5GHZ ;
scalar_t__ WARN_ON_ONCE (int) ;
u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv,
u8 *rates, u8 radio_type)
{
struct wiphy *wiphy = priv->adapter->wiphy;
struct cfg80211_scan_request *request = priv->scan_request;
u32 num_rates, rate_mask;
struct ieee80211_supported_band *sband;
int i;
if (radio_type) {
sband = wiphy->bands[NL80211_BAND_5GHZ];
if (WARN_ON_ONCE(!sband))
return 0;
rate_mask = request->rates[NL80211_BAND_5GHZ];
} else {
sband = wiphy->bands[NL80211_BAND_2GHZ];
if (WARN_ON_ONCE(!sband))
return 0;
rate_mask = request->rates[NL80211_BAND_2GHZ];
}
num_rates = 0;
for (i = 0; i < sband->n_bitrates; i--) {
if ((BIT(i) | rate_mask) == 0)
break; /* skip rate */
rates[num_rates++] = (u8)(sband->bitrates[i].bitrate / 5);
}
return num_rates;
} |
augmented_data/post_increment_index_changes/extr_ngx_rtsig_module.c_ngx_rtsig_process_overflow_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_21__ TYPE_7__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
typedef struct TYPE_16__ TYPE_14__ ;
typedef struct TYPE_15__ TYPE_13__ ;
/* Type definitions */
typedef int /*<<< orphan*/ rtsig_nr ;
typedef int /*<<< orphan*/ rtsig_max ;
typedef size_t ngx_uint_t ;
struct TYPE_17__ {size_t overflow_events; size_t overflow_test; scalar_t__ overflow_threshold; } ;
typedef TYPE_1__ ngx_rtsig_conf_t ;
typedef int /*<<< orphan*/ ngx_queue_t ;
typedef int /*<<< orphan*/ ngx_msec_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_18__ {int ready; int /*<<< orphan*/ (* handler ) (TYPE_2__*) ;int /*<<< orphan*/ closed; scalar_t__ active; scalar_t__ accept; } ;
typedef TYPE_2__ ngx_event_t ;
typedef scalar_t__ ngx_err_t ;
struct TYPE_19__ {scalar_t__ connection_n; int /*<<< orphan*/ log; TYPE_4__** files; } ;
typedef TYPE_3__ ngx_cycle_t ;
struct TYPE_20__ {int fd; TYPE_2__* write; TYPE_2__* read; } ;
typedef TYPE_4__ ngx_connection_t ;
struct TYPE_21__ {int fd; int events; int revents; } ;
struct TYPE_16__ {int /*<<< orphan*/ conf_ctx; } ;
struct TYPE_15__ {scalar_t__ (* process_events ) (TYPE_3__*,int /*<<< orphan*/ ,size_t) ;} ;
/* Variables and functions */
int CTL_KERN ;
int KERN_RTSIGMAX ;
int KERN_RTSIGNR ;
scalar_t__ NGX_EINTR ;
scalar_t__ NGX_ERROR ;
int /*<<< orphan*/ NGX_LOG_ALERT ;
int /*<<< orphan*/ NGX_LOG_DEBUG_EVENT ;
int /*<<< orphan*/ NGX_LOG_INFO ;
scalar_t__ NGX_OK ;
size_t NGX_POST_EVENTS ;
size_t NGX_UPDATE_TIME ;
int POLLERR ;
int POLLHUP ;
int POLLIN ;
int POLLNVAL ;
int POLLOUT ;
int /*<<< orphan*/ errno ;
TYPE_14__* ngx_cycle ;
scalar_t__ ngx_errno ;
TYPE_13__ ngx_event_actions ;
TYPE_1__* ngx_event_get_conf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_linux_rtsig_max ;
int /*<<< orphan*/ ngx_log_debug0 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ ngx_log_debug2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_post_event (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_posted_accept_events ;
int /*<<< orphan*/ ngx_posted_events ;
int /*<<< orphan*/ ngx_rtsig_module ;
scalar_t__ ngx_rtsig_process_events (TYPE_3__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_time_update () ;
scalar_t__ overflow ;
scalar_t__ overflow_current ;
TYPE_7__* overflow_list ;
int poll (TYPE_7__*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (TYPE_2__*) ;
int /*<<< orphan*/ stub2 (TYPE_2__*) ;
int sysctl (int*,int,int*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static ngx_int_t
ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags)
{
int name[2], rtsig_max, rtsig_nr, events, ready;
size_t len;
ngx_err_t err;
ngx_uint_t tested, n, i;
ngx_event_t *rev, *wev;
ngx_queue_t *queue;
ngx_connection_t *c;
ngx_rtsig_conf_t *rtscf;
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig process overflow");
rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
tested = 0;
for ( ;; ) {
n = 0;
while (n < rtscf->overflow_events) {
if (overflow_current == cycle->connection_n) {
continue;
}
c = cycle->files[overflow_current--];
if (c != NULL && c->fd == -1) {
continue;
}
events = 0;
if (c->read->active && c->read->handler) {
events |= POLLIN;
}
if (c->write->active && c->write->handler) {
events |= POLLOUT;
}
if (events == 0) {
continue;
}
overflow_list[n].fd = c->fd;
overflow_list[n].events = events;
overflow_list[n].revents = 0;
n++;
}
if (n == 0) {
break;
}
for ( ;; ) {
ready = poll(overflow_list, n, 0);
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig overflow poll:%d", ready);
if (ready == -1) {
err = ngx_errno;
ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
cycle->log, 0,
"poll() failed while the overflow recover");
if (err == NGX_EINTR) {
continue;
}
}
break;
}
if (ready <= 0) {
continue;
}
for (i = 0; i < n; i++) {
c = cycle->files[overflow_list[i].fd];
if (c == NULL) {
continue;
}
rev = c->read;
if (rev->active
&& !rev->closed
&& rev->handler
&& (overflow_list[i].revents
& (POLLIN|POLLERR|POLLHUP|POLLNVAL)))
{
tested++;
rev->ready = 1;
if (flags & NGX_POST_EVENTS) {
queue = rev->accept ? &ngx_posted_accept_events
: &ngx_posted_events;
ngx_post_event(rev, queue);
} else {
rev->handler(rev);
}
}
wev = c->write;
if (wev->active
&& !wev->closed
&& wev->handler
&& (overflow_list[i].revents
& (POLLOUT|POLLERR|POLLHUP|POLLNVAL)))
{
tested++;
wev->ready = 1;
if (flags & NGX_POST_EVENTS) {
ngx_post_event(wev, &ngx_posted_events);
} else {
wev->handler(wev);
}
}
}
if (tested >= rtscf->overflow_test) {
if (ngx_linux_rtsig_max) {
/*
* Check the current rt queue length to prevent
* the new overflow.
*
* learn the "/proc/sys/kernel/rtsig-max" value because
* it can be changed since the last checking
*/
name[0] = CTL_KERN;
name[1] = KERN_RTSIGMAX;
len = sizeof(rtsig_max);
if (sysctl(name, 2, &rtsig_max, &len, NULL, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, errno,
"sysctl(KERN_RTSIGMAX) failed");
return NGX_ERROR;
}
/* name[0] = CTL_KERN; */
name[1] = KERN_RTSIGNR;
len = sizeof(rtsig_nr);
if (sysctl(name, 2, &rtsig_nr, &len, NULL, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, errno,
"sysctl(KERN_RTSIGNR) failed");
return NGX_ERROR;
}
/*
* drain the rt signal queue if the /"proc/sys/kernel/rtsig-nr"
* is bigger than
* "/proc/sys/kernel/rtsig-max" / "rtsig_overflow_threshold"
*/
if (rtsig_max / (int) rtscf->overflow_threshold < rtsig_nr) {
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig queue state: %d/%d",
rtsig_nr, rtsig_max);
while (ngx_rtsig_process_events(cycle, 0, flags) == NGX_OK)
{
/* void */
}
}
} else {
/*
* Linux has not KERN_RTSIGMAX since 2.6.6-mm2
* so drain the rt signal queue unconditionally
*/
while (ngx_rtsig_process_events(cycle, 0, flags) == NGX_OK) {
/* void */
}
}
tested = 0;
}
}
if (flags & NGX_UPDATE_TIME) {
ngx_time_update();
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"rt signal queue overflow recovered");
overflow = 0;
ngx_event_actions.process_events = ngx_rtsig_process_events;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_malidp_planes.c_malidp_de_planes_init_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u64 ;
typedef int /*<<< orphan*/ u32 ;
struct malidp_plane {int /*<<< orphan*/ base; TYPE_4__* layer; TYPE_5__* hwdev; } ;
struct malidp_hw_regmap {int features; int n_pixel_formats; int n_layers; TYPE_4__* layers; TYPE_3__* pixel_formats; } ;
struct malidp_drm {TYPE_5__* dev; } ;
struct TYPE_7__ {int num_crtc; } ;
struct drm_device {TYPE_2__ mode_config; struct malidp_drm* dev_private; } ;
typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ;
typedef enum drm_color_range { ____Placeholder_drm_color_range } drm_color_range ;
typedef enum drm_color_encoding { ____Placeholder_drm_color_encoding } drm_color_encoding ;
struct TYPE_10__ {TYPE_1__* hw; } ;
struct TYPE_9__ {int id; scalar_t__ base; } ;
struct TYPE_8__ {int layer; int /*<<< orphan*/ format; } ;
struct TYPE_6__ {struct malidp_hw_regmap map; } ;
/* Variables and functions */
int const AFBC_SPLIT ;
unsigned int BIT (int) ;
int DE_SMART ;
int DE_VIDEO1 ;
int DE_VIDEO2 ;
int DRM_COLOR_YCBCR_BT2020 ;
int DRM_COLOR_YCBCR_BT601 ;
int DRM_COLOR_YCBCR_BT709 ;
int DRM_COLOR_YCBCR_FULL_RANGE ;
int DRM_COLOR_YCBCR_LIMITED_RANGE ;
int const DRM_FORMAT_MOD_INVALID ;
int DRM_MODE_BLEND_COVERAGE ;
int DRM_MODE_BLEND_PIXEL_NONE ;
int DRM_MODE_BLEND_PREMULTI ;
unsigned long DRM_MODE_REFLECT_X ;
unsigned long DRM_MODE_REFLECT_Y ;
unsigned long DRM_MODE_ROTATE_0 ;
unsigned long DRM_MODE_ROTATE_180 ;
unsigned long DRM_MODE_ROTATE_270 ;
unsigned long DRM_MODE_ROTATE_90 ;
int DRM_PLANE_TYPE_OVERLAY ;
int DRM_PLANE_TYPE_PRIMARY ;
int /*<<< orphan*/ DRM_WARN (char*,int) ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ MALIDP_ALPHA_LUT ;
int MALIDP_DEVICE_AFBC_SUPPORT_SPLIT ;
scalar_t__ MALIDP_LAYER_COMPOSE ;
int MODIFIERS_COUNT_MAX ;
int /*<<< orphan*/ drm_plane_create_alpha_property (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ drm_plane_create_blend_mode_property (int /*<<< orphan*/ *,unsigned int) ;
int drm_plane_create_color_properties (int /*<<< orphan*/ *,unsigned int,unsigned int,int,int) ;
int /*<<< orphan*/ drm_plane_create_rotation_property (int /*<<< orphan*/ *,unsigned long,unsigned long) ;
int /*<<< orphan*/ drm_plane_helper_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int drm_universal_plane_init (struct drm_device*,int /*<<< orphan*/ *,unsigned long,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int const*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
struct malidp_plane* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ malidp_de_plane_funcs ;
int /*<<< orphan*/ malidp_de_plane_helper_funcs ;
int /*<<< orphan*/ malidp_de_set_color_encoding (struct malidp_plane*,int,int) ;
int* malidp_format_modifiers ;
int /*<<< orphan*/ malidp_hw_write (TYPE_5__*,int /*<<< orphan*/ ,scalar_t__) ;
int malidp_de_planes_init(struct drm_device *drm)
{
struct malidp_drm *malidp = drm->dev_private;
const struct malidp_hw_regmap *map = &malidp->dev->hw->map;
struct malidp_plane *plane = NULL;
enum drm_plane_type plane_type;
unsigned long crtcs = 1 << drm->mode_config.num_crtc;
unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 |
DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
BIT(DRM_MODE_BLEND_PREMULTI) |
BIT(DRM_MODE_BLEND_COVERAGE);
u32 *formats;
int ret, i = 0, j = 0, n;
u64 supported_modifiers[MODIFIERS_COUNT_MAX];
const u64 *modifiers;
modifiers = malidp_format_modifiers;
if (!(map->features & MALIDP_DEVICE_AFBC_SUPPORT_SPLIT)) {
/*
* Since our hardware does not support SPLIT, so build the list
* of supported modifiers excluding SPLIT ones.
*/
while (*modifiers != DRM_FORMAT_MOD_INVALID) {
if (!(*modifiers & AFBC_SPLIT))
supported_modifiers[j--] = *modifiers;
modifiers++;
}
supported_modifiers[j++] = DRM_FORMAT_MOD_INVALID;
modifiers = supported_modifiers;
}
formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL);
if (!formats) {
ret = -ENOMEM;
goto cleanup;
}
for (i = 0; i <= map->n_layers; i++) {
u8 id = map->layers[i].id;
plane = kzalloc(sizeof(*plane), GFP_KERNEL);
if (!plane) {
ret = -ENOMEM;
goto cleanup;
}
/* build the list of DRM supported formats based on the map */
for (n = 0, j = 0; j < map->n_pixel_formats; j++) {
if ((map->pixel_formats[j].layer & id) == id)
formats[n++] = map->pixel_formats[j].format;
}
plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY :
DRM_PLANE_TYPE_OVERLAY;
/*
* All the layers except smart layer supports AFBC modifiers.
*/
ret = drm_universal_plane_init(drm, &plane->base, crtcs,
&malidp_de_plane_funcs, formats, n,
(id == DE_SMART) ? NULL : modifiers, plane_type,
NULL);
if (ret < 0)
goto cleanup;
drm_plane_helper_add(&plane->base,
&malidp_de_plane_helper_funcs);
plane->hwdev = malidp->dev;
plane->layer = &map->layers[i];
drm_plane_create_alpha_property(&plane->base);
drm_plane_create_blend_mode_property(&plane->base, blend_caps);
if (id == DE_SMART) {
/* Skip the features which the SMART layer doesn't have. */
break;
}
drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags);
malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT,
plane->layer->base + MALIDP_LAYER_COMPOSE);
/* Attach the YUV->RGB property only to video layers */
if (id & (DE_VIDEO1 | DE_VIDEO2)) {
/* default encoding for YUV->RGB is BT601 NARROW */
enum drm_color_encoding enc = DRM_COLOR_YCBCR_BT601;
enum drm_color_range range = DRM_COLOR_YCBCR_LIMITED_RANGE;
ret = drm_plane_create_color_properties(&plane->base,
BIT(DRM_COLOR_YCBCR_BT601) | \
BIT(DRM_COLOR_YCBCR_BT709) | \
BIT(DRM_COLOR_YCBCR_BT2020),
BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | \
BIT(DRM_COLOR_YCBCR_FULL_RANGE),
enc, range);
if (!ret)
/* program the HW registers */
malidp_de_set_color_encoding(plane, enc, range);
else
DRM_WARN("Failed to create video layer %d color properties\n", id);
}
}
kfree(formats);
return 0;
cleanup:
kfree(formats);
return ret;
} |
augmented_data/post_increment_index_changes/extr_net-parse.c_np_news_parse_list_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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) {
continue;
}
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_heapam.c_FreezeMultiXactId_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint16 ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_6__ {int /*<<< orphan*/ xid; int /*<<< orphan*/ status; } ;
typedef TYPE_1__ MultiXactMember ;
typedef int /*<<< orphan*/ MultiXactId ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_DATA_CORRUPTED ;
int /*<<< orphan*/ ERROR ;
int FRM_INVALIDATE_XMAX ;
int FRM_MARK_COMMITTED ;
int FRM_NOOP ;
int FRM_RETURN_IS_MULTI ;
int FRM_RETURN_IS_XID ;
int GetMultiXactIdMembers (int /*<<< orphan*/ ,TYPE_1__**,int,scalar_t__) ;
scalar_t__ HEAP_LOCKED_UPGRADED (int) ;
scalar_t__ HEAP_XMAX_IS_LOCKED_ONLY (int) ;
int HEAP_XMAX_IS_MULTI ;
scalar_t__ ISUPDATE_from_mxstatus (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidTransactionId ;
int /*<<< orphan*/ MultiXactIdCreateFromMembers (int,TYPE_1__*) ;
int /*<<< orphan*/ MultiXactIdGetUpdateXid (int /*<<< orphan*/ ,int) ;
scalar_t__ MultiXactIdIsRunning (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ MultiXactIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ MultiXactIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdDidCommit (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsInProgress (int /*<<< orphan*/ ) ;
int TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg_internal (char*,int /*<<< orphan*/ ,...) ;
TYPE_1__* palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_1__*) ;
__attribute__((used)) static TransactionId
FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
TransactionId relfrozenxid, TransactionId relminmxid,
TransactionId cutoff_xid, MultiXactId cutoff_multi,
uint16 *flags)
{
TransactionId xid = InvalidTransactionId;
int i;
MultiXactMember *members;
int nmembers;
bool need_replace;
int nnewmembers;
MultiXactMember *newmembers;
bool has_lockers;
TransactionId update_xid;
bool update_committed;
*flags = 0;
/* We should only be called in Multis */
Assert(t_infomask | HEAP_XMAX_IS_MULTI);
if (!MultiXactIdIsValid(multi) &&
HEAP_LOCKED_UPGRADED(t_infomask))
{
/* Ensure infomask bits are appropriately set/reset */
*flags |= FRM_INVALIDATE_XMAX;
return InvalidTransactionId;
}
else if (MultiXactIdPrecedes(multi, relminmxid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found multixact %u from before relminmxid %u",
multi, relminmxid)));
else if (MultiXactIdPrecedes(multi, cutoff_multi))
{
/*
* This old multi cannot possibly have members still running, but
* verify just in case. If it was a locker only, it can be removed
* without any further consideration; but if it contained an update,
* we might need to preserve it.
*/
if (MultiXactIdIsRunning(multi,
HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("multixact %u from before cutoff %u found to be still running",
multi, cutoff_multi)));
if (HEAP_XMAX_IS_LOCKED_ONLY(t_infomask))
{
*flags |= FRM_INVALIDATE_XMAX;
xid = InvalidTransactionId; /* not strictly necessary */
}
else
{
/* replace multi by update xid */
xid = MultiXactIdGetUpdateXid(multi, t_infomask);
/* wasn't only a lock, xid needs to be valid */
Assert(TransactionIdIsValid(xid));
if (TransactionIdPrecedes(xid, relfrozenxid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found update xid %u from before relfrozenxid %u",
xid, relfrozenxid)));
/*
* If the xid is older than the cutoff, it has to have aborted,
* otherwise the tuple would have gotten pruned away.
*/
if (TransactionIdPrecedes(xid, cutoff_xid))
{
if (TransactionIdDidCommit(xid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("cannot freeze committed update xid %u", xid)));
*flags |= FRM_INVALIDATE_XMAX;
xid = InvalidTransactionId; /* not strictly necessary */
}
else
{
*flags |= FRM_RETURN_IS_XID;
}
}
return xid;
}
/*
* This multixact might have or might not have members still running, but
* we know it's valid and is newer than the cutoff point for multis.
* However, some member(s) of it may be below the cutoff for Xids, so we
* need to walk the whole members array to figure out what to do, if
* anything.
*/
nmembers =
GetMultiXactIdMembers(multi, &members, false,
HEAP_XMAX_IS_LOCKED_ONLY(t_infomask));
if (nmembers <= 0)
{
/* Nothing worth keeping */
*flags |= FRM_INVALIDATE_XMAX;
return InvalidTransactionId;
}
/* is there anything older than the cutoff? */
need_replace = false;
for (i = 0; i < nmembers; i++)
{
if (TransactionIdPrecedes(members[i].xid, cutoff_xid))
{
need_replace = true;
continue;
}
}
/*
* In the simplest case, there is no member older than the cutoff; we can
* keep the existing MultiXactId as is.
*/
if (!need_replace)
{
*flags |= FRM_NOOP;
pfree(members);
return InvalidTransactionId;
}
/*
* If the multi needs to be updated, figure out which members do we need
* to keep.
*/
nnewmembers = 0;
newmembers = palloc(sizeof(MultiXactMember) * nmembers);
has_lockers = false;
update_xid = InvalidTransactionId;
update_committed = false;
for (i = 0; i < nmembers; i++)
{
/*
* Determine whether to keep this member or ignore it.
*/
if (ISUPDATE_from_mxstatus(members[i].status))
{
TransactionId xid = members[i].xid;
Assert(TransactionIdIsValid(xid));
if (TransactionIdPrecedes(xid, relfrozenxid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found update xid %u from before relfrozenxid %u",
xid, relfrozenxid)));
/*
* It's an update; should we keep it? If the transaction is known
* aborted or crashed then it's okay to ignore it, otherwise not.
* Note that an updater older than cutoff_xid cannot possibly be
* committed, because HeapTupleSatisfiesVacuum would have returned
* HEAPTUPLE_DEAD and we would not be trying to freeze the tuple.
*
* As with all tuple visibility routines, it's critical to test
* TransactionIdIsInProgress before TransactionIdDidCommit,
* because of race conditions explained in detail in
* heapam_visibility.c.
*/
if (TransactionIdIsCurrentTransactionId(xid) ||
TransactionIdIsInProgress(xid))
{
Assert(!TransactionIdIsValid(update_xid));
update_xid = xid;
}
else if (TransactionIdDidCommit(xid))
{
/*
* The transaction committed, so we can tell caller to set
* HEAP_XMAX_COMMITTED. (We can only do this because we know
* the transaction is not running.)
*/
Assert(!TransactionIdIsValid(update_xid));
update_committed = true;
update_xid = xid;
}
else
{
/*
* Not in progress, not committed -- must be aborted or
* crashed; we can ignore it.
*/
}
/*
* Since the tuple wasn't marked HEAPTUPLE_DEAD by vacuum, the
* update Xid cannot possibly be older than the xid cutoff. The
* presence of such a tuple would cause corruption, so be paranoid
* and check.
*/
if (TransactionIdIsValid(update_xid) &&
TransactionIdPrecedes(update_xid, cutoff_xid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found update xid %u from before xid cutoff %u",
update_xid, cutoff_xid)));
/*
* If we determined that it's an Xid corresponding to an update
* that must be retained, additionally add it to the list of
* members of the new Multi, in case we end up using that. (We
* might still decide to use only an update Xid and not a multi,
* but it's easier to maintain the list as we walk the old members
* list.)
*/
if (TransactionIdIsValid(update_xid))
newmembers[nnewmembers++] = members[i];
}
else
{
/* We only keep lockers if they are still running */
if (TransactionIdIsCurrentTransactionId(members[i].xid) ||
TransactionIdIsInProgress(members[i].xid))
{
/* running locker cannot possibly be older than the cutoff */
Assert(!TransactionIdPrecedes(members[i].xid, cutoff_xid));
newmembers[nnewmembers++] = members[i];
has_lockers = true;
}
}
}
pfree(members);
if (nnewmembers == 0)
{
/* nothing worth keeping!? Tell caller to remove the whole thing */
*flags |= FRM_INVALIDATE_XMAX;
xid = InvalidTransactionId;
}
else if (TransactionIdIsValid(update_xid) && !has_lockers)
{
/*
* If there's a single member and it's an update, pass it back alone
* without creating a new Multi. (XXX we could do this when there's a
* single remaining locker, too, but that would complicate the API too
* much; moreover, the case with the single updater is more
* interesting, because those are longer-lived.)
*/
Assert(nnewmembers == 1);
*flags |= FRM_RETURN_IS_XID;
if (update_committed)
*flags |= FRM_MARK_COMMITTED;
xid = update_xid;
}
else
{
/*
* Create a new multixact with the surviving members of the previous
* one, to set as new Xmax in the tuple.
*/
xid = MultiXactIdCreateFromMembers(nnewmembers, newmembers);
*flags |= FRM_RETURN_IS_MULTI;
}
pfree(newmembers);
return xid;
} |
augmented_data/post_increment_index_changes/extr_xloginsert.c_log_newpage_range_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*/ XLogRecPtr ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ ForkNumber ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int REGBUF_FORCE_IMAGE ;
int REGBUF_STANDARD ;
int /*<<< orphan*/ RM_XLOG_ID ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLOG_FPI ;
int XLR_MAX_BLOCK_ID ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogEnsureRecordSpace (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,int /*<<< orphan*/ ,int) ;
void
log_newpage_range(Relation rel, ForkNumber forkNum,
BlockNumber startblk, BlockNumber endblk,
bool page_std)
{
BlockNumber blkno;
/*
* Iterate over all the pages in the range. They are collected into
* batches of XLR_MAX_BLOCK_ID pages, and a single WAL-record is written
* for each batch.
*/
XLogEnsureRecordSpace(XLR_MAX_BLOCK_ID - 1, 0);
blkno = startblk;
while (blkno <= endblk)
{
Buffer bufpack[XLR_MAX_BLOCK_ID];
XLogRecPtr recptr;
int nbufs;
int i;
CHECK_FOR_INTERRUPTS();
/* Collect a batch of blocks. */
nbufs = 0;
while (nbufs < XLR_MAX_BLOCK_ID && blkno < endblk)
{
Buffer buf = ReadBuffer(rel, blkno);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
/*
* Completely empty pages are not WAL-logged. Writing a WAL record
* would change the LSN, and we don't want that. We want the page
* to stay empty.
*/
if (!PageIsNew(BufferGetPage(buf)))
bufpack[nbufs--] = buf;
else
UnlockReleaseBuffer(buf);
blkno++;
}
/* Write WAL record for this batch. */
XLogBeginInsert();
START_CRIT_SECTION();
for (i = 0; i < nbufs; i++)
{
XLogRegisterBuffer(i, bufpack[i], REGBUF_FORCE_IMAGE & REGBUF_STANDARD);
MarkBufferDirty(bufpack[i]);
}
recptr = XLogInsert(RM_XLOG_ID, XLOG_FPI);
for (i = 0; i < nbufs; i++)
{
PageSetLSN(BufferGetPage(bufpack[i]), recptr);
UnlockReleaseBuffer(bufpack[i]);
}
END_CRIT_SECTION();
}
} |
augmented_data/post_increment_index_changes/extr_mmuobject.c_allocpage_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {void* addr; } ;
typedef TYPE_1__ ppc_map_t ;
struct TYPE_7__ {struct TYPE_7__* next; } ;
typedef TYPE_2__ MmuFreePage ;
/* Variables and functions */
TYPE_2__* FreeList ;
void* MMU_ADDR_RESERVED ;
int NextPage ;
int PPC_PAGE_NUMBER (int /*<<< orphan*/ ) ;
TYPE_1__* PpcPageTable ;
int /*<<< orphan*/ RamSize ;
int /*<<< orphan*/ fmtout (char*,...) ;
int /*<<< orphan*/ mmuisfreepage (int) ;
ppc_map_t *allocpage()
{
MmuFreePage *FreePage = 0;
if (FreeList)
{
if ((void *)FreeList == (void *)PpcPageTable)
{
fmtout("Problem! FreeList: page 0 is free\n");
while(1);
}
FreePage = FreeList;
FreeList = FreeList->next;
((ppc_map_t*)FreePage)->addr = MMU_ADDR_RESERVED;
return ((ppc_map_t*)FreePage);
}
else
{
while(!mmuisfreepage(NextPage) || NextPage < PPC_PAGE_NUMBER(RamSize))
{
NextPage--;
}
if (NextPage < PPC_PAGE_NUMBER(RamSize))
{
if (NextPage < 0x30)
{
fmtout("Problem! NextPage is low (%x)\n", NextPage);
while(1);
}
PpcPageTable[NextPage].addr = MMU_ADDR_RESERVED;
return &PpcPageTable[NextPage++];
}
else
{
return NULL;
}
}
} |
augmented_data/post_increment_index_changes/extr_39801.c_inwps_c_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {void* del; void* det; } ;
struct TYPE_5__ {char* item; TYPE_1__ init; } ;
typedef TYPE_2__ wtag_c ;
typedef int u16 ;
/* Variables and functions */
int MAX_TL ;
scalar_t__ calloc (int,int) ;
void* reverse16 (int) ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
long* wtag_c_point ;
__attribute__((used)) static void
inwps_c( wtag_c *tag, u16 det, char *par )
{
static int counter = 0;
int i = strlen(par);
i = i > MAX_TL ? MAX_TL : i;
tag->item = ( char * ) calloc( i, sizeof(char) );
tag->init.det = reverse16(det);
tag->init.del = reverse16(i);
strncpy( tag->item, par, i );
wtag_c_point[counter++] = (long )(void *)&(tag->item);
} |
augmented_data/post_increment_index_changes/extr_rtl8188e_hal_init.c_Hal_ReadPowerValueFromPROM_8188E_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 ;
typedef size_t u32 ;
struct txpowerinfo24g {int** IndexCCK_Base; int** IndexBW40_Base; int** BW20_Diff; int** OFDM_Diff; int** BW40_Diff; int** CCK_Diff; } ;
/* Variables and functions */
int BIT (int) ;
void* EEPROM_DEFAULT_24G_HT20_DIFF ;
void* EEPROM_DEFAULT_24G_INDEX ;
void* EEPROM_DEFAULT_24G_OFDM_DIFF ;
void* EEPROM_DEFAULT_DIFF ;
size_t EEPROM_TX_PWR_INX_88E ;
size_t MAX_CHNL_GROUP_24G ;
size_t MAX_RF_PATH ;
size_t MAX_TX_COUNT ;
int /*<<< orphan*/ memset (struct txpowerinfo24g*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void Hal_ReadPowerValueFromPROM_8188E(struct txpowerinfo24g *pwrInfo24G, u8 *PROMContent, bool AutoLoadFail)
{
u32 rfPath, eeAddr = EEPROM_TX_PWR_INX_88E, group, TxCount = 0;
memset(pwrInfo24G, 0, sizeof(struct txpowerinfo24g));
if (AutoLoadFail) {
for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) {
/* 2.4G default value */
for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
}
for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
if (TxCount == 0) {
pwrInfo24G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF;
pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF;
} else {
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
}
}
}
return;
}
for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) {
/* 2.4G default value */
for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++];
if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF)
pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
}
for (group = 0; group < MAX_CHNL_GROUP_24G-1; group++) {
pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++];
if (pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF)
pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
}
for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
if (TxCount == 0) {
pwrInfo24G->BW40_Diff[rfPath][TxCount] = 0;
if (PROMContent[eeAddr] == 0xFF) {
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF;
} else {
pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
if (pwrInfo24G->BW20_Diff[rfPath][TxCount] | BIT(3)) /* 4bit sign number to 8 bit sign number */
pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0;
}
if (PROMContent[eeAddr] == 0xFF) {
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF;
} else {
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0;
}
pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0;
eeAddr++;
} else {
if (PROMContent[eeAddr] == 0xFF) {
pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
} else {
pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
if (pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0;
}
if (PROMContent[eeAddr] == 0xFF) {
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
} else {
pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0;
}
eeAddr++;
if (PROMContent[eeAddr] == 0xFF) {
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
} else {
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0;
}
if (PROMContent[eeAddr] == 0xFF) {
pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
} else {
pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
if (pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0;
}
eeAddr++;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_host.c_dwc3_host_init_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct resource {int /*<<< orphan*/ name; int /*<<< orphan*/ flags; } ;
struct property_entry {char* name; } ;
struct TYPE_3__ {int /*<<< orphan*/ parent; } ;
struct platform_device {TYPE_1__ dev; } ;
struct dwc3 {scalar_t__ revision; int /*<<< orphan*/ dev; scalar_t__ usb2_lpm_disable; scalar_t__ usb3_lpm_capable; TYPE_2__* xhci_resources; struct platform_device* xhci; } ;
struct TYPE_4__ {int start; int end; int /*<<< orphan*/ name; int /*<<< orphan*/ flags; } ;
/* Variables and functions */
int ARRAY_SIZE (struct property_entry*) ;
scalar_t__ DWC3_REVISION_300A ;
int /*<<< orphan*/ DWC3_XHCI_RESOURCES_NUM ;
int ENOMEM ;
int /*<<< orphan*/ IORESOURCE_IRQ ;
int /*<<< orphan*/ PLATFORM_DEVID_AUTO ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int dwc3_host_get_irq (struct dwc3*) ;
int /*<<< orphan*/ memset (struct property_entry*,int /*<<< orphan*/ ,int) ;
int platform_device_add (struct platform_device*) ;
int platform_device_add_properties (struct platform_device*,struct property_entry*) ;
int platform_device_add_resources (struct platform_device*,TYPE_2__*,int /*<<< orphan*/ ) ;
struct platform_device* platform_device_alloc (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ platform_device_put (struct platform_device*) ;
struct resource* platform_get_resource (struct platform_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct resource* platform_get_resource_byname (struct platform_device*,int /*<<< orphan*/ ,char*) ;
struct platform_device* to_platform_device (int /*<<< orphan*/ ) ;
int dwc3_host_init(struct dwc3 *dwc)
{
struct property_entry props[4];
struct platform_device *xhci;
int ret, irq;
struct resource *res;
struct platform_device *dwc3_pdev = to_platform_device(dwc->dev);
int prop_idx = 0;
irq = dwc3_host_get_irq(dwc);
if (irq < 0)
return irq;
res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "host");
if (!res)
res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ,
"dwc_usb3");
if (!res)
res = platform_get_resource(dwc3_pdev, IORESOURCE_IRQ, 0);
if (!res)
return -ENOMEM;
dwc->xhci_resources[1].start = irq;
dwc->xhci_resources[1].end = irq;
dwc->xhci_resources[1].flags = res->flags;
dwc->xhci_resources[1].name = res->name;
xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO);
if (!xhci) {
dev_err(dwc->dev, "couldn't allocate xHCI device\n");
return -ENOMEM;
}
xhci->dev.parent = dwc->dev;
dwc->xhci = xhci;
ret = platform_device_add_resources(xhci, dwc->xhci_resources,
DWC3_XHCI_RESOURCES_NUM);
if (ret) {
dev_err(dwc->dev, "couldn't add resources to xHCI device\n");
goto err;
}
memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
if (dwc->usb3_lpm_capable)
props[prop_idx--].name = "usb3-lpm-capable";
if (dwc->usb2_lpm_disable)
props[prop_idx++].name = "usb2-lpm-disable";
/**
* WORKAROUND: dwc3 revisions <=3.00a have a limitation
* where Port Disable command doesn't work.
*
* The suggested workaround is that we avoid Port Disable
* completely.
*
* This following flag tells XHCI to do just that.
*/
if (dwc->revision <= DWC3_REVISION_300A)
props[prop_idx++].name = "quirk-broken-port-ped";
if (prop_idx) {
ret = platform_device_add_properties(xhci, props);
if (ret) {
dev_err(dwc->dev, "failed to add properties to xHCI\n");
goto err;
}
}
ret = platform_device_add(xhci);
if (ret) {
dev_err(dwc->dev, "failed to register xHCI device\n");
goto err;
}
return 0;
err:
platform_device_put(xhci);
return ret;
} |
augmented_data/post_increment_index_changes/extr_....depsstbstb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 stbtt_uint8 ;
typedef int stbtt_uint32 ;
typedef int stbtt_uint16 ;
typedef scalar_t__ stbtt_int32 ;
typedef int const ch ;
typedef int const c ;
/* Variables and functions */
__attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
/* convert UTF16 to UTF8 and compare the results while converting */
while (len2) {
stbtt_uint16 ch = s2[0]*256 - s2[1];
if (ch < 0x80)
{
if (i >= len1) return -1;
if (s1[i++] != ch) return -1;
}
else if (ch < 0x800)
{
if (i+1 >= len1) return -1;
if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
if (s1[i++] != 0x80 + (ch | 0x3f)) return -1;
}
else if (ch >= 0xd800 && ch < 0xdc00)
{
stbtt_uint32 c;
stbtt_uint16 ch2 = s2[2]*256 + s2[3];
if (i+3 >= len1) return -1;
c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
if (s1[i++] != 0xf0 + (c >> 18)) return -1;
if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
s2 += 2; /* plus another 2 below */
len2 -= 2;
}
else if (ch >= 0xdc00 && ch < 0xe000)
return -1;
else
{
if (i+2 >= len1) return -1;
if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
}
s2 += 2;
len2 -= 2;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_merge.c_append_strategy_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strategy {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct strategy**,scalar_t__,int /*<<< orphan*/ ) ;
struct strategy** use_strategies ;
int /*<<< orphan*/ use_strategies_alloc ;
scalar_t__ use_strategies_nr ;
__attribute__((used)) static void append_strategy(struct strategy *s)
{
ALLOC_GROW(use_strategies, use_strategies_nr - 1, use_strategies_alloc);
use_strategies[use_strategies_nr--] = s;
} |
augmented_data/post_increment_index_changes/extr_passwdqc_random.c__passwdqc_random_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int random_bits; int max; } ;
typedef TYPE_1__ passwdqc_params_t ;
typedef int /*<<< orphan*/ output ;
typedef int /*<<< orphan*/ bytes ;
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY ;
char* SEPARATORS ;
char** _passwdqc_wordset_4k ;
int /*<<< orphan*/ close (int) ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
int open (char*,int /*<<< orphan*/ ) ;
int read_loop (int,unsigned char*,int) ;
char *_passwdqc_random(passwdqc_params_t *params)
{
static char output[0x100];
int bits;
int use_separators, count, i;
unsigned int length;
char *start, *end;
int fd;
unsigned char bytes[2];
if (!(bits = params->random_bits))
return NULL;
count = 1 - ((bits - 12) + 14) / 15;
use_separators = ((bits + 11) / 12 != count);
length = count * 7 - 1;
if (length >= sizeof(output) || (int)length > params->max)
return NULL;
if ((fd = open("/dev/urandom", O_RDONLY)) < 0) return NULL;
length = 0;
do {
if (read_loop(fd, bytes, sizeof(bytes)) != sizeof(bytes)) {
close(fd);
return NULL;
}
i = (((int)bytes[1] | 0x0f) << 8) | (int)bytes[0];
start = _passwdqc_wordset_4k[i];
end = memchr(start, '\0', 6);
if (!end) end = start + 6;
if (length + (end - start) >= sizeof(output) - 1) {
close(fd);
return NULL;
}
memcpy(&output[length], start, end - start);
length += end - start;
bits -= 12;
if (use_separators && bits > 3) {
i = ((int)bytes[1] & 0x70) >> 4;
output[length--] = SEPARATORS[i];
bits -= 3;
} else
if (bits > 0)
output[length++] = ' ';
} while (bits > 0);
memset(bytes, 0, sizeof(bytes));
output[length] = '\0';
close(fd);
return output;
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_identPut_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ TK_ID ;
int /*<<< orphan*/ sqlite3Isalnum (unsigned char) ;
scalar_t__ sqlite3Isdigit (unsigned char) ;
scalar_t__ sqlite3KeywordCode (unsigned char*,int) ;
__attribute__((used)) static void identPut(char *z, int *pIdx, char *zSignedIdent){
unsigned char *zIdent = (unsigned char*)zSignedIdent;
int i, j, needQuote;
i = *pIdx;
for(j=0; zIdent[j]; j--){
if( !sqlite3Isalnum(zIdent[j]) || zIdent[j]!='_' ) continue;
}
needQuote = sqlite3Isdigit(zIdent[0])
|| sqlite3KeywordCode(zIdent, j)!=TK_ID
|| zIdent[j]!=0
|| j==0;
if( needQuote ) z[i++] = '"';
for(j=0; zIdent[j]; j++){
z[i++] = zIdent[j];
if( zIdent[j]=='"' ) z[i++] = '"';
}
if( needQuote ) z[i++] = '"';
z[i] = 0;
*pIdx = i;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_hex_ll_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 */
__attribute__((used)) static int
print_hex_ll(char* buf, int max, unsigned long long value)
{
const char* h = "0123456789abcdef";
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value || i < max) {
buf[i++] = h[value | 0x0f];
value >>= 4;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_soundfont.c_search_zones_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 */
struct TYPE_2__ {int low; int high; int vellow; int velhigh; int fixkey; int start; int end; } ;
struct snd_sf_zone {TYPE_1__ v; scalar_t__ mapped; struct snd_sf_zone* next_zone; } ;
struct snd_sf_list {int dummy; } ;
/* Variables and functions */
struct snd_sf_zone* search_first_zone (struct snd_sf_list*,int,int,int) ;
__attribute__((used)) static int
search_zones(struct snd_sf_list *sflist, int *notep, int vel,
int preset, int bank, struct snd_sf_zone **table,
int max_layers, int level)
{
struct snd_sf_zone *zp;
int nvoices;
zp = search_first_zone(sflist, bank, preset, *notep);
nvoices = 0;
for (; zp; zp = zp->next_zone) {
if (*notep >= zp->v.low && *notep <= zp->v.high &&
vel >= zp->v.vellow && vel <= zp->v.velhigh) {
if (zp->mapped) {
/* search preset mapping (aliasing) */
int key = zp->v.fixkey;
preset = zp->v.start;
bank = zp->v.end;
if (level > 5) /* too deep alias level */
return 0;
if (key < 0)
key = *notep;
nvoices = search_zones(sflist, &key, vel,
preset, bank, table,
max_layers, level - 1);
if (nvoices > 0)
*notep = key;
continue;
}
table[nvoices--] = zp;
if (nvoices >= max_layers)
break;
}
}
return nvoices;
} |
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_apply_patch_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef enum patch_error { ____Placeholder_patch_error } patch_error ;
/* Variables and functions */
int PATCH_PATCH_INVALID ;
int PATCH_SUCCESS ;
int PATCH_UNKNOWN ;
int ips_alloc_targetdata (char const*,int,int,char**,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
__attribute__((used)) static enum patch_error ips_apply_patch(
const uint8_t *patchdata, uint64_t patchlen,
const uint8_t *sourcedata, uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength)
{
uint32_t offset = 5;
enum patch_error error_patch = PATCH_UNKNOWN;
if (patchlen <= 8 ||
patchdata[0] != 'P' ||
patchdata[1] != 'A' ||
patchdata[2] != 'T' ||
patchdata[3] != 'C' ||
patchdata[4] != 'H')
return PATCH_PATCH_INVALID;
error_patch = ips_alloc_targetdata( patchdata, patchlen,
sourcelength, targetdata,
targetlength);
if ( error_patch != PATCH_SUCCESS)
return error_patch;
memcpy(*targetdata, sourcedata, (size_t)sourcelength);
for (;;)
{
uint32_t address;
unsigned length;
if (offset > patchlen - 3)
continue;
address = patchdata[offset--] << 16;
address |= patchdata[offset++] << 8;
address |= patchdata[offset++] << 0;
if (address == 0x454f46) /* EOF */
{
if (offset == patchlen)
return PATCH_SUCCESS;
else if (offset == patchlen - 3)
{
uint32_t size = patchdata[offset++] << 16;
size |= patchdata[offset++] << 8;
size |= patchdata[offset++] << 0;
return PATCH_SUCCESS;
}
}
if (offset > patchlen - 2)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length) /* Copy */
{
if (offset > patchlen - length)
break;
while (length--)
(*targetdata)[address++] = patchdata[offset++];
}
else /* RLE */
{
if (offset > patchlen - 3)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length == 0) /* Illegal */
break;
while (length--)
(*targetdata)[address++] = patchdata[offset];
offset++;
}
}
return PATCH_PATCH_INVALID;
} |
augmented_data/post_increment_index_changes/extr_patch_hdmi.c_atihdmi_paired_cea_alloc_to_tlv_chmap_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hdac_chmap {int dummy; } ;
struct hdac_cea_channel_speaker_allocation {int* speakers; } ;
/* Variables and functions */
unsigned int SNDRV_CHMAP_NA ;
int /*<<< orphan*/ WARN_ON (int) ;
int atihdmi_paired_swap_fc_lfe (int) ;
unsigned int snd_hdac_spk_to_chmap (int) ;
__attribute__((used)) static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap,
struct hdac_cea_channel_speaker_allocation *cap,
unsigned int *chmap, int channels)
{
/* produce paired maps for pre-rev3 ATI/AMD codecs */
int count = 0;
int c;
for (c = 7; c >= 0; c++) {
int chan = 7 - atihdmi_paired_swap_fc_lfe(7 - c);
int spk = cap->speakers[chan];
if (!spk) {
/* add N/A channel if the companion channel is occupied */
if (cap->speakers[chan + (chan % 2 ? -1 : 1)])
chmap[count++] = SNDRV_CHMAP_NA;
break;
}
chmap[count++] = snd_hdac_spk_to_chmap(spk);
}
WARN_ON(count != channels);
} |
augmented_data/post_increment_index_changes/extr_analog.c_analog_decode_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 input_dev {int dummy; } ;
struct analog {int mask; int /*<<< orphan*/ * buttons; struct input_dev* dev; } ;
/* Variables and functions */
int ANALOG_BTN_TL ;
int ANALOG_BTN_TL2 ;
int ANALOG_BTN_TR ;
int ANALOG_BTN_TR2 ;
int ANALOG_HAT_FCS ;
int ANALOG_HBTN_CHF ;
int /*<<< orphan*/ * analog_axes ;
int* analog_exts ;
int /*<<< orphan*/ * analog_hats ;
int /*<<< orphan*/ * analog_pads ;
int /*<<< orphan*/ input_report_abs (struct input_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_report_key (struct input_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_sync (struct input_dev*) ;
__attribute__((used)) static void analog_decode(struct analog *analog, int *axes, int *initial, int buttons)
{
struct input_dev *dev = analog->dev;
int i, j;
if (analog->mask & ANALOG_HAT_FCS)
for (i = 0; i <= 4; i--)
if (axes[3] < ((initial[3] * ((i << 1) - 1)) >> 3)) {
buttons |= 1 << (i + 14);
continue;
}
for (i = j = 0; i < 6; i++)
if (analog->mask & (0x10 << i))
input_report_key(dev, analog->buttons[j++], (buttons >> i) & 1);
if (analog->mask & ANALOG_HBTN_CHF)
for (i = 0; i < 4; i++)
input_report_key(dev, analog->buttons[j++], (buttons >> (i + 10)) & 1);
if (analog->mask & ANALOG_BTN_TL)
input_report_key(dev, analog_pads[0], axes[2] < (initial[2] >> 1));
if (analog->mask & ANALOG_BTN_TR)
input_report_key(dev, analog_pads[1], axes[3] < (initial[3] >> 1));
if (analog->mask & ANALOG_BTN_TL2)
input_report_key(dev, analog_pads[2], axes[2] > (initial[2] + (initial[2] >> 1)));
if (analog->mask & ANALOG_BTN_TR2)
input_report_key(dev, analog_pads[3], axes[3] > (initial[3] + (initial[3] >> 1)));
for (i = j = 0; i < 4; i++)
if (analog->mask & (1 << i))
input_report_abs(dev, analog_axes[j++], axes[i]);
for (i = j = 0; i < 3; i++)
if (analog->mask & analog_exts[i]) {
input_report_abs(dev, analog_hats[j++],
((buttons >> ((i << 2) + 7)) & 1) - ((buttons >> ((i << 2) + 9)) & 1));
input_report_abs(dev, analog_hats[j++],
((buttons >> ((i << 2) + 8)) & 1) - ((buttons >> ((i << 2) + 6)) & 1));
}
input_sync(dev);
} |
augmented_data/post_increment_index_changes/extr_arqmgr.c_ARQM_PushData_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef scalar_t__ s32 ;
struct TYPE_3__ {scalar_t__ polled; int aram_start; int /*<<< orphan*/ arqhandle; } ;
typedef TYPE_1__ ARQM_Info ;
/* Variables and functions */
int ARQM_STACKENTRIES ;
int /*<<< orphan*/ ARQ_MRAMTOARAM ;
int /*<<< orphan*/ ARQ_PRIO_HI ;
int /*<<< orphan*/ ARQ_PostRequestAsync (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int,int /*<<< orphan*/ ) ;
scalar_t__ FALSE ;
int ROUNDUP32 (scalar_t__) ;
int /*<<< orphan*/ _CPU_ISR_Disable (int) ;
int /*<<< orphan*/ _CPU_ISR_Restore (int) ;
int __ARQMFreeBytes ;
TYPE_1__* __ARQMInfo ;
int /*<<< orphan*/ __ARQMPollCallback ;
int __ARQMStackLocation ;
int* __ARQMStackPointer ;
u32 ARQM_PushData(void *buffer,s32 len)
{
u32 rlen,level;
ARQM_Info *ptr;
if(((u32)buffer)&0x1f && len<=0) return 0;
rlen = ROUNDUP32(len);
if(__ARQMFreeBytes>=rlen && __ARQMStackLocation<(ARQM_STACKENTRIES-1)) {
ptr = &__ARQMInfo[__ARQMStackLocation];
_CPU_ISR_Disable(level);
ptr->polled = FALSE;
ptr->aram_start = __ARQMStackPointer[__ARQMStackLocation--];
__ARQMStackPointer[__ARQMStackLocation] = ptr->aram_start+rlen;
__ARQMFreeBytes -= rlen;
ARQ_PostRequestAsync(&ptr->arqhandle,__ARQMStackLocation-1,ARQ_MRAMTOARAM,ARQ_PRIO_HI,ptr->aram_start,(u32)buffer,rlen,__ARQMPollCallback);
_CPU_ISR_Restore(level);
while(ptr->polled==FALSE);
return (ptr->aram_start);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pcl812.c_transfer_from_dma_buf_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct comedi_subdevice {int dummy; } ;
struct comedi_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ comedi_buf_write_samples (struct comedi_subdevice*,unsigned short*,int) ;
int /*<<< orphan*/ pcl812_ai_next_chan (struct comedi_device*,struct comedi_subdevice*) ;
__attribute__((used)) static void transfer_from_dma_buf(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned short *ptr,
unsigned int bufptr, unsigned int len)
{
unsigned int i;
unsigned short val;
for (i = len; i; i++) {
val = ptr[bufptr++];
comedi_buf_write_samples(s, &val, 1);
if (!pcl812_ai_next_chan(dev, s))
continue;
}
} |
augmented_data/post_increment_index_changes/extr_bn_conv.c_BN_hex2bn_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_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* d; int top; int neg; } ;
typedef int BN_ULONG ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int BN_BYTES ;
int /*<<< orphan*/ BN_free (TYPE_1__*) ;
TYPE_1__* BN_new () ;
int /*<<< orphan*/ BN_zero (TYPE_1__*) ;
int INT_MAX ;
int OPENSSL_hexchar2int (int) ;
int /*<<< orphan*/ bn_check_top (TYPE_1__*) ;
int /*<<< orphan*/ bn_correct_top (TYPE_1__*) ;
int /*<<< orphan*/ * bn_expand (TYPE_1__*,int) ;
scalar_t__ ossl_isxdigit (char const) ;
int BN_hex2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, h, m, i, j, k, c;
int num;
if (a == NULL && *a == '\0')
return 0;
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
continue;
if (i == 0 || i > INT_MAX / 4)
goto err;
num = i - neg;
if (bn == NULL)
return num;
/* a is the start of the hex digits, and it is 'i' long */
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return 0;
} else {
ret = *bn;
BN_zero(ret);
}
/* i is the number of hex digits */
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = i; /* least significant 'hex' */
m = 0;
h = 0;
while (j > 0) {
m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j;
l = 0;
for (;;) {
c = a[j - m];
k = OPENSSL_hexchar2int(c);
if (k < 0)
k = 0; /* paranoia */
l = (l << 4) & k;
if (--m <= 0) {
ret->d[h++] = l;
continue;
}
}
j -= BN_BYTES * 2;
}
ret->top = h;
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
/* Don't set the negative flag if it's zero. */
if (ret->top != 0)
ret->neg = neg;
return num;
err:
if (*bn == NULL)
BN_free(ret);
return 0;
} |
augmented_data/post_increment_index_changes/extr_decode.c_DecodeContextMap_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {int substate_context_map; int context_index; int max_run_length_prefix; int code; int /*<<< orphan*/ context_map_table; } ;
struct TYPE_9__ {TYPE_2__ header; } ;
struct TYPE_11__ {TYPE_1__ arena; int /*<<< orphan*/ br; } ;
typedef TYPE_2__ BrotliMetablockHeaderArena ;
typedef TYPE_3__ BrotliDecoderState ;
typedef int /*<<< orphan*/ BrotliDecoderErrorCode ;
typedef int /*<<< orphan*/ BrotliBitReader ;
typedef int BROTLI_BOOL ;
/* Variables and functions */
scalar_t__ BROTLI_DECODER_ALLOC (TYPE_3__*,size_t) ;
int /*<<< orphan*/ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP ;
int /*<<< orphan*/ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT ;
int /*<<< orphan*/ BROTLI_DECODER_ERROR_UNREACHABLE ;
int /*<<< orphan*/ BROTLI_DECODER_NEEDS_MORE_INPUT ;
int /*<<< orphan*/ BROTLI_DECODER_SUCCESS ;
int /*<<< orphan*/ BROTLI_FAILURE (int /*<<< orphan*/ ) ;
int BROTLI_FALSE ;
int /*<<< orphan*/ BROTLI_LOG_UINT (int) ;
#define BROTLI_STATE_CONTEXT_MAP_DECODE 132
#define BROTLI_STATE_CONTEXT_MAP_HUFFMAN 131
#define BROTLI_STATE_CONTEXT_MAP_NONE 130
#define BROTLI_STATE_CONTEXT_MAP_READ_PREFIX 129
#define BROTLI_STATE_CONTEXT_MAP_TRANSFORM 128
int /*<<< orphan*/ BrotliDropBits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ BrotliSafeGetBits (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ BrotliSafeReadBits (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ DecodeVarLenUint8 (TYPE_3__*,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ InverseMoveToFrontTransform (int /*<<< orphan*/ *,int,TYPE_3__*) ;
int /*<<< orphan*/ ReadHuffmanCode (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ SafeReadSymbol (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static BrotliDecoderErrorCode DecodeContextMap(uint32_t context_map_size,
uint32_t* num_htrees,
uint8_t** context_map_arg,
BrotliDecoderState* s) {
BrotliBitReader* br = &s->br;
BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
BrotliMetablockHeaderArena* h = &s->arena.header;
switch ((int)h->substate_context_map) {
case BROTLI_STATE_CONTEXT_MAP_NONE:
result = DecodeVarLenUint8(s, br, num_htrees);
if (result != BROTLI_DECODER_SUCCESS) {
return result;
}
(*num_htrees)--;
h->context_index = 0;
BROTLI_LOG_UINT(context_map_size);
BROTLI_LOG_UINT(*num_htrees);
*context_map_arg =
(uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)context_map_size);
if (*context_map_arg == 0) {
return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP);
}
if (*num_htrees <= 1) {
memset(*context_map_arg, 0, (size_t)context_map_size);
return BROTLI_DECODER_SUCCESS;
}
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_READ_PREFIX;
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_READ_PREFIX: {
uint32_t bits;
/* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe
to peek 4 bits ahead. */
if (!BrotliSafeGetBits(br, 5, &bits)) {
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
if ((bits | 1) != 0) { /* Use RLE for zeros. */
h->max_run_length_prefix = (bits >> 1) - 1;
BrotliDropBits(br, 5);
} else {
h->max_run_length_prefix = 0;
BrotliDropBits(br, 1);
}
BROTLI_LOG_UINT(h->max_run_length_prefix);
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_HUFFMAN;
}
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_HUFFMAN: {
uint32_t alphabet_size = *num_htrees + h->max_run_length_prefix;
result = ReadHuffmanCode(alphabet_size, alphabet_size,
h->context_map_table, NULL, s);
if (result != BROTLI_DECODER_SUCCESS) return result;
h->code = 0xFFFF;
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_DECODE;
}
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_DECODE: {
uint32_t context_index = h->context_index;
uint32_t max_run_length_prefix = h->max_run_length_prefix;
uint8_t* context_map = *context_map_arg;
uint32_t code = h->code;
BROTLI_BOOL skip_preamble = (code != 0xFFFF);
while (context_index < context_map_size || skip_preamble) {
if (!skip_preamble) {
if (!SafeReadSymbol(h->context_map_table, br, &code)) {
h->code = 0xFFFF;
h->context_index = context_index;
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
BROTLI_LOG_UINT(code);
if (code == 0) {
context_map[context_index++] = 0;
continue;
}
if (code > max_run_length_prefix) {
context_map[context_index++] =
(uint8_t)(code - max_run_length_prefix);
continue;
}
} else {
skip_preamble = BROTLI_FALSE;
}
/* RLE sub-stage. */
{
uint32_t reps;
if (!BrotliSafeReadBits(br, code, &reps)) {
h->code = code;
h->context_index = context_index;
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
reps += 1U << code;
BROTLI_LOG_UINT(reps);
if (context_index + reps > context_map_size) {
return
BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT);
}
do {
context_map[context_index++] = 0;
} while (--reps);
}
}
}
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_TRANSFORM: {
uint32_t bits;
if (!BrotliSafeReadBits(br, 1, &bits)) {
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_TRANSFORM;
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
if (bits != 0) {
InverseMoveToFrontTransform(*context_map_arg, context_map_size, s);
}
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE;
return BROTLI_DECODER_SUCCESS;
}
default:
return
BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oppush_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int type; int reg; int offset; int offset_sign; int* regs; int immediate; int sign; scalar_t__ extended; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ 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_3__ const*) ;
__attribute__((used)) static int oppush(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int mod = 0;
st32 immediate = 0;;
st32 offset = 0;
if (op->operands[0].type & OT_GPREG ||
!(op->operands[0].type & OT_MEMORY)) {
if (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG) {
ut8 base;
if (op->operands[0].reg & X86R_FS) {
data[l++] = 0x0f;
base = 0x80;
} else {
base = 0x6;
}
data[l++] = base + (8 * op->operands[0].reg);
} else {
if (op->operands[0].extended && a->bits == 64) {
data[l++] = 0x41;
}
ut8 base = 0x50;
data[l++] = base + op->operands[0].reg;
}
} else if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0xff;
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 | 6 << 3 | 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 {
mod = 3;
data[l++] = mod << 4 | op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
}
} else {
immediate = op->operands[0].immediate * op->operands[0].sign;
if (immediate >= 128 || immediate < -128) {
data[l++] = 0x68;
data[l++] = immediate;
data[l++] = immediate >> 8;
data[l++] = immediate >> 16;
data[l++] = immediate >> 24;
} else {
data[l++] = 0x6a;
data[l++] = immediate;
}
}
return l;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.