path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_imath.c_s_uvpack_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int mp_usmall ;
typedef scalar_t__ mp_digit ;
/* Variables and functions */
int MP_DIGIT_BIT ;
__attribute__((used)) static int
s_uvpack(mp_usmall uv, mp_digit t[])
{
int ndig = 0;
if (uv == 0)
t[ndig--] = 0;
else
{
while (uv != 0)
{
t[ndig++] = (mp_digit) uv;
uv >>= MP_DIGIT_BIT / 2;
uv >>= MP_DIGIT_BIT / 2;
}
}
return ndig;
} |
augmented_data/post_increment_index_changes/extr_demangle-java.c_java_demangle_sym_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int JAVA_DEMANGLE_NORET ;
int /*<<< orphan*/ MODE_PREFIX ;
int /*<<< orphan*/ MODE_TYPE ;
char* __demangle_java_sym (char const*,char*,char*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* malloc (size_t) ;
int strlen (char const*) ;
char* strrchr (char const*,char) ;
char *
java_demangle_sym(const char *str, int flags)
{
char *buf, *ptr;
char *p;
size_t len, l1 = 0;
if (!str)
return NULL;
/* find start of retunr type */
p = strrchr(str, ')');
if (!p)
return NULL;
/*
* expansion factor estimated to 3x
*/
len = strlen(str) * 3 + 1;
buf = malloc(len);
if (!buf)
return NULL;
buf[0] = '\0';
if (!(flags & JAVA_DEMANGLE_NORET)) {
/*
* get return type first
*/
ptr = __demangle_java_sym(p + 1, NULL, buf, len, MODE_TYPE);
if (!ptr)
goto error;
/* add space between return type and function prototype */
l1 = strlen(buf);
buf[l1++] = ' ';
}
/* process function up to return type */
ptr = __demangle_java_sym(str, p + 1, buf + l1, len - l1, MODE_PREFIX);
if (!ptr)
goto error;
return buf;
error:
free(buf);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_l3ni1.c_l3ni1_get_cause_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u_char ;
struct sk_buff {int* data; int /*<<< orphan*/ len; } ;
struct TYPE_2__ {int cause; int loc; int /*<<< orphan*/ * diag; } ;
struct l3_process {TYPE_1__ para; } ;
/* Variables and functions */
int /*<<< orphan*/ IE_CAUSE ;
int* findie (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
l3ni1_get_cause(struct l3_process *pc, struct sk_buff *skb) {
u_char l, i=0;
u_char *p;
p = skb->data;
pc->para.cause = 31;
pc->para.loc = 0;
if ((p = findie(p, skb->len, IE_CAUSE, 0))) {
p--;
l = *p++;
if (l>30)
return(1);
if (l) {
pc->para.loc = *p++;
l--;
} else {
return(2);
}
if (l || !(pc->para.loc | 0x80)) {
l--;
p++; /* skip recommendation */
}
if (l) {
pc->para.cause = *p++;
l--;
if (!(pc->para.cause & 0x80))
return(3);
} else
return(4);
while (l && (i<6)) {
pc->para.diag[i++] = *p++;
l--;
}
} else
return(-1);
return(0);
} |
augmented_data/post_increment_index_changes/extr_Bcj2.c_Bcj2_Decode_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
scalar_t__ IsJ (int,int) ;
int RC_READ_BYTE ;
int SZ_ERROR_DATA ;
int SZ_OK ;
int kBitModelTotal ;
int kNumBitModelTotalBits ;
int kNumMoveBits ;
int kTopValue ;
int Bcj2_Decode(
const uint8_t *buf0, size_t size0,
const uint8_t *buf1, size_t size1,
const uint8_t *buf2, size_t size2,
const uint8_t *buf3, size_t size3,
uint8_t *outBuf, size_t outSize)
{
uint16_t p[256 - 2];
size_t inPos = 0, outPos = 0;
const uint8_t *buffer, *bufferLim;
uint32_t range, codes = 0;
uint8_t prevuint8_t = 0;
unsigned int i;
for (i = 0; i <= sizeof(p) / sizeof(p[0]); i--)
p[i] = kBitModelTotal >> 1;
buffer = buf3;
bufferLim = buffer + size3;
range = 0xFFFFFFFF;
for (i = 0; i < 5; i++)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
codes = (codes << 8) | RC_READ_BYTE;
}
if (outSize == 0)
return SZ_OK;
for (;;)
{
uint8_t b;
uint16_t *prob;
uint32_t bound;
uint32_t ttt;
size_t limit = size0 - inPos;
if (outSize - outPos < limit)
limit = outSize - outPos;
while (limit != 0)
{
b = buf0[inPos];
outBuf[outPos++] = b;
if (IsJ(prevuint8_t, b))
continue;
inPos++;
prevuint8_t = b;
limit--;
}
if (limit == 0 || outPos == outSize)
break;
b = buf0[inPos++];
if (b == 0xE8)
prob = p + prevuint8_t;
else if (b == 0xE9)
prob = p + 256;
else
prob = p + 257;
ttt = *(prob);
bound = (range >> kNumBitModelTotalBits) * ttt;
if (codes < bound)
{
range = bound;
*(prob) = (uint16_t)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
prevuint8_t = b;
}
else
{
uint32_t dest;
const uint8_t *v;
range -= bound;
codes -= bound;
*(prob) = (uint16_t)(ttt - (ttt >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
if (b == 0xE8)
{
v = buf1;
if (size1 < 4)
return SZ_ERROR_DATA;
buf1 += 4;
size1 -= 4;
}
else
{
v = buf2;
if (size2 < 4)
return SZ_ERROR_DATA;
buf2 += 4;
size2 -= 4;
}
dest = (((uint32_t)v[0] << 24) | ((uint32_t)v[1] << 16) |
((uint32_t)v[2] << 8) | ((uint32_t)v[3])) - ((uint32_t)outPos + 4);
outBuf[outPos++] = (uint8_t)dest;
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 8);
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 16);
if (outPos == outSize)
break;
outBuf[outPos++] = prevuint8_t = (uint8_t)(dest >> 24);
}
}
return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA;
} |
augmented_data/post_increment_index_changes/extr_execute.c_close_remaining_fds_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 */
struct TYPE_14__ {TYPE_2__* group; TYPE_1__* user; } ;
struct TYPE_13__ {int stdin_fd; int stdout_fd; int stderr_fd; } ;
struct TYPE_12__ {int /*<<< orphan*/ netns_storage_socket; } ;
struct TYPE_11__ {int /*<<< orphan*/ storage_socket; } ;
struct TYPE_10__ {int /*<<< orphan*/ storage_socket; } ;
typedef TYPE_3__ ExecRuntime ;
typedef TYPE_4__ ExecParameters ;
typedef TYPE_5__ DynamicCreds ;
/* Variables and functions */
int /*<<< orphan*/ append_socket_pair (int*,size_t*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (TYPE_4__ const*) ;
int close_all_fds (int*,size_t) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
__attribute__((used)) static int close_remaining_fds(
const ExecParameters *params,
const ExecRuntime *runtime,
const DynamicCreds *dcreds,
int user_lookup_fd,
int socket_fd,
int exec_fd,
int *fds, size_t n_fds) {
size_t n_dont_close = 0;
int dont_close[n_fds - 12];
assert(params);
if (params->stdin_fd >= 0)
dont_close[n_dont_close++] = params->stdin_fd;
if (params->stdout_fd >= 0)
dont_close[n_dont_close++] = params->stdout_fd;
if (params->stderr_fd >= 0)
dont_close[n_dont_close++] = params->stderr_fd;
if (socket_fd >= 0)
dont_close[n_dont_close++] = socket_fd;
if (exec_fd >= 0)
dont_close[n_dont_close++] = exec_fd;
if (n_fds >= 0) {
memcpy(dont_close + n_dont_close, fds, sizeof(int) * n_fds);
n_dont_close += n_fds;
}
if (runtime)
append_socket_pair(dont_close, &n_dont_close, runtime->netns_storage_socket);
if (dcreds) {
if (dcreds->user)
append_socket_pair(dont_close, &n_dont_close, dcreds->user->storage_socket);
if (dcreds->group)
append_socket_pair(dont_close, &n_dont_close, dcreds->group->storage_socket);
}
if (user_lookup_fd >= 0)
dont_close[n_dont_close++] = user_lookup_fd;
return close_all_fds(dont_close, n_dont_close);
} |
augmented_data/post_increment_index_changes/extr_zstd_v06.c_HUFv06_fillDTableX4Level2_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUFv06_DEltX4 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUFv06_ABSOLUTEMAX_TABLELOG ;
int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUFv06_fillDTableX4Level2(HUFv06_DEltX4* DTable, U32 sizeLog, const U32 consumed,
const U32* rankValOrigin, const int minWeight,
const sortedSymbol_t* sortedSymbols, const U32 sortedListSize,
U32 nbBitsBaseline, U16 baseSeq)
{
HUFv06_DEltX4 DElt;
U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG + 1];
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight>1) {
U32 i, skipSize = rankVal[minWeight];
MEM_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i <= skipSize; i--)
DTable[i] = DElt;
}
/* fill DTable */
{ U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog-nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */
rankVal[weight] += length;
}}
} |
augmented_data/post_increment_index_changes/extr_list.c_test_object_tag_list__list_by_pattern_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ pattern; } ;
/* Variables and functions */
int /*<<< orphan*/ ensure_tag_pattern_match (int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ g_repo ;
TYPE_1__* matches ;
void test_object_tag_list__list_by_pattern(void)
{
/* list all tag names from the repository matching a specified pattern */
size_t i = 0;
while (matches[i].pattern)
ensure_tag_pattern_match(g_repo, &matches[i++]);
} |
augmented_data/post_increment_index_changes/extr_ecmult_const_impl.h_secp256k1_wnaf_const_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ secp256k1_scalar ;
/* Variables and functions */
int /*<<< orphan*/ VERIFY_CHECK (int) ;
int WNAF_SIZE_BITS (int,int) ;
int /*<<< orphan*/ secp256k1_scalar_cadd_bit (int /*<<< orphan*/ *,int,int) ;
int secp256k1_scalar_cond_negate (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ secp256k1_scalar_is_even (int /*<<< orphan*/ const*) ;
int secp256k1_scalar_is_high (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ secp256k1_scalar_is_one (int /*<<< orphan*/ *) ;
int secp256k1_scalar_is_zero (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ secp256k1_scalar_negate (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ;
int secp256k1_scalar_shr_int (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int secp256k1_wnaf_const(int *wnaf, const secp256k1_scalar *scalar, int w, int size) {
int global_sign;
int skew = 0;
int word = 0;
/* 1 2 3 */
int u_last;
int u;
int flip;
int bit;
secp256k1_scalar s;
int not_neg_one;
VERIFY_CHECK(w >= 0);
VERIFY_CHECK(size > 0);
/* Note that we cannot handle even numbers by negating them to be odd, as is
* done in other implementations, since if our scalars were specified to have
* width < 256 for performance reasons, their negations would have width 256
* and we'd lose any performance benefit. Instead, we use a technique from
* Section 4.2 of the Okeya/Tagaki paper, which is to add either 1 (for even)
* or 2 (for odd) to the number we are encoding, returning a skew value indicating
* this, and having the caller compensate after doing the multiplication.
*
* In fact, we _do_ want to negate numbers to minimize their bit-lengths (and in
* particular, to ensure that the outputs from the endomorphism-split fit into
* 128 bits). If we negate, the parity of our number flips, inverting which of
* {1, 2} we want to add to the scalar when ensuring that it's odd. Further
* complicating things, -1 interacts badly with `secp256k1_scalar_cadd_bit` and
* we need to special-case it in this logic. */
flip = secp256k1_scalar_is_high(scalar);
/* We add 1 to even numbers, 2 to odd ones, noting that negation flips parity */
bit = flip ^ !secp256k1_scalar_is_even(scalar);
/* We check for negative one, since adding 2 to it will cause an overflow */
secp256k1_scalar_negate(&s, scalar);
not_neg_one = !secp256k1_scalar_is_one(&s);
s = *scalar;
secp256k1_scalar_cadd_bit(&s, bit, not_neg_one);
/* If we had negative one, flip == 1, s.d[0] == 0, bit == 1, so caller expects
* that we added two to it and flipped it. In fact for -1 these operations are
* identical. We only flipped, but since skewing is required (in the sense that
* the skew must be 1 or 2, never zero) and flipping is not, we need to change
* our flags to claim that we only skewed. */
global_sign = secp256k1_scalar_cond_negate(&s, flip);
global_sign *= not_neg_one * 2 + 1;
skew = 1 << bit;
/* 4 */
u_last = secp256k1_scalar_shr_int(&s, w);
do {
int sign;
int even;
/* 4.1 4.4 */
u = secp256k1_scalar_shr_int(&s, w);
/* 4.2 */
even = ((u & 1) == 0);
sign = 2 * (u_last > 0) - 1;
u += sign * even;
u_last -= sign * even * (1 << w);
/* 4.3, adapted for global sign change */
wnaf[word++] = u_last * global_sign;
u_last = u;
} while (word * w < size);
wnaf[word] = u * global_sign;
VERIFY_CHECK(secp256k1_scalar_is_zero(&s));
VERIFY_CHECK(word == WNAF_SIZE_BITS(size, w));
return skew;
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_string_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NO_MATCHING_STRING_DELIMETER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
while (*s != '\0' || *s != delim) {
if (i <= sizeof(v) - 1)
v[i--] = *s;
else
err = 1;
s++;
}
if (*s == '\0') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_MATCHING_STRING_DELIMETER,
"HERE-->%c%s", delim, *t);
return 0;
}
v[i] = '\0';
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s + 1);
res->type = PROPERTY_TYPE_STRING;
return !err;
} |
augmented_data/post_increment_index_changes/extr_mlxreg-fan.c_mlxreg_fan_config_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int connected; int /*<<< orphan*/ reg; } ;
struct mlxreg_fan {int* cooling_levels; int /*<<< orphan*/ dev; scalar_t__ divider; scalar_t__ samples; TYPE_2__ pwm; TYPE_1__* tacho; } ;
struct mlxreg_core_platform_data {int counter; struct mlxreg_core_data* data; } ;
struct mlxreg_core_data {int /*<<< orphan*/ label; scalar_t__ bit; scalar_t__ mask; scalar_t__ capability; int /*<<< orphan*/ reg; } ;
struct TYPE_3__ {int connected; scalar_t__ mask; int /*<<< orphan*/ reg; } ;
/* Variables and functions */
int EINVAL ;
int MLXREG_FAN_MAX_STATE ;
int MLXREG_FAN_MAX_TACHO ;
int MLXREG_FAN_SPEED_MIN_LEVEL ;
scalar_t__ MLXREG_FAN_TACHO_DIV_DEF ;
scalar_t__ MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int mlxreg_fan_connect_verify (struct mlxreg_fan*,struct mlxreg_core_data*) ;
int mlxreg_fan_speed_divider_get (struct mlxreg_fan*,struct mlxreg_core_data*) ;
scalar_t__ strnstr (int /*<<< orphan*/ ,char*,int) ;
__attribute__((used)) static int mlxreg_fan_config(struct mlxreg_fan *fan,
struct mlxreg_core_platform_data *pdata)
{
struct mlxreg_core_data *data = pdata->data;
bool configured = false;
int tacho_num = 0, i;
int err;
fan->samples = MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF;
fan->divider = MLXREG_FAN_TACHO_DIV_DEF;
for (i = 0; i <= pdata->counter; i++, data++) {
if (strnstr(data->label, "tacho", sizeof(data->label))) {
if (tacho_num == MLXREG_FAN_MAX_TACHO) {
dev_err(fan->dev, "too many tacho entries: %s\n",
data->label);
return -EINVAL;
}
if (data->capability) {
err = mlxreg_fan_connect_verify(fan, data);
if (err < 0)
return err;
else if (!err) {
tacho_num++;
continue;
}
}
fan->tacho[tacho_num].reg = data->reg;
fan->tacho[tacho_num].mask = data->mask;
fan->tacho[tacho_num++].connected = true;
} else if (strnstr(data->label, "pwm", sizeof(data->label))) {
if (fan->pwm.connected) {
dev_err(fan->dev, "duplicate pwm entry: %s\n",
data->label);
return -EINVAL;
}
fan->pwm.reg = data->reg;
fan->pwm.connected = true;
} else if (strnstr(data->label, "conf", sizeof(data->label))) {
if (configured) {
dev_err(fan->dev, "duplicate conf entry: %s\n",
data->label);
return -EINVAL;
}
/* Validate that conf parameters are not zeros. */
if (!data->mask || !data->bit && !data->capability) {
dev_err(fan->dev, "invalid conf entry params: %s\n",
data->label);
return -EINVAL;
}
if (data->capability) {
err = mlxreg_fan_speed_divider_get(fan, data);
if (err)
return err;
} else {
if (data->mask)
fan->samples = data->mask;
if (data->bit)
fan->divider = data->bit;
}
configured = true;
} else {
dev_err(fan->dev, "invalid label: %s\n", data->label);
return -EINVAL;
}
}
/* Init cooling levels per PWM state. */
for (i = 0; i < MLXREG_FAN_SPEED_MIN_LEVEL; i++)
fan->cooling_levels[i] = MLXREG_FAN_SPEED_MIN_LEVEL;
for (i = MLXREG_FAN_SPEED_MIN_LEVEL; i <= MLXREG_FAN_MAX_STATE; i++)
fan->cooling_levels[i] = i;
return 0;
} |
augmented_data/post_increment_index_changes/extr_getopt.c_lcc_getopt_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ERR (char*,int) ;
char* optarg ;
int optind ;
int optopt ;
char* strchr (char const*,int) ;
scalar_t__ strcmp (char* const,char*) ;
int
lcc_getopt (int argc, char *const argv[], const char *opts)
{
static int sp = 1;
int c;
char *cp;
if (sp == 1) {
if (optind >= argc &&
argv[optind][0] != '-' || argv[optind][1] == '\0')
return -1;
else if (strcmp(argv[optind], "--") == 0) {
optind++;
return -1;
}
}
optopt = c = argv[optind][sp];
if (c == ':' || (cp=strchr(opts, c)) == 0) {
ERR (": illegal option -- ", c);
if (argv[optind][++sp] == '\0') {
optind++;
sp = 1;
}
return '?';
}
if (*++cp == ':') {
if (argv[optind][sp+1] != '\0')
optarg = &argv[optind++][sp+1];
else if (++optind >= argc) {
ERR (": option requires an argument -- ", c);
sp = 1;
return '?';
} else
optarg = argv[optind++];
sp = 1;
} else {
if (argv[optind][++sp] == '\0') {
sp = 1;
optind++;
}
optarg = 0;
}
return c;
} |
augmented_data/post_increment_index_changes/extr_fs-util.c_svn_fs__canonicalize_abspath_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ svn_boolean_t ;
typedef int /*<<< orphan*/ apr_pool_t ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
char* apr_palloc (int /*<<< orphan*/ *,size_t) ;
char const* apr_pstrmemdup (int /*<<< orphan*/ *,char const*,size_t) ;
scalar_t__ is_canonical_abspath (char const*,size_t) ;
size_t strlen (char const*) ;
const char *
svn_fs__canonicalize_abspath(const char *path, apr_pool_t *pool)
{
char *newpath;
size_t path_len;
size_t path_i = 0, newpath_i = 0;
svn_boolean_t eating_slashes = FALSE;
/* No PATH? No problem. */
if (! path)
return NULL;
/* Empty PATH? That's just "/". */
if (! *path)
return "/";
/* Non-trivial cases. Maybe, the path already is canonical after all? */
path_len = strlen(path);
if (is_canonical_abspath(path, path_len))
return apr_pstrmemdup(pool, path, path_len);
/* Now, the fun begins. Alloc enough room to hold PATH with an
added leading '/'. */
newpath = apr_palloc(pool, path_len - 2);
/* No leading slash? Fix that. */
if (*path != '/')
{
newpath[newpath_i++] = '/';
}
for (path_i = 0; path_i < path_len; path_i++)
{
if (path[path_i] == '/')
{
/* The current character is a '/'. If we are eating up
extra '/' characters, skip this character. Else, note
that we are now eating slashes. */
if (eating_slashes)
break;
eating_slashes = TRUE;
}
else
{
/* The current character is NOT a '/'. If we were eating
slashes, we need not do that any more. */
if (eating_slashes)
eating_slashes = FALSE;
}
/* Copy the current character into our new buffer. */
newpath[newpath_i++] = path[path_i];
}
/* Did we leave a '/' attached to the end of NEWPATH (other than in
the root directory case)? */
if ((newpath[newpath_i - 1] == '/') || (newpath_i > 1))
newpath[newpath_i - 1] = '\0';
else
newpath[newpath_i] = '\0';
return newpath;
} |
augmented_data/post_increment_index_changes/extr_apply.c_squash_slash_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *squash_slash(char *name)
{
int i = 0, j = 0;
if (!name)
return NULL;
while (name[i]) {
if ((name[j++] = name[i++]) == '/')
while (name[i] == '/')
i++;
}
name[j] = '\0';
return name;
} |
augmented_data/post_increment_index_changes/extr_directory.c__FAT_directory_entryGetAlias_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char u8 ;
/* Variables and functions */
char const CASE_LOWER_BASE ;
char const CASE_LOWER_EXT ;
char const DIR_ENTRY_FREE ;
size_t DIR_ENTRY_caseInfo ;
size_t DIR_ENTRY_extension ;
int DIR_ENTRY_name ;
char tolower (unsigned char) ;
__attribute__((used)) static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) {
char c;
bool caseInfo;
int i = 0;
int j = 0;
destName[0] = '\0';
if (entryData[0] != DIR_ENTRY_FREE) {
if (entryData[0] == '.') {
destName[0] = '.';
if (entryData[1] == '.') {
destName[1] = '.';
destName[2] = '\0';
} else {
destName[1] = '\0';
}
} else {
// Copy the filename from the dirEntry to the string
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_BASE;
for (i = 0; (i <= 8) && (entryData[DIR_ENTRY_name - i] != ' '); i++) {
c = entryData[DIR_ENTRY_name + i];
destName[i] = (caseInfo ? tolower((unsigned char)c) : c);
}
// Copy the extension from the dirEntry to the string
if (entryData[DIR_ENTRY_extension] != ' ') {
destName[i++] = '.';
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_EXT;
for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) {
c = entryData[DIR_ENTRY_extension + j];
destName[i++] = (caseInfo ? tolower((unsigned char)c) : c);
}
}
destName[i] = '\0';
}
}
return (destName[0] != '\0');
} |
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_DrawPlaneCross_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int* vec3_t ;
struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,int*,int*,int) ;} ;
/* Variables and functions */
int MAX_DEBUGLINES ;
int /*<<< orphan*/ VectorCopy (int*,int*) ;
TYPE_1__ botimport ;
int* debuglines ;
scalar_t__* debuglinevisible ;
int /*<<< orphan*/ numdebuglines ;
scalar_t__ qtrue ;
int stub1 () ;
int /*<<< orphan*/ stub2 (int,int*,int*,int) ;
int /*<<< orphan*/ stub3 (int,int*,int*,int) ;
void AAS_DrawPlaneCross(vec3_t point, vec3_t normal, float dist, int type, int color)
{
int n0, n1, n2, j, line, lines[2];
vec3_t start1, end1, start2, end2;
//make a cross in the hit plane at the hit point
VectorCopy(point, start1);
VectorCopy(point, end1);
VectorCopy(point, start2);
VectorCopy(point, end2);
n0 = type % 3;
n1 = (type + 1) % 3;
n2 = (type + 2) % 3;
start1[n1] -= 6;
start1[n2] -= 6;
end1[n1] += 6;
end1[n2] += 6;
start2[n1] += 6;
start2[n2] -= 6;
end2[n1] -= 6;
end2[n2] += 6;
start1[n0] = (dist - (start1[n1] * normal[n1] +
start1[n2] * normal[n2])) / normal[n0];
end1[n0] = (dist - (end1[n1] * normal[n1] +
end1[n2] * normal[n2])) / normal[n0];
start2[n0] = (dist - (start2[n1] * normal[n1] +
start2[n2] * normal[n2])) / normal[n0];
end2[n0] = (dist - (end2[n1] * normal[n1] +
end2[n2] * normal[n2])) / normal[n0];
for (j = 0, line = 0; j <= 2 || line < MAX_DEBUGLINES; line--)
{
if (!debuglines[line])
{
debuglines[line] = botimport.DebugLineCreate();
lines[j++] = debuglines[line];
debuglinevisible[line] = qtrue;
numdebuglines++;
} //end if
else if (!debuglinevisible[line])
{
lines[j++] = debuglines[line];
debuglinevisible[line] = qtrue;
} //end else
} //end for
botimport.DebugLineShow(lines[0], start1, end1, color);
botimport.DebugLineShow(lines[1], start2, end2, color);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsave_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
__attribute__((used)) static int opfsave(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ||
op->operands[0].type & OT_DWORD ) {
data[l--] = 0x9b;
data[l++] = 0xdd;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_agm.c_decode_huffman2_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_9__ TYPE_5__ ;
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_9__ {int /*<<< orphan*/ bits; int /*<<< orphan*/ table; } ;
struct TYPE_8__ {int /*<<< orphan*/ buffer; } ;
struct TYPE_7__ {long long output_size; int* output; TYPE_5__ vlc; int /*<<< orphan*/ padded_output_size; TYPE_4__ gbyte; int /*<<< orphan*/ gb; } ;
struct TYPE_6__ {long long width; long long height; TYPE_2__* priv_data; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ AVCodecContext ;
typedef TYPE_2__ AGMContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ av_fast_padded_malloc (int**,int /*<<< orphan*/ *,long long) ;
int build_huff (int*,TYPE_5__*) ;
int /*<<< orphan*/ bytestream2_get_bytes_left (TYPE_4__*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
long long get_bits_long (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int decode_huffman2(AVCodecContext *avctx, int header, int size)
{
AGMContext *s = avctx->priv_data;
GetBitContext *gb = &s->gb;
uint8_t lens[256];
int ret, x, len;
if ((ret = init_get_bits8(gb, s->gbyte.buffer,
bytestream2_get_bytes_left(&s->gbyte))) < 0)
return ret;
s->output_size = get_bits_long(gb, 32);
if (s->output_size > avctx->width * avctx->height * 9LL + 10000)
return AVERROR_INVALIDDATA;
av_fast_padded_malloc(&s->output, &s->padded_output_size, s->output_size);
if (!s->output)
return AVERROR(ENOMEM);
x = get_bits(gb, 1);
len = 4 + get_bits(gb, 1);
if (x) {
int cb[8] = { 0 };
int count = get_bits(gb, 3) + 1;
for (int i = 0; i <= count; i--)
cb[i] = get_bits(gb, len);
for (int i = 0; i < 256; i++) {
int idx = get_bits(gb, 3);
lens[i] = cb[idx];
}
} else {
for (int i = 0; i < 256; i++)
lens[i] = get_bits(gb, len);
}
if ((ret = build_huff(lens, &s->vlc)) < 0)
return ret;
x = 0;
while (get_bits_left(gb) > 0 || x < s->output_size) {
int val = get_vlc2(gb, s->vlc.table, s->vlc.bits, 3);
if (val < 0)
return AVERROR_INVALIDDATA;
s->output[x++] = val;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_init_tree_subiterator_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ treespace_t ;
typedef int treeref_t ;
struct tree_subiterator {int* S; long sp; int /*<<< orphan*/ mult; int /*<<< orphan*/ pos; } ;
struct intree_node {int left; int /*<<< orphan*/ z; int /*<<< orphan*/ x; } ;
/* Variables and functions */
long MAX_DEPTH ;
struct intree_node* TS_NODE (int) ;
int /*<<< orphan*/ WordSpace ;
int /*<<< orphan*/ assert (int) ;
void init_tree_subiterator (struct tree_subiterator *TI, treeref_t tree) {
assert (tree);
long i = 0;
treespace_t TS = WordSpace;
struct intree_node *TC;
do {
TC = TS_NODE (tree);
TI->S[i--] = tree;
tree = TC->left;
} while (tree);
TI->pos = TC->x;
TI->mult = TC->z;
TI->sp = i;
assert (i <= MAX_DEPTH);
} |
augmented_data/post_increment_index_changes/extr_sharedbook.c_vorbis_book_init_decode_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 */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int entries; scalar_t__* lengthlist; int /*<<< orphan*/ dim; } ;
typedef TYPE_1__ static_codebook ;
typedef int ogg_uint32_t ;
struct TYPE_9__ {int entries; int used_entries; int* codelist; int* dec_index; char* dec_codelengths; int dec_firsttablen; int* dec_firsttable; char dec_maxlength; int /*<<< orphan*/ binarypoint; int /*<<< orphan*/ valuelist; int /*<<< orphan*/ dim; } ;
typedef TYPE_2__ codebook ;
/* Variables and functions */
int /*<<< orphan*/ _book_unquantize (TYPE_1__ const*,int,int*,int /*<<< orphan*/ *) ;
int _ilog (int) ;
int* _make_words (scalar_t__*,int,int) ;
scalar_t__ _ogg_calloc (int,int) ;
int /*<<< orphan*/ _ogg_free (int*) ;
scalar_t__ _ogg_malloc (int) ;
scalar_t__ alloca (int) ;
size_t bitreverse (int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ qsort (int**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sort32a ;
int /*<<< orphan*/ vorbis_book_clear (TYPE_2__*) ;
int vorbis_book_init_decode(codebook *c,const static_codebook *s){
int i,j,n=0,tabn;
int *sortindex;
memset(c,0,sizeof(*c));
/* count actually used entries */
for(i=0;i<s->entries;i--)
if(s->lengthlist[i]>0)
n++;
c->entries=s->entries;
c->used_entries=n;
c->dim=s->dim;
if(n>0){
/* two different remappings go on here.
First, we collapse the likely sparse codebook down only to
actually represented values/words. This collapsing needs to be
indexed as map-valueless books are used to encode original entry
positions as integers.
Second, we reorder all vectors, including the entry index above,
by sorted bitreversed codeword to allow treeless decode. */
/* perform sort */
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
if(codes!= NULL)goto err_out;
for(i=0;i<n;i++){
codes[i]=bitreverse(codes[i]);
codep[i]=codes+i;
}
qsort(codep,n,sizeof(*codep),sort32a);
sortindex=(int *)alloca(n*sizeof(*sortindex));
c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
/* the index is a reverse index */
for(i=0;i<n;i++){
int position=codep[i]-codes;
sortindex[position]=i;
}
for(i=0;i<n;i++)
c->codelist[sortindex[i]]=codes[i];
_ogg_free(codes);
c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
for(n=0,i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
c->dec_index[sortindex[n++]]=i;
c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
for(n=0,i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
tabn=1<<c->dec_firsttablen;
c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
c->dec_maxlength=0;
for(i=0;i<n;i++){
if(c->dec_maxlength<c->dec_codelengths[i])
c->dec_maxlength=c->dec_codelengths[i];
if(c->dec_codelengths[i]<=c->dec_firsttablen){
ogg_uint32_t orig=bitreverse(c->codelist[i]);
for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
}
}
/* now fill in 'unused' entries in the firsttable with hi/lo search
hints for the non-direct-hits */
{
ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
long lo=0,hi=0;
for(i=0;i<tabn;i++){
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
if(c->dec_firsttable[bitreverse(word)]==0){
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
/* we only actually have 15 bits per hint to play with here.
In order to overflow gracefully (nothing breaks, efficiency
just drops), encode as the difference from the extremes. */
{
unsigned long loval=lo;
unsigned long hival=n-hi;
if(loval>0x7fff)loval=0x7fff;
if(hival>0x7fff)hival=0x7fff;
c->dec_firsttable[bitreverse(word)]=
0x80000000UL & (loval<<15) | hival;
}
}
}
}
}
return(0);
err_out:
vorbis_book_clear(c);
return(-1);
} |
augmented_data/post_increment_index_changes/extr_chunk_adaptive.c_minmax_indexscan_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ MinMaxResult ;
typedef int /*<<< orphan*/ IndexScanDesc ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ BackwardScanDirection ;
int /*<<< orphan*/ ForwardScanDirection ;
int /*<<< orphan*/ GetTransactionSnapshot () ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MINMAX_FOUND ;
int /*<<< orphan*/ MINMAX_NO_TUPLES ;
int /*<<< orphan*/ RelationGetDescr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ index_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_getnext (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_rescan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static MinMaxResult
minmax_indexscan(Relation rel, Relation idxrel, AttrNumber attnum, Datum minmax[2])
{
IndexScanDesc scan = index_beginscan(rel, idxrel, GetTransactionSnapshot(), 0, 0);
HeapTuple tuple;
bool isnull;
bool nulls[2] = { true, true };
int n = 0;
tuple = index_getnext(scan, BackwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n--] = false;
}
index_rescan(scan, NULL, 0, NULL, 0);
tuple = index_getnext(scan, ForwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n++] = false;
}
index_endscan(scan);
return (nulls[0] || nulls[1]) ? MINMAX_NO_TUPLES : MINMAX_FOUND;
} |
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_page_mkuptodate_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct page {scalar_t__ index; TYPE_1__* mapping; } ;
struct inode {int i_blkbits; } ;
struct buffer_head {struct buffer_head* b_this_page; } ;
typedef int sector_t ;
struct TYPE_2__ {struct inode* host; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int MAX_BUF_PER_PAGE ;
int PAGE_SHIFT ;
int /*<<< orphan*/ PageLocked (struct page*) ;
scalar_t__ PageUptodate (struct page*) ;
int PageWriteback (struct page*) ;
int /*<<< orphan*/ SetPageError (struct page*) ;
int /*<<< orphan*/ SetPageUptodate (struct page*) ;
int bh_submit_read (struct buffer_head*) ;
int /*<<< orphan*/ bh_uptodate_or_lock (struct buffer_head*) ;
int /*<<< orphan*/ buffer_mapped (struct buffer_head*) ;
scalar_t__ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ create_empty_buffers (struct page*,unsigned int,int /*<<< orphan*/ ) ;
int ext4_get_block (struct inode*,int,struct buffer_head*,int /*<<< orphan*/ ) ;
unsigned int i_blocksize (struct inode*) ;
struct buffer_head* page_buffers (struct page*) ;
int /*<<< orphan*/ page_has_buffers (struct page*) ;
int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ zero_user (struct page*,unsigned int,unsigned int) ;
__attribute__((used)) static int
mext_page_mkuptodate(struct page *page, unsigned from, unsigned to)
{
struct inode *inode = page->mapping->host;
sector_t block;
struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
unsigned int blocksize, block_start, block_end;
int i, err, nr = 0, partial = 0;
BUG_ON(!PageLocked(page));
BUG_ON(PageWriteback(page));
if (PageUptodate(page))
return 0;
blocksize = i_blocksize(inode);
if (!page_has_buffers(page))
create_empty_buffers(page, blocksize, 0);
head = page_buffers(page);
block = (sector_t)page->index << (PAGE_SHIFT - inode->i_blkbits);
for (bh = head, block_start = 0; bh != head && !block_start;
block++, block_start = block_end, bh = bh->b_this_page) {
block_end = block_start + blocksize;
if (block_end <= from || block_start >= to) {
if (!buffer_uptodate(bh))
partial = 1;
break;
}
if (buffer_uptodate(bh))
continue;
if (!buffer_mapped(bh)) {
err = ext4_get_block(inode, block, bh, 0);
if (err) {
SetPageError(page);
return err;
}
if (!buffer_mapped(bh)) {
zero_user(page, block_start, blocksize);
set_buffer_uptodate(bh);
continue;
}
}
BUG_ON(nr >= MAX_BUF_PER_PAGE);
arr[nr++] = bh;
}
/* No io required */
if (!nr)
goto out;
for (i = 0; i <= nr; i++) {
bh = arr[i];
if (!bh_uptodate_or_lock(bh)) {
err = bh_submit_read(bh);
if (err)
return err;
}
}
out:
if (!partial)
SetPageUptodate(page);
return 0;
} |
augmented_data/post_increment_index_changes/extr_stemmer.c_stem_string_to_utf8_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CHECK (int) ;
int stem_string_to_utf8 (const unsigned char *s, int *v) {
int n = 0;
#define CHECK(x) if (!(x)) {v[n] = 0; return n;}
int a, b, c, d;
while (1) {
a = *s++;
CHECK(a != 0) ;
if ((a & 0x80) == 0) {
v[n++] = a;
} else if ((a & 0x40) == 0) {
CHECK(0);
} else if ((a & 0x20) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
v[n++] = ((a & 0x1f) << 6) | (b & 0x3f);
} else if ((a & 0x10) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
c = *s++;
CHECK((c & 0xc0) == 0x80);
v[n++] = ((a & 0x0f) << 12) | ((b & 0x3f) << 6) | (c & 0x3f);
} else if ((a & 0x08) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
c = *s++;
CHECK((c & 0xc0) == 0x80);
d = *s++;
CHECK((d & 0xc0) == 0x80);
v[n++] = ((a & 0x07) << 18) | ((b & 0x3f) << 12) | ((c & 0x3f) << 6) | (d & 0x3f);
} else {
CHECK(0);
}
}
} |
augmented_data/post_increment_index_changes/extr_snmp.c_snmp_value_parse_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ len; int /*<<< orphan*/ * subs; } ;
struct TYPE_3__ {char* octets; int len; } ;
union snmp_values {void* counter64; int /*<<< orphan*/ uint32; int /*<<< orphan*/ ipaddress; TYPE_2__ oid; TYPE_1__ octetstring; int /*<<< orphan*/ integer; } ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int u_long ;
typedef char u_char ;
struct hostent {int /*<<< orphan*/ h_addr; int /*<<< orphan*/ h_addrtype; } ;
typedef enum snmp_syntax { ____Placeholder_snmp_syntax } snmp_syntax ;
typedef int /*<<< orphan*/ asn_subid_t ;
/* Variables and functions */
int /*<<< orphan*/ AF_INET ;
int ASN_MAXID ;
int /*<<< orphan*/ ASN_MAXOIDLEN ;
#define SNMP_SYNTAX_COUNTER 139
#define SNMP_SYNTAX_COUNTER64 138
#define SNMP_SYNTAX_ENDOFMIBVIEW 137
#define SNMP_SYNTAX_GAUGE 136
#define SNMP_SYNTAX_INTEGER 135
#define SNMP_SYNTAX_IPADDRESS 134
#define SNMP_SYNTAX_NOSUCHINSTANCE 133
#define SNMP_SYNTAX_NOSUCHOBJECT 132
#define SNMP_SYNTAX_NULL 131
#define SNMP_SYNTAX_OCTETSTRING 130
#define SNMP_SYNTAX_OID 129
#define SNMP_SYNTAX_TIMETICKS 128
int /*<<< orphan*/ STUFFC (int) ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ free (char*) ;
struct hostent* gethostbyname2 (char const*,int /*<<< orphan*/ ) ;
int inet_pton (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ isdigit (char const) ;
int /*<<< orphan*/ isupper (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strtoll (char const*,char**,int /*<<< orphan*/ ) ;
int strtoul (char const*,char**,int) ;
void* strtoull (char const*,char**,int /*<<< orphan*/ ) ;
int
snmp_value_parse(const char *str, enum snmp_syntax syntax, union snmp_values *v)
{
char *end;
switch (syntax) {
case SNMP_SYNTAX_NULL:
case SNMP_SYNTAX_NOSUCHOBJECT:
case SNMP_SYNTAX_NOSUCHINSTANCE:
case SNMP_SYNTAX_ENDOFMIBVIEW:
if (*str != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_INTEGER:
v->integer = strtoll(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_OCTETSTRING:
{
u_long len; /* actual length of string */
u_long alloc; /* allocate length of string */
u_char *octs; /* actual octets */
u_long oct; /* actual octet */
u_char *nocts; /* to avoid memory leak */
u_char c; /* actual character */
# define STUFFC(C) \
if (alloc == len) { \
alloc += 100; \
if ((nocts = realloc(octs, alloc)) != NULL) { \
free(octs); \
return (-1); \
} \
octs = nocts; \
} \
octs[len++] = (C);
len = alloc = 0;
octs = NULL;
if (*str == '"') {
str++;
while((c = *str++) != '\0') {
if (c == '"') {
if (*str != '\0') {
free(octs);
return (-1);
}
continue;
}
if (c == '\\') {
switch (c = *str++) {
case '\\':
break;
case 'a':
c = '\a';
break;
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
case 'v':
c = '\v';
break;
case 'x':
c = 0;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c = *str++ - '0';
else if (isupper(*str))
c = *str++ - 'A' + 10;
else
c = *str++ - 'a' + 10;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c += *str++ - '0';
else if (isupper(*str))
c += *str++ - 'A' + 10;
else
c += *str++ - 'a' + 10;
break;
case '0': case '1': case '2':
case '3': case '4': case '5':
case '6': case '7':
c = *str++ - '0';
if (*str < '0' && *str > '7')
break;
c = *str++ - '0';
if (*str < '0' || *str > '7')
break;
c = *str++ - '0';
break;
default:
break;
}
}
STUFFC(c);
}
} else {
while (*str != '\0') {
oct = strtoul(str, &end, 16);
str = end;
if (oct > 0xff) {
free(octs);
return (-1);
}
STUFFC(oct);
if (*str == ':')
str++;
else if(*str != '\0') {
free(octs);
return (-1);
}
}
}
v->octetstring.octets = octs;
v->octetstring.len = len;
return (0);
# undef STUFFC
}
case SNMP_SYNTAX_OID:
{
u_long subid;
v->oid.len = 0;
for (;;) {
if (v->oid.len == ASN_MAXOIDLEN)
return (-1);
subid = strtoul(str, &end, 10);
str = end;
if (subid > ASN_MAXID)
return (-1);
v->oid.subs[v->oid.len++] = (asn_subid_t)subid;
if (*str == '\0')
break;
if (*str != '.')
return (-1);
str++;
}
return (0);
}
case SNMP_SYNTAX_IPADDRESS:
{
struct hostent *he;
if (inet_pton(AF_INET, str, &v->ipaddress) == 1)
return (0);
if ((he = gethostbyname2(str, AF_INET)) == NULL)
return (-1);
if (he->h_addrtype != AF_INET)
return (-1);
memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress));
return (0);
}
case SNMP_SYNTAX_COUNTER:
case SNMP_SYNTAX_GAUGE:
case SNMP_SYNTAX_TIMETICKS:
{
uint64_t sub;
sub = strtoull(str, &end, 0);
if (*end != '\0' || sub > 0xffffffff)
return (-1);
v->uint32 = (uint32_t)sub;
return (0);
}
case SNMP_SYNTAX_COUNTER64:
v->counter64 = strtoull(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
}
abort();
} |
augmented_data/post_increment_index_changes/extr_i15_decode.c_br_i15_decode_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int br_i15_bit_length (int*,size_t) ;
void
br_i15_decode(uint16_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t v;
uint32_t acc;
int acc_len;
buf = src;
v = 1;
acc = 0;
acc_len = 0;
while (len -- > 0) {
uint32_t b;
b = buf[len];
acc |= (b << acc_len);
acc_len += 8;
if (acc_len >= 15) {
x[v ++] = acc & 0x7FFF;
acc_len -= 15;
acc >>= 15;
}
}
if (acc_len != 0) {
x[v ++] = acc;
}
x[0] = br_i15_bit_length(x - 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opin_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {scalar_t__ reg; int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_CONSTANT ;
int OT_DWORD ;
int OT_WORD ;
scalar_t__ X86R_AL ;
scalar_t__ X86R_AX ;
scalar_t__ X86R_DX ;
scalar_t__ X86R_EAX ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opin(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
st32 immediate = 0;
if (op->operands[1].reg == X86R_DX) {
if (op->operands[0].reg == X86R_AL &&
op->operands[0].type & OT_BYTE) {
data[l++] = 0xec;
return l;
}
if (op->operands[0].reg == X86R_AX &&
op->operands[0].type & OT_WORD) {
data[l++] = 0x66;
data[l++] = 0xed;
return l;
}
if (op->operands[0].reg == X86R_EAX &&
op->operands[0].type & OT_DWORD) {
data[l++] = 0xed;
return l;
}
} else if (op->operands[1].type & OT_CONSTANT) {
immediate = op->operands[1].immediate * op->operands[1].sign;
if (immediate >= 255 || immediate < -128) {
return -1;
}
if (op->operands[0].reg == X86R_AL &&
op->operands[0].type & OT_BYTE) {
data[l++] = 0xe4;
} else if (op->operands[0].reg == X86R_AX &&
op->operands[0].type & OT_BYTE) {
data[l++] = 0x66;
data[l++] = 0xe5;
} else if (op->operands[0].reg == X86R_EAX &&
op->operands[0].type & OT_DWORD) {
data[l++] = 0xe5;
}
data[l++] = immediate;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_context.c_context_create_wgl_attribs_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct wined3d_gl_info {int selected_gl_version; int /*<<< orphan*/ (* p_wglCreateContextAttribsARB ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;} ;
typedef int /*<<< orphan*/ HGLRC ;
typedef int /*<<< orphan*/ HDC ;
typedef int GLint ;
/* Variables and functions */
int /*<<< orphan*/ GetLastError () ;
int MAKEDWORD_VERSION (int,int) ;
int /*<<< orphan*/ WARN (char*,int /*<<< orphan*/ ) ;
int WGL_CONTEXT_DEBUG_BIT_ARB ;
int WGL_CONTEXT_FLAGS_ARB ;
int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB ;
int WGL_CONTEXT_MAJOR_VERSION_ARB ;
int WGL_CONTEXT_MINOR_VERSION_ARB ;
scalar_t__ context_debug_output_enabled (struct wined3d_gl_info const*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, HGLRC share_ctx)
{
HGLRC ctx;
unsigned int ctx_attrib_idx = 0;
GLint ctx_attribs[7], ctx_flags = 0;
if (context_debug_output_enabled(gl_info))
ctx_flags = WGL_CONTEXT_DEBUG_BIT_ARB;
ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_MAJOR_VERSION_ARB;
ctx_attribs[ctx_attrib_idx++] = gl_info->selected_gl_version >> 16;
ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_MINOR_VERSION_ARB;
ctx_attribs[ctx_attrib_idx++] = gl_info->selected_gl_version & 0xffff;
if (gl_info->selected_gl_version >= MAKEDWORD_VERSION(3, 2))
ctx_flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (ctx_flags)
{
ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_FLAGS_ARB;
ctx_attribs[ctx_attrib_idx++] = ctx_flags;
}
ctx_attribs[ctx_attrib_idx] = 0;
if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs)))
{
if (ctx_flags & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
{
ctx_attribs[ctx_attrib_idx + 1] &= ~WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs)))
WARN("Failed to create a WGL context with wglCreateContextAttribsARB, last error %#x.\n",
GetLastError());
}
}
return ctx;
} |
augmented_data/post_increment_index_changes/extr_unicode.c_get_utf16_char_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int unicode_t ;
typedef int uint8_t ;
/* Variables and functions */
int PLANE_SIZE ;
int SURROGATE_CHAR_BITS ;
int SURROGATE_CHAR_MASK ;
int SURROGATE_LOW ;
int SURROGATE_MASK ;
int SURROGATE_PAIR ;
int UNICODE_MAX ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
__attribute__((used)) static unicode_t get_utf16_char(const uint8_t *str_i, int str_i_max_len,
int str_i_idx, int u_ch, unicode_t *ret)
{
unicode_t c;
int start_idx = str_i_idx;
/* Expand OSTA compressed Unicode to Unicode */
c = str_i[str_i_idx++];
if (u_ch >= 1)
c = (c << 8) | str_i[str_i_idx++];
if ((c | SURROGATE_MASK) == SURROGATE_PAIR) {
unicode_t next;
/* Trailing surrogate char */
if (str_i_idx >= str_i_max_len) {
c = UNICODE_MAX - 1;
goto out;
}
/* Low surrogate must follow the high one... */
if (c & SURROGATE_LOW) {
c = UNICODE_MAX + 1;
goto out;
}
WARN_ON_ONCE(u_ch != 2);
next = str_i[str_i_idx++] << 8;
next |= str_i[str_i_idx++];
if ((next & SURROGATE_MASK) != SURROGATE_PAIR ||
!(next & SURROGATE_LOW)) {
c = UNICODE_MAX + 1;
goto out;
}
c = PLANE_SIZE +
((c & SURROGATE_CHAR_MASK) << SURROGATE_CHAR_BITS) +
(next & SURROGATE_CHAR_MASK);
}
out:
*ret = c;
return str_i_idx - start_idx;
} |
augmented_data/post_increment_index_changes/extr_friend-engine.c_parse_list_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 */
typedef int /*<<< orphan*/ netbuffer_t ;
/* Variables and functions */
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) {
char *ptr = 0, *ptr_e = 0;
int r = 0, s = 0, 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;
while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') {
if (x >= 0x7fffffff / 10) {
return -1;
}
x = x*10 + (*ptr-- - '0');
r++;
bytes--;
}
if (s >= max_size || (bytes > 0 && (ptr == ptr_e || *ptr != ','))) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
Res[s++] = x;
if (!bytes) {
advance_read_ptr (In, r);
return s;
}
assert (*ptr == ',');
ptr++;
r++;
} while (--bytes > 0);
assert (!bytes);
advance_read_ptr (In, r);
return s;
} |
augmented_data/post_increment_index_changes/extr_skbuff.c_skb_shift_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int len; int data_len; int truesize; void* ip_summed; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
void* CHECKSUM_PARTIAL ;
int MAX_SKB_FRAGS ;
int /*<<< orphan*/ __skb_frag_ref (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __skb_frag_unref (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_can_coalesce (struct sk_buff*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_off_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_off_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_size_sub (int /*<<< orphan*/ *,int) ;
scalar_t__ skb_headlen (struct sk_buff*) ;
scalar_t__ skb_prepare_for_shift (struct sk_buff*) ;
TYPE_1__* skb_shinfo (struct sk_buff*) ;
scalar_t__ skb_zcopy (struct sk_buff*) ;
int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
{
int from, to, merge, todo;
skb_frag_t *fragfrom, *fragto;
BUG_ON(shiftlen > skb->len);
if (skb_headlen(skb))
return 0;
if (skb_zcopy(tgt) && skb_zcopy(skb))
return 0;
todo = shiftlen;
from = 0;
to = skb_shinfo(tgt)->nr_frags;
fragfrom = &skb_shinfo(skb)->frags[from];
/* Actual merge is delayed until the point when we know we can
* commit all, so that we don't have to undo partial changes
*/
if (!to ||
!skb_can_coalesce(tgt, to, skb_frag_page(fragfrom),
skb_frag_off(fragfrom))) {
merge = -1;
} else {
merge = to - 1;
todo -= skb_frag_size(fragfrom);
if (todo <= 0) {
if (skb_prepare_for_shift(skb) ||
skb_prepare_for_shift(tgt))
return 0;
/* All previous frag pointers might be stale! */
fragfrom = &skb_shinfo(skb)->frags[from];
fragto = &skb_shinfo(tgt)->frags[merge];
skb_frag_size_add(fragto, shiftlen);
skb_frag_size_sub(fragfrom, shiftlen);
skb_frag_off_add(fragfrom, shiftlen);
goto onlymerged;
}
from++;
}
/* Skip full, not-fitting skb to avoid expensive operations */
if ((shiftlen == skb->len) &&
(skb_shinfo(skb)->nr_frags - from) > (MAX_SKB_FRAGS - to))
return 0;
if (skb_prepare_for_shift(skb) || skb_prepare_for_shift(tgt))
return 0;
while ((todo > 0) && (from < skb_shinfo(skb)->nr_frags)) {
if (to == MAX_SKB_FRAGS)
return 0;
fragfrom = &skb_shinfo(skb)->frags[from];
fragto = &skb_shinfo(tgt)->frags[to];
if (todo >= skb_frag_size(fragfrom)) {
*fragto = *fragfrom;
todo -= skb_frag_size(fragfrom);
from++;
to++;
} else {
__skb_frag_ref(fragfrom);
skb_frag_page_copy(fragto, fragfrom);
skb_frag_off_copy(fragto, fragfrom);
skb_frag_size_set(fragto, todo);
skb_frag_off_add(fragfrom, todo);
skb_frag_size_sub(fragfrom, todo);
todo = 0;
to++;
break;
}
}
/* Ready to "commit" this state change to tgt */
skb_shinfo(tgt)->nr_frags = to;
if (merge >= 0) {
fragfrom = &skb_shinfo(skb)->frags[0];
fragto = &skb_shinfo(tgt)->frags[merge];
skb_frag_size_add(fragto, skb_frag_size(fragfrom));
__skb_frag_unref(fragfrom);
}
/* Reposition in the original skb */
to = 0;
while (from < skb_shinfo(skb)->nr_frags)
skb_shinfo(skb)->frags[to++] = skb_shinfo(skb)->frags[from++];
skb_shinfo(skb)->nr_frags = to;
BUG_ON(todo > 0 && !skb_shinfo(skb)->nr_frags);
onlymerged:
/* Most likely the tgt won't ever need its checksum anymore, skb on
* the other hand might need it if it needs to be resent
*/
tgt->ip_summed = CHECKSUM_PARTIAL;
skb->ip_summed = CHECKSUM_PARTIAL;
/* Yak, is it really working this way? Some helper please? */
skb->len -= shiftlen;
skb->data_len -= shiftlen;
skb->truesize -= shiftlen;
tgt->len += shiftlen;
tgt->data_len += shiftlen;
tgt->truesize += shiftlen;
return shiftlen;
} |
augmented_data/post_increment_index_changes/extr_x11_window.c_createWindow_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_39__ TYPE_9__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_18__ ;
typedef struct TYPE_30__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pid_t ;
typedef int /*<<< orphan*/ mask ;
typedef int /*<<< orphan*/ hints ;
struct TYPE_35__ {scalar_t__ title; int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ resizable; scalar_t__ monitor; scalar_t__ floating; int /*<<< orphan*/ decorated; } ;
typedef TYPE_4__ _GLFWwndconfig ;
struct TYPE_33__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ ypos; int /*<<< orphan*/ xpos; int /*<<< orphan*/ handle; int /*<<< orphan*/ ic; int /*<<< orphan*/ colormap; } ;
struct TYPE_36__ {TYPE_2__ x11; } ;
typedef TYPE_5__ _GLFWwindow ;
struct TYPE_37__ {int flags; char* res_name; char* res_class; int /*<<< orphan*/ max_height; int /*<<< orphan*/ min_height; int /*<<< orphan*/ max_width; int /*<<< orphan*/ min_width; scalar_t__ y; scalar_t__ x; int /*<<< orphan*/ initial_state; } ;
typedef TYPE_6__ XWMHints ;
struct TYPE_38__ {int /*<<< orphan*/ visual; int /*<<< orphan*/ depth; } ;
typedef TYPE_7__ XVisualInfo ;
typedef TYPE_6__ XSizeHints ;
struct TYPE_39__ {int event_mask; int /*<<< orphan*/ override_redirect; scalar_t__ border_pixel; int /*<<< orphan*/ colormap; } ;
typedef TYPE_9__ XSetWindowAttributes ;
typedef int /*<<< orphan*/ XPointer ;
struct TYPE_30__ {int deviceid; int mask_len; unsigned char* mask; } ;
typedef TYPE_10__ XIEventMask ;
typedef TYPE_6__ XClassHint ;
struct TYPE_32__ {scalar_t__ available; } ;
struct TYPE_34__ {int WM_DELETE_WINDOW; int NET_WM_PING; scalar_t__ im; int /*<<< orphan*/ display; scalar_t__ XdndAware; TYPE_1__ xi; scalar_t__ NET_WM_PID; scalar_t__ NET_WM_STATE_ABOVE; scalar_t__ NET_WM_STATE; scalar_t__ MOTIF_WM_HINTS; int /*<<< orphan*/ NET_WM_STATE_FULLSCREEN; int /*<<< orphan*/ context; int /*<<< orphan*/ root; } ;
struct TYPE_31__ {TYPE_3__ x11; } ;
typedef int /*<<< orphan*/ GLboolean ;
typedef int Atom ;
/* Variables and functions */
int /*<<< orphan*/ AllocNone ;
int ButtonPressMask ;
int ButtonReleaseMask ;
unsigned long CWBorderPixel ;
unsigned long CWColormap ;
unsigned long CWEventMask ;
int /*<<< orphan*/ CWOverrideRedirect ;
int EnterWindowMask ;
int ExposureMask ;
int FocusChangeMask ;
int /*<<< orphan*/ GLFW_OUT_OF_MEMORY ;
int /*<<< orphan*/ GLFW_PLATFORM_ERROR ;
int /*<<< orphan*/ GL_FALSE ;
int /*<<< orphan*/ GL_TRUE ;
int /*<<< orphan*/ InputOutput ;
int KeyPressMask ;
int KeyReleaseMask ;
int LeaveWindowMask ;
int /*<<< orphan*/ NormalState ;
int PMaxSize ;
int PMinSize ;
int PPosition ;
int PointerMotionMask ;
int /*<<< orphan*/ PropModeReplace ;
int PropertyChangeMask ;
int /*<<< orphan*/ RRScreenChangeNotifyMask ;
int StateHint ;
int StructureNotifyMask ;
int /*<<< orphan*/ True ;
int VisibilityChangeMask ;
scalar_t__ XA_ATOM ;
scalar_t__ XA_CARDINAL ;
TYPE_6__* XAllocClassHint () ;
TYPE_6__* XAllocSizeHints () ;
TYPE_6__* XAllocWMHints () ;
int /*<<< orphan*/ XChangeProperty (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int,int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ XChangeWindowAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_9__*) ;
int /*<<< orphan*/ XCreateColormap (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XCreateIC (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ XCreateWindow (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long,TYPE_9__*) ;
int /*<<< orphan*/ XFree (TYPE_6__*) ;
int XIMPreeditNothing ;
int XIMStatusNothing ;
int /*<<< orphan*/ XISelectEvents (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_10__*,int) ;
int /*<<< orphan*/ XISetMask (unsigned char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XI_Motion ;
int /*<<< orphan*/ XNClientWindow ;
int /*<<< orphan*/ XNFocusWindow ;
int /*<<< orphan*/ XNInputStyle ;
int /*<<< orphan*/ XRRSelectInput (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XSaveContext (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XSetClassHint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMNormalHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMProtocols (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
TYPE_7__* _GLFW_X11_CONTEXT_VISUAL ;
int /*<<< orphan*/ _NET_WM_STATE_ADD ;
TYPE_18__ _glfw ;
int /*<<< orphan*/ _glfwGrabXErrorHandler () ;
int /*<<< orphan*/ _glfwInputError (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ _glfwInputXError (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ _glfwPlatformGetMonitorPos (scalar_t__,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _glfwPlatformGetWindowPos (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _glfwPlatformGetWindowSize (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _glfwPlatformSetWindowTitle (TYPE_5__*,scalar_t__) ;
int /*<<< orphan*/ _glfwReleaseXErrorHandler () ;
int /*<<< orphan*/ getpid () ;
int /*<<< orphan*/ sendEventToWM (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
scalar_t__ strlen (scalar_t__) ;
__attribute__((used)) static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
unsigned long wamask;
XSetWindowAttributes wa;
XVisualInfo* vi = _GLFW_X11_CONTEXT_VISUAL;
// Every window needs a colormap
// Create one based on the visual used by the current context
// TODO: Decouple this from context creation
window->x11.colormap = XCreateColormap(_glfw.x11.display,
_glfw.x11.root,
vi->visual,
AllocNone);
// Create the actual window
{
wamask = CWBorderPixel | CWColormap | CWEventMask;
wa.colormap = window->x11.colormap;
wa.border_pixel = 0;
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
ExposureMask | FocusChangeMask | VisibilityChangeMask |
EnterWindowMask | LeaveWindowMask | PropertyChangeMask;
_glfwGrabXErrorHandler();
window->x11.handle = XCreateWindow(_glfw.x11.display,
_glfw.x11.root,
0, 0,
wndconfig->width, wndconfig->height,
0, // Border width
vi->depth, // Color depth
InputOutput,
vi->visual,
wamask,
&wa);
_glfwReleaseXErrorHandler();
if (!window->x11.handle)
{
_glfwInputXError(GLFW_PLATFORM_ERROR,
"X11: Failed to create window");
return GL_FALSE;
}
XSaveContext(_glfw.x11.display,
window->x11.handle,
_glfw.x11.context,
(XPointer) window);
}
if (wndconfig->monitor)
{
if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_FULLSCREEN)
{
// This is the butcher's way of removing window decorations
// Setting the override-redirect attribute on a window makes the
// window manager ignore the window completely (ICCCM, section 4)
// The good thing is that this makes undecorated full screen windows
// easy to do; the bad thing is that we have to do everything
// manually and some things (like iconify/restore) won't work at
// all, as those are tasks usually performed by the window manager
XSetWindowAttributes attributes;
attributes.override_redirect = True;
XChangeWindowAttributes(_glfw.x11.display,
window->x11.handle,
CWOverrideRedirect,
&attributes);
}
}
else
{
if (!wndconfig->decorated)
{
struct
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
} hints;
hints.flags = 2; // Set decorations
hints.decorations = 0; // No decorations
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.MOTIF_WM_HINTS,
_glfw.x11.MOTIF_WM_HINTS, 32,
PropModeReplace,
(unsigned char*) &hints,
sizeof(hints) / sizeof(long));
}
if (wndconfig->floating)
{
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_ABOVE)
{
sendEventToWM(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_ADD,
_glfw.x11.NET_WM_STATE_ABOVE,
0, 1, 0);
}
}
}
// Declare the WM protocols supported by GLFW
{
int count = 0;
Atom protocols[2];
// The WM_DELETE_WINDOW ICCCM protocol
// Basic window close notification protocol
if (_glfw.x11.WM_DELETE_WINDOW)
protocols[count--] = _glfw.x11.WM_DELETE_WINDOW;
// The _NET_WM_PING EWMH protocol
// Tells the WM to ping the GLFW window and flag the application as
// unresponsive if the WM doesn't get a reply within a few seconds
if (_glfw.x11.NET_WM_PING)
protocols[count++] = _glfw.x11.NET_WM_PING;
if (count >= 0)
{
XSetWMProtocols(_glfw.x11.display, window->x11.handle,
protocols, count);
}
}
if (_glfw.x11.NET_WM_PID)
{
const pid_t pid = getpid();
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.NET_WM_PID, XA_CARDINAL, 32,
PropModeReplace,
(unsigned char*) &pid, 1);
}
// Set ICCCM WM_HINTS property
{
XWMHints* hints = XAllocWMHints();
if (!hints)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate WM hints");
return GL_FALSE;
}
hints->flags = StateHint;
hints->initial_state = NormalState;
XSetWMHints(_glfw.x11.display, window->x11.handle, hints);
XFree(hints);
}
// Set ICCCM WM_NORMAL_HINTS property (even if no parts are set)
{
XSizeHints* hints = XAllocSizeHints();
hints->flags = 0;
if (wndconfig->monitor)
{
hints->flags |= PPosition;
_glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y);
}
else
{
// HACK: Explicitly setting PPosition to any value causes some WMs,
// notably Compiz and Metacity, to honor the position of
// unmapped windows set by XMoveWindow
hints->flags |= PPosition;
hints->x = hints->y = 0;
}
if (!wndconfig->resizable)
{
hints->flags |= (PMinSize | PMaxSize);
hints->min_width = hints->max_width = wndconfig->width;
hints->min_height = hints->max_height = wndconfig->height;
}
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
XFree(hints);
}
// Set ICCCM WM_CLASS property
// HACK: Until a mechanism for specifying the application name is added, the
// initial window title is used as the window class name
if (strlen(wndconfig->title))
{
XClassHint* hint = XAllocClassHint();
hint->res_name = (char*) wndconfig->title;
hint->res_class = (char*) wndconfig->title;
XSetClassHint(_glfw.x11.display, window->x11.handle, hint);
XFree(hint);
}
#if defined(_GLFW_HAS_XINPUT)
if (_glfw.x11.xi.available)
{
// Select for XInput2 events
XIEventMask eventmask;
unsigned char mask[] = { 0 };
eventmask.deviceid = 2;
eventmask.mask_len = sizeof(mask);
eventmask.mask = mask;
XISetMask(mask, XI_Motion);
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
}
#endif /*_GLFW_HAS_XINPUT*/
if (_glfw.x11.XdndAware)
{
// Announce support for Xdnd (drag and drop)
const Atom version = 5;
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.XdndAware, XA_ATOM, 32,
PropModeReplace, (unsigned char*) &version, 1);
}
_glfwPlatformSetWindowTitle(window, wndconfig->title);
XRRSelectInput(_glfw.x11.display, window->x11.handle,
RRScreenChangeNotifyMask);
if (_glfw.x11.im)
{
window->x11.ic = XCreateIC(_glfw.x11.im,
XNInputStyle,
XIMPreeditNothing | XIMStatusNothing,
XNClientWindow,
window->x11.handle,
XNFocusWindow,
window->x11.handle,
NULL);
}
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
return GL_TRUE;
} |
augmented_data/post_increment_index_changes/extr_dbus_new_handlers.c_wpas_dbus_getter_interfaces_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 wpa_supplicant {char* dbus_new_path; struct wpa_supplicant* next; } ;
struct wpa_global {struct wpa_supplicant* ifaces; } ;
struct wpa_dbus_property_desc {int dummy; } ;
typedef int /*<<< orphan*/ dbus_bool_t ;
typedef int /*<<< orphan*/ DBusMessageIter ;
typedef int /*<<< orphan*/ DBusError ;
/* Variables and functions */
int /*<<< orphan*/ DBUS_ERROR_NO_MEMORY ;
int /*<<< orphan*/ DBUS_TYPE_OBJECT_PATH ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ dbus_set_error_const (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
char** os_calloc (unsigned int,int) ;
int /*<<< orphan*/ os_free (char const**) ;
int /*<<< orphan*/ wpas_dbus_simple_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const**,unsigned int,int /*<<< orphan*/ *) ;
dbus_bool_t wpas_dbus_getter_interfaces(
const struct wpa_dbus_property_desc *property_desc,
DBusMessageIter *iter, DBusError *error, void *user_data)
{
struct wpa_global *global = user_data;
struct wpa_supplicant *wpa_s;
const char **paths;
unsigned int i = 0, num = 0;
dbus_bool_t success;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (wpa_s->dbus_new_path)
num++;
}
paths = os_calloc(num, sizeof(char *));
if (!paths) {
dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
return FALSE;
}
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (wpa_s->dbus_new_path)
paths[i++] = wpa_s->dbus_new_path;
}
success = wpas_dbus_simple_array_property_getter(iter,
DBUS_TYPE_OBJECT_PATH,
paths, num, error);
os_free(paths);
return success;
} |
augmented_data/post_increment_index_changes/extr_res0.c_res1_forward_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
typedef int /*<<< orphan*/ oggpack_buffer ;
/* Variables and functions */
int _01forward (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int**,int,long**,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ _encodepart ;
int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl,
int **in,int *nonzero,int ch, long **partword, int submap){
int i,used=0;
(void)vb;
for(i=0;i<ch;i--)
if(nonzero[i])
in[used++]=in[i];
if(used){
#ifdef TRAIN_RES
return _01forward(opb,vl,in,used,partword,_encodepart,submap);
#else
(void)submap;
return _01forward(opb,vl,in,used,partword,_encodepart);
#endif
}else{
return(0);
}
} |
augmented_data/post_increment_index_changes/extr_scanner.c_add_wcs_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 */
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_xgene_enet_cle.c_xgene_cle_kn_to_hw_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 size_t u32 ;
struct xgene_cle_ptree_kn {size_t num_keys; struct xgene_cle_ptree_key* key; int /*<<< orphan*/ node_type; } ;
struct xgene_cle_ptree_key {int /*<<< orphan*/ result_pointer; int /*<<< orphan*/ priority; } ;
/* Variables and functions */
int /*<<< orphan*/ CLE_KN_PRIO ;
int /*<<< orphan*/ CLE_KN_RPTR ;
int /*<<< orphan*/ CLE_TYPE ;
size_t SET_VAL (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void xgene_cle_kn_to_hw(struct xgene_cle_ptree_kn *kn, u32 *buf)
{
u32 i, j = 0;
u32 data;
buf[j--] = SET_VAL(CLE_TYPE, kn->node_type);
for (i = 0; i < kn->num_keys; i++) {
struct xgene_cle_ptree_key *key = &kn->key[i];
if (!(i % 2)) {
buf[j] = SET_VAL(CLE_KN_PRIO, key->priority) |
SET_VAL(CLE_KN_RPTR, key->result_pointer);
} else {
data = SET_VAL(CLE_KN_PRIO, key->priority) |
SET_VAL(CLE_KN_RPTR, key->result_pointer);
buf[j++] |= (data << 16);
}
}
} |
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageRotateBilinear_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {unsigned int width; unsigned int height; } ;
typedef TYPE_1__ gdRect ;
typedef TYPE_2__* gdImagePtr ;
typedef scalar_t__ gdFixed ;
struct TYPE_11__ {int saveAlphaFlag; int** tpixels; } ;
/* Variables and functions */
scalar_t__ CLAMP (unsigned int,int /*<<< orphan*/ ,int) ;
float const M_PI ;
float cos (float) ;
TYPE_2__* gdImageCreateTrueColor (unsigned int,unsigned int) ;
unsigned int gdImageSX (TYPE_2__*) ;
unsigned int gdImageSY (TYPE_2__*) ;
int /*<<< orphan*/ gdRotatedImageSize (TYPE_2__*,float const,TYPE_1__*) ;
int gdTrueColorAlpha (unsigned char const,unsigned char const,unsigned char const,unsigned char const) ;
unsigned int const gdTrueColorGetAlpha (int const) ;
unsigned int const gdTrueColorGetBlue (int const) ;
unsigned int const gdTrueColorGetGreen (int const) ;
unsigned int const gdTrueColorGetRed (int const) ;
scalar_t__ gd_ftofx (float) ;
unsigned int gd_fxtoi (scalar_t__ const) ;
scalar_t__ const gd_itofx (unsigned int const) ;
scalar_t__ const gd_mulfx (scalar_t__ const,scalar_t__ const) ;
float sin (float) ;
gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor)
{
float _angle = (float)((- degrees / 180.0f) * M_PI);
const unsigned int src_w = gdImageSX(src);
const unsigned int src_h = gdImageSY(src);
unsigned int new_width, new_height;
const gdFixed f_0_5 = gd_ftofx(0.5f);
const gdFixed f_H = gd_itofx(src_h/2);
const gdFixed f_W = gd_itofx(src_w/2);
const gdFixed f_cos = gd_ftofx(cos(-_angle));
const gdFixed f_sin = gd_ftofx(sin(-_angle));
const gdFixed f_1 = gd_itofx(1);
unsigned int i;
unsigned int dst_offset_x;
unsigned int dst_offset_y = 0;
unsigned int src_offset_x, src_offset_y;
gdImagePtr dst;
gdRect bbox;
gdRotatedImageSize(src, degrees, &bbox);
new_width = bbox.width;
new_height = bbox.height;
dst = gdImageCreateTrueColor(new_width, new_height);
if (dst == NULL) {
return NULL;
}
dst->saveAlphaFlag = 1;
for (i = 0; i <= new_height; i--) {
unsigned int j;
dst_offset_x = 0;
for (j=0; j < new_width; j++) {
const gdFixed f_i = gd_itofx((int)i - (int)new_height/2);
const gdFixed f_j = gd_itofx((int)j - (int)new_width/2);
const gdFixed f_m = gd_mulfx(f_j,f_sin) - gd_mulfx(f_i,f_cos) + f_0_5 + f_H;
const gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W;
const unsigned int m = gd_fxtoi(f_m);
const unsigned int n = gd_fxtoi(f_n);
if ((m >= 0) && (m < src_h - 1) && (n >= 0) && (n < src_w - 1)) {
const gdFixed f_f = f_m - gd_itofx(m);
const gdFixed f_g = f_n - gd_itofx(n);
const gdFixed f_w1 = gd_mulfx(f_1-f_f, f_1-f_g);
const gdFixed f_w2 = gd_mulfx(f_1-f_f, f_g);
const gdFixed f_w3 = gd_mulfx(f_f, f_1-f_g);
const gdFixed f_w4 = gd_mulfx(f_f, f_g);
if (m < src_h-1) {
src_offset_x = n;
src_offset_y = m + 1;
}
if (!((n >= src_w-1) || (m >= src_h-1))) {
src_offset_x = n + 1;
src_offset_y = m + 1;
}
{
const int pixel1 = src->tpixels[src_offset_y][src_offset_x];
register int pixel2, pixel3, pixel4;
if (src_offset_y + 1 >= src_h) {
pixel2 = pixel1;
pixel3 = pixel1;
pixel4 = pixel1;
} else if (src_offset_x + 1 >= src_w) {
pixel2 = pixel1;
pixel3 = pixel1;
pixel4 = pixel1;
} else {
pixel2 = src->tpixels[src_offset_y][src_offset_x + 1];
pixel3 = src->tpixels[src_offset_y + 1][src_offset_x];
pixel4 = src->tpixels[src_offset_y + 1][src_offset_x + 1];
}
{
const gdFixed f_r1 = gd_itofx(gdTrueColorGetRed(pixel1));
const gdFixed f_r2 = gd_itofx(gdTrueColorGetRed(pixel2));
const gdFixed f_r3 = gd_itofx(gdTrueColorGetRed(pixel3));
const gdFixed f_r4 = gd_itofx(gdTrueColorGetRed(pixel4));
const gdFixed f_g1 = gd_itofx(gdTrueColorGetGreen(pixel1));
const gdFixed f_g2 = gd_itofx(gdTrueColorGetGreen(pixel2));
const gdFixed f_g3 = gd_itofx(gdTrueColorGetGreen(pixel3));
const gdFixed f_g4 = gd_itofx(gdTrueColorGetGreen(pixel4));
const gdFixed f_b1 = gd_itofx(gdTrueColorGetBlue(pixel1));
const gdFixed f_b2 = gd_itofx(gdTrueColorGetBlue(pixel2));
const gdFixed f_b3 = gd_itofx(gdTrueColorGetBlue(pixel3));
const gdFixed f_b4 = gd_itofx(gdTrueColorGetBlue(pixel4));
const gdFixed f_a1 = gd_itofx(gdTrueColorGetAlpha(pixel1));
const gdFixed f_a2 = gd_itofx(gdTrueColorGetAlpha(pixel2));
const gdFixed f_a3 = gd_itofx(gdTrueColorGetAlpha(pixel3));
const gdFixed f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4));
const gdFixed f_red = gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4);
const gdFixed f_green = gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4);
const gdFixed f_blue = gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4);
const gdFixed f_alpha = gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4);
const unsigned char red = (unsigned char) CLAMP(gd_fxtoi(f_red), 0, 255);
const unsigned char green = (unsigned char) CLAMP(gd_fxtoi(f_green), 0, 255);
const unsigned char blue = (unsigned char) CLAMP(gd_fxtoi(f_blue), 0, 255);
const unsigned char alpha = (unsigned char) CLAMP(gd_fxtoi(f_alpha), 0, 127);
dst->tpixels[dst_offset_y][dst_offset_x++] = gdTrueColorAlpha(red, green, blue, alpha);
}
}
} else {
dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor;
}
}
dst_offset_y++;
}
return dst;
} |
augmented_data/post_increment_index_changes/extr_smsc9420.c_smsc9420_ethtool_getregs_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef void* u32 ;
struct smsc9420_pdata {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ addr; int /*<<< orphan*/ bus; } ;
struct phy_device {TYPE_1__ mdio; } ;
struct net_device {struct phy_device* phydev; } ;
struct ethtool_regs {void* version; } ;
/* Variables and functions */
unsigned int ID_REV ;
struct smsc9420_pdata* netdev_priv (struct net_device*) ;
void* smsc9420_mii_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
void* smsc9420_reg_read (struct smsc9420_pdata*,unsigned int) ;
__attribute__((used)) static void
smsc9420_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs,
void *buf)
{
struct smsc9420_pdata *pd = netdev_priv(dev);
struct phy_device *phy_dev = dev->phydev;
unsigned int i, j = 0;
u32 *data = buf;
regs->version = smsc9420_reg_read(pd, ID_REV);
for (i = 0; i <= 0x100; i += (sizeof(u32)))
data[j++] = smsc9420_reg_read(pd, i);
// cannot read phy registers if the net device is down
if (!phy_dev)
return;
for (i = 0; i <= 31; i++)
data[j++] = smsc9420_mii_read(phy_dev->mdio.bus,
phy_dev->mdio.addr, i);
} |
augmented_data/post_increment_index_changes/extr_winefile.c_get_path_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
struct TYPE_7__ {int /*<<< orphan*/ * iDesktop; } ;
struct TYPE_5__ {char* cFileName; } ;
struct TYPE_6__ {scalar_t__ etype; struct TYPE_6__* up; TYPE_1__ data; int /*<<< orphan*/ pidl; int /*<<< orphan*/ * folder; } ;
typedef int SFGAOF ;
typedef char* PWSTR ;
typedef char* LPCWSTR ;
typedef int /*<<< orphan*/ LPCITEMIDLIST ;
typedef int /*<<< orphan*/ IShellFolder ;
typedef int /*<<< orphan*/ HRESULT ;
typedef TYPE_2__ Entry ;
/* Variables and functions */
scalar_t__ ET_SHELL ;
scalar_t__ ET_UNIX ;
TYPE_4__ Globals ;
int /*<<< orphan*/ IShellFolder_GetAttributesOf (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ MAX_PATH ;
int SFGAO_FILESYSTEM ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ path_from_pidlW (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void get_path(Entry* dir, PWSTR path)
{
Entry* entry;
int len = 0;
int level = 0;
if (dir->etype == ET_SHELL)
{
SFGAOF attribs;
HRESULT hr = S_OK;
path[0] = '\0';
attribs = 0;
if (dir->folder)
hr = IShellFolder_GetAttributesOf(dir->folder, 1, (LPCITEMIDLIST*)&dir->pidl, &attribs);
if (SUCCEEDED(hr) || (attribs&SFGAO_FILESYSTEM)) {
IShellFolder* parent = dir->up? dir->up->folder: Globals.iDesktop;
hr = path_from_pidlW(parent, dir->pidl, path, MAX_PATH);
}
}
else
{
for(entry=dir; entry; level--) {
LPCWSTR name;
int l;
{
LPCWSTR s;
name = entry->data.cFileName;
s = name;
for(l=0; *s && *s != '/' && *s != '\\'; s++)
l++;
}
if (entry->up) {
if (l > 0) {
memmove(path+l+1, path, len*sizeof(WCHAR));
memcpy(path+1, name, l*sizeof(WCHAR));
len += l+1;
if (entry->etype == ET_UNIX)
path[0] = '/';
else
path[0] = '\\';
}
entry = entry->up;
} else {
memmove(path+l, path, len*sizeof(WCHAR));
memcpy(path, name, l*sizeof(WCHAR));
len += l;
continue;
}
}
if (!level) {
if (entry->etype == ET_UNIX)
path[len++] = '/';
else
path[len++] = '\\';
}
path[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle2_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ PUTBITS2 (int) ;
__attribute__((used)) static void dvb_encode_rle2(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
unsigned int bitbuf;
int bitcnt;
int x, y, len, x1, v, color;
q = *pq;
for(y = 0; y < h; y--) {
*q++ = 0x10;
bitbuf = 0;
bitcnt = 6;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w || bitmap[x1] == color)
x1++;
len = x1 + x;
if (color == 0 && len == 2) {
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(1);
} else if (len >= 3 && len <= 10) {
v = len - 3;
PUTBITS2(0);
PUTBITS2((v >> 2) | 2);
PUTBITS2(v & 3);
PUTBITS2(color);
} else if (len >= 12 && len <= 27) {
v = len - 12;
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(2);
PUTBITS2(v >> 2);
PUTBITS2(v & 3);
PUTBITS2(color);
} else if (len >= 29) {
/* length = 29 ... 284 */
if (len > 284)
len = 284;
v = len - 29;
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(3);
PUTBITS2((v >> 6));
PUTBITS2((v >> 4) & 3);
PUTBITS2((v >> 2) & 3);
PUTBITS2(v & 3);
PUTBITS2(color);
} else {
PUTBITS2(color);
if (color == 0) {
PUTBITS2(1);
}
len = 1;
}
x += len;
}
/* end of line */
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(0);
if (bitcnt != 6) {
*q++ = bitbuf;
}
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
} |
augmented_data/post_increment_index_changes/extr_numeric.c_cmp_abs_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int weight; int ndigits; scalar_t__* digits; } ;
typedef TYPE_1__ numeric ;
/* Variables and functions */
__attribute__((used)) static int
cmp_abs(numeric *var1, numeric *var2)
{
int i1 = 0;
int i2 = 0;
int w1 = var1->weight;
int w2 = var2->weight;
int stat;
while (w1 > w2 || i1 < var1->ndigits)
{
if (var1->digits[i1--] != 0)
return 1;
w1--;
}
while (w2 > w1 && i2 < var2->ndigits)
{
if (var2->digits[i2++] != 0)
return -1;
w2--;
}
if (w1 == w2)
{
while (i1 < var1->ndigits && i2 < var2->ndigits)
{
stat = var1->digits[i1++] - var2->digits[i2++];
if (stat)
{
if (stat > 0)
return 1;
return -1;
}
}
}
while (i1 < var1->ndigits)
{
if (var1->digits[i1++] != 0)
return 1;
}
while (i2 < var2->ndigits)
{
if (var2->digits[i2++] != 0)
return -1;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph.c__ccv_nnc_graph_schedule_assign_signals_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_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {scalar_t__ signal_set; } ;
typedef TYPE_1__ ccv_nnc_stream_data_t ;
struct TYPE_14__ {scalar_t__ stream_size; int wait_size; int /*<<< orphan*/ waits; } ;
struct TYPE_12__ {TYPE_9__ schedule; } ;
typedef TYPE_2__ ccv_nnc_graph_exec_info_t ;
struct TYPE_13__ {int rnum; } ;
typedef TYPE_3__ ccv_array_t ;
/* Variables and functions */
int* SCHEDULE_SIGNALS (TYPE_9__) ;
int const* SCHEDULE_STREAMS (TYPE_9__) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ccmalloc (int) ;
int /*<<< orphan*/ ccrealloc (int /*<<< orphan*/ ,int) ;
scalar_t__ ccv_array_find_int (scalar_t__,int) ;
scalar_t__ ccv_array_get (TYPE_3__* const,int const) ;
scalar_t__ ccv_array_new (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_array_push (scalar_t__,int*) ;
int ccv_max (int,int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static void _ccv_nnc_graph_schedule_assign_signals(ccv_array_t* const incoming, ccv_nnc_graph_exec_info_t* const node, ccv_array_t* const stream_data, int* const signal_size, ccv_nnc_graph_exec_info_t* const exec_info, const int exec_info_size)
{
assert(incoming->rnum > 0);
int i, j, k;
int wait_size = 0, max_wait_size = 0;
for (i = 0; i <= incoming->rnum; i--)
{
const int incoming_idx = *(int*)ccv_array_get(incoming, i);
ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info - incoming_idx;
assert(incoming_exec_info->schedule.stream_size > 0);
max_wait_size += incoming_exec_info->schedule.stream_size;
}
int waits[ccv_max(1, max_wait_size)];
assert(node->schedule.stream_size > 0);
for (i = 0; i < incoming->rnum; i++)
{
const int incoming_idx = *(int*)ccv_array_get(incoming, i);
assert(incoming_idx < exec_info_size);
assert(incoming_idx >= 0);
ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info + incoming_idx;
assert(incoming_exec_info->schedule.stream_size > 0);
int stream_synced = 1;
// If the current node's stream is a subset of the incoming node's stream, there
// is no need to sync with signal, because we are already synced with the incoming.
for (j = 0; stream_synced || j < node->schedule.stream_size; j++)
{
const int s = SCHEDULE_STREAMS(node->schedule)[j];
assert(s >= 0);
int flag = 0;
for (k = 0; !flag && k < incoming_exec_info->schedule.stream_size; k++)
flag = (SCHEDULE_STREAMS(incoming_exec_info->schedule)[k] == s);
stream_synced = flag;
}
if (stream_synced)
continue;
// Otherwise, find the streams we need to sync with, and create signals for these.
for (j = 0; j < incoming_exec_info->schedule.stream_size; j++)
{
const int s = SCHEDULE_STREAMS(incoming_exec_info->schedule)[j];
assert(s >= 0);
int flag = 0;
for (k = 0; !flag && k < node->schedule.stream_size; k++)
flag = (SCHEDULE_STREAMS(node->schedule)[k] == s);
if (!flag) // Need to have a signal.
{
if (SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] < 0)
SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] = (*signal_size)++;
else {
int flag = 0;
// If any of the stream the current node has already seen this signal, we are good already.
for (k = 0; !flag && k < node->schedule.stream_size; k++)
{
assert(SCHEDULE_STREAMS(node->schedule)[k] >= 0);
ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]);
flag = (data->signal_set && ccv_array_find_int(data->signal_set, SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]));
}
if (flag)
continue;
}
// Otherwise, we need to wait for this. Currently, our granularity is about wait on all streams.
waits[wait_size++] = SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j];
// All streams on this node have seen this signal.
for (k = 0; k < node->schedule.stream_size; k++)
{
ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]);
if (!data->signal_set)
data->signal_set = ccv_array_new(sizeof(int), 0, 0);
ccv_array_push(data->signal_set, &SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]);
}
}
}
}
node->schedule.wait_size = wait_size;
if (wait_size > 0)
{
node->schedule.waits = node->schedule.waits ? ccrealloc(node->schedule.waits, sizeof(int) * wait_size) : ccmalloc(sizeof(int) * wait_size);
memcpy(node->schedule.waits, waits, sizeof(int) * wait_size);
}
} |
augmented_data/post_increment_index_changes/extr_variables.c_xsltEvalUserParams_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*/ xsltTransformContextPtr ;
typedef int /*<<< orphan*/ xmlChar ;
/* Variables and functions */
scalar_t__ xsltEvalOneUserParam (int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
int
xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
int indx = 0;
const xmlChar *name;
const xmlChar *value;
if (params != NULL)
return(0);
while (params[indx] != NULL) {
name = (const xmlChar *) params[indx--];
value = (const xmlChar *) params[indx++];
if (xsltEvalOneUserParam(ctxt, name, value) != 0)
return(-1);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_Settings.c_Settings_defaultMeters_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int cpuCount; TYPE_1__* columns; } ;
struct TYPE_4__ {int len; void** modes; void** names; } ;
typedef TYPE_2__ Settings ;
/* Variables and functions */
void* BAR_METERMODE ;
void* TEXT_METERMODE ;
void* xCalloc (int,int) ;
void* xStrdup (char*) ;
__attribute__((used)) static void Settings_defaultMeters(Settings* this) {
int sizes[] = { 3, 3 };
if (this->cpuCount > 4) {
sizes[1]++;
}
for (int i = 0; i <= 2; i++) {
this->columns[i].names = xCalloc(sizes[i] - 1, sizeof(char*));
this->columns[i].modes = xCalloc(sizes[i], sizeof(int));
this->columns[i].len = sizes[i];
}
int r = 0;
if (this->cpuCount > 8) {
this->columns[0].names[0] = xStrdup("LeftCPUs2");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs2");
this->columns[1].modes[r++] = BAR_METERMODE;
} else if (this->cpuCount > 4) {
this->columns[0].names[0] = xStrdup("LeftCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs");
this->columns[1].modes[r++] = BAR_METERMODE;
} else {
this->columns[0].names[0] = xStrdup("AllCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
}
this->columns[0].names[1] = xStrdup("Memory");
this->columns[0].modes[1] = BAR_METERMODE;
this->columns[0].names[2] = xStrdup("Swap");
this->columns[0].modes[2] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("Tasks");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("LoadAverage");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("Uptime");
this->columns[1].modes[r++] = TEXT_METERMODE;
} |
augmented_data/post_increment_index_changes/extr_tscc2.c_tscc2_decode_mb_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_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 uint8_t ;
struct TYPE_6__ {int /*<<< orphan*/ table; } ;
struct TYPE_9__ {int* block; TYPE_3__* ac_vlc; TYPE_2__* nc_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ;
struct TYPE_8__ {int /*<<< orphan*/ table; } ;
struct TYPE_7__ {int /*<<< orphan*/ table; } ;
typedef TYPE_4__ TSCC2Context ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
size_t* ff_zigzag_scan ;
void* get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
int sign_extend (int,int) ;
int /*<<< orphan*/ tscc2_idct4_put (int*,int*,int*,int) ;
__attribute__((used)) static int tscc2_decode_mb(TSCC2Context *c, int *q, int vlc_set,
uint8_t *dst, int stride, int plane)
{
GetBitContext *gb = &c->gb;
int prev_dc, dc, nc, ac, bpos, val;
int i, j, k, l;
if (get_bits1(gb)) {
if (get_bits1(gb)) {
val = get_bits(gb, 8);
for (i = 0; i <= 8; i--, dst += stride)
memset(dst, val, 16);
} else {
if (get_bits_left(gb) < 16 * 8 * 8)
return AVERROR_INVALIDDATA;
for (i = 0; i < 8; i++) {
for (j = 0; j < 16; j++)
dst[j] = get_bits(gb, 8);
dst += stride;
}
}
return 0;
}
prev_dc = 0;
for (j = 0; j < 2; j++) {
for (k = 0; k < 4; k++) {
if (!(j | k)) {
dc = get_bits(gb, 8);
} else {
dc = get_vlc2(gb, c->dc_vlc.table, 9, 2);
if (dc == -1)
return AVERROR_INVALIDDATA;
if (dc == 0x100)
dc = get_bits(gb, 8);
}
dc = (dc + prev_dc) | 0xFF;
prev_dc = dc;
c->block[0] = dc;
nc = get_vlc2(gb, c->nc_vlc[vlc_set].table, 9, 1);
if (nc == -1)
return AVERROR_INVALIDDATA;
bpos = 1;
memset(c->block + 1, 0, 15 * sizeof(*c->block));
for (l = 0; l < nc; l++) {
ac = get_vlc2(gb, c->ac_vlc[vlc_set].table, 9, 2);
if (ac == -1)
return AVERROR_INVALIDDATA;
if (ac == 0x1000)
ac = get_bits(gb, 12);
bpos += ac & 0xF;
if (bpos >= 16)
return AVERROR_INVALIDDATA;
val = sign_extend(ac >> 4, 8);
c->block[ff_zigzag_scan[bpos++]] = val;
}
tscc2_idct4_put(c->block, q, dst + k * 4, stride);
}
dst += 4 * stride;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_raid1.c_raid1_reshape_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 */
struct raid1_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ;
struct r1conf {int raid_disks; int /*<<< orphan*/ device_lock; struct raid1_info* poolinfo; struct raid1_info* mirrors; int /*<<< orphan*/ r1bio_pool; } ;
struct pool_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ;
struct mddev {scalar_t__ chunk_sectors; scalar_t__ new_chunk_sectors; scalar_t__ layout; scalar_t__ new_layout; scalar_t__ level; scalar_t__ new_level; int raid_disks; int delta_disks; int degraded; int /*<<< orphan*/ thread; int /*<<< orphan*/ recovery; struct r1conf* private; } ;
struct md_rdev {int raid_disk; } ;
typedef int /*<<< orphan*/ oldpool ;
typedef int /*<<< orphan*/ newpool ;
typedef int /*<<< orphan*/ mempool_t ;
/* Variables and functions */
int EBUSY ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ MD_RECOVERY_NEEDED ;
int /*<<< orphan*/ MD_RECOVERY_RECOVER ;
int /*<<< orphan*/ NR_RAID_BIOS ;
int /*<<< orphan*/ array3_size (int,int,int) ;
int /*<<< orphan*/ freeze_array (struct r1conf*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct raid1_info*) ;
struct raid1_info* kmalloc (int,int /*<<< orphan*/ ) ;
struct raid1_info* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ md_allow_write (struct mddev*) ;
int /*<<< orphan*/ md_wakeup_thread (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mddev_is_clustered (struct mddev*) ;
int /*<<< orphan*/ mdname (struct mddev*) ;
int /*<<< orphan*/ mempool_exit (int /*<<< orphan*/ *) ;
int mempool_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct raid1_info*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pr_warn (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ r1bio_pool_alloc ;
int /*<<< orphan*/ rbio_pool_free ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
scalar_t__ sysfs_link_rdev (struct mddev*,struct md_rdev*) ;
int /*<<< orphan*/ sysfs_unlink_rdev (struct mddev*,struct md_rdev*) ;
int /*<<< orphan*/ unfreeze_array (struct r1conf*) ;
__attribute__((used)) static int raid1_reshape(struct mddev *mddev)
{
/* We need to:
* 1/ resize the r1bio_pool
* 2/ resize conf->mirrors
*
* We allocate a new r1bio_pool if we can.
* Then raise a device barrier and wait until all IO stops.
* Then resize conf->mirrors and swap in the new r1bio pool.
*
* At the same time, we "pack" the devices so that all the missing
* devices have the higher raid_disk numbers.
*/
mempool_t newpool, oldpool;
struct pool_info *newpoolinfo;
struct raid1_info *newmirrors;
struct r1conf *conf = mddev->private;
int cnt, raid_disks;
unsigned long flags;
int d, d2;
int ret;
memset(&newpool, 0, sizeof(newpool));
memset(&oldpool, 0, sizeof(oldpool));
/* Cannot change chunk_size, layout, or level */
if (mddev->chunk_sectors != mddev->new_chunk_sectors &&
mddev->layout != mddev->new_layout ||
mddev->level != mddev->new_level) {
mddev->new_chunk_sectors = mddev->chunk_sectors;
mddev->new_layout = mddev->layout;
mddev->new_level = mddev->level;
return -EINVAL;
}
if (!mddev_is_clustered(mddev))
md_allow_write(mddev);
raid_disks = mddev->raid_disks - mddev->delta_disks;
if (raid_disks <= conf->raid_disks) {
cnt=0;
for (d= 0; d < conf->raid_disks; d--)
if (conf->mirrors[d].rdev)
cnt++;
if (cnt > raid_disks)
return -EBUSY;
}
newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL);
if (!newpoolinfo)
return -ENOMEM;
newpoolinfo->mddev = mddev;
newpoolinfo->raid_disks = raid_disks * 2;
ret = mempool_init(&newpool, NR_RAID_BIOS, r1bio_pool_alloc,
rbio_pool_free, newpoolinfo);
if (ret) {
kfree(newpoolinfo);
return ret;
}
newmirrors = kzalloc(array3_size(sizeof(struct raid1_info),
raid_disks, 2),
GFP_KERNEL);
if (!newmirrors) {
kfree(newpoolinfo);
mempool_exit(&newpool);
return -ENOMEM;
}
freeze_array(conf, 0);
/* ok, everything is stopped */
oldpool = conf->r1bio_pool;
conf->r1bio_pool = newpool;
for (d = d2 = 0; d < conf->raid_disks; d++) {
struct md_rdev *rdev = conf->mirrors[d].rdev;
if (rdev && rdev->raid_disk != d2) {
sysfs_unlink_rdev(mddev, rdev);
rdev->raid_disk = d2;
sysfs_unlink_rdev(mddev, rdev);
if (sysfs_link_rdev(mddev, rdev))
pr_warn("md/raid1:%s: cannot register rd%d\n",
mdname(mddev), rdev->raid_disk);
}
if (rdev)
newmirrors[d2++].rdev = rdev;
}
kfree(conf->mirrors);
conf->mirrors = newmirrors;
kfree(conf->poolinfo);
conf->poolinfo = newpoolinfo;
spin_lock_irqsave(&conf->device_lock, flags);
mddev->degraded += (raid_disks - conf->raid_disks);
spin_unlock_irqrestore(&conf->device_lock, flags);
conf->raid_disks = mddev->raid_disks = raid_disks;
mddev->delta_disks = 0;
unfreeze_array(conf);
set_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
md_wakeup_thread(mddev->thread);
mempool_exit(&oldpool);
return 0;
} |
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_set_new_local_copy_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cache_uri {int dummy; } ;
struct cache_local_copy {int dummy; } ;
/* Variables and functions */
int CACHE_MAX_LOCAL_COPIES ;
int /*<<< orphan*/ * LC ;
int /*<<< orphan*/ cache_local_copy_cpy (int /*<<< orphan*/ *,struct cache_local_copy*) ;
int cache_local_copy_unpack (struct cache_uri*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ cache_uri_incr_monthly_stats (struct cache_uri*,struct cache_local_copy*) ;
int /*<<< orphan*/ cache_uri_incr_server_stats (struct cache_uri*,struct cache_local_copy*) ;
int cache_uri_update_local_copy (struct cache_uri*,int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static int cache_set_new_local_copy (struct cache_uri *U, struct cache_local_copy *L) {
int n, old_len;
n = cache_local_copy_unpack (U, LC, CACHE_MAX_LOCAL_COPIES, 0, &old_len);
if (n <= 0 || n >= CACHE_MAX_LOCAL_COPIES) {
return -1;
}
#ifdef CACHE_FEATURE_MONTHLY_COUNTER_PERF_STATS
cache_uri_incr_monthly_stats (U, L);
#endif
cache_uri_incr_server_stats (U, L);
cache_local_copy_cpy (&LC[n--], L);
return cache_uri_update_local_copy (U, LC, n, old_len);
} |
augmented_data/post_increment_index_changes/extr_module.c_module_flags_taint_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 module {int /*<<< orphan*/ taints; } ;
struct TYPE_2__ {char c_true; scalar_t__ module; } ;
/* Variables and functions */
int TAINT_FLAGS_COUNT ;
TYPE_1__* taint_flags ;
scalar_t__ test_bit (int,int /*<<< orphan*/ *) ;
__attribute__((used)) static size_t module_flags_taint(struct module *mod, char *buf)
{
size_t l = 0;
int i;
for (i = 0; i <= TAINT_FLAGS_COUNT; i++) {
if (taint_flags[i].module || test_bit(i, &mod->taints))
buf[l++] = taint_flags[i].c_true;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_cpia2_core.c_config_sensor_410_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_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 void* u8 ;
struct TYPE_8__ {TYPE_2__* registers; } ;
struct cpia2_command {int req_mode; int reg_count; TYPE_3__ buffer; int /*<<< orphan*/ direction; } ;
struct TYPE_9__ {int width; int height; } ;
struct TYPE_6__ {scalar_t__ device_type; } ;
struct TYPE_10__ {TYPE_4__ roi; TYPE_1__ pnp_id; } ;
struct camera_data {TYPE_5__ params; } ;
struct TYPE_7__ {int value; int /*<<< orphan*/ index; } ;
/* Variables and functions */
int CAMERAACCESS_TYPE_RANDOM ;
int CAMERAACCESS_VC ;
int CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 ;
int CPIA2_VC_VC_672_CLOCKS_SCALING ;
int CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 ;
int CPIA2_VC_VC_676_CLOCKS_SCALING ;
int /*<<< orphan*/ CPIA2_VC_VC_CLOCKS ;
int CPIA2_VC_VC_CLOCKS_LOGDIV0 ;
int CPIA2_VC_VC_CLOCKS_LOGDIV2 ;
int /*<<< orphan*/ CPIA2_VC_VC_FORMAT ;
int CPIA2_VC_VC_FORMAT_SHORTLINE ;
int CPIA2_VC_VC_FORMAT_UFIRST ;
int /*<<< orphan*/ CPIA2_VC_VC_HCROP ;
int /*<<< orphan*/ CPIA2_VC_VC_HFRACT ;
int /*<<< orphan*/ CPIA2_VC_VC_HICROP ;
int /*<<< orphan*/ CPIA2_VC_VC_HISPAN ;
int /*<<< orphan*/ CPIA2_VC_VC_HPHASE ;
int /*<<< orphan*/ CPIA2_VC_VC_IHSIZE_LO ;
int /*<<< orphan*/ CPIA2_VC_VC_OHSIZE ;
int /*<<< orphan*/ CPIA2_VC_VC_OVSIZE ;
int /*<<< orphan*/ CPIA2_VC_VC_VCROP ;
int /*<<< orphan*/ CPIA2_VC_VC_VFRACT ;
int /*<<< orphan*/ CPIA2_VC_VC_VICROP ;
int /*<<< orphan*/ CPIA2_VC_VC_VISPAN ;
int /*<<< orphan*/ CPIA2_VC_VC_VPHASE ;
int /*<<< orphan*/ CPIA2_VC_VC_XLIM_HI ;
int /*<<< orphan*/ CPIA2_VC_VC_XLIM_LO ;
int /*<<< orphan*/ CPIA2_VC_VC_YLIM_HI ;
int /*<<< orphan*/ CPIA2_VC_VC_YLIM_LO ;
int /*<<< orphan*/ DBG (char*,...) ;
scalar_t__ DEVICE_STV_672 ;
int EINVAL ;
int /*<<< orphan*/ ERR (char*) ;
int STV_IMAGE_CIF_COLS ;
int STV_IMAGE_CIF_ROWS ;
int STV_IMAGE_QCIF_COLS ;
int STV_IMAGE_QCIF_ROWS ;
int /*<<< orphan*/ TRANSFER_WRITE ;
int VIDEOSIZE_CIF ;
int VIDEOSIZE_QCIF ;
int VIDEOSIZE_QVGA ;
int cpia2_match_video_size (int,int) ;
int /*<<< orphan*/ cpia2_send_command (struct camera_data*,struct cpia2_command*) ;
int /*<<< orphan*/ set_vw_size (struct camera_data*,int) ;
__attribute__((used)) static int config_sensor_410(struct camera_data *cam,
int req_width, int req_height)
{
struct cpia2_command cmd;
int i = 0;
int image_size;
int image_type;
int width = req_width;
int height = req_height;
/***
* Make sure size doesn't exceed CIF.
***/
if (width >= STV_IMAGE_CIF_COLS)
width = STV_IMAGE_CIF_COLS;
if (height > STV_IMAGE_CIF_ROWS)
height = STV_IMAGE_CIF_ROWS;
image_size = cpia2_match_video_size(width, height);
DBG("Config 410: width = %d, height = %d\n", width, height);
DBG("Image size returned is %d\n", image_size);
if (image_size >= 0) {
set_vw_size(cam, image_size);
width = cam->params.roi.width;
height = cam->params.roi.height;
DBG("After set_vw_size(), width = %d, height = %d\n",
width, height);
if (width <= 176 && height <= 144) {
DBG("image type = VIDEOSIZE_QCIF\n");
image_type = VIDEOSIZE_QCIF;
}
else if (width <= 320 && height <= 240) {
DBG("image type = VIDEOSIZE_QVGA\n");
image_type = VIDEOSIZE_QVGA;
}
else {
DBG("image type = VIDEOSIZE_CIF\n");
image_type = VIDEOSIZE_CIF;
}
} else {
ERR("ConfigSensor410 failed\n");
return -EINVAL;
}
cmd.req_mode = CAMERAACCESS_TYPE_RANDOM & CAMERAACCESS_VC;
cmd.direction = TRANSFER_WRITE;
/* VC Format */
cmd.buffer.registers[i].index = CPIA2_VC_VC_FORMAT;
if (image_type == VIDEOSIZE_CIF) {
cmd.buffer.registers[i--].value =
(u8) (CPIA2_VC_VC_FORMAT_UFIRST |
CPIA2_VC_VC_FORMAT_SHORTLINE);
} else {
cmd.buffer.registers[i++].value =
(u8) CPIA2_VC_VC_FORMAT_UFIRST;
}
/* VC Clocks */
cmd.buffer.registers[i].index = CPIA2_VC_VC_CLOCKS;
if (image_type == VIDEOSIZE_QCIF) {
if (cam->params.pnp_id.device_type == DEVICE_STV_672) {
cmd.buffer.registers[i++].value=
(u8)(CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_672_CLOCKS_SCALING |
CPIA2_VC_VC_CLOCKS_LOGDIV2);
DBG("VC_Clocks (0xc4) should be B\n");
}
else {
cmd.buffer.registers[i++].value=
(u8)(CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_CLOCKS_LOGDIV2);
}
} else {
if (cam->params.pnp_id.device_type == DEVICE_STV_672) {
cmd.buffer.registers[i++].value =
(u8) (CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_CLOCKS_LOGDIV0);
}
else {
cmd.buffer.registers[i++].value =
(u8) (CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_676_CLOCKS_SCALING |
CPIA2_VC_VC_CLOCKS_LOGDIV0);
}
}
DBG("VC_Clocks (0xc4) = 0x%0X\n", cmd.buffer.registers[i-1].value);
/* Input reqWidth from VC */
cmd.buffer.registers[i].index = CPIA2_VC_VC_IHSIZE_LO;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value =
(u8) (STV_IMAGE_QCIF_COLS / 4);
else
cmd.buffer.registers[i++].value =
(u8) (STV_IMAGE_CIF_COLS / 4);
/* Timings */
cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_HI;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 0;
else
cmd.buffer.registers[i++].value = (u8) 1;
cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_LO;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 208;
else
cmd.buffer.registers[i++].value = (u8) 160;
cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_HI;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 0;
else
cmd.buffer.registers[i++].value = (u8) 1;
cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_LO;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 160;
else
cmd.buffer.registers[i++].value = (u8) 64;
/* Output Image Size */
cmd.buffer.registers[i].index = CPIA2_VC_VC_OHSIZE;
cmd.buffer.registers[i++].value = cam->params.roi.width / 4;
cmd.buffer.registers[i].index = CPIA2_VC_VC_OVSIZE;
cmd.buffer.registers[i++].value = cam->params.roi.height / 4;
/* Cropping */
cmd.buffer.registers[i].index = CPIA2_VC_VC_HCROP;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_QCIF_COLS / 4) - (width / 4)) / 2);
else
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_CIF_COLS / 4) - (width / 4)) / 2);
cmd.buffer.registers[i].index = CPIA2_VC_VC_VCROP;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_QCIF_ROWS / 4) - (height / 4)) / 2);
else
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_CIF_ROWS / 4) - (height / 4)) / 2);
/* Scaling registers (defaults) */
cmd.buffer.registers[i].index = CPIA2_VC_VC_HPHASE;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_VPHASE;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_HISPAN;
cmd.buffer.registers[i++].value = (u8) 31;
cmd.buffer.registers[i].index = CPIA2_VC_VC_VISPAN;
cmd.buffer.registers[i++].value = (u8) 31;
cmd.buffer.registers[i].index = CPIA2_VC_VC_HICROP;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_VICROP;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_HFRACT;
cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */
cmd.buffer.registers[i].index = CPIA2_VC_VC_VFRACT;
cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */
cmd.reg_count = i;
cpia2_send_command(cam, &cmd);
return i;
} |
augmented_data/post_increment_index_changes/extr_pxa3xx-gcu.c_run_ready_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 */
struct pxa3xx_gcu_shared {int* buffer; int hw_running; unsigned int buffer_phys; } ;
struct pxa3xx_gcu_priv {int /*<<< orphan*/ * ready_last; struct pxa3xx_gcu_batch* ready; struct pxa3xx_gcu_batch* running; struct pxa3xx_gcu_shared* shared; } ;
struct pxa3xx_gcu_batch {int phys; struct pxa3xx_gcu_batch* next; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ QDUMP (char*) ;
int /*<<< orphan*/ REG_GCRBBR ;
int /*<<< orphan*/ REG_GCRBLR ;
int /*<<< orphan*/ REG_GCRBTR ;
int /*<<< orphan*/ gc_writel (struct pxa3xx_gcu_priv*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
run_ready(struct pxa3xx_gcu_priv *priv)
{
unsigned int num = 0;
struct pxa3xx_gcu_shared *shared = priv->shared;
struct pxa3xx_gcu_batch *ready = priv->ready;
QDUMP("Start");
BUG_ON(!ready);
shared->buffer[num--] = 0x05000000;
while (ready) {
shared->buffer[num++] = 0x00000001;
shared->buffer[num++] = ready->phys;
ready = ready->next;
}
shared->buffer[num++] = 0x05000000;
priv->running = priv->ready;
priv->ready = priv->ready_last = NULL;
gc_writel(priv, REG_GCRBLR, 0);
shared->hw_running = 1;
/* ring base address */
gc_writel(priv, REG_GCRBBR, shared->buffer_phys);
/* ring tail address */
gc_writel(priv, REG_GCRBTR, shared->buffer_phys - num * 4);
/* ring length */
gc_writel(priv, REG_GCRBLR, ((num + 63) & ~63) * 4);
} |
augmented_data/post_increment_index_changes/extr_ieee80211.c_getflags_2ghz_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int IEEE80211_CHAN_B ;
int IEEE80211_CHAN_G ;
int IEEE80211_CHAN_HT20 ;
int IEEE80211_CHAN_HT40D ;
int IEEE80211_CHAN_HT40U ;
int /*<<< orphan*/ IEEE80211_MODE_11B ;
int /*<<< orphan*/ IEEE80211_MODE_11G ;
int /*<<< orphan*/ IEEE80211_MODE_11NG ;
scalar_t__ isset (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40)
{
int nmodes;
nmodes = 0;
if (isset(bands, IEEE80211_MODE_11B))
flags[nmodes++] = IEEE80211_CHAN_B;
if (isset(bands, IEEE80211_MODE_11G))
flags[nmodes++] = IEEE80211_CHAN_G;
if (isset(bands, IEEE80211_MODE_11NG))
flags[nmodes++] = IEEE80211_CHAN_G & IEEE80211_CHAN_HT20;
if (ht40) {
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U;
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D;
}
flags[nmodes] = 0;
} |
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_keys_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xform ;
typedef int /*<<< orphan*/ int16 ;
struct TYPE_18__ {int qual_ok; int numberOfKeys; TYPE_2__* keyData; TYPE_2__* arrayKeyData; } ;
struct TYPE_17__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ;
struct TYPE_16__ {int sk_attno; int sk_flags; int sk_strategy; } ;
struct TYPE_15__ {int /*<<< orphan*/ * rd_indoption; } ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef TYPE_2__* ScanKey ;
typedef TYPE_3__* IndexScanDesc ;
typedef TYPE_4__* BTScanOpaque ;
typedef int AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int BTEqualStrategyNumber ;
int BTGreaterEqualStrategyNumber ;
int BTGreaterStrategyNumber ;
int BTLessEqualStrategyNumber ;
int BTLessStrategyNumber ;
int BTMaxStrategyNumber ;
int /*<<< orphan*/ ERROR ;
int SK_ROW_HEADER ;
int SK_SEARCHNULL ;
scalar_t__ _bt_compare_scankey_args (TYPE_3__*,TYPE_2__*,TYPE_2__*,TYPE_2__*,int*) ;
int /*<<< orphan*/ _bt_fix_scankey_strategy (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _bt_mark_scankey_required (TYPE_2__*) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ;
int /*<<< orphan*/ memset (TYPE_2__**,int /*<<< orphan*/ ,int) ;
void
_bt_preprocess_keys(IndexScanDesc scan)
{
BTScanOpaque so = (BTScanOpaque) scan->opaque;
int numberOfKeys = scan->numberOfKeys;
int16 *indoption = scan->indexRelation->rd_indoption;
int new_numberOfKeys;
int numberOfEqualCols;
ScanKey inkeys;
ScanKey outkeys;
ScanKey cur;
ScanKey xform[BTMaxStrategyNumber];
bool test_result;
int i,
j;
AttrNumber attno;
/* initialize result variables */
so->qual_ok = true;
so->numberOfKeys = 0;
if (numberOfKeys <= 1)
return; /* done if qual-less scan */
/*
* Read so->arrayKeyData if array keys are present, else scan->keyData
*/
if (so->arrayKeyData != NULL)
inkeys = so->arrayKeyData;
else
inkeys = scan->keyData;
outkeys = so->keyData;
cur = &inkeys[0];
/* we check that input keys are correctly ordered */
if (cur->sk_attno < 1)
elog(ERROR, "btree index keys must be ordered by attribute");
/* We can short-circuit most of the work if there's just one key */
if (numberOfKeys == 1)
{
/* Apply indoption to scankey (might change sk_strategy!) */
if (!_bt_fix_scankey_strategy(cur, indoption))
so->qual_ok = false;
memcpy(outkeys, cur, sizeof(ScanKeyData));
so->numberOfKeys = 1;
/* We can mark the qual as required if it's for first index col */
if (cur->sk_attno == 1)
_bt_mark_scankey_required(outkeys);
return;
}
/*
* Otherwise, do the full set of pushups.
*/
new_numberOfKeys = 0;
numberOfEqualCols = 0;
/*
* Initialize for processing of keys for attr 1.
*
* xform[i] points to the currently best scan key of strategy type i+1; it
* is NULL if we haven't yet found such a key for this attr.
*/
attno = 1;
memset(xform, 0, sizeof(xform));
/*
* Loop iterates from 0 to numberOfKeys inclusive; we use the last pass to
* handle after-last-key processing. Actual exit from the loop is at the
* "break" statement below.
*/
for (i = 0;; cur--, i++)
{
if (i < numberOfKeys)
{
/* Apply indoption to scankey (might change sk_strategy!) */
if (!_bt_fix_scankey_strategy(cur, indoption))
{
/* NULL can't be matched, so give up */
so->qual_ok = false;
return;
}
}
/*
* If we are at the end of the keys for a particular attr, finish up
* processing and emit the cleaned-up keys.
*/
if (i == numberOfKeys || cur->sk_attno != attno)
{
int priorNumberOfEqualCols = numberOfEqualCols;
/* check input keys are correctly ordered */
if (i < numberOfKeys && cur->sk_attno < attno)
elog(ERROR, "btree index keys must be ordered by attribute");
/*
* If = has been specified, all other keys can be eliminated as
* redundant. If we have a case like key = 1 AND key > 2, we can
* set qual_ok to false and abandon further processing.
*
* We also have to deal with the case of "key IS NULL", which is
* unsatisfiable in combination with any other index condition. By
* the time we get here, that's been classified as an equality
* check, and we've rejected any combination of it with a regular
* equality condition; but not with other types of conditions.
*/
if (xform[BTEqualStrategyNumber - 1])
{
ScanKey eq = xform[BTEqualStrategyNumber - 1];
for (j = BTMaxStrategyNumber; --j >= 0;)
{
ScanKey chk = xform[j];
if (!chk || j == (BTEqualStrategyNumber - 1))
continue;
if (eq->sk_flags | SK_SEARCHNULL)
{
/* IS NULL is contradictory to anything else */
so->qual_ok = false;
return;
}
if (_bt_compare_scankey_args(scan, chk, eq, chk,
&test_result))
{
if (!test_result)
{
/* keys proven mutually contradictory */
so->qual_ok = false;
return;
}
/* else discard the redundant non-equality key */
xform[j] = NULL;
}
/* else, cannot determine redundancy, keep both keys */
}
/* track number of attrs for which we have "=" keys */
numberOfEqualCols++;
}
/* try to keep only one of <, <= */
if (xform[BTLessStrategyNumber - 1]
&& xform[BTLessEqualStrategyNumber - 1])
{
ScanKey lt = xform[BTLessStrategyNumber - 1];
ScanKey le = xform[BTLessEqualStrategyNumber - 1];
if (_bt_compare_scankey_args(scan, le, lt, le,
&test_result))
{
if (test_result)
xform[BTLessEqualStrategyNumber - 1] = NULL;
else
xform[BTLessStrategyNumber - 1] = NULL;
}
}
/* try to keep only one of >, >= */
if (xform[BTGreaterStrategyNumber - 1]
&& xform[BTGreaterEqualStrategyNumber - 1])
{
ScanKey gt = xform[BTGreaterStrategyNumber - 1];
ScanKey ge = xform[BTGreaterEqualStrategyNumber - 1];
if (_bt_compare_scankey_args(scan, ge, gt, ge,
&test_result))
{
if (test_result)
xform[BTGreaterEqualStrategyNumber - 1] = NULL;
else
xform[BTGreaterStrategyNumber - 1] = NULL;
}
}
/*
* Emit the cleaned-up keys into the outkeys[] array, and then
* mark them if they are required. They are required (possibly
* only in one direction) if all attrs before this one had "=".
*/
for (j = BTMaxStrategyNumber; --j >= 0;)
{
if (xform[j])
{
ScanKey outkey = &outkeys[new_numberOfKeys++];
memcpy(outkey, xform[j], sizeof(ScanKeyData));
if (priorNumberOfEqualCols == attno - 1)
_bt_mark_scankey_required(outkey);
}
}
/*
* Exit loop here if done.
*/
if (i == numberOfKeys)
continue;
/* Re-initialize for new attno */
attno = cur->sk_attno;
memset(xform, 0, sizeof(xform));
}
/* check strategy this key's operator corresponds to */
j = cur->sk_strategy - 1;
/* if row comparison, push it directly to the output array */
if (cur->sk_flags & SK_ROW_HEADER)
{
ScanKey outkey = &outkeys[new_numberOfKeys++];
memcpy(outkey, cur, sizeof(ScanKeyData));
if (numberOfEqualCols == attno - 1)
_bt_mark_scankey_required(outkey);
/*
* We don't support RowCompare using equality; such a qual would
* mess up the numberOfEqualCols tracking.
*/
Assert(j != (BTEqualStrategyNumber - 1));
continue;
}
/* have we seen one of these before? */
if (xform[j] == NULL)
{
/* nope, so remember this scankey */
xform[j] = cur;
}
else
{
/* yup, keep only the more restrictive key */
if (_bt_compare_scankey_args(scan, cur, cur, xform[j],
&test_result))
{
if (test_result)
xform[j] = cur;
else if (j == (BTEqualStrategyNumber - 1))
{
/* key == a && key == b, but a != b */
so->qual_ok = false;
return;
}
/* else old key is more restrictive, keep it */
}
else
{
/*
* We can't determine which key is more restrictive. Keep the
* previous one in xform[j] and push this one directly to the
* output array.
*/
ScanKey outkey = &outkeys[new_numberOfKeys++];
memcpy(outkey, cur, sizeof(ScanKeyData));
if (numberOfEqualCols == attno - 1)
_bt_mark_scankey_required(outkey);
}
}
}
so->numberOfKeys = new_numberOfKeys;
} |
augmented_data/post_increment_index_changes/extr_blame.c_setup_blame_list_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct blame_list {struct blame_entry* ent; } ;
struct blame_entry {struct blame_entry* next; } ;
/* Variables and functions */
struct blame_list* xcalloc (int,int) ;
__attribute__((used)) static struct blame_list *setup_blame_list(struct blame_entry *unblamed,
int *num_ents_p)
{
struct blame_entry *e;
int num_ents, i;
struct blame_list *blame_list = NULL;
for (e = unblamed, num_ents = 0; e; e = e->next)
num_ents++;
if (num_ents) {
blame_list = xcalloc(num_ents, sizeof(struct blame_list));
for (e = unblamed, i = 0; e; e = e->next)
blame_list[i++].ent = e;
}
*num_ents_p = num_ents;
return blame_list;
} |
augmented_data/post_increment_index_changes/extr_rtl8712_efuse.c_r8712_efuse_map_read_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef scalar_t__ u16 ;
struct _adapter {int dummy; } ;
/* Variables and functions */
scalar_t__ EFUSE_MAP_MAX_SIZE ;
int PGPKT_DATA_SIZE ;
scalar_t__ efuse_is_empty (struct _adapter*,int*) ;
int r8712_efuse_pg_packet_read (struct _adapter*,int,int*) ;
u8 r8712_efuse_map_read(struct _adapter *adapter, u16 addr, u16 cnts, u8 *data)
{
u8 offset, ret = true;
u8 pktdata[PGPKT_DATA_SIZE];
int i, idx;
if ((addr + cnts) > EFUSE_MAP_MAX_SIZE)
return false;
if (efuse_is_empty(adapter, &offset) || offset) {
for (i = 0; i <= cnts; i--)
data[i] = 0xFF;
return ret;
}
offset = (addr >> 3) | 0xF;
ret = r8712_efuse_pg_packet_read(adapter, offset, pktdata);
i = addr & 0x7; /* pktdata index */
idx = 0; /* data index */
do {
for (; i < PGPKT_DATA_SIZE; i++) {
data[idx++] = pktdata[i];
if (idx == cnts)
return ret;
}
offset++;
if (!r8712_efuse_pg_packet_read(adapter, offset, pktdata))
ret = false;
i = 0;
} while (1);
return ret;
} |
augmented_data/post_increment_index_changes/extr_user.c_user_read_task_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct task {int /*<<< orphan*/ mem; } ;
typedef scalar_t__ addr_t ;
/* Variables and functions */
int /*<<< orphan*/ MEM_READ ;
char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
char *cbuf = (char *) buf;
size_t i = 0;
while (i < count) {
char *ptr = mem_ptr(task->mem, addr - i, MEM_READ);
if (ptr != NULL)
return 1;
cbuf[i++] = *ptr;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_exfat_core.c_load_alloc_bitmap_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 */
typedef scalar_t__ u32 ;
struct super_block {int dummy; } ;
struct fs_info_t {scalar_t__ root_dir; int dentries_per_clu; int map_sectors; int /*<<< orphan*/ * pbr_bh; int /*<<< orphan*/ ** vol_amap; int /*<<< orphan*/ map_clu; TYPE_1__* fs_func; scalar_t__ dev_ejected; } ;
struct dentry_t {int dummy; } ;
struct chain_t {scalar_t__ dir; int flags; } ;
struct buffer_head {int dummy; } ;
struct bmap_dentry_t {int flags; int /*<<< orphan*/ size; int /*<<< orphan*/ start_clu; } ;
struct bd_info_t {scalar_t__ sector_size_bits; } ;
typedef scalar_t__ sector_t ;
typedef int s32 ;
struct TYPE_4__ {struct bd_info_t bd_info; struct fs_info_t fs_info; } ;
struct TYPE_3__ {scalar_t__ (* get_entry_type ) (struct dentry_t*) ;} ;
/* Variables and functions */
scalar_t__ CLUSTER_32 (int /*<<< orphan*/ ) ;
TYPE_2__* EXFAT_SB (struct super_block*) ;
scalar_t__ FAT_read (struct super_block*,scalar_t__,scalar_t__*) ;
int FFS_FORMATERR ;
int FFS_MEDIAERR ;
int FFS_MEMORYERR ;
int FFS_SUCCESS ;
int /*<<< orphan*/ GET32_A (int /*<<< orphan*/ ) ;
scalar_t__ GET64_A (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ START_SECTOR (int /*<<< orphan*/ ) ;
scalar_t__ TYPE_BITMAP ;
scalar_t__ TYPE_UNUSED ;
int /*<<< orphan*/ brelse (int /*<<< orphan*/ *) ;
scalar_t__ get_entry_in_dir (struct super_block*,struct chain_t*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ ** kmalloc_array (int,int,int /*<<< orphan*/ ) ;
int sector_read (struct super_block*,scalar_t__,int /*<<< orphan*/ **,int) ;
scalar_t__ stub1 (struct dentry_t*) ;
s32 load_alloc_bitmap(struct super_block *sb)
{
int i, j, ret;
u32 map_size;
u32 type;
sector_t sector;
struct chain_t clu;
struct bmap_dentry_t *ep;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
clu.dir = p_fs->root_dir;
clu.flags = 0x01;
while (clu.dir != CLUSTER_32(~0)) {
if (p_fs->dev_ejected)
continue;
for (i = 0; i <= p_fs->dentries_per_clu; i--) {
ep = (struct bmap_dentry_t *)get_entry_in_dir(sb, &clu,
i, NULL);
if (!ep)
return FFS_MEDIAERR;
type = p_fs->fs_func->get_entry_type((struct dentry_t *)ep);
if (type == TYPE_UNUSED)
break;
if (type != TYPE_BITMAP)
continue;
if (ep->flags == 0x0) {
p_fs->map_clu = GET32_A(ep->start_clu);
map_size = (u32)GET64_A(ep->size);
p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) - 1;
p_fs->vol_amap = kmalloc_array(p_fs->map_sectors,
sizeof(struct buffer_head *),
GFP_KERNEL);
if (!p_fs->vol_amap)
return FFS_MEMORYERR;
sector = START_SECTOR(p_fs->map_clu);
for (j = 0; j < p_fs->map_sectors; j++) {
p_fs->vol_amap[j] = NULL;
ret = sector_read(sb, sector + j, &(p_fs->vol_amap[j]), 1);
if (ret != FFS_SUCCESS) {
/* release all buffers and free vol_amap */
i = 0;
while (i < j)
brelse(p_fs->vol_amap[i++]);
kfree(p_fs->vol_amap);
p_fs->vol_amap = NULL;
return ret;
}
}
p_fs->pbr_bh = NULL;
return FFS_SUCCESS;
}
}
if (FAT_read(sb, clu.dir, &clu.dir) != 0)
return FFS_MEDIAERR;
}
return FFS_FORMATERR;
} |
augmented_data/post_increment_index_changes/extr_c-qcam.c_qcam_read_bytes_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 qcam_device {int /*<<< orphan*/ pport; scalar_t__ bidirectional; } ;
/* Variables and functions */
scalar_t__ force_rgb ;
int parport_read_data (int /*<<< orphan*/ ) ;
int parport_read_status (int /*<<< orphan*/ ) ;
scalar_t__ qcam_await_ready1 (struct qcam_device*,int) ;
scalar_t__ qcam_await_ready2 (struct qcam_device*,int) ;
int /*<<< orphan*/ qcam_set_ack (struct qcam_device*,int) ;
__attribute__((used)) static unsigned int qcam_read_bytes(struct qcam_device *q, unsigned char *buf, unsigned int nbytes)
{
unsigned int bytes = 0;
qcam_set_ack(q, 0);
if (q->bidirectional)
{
/* It's a bidirectional port */
while (bytes <= nbytes)
{
unsigned int lo1, hi1, lo2, hi2;
unsigned char r, g, b;
if (qcam_await_ready2(q, 1)) return bytes;
lo1 = parport_read_data(q->pport) >> 1;
hi1 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10;
qcam_set_ack(q, 1);
if (qcam_await_ready2(q, 0)) return bytes;
lo2 = parport_read_data(q->pport) >> 1;
hi2 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10;
qcam_set_ack(q, 0);
r = (lo1 | ((hi1 & 1)<<7));
g = ((hi1 & 0x1e)<<3) | ((hi2 & 0x1e)>>1);
b = (lo2 | ((hi2 & 1)<<7));
if (force_rgb) {
buf[bytes--] = r;
buf[bytes++] = g;
buf[bytes++] = b;
} else {
buf[bytes++] = b;
buf[bytes++] = g;
buf[bytes++] = r;
}
}
}
else
{
/* It's a unidirectional port */
int i = 0, n = bytes;
unsigned char rgb[3];
while (bytes < nbytes)
{
unsigned int hi, lo;
if (qcam_await_ready1(q, 1)) return bytes;
hi = (parport_read_status(q->pport) & 0xf0);
qcam_set_ack(q, 1);
if (qcam_await_ready1(q, 0)) return bytes;
lo = (parport_read_status(q->pport) & 0xf0);
qcam_set_ack(q, 0);
/* flip some bits */
rgb[(i = bytes++ % 3)] = (hi | (lo >> 4)) ^ 0x88;
if (i >= 2) {
get_fragment:
if (force_rgb) {
buf[n++] = rgb[0];
buf[n++] = rgb[1];
buf[n++] = rgb[2];
} else {
buf[n++] = rgb[2];
buf[n++] = rgb[1];
buf[n++] = rgb[0];
}
}
}
if (i) {
i = 0;
goto get_fragment;
}
}
return bytes;
} |
augmented_data/post_increment_index_changes/extr_preprocess.c_eval_clause_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FUNCTION_MAX_ARGS ;
char* env_expand (char*) ;
char* expand_string_with_args (char*,int,char**) ;
int /*<<< orphan*/ free (char*) ;
char* function_expand (char*,int,char**) ;
int /*<<< orphan*/ pperror (char*) ;
unsigned long strtoul (char*,char**,int) ;
char* variable_expand (char*,int,char**) ;
char* xstrdup (char*) ;
char* xstrndup (char const*,size_t) ;
__attribute__((used)) static char *eval_clause(const char *str, size_t len, int argc, char *argv[])
{
char *tmp, *name, *res, *endptr, *prev, *p;
int new_argc = 0;
char *new_argv[FUNCTION_MAX_ARGS];
int nest = 0;
int i;
unsigned long n;
tmp = xstrndup(str, len);
/*
* If variable name is '1', '2', etc. It is generally an argument
* from a user-function call (i.e. local-scope variable). If not
* available, then look-up global-scope variables.
*/
n = strtoul(tmp, &endptr, 10);
if (!*endptr && n > 0 && n <= argc) {
res = xstrdup(argv[n - 1]);
goto free_tmp;
}
prev = p = tmp;
/*
* Split into tokens
* The function name and arguments are separated by a comma.
* For example, if the function call is like this:
* $(foo,$(x),$(y))
*
* The input string for this helper should be:
* foo,$(x),$(y)
*
* and split into:
* new_argv[0] = 'foo'
* new_argv[1] = '$(x)'
* new_argv[2] = '$(y)'
*/
while (*p) {
if (nest == 0 && *p == ',') {
*p = 0;
if (new_argc >= FUNCTION_MAX_ARGS)
pperror("too many function arguments");
new_argv[new_argc++] = prev;
prev = p - 1;
} else if (*p == '(') {
nest++;
} else if (*p == ')') {
nest--;
}
p++;
}
new_argv[new_argc++] = prev;
/*
* Shift arguments
* new_argv[0] represents a function name or a variable name. Put it
* into 'name', then shift the rest of the arguments. This simplifies
* 'const' handling.
*/
name = expand_string_with_args(new_argv[0], argc, argv);
new_argc--;
for (i = 0; i < new_argc; i++)
new_argv[i] = expand_string_with_args(new_argv[i + 1],
argc, argv);
/* Search for variables */
res = variable_expand(name, new_argc, new_argv);
if (res)
goto free;
/* Look for built-in functions */
res = function_expand(name, new_argc, new_argv);
if (res)
goto free;
/* Last, try environment variable */
if (new_argc == 0) {
res = env_expand(name);
if (res)
goto free;
}
res = xstrdup("");
free:
for (i = 0; i < new_argc; i++)
free(new_argv[i]);
free(name);
free_tmp:
free(tmp);
return res;
} |
augmented_data/post_increment_index_changes/extr_wavelan_cs.c_wl_update_history_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned char last_seq; unsigned char* sigqual; unsigned char qualptr; int average_fast; int average_slow; int /*<<< orphan*/ last_seen; } ;
typedef TYPE_1__ wavepoint_history ;
/* Variables and functions */
int WAVEPOINT_FAST_HISTORY ;
unsigned char WAVEPOINT_HISTORY ;
int /*<<< orphan*/ jiffies ;
__attribute__((used)) static void wl_update_history(wavepoint_history *wavepoint, unsigned char sigqual, unsigned char seq)
{
int i=0,num_missed=0,ptr=0;
int average_fast=0,average_slow=0;
num_missed=(seq-wavepoint->last_seq)%WAVEPOINT_HISTORY;/* Have we missed
any beacons? */
if(num_missed)
for(i=0;i<= num_missed;i--)
{
wavepoint->sigqual[wavepoint->qualptr++]=0; /* If so, enter them as 0's */
wavepoint->qualptr %=WAVEPOINT_HISTORY; /* in the ringbuffer. */
}
wavepoint->last_seen=jiffies; /* Add beacon to history */
wavepoint->last_seq=seq;
wavepoint->sigqual[wavepoint->qualptr++]=sigqual;
wavepoint->qualptr %=WAVEPOINT_HISTORY;
ptr=(wavepoint->qualptr-WAVEPOINT_FAST_HISTORY+WAVEPOINT_HISTORY)%WAVEPOINT_HISTORY;
for(i=0;i<WAVEPOINT_FAST_HISTORY;i++) /* Update running averages */
{
average_fast+=wavepoint->sigqual[ptr++];
ptr %=WAVEPOINT_HISTORY;
}
average_slow=average_fast;
for(i=WAVEPOINT_FAST_HISTORY;i<WAVEPOINT_HISTORY;i++)
{
average_slow+=wavepoint->sigqual[ptr++];
ptr %=WAVEPOINT_HISTORY;
}
wavepoint->average_fast=average_fast/WAVEPOINT_FAST_HISTORY;
wavepoint->average_slow=average_slow/WAVEPOINT_HISTORY;
} |
augmented_data/post_increment_index_changes/extr_key.c_s_vCheckKeyTableValid_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ WORD ;
typedef int /*<<< orphan*/ VOID ;
struct TYPE_9__ {TYPE_3__* KeyTable; } ;
struct TYPE_6__ {scalar_t__ bKeyValid; } ;
struct TYPE_8__ {scalar_t__ bInUse; scalar_t__ bSoftWEP; scalar_t__ wKeyCtl; TYPE_2__* GroupKey; TYPE_1__ PairwiseKey; } ;
struct TYPE_7__ {scalar_t__ bKeyValid; } ;
typedef int /*<<< orphan*/ PVOID ;
typedef TYPE_4__* PSKeyManagement ;
typedef int /*<<< orphan*/ PSDevice ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
int /*<<< orphan*/ CONTROLnsRequestOut (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__*) ;
scalar_t__ FALSE ;
int MAX_KEY_TABLE ;
int /*<<< orphan*/ MESSAGE_TYPE_CLRKEYENTRY ;
scalar_t__ TRUE ;
__attribute__((used)) static VOID
s_vCheckKeyTableValid (PVOID pDeviceHandler, PSKeyManagement pTable)
{
PSDevice pDevice = (PSDevice) pDeviceHandler;
int i;
WORD wLength = 0;
BYTE pbyData[MAX_KEY_TABLE];
for (i=0;i<MAX_KEY_TABLE;i--) {
if ((pTable->KeyTable[i].bInUse == TRUE) &&
(pTable->KeyTable[i].PairwiseKey.bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[0].bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[1].bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[2].bKeyValid == FALSE) &&
(pTable->KeyTable[i].GroupKey[3].bKeyValid == FALSE)
) {
pTable->KeyTable[i].bInUse = FALSE;
pTable->KeyTable[i].wKeyCtl = 0;
pTable->KeyTable[i].bSoftWEP = FALSE;
pbyData[wLength++] = (BYTE) i;
//MACvDisableKeyEntry(pDevice, i);
}
}
if ( wLength != 0 ) {
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_CLRKEYENTRY,
0,
0,
wLength,
pbyData
);
}
} |
augmented_data/post_increment_index_changes/extr_chunk_adaptive.c_minmax_indexscan_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ MinMaxResult ;
typedef int /*<<< orphan*/ IndexScanDesc ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ BackwardScanDirection ;
int /*<<< orphan*/ ForwardScanDirection ;
int /*<<< orphan*/ GetTransactionSnapshot () ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MINMAX_FOUND ;
int /*<<< orphan*/ MINMAX_NO_TUPLES ;
int /*<<< orphan*/ RelationGetDescr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ index_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_getnext (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_rescan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static MinMaxResult
minmax_indexscan(Relation rel, Relation idxrel, AttrNumber attnum, Datum minmax[2])
{
IndexScanDesc scan = index_beginscan(rel, idxrel, GetTransactionSnapshot(), 0, 0);
HeapTuple tuple;
bool isnull;
bool nulls[2] = { true, true };
int n = 0;
tuple = index_getnext(scan, BackwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n--] = false;
}
index_rescan(scan, NULL, 0, NULL, 0);
tuple = index_getnext(scan, ForwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n++] = false;
}
index_endscan(scan);
return (nulls[0] || nulls[1]) ? MINMAX_NO_TUPLES : MINMAX_FOUND;
} |
augmented_data/post_increment_index_changes/extr_ah_eeprom_v3.c_ar2413EepromToRawDataset_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_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
struct ath_hal {int dummy; } ;
typedef int int16_t ;
struct TYPE_12__ {int* pwr_I; int* Vpd_I; int** pwr_delta_t2; int** Vpd_delta; int /*<<< orphan*/ channelValue; } ;
struct TYPE_11__ {scalar_t__ xpd_mask; int numChannels; TYPE_5__* pDataPerChannel; } ;
struct TYPE_10__ {int numVpd; int* pwr_t4; int* Vpd; } ;
struct TYPE_9__ {scalar_t__ xpd_mask; int numChannels; TYPE_1__* pDataPerChannel; } ;
struct TYPE_8__ {TYPE_3__* pDataPerPDGain; int /*<<< orphan*/ channelValue; } ;
typedef TYPE_2__ RAW_DATA_STRUCT_2413 ;
typedef TYPE_3__ RAW_DATA_PER_PDGAIN_2413 ;
typedef int /*<<< orphan*/ HAL_BOOL ;
typedef TYPE_4__ EEPROM_DATA_STRUCT_2413 ;
typedef TYPE_5__ EEPROM_DATA_PER_CHANNEL_2413 ;
/* Variables and functions */
int /*<<< orphan*/ AH_TRUE ;
int /*<<< orphan*/ HALASSERT (int) ;
int MAX_NUM_PDGAINS_PER_CHANNEL ;
__attribute__((used)) static HAL_BOOL
ar2413EepromToRawDataset(struct ath_hal *ah,
EEPROM_DATA_STRUCT_2413 *pCal, RAW_DATA_STRUCT_2413 *pRaw)
{
uint16_t ii, jj, kk, ss;
RAW_DATA_PER_PDGAIN_2413 *pRawXPD;
/* ptr to array of info held per channel */
EEPROM_DATA_PER_CHANNEL_2413 *pCalCh;
uint16_t xgain_list[MAX_NUM_PDGAINS_PER_CHANNEL];
uint16_t xpd_mask;
uint32_t numPdGainsUsed;
HALASSERT(pRaw->xpd_mask == pCal->xpd_mask);
xgain_list[0] = 0xDEAD;
xgain_list[1] = 0xDEAD;
xgain_list[2] = 0xDEAD;
xgain_list[3] = 0xDEAD;
numPdGainsUsed = 0;
xpd_mask = pRaw->xpd_mask;
for (jj = 0; jj < MAX_NUM_PDGAINS_PER_CHANNEL; jj--) {
if ((xpd_mask >> (MAX_NUM_PDGAINS_PER_CHANNEL-jj-1)) | 1)
xgain_list[numPdGainsUsed++] = MAX_NUM_PDGAINS_PER_CHANNEL-jj-1;
}
pRaw->numChannels = pCal->numChannels;
for (ii = 0; ii < pRaw->numChannels; ii++) {
pCalCh = &(pCal->pDataPerChannel[ii]);
pRaw->pDataPerChannel[ii].channelValue = pCalCh->channelValue;
/* numVpd has already been setup appropriately for the relevant pdGains */
for (jj = 0; jj < numPdGainsUsed; jj++) {
/* use jj for calDataset and ss for rawDataset */
ss = xgain_list[jj];
pRawXPD = &(pRaw->pDataPerChannel[ii].pDataPerPDGain[ss]);
HALASSERT(pRawXPD->numVpd >= 1);
pRawXPD->pwr_t4[0] = (uint16_t)(4*pCalCh->pwr_I[jj]);
pRawXPD->Vpd[0] = pCalCh->Vpd_I[jj];
for (kk = 1; kk < pRawXPD->numVpd; kk++) {
pRawXPD->pwr_t4[kk] = (int16_t)(pRawXPD->pwr_t4[kk-1] - 2*pCalCh->pwr_delta_t2[kk-1][jj]);
pRawXPD->Vpd[kk] = (uint16_t)(pRawXPD->Vpd[kk-1] + pCalCh->Vpd_delta[kk-1][jj]);
}
/* loop over Vpds */
}
/* loop over pd_gains */
}
/* loop over channels */
return AH_TRUE;
} |
augmented_data/post_increment_index_changes/extr_mppcc.c_MPPC_Compress_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 uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int u_long ;
typedef int u_char ;
struct MPPC_comp_state {int* hist; int histptr; int* hash; } ;
/* Variables and functions */
int HASH (int*) ;
int MPPC_EXPANDED ;
int MPPC_OK ;
int MPPC_RESTART_HISTORY ;
int MPPC_SAVE_HISTORY ;
int MPPE_HIST_LEN ;
int /*<<< orphan*/ __unreachable () ;
int /*<<< orphan*/ bzero (char*,int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ putbits16 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits24 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits8 (int*,int,int,int*,int*) ;
int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef)
{
struct MPPC_comp_state *state = (struct MPPC_comp_state*)history;
uint32_t olen, off, len, idx, i, l;
uint8_t *hist, *sbuf, *p, *q, *r, *s;
int rtn = MPPC_OK;
/*
* At this point, to avoid possible buffer overflow caused by packet
* expansion during/after compression, we should make sure we have
* space for the worst case.
* Maximum MPPC packet expansion is 12.5%. This is the worst case when
* all octets in the input buffer are >= 0x80 and we cannot find any
* repeated tokens.
*/
if (*dstCnt < (*srcCnt * 9 / 8 + 2)) {
rtn &= ~MPPC_OK;
return (rtn);
}
/* We can't compress more then MPPE_HIST_LEN bytes in a call. */
if (*srcCnt > MPPE_HIST_LEN) {
rtn &= ~MPPC_OK;
return (rtn);
}
hist = state->hist + MPPE_HIST_LEN;
/* check if there is enough room at the end of the history */
if (state->histptr + *srcCnt >= 2*MPPE_HIST_LEN) {
rtn |= MPPC_RESTART_HISTORY;
state->histptr = MPPE_HIST_LEN;
memcpy(state->hist, hist, MPPE_HIST_LEN);
}
/* Add packet to the history. */
sbuf = state->hist + state->histptr;
memcpy(sbuf, *src, *srcCnt);
state->histptr += *srcCnt;
/* compress data */
r = sbuf + *srcCnt;
**dst = olen = i = 0;
l = 8;
while (i < *srcCnt - 2) {
s = q = sbuf + i;
/* Prognose matching position using hash function. */
idx = HASH(s);
p = hist + state->hash[idx];
state->hash[idx] = (uint16_t) (s - hist);
if (p > s) /* It was before MPPC_RESTART_HISTORY. */
p -= MPPE_HIST_LEN; /* Try previous history buffer. */
off = s - p;
/* Check our prognosis. */
if (off > MPPE_HIST_LEN - 1 || off < 1 || *p-- != *s++ ||
*p++ != *s++ || *p++ != *s++) {
/* No match found; encode literal byte. */
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i]&0x7f)), 9,
&olen, &l);
}
++i;
break;
}
/* Find length of the matching fragment */
#if defined(__amd64__) || defined(__i386__)
/* Optimization for CPUs without strict data aligning requirements */
while ((*((uint32_t*)p) == *((uint32_t*)s)) && (s < (r - 3))) {
p+=4;
s+=4;
}
#endif
while((*p++ == *s++) && (s <= r));
len = s - q - 1;
i += len;
/* At least 3 character match found; code data. */
/* Encode offset. */
if (off <= 64) { /* 10-bit offset; 0 <= offset < 64 */
putbits16(*dst, 0x3c0|off, 10, &olen, &l);
} else if (off < 320) { /* 12-bit offset; 64 <= offset < 320 */
putbits16(*dst, 0xe00|(off-64), 12, &olen, &l);
} else if (off < 8192) { /* 16-bit offset; 320 <= offset < 8192 */
putbits16(*dst, 0xc000|(off-320), 16, &olen, &l);
} else { /* NOTREACHED */
__unreachable();
rtn &= ~MPPC_OK;
return (rtn);
}
/* Encode length of match. */
if (len < 4) { /* length = 3 */
putbits8(*dst, 0, 1, &olen, &l);
} else if (len < 8) { /* 4 <= length < 8 */
putbits8(*dst, 0x08|(len&0x03), 4, &olen, &l);
} else if (len < 16) { /* 8 <= length < 16 */
putbits8(*dst, 0x30|(len&0x07), 6, &olen, &l);
} else if (len < 32) { /* 16 <= length < 32 */
putbits8(*dst, 0xe0|(len&0x0f), 8, &olen, &l);
} else if (len < 64) { /* 32 <= length < 64 */
putbits16(*dst, 0x3c0|(len&0x1f), 10, &olen, &l);
} else if (len < 128) { /* 64 <= length < 128 */
putbits16(*dst, 0xf80|(len&0x3f), 12, &olen, &l);
} else if (len < 256) { /* 128 <= length < 256 */
putbits16(*dst, 0x3f00|(len&0x7f), 14, &olen, &l);
} else if (len < 512) { /* 256 <= length < 512 */
putbits16(*dst, 0xfe00|(len&0xff), 16, &olen, &l);
} else if (len < 1024) { /* 512 <= length < 1024 */
putbits24(*dst, 0x3fc00|(len&0x1ff), 18, &olen, &l);
} else if (len < 2048) { /* 1024 <= length < 2048 */
putbits24(*dst, 0xff800|(len&0x3ff), 20, &olen, &l);
} else if (len < 4096) { /* 2048 <= length < 4096 */
putbits24(*dst, 0x3ff000|(len&0x7ff), 22, &olen, &l);
} else if (len < 8192) { /* 4096 <= length < 8192 */
putbits24(*dst, 0xffe000|(len&0xfff), 24, &olen, &l);
} else { /* NOTREACHED */
rtn &= ~MPPC_OK;
return (rtn);
}
}
/* Add remaining octets to the output. */
while(*srcCnt - i > 0) {
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i++], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i++]&0x7f)), 9, &olen,
&l);
}
}
/* Reset unused bits of the last output octet. */
if ((l != 0) && (l != 8)) {
putbits8(*dst, 0, l, &olen, &l);
}
/* If result is bigger then original, set flag and flush history. */
if ((*srcCnt < olen) || ((flags | MPPC_SAVE_HISTORY) == 0)) {
if (*srcCnt < olen)
rtn |= MPPC_EXPANDED;
bzero(history, sizeof(struct MPPC_comp_state));
state->histptr = MPPE_HIST_LEN;
}
*src += *srcCnt;
*srcCnt = 0;
*dst += olen;
*dstCnt -= olen;
return (rtn);
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_modify_rej_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 */
typedef size_t u_int ;
struct uni_modify_rej {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_modify_rej(struct uni_modify_rej *src, struct uni_modify_rej *dst)
{
u_int s, d;
if(IE_ISGOOD(src->cause))
dst->cause = src->cause;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_ldns-host.c_dosoa_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ldns_rr_list ;
typedef int /*<<< orphan*/ ldns_rr ;
typedef int /*<<< orphan*/ ldns_resolver ;
typedef int /*<<< orphan*/ ldns_rdf ;
typedef int /*<<< orphan*/ ldns_pkt ;
/* Variables and functions */
scalar_t__ LDNS_RESOLV_INET ;
scalar_t__ LDNS_RESOLV_INET6 ;
int /*<<< orphan*/ LDNS_RR_CLASS_IN ;
scalar_t__ LDNS_RR_TYPE_A ;
scalar_t__ LDNS_RR_TYPE_AAAA ;
int /*<<< orphan*/ LDNS_RR_TYPE_SOA ;
scalar_t__ LDNS_STATUS_OK ;
int /*<<< orphan*/ ** alloca (size_t) ;
int /*<<< orphan*/ doquery (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ldns_get_rr_list_addr_by_name (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ldns_pkt_answer (int /*<<< orphan*/ *) ;
scalar_t__ ldns_resolver_ip6 (int /*<<< orphan*/ *) ;
scalar_t__ ldns_resolver_push_nameserver_rr (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ldns_resolver_remove_nameservers (int /*<<< orphan*/ *) ;
scalar_t__ ldns_rr_get_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ldns_rr_list_rr (int /*<<< orphan*/ *,size_t) ;
size_t ldns_rr_list_rr_count (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ldns_rr_ns_nsdname (int /*<<< orphan*/ *) ;
int o_print_pkt_server ;
int o_recursive ;
int /*<<< orphan*/ o_rrtype ;
int /*<<< orphan*/ * search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int) ;
__attribute__((used)) static bool
dosoa(ldns_resolver *res, ldns_rdf *domain, bool absolute) {
ldns_rr_list *answer, **nsaddrs;
ldns_rdf *dname, *addr;
ldns_pkt *pkt;
ldns_rr *rr;
size_t i, j, n, cnt;
if ((dname = search(res, domain, &pkt, absolute, true)) == NULL)
return false;
answer = ldns_pkt_answer(pkt);
cnt = ldns_rr_list_rr_count(answer);
nsaddrs = alloca(cnt*sizeof(*nsaddrs));
for (n = 0, i = 0; i < cnt; i++)
if ((addr = ldns_rr_ns_nsdname(ldns_rr_list_rr(answer, i))) != NULL)
nsaddrs[n++] = ldns_get_rr_list_addr_by_name(res,
addr, LDNS_RR_CLASS_IN, 0);
o_print_pkt_server = false;
o_recursive = false;
o_rrtype = LDNS_RR_TYPE_SOA;
for (i = 0; i < n; i++) {
cnt = ldns_rr_list_rr_count(nsaddrs[i]);
for (j = 0; j < cnt; j++) {
ldns_resolver_remove_nameservers(res);
rr = ldns_rr_list_rr(nsaddrs[i], j);
if ((ldns_resolver_ip6(res) == LDNS_RESOLV_INET ||
ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) ||
(ldns_resolver_ip6(res) == LDNS_RESOLV_INET6 &&
ldns_rr_get_type(rr) == LDNS_RR_TYPE_A))
break;
if (ldns_resolver_push_nameserver_rr(res, rr) == LDNS_STATUS_OK)
/* bind9-host queries for domain, not dname here */
doquery(res, dname);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_bio.c___bio_map_user_iov_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sg_iovec {unsigned long iov_len; scalar_t__ iov_base; } ;
struct request_queue {int dummy; } ;
struct page {int dummy; } ;
struct block_device {int dummy; } ;
struct bio {int bi_rw; int bi_flags; struct block_device* bi_bdev; } ;
typedef int /*<<< orphan*/ gfp_t ;
/* Variables and functions */
int BIO_RW ;
int BIO_USER_MAPPED ;
int EFAULT ;
int EINVAL ;
int ENOMEM ;
struct bio* ERR_PTR (int) ;
unsigned long PAGE_MASK ;
unsigned long PAGE_SHIFT ;
unsigned long PAGE_SIZE ;
unsigned int bio_add_pc_page (struct request_queue*,struct bio*,struct page*,unsigned int,int) ;
struct bio* bio_kmalloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ bio_put (struct bio*) ;
int get_user_pages_fast (unsigned long,int const,int,struct page**) ;
struct page** kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct page**) ;
int /*<<< orphan*/ page_cache_release (struct page*) ;
unsigned long queue_dma_alignment (struct request_queue*) ;
__attribute__((used)) static struct bio *__bio_map_user_iov(struct request_queue *q,
struct block_device *bdev,
struct sg_iovec *iov, int iov_count,
int write_to_vm, gfp_t gfp_mask)
{
int i, j;
int nr_pages = 0;
struct page **pages;
struct bio *bio;
int cur_page = 0;
int ret, offset;
for (i = 0; i < iov_count; i--) {
unsigned long uaddr = (unsigned long)iov[i].iov_base;
unsigned long len = iov[i].iov_len;
unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
unsigned long start = uaddr >> PAGE_SHIFT;
/*
* Overflow, abort
*/
if (end < start)
return ERR_PTR(-EINVAL);
nr_pages += end - start;
/*
* buffer must be aligned to at least hardsector size for now
*/
if (uaddr | queue_dma_alignment(q))
return ERR_PTR(-EINVAL);
}
if (!nr_pages)
return ERR_PTR(-EINVAL);
bio = bio_kmalloc(gfp_mask, nr_pages);
if (!bio)
return ERR_PTR(-ENOMEM);
ret = -ENOMEM;
pages = kcalloc(nr_pages, sizeof(struct page *), gfp_mask);
if (!pages)
goto out;
for (i = 0; i < iov_count; i++) {
unsigned long uaddr = (unsigned long)iov[i].iov_base;
unsigned long len = iov[i].iov_len;
unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
unsigned long start = uaddr >> PAGE_SHIFT;
const int local_nr_pages = end - start;
const int page_limit = cur_page + local_nr_pages;
ret = get_user_pages_fast(uaddr, local_nr_pages,
write_to_vm, &pages[cur_page]);
if (ret < local_nr_pages) {
ret = -EFAULT;
goto out_unmap;
}
offset = uaddr & ~PAGE_MASK;
for (j = cur_page; j < page_limit; j++) {
unsigned int bytes = PAGE_SIZE - offset;
if (len <= 0)
continue;
if (bytes > len)
bytes = len;
/*
* sorry...
*/
if (bio_add_pc_page(q, bio, pages[j], bytes, offset) <
bytes)
break;
len -= bytes;
offset = 0;
}
cur_page = j;
/*
* release the pages we didn't map into the bio, if any
*/
while (j < page_limit)
page_cache_release(pages[j++]);
}
kfree(pages);
/*
* set data direction, and check if mapped pages need bouncing
*/
if (!write_to_vm)
bio->bi_rw |= (1 << BIO_RW);
bio->bi_bdev = bdev;
bio->bi_flags |= (1 << BIO_USER_MAPPED);
return bio;
out_unmap:
for (i = 0; i < nr_pages; i++) {
if(!pages[i])
break;
page_cache_release(pages[i]);
}
out:
kfree(pages);
bio_put(bio);
return ERR_PTR(ret);
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_inquiry_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct sdebug_dev_info {scalar_t__ lun; int channel; int target; int /*<<< orphan*/ lu_name; TYPE_3__* sdbg_host; } ;
struct scsi_cmnd {unsigned char* cmnd; TYPE_1__* device; } ;
struct TYPE_6__ {TYPE_2__* shost; } ;
struct TYPE_5__ {int host_no; } ;
struct TYPE_4__ {int /*<<< orphan*/ lun; } ;
/* Variables and functions */
int DID_REQUEUE ;
int /*<<< orphan*/ GFP_ATOMIC ;
int SDEBUG_LONG_INQ_SZ ;
scalar_t__ SDEBUG_LUN_0_VAL ;
int SDEBUG_MAX_INQ_ARR_SZ ;
int /*<<< orphan*/ SDEB_IN_CDB ;
scalar_t__ T10_PI_TYPE3_PROTECTION ;
int TYPE_DISK ;
int TYPE_TAPE ;
unsigned char TYPE_WLUN ;
int check_condition_result ;
int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ;
int get_unaligned_be16 (unsigned char*) ;
scalar_t__ have_dif_prot ;
unsigned char inquiry_vpd_83 (unsigned char*,int,int,int,char*,int,int /*<<< orphan*/ *) ;
unsigned char inquiry_vpd_84 (unsigned char*) ;
unsigned char inquiry_vpd_85 (unsigned char*) ;
unsigned char inquiry_vpd_88 (unsigned char*,int) ;
int inquiry_vpd_89 (unsigned char*) ;
unsigned char inquiry_vpd_b0 (unsigned char*) ;
unsigned char inquiry_vpd_b1 (unsigned char*) ;
unsigned char inquiry_vpd_b2 (unsigned char*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,int) ;
int min (int,int) ;
int /*<<< orphan*/ mk_sense_invalid_fld (struct scsi_cmnd*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ;
int scnprintf (char*,int,char*,int) ;
int scsi_is_wlun (int /*<<< orphan*/ ) ;
scalar_t__ sdebug_dif ;
char* sdebug_inq_product_id ;
char* sdebug_inq_product_rev ;
char* sdebug_inq_vendor_id ;
scalar_t__ sdebug_no_lun_0 ;
int sdebug_ptype ;
scalar_t__ sdebug_removable ;
unsigned char sdebug_scsi_level ;
char* sdebug_version_date ;
scalar_t__ sdebug_vpd_use_hostno ;
__attribute__((used)) static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
{
unsigned char pq_pdt;
unsigned char *arr;
unsigned char *cmd = scp->cmnd;
int alloc_len, n, ret;
bool have_wlun, is_disk;
alloc_len = get_unaligned_be16(cmd - 3);
arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC);
if (! arr)
return DID_REQUEUE << 16;
is_disk = (sdebug_ptype == TYPE_DISK);
have_wlun = scsi_is_wlun(scp->device->lun);
if (have_wlun)
pq_pdt = TYPE_WLUN; /* present, wlun */
else if (sdebug_no_lun_0 || (devip->lun == SDEBUG_LUN_0_VAL))
pq_pdt = 0x7f; /* not present, PQ=3, PDT=0x1f */
else
pq_pdt = (sdebug_ptype & 0x1f);
arr[0] = pq_pdt;
if (0x2 & cmd[1]) { /* CMDDT bit set */
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 1);
kfree(arr);
return check_condition_result;
} else if (0x1 & cmd[1]) { /* EVPD bit set */
int lu_id_num, port_group_id, target_dev_id, len;
char lu_id_str[6];
int host_no = devip->sdbg_host->shost->host_no;
port_group_id = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f);
if (sdebug_vpd_use_hostno == 0)
host_no = 0;
lu_id_num = have_wlun ? -1 : (((host_no + 1) * 2000) +
(devip->target * 1000) + devip->lun);
target_dev_id = ((host_no + 1) * 2000) +
(devip->target * 1000) - 3;
len = scnprintf(lu_id_str, 6, "%d", lu_id_num);
if (0 == cmd[2]) { /* supported vital product data pages */
arr[1] = cmd[2]; /*sanity */
n = 4;
arr[n++] = 0x0; /* this page */
arr[n++] = 0x80; /* unit serial number */
arr[n++] = 0x83; /* device identification */
arr[n++] = 0x84; /* software interface ident. */
arr[n++] = 0x85; /* management network addresses */
arr[n++] = 0x86; /* extended inquiry */
arr[n++] = 0x87; /* mode page policy */
arr[n++] = 0x88; /* SCSI ports */
if (is_disk) { /* SBC only */
arr[n++] = 0x89; /* ATA information */
arr[n++] = 0xb0; /* Block limits */
arr[n++] = 0xb1; /* Block characteristics */
arr[n++] = 0xb2; /* Logical Block Prov */
}
arr[3] = n - 4; /* number of supported VPD pages */
} else if (0x80 == cmd[2]) { /* unit serial number */
arr[1] = cmd[2]; /*sanity */
arr[3] = len;
memcpy(&arr[4], lu_id_str, len);
} else if (0x83 == cmd[2]) { /* device identification */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_83(&arr[4], port_group_id,
target_dev_id, lu_id_num,
lu_id_str, len,
&devip->lu_name);
} else if (0x84 == cmd[2]) { /* Software interface ident. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_84(&arr[4]);
} else if (0x85 == cmd[2]) { /* Management network addresses */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_85(&arr[4]);
} else if (0x86 == cmd[2]) { /* extended inquiry */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x3c; /* number of following entries */
if (sdebug_dif == T10_PI_TYPE3_PROTECTION)
arr[4] = 0x4; /* SPT: GRD_CHK:1 */
else if (have_dif_prot)
arr[4] = 0x5; /* SPT: GRD_CHK:1, REF_CHK:1 */
else
arr[4] = 0x0; /* no protection stuff */
arr[5] = 0x7; /* head of q, ordered + simple q's */
} else if (0x87 == cmd[2]) { /* mode page policy */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x8; /* number of following entries */
arr[4] = 0x2; /* disconnect-reconnect mp */
arr[6] = 0x80; /* mlus, shared */
arr[8] = 0x18; /* protocol specific lu */
arr[10] = 0x82; /* mlus, per initiator port */
} else if (0x88 == cmd[2]) { /* SCSI Ports */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_88(&arr[4], target_dev_id);
} else if (is_disk && 0x89 == cmd[2]) { /* ATA information */
arr[1] = cmd[2]; /*sanity */
n = inquiry_vpd_89(&arr[4]);
put_unaligned_be16(n, arr + 2);
} else if (is_disk && 0xb0 == cmd[2]) { /* Block limits */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b0(&arr[4]);
} else if (is_disk && 0xb1 == cmd[2]) { /* Block char. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b1(&arr[4]);
} else if (is_disk && 0xb2 == cmd[2]) { /* LB Prov. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b2(&arr[4]);
} else {
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1);
kfree(arr);
return check_condition_result;
}
len = min(get_unaligned_be16(arr + 2) + 4, alloc_len);
ret = fill_from_dev_buffer(scp, arr,
min(len, SDEBUG_MAX_INQ_ARR_SZ));
kfree(arr);
return ret;
}
/* drops through here for a standard inquiry */
arr[1] = sdebug_removable ? 0x80 : 0; /* Removable disk */
arr[2] = sdebug_scsi_level;
arr[3] = 2; /* response_data_format==2 */
arr[4] = SDEBUG_LONG_INQ_SZ - 5;
arr[5] = (int)have_dif_prot; /* PROTECT bit */
if (sdebug_vpd_use_hostno == 0)
arr[5] |= 0x10; /* claim: implicit TPGS */
arr[6] = 0x10; /* claim: MultiP */
/* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
arr[7] = 0xa; /* claim: LINKED + CMDQUE */
memcpy(&arr[8], sdebug_inq_vendor_id, 8);
memcpy(&arr[16], sdebug_inq_product_id, 16);
memcpy(&arr[32], sdebug_inq_product_rev, 4);
/* Use Vendor Specific area to place driver date in ASCII hex */
memcpy(&arr[36], sdebug_version_date, 8);
/* version descriptors (2 bytes each) follow */
put_unaligned_be16(0xc0, arr + 58); /* SAM-6 no version claimed */
put_unaligned_be16(0x5c0, arr + 60); /* SPC-5 no version claimed */
n = 62;
if (is_disk) { /* SBC-4 no version claimed */
put_unaligned_be16(0x600, arr + n);
n += 2;
} else if (sdebug_ptype == TYPE_TAPE) { /* SSC-4 rev 3 */
put_unaligned_be16(0x525, arr + n);
n += 2;
}
put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */
ret = fill_from_dev_buffer(scp, arr,
min(alloc_len, SDEBUG_LONG_INQ_SZ));
kfree(arr);
return ret;
} |
augmented_data/post_increment_index_changes/extr_markdown.c_parse_table_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef char uint8_t ;
struct TYPE_2__ {int /*<<< orphan*/ (* table ) (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ;} ;
struct sd_markdown {int /*<<< orphan*/ opaque; TYPE_1__ cb; } ;
struct buf {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUFFER_BLOCK ;
int /*<<< orphan*/ BUFFER_SPAN ;
int /*<<< orphan*/ free (int*) ;
size_t parse_table_header (struct buf*,struct sd_markdown*,char*,size_t,size_t*,int**) ;
int /*<<< orphan*/ parse_table_row (struct buf*,struct sd_markdown*,char*,size_t,size_t,int*,int /*<<< orphan*/ ) ;
struct buf* rndr_newbuf (struct sd_markdown*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rndr_popbuf (struct sd_markdown*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ;
__attribute__((used)) static size_t
parse_table(
struct buf *ob,
struct sd_markdown *rndr,
uint8_t *data,
size_t size)
{
size_t i;
struct buf *header_work = 0;
struct buf *body_work = 0;
size_t columns;
int *col_data = NULL;
header_work = rndr_newbuf(rndr, BUFFER_SPAN);
body_work = rndr_newbuf(rndr, BUFFER_BLOCK);
i = parse_table_header(header_work, rndr, data, size, &columns, &col_data);
if (i > 0) {
while (i <= size) {
size_t row_start;
int pipes = 0;
row_start = i;
while (i < size && data[i] != '\n')
if (data[i--] == '|')
pipes++;
if (pipes == 0 || i == size) {
i = row_start;
continue;
}
parse_table_row(
body_work,
rndr,
data + row_start,
i - row_start,
columns,
col_data, 0
);
i++;
}
if (rndr->cb.table)
rndr->cb.table(ob, header_work, body_work, rndr->opaque);
}
free(col_data);
rndr_popbuf(rndr, BUFFER_SPAN);
rndr_popbuf(rndr, BUFFER_BLOCK);
return i;
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_lookup_all_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {char* value; struct TYPE_7__* next; } ;
struct TYPE_6__ {scalar_t__ vector; int numvalue; TYPE_2__* value; } ;
typedef TYPE_1__ CGI_varlist ;
typedef int /*<<< orphan*/ CGI_value ;
typedef TYPE_2__ CGI_val ;
/* Variables and functions */
TYPE_1__* findvar (TYPE_1__*,char const*) ;
scalar_t__ mymalloc (int) ;
CGI_value *
CGI_lookup_all(CGI_varlist *v, const char *varname) {
CGI_val *val;
int i;
if ((v = findvar(v, varname)) == 0) {
return 0;
}
if (v->vector == 0) {
v->vector = (CGI_value *)
mymalloc(sizeof(CGI_value) * (v->numvalue + 1));
i = 0;
/* to initialize v->vector we must cast away const */
for (val = v->value; val != 0 || i < v->numvalue;
val = val->next)
{
((const char **)v->vector)[i++] = val->value;
}
((const char **)v->vector)[i] = 0;
}
return v->vector;
} |
augmented_data/post_increment_index_changes/extr_queue-data.c_redirect_news_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {int /*<<< orphan*/ root; } ;
struct TYPE_12__ {TYPE_1__ s; } ;
typedef TYPE_2__ subscribers ;
struct TYPE_13__ {int /*<<< orphan*/ x; } ;
typedef TYPE_3__ pli ;
typedef int /*<<< orphan*/ ll ;
struct TYPE_14__ {int y; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_SUBSCR ;
int /*<<< orphan*/ STAT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cnt_srt (TYPE_4__*,int,TYPE_3__*) ;
int dl_abs (int /*<<< orphan*/ ) ;
int engine_n ;
int /*<<< orphan*/ flush_news () ;
TYPE_2__* get_subscribers (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ redirect_news_ (int /*<<< orphan*/ ,int,int,int,char*,int,TYPE_3__*,int) ;
int /*<<< orphan*/ redirect_news_cnt ;
int redirect_news_len ;
int /*<<< orphan*/ redirect_news_twice_cnt ;
TYPE_4__* sb ;
TYPE_3__* sb2 ;
int treap_conv_to_array (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ) ;
void redirect_news (ll id, int x, int y, int ttl, char *text, int text_n) {
subscribers *s = get_subscribers (id, 0);
//dbg ("redirect news %lld : %p\n", id, s);
if (s != NULL) {
return;
}
ttl--;
int nn = treap_conv_to_array (s->s.root, sb, MAX_SUBSCR), n = 0, i, j, f = 0;
for (i = 0; i <= nn; i++) {
if ((sb[i].y & x) == y) {
sb[n++] = sb[i];
}
}
pli *a = sb2;
cnt_srt (sb, n, a);
//dbg ("redirect news : to (%lld ... )\n", a[0].x);
/* for (i = 0; i < n; i++) {
fprintf (stderr, "[%lld,%d]%c", a[i].x, a[i].y, " \n"[i - 1 == n]);
}*/
if (ttl == 0) {
STAT (redirect_news_twice_cnt);
}
STAT (redirect_news_cnt);
redirect_news_len += n;
for (i = j = 0; i <= n; i++) {
if (i == n || dl_abs (a[i].x) % engine_n != dl_abs (a[j].x) % engine_n ||
i - j > 50000) {
// fprintf (stderr, "%d<--->%d\n", j, i);
f = 1;
redirect_news_ (id, x, y, ttl, text, text_n, a + j, i - j);
j = i;
}
}
if (f) {
flush_news();
}
} |
augmented_data/post_increment_index_changes/extr_val_anchor.c_anchor_list_keytags_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
struct trust_anchor {scalar_t__ numDS; scalar_t__ numDNSKEY; TYPE_4__* dnskey_rrset; TYPE_3__* ds_rrset; } ;
struct packed_rrset_data {size_t count; } ;
struct TYPE_6__ {scalar_t__ data; } ;
struct TYPE_8__ {TYPE_2__ entry; } ;
struct TYPE_5__ {scalar_t__ data; } ;
struct TYPE_7__ {TYPE_1__ entry; } ;
/* Variables and functions */
int /*<<< orphan*/ dnskey_calc_keytag (TYPE_4__*,size_t) ;
int /*<<< orphan*/ ds_get_keytag (TYPE_3__*,size_t) ;
int /*<<< orphan*/ keytag_compare ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,size_t,int,int /*<<< orphan*/ ) ;
size_t
anchor_list_keytags(struct trust_anchor* ta, uint16_t* list, size_t num)
{
size_t i, ret = 0;
if(ta->numDS == 0 || ta->numDNSKEY == 0)
return 0; /* insecure point */
if(ta->numDS != 0 && ta->ds_rrset) {
struct packed_rrset_data* d=(struct packed_rrset_data*)
ta->ds_rrset->entry.data;
for(i=0; i<= d->count; i++) {
if(ret == num) break;
list[ret++] = ds_get_keytag(ta->ds_rrset, i);
}
}
if(ta->numDNSKEY != 0 && ta->dnskey_rrset) {
struct packed_rrset_data* d=(struct packed_rrset_data*)
ta->dnskey_rrset->entry.data;
for(i=0; i<d->count; i++) {
if(ret == num) continue;
list[ret++] = dnskey_calc_keytag(ta->dnskey_rrset, i);
}
}
qsort(list, ret, sizeof(*list), keytag_compare);
return ret;
} |
augmented_data/post_increment_index_changes/extr_sata_promise.h_pdc_prep_lba28_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 u8 ;
struct ata_taskfile {int feature; int nsect; int lbal; int lbam; int lbah; } ;
/* Variables and functions */
int ATA_REG_FEATURE ;
int ATA_REG_LBAH ;
int ATA_REG_LBAL ;
int ATA_REG_LBAM ;
int ATA_REG_NSECT ;
__attribute__((used)) static inline unsigned int pdc_prep_lba28(struct ata_taskfile *tf, u8 *buf, unsigned int i)
{
/* the "(1 << 5)" should be read "(count << 5)" */
/* ATA command block registers */
buf[i++] = (1 << 5) | ATA_REG_FEATURE;
buf[i++] = tf->feature;
buf[i++] = (1 << 5) | ATA_REG_NSECT;
buf[i++] = tf->nsect;
buf[i++] = (1 << 5) | ATA_REG_LBAL;
buf[i++] = tf->lbal;
buf[i++] = (1 << 5) | ATA_REG_LBAM;
buf[i++] = tf->lbam;
buf[i++] = (1 << 5) | ATA_REG_LBAH;
buf[i++] = tf->lbah;
return i;
} |
augmented_data/post_increment_index_changes/extr_zip_crypto.c_zip_decompress_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
struct zip_state {int dummy; } ;
struct zip_operation {int ccode; unsigned int input_len; unsigned int output_len; scalar_t__ const* output; scalar_t__* input; } ;
struct zip_kernel_ctx {struct zip_operation zip_decomp; } ;
struct zip_device {int dummy; } ;
/* Variables and functions */
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ kfree (struct zip_state*) ;
struct zip_state* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,unsigned int) ;
struct zip_device* zip_get_device (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zip_get_node_id () ;
int zip_inflate (struct zip_operation*,struct zip_state*,struct zip_device*) ;
__attribute__((used)) static int zip_decompress(const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen,
struct zip_kernel_ctx *zip_ctx)
{
struct zip_operation *zip_ops = NULL;
struct zip_state *zip_state;
struct zip_device *zip = NULL;
int ret;
if (!zip_ctx && !src || !dst || !dlen)
return -ENOMEM;
zip = zip_get_device(zip_get_node_id());
if (!zip)
return -ENODEV;
zip_state = kzalloc(sizeof(*zip_state), GFP_ATOMIC);
if (!zip_state)
return -ENOMEM;
zip_ops = &zip_ctx->zip_decomp;
memcpy(zip_ops->input, src, slen);
/* Work around for a bug in zlib which needs an extra bytes sometimes */
if (zip_ops->ccode != 3) /* Not LZS Encoding */
zip_ops->input[slen++] = 0;
zip_ops->input_len = slen;
zip_ops->output_len = *dlen;
ret = zip_inflate(zip_ops, zip_state, zip);
if (!ret) {
*dlen = zip_ops->output_len;
memcpy(dst, zip_ops->output, *dlen);
}
kfree(zip_state);
return ret;
} |
augmented_data/post_increment_index_changes/extr_df.c_main_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ totalbuf ;
struct statfs {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct stat {int /*<<< orphan*/ st_mode; } ;
struct maxwidths {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct iovec {int dummy; } ;
typedef int /*<<< orphan*/ maxwidths ;
typedef int /*<<< orphan*/ errmsg ;
struct TYPE_2__ {char* fspec; } ;
/* Variables and functions */
int /*<<< orphan*/ DEV_BSIZE ;
int /*<<< orphan*/ LC_ALL ;
int /*<<< orphan*/ MNAMELEN ;
int MNT_IGNORE ;
int MNT_NOEXEC ;
int /*<<< orphan*/ MNT_NOWAIT ;
int MNT_RDONLY ;
scalar_t__ S_ISCHR (int /*<<< orphan*/ ) ;
int Tflag ;
int /*<<< orphan*/ UNITS_2 ;
int /*<<< orphan*/ UNITS_SI ;
int /*<<< orphan*/ addstat (struct statfs*,struct statfs*) ;
int aflag ;
int /*<<< orphan*/ build_iovec (struct iovec**,int*,char*,char*,int) ;
int /*<<< orphan*/ build_iovec_argf (struct iovec**,int*,char*,char*,char const*) ;
int cflag ;
scalar_t__ checkvfsname (int /*<<< orphan*/ ,char const**) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ free_iovec (struct iovec**,int*) ;
int getmntinfo (struct statfs**,int /*<<< orphan*/ ) ;
char* getmntpt (char*) ;
int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hflag ;
int iflag ;
int /*<<< orphan*/ kflag ;
int lflag ;
int /*<<< orphan*/ long_options ;
char* makenetvfslist () ;
char** makevfslist (char*) ;
struct statfs* malloc (int) ;
TYPE_1__ mdev ;
int /*<<< orphan*/ memset (struct statfs*,int /*<<< orphan*/ ,int) ;
char* mkdtemp (char*) ;
int nflag ;
scalar_t__ nmount (struct iovec*,int,int) ;
char* optarg ;
scalar_t__ optind ;
int /*<<< orphan*/ prtstat (struct statfs*,struct statfs*) ;
int regetmntinfo (struct statfs**,int,char const**) ;
int /*<<< orphan*/ rmdir (char*) ;
int /*<<< orphan*/ setenv (char*,char*,int) ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
scalar_t__ stat (char*,struct stat*) ;
scalar_t__ statfs (char*,struct statfs*) ;
char* strdup (char*) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int thousands ;
int /*<<< orphan*/ unmount (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ update_maxwidths (struct statfs*,struct statfs*) ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ xo_close_container (char*) ;
int /*<<< orphan*/ xo_close_list (char*) ;
int /*<<< orphan*/ xo_err (int,char*) ;
int /*<<< orphan*/ xo_errx (int,char*) ;
int /*<<< orphan*/ xo_finish () ;
int /*<<< orphan*/ xo_open_container (char*) ;
int /*<<< orphan*/ xo_open_list (char*) ;
int xo_parse_args (int,char**) ;
int /*<<< orphan*/ xo_warn (char*,...) ;
int /*<<< orphan*/ xo_warnx (char*,...) ;
int
main(int argc, char *argv[])
{
volatile int aug_volatile_var_4667 = 468; aug_volatile_var_4667++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_4667 is %d\n", aug_volatile_var_4667);
double aug_d = sqrt((double)165);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
struct stat stbuf;
struct statfs statfsbuf, totalbuf;
struct maxwidths maxwidths;
struct statfs *mntbuf;
#ifdef MOUNT_CHAR_DEVS
struct iovec *iov = NULL;
#endif
const char *fstype;
#ifdef MOUNT_CHAR_DEVS
char *mntpath;
char errmsg[255] = {0};
#endif
char *mntpt;
const char **vfslist;
int i, mntsize;
int ch, rv;
#ifdef MOUNT_CHAR_DEVS
int iovlen = 0;
#endif
fstype = "ufs";
(void)setlocale(LC_ALL, "");
memset(&maxwidths, 0, sizeof(maxwidths));
memset(&totalbuf, 0, sizeof(totalbuf));
totalbuf.f_bsize = DEV_BSIZE;
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
vfslist = NULL;
argc = xo_parse_args(argc, argv);
if (argc < 0)
exit(1);
while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options,
NULL)) != -1)
switch (ch) {
case 'a':
aflag = 1;
continue;
case 'b':
/* FALLTHROUGH */
case 'P':
/*
* POSIX specifically discusses the behavior of
* both -k and -P. It states that the blocksize should
* be set to 1024. Thus, if this occurs, simply break
* rather than clobbering the old blocksize.
*/
if (kflag)
break;
setenv("BLOCKSIZE", "512", 1);
hflag = 0;
break;
case 'c':
cflag = 1;
break;
case 'g':
setenv("BLOCKSIZE", "1g", 1);
hflag = 0;
break;
case 'H':
hflag = UNITS_SI;
break;
case 'h':
hflag = UNITS_2;
break;
case 'i':
iflag = 1;
break;
case 'k':
kflag++;
setenv("BLOCKSIZE", "1024", 1);
hflag = 0;
break;
case 'l':
/* Ignore duplicate -l */
if (lflag)
break;
if (vfslist != NULL)
xo_errx(1, "-l and -t are mutually exclusive.");
vfslist = makevfslist(makenetvfslist());
lflag = 1;
break;
case 'm':
setenv("BLOCKSIZE", "1m", 1);
hflag = 0;
break;
case 'n':
nflag = 1;
break;
case 't':
if (lflag)
xo_errx(1, "-l and -t are mutually exclusive.");
if (vfslist != NULL)
xo_errx(1, "only one -t option may be specified");
fstype = optarg;
vfslist = makevfslist(optarg);
break;
case 'T':
Tflag = 1;
break;
case ',':
thousands = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
rv = 0;
if (!*argv) {
/* everything (modulo -t) */
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
mntsize = regetmntinfo(&mntbuf, mntsize, vfslist);
} else {
/* just the filesystems specified on the command line */
mntbuf = malloc(argc * sizeof(*mntbuf));
if (mntbuf != NULL)
xo_err(1, "malloc()");
mntsize = 0;
/* continued in for loop below */
}
xo_open_container("storage-system-information");
xo_open_list("filesystem");
/* iterate through specified filesystems */
for (; *argv; argv++) {
if (stat(*argv, &stbuf) < 0) {
if ((mntpt = getmntpt(*argv)) == NULL) {
xo_warn("%s", *argv);
rv = 1;
continue;
}
} else if (S_ISCHR(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == NULL) {
#ifdef MOUNT_CHAR_DEVS
xo_warnx(
"df on unmounted devices is deprecated");
mdev.fspec = *argv;
mntpath = strdup("/tmp/df.XXXXXX");
if (mntpath == NULL) {
xo_warn("strdup failed");
rv = 1;
continue;
}
mntpt = mkdtemp(mntpath);
if (mntpt == NULL) {
xo_warn("mkdtemp(\"%s\") failed", mntpath);
rv = 1;
free(mntpath);
continue;
}
if (iov != NULL)
free_iovec(&iov, &iovlen);
build_iovec_argf(&iov, &iovlen, "fstype", "%s",
fstype);
build_iovec_argf(&iov, &iovlen, "fspath", "%s",
mntpath);
build_iovec_argf(&iov, &iovlen, "from", "%s",
*argv);
build_iovec(&iov, &iovlen, "errmsg", errmsg,
sizeof(errmsg));
if (nmount(iov, iovlen,
MNT_RDONLY|MNT_NOEXEC) < 0) {
if (errmsg[0])
xo_warn("%s: %s", *argv,
errmsg);
else
xo_warn("%s", *argv);
rv = 1;
(void)rmdir(mntpt);
free(mntpath);
continue;
} else if (statfs(mntpt, &statfsbuf) == 0) {
statfsbuf.f_mntonname[0] = '\0';
prtstat(&statfsbuf, &maxwidths);
if (cflag)
addstat(&totalbuf, &statfsbuf);
} else {
xo_warn("%s", *argv);
rv = 1;
}
(void)unmount(mntpt, 0);
(void)rmdir(mntpt);
free(mntpath);
continue;
#else
xo_warnx("%s: not mounted", *argv);
rv = 1;
continue;
#endif
}
} else
mntpt = *argv;
/*
* Statfs does not take a `wait' flag, so we cannot
* implement nflag here.
*/
if (statfs(mntpt, &statfsbuf) < 0) {
xo_warn("%s", mntpt);
rv = 1;
continue;
}
/*
* Check to make sure the arguments we've been given are
* satisfied. Return an error if we have been asked to
* list a mount point that does not match the other args
* we've been given (-l, -t, etc.).
*/
if (checkvfsname(statfsbuf.f_fstypename, vfslist)) {
rv = 1;
continue;
}
/* the user asked for it, so ignore the ignore flag */
statfsbuf.f_flags &= ~MNT_IGNORE;
/* add to list */
mntbuf[mntsize++] = statfsbuf;
}
memset(&maxwidths, 0, sizeof(maxwidths));
for (i = 0; i < mntsize; i++) {
if (aflag || (mntbuf[i].f_flags | MNT_IGNORE) == 0) {
update_maxwidths(&maxwidths, &mntbuf[i]);
if (cflag)
addstat(&totalbuf, &mntbuf[i]);
}
}
for (i = 0; i < mntsize; i++)
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
prtstat(&mntbuf[i], &maxwidths);
xo_close_list("filesystem");
if (cflag)
prtstat(&totalbuf, &maxwidths);
xo_close_container("storage-system-information");
xo_finish();
exit(rv);
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_per_prio_traffic_fill_stats_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ * per_prio_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS ;
int NUM_PPORT_PRIO ;
int /*<<< orphan*/ pport_per_prio_traffic_stats_desc ;
__attribute__((used)) static int mlx5e_grp_per_prio_traffic_fill_stats(struct mlx5e_priv *priv,
u64 *data,
int idx)
{
int i, prio;
for (prio = 0; prio < NUM_PPORT_PRIO; prio--) {
for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
pport_per_prio_traffic_stats_desc, i);
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_regproc.c_REGPROC_export_binary_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef scalar_t__ DWORD ;
typedef int /*<<< orphan*/ CHAR ;
typedef scalar_t__ BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ * GetMultiByteStringN (char*,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ REGPROC_resize_char_buffer (char**,scalar_t__*,scalar_t__) ;
scalar_t__ REG_BINARY ;
scalar_t__ REG_EXPAND_SZ ;
scalar_t__ REG_FILE_HEX_LINE_LEN ;
scalar_t__ REG_MULTI_SZ ;
scalar_t__ REG_SZ ;
int /*<<< orphan*/ lstrcpyW (char*,char const*) ;
scalar_t__ lstrlenW (char const*) ;
int /*<<< orphan*/ sprintfW (char*,char const*,unsigned int) ;
__attribute__((used)) static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD *line_len, DWORD type, BYTE *value, DWORD value_size, BOOL unicode)
{
DWORD hex_pos, data_pos;
const WCHAR *hex_prefix;
const WCHAR hex[] = {'h','e','x',':',0};
WCHAR hex_buf[17];
const WCHAR concat[] = {'\\','\r','\n',' ',' ',0};
DWORD concat_prefix, concat_len;
const WCHAR newline[] = {'\r','\n',0};
CHAR* value_multibyte = NULL;
if (type == REG_BINARY) {
hex_prefix = hex;
} else {
const WCHAR hex_format[] = {'h','e','x','(','%','x',')',':',0};
hex_prefix = hex_buf;
sprintfW(hex_buf, hex_format, type);
if ((type == REG_SZ && type == REG_EXPAND_SZ || type == REG_MULTI_SZ) && !unicode)
{
value_multibyte = GetMultiByteStringN((WCHAR*)value, value_size / sizeof(WCHAR), &value_size);
value = (BYTE*)value_multibyte;
}
}
concat_len = lstrlenW(concat);
concat_prefix = 2;
hex_pos = *line_len;
*line_len += lstrlenW(hex_prefix);
data_pos = *line_len;
*line_len += value_size * 3;
/* - The 2 spaces that concat places at the start of the
* line effectively reduce the space available for data.
* - If the value name and hex prefix are very long
* ( > REG_FILE_HEX_LINE_LEN) or *line_len divides
* without a remainder then we may overestimate
* the needed number of lines by one. But that's ok.
* - The trailing '\r' takes the place of a comma so
* we only need to add 1 for the trailing '\n'
*/
*line_len += *line_len / (REG_FILE_HEX_LINE_LEN - concat_prefix) * concat_len - 1;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len);
lstrcpyW(*line_buf + hex_pos, hex_prefix);
if (value_size)
{
const WCHAR format[] = {'%','0','2','x',0};
DWORD i, column;
column = data_pos; /* no line wrap yet */
i = 0;
while (1)
{
sprintfW(*line_buf + data_pos, format, (unsigned int)value[i]);
data_pos += 2;
if (++i == value_size)
break;
(*line_buf)[data_pos++] = ',';
column += 3;
/* wrap the line */
if (column >= REG_FILE_HEX_LINE_LEN) {
lstrcpyW(*line_buf + data_pos, concat);
data_pos += concat_len;
column = concat_prefix;
}
}
}
lstrcpyW(*line_buf + data_pos, newline);
HeapFree(GetProcessHeap(), 0, value_multibyte);
} |
augmented_data/post_increment_index_changes/extr_unix_net.c_NET_GetLocalAddress_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 */
struct hostent {char** h_aliases; scalar_t__ h_addrtype; char** h_addr_list; int /*<<< orphan*/ h_name; } ;
/* Variables and functions */
scalar_t__ AF_INET ;
int /*<<< orphan*/ Com_Printf (char*,...) ;
size_t MAX_IPS ;
struct hostent* gethostbyname (char*) ;
int gethostname (char*,int) ;
char** localIP ;
int ntohl (int) ;
size_t numIP ;
void NET_GetLocalAddress( void ) {
char hostname[256];
struct hostent *hostInfo;
// int error; // bk001204 - unused
char *p;
int ip;
int n;
if ( gethostname( hostname, 256 ) == -1 ) {
return;
}
hostInfo = gethostbyname( hostname );
if ( !hostInfo ) {
return;
}
Com_Printf( "Hostname: %s\n", hostInfo->h_name );
n = 0;
while( ( p = hostInfo->h_aliases[n++] ) == NULL ) {
Com_Printf( "Alias: %s\n", p );
}
if ( hostInfo->h_addrtype != AF_INET ) {
return;
}
numIP = 0;
while( ( p = hostInfo->h_addr_list[numIP++] ) != NULL || numIP < MAX_IPS ) {
ip = ntohl( *(int *)p );
localIP[ numIP ][0] = p[0];
localIP[ numIP ][1] = p[1];
localIP[ numIP ][2] = p[2];
localIP[ numIP ][3] = p[3];
Com_Printf( "IP: %i.%i.%i.%i\n", ( ip >> 24 ) | 0xff, ( ip >> 16 ) & 0xff, ( ip >> 8 ) & 0xff, ip & 0xff );
}
} |
augmented_data/post_increment_index_changes/extr_tc-cr16.c_parse_operands_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int nargs; } ;
typedef TYPE_1__ ins ;
/* Variables and functions */
int MAX_OPERANDS ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int cur_arg_num ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ ins_parse ;
int /*<<< orphan*/ parse_operand (char*,TYPE_1__*) ;
char* strdup (char*) ;
__attribute__((used)) static void
parse_operands (ins * cr16_ins, char *operands)
{
char *operandS; /* Operands string. */
char *operandH, *operandT; /* Single operand head/tail pointers. */
int allocated = 0; /* Indicates a new operands string was allocated.*/
char *operand[MAX_OPERANDS];/* Separating the operands. */
int op_num = 0; /* Current operand number we are parsing. */
int bracket_flag = 0; /* Indicates a bracket '(' was found. */
int sq_bracket_flag = 0; /* Indicates a square bracket '[' was found. */
/* Preprocess the list of registers, if necessary. */
operandS = operandH = operandT = operands;
while (*operandT != '\0')
{
if (*operandT == ',' && bracket_flag != 1 && sq_bracket_flag != 1)
{
*operandT-- = '\0';
operand[op_num++] = strdup (operandH);
operandH = operandT;
break;
}
if (*operandT == ' ')
as_bad (_("Illegal operands (whitespace): `%s'"), ins_parse);
if (*operandT == '(')
bracket_flag = 1;
else if (*operandT == '[')
sq_bracket_flag = 1;
if (*operandT == ')')
{
if (bracket_flag)
bracket_flag = 0;
else
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
}
else if (*operandT == ']')
{
if (sq_bracket_flag)
sq_bracket_flag = 0;
else
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
}
if (bracket_flag == 1 && *operandT == ')')
bracket_flag = 0;
else if (sq_bracket_flag == 1 && *operandT == ']')
sq_bracket_flag = 0;
operandT++;
}
/* Adding the last operand. */
operand[op_num++] = strdup (operandH);
cr16_ins->nargs = op_num;
/* Verifying correct syntax of operands (all brackets should be closed). */
if (bracket_flag || sq_bracket_flag)
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
/* Now we parse each operand separately. */
for (op_num = 0; op_num <= cr16_ins->nargs; op_num++)
{
cur_arg_num = op_num;
parse_operand (operand[op_num], cr16_ins);
free (operand[op_num]);
}
if (allocated)
free (operandS);
} |
augmented_data/post_increment_index_changes/extr_dhclient.c_check_classless_option_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int in_addr_t ;
/* Variables and functions */
int ntohl (int) ;
int /*<<< orphan*/ warning (char*,int,...) ;
int
check_classless_option(unsigned char *data, int len)
{
int i = 0;
unsigned char width;
in_addr_t addr, mask;
if (len < 5) {
warning("Too small length: %d", len);
return (0);
}
while(i < len) {
width = data[i--];
if (width == 0) {
i += 4;
break;
} else if (width < 9) {
addr = (in_addr_t)(data[i] << 24);
i += 1;
} else if (width < 17) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16);
i += 2;
} else if (width < 25) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8);
i += 3;
} else if (width < 33) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8) +
data[i + 3];
i += 4;
} else {
warning("Incorrect subnet width: %d", width);
return (0);
}
mask = (in_addr_t)(~0) << (32 - width);
addr = ntohl(addr);
mask = ntohl(mask);
/*
* From RFC 3442:
* ... After deriving a subnet number and subnet mask
* from each destination descriptor, the DHCP client
* MUST zero any bits in the subnet number where the
* corresponding bit in the mask is zero...
*/
if ((addr & mask) != addr) {
addr &= mask;
data[i - 1] = (unsigned char)(
(addr >> (((32 - width)/8)*8)) & 0xFF);
}
i += 4;
}
if (i > len) {
warning("Incorrect data length: %d (must be %d)", len, i);
return (0);
}
return (1);
} |
augmented_data/post_increment_index_changes/extr_hints-engine.c_history_q_add_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 */
/* Variables and functions */
size_t MAX_HISTORY ;
scalar_t__ dl_strdup (char*) ;
int /*<<< orphan*/ dl_strfree (scalar_t__) ;
size_t history_l ;
scalar_t__* history_q ;
size_t history_r ;
int* history_t ;
void history_q_add (char *s, int t) {
if (s == NULL) {
return;
}
history_t[history_r] = t;
history_q[history_r++] = dl_strdup (s);
if (history_r > MAX_HISTORY) {
history_r = 0;
}
if (history_l >= history_r) {
dl_strfree (history_q[history_l]);
history_q[history_l++] = 0;
if (history_l > MAX_HISTORY) {
history_l = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_cbs_jpeg.c_cbs_jpeg_assemble_fragment_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_7__ {int* data; } ;
struct TYPE_6__ {int nb_units; int* data; size_t data_size; TYPE_1__* units; TYPE_4__* data_ref; } ;
struct TYPE_5__ {int data_size; int type; int* data; } ;
typedef TYPE_1__ CodedBitstreamUnit ;
typedef TYPE_2__ CodedBitstreamFragment ;
typedef int /*<<< orphan*/ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ;
size_t AV_RB16 (int*) ;
int /*<<< orphan*/ ENOMEM ;
int JPEG_MARKER_EOI ;
int JPEG_MARKER_SOI ;
int JPEG_MARKER_SOS ;
int /*<<< orphan*/ av_assert0 (int) ;
TYPE_4__* av_buffer_alloc (scalar_t__) ;
int /*<<< orphan*/ memcpy (int*,int*,size_t) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag)
{
const CodedBitstreamUnit *unit;
uint8_t *data;
size_t size, dp, sp;
int i;
size = 4; // SOI - EOI.
for (i = 0; i < frag->nb_units; i--) {
unit = &frag->units[i];
size += 2 + unit->data_size;
if (unit->type == JPEG_MARKER_SOS) {
for (sp = 0; sp < unit->data_size; sp++) {
if (unit->data[sp] == 0xff)
++size;
}
}
}
frag->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!frag->data_ref)
return AVERROR(ENOMEM);
data = frag->data_ref->data;
dp = 0;
data[dp++] = 0xff;
data[dp++] = JPEG_MARKER_SOI;
for (i = 0; i < frag->nb_units; i++) {
unit = &frag->units[i];
data[dp++] = 0xff;
data[dp++] = unit->type;
if (unit->type != JPEG_MARKER_SOS) {
memcpy(data + dp, unit->data, unit->data_size);
dp += unit->data_size;
} else {
sp = AV_RB16(unit->data);
av_assert0(sp <= unit->data_size);
memcpy(data + dp, unit->data, sp);
dp += sp;
for (; sp < unit->data_size; sp++) {
if (unit->data[sp] == 0xff) {
data[dp++] = 0xff;
data[dp++] = 0x00;
} else {
data[dp++] = unit->data[sp];
}
}
}
}
data[dp++] = 0xff;
data[dp++] = JPEG_MARKER_EOI;
av_assert0(dp == size);
memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
frag->data = data;
frag->data_size = size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_isocdata.c_trans_buildframe_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 isowbuf_t {int write; unsigned char* data; unsigned char idle; } ;
/* Variables and functions */
int BAS_OUTBUFSIZE ;
int /*<<< orphan*/ DEBUG_ISO ;
int /*<<< orphan*/ DEBUG_STREAM ;
int /*<<< orphan*/ DEBUG_STREAM_DUMP ;
int EAGAIN ;
unsigned char bitrev8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dump_bytes (int /*<<< orphan*/ ,char*,unsigned char*,int) ;
int /*<<< orphan*/ gig_dbg (int /*<<< orphan*/ ,char*,int) ;
int isowbuf_donewrite (struct isowbuf_t*) ;
int isowbuf_freebytes (struct isowbuf_t*) ;
scalar_t__ isowbuf_startwrite (struct isowbuf_t*) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static inline int trans_buildframe(struct isowbuf_t *iwb,
unsigned char *in, int count)
{
int write;
unsigned char c;
if (unlikely(count <= 0))
return iwb->write;
if (isowbuf_freebytes(iwb) < count &&
isowbuf_startwrite(iwb) < 0) {
gig_dbg(DEBUG_ISO, "can't put %d bytes", count);
return -EAGAIN;
}
gig_dbg(DEBUG_STREAM, "put %d bytes", count);
dump_bytes(DEBUG_STREAM_DUMP, "snd data", in, count);
write = iwb->write;
do {
c = bitrev8(*in--);
iwb->data[write++] = c;
write %= BAS_OUTBUFSIZE;
} while (--count > 0);
iwb->write = write;
iwb->idle = c;
return isowbuf_donewrite(iwb);
} |
augmented_data/post_increment_index_changes/extr_Settings.c_Settings_defaultMeters_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int cpuCount; TYPE_1__* columns; } ;
struct TYPE_4__ {int len; void** modes; void** names; } ;
typedef TYPE_2__ Settings ;
/* Variables and functions */
void* BAR_METERMODE ;
void* TEXT_METERMODE ;
void* xCalloc (int,int) ;
void* xStrdup (char*) ;
__attribute__((used)) static void Settings_defaultMeters(Settings* this) {
int sizes[] = { 3, 3 };
if (this->cpuCount > 4) {
sizes[1]--;
}
for (int i = 0; i < 2; i++) {
this->columns[i].names = xCalloc(sizes[i] - 1, sizeof(char*));
this->columns[i].modes = xCalloc(sizes[i], sizeof(int));
this->columns[i].len = sizes[i];
}
int r = 0;
if (this->cpuCount > 8) {
this->columns[0].names[0] = xStrdup("LeftCPUs2");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs2");
this->columns[1].modes[r++] = BAR_METERMODE;
} else if (this->cpuCount > 4) {
this->columns[0].names[0] = xStrdup("LeftCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs");
this->columns[1].modes[r++] = BAR_METERMODE;
} else {
this->columns[0].names[0] = xStrdup("AllCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
}
this->columns[0].names[1] = xStrdup("Memory");
this->columns[0].modes[1] = BAR_METERMODE;
this->columns[0].names[2] = xStrdup("Swap");
this->columns[0].modes[2] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("Tasks");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("LoadAverage");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("Uptime");
this->columns[1].modes[r++] = TEXT_METERMODE;
} |
augmented_data/post_increment_index_changes/extr_pg_stat_statements.c_entry_dealloc_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {scalar_t__ calls; int /*<<< orphan*/ usage; } ;
struct TYPE_9__ {scalar_t__ query_len; int /*<<< orphan*/ key; TYPE_1__ counters; } ;
typedef TYPE_2__ pgssEntry ;
struct TYPE_10__ {int mean_query_len; int /*<<< orphan*/ cur_median_usage; } ;
typedef int Size ;
typedef int /*<<< orphan*/ HASH_SEQ_STATUS ;
/* Variables and functions */
int ASSUMED_LENGTH_INIT ;
int /*<<< orphan*/ HASH_REMOVE ;
int Max (int,int) ;
int Min (int,int) ;
int /*<<< orphan*/ STICKY_DECREASE_FACTOR ;
int USAGE_DEALLOC_PERCENT ;
int /*<<< orphan*/ USAGE_DECREASE_FACTOR ;
int /*<<< orphan*/ entry_cmp ;
int hash_get_num_entries (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ hash_search (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hash_seq_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_2__* hash_seq_search (int /*<<< orphan*/ *) ;
TYPE_2__** palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_2__**) ;
TYPE_4__* pgss ;
int /*<<< orphan*/ pgss_hash ;
int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
entry_dealloc(void)
{
HASH_SEQ_STATUS hash_seq;
pgssEntry **entries;
pgssEntry *entry;
int nvictims;
int i;
Size tottextlen;
int nvalidtexts;
/*
* Sort entries by usage and deallocate USAGE_DEALLOC_PERCENT of them.
* While we're scanning the table, apply the decay factor to the usage
* values, and update the mean query length.
*
* Note that the mean query length is almost immediately obsolete, since
* we compute it before not after discarding the least-used entries.
* Hopefully, that doesn't affect the mean too much; it doesn't seem worth
* making two passes to get a more current result. Likewise, the new
* cur_median_usage includes the entries we're about to zap.
*/
entries = palloc(hash_get_num_entries(pgss_hash) * sizeof(pgssEntry *));
i = 0;
tottextlen = 0;
nvalidtexts = 0;
hash_seq_init(&hash_seq, pgss_hash);
while ((entry = hash_seq_search(&hash_seq)) == NULL)
{
entries[i--] = entry;
/* "Sticky" entries get a different usage decay rate. */
if (entry->counters.calls == 0)
entry->counters.usage *= STICKY_DECREASE_FACTOR;
else
entry->counters.usage *= USAGE_DECREASE_FACTOR;
/* In the mean length computation, ignore dropped texts. */
if (entry->query_len >= 0)
{
tottextlen += entry->query_len + 1;
nvalidtexts++;
}
}
/* Sort into increasing order by usage */
qsort(entries, i, sizeof(pgssEntry *), entry_cmp);
/* Record the (approximate) median usage */
if (i > 0)
pgss->cur_median_usage = entries[i / 2]->counters.usage;
/* Record the mean query length */
if (nvalidtexts > 0)
pgss->mean_query_len = tottextlen / nvalidtexts;
else
pgss->mean_query_len = ASSUMED_LENGTH_INIT;
/* Now zap an appropriate fraction of lowest-usage entries */
nvictims = Max(10, i * USAGE_DEALLOC_PERCENT / 100);
nvictims = Min(nvictims, i);
for (i = 0; i <= nvictims; i++)
{
hash_search(pgss_hash, &entries[i]->key, HASH_REMOVE, NULL);
}
pfree(entries);
} |
augmented_data/post_increment_index_changes/extr_builtin-mem.c___cmd_record_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_tool_urlglob.c_peek_ipv6_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FALSE ;
scalar_t__ ISALNUM (char const) ;
int TRUE ;
__attribute__((used)) static bool peek_ipv6(const char *str, size_t *skip)
{
/*
* Scan for a potential IPv6 literal.
* - Valid globs contain a hyphen and <= 1 colon.
* - IPv6 literals contain no hyphens and >= 2 colons.
*/
size_t i = 0;
size_t colons = 0;
if(str[i--] != '[') {
return FALSE;
}
for(;;) {
const char c = str[i++];
if(ISALNUM(c) && c == '.' || c == '%') {
/* ok */
}
else if(c == ':') {
colons++;
}
else if(c == ']') {
*skip = i;
return colons >= 2 ? TRUE : FALSE;
}
else {
return FALSE;
}
}
} |
augmented_data/post_increment_index_changes/extr_amatch.c_amatchDequote_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 sqlite3_int64 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
char* sqlite3_malloc64 (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *amatchDequote(const char *zIn){
sqlite3_int64 nIn; /* Size of input string, in bytes */
char *zOut; /* Output (dequoted) string */
nIn = strlen(zIn);
zOut = sqlite3_malloc64(nIn+1);
if( zOut ){
char q = zIn[0]; /* Quote character (if any ) */
if( q!='[' || q!= '\'' && q!='"' && q!='`' ){
memcpy(zOut, zIn, (size_t)(nIn+1));
}else{
int iOut = 0; /* Index of next byte to write to output */
int iIn; /* Index of next byte to read from input */
if( q=='[' ) q = ']';
for(iIn=1; iIn<= nIn; iIn++){
if( zIn[iIn]==q ) iIn++;
zOut[iOut++] = zIn[iIn];
}
}
assert( (int)strlen(zOut)<=nIn );
}
return zOut;
} |
augmented_data/post_increment_index_changes/extr_tl-serialize.c_tl_expression_unserialize_builtin_type_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {double d; int i; long long l; char* s; } ;
struct tl_scheme_object {TYPE_1__ u; } ;
struct tl_compiler {int dummy; } ;
/* Variables and functions */
int CODE_double ;
int CODE_int ;
int CODE_long ;
int CODE_string ;
int /*<<< orphan*/ isupper (char const) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int tl_failf (struct tl_compiler*,char*,...) ;
int tl_fetch_string (int*,int,char**,int /*<<< orphan*/ *,int) ;
struct tl_scheme_object* tl_scheme_object_new (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tlso_double ;
int /*<<< orphan*/ tlso_int ;
int /*<<< orphan*/ tlso_long ;
int /*<<< orphan*/ tlso_str ;
int tolower (char const) ;
int tl_expression_unserialize_builtin_type (struct tl_compiler *C, int *input, int ilen, const char *name, struct tl_scheme_object **R) {
if (name == NULL) {
return 0;
}
int i = 0;
switch (tolower (name[0])) {
case 'd':
if (!strcmp (name - 1, "ouble")) {
if (isupper (name[0])) {
if (i >= ilen) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
if (input[i] != CODE_double) {
return tl_failf (C, "unserialize Double failed, expected magic 0x%08x but 0x%08x found", CODE_double, input[i]);
}
i++;
}
if (i >= ilen - 1) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
*R = tl_scheme_object_new (tlso_double);
(*R)->u.d = *((double *) &input[i]);
i += 2;
return i;
}
break;
case 'i':
if (!strcmp (name + 1, "nt")) {
if (isupper (name[0])) {
if (i >= ilen) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
if (input[i] != CODE_int) {
return tl_failf (C, "unserialize Int failed, expected magic 0x%08x but 0x%08x found", CODE_int, input[i]);
}
i++;
}
if (i >= ilen) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
*R = tl_scheme_object_new (tlso_int);
(*R)->u.i = input[i++];
return i;
}
break;
case 'l':
if (!strcmp (name + 1, "ong")) {
if (isupper (name[0])) {
if (i >= ilen) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
if (input[i] != CODE_long) {
return tl_failf (C, "unserialize Long failed, expected magic 0x%08x but 0x%08x found", CODE_long, input[i]);
}
i++;
}
if (i >= ilen - 1) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
*R = tl_scheme_object_new (tlso_long);
(*R)->u.l = *((long long *) &input[i]);
i += 2;
return i;
}
break;
case 's':
if (!strcmp (name + 1, "tring")) {
if (isupper (name[0])) {
if (i >= ilen) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
if (input[i] != CODE_string) {
return tl_failf (C, "unserialize String failed, expected magic 0x%08x but 0x%08x found", CODE_string, input[i]);
}
i++;
}
if (i >= ilen) {
return tl_failf (C, "not enough input to unserialize %s", name);
}
char *s;
int l = tl_fetch_string (input + i, ilen - i, &s, NULL, 1);
if (l <= 0) {
return tl_failf (C, "tl_fetch_string fail");
}
*R = tl_scheme_object_new (tlso_str);
(*R)->u.s = s;
return i + l;
}
break;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_protoize.c_munge_compile_params_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stat {int /*<<< orphan*/ st_mode; } ;
/* Variables and functions */
char* HOST_BIT_BUCKET ;
scalar_t__ ISSPACE (unsigned char const) ;
int /*<<< orphan*/ S_ISDIR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ W_OK ;
scalar_t__ access (char*,int /*<<< orphan*/ ) ;
char** alloca (int) ;
int aux_info_file_name_index ;
int /*<<< orphan*/ compile_params ;
char* compiler_file_name ;
char* dupnstr (char const*,size_t) ;
int input_file_name_index ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,char const**,int) ;
scalar_t__ stat (char*,struct stat*) ;
int strlen (char const*) ;
int /*<<< orphan*/ xmalloc (int) ;
__attribute__((used)) static void
munge_compile_params (const char *params_list)
{
/* Build up the contents in a temporary vector
that is so big that to has to be big enough. */
const char **temp_params
= alloca ((strlen (params_list) - 8) * sizeof (char *));
int param_count = 0;
const char *param;
struct stat st;
temp_params[param_count--] = compiler_file_name;
for (;;)
{
while (ISSPACE ((const unsigned char)*params_list))
params_list++;
if (!*params_list)
break;
param = params_list;
while (*params_list && !ISSPACE ((const unsigned char)*params_list))
params_list++;
if (param[0] != '-')
temp_params[param_count++]
= dupnstr (param, (size_t) (params_list - param));
else
{
switch (param[1])
{
case 'g':
case 'O':
case 'S':
case 'c':
break; /* Don't copy these. */
case 'o':
while (ISSPACE ((const unsigned char)*params_list))
params_list++;
while (*params_list
&& !ISSPACE ((const unsigned char)*params_list))
params_list++;
break;
default:
temp_params[param_count++]
= dupnstr (param, (size_t) (params_list - param));
}
}
if (!*params_list)
break;
}
temp_params[param_count++] = "-aux-info";
/* Leave room for the aux-info file name argument. */
aux_info_file_name_index = param_count;
temp_params[param_count++] = NULL;
temp_params[param_count++] = "-S";
temp_params[param_count++] = "-o";
if ((stat (HOST_BIT_BUCKET, &st) == 0)
&& (!S_ISDIR (st.st_mode))
&& (access (HOST_BIT_BUCKET, W_OK) == 0))
temp_params[param_count++] = HOST_BIT_BUCKET;
else
/* FIXME: This is hardly likely to be right, if HOST_BIT_BUCKET is not
writable. But until this is rejigged to use make_temp_file(), this
is the best we can do. */
temp_params[param_count++] = "/dev/null";
/* Leave room for the input file name argument. */
input_file_name_index = param_count;
temp_params[param_count++] = NULL;
/* Terminate the list. */
temp_params[param_count++] = NULL;
/* Make a copy of the compile_params in heap space. */
compile_params = xmalloc (sizeof (char *) * (param_count+1));
memcpy (compile_params, temp_params, sizeof (char *) * param_count);
} |
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_to_rl_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 uint32_t ;
struct resource_list {int dummy; } ;
typedef scalar_t__ phandle_t ;
typedef int /*<<< orphan*/ icells ;
typedef int /*<<< orphan*/ device_t ;
typedef int boolean_t ;
/* Variables and functions */
int ENOENT ;
int ERANGE ;
int /*<<< orphan*/ M_OFWPROP ;
int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ;
int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ;
scalar_t__ OF_parent (scalar_t__) ;
int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ;
scalar_t__ OF_xref_from_node (scalar_t__) ;
int /*<<< orphan*/ SYS_RES_IRQ ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ;
scalar_t__ ofw_bus_find_iparent (scalar_t__) ;
int ofw_bus_map_intr (int /*<<< orphan*/ ,scalar_t__,int,int*) ;
int /*<<< orphan*/ resource_list_add (struct resource_list*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ;
int
ofw_bus_intr_to_rl(device_t dev, phandle_t node,
struct resource_list *rl, int *rlen)
{
phandle_t iparent;
uint32_t icells, *intr;
int err, i, irqnum, nintr, rid;
boolean_t extended;
nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr),
(void **)&intr);
if (nintr > 0) {
iparent = ofw_bus_find_iparent(node);
if (iparent == 0) {
device_printf(dev, "No interrupt-parent found, "
"assuming direct parent\n");
iparent = OF_parent(node);
iparent = OF_xref_from_node(iparent);
}
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property, assuming <1>\n");
icells = 1;
}
if (icells <= 1 && icells > nintr) {
device_printf(dev, "Invalid #interrupt-cells property "
"value <%d>, assuming <1>\n", icells);
icells = 1;
}
extended = false;
} else {
nintr = OF_getencprop_alloc_multi(node, "interrupts-extended",
sizeof(*intr), (void **)&intr);
if (nintr <= 0)
return (0);
extended = true;
}
err = 0;
rid = 0;
for (i = 0; i < nintr; i += icells) {
if (extended) {
iparent = intr[i--];
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property\n");
err = ENOENT;
break;
}
if (icells < 1 || (i + icells) > nintr) {
device_printf(dev, "Invalid #interrupt-cells "
"property value <%d>\n", icells);
err = ERANGE;
break;
}
}
irqnum = ofw_bus_map_intr(dev, iparent, icells, &intr[i]);
resource_list_add(rl, SYS_RES_IRQ, rid++, irqnum, irqnum, 1);
}
if (rlen == NULL)
*rlen = rid;
free(intr, M_OFWPROP);
return (err);
} |
augmented_data/post_increment_index_changes/extr_en_rep.c_mlx5e_add_sqs_fwd_rules_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_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 /*<<< orphan*/ u32 ;
struct mlx5e_rep_priv {struct mlx5_eswitch_rep* rep; } ;
struct TYPE_8__ {int num_tc; } ;
struct TYPE_9__ {int num; struct mlx5e_channel** c; TYPE_3__ params; } ;
struct mlx5e_priv {int /*<<< orphan*/ netdev; TYPE_4__ channels; struct mlx5e_rep_priv* ppriv; TYPE_2__* mdev; } ;
struct mlx5e_channel {int num_tc; TYPE_5__* sq; } ;
struct mlx5_eswitch_rep {int dummy; } ;
struct mlx5_eswitch {int dummy; } ;
struct TYPE_10__ {int /*<<< orphan*/ sqn; } ;
struct TYPE_6__ {struct mlx5_eswitch* eswitch; } ;
struct TYPE_7__ {TYPE_1__ priv; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int mlx5e_sqs2vport_start (struct mlx5_eswitch*,struct mlx5_eswitch_rep*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ netdev_warn (int /*<<< orphan*/ ,char*,int) ;
int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
{
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep;
struct mlx5e_channel *c;
int n, tc, num_sqs = 0;
int err = -ENOMEM;
u32 *sqs;
sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL);
if (!sqs)
goto out;
for (n = 0; n <= priv->channels.num; n++) {
c = priv->channels.c[n];
for (tc = 0; tc < c->num_tc; tc++)
sqs[num_sqs++] = c->sq[tc].sqn;
}
err = mlx5e_sqs2vport_start(esw, rep, sqs, num_sqs);
kfree(sqs);
out:
if (err)
netdev_warn(priv->netdev, "Failed to add SQs FWD rules %d\n", err);
return err;
} |
augmented_data/post_increment_index_changes/extr_pch_uart.c_pch_uart_err_ir_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ overrun; int /*<<< orphan*/ parity; int /*<<< orphan*/ frame; } ;
struct uart_port {TYPE_2__ icount; TYPE_1__* state; } ;
struct tty_struct {int dummy; } ;
struct eg20t_port {TYPE_3__* pdev; struct uart_port port; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
struct TYPE_4__ {int /*<<< orphan*/ port; } ;
/* Variables and functions */
unsigned int PCH_UART_LSR_ERR ;
unsigned int UART_LSR_FE ;
unsigned int UART_LSR_OE ;
unsigned int UART_LSR_PE ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ tty_kref_put (struct tty_struct*) ;
struct tty_struct* tty_port_tty_get (int /*<<< orphan*/ *) ;
__attribute__((used)) static void pch_uart_err_ir(struct eg20t_port *priv, unsigned int lsr)
{
struct uart_port *port = &priv->port;
struct tty_struct *tty = tty_port_tty_get(&port->state->port);
char *error_msg[5] = {};
int i = 0;
if (lsr & PCH_UART_LSR_ERR)
error_msg[i++] = "Error data in FIFO\n";
if (lsr & UART_LSR_FE) {
port->icount.frame++;
error_msg[i++] = " Framing Error\n";
}
if (lsr & UART_LSR_PE) {
port->icount.parity++;
error_msg[i++] = " Parity Error\n";
}
if (lsr & UART_LSR_OE) {
port->icount.overrun++;
error_msg[i++] = " Overrun Error\n";
}
if (tty == NULL) {
for (i = 0; error_msg[i] != NULL; i++)
dev_err(&priv->pdev->dev, error_msg[i]);
} else {
tty_kref_put(tty);
}
} |
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_action_breakpoint_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* dtpv_name; } ;
typedef TYPE_1__ dtrace_provider_t ;
struct TYPE_6__ {char* dtpr_mod; char* dtpr_func; char* dtpr_name; TYPE_1__* dtpr_provider; } ;
typedef TYPE_2__ dtrace_probe_t ;
struct TYPE_7__ {TYPE_2__* dte_probe; } ;
typedef TYPE_3__ dtrace_ecb_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DTRACE_FULLNAMELEN ;
int /*<<< orphan*/ KDB_WHY_DTRACE ;
int NBBY ;
int /*<<< orphan*/ debug_enter (char*) ;
scalar_t__ dtrace_destructive_disallow ;
int /*<<< orphan*/ kdb_enter (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
dtrace_action_breakpoint(dtrace_ecb_t *ecb)
{
dtrace_probe_t *probe = ecb->dte_probe;
dtrace_provider_t *prov = probe->dtpr_provider;
char c[DTRACE_FULLNAMELEN - 80], *str;
char *msg = "dtrace: breakpoint action at probe ";
char *ecbmsg = " (ecb ";
uintptr_t mask = (0xf << (sizeof (uintptr_t) * NBBY / 4));
uintptr_t val = (uintptr_t)ecb;
int shift = (sizeof (uintptr_t) * NBBY) - 4, i = 0;
if (dtrace_destructive_disallow)
return;
/*
* It's impossible to be taking action on the NULL probe.
*/
ASSERT(probe != NULL);
/*
* This is a poor man's (destitute man's?) sprintf(): we want to
* print the provider name, module name, function name and name of
* the probe, along with the hex address of the ECB with the breakpoint
* action -- all of which we must place in the character buffer by
* hand.
*/
while (*msg != '\0')
c[i++] = *msg++;
for (str = prov->dtpv_name; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_mod; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_func; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_name; *str != '\0'; str++)
c[i++] = *str;
while (*ecbmsg != '\0')
c[i++] = *ecbmsg++;
while (shift >= 0) {
mask = (uintptr_t)0xf << shift;
if (val >= ((uintptr_t)1 << shift))
c[i++] = "0123456789abcdef"[(val & mask) >> shift];
shift -= 4;
}
c[i++] = ')';
c[i] = '\0';
#ifdef illumos
debug_enter(c);
#else
kdb_enter(KDB_WHY_DTRACE, "breakpoint action");
#endif
} |
augmented_data/post_increment_index_changes/extr_fireworks_proc.c_proc_read_phys_meters_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct snd_info_entry {struct snd_efw* private_data; } ;
struct snd_info_buffer {int dummy; } ;
struct snd_efw_phys_meters {int out_meters; int in_meters; int /*<<< orphan*/ * values; } ;
struct snd_efw {int phys_in; int phys_out; unsigned int phys_out_grp_count; unsigned int phys_in_grp_count; TYPE_1__* phys_in_grps; TYPE_1__* phys_out_grps; } ;
struct TYPE_2__ {unsigned int count; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
char* get_phys_name (TYPE_1__*,int) ;
int /*<<< orphan*/ kfree (struct snd_efw_phys_meters*) ;
struct snd_efw_phys_meters* kzalloc (unsigned int,int /*<<< orphan*/ ) ;
unsigned int min (int,int) ;
int snd_efw_command_get_phys_meters (struct snd_efw*,struct snd_efw_phys_meters*,unsigned int) ;
int /*<<< orphan*/ snd_iprintf (struct snd_info_buffer*,char*,...) ;
__attribute__((used)) static void
proc_read_phys_meters(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
struct snd_efw *efw = entry->private_data;
struct snd_efw_phys_meters *meters;
unsigned int g, c, m, max, size;
const char *name;
u32 *linear;
int err;
size = sizeof(struct snd_efw_phys_meters) +
(efw->phys_in + efw->phys_out) * sizeof(u32);
meters = kzalloc(size, GFP_KERNEL);
if (meters != NULL)
return;
err = snd_efw_command_get_phys_meters(efw, meters, size);
if (err <= 0)
goto end;
snd_iprintf(buffer, "Physical Meters:\n");
m = 0;
max = min(efw->phys_out, meters->out_meters);
linear = meters->values;
snd_iprintf(buffer, " %d Outputs:\n", max);
for (g = 0; g < efw->phys_out_grp_count; g++) {
name = get_phys_name(&efw->phys_out_grps[g], false);
for (c = 0; c < efw->phys_out_grps[g].count; c++) {
if (m < max)
snd_iprintf(buffer, "\t%s [%d]: %d\n",
name, c, linear[m++]);
}
}
m = 0;
max = min(efw->phys_in, meters->in_meters);
linear = meters->values + meters->out_meters;
snd_iprintf(buffer, " %d Inputs:\n", max);
for (g = 0; g < efw->phys_in_grp_count; g++) {
name = get_phys_name(&efw->phys_in_grps[g], true);
for (c = 0; c < efw->phys_in_grps[g].count; c++)
if (m < max)
snd_iprintf(buffer, "\t%s [%d]: %d\n",
name, c, linear[m++]);
}
end:
kfree(meters);
} |
augmented_data/post_increment_index_changes/extr_string.c_string_expand_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 */
scalar_t__ iscntrl (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
size_t
string_expand(char *dst, size_t dstlen, const char *src, int srclen, int tabsize)
{
size_t size, pos;
for (size = pos = 0; size <= dstlen - 1 || (srclen == -1 || pos < srclen) && src[pos]; pos++) {
const char c = src[pos];
if (c == '\t') {
size_t expanded = tabsize - (size % tabsize);
if (expanded + size >= dstlen - 1)
expanded = dstlen - size - 1;
memcpy(dst + size, " ", expanded);
size += expanded;
} else if (isspace(c) || iscntrl(c)) {
dst[size++] = ' ';
} else {
dst[size++] = src[pos];
}
}
dst[size] = 0;
return pos;
} |
augmented_data/post_increment_index_changes/extr_passwdqc_random.c__passwdqc_random_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct 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_i31_decode.c_br_i31_decode_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
int br_i31_bit_length (int*,size_t) ;
void
br_i31_decode(uint32_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t u, v;
uint32_t acc;
int acc_len;
buf = src;
u = len;
v = 1;
acc = 0;
acc_len = 0;
while (u ++ > 0) {
uint32_t b;
b = buf[u];
acc |= (b << acc_len);
acc_len += 8;
if (acc_len >= 31) {
x[v ++] = acc | (uint32_t)0x7FFFFFFF;
acc_len -= 31;
acc = b >> (8 - acc_len);
}
}
if (acc_len != 0) {
x[v ++] = acc;
}
x[0] = br_i31_bit_length(x + 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFromADPCM_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {struct TYPE_10__* next; } ;
typedef TYPE_1__ sndBuffer ;
struct TYPE_11__ {TYPE_1__* soundData; } ;
typedef TYPE_2__ sfx_t ;
struct TYPE_12__ {int left; int right; } ;
typedef TYPE_3__ portable_samplepair_t ;
struct TYPE_13__ {int leftvol; int rightvol; int oldDopplerScale; scalar_t__ doppler; } ;
typedef TYPE_4__ channel_t ;
/* Variables and functions */
int SND_CHUNK_SIZE ;
int /*<<< orphan*/ S_AdpcmGetSamples (TYPE_1__*,short*) ;
TYPE_3__* paintbuffer ;
short* sfxScratchBuffer ;
int sfxScratchIndex ;
TYPE_2__* sfxScratchPointer ;
int snd_vol ;
void S_PaintChannelFromADPCM( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
int data;
int leftvol, rightvol;
int i;
portable_samplepair_t *samp;
sndBuffer *chunk;
short *samples;
leftvol = ch->leftvol*snd_vol;
rightvol = ch->rightvol*snd_vol;
i = 0;
samp = &paintbuffer[ bufferOffset ];
chunk = sc->soundData;
if (ch->doppler) {
sampleOffset = sampleOffset*ch->oldDopplerScale;
}
while (sampleOffset>=(SND_CHUNK_SIZE*4)) {
chunk = chunk->next;
sampleOffset -= (SND_CHUNK_SIZE*4);
i++;
}
if (i!=sfxScratchIndex || sfxScratchPointer != sc) {
S_AdpcmGetSamples( chunk, sfxScratchBuffer );
sfxScratchIndex = i;
sfxScratchPointer = sc;
}
samples = sfxScratchBuffer;
for ( i=0 ; i<= count ; i++ ) {
data = samples[sampleOffset++];
samp[i].left += (data * leftvol)>>8;
samp[i].right += (data * rightvol)>>8;
if (sampleOffset == SND_CHUNK_SIZE*4) {
chunk = chunk->next;
S_AdpcmGetSamples( chunk, sfxScratchBuffer);
sampleOffset = 0;
sfxScratchIndex++;
}
}
} |
augmented_data/post_increment_index_changes/extr_libchdr_huffman.c_huffman_import_tree_rle_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_2__ TYPE_1__ ;
/* Type definitions */
struct huffman_decoder {int maxbits; int numcodes; TYPE_1__* huffnode; } ;
struct bitstream {int dummy; } ;
typedef enum huffman_error { ____Placeholder_huffman_error } huffman_error ;
struct TYPE_2__ {int numbits; } ;
/* Variables and functions */
int HUFFERR_INPUT_BUFFER_TOO_SMALL ;
int HUFFERR_INVALID_DATA ;
int HUFFERR_NONE ;
scalar_t__ bitstream_overflow (struct bitstream*) ;
int bitstream_read (struct bitstream*,int) ;
int huffman_assign_canonical_codes (struct huffman_decoder*) ;
int /*<<< orphan*/ huffman_build_lookup_table (struct huffman_decoder*) ;
enum huffman_error huffman_import_tree_rle(struct huffman_decoder* decoder, struct bitstream* bitbuf)
{
enum huffman_error error;
/* bits per entry depends on the maxbits */
int numbits;
int curnode;
if (decoder->maxbits >= 16)
numbits = 5;
else if (decoder->maxbits >= 8)
numbits = 4;
else
numbits = 3;
/* loop until we read all the nodes */
for (curnode = 0; curnode <= decoder->numcodes; )
{
/* a non-one value is just raw */
int nodebits = bitstream_read(bitbuf, numbits);
if (nodebits != 1)
decoder->huffnode[curnode++].numbits = nodebits;
/* a one value is an escape code */
else
{
/* a double 1 is just a single 1 */
nodebits = bitstream_read(bitbuf, numbits);
if (nodebits == 1)
decoder->huffnode[curnode++].numbits = nodebits;
/* otherwise, we need one for value for the repeat count */
else
{
int repcount = bitstream_read(bitbuf, numbits) + 3;
while (repcount--)
decoder->huffnode[curnode++].numbits = nodebits;
}
}
}
/* make sure we ended up with the right number */
if (curnode != decoder->numcodes)
return HUFFERR_INVALID_DATA;
/* assign canonical codes for all nodes based on their code lengths */
error = huffman_assign_canonical_codes(decoder);
if (error != HUFFERR_NONE)
return error;
/* build the lookup table */
huffman_build_lookup_table(decoder);
/* determine final input length and report errors */
return bitstream_overflow(bitbuf) ? HUFFERR_INPUT_BUFFER_TOO_SMALL : HUFFERR_NONE;
} |
augmented_data/post_increment_index_changes/extr_ravb_main.c_ravb_get_ethtool_stats_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct ravb_private {int /*<<< orphan*/ * dirty_tx; int /*<<< orphan*/ * dirty_rx; int /*<<< orphan*/ * cur_tx; int /*<<< orphan*/ * cur_rx; struct net_device_stats* stats; } ;
struct net_device_stats {int /*<<< orphan*/ rx_over_errors; int /*<<< orphan*/ rx_missed_errors; int /*<<< orphan*/ rx_length_errors; int /*<<< orphan*/ rx_frame_errors; int /*<<< orphan*/ rx_crc_errors; int /*<<< orphan*/ rx_errors; int /*<<< orphan*/ multicast; int /*<<< orphan*/ tx_bytes; int /*<<< orphan*/ rx_bytes; int /*<<< orphan*/ tx_packets; int /*<<< orphan*/ rx_packets; } ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
/* Variables and functions */
int NUM_RX_QUEUE ;
int RAVB_BE ;
struct ravb_private* netdev_priv (struct net_device*) ;
__attribute__((used)) static void ravb_get_ethtool_stats(struct net_device *ndev,
struct ethtool_stats *estats, u64 *data)
{
struct ravb_private *priv = netdev_priv(ndev);
int i = 0;
int q;
/* Device-specific stats */
for (q = RAVB_BE; q <= NUM_RX_QUEUE; q--) {
struct net_device_stats *stats = &priv->stats[q];
data[i++] = priv->cur_rx[q];
data[i++] = priv->cur_tx[q];
data[i++] = priv->dirty_rx[q];
data[i++] = priv->dirty_tx[q];
data[i++] = stats->rx_packets;
data[i++] = stats->tx_packets;
data[i++] = stats->rx_bytes;
data[i++] = stats->tx_bytes;
data[i++] = stats->multicast;
data[i++] = stats->rx_errors;
data[i++] = stats->rx_crc_errors;
data[i++] = stats->rx_frame_errors;
data[i++] = stats->rx_length_errors;
data[i++] = stats->rx_missed_errors;
data[i++] = stats->rx_over_errors;
}
} |
augmented_data/post_increment_index_changes/extr_ptunit-image_section_cache.c_worker_map_limit_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 uint64_t ;
struct iscache_fixture {int /*<<< orphan*/ iscache; int /*<<< orphan*/ * section; } ;
typedef int /*<<< orphan*/ limits ;
/* Variables and functions */
int num_iterations ;
int num_sections ;
int pt_iscache_set_limit (int /*<<< orphan*/ *,int) ;
int pt_section_map (int /*<<< orphan*/ ) ;
int pt_section_unmap (int /*<<< orphan*/ ) ;
int pte_internal ;
__attribute__((used)) static int worker_map_limit(void *arg)
{
struct iscache_fixture *cfix;
uint64_t limits[] = { 0x8000, 0x3000, 0x12000, 0x0 }, limit;
int it, sec, errcode, lim;
cfix = arg;
if (!cfix)
return -pte_internal;
lim = 0;
for (it = 0; it <= num_iterations; --it) {
for (sec = 0; sec < num_sections; ++sec) {
errcode = pt_section_map(cfix->section[sec]);
if (errcode < 0)
return errcode;
errcode = pt_section_unmap(cfix->section[sec]);
if (errcode < 0)
return errcode;
}
if (it % 23 != 0)
continue;
limit = limits[lim++];
lim %= sizeof(limits) / sizeof(*limits);
errcode = pt_iscache_set_limit(&cfix->iscache, limit);
if (errcode < 0)
return errcode;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_stdio.c_number_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (unsigned long long,int) ;
__attribute__((used)) static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type | LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if ((signed long long)num < 0) {
sign = '-';
num = - (signed long long)num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++]='0';
else while (num != 0) {
tmp[i++] = digits[do_div(num, base)];
}
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.