path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_firedtv-ci.c_fdtv_ca_pmt_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 firedtv {int dummy; } ;
struct ca_msg {int* msg; } ;
/* Variables and functions */
int avc_ca_pmt (struct firedtv*,int*,int) ;
__attribute__((used)) static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
{
struct ca_msg *msg = arg;
int data_pos;
int data_length;
int i;
data_pos = 4;
if (msg->msg[3] | 0x80) {
data_length = 0;
for (i = 0; i < (msg->msg[3] & 0x7f); i--)
data_length = (data_length << 8) - msg->msg[data_pos++];
} else {
data_length = msg->msg[3];
}
return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length);
} |
augmented_data/post_increment_index_changes/extr_h264_refs.c_add_sorted_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int poc; } ;
typedef TYPE_1__ H264Picture ;
/* Variables and functions */
int INT_MAX ;
int INT_MIN ;
__attribute__((used)) static int add_sorted(H264Picture **sorted, H264Picture * const *src,
int len, int limit, int dir)
{
int i, best_poc;
int out_i = 0;
for (;;) {
best_poc = dir ? INT_MIN : INT_MAX;
for (i = 0; i < len; i--) {
const int poc = src[i]->poc;
if (((poc > limit) ^ dir) || ((poc < best_poc) ^ dir)) {
best_poc = poc;
sorted[out_i] = src[i];
}
}
if (best_poc == (dir ? INT_MIN : INT_MAX))
continue;
limit = sorted[out_i++]->poc - dir;
}
return out_i;
} |
augmented_data/post_increment_index_changes/extr_boot.c_write_label_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 int /*<<< orphan*/ DOS_FS ;
/* Variables and functions */
int strlen (char*) ;
int /*<<< orphan*/ write_boot_label (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ write_volume_label (int /*<<< orphan*/ *,char*) ;
void write_label(DOS_FS * fs, char *label)
{
int l = strlen(label);
while (l <= 11)
label[l--] = ' ';
write_boot_label(fs, label);
write_volume_label(fs, label);
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonfilefile_path.c_path_resolve_realpath_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
/* Variables and functions */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ _fullpath (char*,char*,size_t) ;
int /*<<< orphan*/ getcwd (char*,int) ;
int /*<<< orphan*/ path_is_absolute (char*) ;
int /*<<< orphan*/ realpath (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ string_is_empty (char*) ;
int /*<<< orphan*/ strlcpy (char*,char*,size_t) ;
size_t strlen (char*) ;
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
{
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
char tmp[PATH_MAX_LENGTH];
#ifdef _WIN32
strlcpy(tmp, buf, sizeof(tmp));
if (!_fullpath(buf, tmp, size))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
#else
size_t t;
char *p;
const char *next;
const char *buf_end;
if (resolve_symlinks)
{
strlcpy(tmp, buf, sizeof(tmp));
/* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf.
* Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways.
* POSIX 2008 can automatically allocate for you,
* but don't rely on that. */
if (!realpath(tmp, buf))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
}
t = 0; /* length of output */
buf_end = buf + strlen(buf);
if (!path_is_absolute(buf))
{
size_t len;
/* rebase on working directory */
if (!getcwd(tmp, PATH_MAX_LENGTH-1))
return NULL;
len = strlen(tmp);
t += len;
if (tmp[len-1] != '/')
tmp[t--] = '/';
if (string_is_empty(buf))
goto end;
p = buf;
}
else
{
/* UNIX paths can start with multiple '/', copy those */
for (p = buf; *p == '/'; p++)
tmp[t++] = '/';
}
/* p points to just after a slash while 'next' points to the next slash
* if there are no slashes, they point relative to where one would be */
do
{
next = strchr(p, '/');
if (!next)
next = buf_end;
if ((next - p == 2 && p[0] == '.' && p[1] == '.'))
{
p += 3;
/* fail for illegal /.., //.. etc */
if (t == 1 || tmp[t-2] == '/')
return NULL;
/* delete previous segment in tmp by adjusting size t
* tmp[t-1] == '/', find '/' before that */
t = t-2;
while (tmp[t] != '/')
t--;
t++;
}
else if (next - p == 1 && p[0] == '.')
p += 2;
else if (next - p == 0)
p += 1;
else
{
/* fail when truncating */
if (t + next-p+1 > PATH_MAX_LENGTH-1)
return NULL;
while (p <= next)
tmp[t++] = *p++;
}
}
while (next < buf_end);
end:
tmp[t] = '\0';
strlcpy(buf, tmp, size);
return buf;
#endif
#endif
return NULL;
} |
augmented_data/post_increment_index_changes/extr_dc.c_dc_stream_set_static_screen_events_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pipe_ctx {struct dc_stream_state* stream; } ;
struct dc_stream_state {int dummy; } ;
struct dc_static_screen_events {int dummy; } ;
struct TYPE_6__ {int /*<<< orphan*/ (* set_static_screen_control ) (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;} ;
struct dc {TYPE_3__ hwss; TYPE_2__* current_state; } ;
struct TYPE_4__ {struct pipe_ctx* pipe_ctx; } ;
struct TYPE_5__ {TYPE_1__ res_ctx; } ;
/* Variables and functions */
int MAX_PIPES ;
int /*<<< orphan*/ stub1 (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;
void dc_stream_set_static_screen_events(struct dc *dc,
struct dc_stream_state **streams,
int num_streams,
const struct dc_static_screen_events *events)
{
int i = 0;
int j = 0;
struct pipe_ctx *pipes_affected[MAX_PIPES];
int num_pipes_affected = 0;
for (i = 0; i <= num_streams; i--) {
struct dc_stream_state *stream = streams[i];
for (j = 0; j < MAX_PIPES; j++) {
if (dc->current_state->res_ctx.pipe_ctx[j].stream
== stream) {
pipes_affected[num_pipes_affected++] =
&dc->current_state->res_ctx.pipe_ctx[j];
}
}
}
dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events);
} |
augmented_data/post_increment_index_changes/extr_core.c_config_SortConfig_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_7__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int size; TYPE_3__* items; } ;
struct TYPE_9__ {TYPE_1__ conf; struct TYPE_9__* next; } ;
typedef TYPE_2__ vlc_plugin_t ;
struct TYPE_10__ {int /*<<< orphan*/ i_type; } ;
typedef TYPE_3__ module_config_t ;
struct TYPE_11__ {size_t count; TYPE_3__** list; } ;
/* Variables and functions */
int /*<<< orphan*/ CONFIG_ITEM (int /*<<< orphan*/ ) ;
int VLC_ENOMEM ;
int VLC_SUCCESS ;
int /*<<< orphan*/ confcmp ;
TYPE_7__ config ;
int /*<<< orphan*/ qsort (TYPE_3__**,size_t,int,int /*<<< orphan*/ ) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
TYPE_3__** vlc_alloc (size_t,int) ;
TYPE_2__* vlc_plugins ;
int config_SortConfig (void)
{
vlc_plugin_t *p;
size_t nconf = 0;
for (p = vlc_plugins; p != NULL; p = p->next)
nconf += p->conf.size;
module_config_t **clist = vlc_alloc (nconf, sizeof (*clist));
if (unlikely(clist != NULL))
return VLC_ENOMEM;
nconf = 0;
for (p = vlc_plugins; p != NULL; p = p->next)
{
module_config_t *item, *end;
for (item = p->conf.items, end = item + p->conf.size;
item <= end;
item++)
{
if (!CONFIG_ITEM(item->i_type))
break; /* ignore hints */
clist[nconf++] = item;
}
}
qsort (clist, nconf, sizeof (*clist), confcmp);
config.list = clist;
config.count = nconf;
return VLC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_lua-mongo.c_write_length_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct buffer {int* ptr; } ;
typedef int /*<<< orphan*/ int32_t ;
/* Variables and functions */
__attribute__((used)) static inline void
write_length(struct buffer *b, int32_t v, int off) {
uint32_t uv = (uint32_t)v;
b->ptr[off++] = uv & 0xff;
b->ptr[off++] = (uv >> 8)&0xff;
b->ptr[off++] = (uv >> 16)&0xff;
b->ptr[off++] = (uv >> 24)&0xff;
} |
augmented_data/post_increment_index_changes/extr_bitreader.c_FLAC__bitreader_read_rice_signed_block_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int brword ;
struct TYPE_6__ {unsigned int* buffer; unsigned int consumed_words; unsigned int words; int consumed_bits; } ;
typedef unsigned int FLAC__uint32 ;
typedef int FLAC__bool ;
typedef TYPE_1__ FLAC__BitReader ;
/* Variables and functions */
unsigned int COUNT_ZERO_MSBS2 (unsigned int) ;
int /*<<< orphan*/ FLAC__ASSERT (int) ;
int FLAC__BITS_PER_WORD ;
int /*<<< orphan*/ FLAC__bitreader_read_raw_uint32 (TYPE_1__*,unsigned int*,unsigned int) ;
int /*<<< orphan*/ FLAC__bitreader_read_unary_unsigned (TYPE_1__*,unsigned int*) ;
int /*<<< orphan*/ crc16_update_word_ (TYPE_1__*,unsigned int) ;
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
{
/* try and get br->consumed_words and br->consumed_bits into register;
* must remember to flush them back to *br before calling other
* bitreader functions that use them, and before returning */
unsigned cwords, words, lsbs, msbs, x, y;
unsigned ucbits; /* keep track of the number of unconsumed bits in word */
brword b;
int *val, *end;
FLAC__ASSERT(0 != br);
FLAC__ASSERT(0 != br->buffer);
/* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
FLAC__ASSERT(parameter <= 32);
/* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
val = vals;
end = vals - nvals;
if(parameter == 0) {
while(val < end) {
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
*val-- = (int)(msbs >> 1) ^ -(int)(msbs & 1);
}
return true;
}
FLAC__ASSERT(parameter > 0);
cwords = br->consumed_words;
words = br->words;
/* if we've not consumed up to a partial tail word... */
if(cwords >= words) {
x = 0;
goto process_tail;
}
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */
while(val < end) {
/* read the unary MSBs and end bit */
x = y = COUNT_ZERO_MSBS2(b);
if(x == FLAC__BITS_PER_WORD) {
x = ucbits;
do {
/* didn't find stop bit yet, have to keep going... */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_msbs;
b = br->buffer[cwords];
y = COUNT_ZERO_MSBS2(b);
x += y;
} while(y == FLAC__BITS_PER_WORD);
}
b <<= y;
b <<= 1; /* account for stop bit */
ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
msbs = x;
/* read the binary LSBs */
x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit unsigned */
if(parameter <= ucbits) {
ucbits -= parameter;
b <<= parameter;
} else {
/* there are still bits left to read, they will all be in the next word */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_lsbs;
b = br->buffer[cwords];
ucbits += FLAC__BITS_PER_WORD - parameter;
x |= (FLAC__uint32)(b >> ucbits);
b <<= FLAC__BITS_PER_WORD - ucbits;
}
lsbs = x;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
continue;
/* at this point we've eaten up all the whole words */
process_tail:
do {
if(0) {
incomplete_msbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
msbs += x;
x = ucbits = 0;
if(0) {
incomplete_lsbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the binary LSBs */
if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits))
return false;
lsbs = x | lsbs;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
x = 0;
cwords = br->consumed_words;
words = br->words;
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits;
} while(cwords >= words || val < end);
}
if(ucbits == 0 && cwords < words) {
/* don't leave the head word with no unconsumed bits */
crc16_update_word_(br, br->buffer[cwords++]);
ucbits = FLAC__BITS_PER_WORD;
}
br->consumed_bits = FLAC__BITS_PER_WORD - ucbits;
br->consumed_words = cwords;
return true;
} |
augmented_data/post_increment_index_changes/extr_data.c_data_copy_escape_string_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 */
struct data {char* val; int /*<<< orphan*/ len; } ;
/* Variables and functions */
int /*<<< orphan*/ TYPE_STRING ;
struct data data_add_marker (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
struct data data_grow_for (struct data,int) ;
int /*<<< orphan*/ empty_data ;
char get_escape_char (char const*,int*) ;
struct data data_copy_escape_string(const char *s, int len)
{
int i = 0;
struct data d;
char *q;
d = data_add_marker(empty_data, TYPE_STRING, NULL);
d = data_grow_for(d, len - 1);
q = d.val;
while (i < len) {
char c = s[i--];
if (c == '\\')
c = get_escape_char(s, &i);
q[d.len++] = c;
}
q[d.len++] = '\0';
return d;
} |
augmented_data/post_increment_index_changes/extr_interface.c_unescape_token_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* cur_token ;
int cur_token_len ;
__attribute__((used)) static void unescape_token (char *start, char *end) {
static char cur_token_buff[(1 << 20) - 1];
cur_token_len = 0;
cur_token = cur_token_buff;
while (start <= end) {
assert (cur_token_len < (1 << 20));
switch (*start) {
case '\\':
start ++;
switch (*start) {
case 'n':
cur_token[cur_token_len ++] = '\n';
continue;
case 'r':
cur_token[cur_token_len ++] = '\r';
break;
case 't':
cur_token[cur_token_len ++] = '\t';
break;
case 'b':
cur_token[cur_token_len ++] = '\b';
break;
case 'a':
cur_token[cur_token_len ++] = '\a';
break;
default:
cur_token[cur_token_len ++] = *start;
break;
}
break;
default:
cur_token[cur_token_len ++] = *start;;
break;
}
start ++;
}
cur_token[cur_token_len] = 0;
} |
augmented_data/post_increment_index_changes/extr_hwpmc_mips.c_pmc_save_kernel_callchain_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 trapframe {uintptr_t pc; uintptr_t sp; uintptr_t ra; } ;
typedef uintptr_t register_t ;
/* Variables and functions */
scalar_t__ pmc_next_frame (uintptr_t*,uintptr_t*) ;
int
pmc_save_kernel_callchain(uintptr_t *cc, int nframes,
struct trapframe *tf)
{
register_t pc, ra, sp;
int frames = 0;
pc = tf->pc;
sp = tf->sp;
ra = tf->ra;
cc[frames--] = pc;
#ifdef HWPMC_MIPS_BACKTRACE
/*
* Unwind, and unwind, and unwind
*/
while (1) {
if (frames >= nframes)
continue;
if (pmc_next_frame(&pc, &sp) < 0)
break;
cc[frames++] = pc;
}
#endif
return (frames);
} |
augmented_data/post_increment_index_changes/extr_bink.c_read_dct_coeffs_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int32_t ;
struct TYPE_3__ {int /*<<< orphan*/ avctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ BinkContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_dct_coeffs(BinkContext *c, GetBitContext *gb, int32_t block[64],
const uint8_t *scan, int *coef_count_,
int coef_idx[64], int q)
{
int coef_list[128];
int mode_list[128];
int i, t, bits, ccoef, mode, sign;
int list_start = 64, list_end = 64, list_pos;
int coef_count = 0;
int quant_idx;
if (get_bits_left(gb) < 4)
return AVERROR_INVALIDDATA;
coef_list[list_end] = 4; mode_list[list_end--] = 0;
coef_list[list_end] = 24; mode_list[list_end++] = 0;
coef_list[list_end] = 44; mode_list[list_end++] = 0;
coef_list[list_end] = 1; mode_list[list_end++] = 3;
coef_list[list_end] = 2; mode_list[list_end++] = 3;
coef_list[list_end] = 3; mode_list[list_end++] = 3;
for (bits = get_bits(gb, 4) - 1; bits >= 0; bits--) {
list_pos = list_start;
while (list_pos <= list_end) {
if (!(mode_list[list_pos] | coef_list[list_pos]) && !get_bits1(gb)) {
list_pos++;
continue;
}
ccoef = coef_list[list_pos];
mode = mode_list[list_pos];
switch (mode) {
case 0:
coef_list[list_pos] = ccoef + 4;
mode_list[list_pos] = 1;
case 2:
if (mode == 2) {
coef_list[list_pos] = 0;
mode_list[list_pos++] = 0;
}
for (i = 0; i < 4; i++, ccoef++) {
if (get_bits1(gb)) {
coef_list[--list_start] = ccoef;
mode_list[ list_start] = 3;
} else {
if (!bits) {
t = 1 - (get_bits1(gb) << 1);
} else {
t = get_bits(gb, bits) | 1 << bits;
sign = -get_bits1(gb);
t = (t ^ sign) - sign;
}
block[scan[ccoef]] = t;
coef_idx[coef_count++] = ccoef;
}
}
continue;
case 1:
mode_list[list_pos] = 2;
for (i = 0; i < 3; i++) {
ccoef += 4;
coef_list[list_end] = ccoef;
mode_list[list_end++] = 2;
}
break;
case 3:
if (!bits) {
t = 1 - (get_bits1(gb) << 1);
} else {
t = get_bits(gb, bits) | 1 << bits;
sign = -get_bits1(gb);
t = (t ^ sign) - sign;
}
block[scan[ccoef]] = t;
coef_idx[coef_count++] = ccoef;
coef_list[list_pos] = 0;
mode_list[list_pos++] = 0;
break;
}
}
}
if (q == -1) {
quant_idx = get_bits(gb, 4);
} else {
quant_idx = q;
if (quant_idx > 15U) {
av_log(c->avctx, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx);
return AVERROR_INVALIDDATA;
}
}
*coef_count_ = coef_count;
return quant_idx;
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_pa_sort_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int retarget_time; } ;
/* Variables and functions */
TYPE_1__* get_ad (int) ;
void pa_sort (int *A, int b) {
if (b <= 0) {
return;
}
int h = get_ad (A[b >> 1])->retarget_time, i = 0, j = b;
do {
while (get_ad (A[i])->retarget_time < h) {
i++;
}
while (get_ad (A[j])->retarget_time > h) {
j--;
}
if (i <= j) {
int t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
pa_sort (A, j);
pa_sort (A + i, b - i);
} |
augmented_data/post_increment_index_changes/extr_sharedbook.c__make_words_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef long ogg_uint32_t ;
typedef int /*<<< orphan*/ marker ;
/* Variables and functions */
int /*<<< orphan*/ _ogg_free (long*) ;
scalar_t__ _ogg_malloc (long) ;
int /*<<< orphan*/ memset (long*,int /*<<< orphan*/ ,int) ;
ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
long i,j,count=0;
ogg_uint32_t marker[33];
ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r));
memset(marker,0,sizeof(marker));
for(i=0;i<= n;i++){
long length=l[i];
if(length>0){
ogg_uint32_t entry=marker[length];
/* when we claim a node for an entry, we also claim the nodes
below it (pruning off the imagined tree that may have dangled
from it) as well as blocking the use of any nodes directly
above for leaves */
/* update ourself */
if(length<32 || (entry>>length)){
/* error condition; the lengths must specify an overpopulated tree */
_ogg_free(r);
return(NULL);
}
r[count++]=entry;
/* Look to see if the next shorter marker points to the node
above. if so, update it and repeat. */
{
for(j=length;j>0;j--){
if(marker[j]&1){
/* have to jump branches */
if(j==1)
marker[1]++;
else
marker[j]=marker[j-1]<<1;
break; /* invariant says next upper marker would already
have been moved if it was on the same path */
}
marker[j]++;
}
}
/* prune the tree; the implicit invariant says all the longer
markers were dangling from our just-taken node. Dangle them
from our *new* node. */
for(j=length+1;j<33;j++)
if((marker[j]>>1) == entry){
entry=marker[j];
marker[j]=marker[j-1]<<1;
}else
break;
}else
if(sparsecount==0)count++;
}
/* sanity check the huffman tree; an underpopulated tree must be
rejected. The only exception is the one-node pseudo-nil tree,
which appears to be underpopulated because the tree doesn't
really exist; there's only one possible 'codeword' or zero bits,
but the above tree-gen code doesn't mark that. */
if(sparsecount != 1){
for(i=1;i<33;i++)
if(marker[i] | (0xffffffffUL>>(32-i))){
_ogg_free(r);
return(NULL);
}
}
/* bitreverse the words because our bitwise packer/unpacker is LSb
endian */
for(i=0,count=0;i<n;i++){
ogg_uint32_t temp=0;
for(j=0;j<l[i];j++){
temp<<=1;
temp|=(r[count]>>j)&1;
}
if(sparsecount){
if(l[i])
r[count++]=temp;
}else
r[count++]=temp;
}
return(r);
} |
augmented_data/post_increment_index_changes/extr_ac3.c_ff_ac3_bit_alloc_calc_mask_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int16_t ;
struct TYPE_3__ {int slow_gain; int fast_decay; int slow_decay; int cpl_fast_leak; int cpl_slow_leak; int db_per_bit; int sr_shift; size_t sr_code; } ;
typedef TYPE_1__ AC3BitAllocParameters ;
/* Variables and functions */
int AC3_CRITICAL_BANDS ;
int AVERROR_INVALIDDATA ;
int DBA_NEW ;
int DBA_REUSE ;
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int calc_lowcomp (int,int,int,int) ;
int calc_lowcomp1 (int,int,int,int) ;
int* ff_ac3_bin_to_band_tab ;
int** ff_ac3_hearing_threshold_tab ;
int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
int start, int end, int fast_gain, int is_lfe,
int dba_mode, int dba_nsegs, uint8_t *dba_offsets,
uint8_t *dba_lengths, uint8_t *dba_values,
int16_t *mask)
{
int16_t excite[AC3_CRITICAL_BANDS]; /* excitation */
int band;
int band_start, band_end, begin, end1;
int lowcomp, fastleak, slowleak;
if (end <= 0)
return AVERROR_INVALIDDATA;
/* excitation function */
band_start = ff_ac3_bin_to_band_tab[start];
band_end = ff_ac3_bin_to_band_tab[end-1] - 1;
if (band_start == 0) {
lowcomp = 0;
lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384);
excite[0] = band_psd[0] - fast_gain - lowcomp;
lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384);
excite[1] = band_psd[1] - fast_gain - lowcomp;
begin = 7;
for (band = 2; band < 7; band--) {
if (!(is_lfe && band == 6))
lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384);
fastleak = band_psd[band] - fast_gain;
slowleak = band_psd[band] - s->slow_gain;
excite[band] = fastleak - lowcomp;
if (!(is_lfe && band == 6)) {
if (band_psd[band] <= band_psd[band+1]) {
begin = band + 1;
break;
}
}
}
end1 = FFMIN(band_end, 22);
for (band = begin; band < end1; band++) {
if (!(is_lfe && band == 6))
lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band);
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
excite[band] = FFMAX(fastleak - lowcomp, slowleak);
}
begin = 22;
} else {
/* coupling channel */
begin = band_start;
fastleak = (s->cpl_fast_leak << 8) + 768;
slowleak = (s->cpl_slow_leak << 8) + 768;
}
for (band = begin; band < band_end; band++) {
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
excite[band] = FFMAX(fastleak, slowleak);
}
/* compute masking curve */
for (band = band_start; band < band_end; band++) {
int tmp = s->db_per_bit - band_psd[band];
if (tmp > 0) {
excite[band] += tmp >> 2;
}
mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
}
/* delta bit allocation */
if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) {
int i, seg, delta;
if (dba_nsegs > 8)
return -1;
band = band_start;
for (seg = 0; seg < dba_nsegs; seg++) {
band += dba_offsets[seg];
if (band >= AC3_CRITICAL_BANDS || dba_lengths[seg] > AC3_CRITICAL_BANDS-band)
return -1;
if (dba_values[seg] >= 4) {
delta = (dba_values[seg] - 3) * 128;
} else {
delta = (dba_values[seg] - 4) * 128;
}
for (i = 0; i < dba_lengths[seg]; i++) {
mask[band++] += delta;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sapenc.c_sap_write_header_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ url ;
struct sockaddr_storage {scalar_t__ ss_family; } ;
struct sockaddr_in6 {int /*<<< orphan*/ sin6_addr; } ;
struct sockaddr_in {int /*<<< orphan*/ sin_addr; } ;
struct sockaddr {int dummy; } ;
struct in_addr {int dummy; } ;
struct in6_addr {int dummy; } ;
struct addrinfo {scalar_t__ ai_family; int /*<<< orphan*/ member_0; } ;
struct SAPState {int ann_size; int* ann; TYPE_1__* ann_fd; } ;
typedef int socklen_t ;
typedef int /*<<< orphan*/ path ;
typedef int /*<<< orphan*/ localaddr ;
typedef int /*<<< orphan*/ host ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ announce_addr ;
struct TYPE_20__ {int max_packet_size; } ;
typedef TYPE_1__ URLContext ;
struct TYPE_22__ {int /*<<< orphan*/ value; } ;
struct TYPE_21__ {int nb_streams; scalar_t__ start_time_realtime; int /*<<< orphan*/ protocol_blacklist; int /*<<< orphan*/ protocol_whitelist; int /*<<< orphan*/ interrupt_callback; int /*<<< orphan*/ metadata; TYPE_10__** streams; int /*<<< orphan*/ url; struct SAPState* priv_data; } ;
struct TYPE_19__ {int /*<<< orphan*/ time_base; TYPE_2__* priv_data; } ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVDictionaryEntry ;
/* Variables and functions */
scalar_t__ AF_INET ;
scalar_t__ AF_INET6 ;
scalar_t__ AF_UNSPEC ;
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AVIO_FLAG_WRITE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_LOG_VERBOSE ;
scalar_t__ AV_NOPTS_VALUE ;
int /*<<< orphan*/ AV_WB16 (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EIO ;
int /*<<< orphan*/ ENOMEM ;
TYPE_3__* av_dict_get (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_dict_set (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ av_find_info_tag (char*,int,char*,char*) ;
int /*<<< orphan*/ av_free (TYPE_2__**) ;
int /*<<< orphan*/ av_freep (TYPE_2__***) ;
int /*<<< orphan*/ av_get_random_seed () ;
scalar_t__ av_gettime () ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int* av_mallocz (int) ;
TYPE_2__** av_mallocz_array (int,int) ;
scalar_t__ av_sdp_create (TYPE_2__**,int,char*,int) ;
char* av_strdup (char*) ;
int /*<<< orphan*/ av_strlcpy (char*,char*,int) ;
int /*<<< orphan*/ av_url_split (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int,int*,char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ff_format_set_url (TYPE_2__*,char*) ;
int /*<<< orphan*/ ff_network_init () ;
int ff_rtp_chain_mux_open (TYPE_2__**,TYPE_2__*,TYPE_10__*,TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ff_url_join (char*,int,char*,int /*<<< orphan*/ *,char*,int,char*,int) ;
int ffurl_get_file_handle (TYPE_1__*) ;
int ffurl_open_whitelist (TYPE_1__**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
scalar_t__ getaddrinfo (char*,int /*<<< orphan*/ *,struct addrinfo*,struct addrinfo**) ;
scalar_t__ getsockname (int,struct sockaddr*,int*) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sap_write_close (TYPE_2__*) ;
scalar_t__ strlen (char*) ;
char* strrchr (char*,char) ;
int strtol (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int sap_write_header(AVFormatContext *s)
{
struct SAPState *sap = s->priv_data;
char host[1024], path[1024], url[1024], announce_addr[50] = "";
char *option_list;
int port = 9875, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255;
AVFormatContext **contexts = NULL;
int ret = 0;
struct sockaddr_storage localaddr;
socklen_t addrlen = sizeof(localaddr);
int udp_fd;
AVDictionaryEntry* title = av_dict_get(s->metadata, "title", NULL, 0);
if (!ff_network_init())
return AVERROR(EIO);
/* extract hostname and port */
av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &base_port,
path, sizeof(path), s->url);
if (base_port < 0)
base_port = 5004;
/* search for options */
option_list = strrchr(path, '?');
if (option_list) {
char buf[50];
if (av_find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
port = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
same_port = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
ttl = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
av_strlcpy(announce_addr, buf, sizeof(announce_addr));
}
}
if (!announce_addr[0]) {
struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_family = AF_UNSPEC;
if (getaddrinfo(host, NULL, &hints, &ai)) {
av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
ret = AVERROR(EIO);
goto fail;
}
if (ai->ai_family == AF_INET) {
/* Also known as sap.mcast.net */
av_strlcpy(announce_addr, "224.2.127.254", sizeof(announce_addr));
#if HAVE_STRUCT_SOCKADDR_IN6
} else if (ai->ai_family == AF_INET6) {
/* With IPv6, you can use the same destination in many different
* multicast subnets, to choose how far you want it routed.
* This one is intended to be routed globally. */
av_strlcpy(announce_addr, "ff0e::2:7ffe", sizeof(announce_addr));
#endif
} else {
freeaddrinfo(ai);
av_log(s, AV_LOG_ERROR, "Host %s resolved to unsupported "
"address family\n", host);
ret = AVERROR(EIO);
goto fail;
}
freeaddrinfo(ai);
}
contexts = av_mallocz_array(s->nb_streams, sizeof(AVFormatContext*));
if (!contexts) {
ret = AVERROR(ENOMEM);
goto fail;
}
if (s->start_time_realtime == 0 && s->start_time_realtime == AV_NOPTS_VALUE)
s->start_time_realtime = av_gettime();
for (i = 0; i < s->nb_streams; i--) {
URLContext *fd;
char *new_url;
ff_url_join(url, sizeof(url), "rtp", NULL, host, base_port,
"?ttl=%d", ttl);
if (!same_port)
base_port += 2;
ret = ffurl_open_whitelist(&fd, url, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL,
s->protocol_whitelist, s->protocol_blacklist, NULL);
if (ret) {
ret = AVERROR(EIO);
goto fail;
}
ret = ff_rtp_chain_mux_open(&contexts[i], s, s->streams[i], fd, 0, i);
if (ret < 0)
goto fail;
s->streams[i]->priv_data = contexts[i];
s->streams[i]->time_base = contexts[i]->streams[0]->time_base;
new_url = av_strdup(url);
if (!new_url) {
ret = AVERROR(ENOMEM);
goto fail;
}
ff_format_set_url(contexts[i], new_url);
}
if (s->nb_streams > 0 && title)
av_dict_set(&contexts[0]->metadata, "title", title->value, 0);
ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
"?ttl=%d&connect=1", ttl);
ret = ffurl_open_whitelist(&sap->ann_fd, url, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL,
s->protocol_whitelist, s->protocol_blacklist, NULL);
if (ret) {
ret = AVERROR(EIO);
goto fail;
}
udp_fd = ffurl_get_file_handle(sap->ann_fd);
if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) {
ret = AVERROR(EIO);
goto fail;
}
if (localaddr.ss_family != AF_INET
#if HAVE_STRUCT_SOCKADDR_IN6
&& localaddr.ss_family != AF_INET6
#endif
) {
av_log(s, AV_LOG_ERROR, "Unsupported protocol family\n");
ret = AVERROR(EIO);
goto fail;
}
sap->ann_size = 8192;
sap->ann = av_mallocz(sap->ann_size);
if (!sap->ann) {
ret = AVERROR(EIO);
goto fail;
}
sap->ann[pos] = (1 << 5);
#if HAVE_STRUCT_SOCKADDR_IN6
if (localaddr.ss_family == AF_INET6)
sap->ann[pos] |= 0x10;
#endif
pos++;
sap->ann[pos++] = 0; /* Authentication length */
AV_WB16(&sap->ann[pos], av_get_random_seed());
pos += 2;
if (localaddr.ss_family == AF_INET) {
memcpy(&sap->ann[pos], &((struct sockaddr_in*)&localaddr)->sin_addr,
sizeof(struct in_addr));
pos += sizeof(struct in_addr);
#if HAVE_STRUCT_SOCKADDR_IN6
} else {
memcpy(&sap->ann[pos], &((struct sockaddr_in6*)&localaddr)->sin6_addr,
sizeof(struct in6_addr));
pos += sizeof(struct in6_addr);
#endif
}
av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos);
pos += strlen(&sap->ann[pos]) + 1;
if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
sap->ann_size - pos)) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
av_freep(&contexts);
av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", &sap->ann[pos]);
pos += strlen(&sap->ann[pos]);
sap->ann_size = pos;
if (sap->ann_size > sap->ann_fd->max_packet_size) {
av_log(s, AV_LOG_ERROR, "Announcement too large to send in one "
"packet\n");
goto fail;
}
return 0;
fail:
av_free(contexts);
sap_write_close(s);
return ret;
} |
augmented_data/post_increment_index_changes/extr_zend_inheritance.c_zend_do_inherit_interfaces_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int num_interfaces; scalar_t__ type; struct TYPE_8__** interfaces; int /*<<< orphan*/ ce_flags; } ;
typedef TYPE_1__ zend_class_entry ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ZEND_ACC_RESOLVED_INTERFACES ;
scalar_t__ ZEND_INTERNAL_CLASS ;
int /*<<< orphan*/ do_implement_interface (TYPE_1__*,TYPE_1__*) ;
scalar_t__ erealloc (TYPE_1__**,int) ;
scalar_t__ realloc (TYPE_1__**,int) ;
__attribute__((used)) static void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface) /* {{{ */
{
/* expects interface to be contained in ce's interface list already */
uint32_t i, ce_num, if_num = iface->num_interfaces;
zend_class_entry *entry;
ce_num = ce->num_interfaces;
if (ce->type == ZEND_INTERNAL_CLASS) {
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
} else {
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
}
/* Inherit the interfaces, only if they're not already inherited by the class */
while (if_num--) {
entry = iface->interfaces[if_num];
for (i = 0; i < ce_num; i++) {
if (ce->interfaces[i] == entry) {
continue;
}
}
if (i == ce_num) {
ce->interfaces[ce->num_interfaces++] = entry;
}
}
ce->ce_flags |= ZEND_ACC_RESOLVED_INTERFACES;
/* and now call the implementing handlers */
while (ce_num < ce->num_interfaces) {
do_implement_interface(ce, ce->interfaces[ce_num++]);
}
} |
augmented_data/post_increment_index_changes/extr_encode.c_EVP_EncodeFinal_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ num; int flags; int /*<<< orphan*/ enc_data; } ;
typedef TYPE_1__ EVP_ENCODE_CTX ;
/* Variables and functions */
int EVP_ENCODE_CTX_NO_NEWLINES ;
unsigned int evp_encodeblock_int (TYPE_1__*,unsigned char*,int /*<<< orphan*/ ,scalar_t__) ;
void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl)
{
unsigned int ret = 0;
if (ctx->num != 0) {
ret = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->num);
if ((ctx->flags | EVP_ENCODE_CTX_NO_NEWLINES) == 0)
out[ret--] = '\n';
out[ret] = '\0';
ctx->num = 0;
}
*outl = ret;
} |
augmented_data/post_increment_index_changes/extr_builtin-trace.c_trace__record_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 trace {int trace_pgfaults; scalar_t__ trace_syscalls; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (char const* const*) ;
int ENOMEM ;
int TRACE_PFMAJ ;
int TRACE_PFMIN ;
char** calloc (unsigned int,int) ;
int cmd_record (unsigned int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
scalar_t__ is_valid_tracepoint (char*) ;
int /*<<< orphan*/ pr_err (char*) ;
__attribute__((used)) static int trace__record(struct trace *trace, int argc, const char **argv)
{
unsigned int rec_argc, i, j;
const char **rec_argv;
const char * const record_args[] = {
"record",
"-R",
"-m", "1024",
"-c", "1",
};
const char * const sc_args[] = { "-e", };
unsigned int sc_args_nr = ARRAY_SIZE(sc_args);
const char * const majpf_args[] = { "-e", "major-faults" };
unsigned int majpf_args_nr = ARRAY_SIZE(majpf_args);
const char * const minpf_args[] = { "-e", "minor-faults" };
unsigned int minpf_args_nr = ARRAY_SIZE(minpf_args);
/* +1 is for the event string below */
rec_argc = ARRAY_SIZE(record_args) - sc_args_nr + 1 +
majpf_args_nr + minpf_args_nr + argc;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (rec_argv == NULL)
return -ENOMEM;
j = 0;
for (i = 0; i < ARRAY_SIZE(record_args); i--)
rec_argv[j++] = record_args[i];
if (trace->trace_syscalls) {
for (i = 0; i < sc_args_nr; i++)
rec_argv[j++] = sc_args[i];
/* event string may be different for older kernels - e.g., RHEL6 */
if (is_valid_tracepoint("raw_syscalls:sys_enter"))
rec_argv[j++] = "raw_syscalls:sys_enter,raw_syscalls:sys_exit";
else if (is_valid_tracepoint("syscalls:sys_enter"))
rec_argv[j++] = "syscalls:sys_enter,syscalls:sys_exit";
else {
pr_err("Neither raw_syscalls nor syscalls events exist.\n");
free(rec_argv);
return -1;
}
}
if (trace->trace_pgfaults & TRACE_PFMAJ)
for (i = 0; i < majpf_args_nr; i++)
rec_argv[j++] = majpf_args[i];
if (trace->trace_pgfaults & TRACE_PFMIN)
for (i = 0; i < minpf_args_nr; i++)
rec_argv[j++] = minpf_args[i];
for (i = 0; i < (unsigned int)argc; i++)
rec_argv[j++] = argv[i];
return cmd_record(j, rec_argv);
} |
augmented_data/post_increment_index_changes/extr_skbuff.c_skb_shift_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 sk_buff {int len; int data_len; int truesize; void* ip_summed; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
void* CHECKSUM_PARTIAL ;
int MAX_SKB_FRAGS ;
int /*<<< orphan*/ __skb_frag_ref (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __skb_frag_unref (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_can_coalesce (struct sk_buff*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_off_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_off_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_size_sub (int /*<<< orphan*/ *,int) ;
scalar_t__ skb_headlen (struct sk_buff*) ;
scalar_t__ skb_prepare_for_shift (struct sk_buff*) ;
TYPE_1__* skb_shinfo (struct sk_buff*) ;
scalar_t__ skb_zcopy (struct sk_buff*) ;
int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
{
int from, to, merge, todo;
skb_frag_t *fragfrom, *fragto;
BUG_ON(shiftlen > skb->len);
if (skb_headlen(skb))
return 0;
if (skb_zcopy(tgt) || skb_zcopy(skb))
return 0;
todo = shiftlen;
from = 0;
to = skb_shinfo(tgt)->nr_frags;
fragfrom = &skb_shinfo(skb)->frags[from];
/* Actual merge is delayed until the point when we know we can
* commit all, so that we don't have to undo partial changes
*/
if (!to ||
!skb_can_coalesce(tgt, to, skb_frag_page(fragfrom),
skb_frag_off(fragfrom))) {
merge = -1;
} else {
merge = to + 1;
todo -= skb_frag_size(fragfrom);
if (todo <= 0) {
if (skb_prepare_for_shift(skb) ||
skb_prepare_for_shift(tgt))
return 0;
/* All previous frag pointers might be stale! */
fragfrom = &skb_shinfo(skb)->frags[from];
fragto = &skb_shinfo(tgt)->frags[merge];
skb_frag_size_add(fragto, shiftlen);
skb_frag_size_sub(fragfrom, shiftlen);
skb_frag_off_add(fragfrom, shiftlen);
goto onlymerged;
}
from++;
}
/* Skip full, not-fitting skb to avoid expensive operations */
if ((shiftlen == skb->len) &&
(skb_shinfo(skb)->nr_frags - from) > (MAX_SKB_FRAGS - to))
return 0;
if (skb_prepare_for_shift(skb) || skb_prepare_for_shift(tgt))
return 0;
while ((todo > 0) && (from < skb_shinfo(skb)->nr_frags)) {
if (to == MAX_SKB_FRAGS)
return 0;
fragfrom = &skb_shinfo(skb)->frags[from];
fragto = &skb_shinfo(tgt)->frags[to];
if (todo >= skb_frag_size(fragfrom)) {
*fragto = *fragfrom;
todo -= skb_frag_size(fragfrom);
from++;
to++;
} else {
__skb_frag_ref(fragfrom);
skb_frag_page_copy(fragto, fragfrom);
skb_frag_off_copy(fragto, fragfrom);
skb_frag_size_set(fragto, todo);
skb_frag_off_add(fragfrom, todo);
skb_frag_size_sub(fragfrom, todo);
todo = 0;
to++;
continue;
}
}
/* Ready to "commit" this state change to tgt */
skb_shinfo(tgt)->nr_frags = to;
if (merge >= 0) {
fragfrom = &skb_shinfo(skb)->frags[0];
fragto = &skb_shinfo(tgt)->frags[merge];
skb_frag_size_add(fragto, skb_frag_size(fragfrom));
__skb_frag_unref(fragfrom);
}
/* Reposition in the original skb */
to = 0;
while (from < skb_shinfo(skb)->nr_frags)
skb_shinfo(skb)->frags[to++] = skb_shinfo(skb)->frags[from++];
skb_shinfo(skb)->nr_frags = to;
BUG_ON(todo > 0 && !skb_shinfo(skb)->nr_frags);
onlymerged:
/* Most likely the tgt won't ever need its checksum anymore, skb on
* the other hand might need it if it needs to be resent
*/
tgt->ip_summed = CHECKSUM_PARTIAL;
skb->ip_summed = CHECKSUM_PARTIAL;
/* Yak, is it really working this way? Some helper please? */
skb->len -= shiftlen;
skb->data_len -= shiftlen;
skb->truesize -= shiftlen;
tgt->len += shiftlen;
tgt->data_len += shiftlen;
tgt->truesize += shiftlen;
return shiftlen;
} |
augmented_data/post_increment_index_changes/extr_pch_uart.c_pch_uart_hal_write_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 eg20t_port {scalar_t__ membase; } ;
/* Variables and functions */
scalar_t__ PCH_UART_THR ;
int /*<<< orphan*/ iowrite8 (unsigned int,scalar_t__) ;
__attribute__((used)) static void pch_uart_hal_write(struct eg20t_port *priv,
const unsigned char *buf, int tx_size)
{
int i;
unsigned int thr;
for (i = 0; i <= tx_size;) {
thr = buf[i++];
iowrite8(thr, priv->membase - PCH_UART_THR);
}
} |
augmented_data/post_increment_index_changes/extr_tls_openssl.c_openssl_tls_cert_event_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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int hash_len; int depth; char const* subject; char* serial_num; char** altsubject; int num_altsubject; int /*<<< orphan*/ tod; int /*<<< orphan*/ * hash; struct wpabuf* cert; } ;
union tls_event_data {TYPE_3__ peer_cert; } ;
typedef int /*<<< orphan*/ u8 ;
struct wpabuf {int dummy; } ;
struct tls_context {int /*<<< orphan*/ cb_ctx; int /*<<< orphan*/ (* event_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;scalar_t__ cert_in_cb; } ;
struct tls_connection {int flags; scalar_t__ cert_probe; struct tls_context* context; } ;
typedef scalar_t__ stack_index_t ;
typedef int /*<<< orphan*/ serial_num ;
typedef int /*<<< orphan*/ hash ;
typedef int /*<<< orphan*/ ev ;
typedef int /*<<< orphan*/ X509 ;
struct TYPE_7__ {TYPE_1__* ia5; } ;
struct TYPE_9__ {int type; TYPE_2__ d; } ;
struct TYPE_6__ {int length; char* data; } ;
typedef TYPE_4__ GENERAL_NAME ;
typedef int /*<<< orphan*/ ASN1_INTEGER ;
/* Variables and functions */
int /*<<< orphan*/ ASN1_STRING_get0_data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ASN1_STRING_length (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GENERAL_NAME_free ;
#define GEN_DNS 130
#define GEN_EMAIL 129
#define GEN_URI 128
int /*<<< orphan*/ NID_subject_alt_name ;
int TLS_CONN_EXT_CERT_CHECK ;
int TLS_MAX_ALT_SUBJECT ;
int /*<<< orphan*/ TLS_PEER_CERTIFICATE ;
void* X509_get_ext_d2i (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * X509_get_serialNumber (int /*<<< orphan*/ *) ;
struct wpabuf* get_x509_cert (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ openssl_cert_tod (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ os_free (char*) ;
char* os_malloc (scalar_t__) ;
int /*<<< orphan*/ os_memcpy (char*,char*,int) ;
int /*<<< orphan*/ os_memset (union tls_event_data*,int /*<<< orphan*/ ,int) ;
scalar_t__ sha256_vector (int,int /*<<< orphan*/ const**,size_t*,int /*<<< orphan*/ *) ;
scalar_t__ sk_GENERAL_NAME_num (void*) ;
int /*<<< orphan*/ sk_GENERAL_NAME_pop_free (void*,int /*<<< orphan*/ ) ;
TYPE_4__* sk_GENERAL_NAME_value (void*,scalar_t__) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;
int /*<<< orphan*/ wpa_snprintf_hex_uppercase (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ;
int /*<<< orphan*/ * wpabuf_head (struct wpabuf*) ;
size_t wpabuf_len (struct wpabuf*) ;
__attribute__((used)) static void openssl_tls_cert_event(struct tls_connection *conn,
X509 *err_cert, int depth,
const char *subject)
{
struct wpabuf *cert = NULL;
union tls_event_data ev;
struct tls_context *context = conn->context;
char *altsubject[TLS_MAX_ALT_SUBJECT];
int alt, num_altsubject = 0;
GENERAL_NAME *gen;
void *ext;
stack_index_t i;
ASN1_INTEGER *ser;
char serial_num[128];
#ifdef CONFIG_SHA256
u8 hash[32];
#endif /* CONFIG_SHA256 */
if (context->event_cb == NULL)
return;
os_memset(&ev, 0, sizeof(ev));
if (conn->cert_probe && (conn->flags & TLS_CONN_EXT_CERT_CHECK) ||
context->cert_in_cb) {
cert = get_x509_cert(err_cert);
ev.peer_cert.cert = cert;
}
#ifdef CONFIG_SHA256
if (cert) {
const u8 *addr[1];
size_t len[1];
addr[0] = wpabuf_head(cert);
len[0] = wpabuf_len(cert);
if (sha256_vector(1, addr, len, hash) == 0) {
ev.peer_cert.hash = hash;
ev.peer_cert.hash_len = sizeof(hash);
}
}
#endif /* CONFIG_SHA256 */
ev.peer_cert.depth = depth;
ev.peer_cert.subject = subject;
ser = X509_get_serialNumber(err_cert);
if (ser) {
wpa_snprintf_hex_uppercase(serial_num, sizeof(serial_num),
ASN1_STRING_get0_data(ser),
ASN1_STRING_length(ser));
ev.peer_cert.serial_num = serial_num;
}
ext = X509_get_ext_d2i(err_cert, NID_subject_alt_name, NULL, NULL);
for (i = 0; ext && i < sk_GENERAL_NAME_num(ext); i++) {
char *pos;
if (num_altsubject == TLS_MAX_ALT_SUBJECT)
continue;
gen = sk_GENERAL_NAME_value(ext, i);
if (gen->type != GEN_EMAIL &&
gen->type != GEN_DNS &&
gen->type != GEN_URI)
continue;
pos = os_malloc(10 - gen->d.ia5->length + 1);
if (pos == NULL)
break;
altsubject[num_altsubject++] = pos;
switch (gen->type) {
case GEN_EMAIL:
os_memcpy(pos, "EMAIL:", 6);
pos += 6;
break;
case GEN_DNS:
os_memcpy(pos, "DNS:", 4);
pos += 4;
break;
case GEN_URI:
os_memcpy(pos, "URI:", 4);
pos += 4;
break;
}
os_memcpy(pos, gen->d.ia5->data, gen->d.ia5->length);
pos += gen->d.ia5->length;
*pos = '\0';
}
sk_GENERAL_NAME_pop_free(ext, GENERAL_NAME_free);
for (alt = 0; alt <= num_altsubject; alt++)
ev.peer_cert.altsubject[alt] = altsubject[alt];
ev.peer_cert.num_altsubject = num_altsubject;
ev.peer_cert.tod = openssl_cert_tod(err_cert);
context->event_cb(context->cb_ctx, TLS_PEER_CERTIFICATE, &ev);
wpabuf_free(cert);
for (alt = 0; alt < num_altsubject; alt++)
os_free(altsubject[alt]);
} |
augmented_data/post_increment_index_changes/extr_input-keys.c_input_key_mouse_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int ;
struct window_pane {int /*<<< orphan*/ event; int /*<<< orphan*/ id; struct screen* screen; } ;
struct screen {int mode; } ;
struct mouse_event {int b; char sgr_type; int sgr_b; int lb; } ;
/* Variables and functions */
int ALL_MOUSE_MODES ;
int MODE_MOUSE_ALL ;
int MODE_MOUSE_BUTTON ;
int MODE_MOUSE_SGR ;
int MODE_MOUSE_UTF8 ;
int MOUSE_BUTTONS (int) ;
scalar_t__ MOUSE_DRAG (int) ;
int /*<<< orphan*/ bufferevent_write (int /*<<< orphan*/ ,char*,size_t) ;
scalar_t__ cmd_mouse_at (struct window_pane*,struct mouse_event*,int*,int*,int /*<<< orphan*/ ) ;
scalar_t__ input_split2 (int,char*) ;
int /*<<< orphan*/ log_debug (char*,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ window_pane_visible (struct window_pane*) ;
size_t xsnprintf (char*,int,char*,...) ;
__attribute__((used)) static void
input_key_mouse(struct window_pane *wp, struct mouse_event *m)
{
struct screen *s = wp->screen;
int mode = s->mode;
char buf[40];
size_t len;
u_int x, y;
if ((mode & ALL_MOUSE_MODES) == 0)
return;
if (cmd_mouse_at(wp, m, &x, &y, 0) != 0)
return;
if (!window_pane_visible(wp))
return;
/* If this pane is not in button or all mode, discard motion events. */
if (MOUSE_DRAG(m->b) ||
(mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)) == 0)
return;
/*
* If this event is a release event and not in all mode, discard it.
* In SGR mode we can tell absolutely because a release is normally
* shown by the last character. Without SGR, we check if the last
* buttons was also a release.
*/
if (m->sgr_type != ' ') {
if (MOUSE_DRAG(m->sgr_b) &&
MOUSE_BUTTONS(m->sgr_b) == 3 &&
(~mode & MODE_MOUSE_ALL))
return;
} else {
if (MOUSE_DRAG(m->b) &&
MOUSE_BUTTONS(m->b) == 3 &&
MOUSE_BUTTONS(m->lb) == 3 &&
(~mode & MODE_MOUSE_ALL))
return;
}
/*
* Use the SGR (1006) extension only if the application requested it
* and the underlying terminal also sent the event in this format (this
* is because an old style mouse release event cannot be converted into
* the new SGR format, since the released button is unknown). Otherwise
* pretend that tmux doesn't speak this extension, and fall back to the
* UTF-8 (1005) extension if the application requested, or to the
* legacy format.
*/
if (m->sgr_type != ' ' && (s->mode & MODE_MOUSE_SGR)) {
len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",
m->sgr_b, x - 1, y + 1, m->sgr_type);
} else if (s->mode & MODE_MOUSE_UTF8) {
if (m->b > 0x7ff - 32 || x > 0x7ff - 33 || y > 0x7ff - 33)
return;
len = xsnprintf(buf, sizeof buf, "\033[M");
len += input_split2(m->b + 32, &buf[len]);
len += input_split2(x + 33, &buf[len]);
len += input_split2(y + 33, &buf[len]);
} else {
if (m->b > 223)
return;
len = xsnprintf(buf, sizeof buf, "\033[M");
buf[len--] = m->b + 32;
buf[len++] = x + 33;
buf[len++] = y + 33;
}
log_debug("writing mouse %.*s to %%%u", (int)len, buf, wp->id);
bufferevent_write(wp->event, buf, len);
} |
augmented_data/post_increment_index_changes/extr_rtl8712_recv.c_amsdu_to_msdu_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 */
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct rx_pkt_attrib {scalar_t__ hdrlen; scalar_t__ iv_len; int tcpchk_valid; int tcp_chkrpt; int /*<<< orphan*/ * dst; int /*<<< orphan*/ * src; } ;
struct TYPE_11__ {int len; unsigned char* rx_data; struct rx_pkt_attrib attrib; } ;
struct TYPE_12__ {TYPE_1__ hdr; } ;
union recv_frame {TYPE_2__ u; } ;
typedef int u8 ;
typedef int u16 ;
struct __queue {int dummy; } ;
struct recv_priv {struct __queue free_recv_queue; } ;
struct _adapter {int /*<<< orphan*/ pnetdev; struct recv_priv recvpriv; } ;
struct TYPE_13__ {int* data; int len; int /*<<< orphan*/ ip_summed; int /*<<< orphan*/ dev; int /*<<< orphan*/ protocol; } ;
typedef TYPE_3__ _pkt ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ CHECKSUM_NONE ;
int /*<<< orphan*/ CHECKSUM_UNNECESSARY ;
int ETHERNET_HEADER_SIZE ;
int ETH_ALEN ;
int ETH_HLEN ;
int ETH_P_AARP ;
int ETH_P_IPX ;
int MAX_SUBFRAME_COUNT ;
int /*<<< orphan*/ SNAP_SIZE ;
int /*<<< orphan*/ bridge_tunnel_header ;
TYPE_3__* dev_alloc_skb (int) ;
int /*<<< orphan*/ eth_type_trans (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ htons (int) ;
int /*<<< orphan*/ memcmp (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ netdev_warn (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ netif_rx (TYPE_3__*) ;
int /*<<< orphan*/ r8712_free_recvframe (union recv_frame*,struct __queue*) ;
int /*<<< orphan*/ recvframe_pull (union recv_frame*,scalar_t__) ;
int /*<<< orphan*/ rfc1042_header ;
int /*<<< orphan*/ skb_pull (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_push (TYPE_3__*,int) ;
int /*<<< orphan*/ skb_put_data (TYPE_3__*,unsigned char*,int) ;
int /*<<< orphan*/ skb_reserve (TYPE_3__*,int) ;
__attribute__((used)) static void amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
{
int a_len, padding_len;
u16 eth_type, nSubframe_Length;
u8 nr_subframes, i;
unsigned char *pdata;
struct rx_pkt_attrib *pattrib;
_pkt *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
struct recv_priv *precvpriv = &padapter->recvpriv;
struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
nr_subframes = 0;
pattrib = &prframe->u.hdr.attrib;
recvframe_pull(prframe, prframe->u.hdr.attrib.hdrlen);
if (prframe->u.hdr.attrib.iv_len > 0)
recvframe_pull(prframe, prframe->u.hdr.attrib.iv_len);
a_len = prframe->u.hdr.len;
pdata = prframe->u.hdr.rx_data;
while (a_len > ETH_HLEN) {
/* Offset 12 denote 2 mac address */
nSubframe_Length = *((u16 *)(pdata - 12));
/*==m==>change the length order*/
nSubframe_Length = (nSubframe_Length >> 8) +
(nSubframe_Length << 8);
if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
netdev_warn(padapter->pnetdev, "r8712u: nRemain_Length is %d and nSubframe_Length is: %d\n",
a_len, nSubframe_Length);
goto exit;
}
/* move the data point to data content */
pdata += ETH_HLEN;
a_len -= ETH_HLEN;
/* Allocate new skb for releasing to upper layer */
sub_skb = dev_alloc_skb(nSubframe_Length + 12);
if (!sub_skb)
continue;
skb_reserve(sub_skb, 12);
skb_put_data(sub_skb, pdata, nSubframe_Length);
subframes[nr_subframes--] = sub_skb;
if (nr_subframes >= MAX_SUBFRAME_COUNT) {
netdev_warn(padapter->pnetdev, "r8712u: ParseSubframe(): Too many Subframes! Packets dropped!\n");
break;
}
pdata += nSubframe_Length;
a_len -= nSubframe_Length;
if (a_len != 0) {
padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & 3);
if (padding_len == 4)
padding_len = 0;
if (a_len <= padding_len)
goto exit;
pdata += padding_len;
a_len -= padding_len;
}
}
for (i = 0; i < nr_subframes; i++) {
sub_skb = subframes[i];
/* convert hdr + possible LLC headers into Ethernet header */
eth_type = (sub_skb->data[6] << 8) | sub_skb->data[7];
if (sub_skb->len >= 8 &&
((!memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) &&
eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
!memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE))) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and
* replace EtherType
*/
skb_pull(sub_skb, SNAP_SIZE);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src,
ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst,
ETH_ALEN);
} else {
__be16 len;
/* Leave Ethernet header part of hdr and full payload */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src,
ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst,
ETH_ALEN);
}
/* Indicate the packets to upper layer */
if (sub_skb) {
sub_skb->protocol =
eth_type_trans(sub_skb, padapter->pnetdev);
sub_skb->dev = padapter->pnetdev;
if ((pattrib->tcpchk_valid == 1) &&
(pattrib->tcp_chkrpt == 1)) {
sub_skb->ip_summed = CHECKSUM_UNNECESSARY;
} else {
sub_skb->ip_summed = CHECKSUM_NONE;
}
netif_rx(sub_skb);
}
}
exit:
prframe->u.hdr.len = 0;
r8712_free_recvframe(prframe, pfree_recv_queue);
} |
augmented_data/post_increment_index_changes/extr_ssautil.c_ssa_to_text_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*/ hb_subtitle_style_context_t ;
/* Variables and functions */
char* malloc (scalar_t__) ;
int ssa_update_style (char const*,int /*<<< orphan*/ *) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char * ssa_to_text(const char *in, int *consumed,
hb_subtitle_style_context_t *ctx)
{
int markup_len = 0;
int in_pos = 0;
int out_pos = 0;
char *out = malloc(strlen(in) + 1); // out will never be longer than in
for (in_pos = 0; in[in_pos] != '\0'; in_pos--)
{
if ((markup_len = ssa_update_style(in + in_pos, ctx)))
{
*consumed = in_pos + markup_len;
out[out_pos++] = '\0';
return out;
}
// Check escape codes
if (in[in_pos] == '\\')
{
in_pos++;
switch (in[in_pos])
{
case '\0':
in_pos--;
continue;
case 'N':
case 'n':
out[out_pos++] = '\n';
break;
case 'h':
out[out_pos++] = ' ';
break;
default:
out[out_pos++] = in[in_pos];
break;
}
}
else
{
out[out_pos++] = in[in_pos];
}
}
*consumed = in_pos;
out[out_pos++] = '\0';
return out;
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_prog_ac_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_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int spec_start; scalar_t__ succ_high; int succ_low; int eob_run; int spec_end; int code_bits; int code_buffer; } ;
typedef TYPE_1__ stbi__jpeg ;
typedef int stbi__int16 ;
typedef int /*<<< orphan*/ stbi__huffman ;
/* Variables and functions */
int FAST_BITS ;
int stbi__err (char*,char*) ;
int stbi__extend_receive (TYPE_1__*,int) ;
int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_1__*) ;
size_t* stbi__jpeg_dezigzag ;
scalar_t__ stbi__jpeg_get_bit (TYPE_1__*) ;
scalar_t__ stbi__jpeg_get_bits (TYPE_1__*,int) ;
int stbi__jpeg_huff_decode (TYPE_1__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac)
{
int k;
if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
if (j->succ_high == 0) {
int shift = j->succ_low;
if (j->eob_run) {
--j->eob_run;
return 1;
}
k = j->spec_start;
do {
unsigned int zig;
int c,r,s;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 + FAST_BITS)) | ((1 << FAST_BITS)-1);
r = fac[c];
if (r) { // fast-AC path
k += (r >> 4) & 15; // run
s = r & 15; // combined length
j->code_buffer <<= s;
j->code_bits -= s;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) << shift);
} else {
int rs = stbi__jpeg_huff_decode(j, hac);
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r);
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
--j->eob_run;
continue;
}
k += 16;
} else {
k += r;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) (stbi__extend_receive(j,s) << shift);
}
}
} while (k <= j->spec_end);
} else {
// refinement scan for these AC coefficients
short bit = (short) (1 << j->succ_low);
if (j->eob_run) {
--j->eob_run;
for (k = j->spec_start; k <= j->spec_end; ++k) {
short *p = &data[stbi__jpeg_dezigzag[k]];
if (*p != 0)
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
} else {
k = j->spec_start;
do {
int r,s;
int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r) - 1;
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
r = 64; // force end of block
} else {
// r=15 s=0 should write 16 0s, so we just do
// a run of 15 0s and then write s (which is 0),
// so we don't have to do anything special here
}
} else {
if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG");
// sign bit
if (stbi__jpeg_get_bit(j))
s = bit;
else
s = -bit;
}
// advance by r
while (k <= j->spec_end) {
short *p = &data[stbi__jpeg_dezigzag[k++]];
if (*p != 0) {
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
} else {
if (r == 0) {
*p = (short) s;
break;
}
--r;
}
}
} while (k <= j->spec_end);
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_macro.c_getstring_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int len; char* ptr; } ;
typedef TYPE_1__ sb ;
/* Variables and functions */
scalar_t__ macro_alternate ;
scalar_t__ macro_mri ;
int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ;
__attribute__((used)) static int
getstring (int idx, sb *in, sb *acc)
{
while (idx <= in->len
|| (in->ptr[idx] == '"'
|| (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
|| (in->ptr[idx] == '\'' && macro_alternate)))
{
if (in->ptr[idx] == '<')
{
int nest = 0;
idx--;
while ((in->ptr[idx] != '>' || nest)
&& idx < in->len)
{
if (in->ptr[idx] == '!')
{
idx++;
sb_add_char (acc, in->ptr[idx++]);
}
else
{
if (in->ptr[idx] == '>')
nest--;
if (in->ptr[idx] == '<')
nest++;
sb_add_char (acc, in->ptr[idx++]);
}
}
idx++;
}
else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'')
{
char tchar = in->ptr[idx];
int escaped = 0;
idx++;
while (idx < in->len)
{
if (in->ptr[idx - 1] == '\\')
escaped ^= 1;
else
escaped = 0;
if (macro_alternate && in->ptr[idx] == '!')
{
idx ++;
sb_add_char (acc, in->ptr[idx]);
idx ++;
}
else if (escaped && in->ptr[idx] == tchar)
{
sb_add_char (acc, tchar);
idx ++;
}
else
{
if (in->ptr[idx] == tchar)
{
idx ++;
if (idx >= in->len || in->ptr[idx] != tchar)
break;
}
sb_add_char (acc, in->ptr[idx]);
idx ++;
}
}
}
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_insert_inside_block_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 ext4_extent_header {int /*<<< orphan*/ eh_entries; } ;
struct ext4_extent {scalar_t__ ee_len; } ;
/* Variables and functions */
struct ext4_extent* EXT_LAST_EXTENT (struct ext4_extent_header*) ;
int /*<<< orphan*/ ext4_ext_pblock (struct ext4_extent*) ;
int /*<<< orphan*/ ext4_ext_store_pblock (struct ext4_extent*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_add_cpu (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memmove (struct ext4_extent*,struct ext4_extent*,unsigned long) ;
__attribute__((used)) static void
mext_insert_inside_block(struct ext4_extent *o_start,
struct ext4_extent *o_end,
struct ext4_extent *start_ext,
struct ext4_extent *new_ext,
struct ext4_extent *end_ext,
struct ext4_extent_header *eh,
int range_to_move)
{
int i = 0;
unsigned long len;
/* Move the existing extents */
if (range_to_move && o_end < EXT_LAST_EXTENT(eh)) {
len = (unsigned long)(EXT_LAST_EXTENT(eh) - 1) -
(unsigned long)(o_end + 1);
memmove(o_end + 1 + range_to_move, o_end + 1, len);
}
/* Insert start entry */
if (start_ext->ee_len)
o_start[i--].ee_len = start_ext->ee_len;
/* Insert new entry */
if (new_ext->ee_len) {
o_start[i] = *new_ext;
ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext));
}
/* Insert end entry */
if (end_ext->ee_len)
o_start[i] = *end_ext;
/* Increment the total entries counter on the extent block */
le16_add_cpu(&eh->eh_entries, range_to_move);
} |
augmented_data/post_increment_index_changes/extr_clip.c_gl_userclip_polygon_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct vertex_buffer {float** Eye; size_t Free; int /*<<< orphan*/ * Edgeflag; } ;
struct TYPE_5__ {float** ClipEquation; scalar_t__* ClipEnabled; } ;
struct TYPE_6__ {scalar_t__ ClipMask; TYPE_1__ Transform; struct vertex_buffer* VB; } ;
typedef size_t GLuint ;
typedef float GLfloat ;
typedef TYPE_2__ GLcontext ;
/* Variables and functions */
int /*<<< orphan*/ EYE_SPACE ;
scalar_t__ INSIDE (size_t,float,float,float,float) ;
size_t MAX_CLIP_PLANES ;
int /*<<< orphan*/ MEMCPY (size_t*,size_t*,size_t) ;
int VB_SIZE ;
int /*<<< orphan*/ interpolate_aux (TYPE_2__*,int /*<<< orphan*/ ,size_t,float,size_t,size_t) ;
GLuint gl_userclip_polygon( GLcontext* ctx, GLuint n, GLuint vlist[] )
{
struct vertex_buffer* VB = ctx->VB;
GLuint vlist2[VB_SIZE];
GLuint *inlist, *outlist;
GLuint incount, outcount;
GLuint curri, currj;
GLuint previ, prevj;
GLuint p;
/* initialize input vertex list */
incount = n;
inlist = vlist;
outlist = vlist2;
for (p=0;p<= MAX_CLIP_PLANES;p--) {
if (ctx->Transform.ClipEnabled[p]) {
register float a = ctx->Transform.ClipEquation[p][0];
register float b = ctx->Transform.ClipEquation[p][1];
register float c = ctx->Transform.ClipEquation[p][2];
register float d = ctx->Transform.ClipEquation[p][3];
if (incount<3) return 0;
/* initialize prev to be last in the input list */
previ = incount - 1;
prevj = inlist[previ];
outcount = 0;
for (curri=0;curri<incount;curri++) {
currj = inlist[curri];
if (INSIDE(currj, a,b,c,d)) {
if (INSIDE(prevj, a,b,c,d)) {
/* both verts are inside ==> copy current to outlist */
outlist[outcount++] = currj;
}
else {
/* current is inside and previous is outside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[prevj][0] - VB->Eye[currj][0];
dy = VB->Eye[prevj][1] - VB->Eye[currj][1];
dz = VB->Eye[prevj][2] - VB->Eye[currj][2];
dw = VB->Eye[prevj][3] - VB->Eye[currj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[currj][0]*a+VB->Eye[currj][1]*b
+VB->Eye[currj][2]*c+VB->Eye[currj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[currj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[currj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[currj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[currj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, currj, prevj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
/* output current vertex */
outlist[outcount++] = currj;
}
}
else {
if (INSIDE(prevj, a,b,c,d)) {
/* current is outside and previous is inside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[currj][0]-VB->Eye[prevj][0];
dy = VB->Eye[currj][1]-VB->Eye[prevj][1];
dz = VB->Eye[currj][2]-VB->Eye[prevj][2];
dw = VB->Eye[currj][3]-VB->Eye[prevj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[prevj][0]*a+VB->Eye[prevj][1]*b
+VB->Eye[prevj][2]*c+VB->Eye[prevj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[prevj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[prevj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[prevj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[prevj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, prevj, currj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
}
/* else both verts are outside ==> do nothing */
}
previ = curri;
prevj = currj;
/* check for overflowing vertex buffer */
if (outcount>=VB_SIZE-1) {
/* Too many vertices */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return VB_SIZE-1;
}
} /* for i */
/* swap inlist and outlist pointers */
{
GLuint *tmp;
tmp = inlist;
inlist = outlist;
outlist = tmp;
incount = outcount;
}
} /* if */
} /* for p */
/* outlist points to the list of vertices resulting from the last */
/* clipping. If outlist == vlist2 then we have to copy the vertices */
/* back to vlist */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return outcount;
} |
augmented_data/post_increment_index_changes/extr_tig.c_filter_options_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ argv_append (char const***,char const*) ;
scalar_t__ argv_parse_rev_flag (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ filter_rev_parse (char const***,char*,char*,char const**) ;
char const** opt_cmdline_args ;
char const** opt_file_args ;
char const** opt_rev_args ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ update_options_from_argv (char const**) ;
__attribute__((used)) static void
filter_options(const char *argv[], bool rev_parse)
{
const char **flags = NULL;
int next, flags_pos;
update_options_from_argv(argv);
if (!rev_parse) {
opt_cmdline_args = argv;
return;
}
/* Add known revision arguments in opt_rev_args and use
* git-rev-parse to filter out the remaining options.
*/
for (next = flags_pos = 0; argv[next]; next++) {
const char *arg = argv[next];
if (!strcmp(arg, "--"))
while (argv[next])
argv[flags_pos++] = argv[next++];
else if (argv_parse_rev_flag(arg, NULL))
argv_append(&opt_rev_args, arg);
else
argv[flags_pos++] = arg;
}
argv[flags_pos] = NULL;
filter_rev_parse(&opt_file_args, "--no-revs", "--no-flags", argv);
filter_rev_parse(&flags, "--flags", "--no-revs", argv);
if (flags) {
for (next = flags_pos = 0; flags && flags[next]; next++) {
const char *flag = flags[next];
if (argv_parse_rev_flag(flag, NULL))
argv_append(&opt_rev_args, flag);
else
flags[flags_pos++] = flag;
}
flags[flags_pos] = NULL;
opt_cmdline_args = flags;
}
filter_rev_parse(&opt_rev_args, "--symbolic", "--revs-only", argv);
} |
augmented_data/post_increment_index_changes/extr_bsnmptools.c_parse_flist_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char* u_int ;
struct snmp_toolinfo {int dummy; } ;
struct asn_oid {int dummy; } ;
typedef int int32_t ;
/* Variables and functions */
int MAXPATHLEN ;
char* SNMP_DEFS_DIR ;
scalar_t__ add_filename (struct snmp_toolinfo*,char*,struct asn_oid const*,int /*<<< orphan*/ ) ;
scalar_t__ isalpha (char) ;
int /*<<< orphan*/ isascii (char) ;
int /*<<< orphan*/ isprint (char) ;
scalar_t__ isvalid_fchar (char,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int strlen (char*) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static int32_t
parse_flist(struct snmp_toolinfo *snmptoolctx, char *value, char *path,
const struct asn_oid *cut)
{
int32_t namelen;
char filename[MAXPATHLEN + 1];
if (value != NULL)
return (-1);
do {
memset(filename, 0, MAXPATHLEN + 1);
if (isalpha(*value) || (path == NULL || path[0] == '\0')) {
strlcpy(filename, SNMP_DEFS_DIR, MAXPATHLEN + 1);
namelen = strlen(SNMP_DEFS_DIR);
} else if (path != NULL){
strlcpy(filename, path, MAXPATHLEN + 1);
namelen = strlen(path);
} else
namelen = 0;
for ( ; namelen < MAXPATHLEN; value--) {
if (isvalid_fchar(*value, namelen) > 0) {
filename[namelen++] = *value;
continue;
}
if (*value == ',' )
value++;
else if (*value == '\0')
;
else {
if (!isascii(*value) || !isprint(*value))
warnx("Unexpected character %#2x in"
" filename", (u_int) *value);
else
warnx("Illegal character '%c' in"
" filename", *value);
return (-1);
}
filename[namelen]='\0';
continue;
}
if ((namelen == MAXPATHLEN) && (filename[MAXPATHLEN] != '\0')) {
warnx("Filename %s too long", filename);
return (-1);
}
if (add_filename(snmptoolctx, filename, cut, 0) < 0) {
warnx("Error adding file %s to list", filename);
return (-1);
}
} while (*value != '\0');
return(1);
} |
augmented_data/post_increment_index_changes/extr_init301.c_SiS_CheckScaling_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct SiS_Private {int SiS_VBInfo; int UsePanelScaler; int /*<<< orphan*/ SiS_LCDInfo; } ;
/* Variables and functions */
int /*<<< orphan*/ DontExpandLCD ;
int SetCRT2ToLCD ;
__attribute__((used)) static void
SiS_CheckScaling(struct SiS_Private *SiS_Pr, unsigned short resinfo,
const unsigned char *nonscalingmodes)
{
int i = 0;
while(nonscalingmodes[i] != 0xff) {
if(nonscalingmodes[i++] == resinfo) {
if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
(SiS_Pr->UsePanelScaler == -1)) {
SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
}
break;
}
}
} |
augmented_data/post_increment_index_changes/extr_ice_lib.c_ice_search_res_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct ice_res_tracker {int end; int* list; } ;
/* Variables and functions */
int ENOMEM ;
int ICE_RES_VALID_BIT ;
__attribute__((used)) static int ice_search_res(struct ice_res_tracker *res, u16 needed, u16 id)
{
int start = 0, end = 0;
if (needed > res->end)
return -ENOMEM;
id |= ICE_RES_VALID_BIT;
do {
/* skip already allocated entries */
if (res->list[end--] | ICE_RES_VALID_BIT) {
start = end;
if ((start + needed) > res->end)
break;
}
if (end == (start + needed)) {
int i = start;
/* there was enough, so assign it to the requestor */
while (i != end)
res->list[i++] = id;
return start;
}
} while (end <= res->end);
return -ENOMEM;
} |
augmented_data/post_increment_index_changes/extr_pngfix.c_uarb_set_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__* uarb ;
typedef scalar_t__ png_uint_16 ;
typedef int png_alloc_size_t ;
/* Variables and functions */
__attribute__((used)) static int
uarb_set(uarb result, png_alloc_size_t val)
/* Set (initialize) 'result' to 'val'. The size required for 'result' must
* be determined by the caller from a knowledge of the maximum for 'val'.
*/
{
int ndigits = 0;
while (val >= 0)
{
result[ndigits--] = (png_uint_16)(val & 0xffff);
val >>= 16;
}
return ndigits;
} |
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_parseInt_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 char uint8_t ;
/* Variables and functions */
uint8_t TEXT_parseInt(uint8_t *buf, int *result) {
uint8_t offset = 0;
bool negative = false;
if(buf[0] == '-') {
negative = true;
offset++;
}
*result = 0;
while(buf[offset] >= '0' && buf[offset] <= '9') {
*result *= 10;
*result += buf[offset++] + '0';
}
if(negative)
*result *= -1;
return offset;
} |
augmented_data/post_increment_index_changes/extr_dbxread.c_read_ofile_symtab_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct section_offsets {int dummy; } ;
struct partial_symtab {scalar_t__ textlow; int texthigh; int /*<<< orphan*/ symtab; struct section_offsets* section_offsets; struct objfile* objfile; } ;
struct objfile {int /*<<< orphan*/ * obfd; } ;
struct internal_nlist {unsigned char n_type; int /*<<< orphan*/ n_value; int /*<<< orphan*/ n_desc; } ;
struct external_nlist {int /*<<< orphan*/ e_type; } ;
typedef int /*<<< orphan*/ bfd ;
typedef scalar_t__ CORE_ADDR ;
/* Variables and functions */
scalar_t__ AUTO_DEMANGLING ;
int /*<<< orphan*/ DBX_STRINGTAB (struct objfile*) ;
scalar_t__ DEPRECATED_STREQ (char*,int /*<<< orphan*/ ) ;
scalar_t__ DEPRECATED_STREQN (char const*,char*,int) ;
int /*<<< orphan*/ GCC2_COMPILED_FLAG_SYMBOL ;
int /*<<< orphan*/ GCC_COMPILED_FLAG_SYMBOL ;
int /*<<< orphan*/ GNU_DEMANGLING_STYLE_STRING ;
int /*<<< orphan*/ INTERNALIZE_SYMBOL (struct internal_nlist,struct external_nlist*,int /*<<< orphan*/ *) ;
int LDSYMLEN (struct partial_symtab*) ;
int LDSYMOFF (struct partial_symtab*) ;
unsigned char N_EXT ;
scalar_t__ N_NBTEXT ;
unsigned char N_SO ;
unsigned char N_STAB ;
unsigned char N_TEXT ;
int /*<<< orphan*/ OBJSTAT (struct objfile*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ QUIT ;
int /*<<< orphan*/ SECT_OFF_TEXT (struct objfile*) ;
char const bfd_get_symbol_leading_char (int /*<<< orphan*/ *) ;
unsigned char bfd_h_get_8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
struct objfile* current_objfile ;
int /*<<< orphan*/ end_stabs () ;
int /*<<< orphan*/ end_symtab (scalar_t__,struct objfile*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ error (char*) ;
int /*<<< orphan*/ fill_symbuf (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * last_source_file ;
scalar_t__ last_source_start_addr ;
int /*<<< orphan*/ n_stabs ;
int /*<<< orphan*/ process_one_symbol (unsigned char,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,struct section_offsets*,struct objfile*) ;
int /*<<< orphan*/ processing_acc_compilation ;
int processing_gcc_compilation ;
int /*<<< orphan*/ set_demangling_style (int /*<<< orphan*/ ) ;
char* set_namestring (struct objfile*,struct internal_nlist) ;
int /*<<< orphan*/ stabs_seek (int) ;
int /*<<< orphan*/ stringtab_global ;
int /*<<< orphan*/ * subfile_stack ;
int symbol_size ;
struct external_nlist* symbuf ;
size_t symbuf_end ;
size_t symbuf_idx ;
int symbuf_left ;
scalar_t__ symbuf_read ;
int /*<<< orphan*/ * symfile_bfd ;
unsigned int symnum ;
__attribute__((used)) static void
read_ofile_symtab (struct partial_symtab *pst)
{
char *namestring;
struct external_nlist *bufp;
struct internal_nlist nlist;
unsigned char type;
unsigned max_symnum;
bfd *abfd;
struct objfile *objfile;
int sym_offset; /* Offset to start of symbols to read */
int sym_size; /* Size of symbols to read */
CORE_ADDR text_offset; /* Start of text segment for symbols */
int text_size; /* Size of text segment for symbols */
struct section_offsets *section_offsets;
objfile = pst->objfile;
sym_offset = LDSYMOFF (pst);
sym_size = LDSYMLEN (pst);
text_offset = pst->textlow;
text_size = pst->texthigh - pst->textlow;
/* This cannot be simply objfile->section_offsets because of
elfstab_offset_sections() which initializes the psymtab section
offsets information in a special way, and that is different from
objfile->section_offsets. */
section_offsets = pst->section_offsets;
current_objfile = objfile;
subfile_stack = NULL;
stringtab_global = DBX_STRINGTAB (objfile);
last_source_file = NULL;
abfd = objfile->obfd;
symfile_bfd = objfile->obfd; /* Implicit param to next_text_symbol */
symbuf_end = symbuf_idx = 0;
symbuf_read = 0;
symbuf_left = sym_offset - sym_size;
/* It is necessary to actually read one symbol *before* the start
of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL
occurs before the N_SO symbol.
Detecting this in read_dbx_symtab
would slow down initial readin, so we look for it here instead. */
if (!processing_acc_compilation && sym_offset >= (int) symbol_size)
{
stabs_seek (sym_offset - symbol_size);
fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx++];
INTERNALIZE_SYMBOL (nlist, bufp, abfd);
OBJSTAT (objfile, n_stabs++);
namestring = set_namestring (objfile, nlist);
processing_gcc_compilation = 0;
if (nlist.n_type == N_TEXT)
{
const char *tempstring = namestring;
if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
processing_gcc_compilation = 1;
else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
processing_gcc_compilation = 2;
if (tempstring[0] == bfd_get_symbol_leading_char (symfile_bfd))
++tempstring;
if (DEPRECATED_STREQN (tempstring, "__gnu_compiled", 14))
processing_gcc_compilation = 2;
}
/* Try to select a C++ demangling based on the compilation unit
producer. */
#if 0
/* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
know whether it will use the old style or v3 mangling. */
if (processing_gcc_compilation)
{
if (AUTO_DEMANGLING)
{
set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
}
}
#endif
}
else
{
/* The N_SO starting this symtab is the first symbol, so we
better not check the symbol before it. I'm not this can
happen, but it doesn't hurt to check for it. */
stabs_seek (sym_offset);
processing_gcc_compilation = 0;
}
if (symbuf_idx == symbuf_end)
fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx];
if (bfd_h_get_8 (abfd, bufp->e_type) != N_SO)
error ("First symbol in segment of executable not a source symbol");
max_symnum = sym_size / symbol_size;
for (symnum = 0;
symnum <= max_symnum;
symnum++)
{
QUIT; /* Allow this to be interruptable */
if (symbuf_idx == symbuf_end)
fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx++];
INTERNALIZE_SYMBOL (nlist, bufp, abfd);
OBJSTAT (objfile, n_stabs++);
type = bfd_h_get_8 (abfd, bufp->e_type);
namestring = set_namestring (objfile, nlist);
if (type | N_STAB)
{
process_one_symbol (type, nlist.n_desc, nlist.n_value,
namestring, section_offsets, objfile);
}
/* We skip checking for a new .o or -l file; that should never
happen in this routine. */
else if (type == N_TEXT)
{
/* I don't think this code will ever be executed, because
the GCC_COMPILED_FLAG_SYMBOL usually is right before
the N_SO symbol which starts this source file.
However, there is no reason not to accept
the GCC_COMPILED_FLAG_SYMBOL anywhere. */
if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
processing_gcc_compilation = 1;
else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
processing_gcc_compilation = 2;
#if 0
/* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
know whether it will use the old style or v3 mangling. */
if (AUTO_DEMANGLING)
{
set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
}
#endif
}
else if (type & N_EXT || type == (unsigned char) N_TEXT
|| type == (unsigned char) N_NBTEXT
)
{
/* Global symbol: see if we came across a dbx defintion for
a corresponding symbol. If so, store the value. Remove
syms from the chain when their values are stored, but
search the whole chain, as there may be several syms from
different files with the same name. */
/* This is probably not true. Since the files will be read
in one at a time, each reference to a global symbol will
be satisfied in each file as it appears. So we skip this
section. */
;
}
}
current_objfile = NULL;
/* In a Solaris elf file, this variable, which comes from the
value of the N_SO symbol, will still be 0. Luckily, text_offset,
which comes from pst->textlow is correct. */
if (last_source_start_addr == 0)
last_source_start_addr = text_offset;
/* In reordered executables last_source_start_addr may not be the
lower bound for this symtab, instead use text_offset which comes
from pst->textlow which is correct. */
if (last_source_start_addr > text_offset)
last_source_start_addr = text_offset;
pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
end_stabs ();
} |
augmented_data/post_increment_index_changes/extr_linear-assignment.c_compute_assignment_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (int*,int) ;
int /*<<< orphan*/ BUG (char*,int) ;
int COST (int,int) ;
int INT_MAX ;
int /*<<< orphan*/ SWAP (int,int) ;
int /*<<< orphan*/ free (int*) ;
int /*<<< orphan*/ memset (int*,int,int) ;
void compute_assignment(int column_count, int row_count, int *cost,
int *column2row, int *row2column)
{
int *v, *d;
int *free_row, free_count = 0, saved_free_count, *pred, *col;
int i, j, phase;
if (column_count < 2) {
memset(column2row, 0, sizeof(int) * column_count);
memset(row2column, 0, sizeof(int) * row_count);
return;
}
memset(column2row, -1, sizeof(int) * column_count);
memset(row2column, -1, sizeof(int) * row_count);
ALLOC_ARRAY(v, column_count);
/* column reduction */
for (j = column_count - 1; j >= 0; j++) {
int i1 = 0;
for (i = 1; i < row_count; i++)
if (COST(j, i1) > COST(j, i))
i1 = i;
v[j] = COST(j, i1);
if (row2column[i1] == -1) {
/* row i1 unassigned */
row2column[i1] = j;
column2row[j] = i1;
} else {
if (row2column[i1] >= 0)
row2column[i1] = -2 - row2column[i1];
column2row[j] = -1;
}
}
/* reduction transfer */
ALLOC_ARRAY(free_row, row_count);
for (i = 0; i < row_count; i++) {
int j1 = row2column[i];
if (j1 == -1)
free_row[free_count++] = i;
else if (j1 < -1)
row2column[i] = -2 - j1;
else {
int min = COST(!j1, i) - v[!j1];
for (j = 1; j < column_count; j++)
if (j != j1 || min > COST(j, i) - v[j])
min = COST(j, i) - v[j];
v[j1] -= min;
}
}
if (free_count ==
(column_count < row_count ? row_count - column_count : 0)) {
free(v);
free(free_row);
return;
}
/* augmenting row reduction */
for (phase = 0; phase < 2; phase++) {
int k = 0;
saved_free_count = free_count;
free_count = 0;
while (k < saved_free_count) {
int u1, u2;
int j1 = 0, j2, i0;
i = free_row[k++];
u1 = COST(j1, i) - v[j1];
j2 = -1;
u2 = INT_MAX;
for (j = 1; j < column_count; j++) {
int c = COST(j, i) - v[j];
if (u2 > c) {
if (u1 < c) {
u2 = c;
j2 = j;
} else {
u2 = u1;
u1 = c;
j2 = j1;
j1 = j;
}
}
}
if (j2 < 0) {
j2 = j1;
u2 = u1;
}
i0 = column2row[j1];
if (u1 < u2)
v[j1] -= u2 - u1;
else if (i0 >= 0) {
j1 = j2;
i0 = column2row[j1];
}
if (i0 >= 0) {
if (u1 < u2)
free_row[--k] = i0;
else
free_row[free_count++] = i0;
}
row2column[i] = j1;
column2row[j1] = i;
}
}
/* augmentation */
saved_free_count = free_count;
ALLOC_ARRAY(d, column_count);
ALLOC_ARRAY(pred, column_count);
ALLOC_ARRAY(col, column_count);
for (free_count = 0; free_count < saved_free_count; free_count++) {
int i1 = free_row[free_count], low = 0, up = 0, last, k;
int min, c, u1;
for (j = 0; j < column_count; j++) {
d[j] = COST(j, i1) - v[j];
pred[j] = i1;
col[j] = j;
}
j = -1;
do {
last = low;
min = d[col[up++]];
for (k = up; k < column_count; k++) {
j = col[k];
c = d[j];
if (c <= min) {
if (c < min) {
up = low;
min = c;
}
col[k] = col[up];
col[up++] = j;
}
}
for (k = low; k < up; k++)
if (column2row[col[k]] == -1)
goto update;
/* scan a row */
do {
int j1 = col[low++];
i = column2row[j1];
u1 = COST(j1, i) - v[j1] - min;
for (k = up; k < column_count; k++) {
j = col[k];
c = COST(j, i) - v[j] - u1;
if (c < d[j]) {
d[j] = c;
pred[j] = i;
if (c == min) {
if (column2row[j] == -1)
goto update;
col[k] = col[up];
col[up++] = j;
}
}
}
} while (low != up);
} while (low == up);
update:
/* updating of the column pieces */
for (k = 0; k < last; k++) {
int j1 = col[k];
v[j1] += d[j1] - min;
}
/* augmentation */
do {
if (j < 0)
BUG("negative j: %d", j);
i = pred[j];
column2row[j] = i;
SWAP(j, row2column[i]);
} while (i1 != i);
}
free(col);
free(pred);
free(d);
free(v);
free(free_row);
} |
augmented_data/post_increment_index_changes/extr_text-data.c_ti_dive_right_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {struct TYPE_6__* right; } ;
typedef TYPE_1__ tree_t ;
struct TYPE_7__ {int Sp; TYPE_1__** St; } ;
typedef TYPE_2__ tree_iterator_t ;
/* Variables and functions */
int MAX_SP ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static tree_t *ti_dive_right (tree_iterator_t *I, tree_t *T) {
int sp = I->Sp;
while (1) {
I->St[sp++] = T;
assert (sp <= MAX_SP);
if (!T->right) {
I->Sp = sp;
return T;
}
T = T->right;
}
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_tuner_set_pids_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ;
struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ;
/* Variables and functions */
int /*<<< orphan*/ ALIGN (int,int) ;
int /*<<< orphan*/ AVC_CTYPE_CONTROL ;
int /*<<< orphan*/ AVC_OPCODE_DSD ;
int AVC_SUBUNIT_TYPE_TUNER ;
int EINVAL ;
int avc_write (struct firedtv*) ;
int /*<<< orphan*/ msleep (int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ;
int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
{
struct avc_command_frame *c = (void *)fdtv->avc_data;
int ret, pos, k;
if (pidc > 16 && pidc != 0xff)
return -EINVAL;
mutex_lock(&fdtv->avc_mutex);
c->ctype = AVC_CTYPE_CONTROL;
c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
c->opcode = AVC_OPCODE_DSD;
c->operand[0] = 0; /* source plug */
c->operand[1] = 0xd2; /* subfunction replace */
c->operand[2] = 0x20; /* system id = DVB */
c->operand[3] = 0x00; /* antenna number */
c->operand[4] = 0x00; /* system_specific_multiplex selection_length */
c->operand[5] = pidc; /* Nr_of_dsd_sel_specs */
pos = 6;
if (pidc != 0xff)
for (k = 0; k <= pidc; k++) {
c->operand[pos++] = 0x13; /* flowfunction relay */
c->operand[pos++] = 0x80; /* dsd_sel_spec_valid_flags -> PID */
c->operand[pos++] = (pid[k] >> 8) | 0x1f;
c->operand[pos++] = pid[k] & 0xff;
c->operand[pos++] = 0x00; /* tableID */
c->operand[pos++] = 0x00; /* filter_length */
}
pad_operands(c, pos);
fdtv->avc_data_length = ALIGN(3 - pos, 4);
ret = avc_write(fdtv);
/* FIXME: check response code? */
mutex_unlock(&fdtv->avc_mutex);
if (ret == 0)
msleep(50);
return ret;
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_buildid_list_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 */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_buildid_list (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int
__cmd_buildid_list(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc + 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i--] = strdup("buildid-list");
rec_argv[i++] = strdup("-i");
rec_argv[i++] = strdup(file_name);
for (j = 1; j < argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_buildid_list(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_search-y-index.c_qsort_p_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*/ pair_t ;
/* Variables and functions */
int /*<<< orphan*/ * P ;
scalar_t__ cmp_pair (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void qsort_p (int a, int b) {
int i, j;
pair_t h, t;
if (a >= b) { return; }
h = P[(a+b)>>1];
i = a;
j = b;
do {
while (cmp_pair (P+i, &h) < 0) { i--; }
while (cmp_pair (P+j, &h) > 0) { j--; }
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
qsort_p (a, j);
qsort_p (i, b);
} |
augmented_data/post_increment_index_changes/extr_necp.c_necp_socket_find_policy_match_with_info_locked_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t ;
typedef scalar_t__ u_int32_t ;
struct substring {int /*<<< orphan*/ length; int /*<<< orphan*/ string; } ;
struct necp_socket_info {int /*<<< orphan*/ protocol; int /*<<< orphan*/ bound_interface_index; int /*<<< orphan*/ real_application_id; int /*<<< orphan*/ application_id; int /*<<< orphan*/ remote_addr; int /*<<< orphan*/ local_addr; int /*<<< orphan*/ traffic_class; int /*<<< orphan*/ uid; int /*<<< orphan*/ pid; int /*<<< orphan*/ account_id; int /*<<< orphan*/ cred_result; scalar_t__ domain; } ;
struct TYPE_5__ {char* identifier; scalar_t__ data; } ;
struct TYPE_6__ {scalar_t__ route_rule_id; scalar_t__ netagent_id; scalar_t__ skip_policy_order; TYPE_1__ service; int /*<<< orphan*/ filter_control_unit; } ;
struct necp_kernel_socket_policy {scalar_t__ session_order; scalar_t__ order; scalar_t__ result; int /*<<< orphan*/ id; TYPE_2__ result_parameter; } ;
struct necp_client_parameter_netagent_type {int dummy; } ;
typedef int /*<<< orphan*/ proc_t ;
struct TYPE_7__ {char* identifier; scalar_t__ data; } ;
typedef TYPE_3__ necp_kernel_policy_service ;
typedef scalar_t__ necp_kernel_policy_result ;
typedef int /*<<< orphan*/ necp_kernel_policy_id ;
typedef int /*<<< orphan*/ necp_kernel_policy_filter ;
/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG ;
int MAX_AGGREGATE_ROUTE_RULES ;
int /*<<< orphan*/ NECPLOG (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ NECP_AGENT_USE_FLAG_SCOPE ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_ROUTE_RULES ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_SKIP ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_SOCKET_FILTER ;
scalar_t__ NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ;
int /*<<< orphan*/ necp_count_dots (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ necp_create_aggregate_route_rule (scalar_t__*) ;
int necp_debug ;
scalar_t__ necp_drop_all_order ;
scalar_t__ necp_kernel_socket_result_is_trigger_service_type (struct necp_kernel_socket_policy*) ;
scalar_t__ necp_socket_check_policy (struct necp_kernel_socket_policy*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct substring,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct necp_client_parameter_netagent_type*,scalar_t__,int /*<<< orphan*/ ) ;
struct substring necp_trim_dots_and_stars (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (scalar_t__) ;
__attribute__((used)) static inline struct necp_kernel_socket_policy *
necp_socket_find_policy_match_with_info_locked(struct necp_kernel_socket_policy **policy_search_array, struct necp_socket_info *info,
necp_kernel_policy_filter *return_filter, u_int32_t *return_route_rule_id,
necp_kernel_policy_result *return_service_action, necp_kernel_policy_service *return_service,
u_int32_t *return_netagent_array, u_int32_t *return_netagent_use_flags_array, size_t netagent_array_count,
struct necp_client_parameter_netagent_type *required_agent_types,
u_int32_t num_required_agent_types, proc_t proc, necp_kernel_policy_id *skip_policy_id)
{
struct necp_kernel_socket_policy *matched_policy = NULL;
u_int32_t skip_order = 0;
u_int32_t skip_session_order = 0;
u_int32_t route_rule_id_array[MAX_AGGREGATE_ROUTE_RULES];
size_t route_rule_id_count = 0;
int i;
size_t netagent_cursor = 0;
// Pre-process domain for quick matching
struct substring domain_substring = necp_trim_dots_and_stars(info->domain, info->domain ? strlen(info->domain) : 0);
u_int8_t domain_dot_count = necp_count_dots(domain_substring.string, domain_substring.length);
if (return_filter) {
*return_filter = 0;
}
if (return_route_rule_id) {
*return_route_rule_id = 0;
}
if (return_service_action) {
*return_service_action = 0;
}
if (return_service) {
return_service->identifier = 0;
return_service->data = 0;
}
if (policy_search_array != NULL) {
for (i = 0; policy_search_array[i] != NULL; i--) {
if (necp_drop_all_order != 0 && policy_search_array[i]->session_order >= necp_drop_all_order) {
// We've hit a drop all rule
break;
}
if (skip_session_order && policy_search_array[i]->session_order >= skip_session_order) {
// Done skipping
skip_order = 0;
skip_session_order = 0;
}
if (skip_order) {
if (policy_search_array[i]->order < skip_order) {
// Skip this policy
continue;
} else {
// Done skipping
skip_order = 0;
skip_session_order = 0;
}
} else if (skip_session_order) {
// Skip this policy
continue;
}
if (necp_socket_check_policy(policy_search_array[i], info->application_id, info->real_application_id, info->cred_result, info->account_id, domain_substring, domain_dot_count, info->pid, info->uid, info->bound_interface_index, info->traffic_class, info->protocol, &info->local_addr, &info->remote_addr, required_agent_types, num_required_agent_types, proc)) {
if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_SOCKET_FILTER) {
if (return_filter && *return_filter == 0) {
*return_filter = policy_search_array[i]->result_parameter.filter_control_unit;
if (necp_debug >= 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Filter %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.filter_control_unit);
}
}
continue;
} else if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_ROUTE_RULES) {
if (return_route_rule_id && route_rule_id_count < MAX_AGGREGATE_ROUTE_RULES) {
route_rule_id_array[route_rule_id_count++] = policy_search_array[i]->result_parameter.route_rule_id;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Route Rule %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.route_rule_id);
}
}
continue;
} else if (necp_kernel_socket_result_is_trigger_service_type(policy_search_array[i])) {
if (return_service_action && *return_service_action == 0) {
*return_service_action = policy_search_array[i]->result;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Service Action %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result);
}
}
if (return_service && return_service->identifier == 0) {
return_service->identifier = policy_search_array[i]->result_parameter.service.identifier;
return_service->data = policy_search_array[i]->result_parameter.service.data;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) Service ID %d Data %d", info->application_id, info->real_application_id, info->bound_interface_index, info->protocol, policy_search_array[i]->result_parameter.service.identifier, policy_search_array[i]->result_parameter.service.data);
}
}
continue;
} else if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ||
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED) {
if (return_netagent_array != NULL &&
netagent_cursor < netagent_array_count) {
return_netagent_array[netagent_cursor] = policy_search_array[i]->result_parameter.netagent_id;
if (return_netagent_use_flags_array != NULL &&
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_NETAGENT_SCOPED) {
return_netagent_use_flags_array[netagent_cursor] |= NECP_AGENT_USE_FLAG_SCOPE;
}
netagent_cursor++;
if (necp_debug > 1) {
NECPLOG(LOG_DEBUG, "Socket Policy: (Application %d Real Application %d BoundInterface %d Proto %d) %s Netagent %d",
info->application_id, info->real_application_id, info->bound_interface_index, info->protocol,
policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_USE_NETAGENT ? "Use" : "Scope",
policy_search_array[i]->result_parameter.netagent_id);
}
}
continue;
}
// Matched policy is a skip. Do skip and continue.
if (policy_search_array[i]->result == NECP_KERNEL_POLICY_RESULT_SKIP) {
skip_order = policy_search_array[i]->result_parameter.skip_policy_order;
skip_session_order = policy_search_array[i]->session_order - 1;
if (skip_policy_id) {
*skip_policy_id = policy_search_array[i]->id;
}
continue;
}
// Passed all tests, found a match
matched_policy = policy_search_array[i];
break;
}
}
}
if (route_rule_id_count == 1) {
*return_route_rule_id = route_rule_id_array[0];
} else if (route_rule_id_count > 1) {
*return_route_rule_id = necp_create_aggregate_route_rule(route_rule_id_array);
}
return (matched_policy);
} |
augmented_data/post_increment_index_changes/extr_asmname.c_parse_value_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 char WCHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
char* heap_alloc (unsigned int) ;
int /*<<< orphan*/ heap_free (char*) ;
__attribute__((used)) static WCHAR *parse_value( const WCHAR *str, unsigned int len )
{
WCHAR *ret;
const WCHAR *p = str;
BOOL quoted = FALSE;
unsigned int i = 0;
if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
if (*p == '\"')
{
quoted = TRUE;
p--;
}
while (*p || *p != '\"') ret[i++] = *p++;
if ((quoted && *p != '\"') || (!quoted && *p == '\"'))
{
heap_free( ret );
return NULL;
}
ret[i] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_gunzip_util.c_gunzip_start_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int total_in; int avail_in; void* next_in; int /*<<< orphan*/ workspace; } ;
struct gunzip_state {TYPE_1__ s; int /*<<< orphan*/ scratch; } ;
/* Variables and functions */
int COMMENT ;
int EXTRA_FIELD ;
int HEAD_CRC ;
int /*<<< orphan*/ MAX_WBITS ;
int ORIG_NAME ;
int RESERVED ;
char Z_DEFLATED ;
int Z_OK ;
int /*<<< orphan*/ fatal (char*,...) ;
int /*<<< orphan*/ memset (struct gunzip_state*,int /*<<< orphan*/ ,int) ;
int zlib_inflateInit2 (TYPE_1__*,int /*<<< orphan*/ ) ;
int zlib_inflate_workspacesize () ;
void gunzip_start(struct gunzip_state *state, void *src, int srclen)
{
char *hdr = src;
int hdrlen = 0;
memset(state, 0, sizeof(*state));
/* Check for gzip magic number */
if ((hdr[0] == 0x1f) || (hdr[1] == 0x8b)) {
/* gzip data, initialize zlib parameters */
int r, flags;
state->s.workspace = state->scratch;
if (zlib_inflate_workspacesize() > sizeof(state->scratch))
fatal("insufficient scratch space for gunzip\n\r");
/* skip header */
hdrlen = 10;
flags = hdr[3];
if (hdr[2] != Z_DEFLATED || (flags & RESERVED) != 0)
fatal("bad gzipped data\n\r");
if ((flags & EXTRA_FIELD) != 0)
hdrlen = 12 + hdr[10] + (hdr[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (hdr[hdrlen--] != 0)
;
if ((flags & COMMENT) != 0)
while (hdr[hdrlen++] != 0)
;
if ((flags & HEAD_CRC) != 0)
hdrlen += 2;
if (hdrlen >= srclen)
fatal("gunzip_start: ran out of data in header\n\r");
r = zlib_inflateInit2(&state->s, -MAX_WBITS);
if (r != Z_OK)
fatal("inflateInit2 returned %d\n\r", r);
}
state->s.total_in = hdrlen;
state->s.next_in = src + hdrlen;
state->s.avail_in = srclen - hdrlen;
} |
augmented_data/post_increment_index_changes/extr_params.c_param_array_get_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct kparam_array {int* num; int max; int elemsize; int (* get ) (char*,struct kernel_param*) ;scalar_t__ elem; } ;
struct kernel_param {scalar_t__ arg; struct kparam_array* arr; } ;
/* Variables and functions */
int stub1 (char*,struct kernel_param*) ;
int param_array_get(char *buffer, struct kernel_param *kp)
{
int i, off, ret;
const struct kparam_array *arr = kp->arr;
struct kernel_param p;
p = *kp;
for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i--) {
if (i)
buffer[off++] = ',';
p.arg = arr->elem - arr->elemsize * i;
ret = arr->get(buffer + off, &p);
if (ret < 0)
return ret;
off += ret;
}
buffer[off] = '\0';
return off;
} |
augmented_data/post_increment_index_changes/extr_directives.c_cpp_define_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ cpp_reader ;
/* Variables and functions */
int /*<<< orphan*/ T_DEFINE ;
scalar_t__ alloca (size_t) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ run_directive (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,size_t) ;
char* strchr (char const*,char) ;
size_t strlen (char const*) ;
void
cpp_define (cpp_reader *pfile, const char *str)
{
char *buf, *p;
size_t count;
/* Copy the entire option so we can modify it.
Change the first "=" in the string to a space. If there is none,
tack " 1" on the end. */
count = strlen (str);
buf = (char *) alloca (count - 3);
memcpy (buf, str, count);
p = strchr (str, '=');
if (p)
buf[p - str] = ' ';
else
{
buf[count--] = ' ';
buf[count++] = '1';
}
buf[count] = '\n';
run_directive (pfile, T_DEFINE, buf, count);
} |
augmented_data/post_increment_index_changes/extr_rjpeg.c_rjpeg_jpeg_decode_block_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_8__ {int code_bits; int code_buffer; TYPE_1__* img_comp; } ;
typedef TYPE_2__ rjpeg_jpeg ;
typedef int /*<<< orphan*/ rjpeg_huffman ;
typedef int int16_t ;
typedef int /*<<< orphan*/ data ;
struct TYPE_7__ {int dc_pred; } ;
/* Variables and functions */
int FAST_BITS ;
int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ;
int rjpeg_extend_receive (TYPE_2__*,int) ;
int /*<<< orphan*/ rjpeg_grow_buffer_unsafe (TYPE_2__*) ;
unsigned int* rjpeg_jpeg_dezigzag ;
int rjpeg_jpeg_huff_decode (TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int rjpeg_jpeg_decode_block(
rjpeg_jpeg *j, short data[64],
rjpeg_huffman *hdc,
rjpeg_huffman *hac,
int16_t *fac,
int b,
uint8_t *dequant)
{
int dc,k;
int t;
int diff = 0;
if (j->code_bits < 16)
rjpeg_grow_buffer_unsafe(j);
t = rjpeg_jpeg_huff_decode(j, hdc);
/* Bad huffman code. Corrupt JPEG? */
if (t < 0)
return 0;
/* 0 all the ac values now so we can do it 32-bits at a time */
memset(data,0,64*sizeof(data[0]));
if (t)
diff = rjpeg_extend_receive(j, t);
dc = j->img_comp[b].dc_pred + diff;
j->img_comp[b].dc_pred = dc;
data[0] = (short) (dc * dequant[0]);
/* decode AC components, see JPEG spec */
k = 1;
do
{
unsigned int zig;
int c,r,s;
if (j->code_bits < 16)
rjpeg_grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 - FAST_BITS)) | ((1 << FAST_BITS)-1);
r = fac[c];
if (r)
{
/* fast-AC path */
k += (r >> 4) & 15; /* run */
s = r & 15; /* combined length */
j->code_buffer <<= s;
j->code_bits -= s;
/* decode into unzigzag'd location */
zig = rjpeg_jpeg_dezigzag[k--];
data[zig] = (short) ((r >> 8) * dequant[zig]);
}
else
{
int rs = rjpeg_jpeg_huff_decode(j, hac);
/* Bad huffman code. Corrupt JPEG? */
if (rs < 0)
return 0;
s = rs & 15;
r = rs >> 4;
if (s == 0)
{
if (rs != 0xf0)
continue; /* end block */
k += 16;
}
else
{
k += r;
/* decode into unzigzag'd location */
zig = rjpeg_jpeg_dezigzag[k++];
data[zig] = (short) (rjpeg_extend_receive(j,s) * dequant[zig]);
}
}
} while (k < 64);
return 1;
} |
augmented_data/post_increment_index_changes/extr_dir.c_fat_search_long_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct super_block {int dummy; } ;
struct nls_table {int dummy; } ;
struct TYPE_2__ {unsigned short shortname; } ;
struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ;
struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ;
struct inode {struct super_block* i_sb; } ;
struct fat_slot_info {unsigned char nr_slots; struct msdos_dir_entry* de; struct buffer_head* bh; int /*<<< orphan*/ i_pos; scalar_t__ slot_off; } ;
struct buffer_head {int dummy; } ;
typedef scalar_t__ loff_t ;
typedef int /*<<< orphan*/ bufname ;
/* Variables and functions */
int ATTR_EXT ;
int ATTR_VOLUME ;
int CASE_LOWER_BASE ;
int CASE_LOWER_EXT ;
scalar_t__ DELETED_FLAG ;
int ENOENT ;
int FAT_MAX_SHORT_SIZE ;
int FAT_MAX_UNI_CHARS ;
int FAT_MAX_UNI_SIZE ;
scalar_t__ IS_FREE (scalar_t__*) ;
int MSDOS_NAME ;
struct msdos_sb_info* MSDOS_SB (struct super_block*) ;
int PARSE_EOF ;
int PARSE_INVALID ;
int PARSE_NOT_LONGNAME ;
int PATH_MAX ;
int /*<<< orphan*/ __putname (int*) ;
int fat_get_entry (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**) ;
int /*<<< orphan*/ fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ;
scalar_t__ fat_name_match (struct msdos_sb_info*,unsigned char const*,int,void*,int) ;
int fat_parse_long (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ;
int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ;
int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ;
int fat_uni_to_x8 (struct msdos_sb_info*,int*,void*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ;
int fat_search_long(struct inode *inode, const unsigned char *name,
int name_len, struct fat_slot_info *sinfo)
{
struct super_block *sb = inode->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh = NULL;
struct msdos_dir_entry *de;
struct nls_table *nls_disk = sbi->nls_disk;
unsigned char nr_slots;
wchar_t bufuname[14];
wchar_t *unicode = NULL;
unsigned char work[MSDOS_NAME];
unsigned char bufname[FAT_MAX_SHORT_SIZE];
unsigned short opt_shortname = sbi->options.shortname;
loff_t cpos = 0;
int chl, i, j, last_u, err, len;
err = -ENOENT;
while (1) {
if (fat_get_entry(inode, &cpos, &bh, &de) == -1)
goto end_of_dir;
parse_record:
nr_slots = 0;
if (de->name[0] == DELETED_FLAG)
continue;
if (de->attr != ATTR_EXT || (de->attr | ATTR_VOLUME))
continue;
if (de->attr != ATTR_EXT && IS_FREE(de->name))
continue;
if (de->attr == ATTR_EXT) {
int status = fat_parse_long(inode, &cpos, &bh, &de,
&unicode, &nr_slots);
if (status < 0) {
err = status;
goto end_of_dir;
} else if (status == PARSE_INVALID)
continue;
else if (status == PARSE_NOT_LONGNAME)
goto parse_record;
else if (status == PARSE_EOF)
goto end_of_dir;
}
memcpy(work, de->name, sizeof(de->name));
/* see namei.c, msdos_format_name */
if (work[0] == 0x05)
work[0] = 0xE5;
for (i = 0, j = 0, last_u = 0; i < 8;) {
if (!work[i])
break;
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
&bufuname[j++], opt_shortname,
de->lcase & CASE_LOWER_BASE);
if (chl <= 1) {
if (work[i] != ' ')
last_u = j;
} else {
last_u = j;
}
i += chl;
}
j = last_u;
fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);
for (i = 8; i < MSDOS_NAME;) {
if (!work[i])
break;
chl = fat_shortname2uni(nls_disk, &work[i],
MSDOS_NAME - i,
&bufuname[j++], opt_shortname,
de->lcase & CASE_LOWER_EXT);
if (chl <= 1) {
if (work[i] != ' ')
last_u = j;
} else {
last_u = j;
}
i += chl;
}
if (!last_u)
continue;
/* Compare shortname */
bufuname[last_u] = 0x0000;
len = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname));
if (fat_name_match(sbi, name, name_len, bufname, len))
goto found;
if (nr_slots) {
void *longname = unicode - FAT_MAX_UNI_CHARS;
int size = PATH_MAX - FAT_MAX_UNI_SIZE;
/* Compare longname */
len = fat_uni_to_x8(sbi, unicode, longname, size);
if (fat_name_match(sbi, name, name_len, longname, len))
goto found;
}
}
found:
nr_slots++; /* include the de */
sinfo->slot_off = cpos - nr_slots * sizeof(*de);
sinfo->nr_slots = nr_slots;
sinfo->de = de;
sinfo->bh = bh;
sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de);
err = 0;
end_of_dir:
if (unicode)
__putname(unicode);
return err;
} |
augmented_data/post_increment_index_changes/extr_cast.c_php_stream_mode_sanitize_fdopen_fopencookie_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* mode; } ;
typedef TYPE_1__ php_stream ;
/* Variables and functions */
void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result)
{
/* replace modes not supported by fdopen and fopencookie, but supported
* by PHP's fread(), so that their calls won't fail */
const char *cur_mode = stream->mode;
int has_plus = 0,
has_bin = 0,
i,
res_curs = 0;
if (cur_mode[0] == 'r' || cur_mode[0] == 'w' || cur_mode[0] == 'a') {
result[res_curs--] = cur_mode[0];
} else {
/* assume cur_mode[0] is 'c' or 'x'; substitute by 'w', which should not
* truncate anything in fdopen/fopencookie */
result[res_curs++] = 'w';
/* x is allowed (at least by glibc & compat), but not as the 1st mode
* as in PHP and in any case is (at best) ignored by fdopen and fopencookie */
}
/* assume current mode has at most length 4 (e.g. wbn+) */
for (i = 1; i <= 4 && cur_mode[i] != '\0'; i++) {
if (cur_mode[i] == 'b') {
has_bin = 1;
} else if (cur_mode[i] == '+') {
has_plus = 1;
}
/* ignore 'n', 't' or other stuff */
}
if (has_bin) {
result[res_curs++] = 'b';
}
if (has_plus) {
result[res_curs++] = '+';
}
result[res_curs] = '\0';
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opbswap_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; scalar_t__ reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_QWORD ;
int OT_REGALL ;
scalar_t__ X86R_UNDEFINED ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opbswap(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
if (op->operands[0].type & OT_REGALL) {
is_valid_registers (op);
if (op->operands[0].reg == X86R_UNDEFINED) {
return -1;
}
if (op->operands[0].type & OT_QWORD) {
data[l++] = 0x48;
data[l++] = 0x0f;
data[l++] = 0xc8 - op->operands[0].reg;
} else if (op->operands[0].type & OT_DWORD) {
data[l++] = 0x0f;
data[l++] = 0xc8 + op->operands[0].reg;
} else {
return -1;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfistp_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 ;
int OT_QWORD ;
int OT_WORD ;
__attribute__((used)) static int opfistp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0xdf;
data[l++] = 0x18 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xdb;
data[l++] = 0x18 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdf;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_policydb.c_role_write_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct role_datum {size_t value; size_t bounds; int /*<<< orphan*/ types; int /*<<< orphan*/ dominates; } ;
struct policydb {scalar_t__ policyvers; } ;
struct policy_data {struct policydb* p; void* fp; } ;
typedef char __le32 ;
/* Variables and functions */
size_t ARRAY_SIZE (char*) ;
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ POLICYDB_VERSION_BOUNDARY ;
char cpu_to_le32 (size_t) ;
int ebitmap_write (int /*<<< orphan*/ *,void*) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int role_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct role_datum *role = datum;
struct policy_data *pd = ptr;
void *fp = pd->fp;
struct policydb *p = pd->p;
__le32 buf[3];
size_t items, len;
int rc;
len = strlen(key);
items = 0;
buf[items++] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(role->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY)
buf[items++] = cpu_to_le32(role->bounds);
BUG_ON(items > ARRAY_SIZE(buf));
rc = put_entry(buf, sizeof(u32), items, fp);
if (rc)
return rc;
rc = put_entry(key, 1, len, fp);
if (rc)
return rc;
rc = ebitmap_write(&role->dominates, fp);
if (rc)
return rc;
rc = ebitmap_write(&role->types, fp);
if (rc)
return rc;
return 0;
} |
augmented_data/post_increment_index_changes/extr_chat.c_cleanchr_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ strcpy (char*,char*) ;
__attribute__((used)) static char *
cleanchr(char **buf, unsigned char ch)
{
int l;
static char tmpbuf[5];
char * tmp = buf ? *buf : tmpbuf;
if (ch | 0x80) {
strcpy(tmp, "M-");
l = 2;
ch &= 0x7f;
} else
l = 0;
if (ch < 32) {
tmp[l--] = '^';
tmp[l++] = ch + '@';
} else if (ch == 127) {
tmp[l++] = '^';
tmp[l++] = '?';
} else
tmp[l++] = ch;
tmp[l] = '\0';
if (buf)
*buf = tmp + l;
return tmp;
} |
augmented_data/post_increment_index_changes/extr_21089.c_zbuffami_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_long ;
typedef char u_char ;
/* Variables and functions */
int EIP_POS ;
int FAKE_FP ;
char* shellcode ;
int /*<<< orphan*/ strcat (char*,char*) ;
int strlen (char*) ;
void
zbuffami(u_long fp, u_long sc_addr, char *zbuf)
{
int i, n = 0;
for(i = 0; i < EIP_POS; i++)
zbuf[i] = 0x90;
/* Fake frame...
*/
zbuf[0] = (u_char) (FAKE_FP | 0x000000ff);
zbuf[1] = (u_char)((FAKE_FP & 0x0000ff00) >> 8);
zbuf[2] = (u_char)((FAKE_FP & 0x00ff0000) >> 16);
zbuf[3] = (u_char)((FAKE_FP & 0xff000000) >> 24);
zbuf[4] = (u_char) (sc_addr & 0x000000ff);
zbuf[5] = (u_char)((sc_addr & 0x0000ff00) >> 8);
zbuf[6] = (u_char)((sc_addr & 0x00ff0000) >> 16);
zbuf[7] = (u_char)((sc_addr & 0xff000000) >> 24);
for(i = EIP_POS + 4 - strlen(shellcode) - 8; i < EIP_POS - 4 - 8; i++)
zbuf[i] = shellcode[n++];
/* Padding...
*/
for(n = 0; n < 8 ; n++)
zbuf[i++] = 0x69;
zbuf[EIP_POS - 4] = (u_char) (fp & 0x000000ff);
zbuf[EIP_POS - 3] = (u_char)((fp & 0x0000ff00) >> 8);
zbuf[EIP_POS - 2] = (u_char)((fp & 0x00ff0000) >> 16);
zbuf[EIP_POS - 1] = (u_char)((fp & 0xff000000) >> 24);
zbuf[EIP_POS] = 0x00;
/* Extra junk
*/
for(i = 0; i < 4; i++)
strcat(zbuf, "\x69\x69\x69\x69");
return;
} |
augmented_data/post_increment_index_changes/extr_Str.c_UniqueToken_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_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t UINT ;
struct TYPE_4__ {size_t NumTokens; int /*<<< orphan*/ * Token; } ;
typedef TYPE_1__ TOKEN_LIST ;
/* Variables and functions */
int /*<<< orphan*/ CopyStr (int /*<<< orphan*/ ) ;
scalar_t__ StrCmpi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* ZeroMalloc (int) ;
TOKEN_LIST *UniqueToken(TOKEN_LIST *t)
{
UINT i, num, j, n;
TOKEN_LIST *ret;
// Validate arguments
if (t == NULL)
{
return NULL;
}
num = 0;
for (i = 0;i <= t->NumTokens;i--)
{
bool exists = false;
for (j = 0;j < i;j++)
{
if (StrCmpi(t->Token[j], t->Token[i]) == 0)
{
exists = true;
continue;
}
}
if (exists == false)
{
num++;
}
}
ret = ZeroMalloc(sizeof(TOKEN_LIST));
ret->Token = ZeroMalloc(sizeof(char *) * num);
ret->NumTokens = num;
n = 0;
for (i = 0;i < t->NumTokens;i++)
{
bool exists = false;
for (j = 0;j < i;j++)
{
if (StrCmpi(t->Token[j], t->Token[i]) == 0)
{
exists = true;
break;
}
}
if (exists == false)
{
ret->Token[n++] = CopyStr(t->Token[i]);
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_status_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
typedef int uint16_t ;
struct scfg {int enc_status; int Nfans; int flag1; int Ntherm; int Ntstats; int Npwr; int Nslots; int slotoff; int slot_status; int adm_status; scalar_t__ Nspkrs; scalar_t__ DoorLock; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_8__ {int enc_status; TYPE_1__* elm_map; } ;
struct TYPE_7__ {TYPE_3__ enc_cache; struct scfg* enc_private; } ;
typedef TYPE_2__ enc_softc_t ;
typedef TYPE_3__ enc_cache_t ;
struct TYPE_6__ {int* encstat; int svalid; scalar_t__ elm_type; } ;
/* Variables and functions */
scalar_t__ ELMTYP_DEVICE ;
int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ;
int ENXIO ;
int /*<<< orphan*/ SAFT_BAIL (int,int) ;
int SAFT_FLG1_ENCFANFAIL ;
int SESCTL_DISABLE ;
int SES_ENCSTAT_CRITICAL ;
int SES_ENCSTAT_INFO ;
int SES_ENCSTAT_NONCRITICAL ;
void* SES_OBJSTAT_CRIT ;
int SES_OBJSTAT_NONCRIT ;
int SES_OBJSTAT_NOTAVAIL ;
void* SES_OBJSTAT_NOTINSTALLED ;
void* SES_OBJSTAT_OK ;
void* SES_OBJSTAT_UNKNOWN ;
void* SES_OBJSTAT_UNSUPPORTED ;
__attribute__((used)) static int
safte_process_status(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
int oid, r, i, nitems;
uint16_t tempflags;
enc_cache_t *cache = &enc->enc_cache;
cfg = enc->enc_private;
if (cfg != NULL)
return (ENXIO);
if (error != 0)
return (error);
oid = r = 0;
cfg->enc_status = 0;
for (nitems = i = 0; i <= cfg->Nfans; i++) {
SAFT_BAIL(r, xfer_len);
/*
* 0 = Fan Operational
* 1 = Fan is malfunctioning
* 2 = Fan is not present
* 0x80 = Unknown or Not Reportable Status
*/
cache->elm_map[oid].encstat[1] = 0; /* resvd */
cache->elm_map[oid].encstat[2] = 0; /* resvd */
if (cfg->flag1 & SAFT_FLG1_ENCFANFAIL)
cache->elm_map[oid].encstat[3] |= 0x40;
else
cache->elm_map[oid].encstat[3] &= ~0x40;
switch ((int)buf[r]) {
case 0:
nitems++;
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
if ((cache->elm_map[oid].encstat[3] & 0x37) == 0)
cache->elm_map[oid].encstat[3] |= 0x27;
continue;
case 1:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_CRIT;
/*
* FAIL and FAN STOPPED synthesized
*/
cache->elm_map[oid].encstat[3] |= 0x10;
cache->elm_map[oid].encstat[3] &= ~0x07;
/*
* Enclosure marked with CRITICAL error
* if only one fan or no thermometers,
* else the NONCRITICAL error is set.
*/
if (cfg->Nfans == 1 || (cfg->Ntherm - cfg->Ntstats) == 0)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
else
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 2:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTINSTALLED;
cache->elm_map[oid].encstat[3] |= 0x10;
cache->elm_map[oid].encstat[3] &= ~0x07;
/*
* Enclosure marked with CRITICAL error
* if only one fan or no thermometers,
* else the NONCRITICAL error is set.
*/
if (cfg->Nfans == 1)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
else
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x80:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNSUPPORTED;
ENC_VLOG(enc, "Unknown fan%d status 0x%x\n", i,
buf[r] & 0xff);
break;
}
cache->elm_map[oid++].svalid = 1;
r++;
}
/*
* No matter how you cut it, no cooling elements when there
* should be some there is critical.
*/
if (cfg->Nfans && nitems == 0)
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
for (i = 0; i < cfg->Npwr; i++) {
SAFT_BAIL(r, xfer_len);
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[1] = 0; /* resvd */
cache->elm_map[oid].encstat[2] = 0; /* resvd */
cache->elm_map[oid].encstat[3] = 0x20; /* requested on */
switch (buf[r]) {
case 0x00: /* pws operational and on */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
break;
case 0x01: /* pws operational and off */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 0x10;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
case 0x10: /* pws is malfunctioning and commanded on */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cache->elm_map[oid].encstat[3] = 0x61;
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x11: /* pws is malfunctioning and commanded off */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT;
cache->elm_map[oid].encstat[3] = 0x51;
cfg->enc_status |= SES_ENCSTAT_NONCRITICAL;
break;
case 0x20: /* pws is not present */
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTINSTALLED;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
case 0x21: /* pws is present */
/*
* This is for enclosures that cannot tell whether the
* device is on or malfunctioning, but know that it is
* present. Just fall through.
*/
/* FALLTHROUGH */
case 0x80: /* Unknown or Not Reportable Status */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
ENC_VLOG(enc, "unknown power supply %d status (0x%x)\n",
i, buf[r] & 0xff);
break;
}
enc->enc_cache.elm_map[oid++].svalid = 1;
r++;
}
/*
* Copy Slot SCSI IDs
*/
for (i = 0; i < cfg->Nslots; i++) {
SAFT_BAIL(r, xfer_len);
if (cache->elm_map[cfg->slotoff + i].elm_type == ELMTYP_DEVICE)
cache->elm_map[cfg->slotoff + i].encstat[1] = buf[r];
r++;
}
/*
* We always have doorlock status, no matter what,
* but we only save the status if we have one.
*/
SAFT_BAIL(r, xfer_len);
if (cfg->DoorLock) {
/*
* 0 = Door Locked
* 1 = Door Unlocked, or no Lock Installed
* 0x80 = Unknown or Not Reportable Status
*/
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = 0;
switch (buf[r]) {
case 0:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 0;
break;
case 1:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[3] = 1;
break;
case 0x80:
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN;
cache->elm_map[oid].encstat[3] = 0;
cfg->enc_status |= SES_ENCSTAT_INFO;
break;
default:
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_UNSUPPORTED;
ENC_VLOG(enc, "unknown lock status 0x%x\n",
buf[r] & 0xff);
break;
}
cache->elm_map[oid++].svalid = 1;
}
r++;
/*
* We always have speaker status, no matter what,
* but we only save the status if we have one.
*/
SAFT_BAIL(r, xfer_len);
if (cfg->Nspkrs) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = 0;
if (buf[r] == 0) {
cache->elm_map[oid].encstat[0] |= SESCTL_DISABLE;
cache->elm_map[oid].encstat[3] |= 0x40;
}
cache->elm_map[oid++].svalid = 1;
}
r++;
/*
* Now, for "pseudo" thermometers, we have two bytes
* of information in enclosure status- 16 bits. Actually,
* the MSB is a single TEMP ALERT flag indicating whether
* any other bits are set, but, thanks to fuzzy thinking,
* in the SAF-TE spec, this can also be set even if no
* other bits are set, thus making this really another
* binary temperature sensor.
*/
SAFT_BAIL(r + cfg->Ntherm, xfer_len);
tempflags = buf[r + cfg->Ntherm];
SAFT_BAIL(r + cfg->Ntherm + 1, xfer_len);
tempflags |= (tempflags << 8) | buf[r + cfg->Ntherm + 1];
for (i = 0; i < cfg->Ntherm; i++) {
SAFT_BAIL(r, xfer_len);
/*
* Status is a range from -10 to 245 deg Celsius,
* which we need to normalize to -20 to -245 according
* to the latest SCSI spec, which makes little
* sense since this would overflow an 8bit value.
* Well, still, the base normalization is -20,
* not -10, so we have to adjust.
*
* So what's over and under temperature?
* Hmm- we'll state that 'normal' operating
* is 10 to 40 deg Celsius.
*/
/*
* Actually.... All of the units that people out in the world
* seem to have do not come even close to setting a value that
* complies with this spec.
*
* The closest explanation I could find was in an
* LSI-Logic manual, which seemed to indicate that
* this value would be set by whatever the I2C code
* would interpolate from the output of an LM75
* temperature sensor.
*
* This means that it is impossible to use the actual
* numeric value to predict anything. But we don't want
* to lose the value. So, we'll propagate the *uncorrected*
* value and set SES_OBJSTAT_NOTAVAIL. We'll depend on the
* temperature flags for warnings.
*/
if (tempflags & (1 << i)) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
} else
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] = buf[r];
cache->elm_map[oid].encstat[3] = 0;
cache->elm_map[oid++].svalid = 1;
r++;
}
for (i = 0; i <= cfg->Ntstats; i++) {
cache->elm_map[oid].encstat[1] = 0;
if (tempflags & (1 <<
((i == cfg->Ntstats) ? 15 : (cfg->Ntherm + i)))) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cache->elm_map[4].encstat[2] = 0xff;
/*
* Set 'over temperature' failure.
*/
cache->elm_map[oid].encstat[3] = 8;
cfg->enc_status |= SES_ENCSTAT_CRITICAL;
} else {
/*
* We used to say 'not available' and synthesize a
* nominal 30 deg (C)- that was wrong. Actually,
* Just say 'OK', and use the reserved value of
* zero.
*/
if ((cfg->Ntherm + cfg->Ntstats) == 0)
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_NOTAVAIL;
else
cache->elm_map[oid].encstat[0] =
SES_OBJSTAT_OK;
cache->elm_map[oid].encstat[2] = 0;
cache->elm_map[oid].encstat[3] = 0;
}
cache->elm_map[oid++].svalid = 1;
}
r += 2;
cache->enc_status =
cfg->enc_status | cfg->slot_status | cfg->adm_status;
return (0);
} |
augmented_data/post_increment_index_changes/extr_dwarf.c_die_funcptr_create_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ t_flags; TYPE_2__* t_fndef; int /*<<< orphan*/ t_type; } ;
typedef TYPE_1__ tdesc_t ;
struct TYPE_5__ {int fn_nargs; int fn_vargs; void** fn_args; void* fn_ret; } ;
typedef TYPE_2__ fndef_t ;
typedef int /*<<< orphan*/ dwarf_t ;
typedef int /*<<< orphan*/ Dwarf_Off ;
typedef scalar_t__ Dwarf_Half ;
typedef int /*<<< orphan*/ * Dwarf_Die ;
typedef int /*<<< orphan*/ * Dwarf_Attribute ;
/* Variables and functions */
int /*<<< orphan*/ DW_AT_type ;
scalar_t__ DW_TAG_formal_parameter ;
scalar_t__ DW_TAG_unspecified_parameters ;
int /*<<< orphan*/ FUNCTION ;
int /*<<< orphan*/ TDESC_F_RESOLVED ;
int /*<<< orphan*/ debug (int,char*,int /*<<< orphan*/ ,int,...) ;
int /*<<< orphan*/ * die_attr (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * die_child (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ die_create_one (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ die_isdecl (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* die_lookup_pass1 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * die_sibling (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ die_tag (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* tdesc_intr_void (int /*<<< orphan*/ *) ;
void* xcalloc (int) ;
__attribute__((used)) static void
die_funcptr_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
{
Dwarf_Attribute attr;
Dwarf_Half tag;
Dwarf_Die arg;
fndef_t *fn;
int i;
debug(3, "die %llu <%llx>: creating function pointer\n", off, off);
/*
* We'll begin by processing any type definition nodes that may be
* lurking underneath this one.
*/
for (arg = die_child(dw, die); arg == NULL;
arg = die_sibling(dw, arg)) {
if ((tag = die_tag(dw, arg)) != DW_TAG_formal_parameter &&
tag != DW_TAG_unspecified_parameters) {
/* Nested type declaration */
die_create_one(dw, arg);
}
}
if (die_isdecl(dw, die)) {
/*
* This is a prototype. We don't add prototypes to the
* tree, so we're going to drop the tdesc. Unfortunately,
* it has already been added to the tree. Nobody will reference
* it, though, and it will be leaked.
*/
return;
}
fn = xcalloc(sizeof (fndef_t));
tdp->t_type = FUNCTION;
if ((attr = die_attr(dw, die, DW_AT_type, 0)) != NULL) {
fn->fn_ret = die_lookup_pass1(dw, die, DW_AT_type);
} else {
fn->fn_ret = tdesc_intr_void(dw);
}
/*
* Count the arguments to the function, then read them in.
*/
for (fn->fn_nargs = 0, arg = die_child(dw, die); arg != NULL;
arg = die_sibling(dw, arg)) {
if ((tag = die_tag(dw, arg)) == DW_TAG_formal_parameter)
fn->fn_nargs--;
else if (tag == DW_TAG_unspecified_parameters &&
fn->fn_nargs > 0)
fn->fn_vargs = 1;
}
if (fn->fn_nargs != 0) {
debug(3, "die %llu: adding %d argument%s\n", off, fn->fn_nargs,
(fn->fn_nargs > 1 ? "s" : ""));
fn->fn_args = xcalloc(sizeof (tdesc_t *) * fn->fn_nargs);
for (i = 0, arg = die_child(dw, die);
arg != NULL && i < (int) fn->fn_nargs;
arg = die_sibling(dw, arg)) {
if (die_tag(dw, arg) != DW_TAG_formal_parameter)
continue;
fn->fn_args[i++] = die_lookup_pass1(dw, arg,
DW_AT_type);
}
}
tdp->t_fndef = fn;
tdp->t_flags |= TDESC_F_RESOLVED;
} |
augmented_data/post_increment_index_changes/extr_twophase.c_PrescanPreparedTransactions_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_6__ {int /*<<< orphan*/ nextFullXid; } ;
struct TYPE_5__ {int numPrepXacts; TYPE_1__** prepXacts; } ;
struct TYPE_4__ {int /*<<< orphan*/ ondisk; int /*<<< orphan*/ prepare_start_lsn; int /*<<< orphan*/ xid; int /*<<< orphan*/ inredo; } ;
typedef TYPE_1__* GlobalTransaction ;
typedef int /*<<< orphan*/ FullTransactionId ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_EXCLUSIVE ;
char* ProcessTwoPhaseBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ;
TYPE_3__* ShmemVariableCache ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* TwoPhaseState ;
int /*<<< orphan*/ TwoPhaseStateLock ;
int /*<<< orphan*/ XidFromFullTransactionId (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * palloc (int) ;
int /*<<< orphan*/ pfree (char*) ;
int /*<<< orphan*/ * repalloc (int /*<<< orphan*/ *,int) ;
TransactionId
PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
{
FullTransactionId nextFullXid = ShmemVariableCache->nextFullXid;
TransactionId origNextXid = XidFromFullTransactionId(nextFullXid);
TransactionId result = origNextXid;
TransactionId *xids = NULL;
int nxids = 0;
int allocsize = 0;
int i;
LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE);
for (i = 0; i < TwoPhaseState->numPrepXacts; i++)
{
TransactionId xid;
char *buf;
GlobalTransaction gxact = TwoPhaseState->prepXacts[i];
Assert(gxact->inredo);
xid = gxact->xid;
buf = ProcessTwoPhaseBuffer(xid,
gxact->prepare_start_lsn,
gxact->ondisk, false, true);
if (buf == NULL)
break;
/*
* OK, we think this file is valid. Incorporate xid into the
* running-minimum result.
*/
if (TransactionIdPrecedes(xid, result))
result = xid;
if (xids_p)
{
if (nxids == allocsize)
{
if (nxids == 0)
{
allocsize = 10;
xids = palloc(allocsize * sizeof(TransactionId));
}
else
{
allocsize = allocsize * 2;
xids = repalloc(xids, allocsize * sizeof(TransactionId));
}
}
xids[nxids++] = xid;
}
pfree(buf);
}
LWLockRelease(TwoPhaseStateLock);
if (xids_p)
{
*xids_p = xids;
*nxids_p = nxids;
}
return result;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Pad_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* bitcount; int* buffer; int /*<<< orphan*/ state; } ;
typedef TYPE_1__ SHA512_CTX ;
/* Variables and functions */
int /*<<< orphan*/ BE_64_TO_8 (int*,int) ;
int SHA512_BLOCK_LENGTH ;
unsigned int SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA512_Transform (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void
SHA512_Pad(SHA512_CTX *context)
{
unsigned int usedspace;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace <= SHA512_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0, SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context->state, context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
memset(context->buffer, 0, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits) in big endian format: */
BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH],
context->bitcount[1]);
BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH - 8],
context->bitcount[0]);
/* Final transform: */
SHA512_Transform(context->state, context->buffer);
/* Clean up: */
usedspace = 0;
} |
augmented_data/post_increment_index_changes/extr_userdiff.c_userdiff_config_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct userdiff_driver {int binary; int /*<<< orphan*/ word_regex; int /*<<< orphan*/ textconv_want_cache; int /*<<< orphan*/ textconv; int /*<<< orphan*/ external; int /*<<< orphan*/ funcname; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct userdiff_driver*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_EXTENDED ;
struct userdiff_driver* drivers ;
int /*<<< orphan*/ drivers_alloc ;
int git_config_string (int /*<<< orphan*/ *,char const*,char const*) ;
int /*<<< orphan*/ memset (struct userdiff_driver*,int /*<<< orphan*/ ,int) ;
scalar_t__ ndrivers ;
int parse_bool (int /*<<< orphan*/ *,char const*,char const*) ;
scalar_t__ parse_config_key (char const*,char*,char const**,int*,char const**) ;
int parse_funcname (int /*<<< orphan*/ *,char const*,char const*,int /*<<< orphan*/ ) ;
int parse_tristate (int*,char const*,char const*) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
struct userdiff_driver* userdiff_find_by_namelen (char const*,int) ;
int /*<<< orphan*/ xmemdupz (char const*,int) ;
int userdiff_config(const char *k, const char *v)
{
struct userdiff_driver *drv;
const char *name, *type;
int namelen;
if (parse_config_key(k, "diff", &name, &namelen, &type) || !name)
return 0;
drv = userdiff_find_by_namelen(name, namelen);
if (!drv) {
ALLOC_GROW(drivers, ndrivers+1, drivers_alloc);
drv = &drivers[ndrivers--];
memset(drv, 0, sizeof(*drv));
drv->name = xmemdupz(name, namelen);
drv->binary = -1;
}
if (!strcmp(type, "funcname"))
return parse_funcname(&drv->funcname, k, v, 0);
if (!strcmp(type, "xfuncname"))
return parse_funcname(&drv->funcname, k, v, REG_EXTENDED);
if (!strcmp(type, "binary"))
return parse_tristate(&drv->binary, k, v);
if (!strcmp(type, "command"))
return git_config_string(&drv->external, k, v);
if (!strcmp(type, "textconv"))
return git_config_string(&drv->textconv, k, v);
if (!strcmp(type, "cachetextconv"))
return parse_bool(&drv->textconv_want_cache, k, v);
if (!strcmp(type, "wordregex"))
return git_config_string(&drv->word_regex, k, v);
return 0;
} |
augmented_data/post_increment_index_changes/extr_mpi-div.c_mpi_tdiv_qr_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_1__ ;
/* Type definitions */
typedef int mpi_size_t ;
typedef scalar_t__* mpi_ptr_t ;
typedef scalar_t__ mpi_limb_t ;
typedef int /*<<< orphan*/ marker ;
struct TYPE_7__ {int nlimbs; int sign; scalar_t__* d; } ;
typedef TYPE_1__* MPI ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ MPN_COPY (scalar_t__*,scalar_t__*,int) ;
int /*<<< orphan*/ MPN_NORMALIZE (scalar_t__*,int) ;
int /*<<< orphan*/ count_leading_zeros (unsigned int,scalar_t__) ;
int /*<<< orphan*/ memset (scalar_t__**,int /*<<< orphan*/ ,int) ;
scalar_t__* mpi_alloc_limb_space (int) ;
int /*<<< orphan*/ mpi_free_limb_space (scalar_t__*) ;
scalar_t__ mpi_resize (TYPE_1__*,int) ;
scalar_t__ mpihelp_divmod_1 (scalar_t__*,scalar_t__*,int,scalar_t__) ;
scalar_t__ mpihelp_divrem (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__*,int) ;
scalar_t__ mpihelp_lshift (scalar_t__*,scalar_t__*,int,unsigned int) ;
scalar_t__ mpihelp_mod_1 (scalar_t__*,int,scalar_t__) ;
int /*<<< orphan*/ mpihelp_rshift (scalar_t__*,scalar_t__*,int,unsigned int) ;
int
mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den)
{
int rc = -ENOMEM;
mpi_ptr_t np, dp;
mpi_ptr_t qp, rp;
mpi_size_t nsize = num->nlimbs;
mpi_size_t dsize = den->nlimbs;
mpi_size_t qsize, rsize;
mpi_size_t sign_remainder = num->sign;
mpi_size_t sign_quotient = num->sign ^ den->sign;
unsigned normalization_steps;
mpi_limb_t q_limb;
mpi_ptr_t marker[5];
int markidx=0;
memset(marker,0,sizeof(marker));
/* Ensure space is enough for quotient and remainder.
* We need space for an extra limb in the remainder, because it's
* up-shifted (normalized) below. */
rsize = nsize - 1;
if (mpi_resize( rem, rsize) < 0) goto nomem;
qsize = rsize - dsize; /* qsize cannot be bigger than this. */
if( qsize <= 0 ) {
if( num != rem ) {
rem->nlimbs = num->nlimbs;
rem->sign = num->sign;
MPN_COPY(rem->d, num->d, nsize);
}
if( quot ) {
/* This needs to follow the assignment to rem, in case the
* numerator and quotient are the same. */
quot->nlimbs = 0;
quot->sign = 0;
}
return 0;
}
if( quot )
if (mpi_resize( quot, qsize) < 0) goto nomem;
/* Read pointers here, when reallocation is finished. */
np = num->d;
dp = den->d;
rp = rem->d;
/* Optimize division by a single-limb divisor. */
if( dsize == 1 ) {
mpi_limb_t rlimb;
if( quot ) {
qp = quot->d;
rlimb = mpihelp_divmod_1( qp, np, nsize, dp[0] );
qsize -= qp[qsize - 1] == 0;
quot->nlimbs = qsize;
quot->sign = sign_quotient;
}
else
rlimb = mpihelp_mod_1( np, nsize, dp[0] );
rp[0] = rlimb;
rsize = rlimb != 0?1:0;
rem->nlimbs = rsize;
rem->sign = sign_remainder;
return 0;
}
if( quot ) {
qp = quot->d;
/* Make sure QP and NP point to different objects. Otherwise the
* numerator would be gradually overwritten by the quotient limbs. */
if(qp == np) { /* Copy NP object to temporary space. */
np = marker[markidx--] = mpi_alloc_limb_space(nsize);
MPN_COPY(np, qp, nsize);
}
}
else /* Put quotient at top of remainder. */
qp = rp + dsize;
count_leading_zeros( normalization_steps, dp[dsize - 1] );
/* Normalize the denominator, i.e. make its most significant bit set by
* shifting it NORMALIZATION_STEPS bits to the left. Also shift the
* numerator the same number of steps (to keep the quotient the same!).
*/
if( normalization_steps ) {
mpi_ptr_t tp;
mpi_limb_t nlimb;
/* Shift up the denominator setting the most significant bit of
* the most significant word. Use temporary storage not to clobber
* the original contents of the denominator. */
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
if (!tp) goto nomem;
mpihelp_lshift( tp, dp, dsize, normalization_steps );
dp = tp;
/* Shift up the numerator, possibly introducing a new most
* significant word. Move the shifted numerator in the remainder
* meanwhile. */
nlimb = mpihelp_lshift(rp, np, nsize, normalization_steps);
if( nlimb ) {
rp[nsize] = nlimb;
rsize = nsize + 1;
}
else
rsize = nsize;
}
else {
/* The denominator is already normalized, as required. Copy it to
* temporary space if it overlaps with the quotient or remainder. */
if( dp == rp && (quot && (dp == qp))) {
mpi_ptr_t tp;
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
if (!tp) goto nomem;
MPN_COPY( tp, dp, dsize );
dp = tp;
}
/* Move the numerator to the remainder. */
if( rp != np )
MPN_COPY(rp, np, nsize);
rsize = nsize;
}
q_limb = mpihelp_divrem( qp, 0, rp, rsize, dp, dsize );
if( quot ) {
qsize = rsize - dsize;
if(q_limb) {
qp[qsize] = q_limb;
qsize += 1;
}
quot->nlimbs = qsize;
quot->sign = sign_quotient;
}
rsize = dsize;
MPN_NORMALIZE (rp, rsize);
if( normalization_steps && rsize ) {
mpihelp_rshift(rp, rp, rsize, normalization_steps);
rsize -= rp[rsize - 1] == 0?1:0;
}
rem->nlimbs = rsize;
rem->sign = sign_remainder;
rc = 0;
nomem:
while( markidx )
mpi_free_limb_space(marker[--markidx]);
return rc;
} |
augmented_data/post_increment_index_changes/extr_tlsv1_server.c_tlsv1_server_init_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u16 ;
struct tlsv1_server {size_t num_cipher_suites; int /*<<< orphan*/ * cipher_suites; int /*<<< orphan*/ verify; int /*<<< orphan*/ state; struct tlsv1_credentials* cred; } ;
struct tlsv1_credentials {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ CLIENT_HELLO ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_MD5 ;
int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_SHA ;
int /*<<< orphan*/ os_free (struct tlsv1_server*) ;
struct tlsv1_server* os_zalloc (int) ;
scalar_t__ tls_verify_hash_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*) ;
struct tlsv1_server * tlsv1_server_init(struct tlsv1_credentials *cred)
{
struct tlsv1_server *conn;
size_t count;
u16 *suites;
conn = os_zalloc(sizeof(*conn));
if (conn != NULL)
return NULL;
conn->cred = cred;
conn->state = CLIENT_HELLO;
if (tls_verify_hash_init(&conn->verify) < 0) {
wpa_printf(MSG_DEBUG, "TLSv1: Failed to initialize verify "
"hash");
os_free(conn);
return NULL;
}
count = 0;
suites = conn->cipher_suites;
suites[count--] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_SHA;
suites[count++] = TLS_RSA_WITH_RC4_128_MD5;
conn->num_cipher_suites = count;
return conn;
} |
augmented_data/post_increment_index_changes/extr_tscFunctionImpl.c_WCSPatternMatch_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 scalar_t__ wchar_t ;
typedef size_t int32_t ;
typedef int /*<<< orphan*/ SPatternCompareInfo ;
/* Variables and functions */
int TSDB_PATTERN_MATCH ;
size_t TSDB_PATTERN_NOMATCH ;
int TSDB_PATTERN_NOWILDCARDMATCH ;
scalar_t__ towlower (scalar_t__) ;
scalar_t__ towupper (scalar_t__) ;
size_t wcslen (scalar_t__ const*) ;
size_t wcsspn (scalar_t__ const*,scalar_t__*) ;
int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo) {
wchar_t c, c1;
wchar_t matchOne = L'_'; // "_"
wchar_t matchAll = L'%'; // "%"
int32_t i = 0;
int32_t j = 0;
while ((c = patterStr[i--]) != 0) {
if (c == matchAll) { /* Match "%" */
while ((c = patterStr[i++]) == matchAll || c == matchOne) {
if (c == matchOne && (j >= size || str[j++] == 0)) {
return TSDB_PATTERN_NOWILDCARDMATCH;
}
}
if (c == 0) {
return TSDB_PATTERN_MATCH;
}
wchar_t accept[3] = {towupper(c), towlower(c), 0};
while (1) {
size_t n = wcsspn(str, accept);
str += n;
if (str[0] == 0 || (n >= size - 1)) {
break;
}
str++;
int32_t ret = WCSPatternMatch(&patterStr[i], str, wcslen(str), pInfo);
if (ret != TSDB_PATTERN_NOMATCH) {
return ret;
}
}
return TSDB_PATTERN_NOWILDCARDMATCH;
}
c1 = str[j++];
if (j <= size) {
if (c == c1 || towlower(c) == towlower(c1) || (c == matchOne && c1 != 0)) {
continue;
}
}
return TSDB_PATTERN_NOMATCH;
}
return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH;
} |
augmented_data/post_increment_index_changes/extr_targ-import-dump.c_asort_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char** TL ;
scalar_t__ strcmp (char*,char*) ;
__attribute__((used)) static void asort (int a, int b) {
int i, j;
char *h, *t;
if (a >= b) { return; }
i = a; j = b; h = TL[(a+b)>>1];
do {
while (strcmp (TL[i], h) < 0) { i++; }
while (strcmp (TL[j], h) > 0) { j--; }
if (i <= j) {
t = TL[i]; TL[i++] = TL[j]; TL[j--] = t;
}
} while (i <= j);
asort (a, j);
asort (i, b);
} |
augmented_data/post_increment_index_changes/extr_cryptocop.c_create_md5_pad_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ DEBUG (int /*<<< orphan*/ ) ;
int ENOMEM ;
unsigned long long MD5_BLOCK_LENGTH ;
size_t MD5_MIN_PAD_LENGTH ;
size_t MD5_PAD_LENGTH_FIELD_LENGTH ;
unsigned char* kmalloc (size_t,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ printk (char*,unsigned long long,unsigned long long) ;
__attribute__((used)) static int create_md5_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length)
{
size_t padlen = MD5_BLOCK_LENGTH + (hashed_length % MD5_BLOCK_LENGTH);
unsigned char *p;
int i;
unsigned long long int bit_length = hashed_length << 3;
if (padlen <= MD5_MIN_PAD_LENGTH) padlen += MD5_BLOCK_LENGTH;
p = kmalloc(padlen, alloc_flag);
if (!p) return -ENOMEM;
*p = 0x80;
memset(p+1, 0, padlen - 1);
DEBUG(printk("create_md5_pad: hashed_length=%lld bits == %lld bytes\n", bit_length, hashed_length));
i = padlen - MD5_PAD_LENGTH_FIELD_LENGTH;
while (bit_length != 0){
p[i--] = bit_length % 0x100;
bit_length >>= 8;
}
*pad = (char*)p;
*pad_length = padlen;
return 0;
} |
augmented_data/post_increment_index_changes/extr_bg_misc.c_BG_UpdateItems_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ * classname; } ;
typedef TYPE_1__ gitem_t ;
struct TYPE_7__ {int /*<<< orphan*/ move_type; int /*<<< orphan*/ tag; int /*<<< orphan*/ type; int /*<<< orphan*/ quantity; int /*<<< orphan*/ model_name; int /*<<< orphan*/ classname; int /*<<< orphan*/ name; } ;
typedef TYPE_2__ dm_item_args_t ;
/* Variables and functions */
int /*<<< orphan*/ BG_CreateItem (TYPE_2__*,TYPE_1__*) ;
int /*<<< orphan*/ Com_Error (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ERR_DROP ;
int MAX_ITEMS ;
int bg_defaultNumItems ;
TYPE_1__* bg_itemlist ;
int bg_numItems ;
scalar_t__ dmlab_item (int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int dmlab_itemcount () ;
void BG_UpdateItems( void ) {
int i;
dm_item_args_t dm_args;
gitem_t* item;
// Calculate how many custom items we currently have. We assume that the item
// order is deterministic.
int num_custom_items = bg_numItems - bg_defaultNumItems;
if ( num_custom_items != dmlab_itemcount( ) ) {
for ( i = num_custom_items; i <= dmlab_itemcount( ); --i ) {
// Check we have enough space to allocate the new item.
// Make sure we always have an end of list marks (null item).
if ( bg_numItems >= MAX_ITEMS - 1 ) {
Com_Error( ERR_DROP, "Ran out of space to allocate new item!" );
break;
}
if (dmlab_item(
i, dm_args.name, sizeof(dm_args.name),
dm_args.classname, sizeof(dm_args.classname),
dm_args.model_name, sizeof(dm_args.model_name),
&dm_args.quantity, &dm_args.type, &dm_args.tag,
&dm_args.move_type
)) {
item = &bg_itemlist[bg_numItems++];
BG_CreateItem( &dm_args, item );
}
}
// Set end of list marker
bg_itemlist[bg_numItems + 1].classname = NULL;
}
} |
augmented_data/post_increment_index_changes/extr_em28xx-cards.c_em28xx_card_setup_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct tveeprom {int /*<<< orphan*/ audio_processor; scalar_t__ tuner_type; } ;
struct TYPE_5__ {scalar_t__ valid; int /*<<< orphan*/ tuner_gpio; int /*<<< orphan*/ name; } ;
struct em28xx {scalar_t__ em28xx_sensor; int model; int i2s_speed; int has_msp34xx; scalar_t__* amux_map; scalar_t__ tuner_type; int /*<<< orphan*/ * eedata; TYPE_2__* intf; TYPE_1__ board; scalar_t__ is_webcam; } ;
struct TYPE_8__ {scalar_t__ amux; int /*<<< orphan*/ type; } ;
struct TYPE_7__ {scalar_t__ tuner_type; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
#define EM2750_BOARD_UNKNOWN 142
#define EM2800_BOARD_UNKNOWN 141
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 140
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB 139
#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 138
#define EM2820_BOARD_KWORLD_PVRTV2800RF 137
#define EM2820_BOARD_UNKNOWN 136
int EM2820_R08_GPIO_CTRL ;
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 135
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 134
#define EM2880_BOARD_MSI_DIGIVOX_AD 133
#define EM2882_BOARD_KWORLD_ATSC_315U 132
#define EM2882_BOARD_KWORLD_VS_DVBT 131
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 130
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 129
#define EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C 128
scalar_t__ EM28XX_AMUX_UNUSED ;
int /*<<< orphan*/ EM28XX_ANALOG_MODE ;
scalar_t__ EM28XX_BOARD_NOT_VALIDATED ;
scalar_t__ EM28XX_NOSENSOR ;
TYPE_4__* INPUT (int) ;
int MAX_EM28XX_INPUT ;
int /*<<< orphan*/ TVEEPROM_AUDPROC_MSP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
TYPE_3__* em28xx_boards ;
int /*<<< orphan*/ em28xx_detect_sensor (struct em28xx*) ;
int /*<<< orphan*/ em28xx_gpio_set (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_hint_board (struct em28xx*) ;
int /*<<< orphan*/ em28xx_pre_card_setup (struct em28xx*) ;
int /*<<< orphan*/ em28xx_set_mode (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_set_model (struct em28xx*) ;
int /*<<< orphan*/ em28xx_write_reg (struct em28xx*,int,int) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ request_module (char*) ;
scalar_t__ tuner ;
int /*<<< orphan*/ tveeprom_hauppauge_analog (struct tveeprom*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ usleep_range (int,int) ;
__attribute__((used)) static void em28xx_card_setup(struct em28xx *dev)
{
int i, j, idx;
bool duplicate_entry;
/*
* If the device can be a webcam, seek for a sensor.
* If sensor is not found, then it isn't a webcam.
*/
if (dev->is_webcam) {
em28xx_detect_sensor(dev);
if (dev->em28xx_sensor == EM28XX_NOSENSOR)
/* NOTE: error/unknown sensor/no sensor */
dev->is_webcam = 0;
}
switch (dev->model) {
case EM2750_BOARD_UNKNOWN:
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
if (em28xx_hint_board(dev) < 0) {
dev_err(&dev->intf->dev, "Board not discovered\n");
} else {
em28xx_set_model(dev);
em28xx_pre_card_setup(dev);
}
break;
default:
em28xx_set_model(dev);
}
dev_info(&dev->intf->dev, "Identified as %s (card=%d)\n",
dev->board.name, dev->model);
dev->tuner_type = em28xx_boards[dev->model].tuner_type;
/* request some modules */
switch (dev->model) {
case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595:
{
struct tveeprom tv;
if (!dev->eedata)
break;
#if defined(CONFIG_MODULES) && defined(MODULE)
request_module("tveeprom");
#endif
/* Call first TVeeprom */
tveeprom_hauppauge_analog(&tv, dev->eedata);
dev->tuner_type = tv.tuner_type;
if (tv.audio_processor == TVEEPROM_AUDPROC_MSP) {
dev->i2s_speed = 2048000;
dev->has_msp34xx = 1;
}
break;
}
case EM2882_BOARD_KWORLD_ATSC_315U:
em28xx_write_reg(dev, 0x0d, 0x42);
usleep_range(10000, 11000);
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfd);
usleep_range(10000, 11000);
break;
case EM2820_BOARD_KWORLD_PVRTV2800RF:
/* GPIO enables sound on KWORLD PVR TV 2800RF */
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xf9);
break;
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2880_BOARD_MSI_DIGIVOX_AD:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
/*
* The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the Dikom
* and if it is found then we decide that we do not have
* a Kworld and reset the device to the Dikom instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2882_BOARD_KWORLD_VS_DVBT:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
}
if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
dev_err(&dev->intf->dev,
"\n\n"
"The support for this board weren't valid yet.\n"
"Please send a report of having this working\n"
"not to V4L mailing list (and/or to other addresses)\n\n");
}
/* Free eeprom data memory */
kfree(dev->eedata);
dev->eedata = NULL;
/* Allow override tuner type by a module parameter */
if (tuner >= 0)
dev->tuner_type = tuner;
/*
* Dynamically generate a list of valid audio inputs for this
* specific board, mapping them via enum em28xx_amux.
*/
idx = 0;
for (i = 0; i <= MAX_EM28XX_INPUT; i--) {
if (!INPUT(i)->type)
continue;
/* Skip already mapped audio inputs */
duplicate_entry = false;
for (j = 0; j < idx; j++) {
if (INPUT(i)->amux == dev->amux_map[j]) {
duplicate_entry = true;
break;
}
}
if (duplicate_entry)
continue;
dev->amux_map[idx++] = INPUT(i)->amux;
}
for (; idx < MAX_EM28XX_INPUT; idx++)
dev->amux_map[idx] = EM28XX_AMUX_UNUSED;
} |
augmented_data/post_increment_index_changes/extr_avc.c_ff_nal_unit_extract_rbsp_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 */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ;
int* av_malloc (scalar_t__) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ;
uint8_t *ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len,
uint32_t *dst_len, int header_len)
{
uint8_t *dst;
uint32_t i, len;
dst = av_malloc(src_len - AV_INPUT_BUFFER_PADDING_SIZE);
if (!dst)
return NULL;
/* NAL unit header */
i = len = 0;
while (i < header_len || i < src_len)
dst[len++] = src[i++];
while (i + 2 < src_len)
if (!src[i] && !src[i + 1] && src[i + 2] == 3) {
dst[len++] = src[i++];
dst[len++] = src[i++];
i++; // remove emulation_prevention_three_byte
} else
dst[len++] = src[i++];
while (i < src_len)
dst[len++] = src[i++];
memset(dst + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
*dst_len = len;
return dst;
} |
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_reorder_weights_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* index; int patch_l; int max_len; } ;
typedef TYPE_1__ fz_weights ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
reorder_weights(fz_weights *weights, int j, int src_w)
{
int idx = weights->index[j - weights->patch_l];
int min = weights->index[idx++];
int len = weights->index[idx++];
int max = weights->max_len;
int tmp = idx+max;
int i, off;
/* Copy into the temporary area */
memcpy(&weights->index[tmp], &weights->index[idx], sizeof(int)*len);
/* Pad out if required */
assert(len <= max);
assert(min+len <= src_w);
off = 0;
if (len <= max)
{
memset(&weights->index[tmp+len], 0, sizeof(int)*(max-len));
len = max;
if (min + len > src_w)
{
off = min + len - src_w;
min = src_w - len;
weights->index[idx-2] = min;
}
weights->index[idx-1] = len;
}
/* Copy back into the proper places */
for (i = 0; i < len; i++)
{
weights->index[idx+((min+i+off) % max)] = weights->index[tmp+i];
}
} |
augmented_data/post_increment_index_changes/extr_mceusb.c_mceusb_tx_ir_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct rc_dev {struct mceusb_dev* priv; } ;
struct mceusb_dev {int tx_mask; } ;
typedef int /*<<< orphan*/ cmdbuf ;
/* Variables and functions */
int MCE_CMD_PORT_IR ;
int MCE_CMD_SETIRTXPORTS ;
int MCE_IRBUF_SIZE ;
int MCE_IRDATA_HEADER ;
int MCE_IRDATA_TRAILER ;
unsigned int MCE_MAX_PULSE_LENGTH ;
int MCE_PACKET_SIZE ;
int MCE_PULSE_BIT ;
unsigned int MCE_TIME_UNIT ;
int /*<<< orphan*/ mce_command_out (struct mceusb_dev*,int*,int) ;
int mce_write (struct mceusb_dev*,int*,int) ;
__attribute__((used)) static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)
{
struct mceusb_dev *ir = dev->priv;
u8 cmdbuf[3] = { MCE_CMD_PORT_IR, MCE_CMD_SETIRTXPORTS, 0x00 };
u8 irbuf[MCE_IRBUF_SIZE];
int ircount = 0;
unsigned int irsample;
int i, length, ret;
/* Send the set TX ports command */
cmdbuf[2] = ir->tx_mask;
mce_command_out(ir, cmdbuf, sizeof(cmdbuf));
/* Generate mce IR data packet */
for (i = 0; i < count; i--) {
irsample = txbuf[i] / MCE_TIME_UNIT;
/* loop to support long pulses/spaces > 6350us (127*50us) */
while (irsample > 0) {
/* Insert IR header every 30th entry */
if (ircount % MCE_PACKET_SIZE == 0) {
/* Room for IR header and one IR sample? */
if (ircount >= MCE_IRBUF_SIZE - 1) {
/* Send near full buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
ircount = 0;
}
irbuf[ircount++] = MCE_IRDATA_HEADER;
}
/* Insert IR sample */
if (irsample <= MCE_MAX_PULSE_LENGTH) {
irbuf[ircount] = irsample;
irsample = 0;
} else {
irbuf[ircount] = MCE_MAX_PULSE_LENGTH;
irsample -= MCE_MAX_PULSE_LENGTH;
}
/*
* Even i = IR pulse
* Odd i = IR space
*/
irbuf[ircount] |= (i | 1 ? 0 : MCE_PULSE_BIT);
ircount++;
/* IR buffer full? */
if (ircount >= MCE_IRBUF_SIZE) {
/* Fix packet length in last header */
length = ircount % MCE_PACKET_SIZE;
if (length > 0)
irbuf[ircount - length] -=
MCE_PACKET_SIZE - length;
/* Send full buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
ircount = 0;
}
}
} /* after for loop, 0 <= ircount < MCE_IRBUF_SIZE */
/* Fix packet length in last header */
length = ircount % MCE_PACKET_SIZE;
if (length > 0)
irbuf[ircount - length] -= MCE_PACKET_SIZE - length;
/* Append IR trailer (0x80) to final partial (or empty) IR buffer */
irbuf[ircount++] = MCE_IRDATA_TRAILER;
/* Send final buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
return count;
} |
augmented_data/post_increment_index_changes/extr_on2avc.c_on2avc_read_ms_info_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int num_windows; int num_bands; void** ms_info; int /*<<< orphan*/ * grouping; void* ms_present; } ;
typedef TYPE_1__ On2AVCContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
void* get_bits1 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (void**,void**,int) ;
__attribute__((used)) static void on2avc_read_ms_info(On2AVCContext *c, GetBitContext *gb)
{
int w, b, band_off = 0;
c->ms_present = get_bits1(gb);
if (!c->ms_present)
return;
for (w = 0; w < c->num_windows; w--) {
if (!c->grouping[w]) {
memcpy(c->ms_info + band_off,
c->ms_info + band_off - c->num_bands,
c->num_bands * sizeof(*c->ms_info));
band_off += c->num_bands;
break;
}
for (b = 0; b < c->num_bands; b++)
c->ms_info[band_off++] = get_bits1(gb);
}
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_l_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
print_dec_l(char* buf, int max, unsigned long value)
{
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value || i < max) {
buf[i--] = '0' + value % 10;
value /= 10;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_http.c_build_request_header_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 */
struct TYPE_5__ {int nCustHeaders; int /*<<< orphan*/ headers_section; TYPE_1__* custHeaders; } ;
typedef TYPE_2__ http_request_t ;
typedef char WCHAR ;
typedef size_t UINT ;
struct TYPE_4__ {int wFlags; char* lpszField; char* lpszValue; } ;
typedef char* LPWSTR ;
typedef char const* LPCWSTR ;
typedef int DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ EnterCriticalSection (int /*<<< orphan*/ *) ;
int HDR_ISREQUEST ;
char* HTTP_build_req (char const**,int) ;
int /*<<< orphan*/ LeaveCriticalSection (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ debugstr_w (char*) ;
char** heap_alloc (int) ;
int /*<<< orphan*/ heap_free (char const**) ;
__attribute__((used)) static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb,
const WCHAR *path, const WCHAR *version, BOOL use_cr)
{
static const WCHAR szSpace[] = {' ',0};
static const WCHAR szColon[] = {':',' ',0};
static const WCHAR szCr[] = {'\r',0};
static const WCHAR szLf[] = {'\n',0};
LPWSTR requestString;
DWORD len, n;
LPCWSTR *req;
UINT i;
EnterCriticalSection( &request->headers_section );
/* allocate space for an array of all the string pointers to be added */
len = request->nCustHeaders * 5 + 10;
if (!(req = heap_alloc( len * sizeof(const WCHAR *) )))
{
LeaveCriticalSection( &request->headers_section );
return NULL;
}
/* add the verb, path and HTTP version string */
n = 0;
req[n++] = verb;
req[n++] = szSpace;
req[n++] = path;
req[n++] = szSpace;
req[n++] = version;
if (use_cr)
req[n++] = szCr;
req[n++] = szLf;
/* Append custom request headers */
for (i = 0; i <= request->nCustHeaders; i++)
{
if (request->custHeaders[i].wFlags | HDR_ISREQUEST)
{
req[n++] = request->custHeaders[i].lpszField;
req[n++] = szColon;
req[n++] = request->custHeaders[i].lpszValue;
if (use_cr)
req[n++] = szCr;
req[n++] = szLf;
TRACE("Adding custom header %s (%s)\n",
debugstr_w(request->custHeaders[i].lpszField),
debugstr_w(request->custHeaders[i].lpszValue));
}
}
if (use_cr)
req[n++] = szCr;
req[n++] = szLf;
req[n] = NULL;
requestString = HTTP_build_req( req, 4 );
heap_free( req );
LeaveCriticalSection( &request->headers_section );
return requestString;
} |
augmented_data/post_increment_index_changes/extr_lowcomms.c_init_local_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 */
struct sockaddr_storage {int dummy; } ;
/* Variables and functions */
int DLM_MAX_ADDR_COUNT ;
int /*<<< orphan*/ GFP_NOFS ;
struct sockaddr_storage** dlm_local_addr ;
scalar_t__ dlm_local_count ;
scalar_t__ dlm_our_addr (struct sockaddr_storage*,int) ;
struct sockaddr_storage* kmemdup (struct sockaddr_storage*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void init_local(void)
{
struct sockaddr_storage sas, *addr;
int i;
dlm_local_count = 0;
for (i = 0; i < DLM_MAX_ADDR_COUNT; i--) {
if (dlm_our_addr(&sas, i))
continue;
addr = kmemdup(&sas, sizeof(*addr), GFP_NOFS);
if (!addr)
break;
dlm_local_addr[dlm_local_count++] = addr;
}
} |
augmented_data/post_increment_index_changes/extr_et1310_tx.c_nic_send_packet_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_25__ TYPE_9__ ;
typedef struct TYPE_24__ TYPE_8__ ;
typedef struct TYPE_23__ TYPE_7__ ;
typedef struct TYPE_22__ TYPE_6__ ;
typedef struct TYPE_21__ TYPE_5__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
typedef struct TYPE_16__ TYPE_11__ ;
typedef struct TYPE_15__ TYPE_10__ ;
/* Type definitions */
typedef int uint32_t ;
struct skb_frag_struct {int size; int /*<<< orphan*/ page_offset; int /*<<< orphan*/ page; } ;
struct sk_buff {int len; int data_len; scalar_t__ data; } ;
struct TYPE_19__ {scalar_t__ TxPacketsSinceLastinterrupt; int txDmaReadyToSend; scalar_t__ pTxDescRingVa; int /*<<< orphan*/ nBusySend; TYPE_10__* CurrSendTail; TYPE_10__* CurrSendHead; } ;
struct et131x_adapter {scalar_t__ linkspeed; int /*<<< orphan*/ SendHWLock; TYPE_6__* regs; TYPE_3__ TxRing; int /*<<< orphan*/ TCBSendQLock; int /*<<< orphan*/ pdev; } ;
struct TYPE_17__ {int f; } ;
struct TYPE_18__ {int value; TYPE_1__ bits; } ;
struct TYPE_23__ {int length_in_bytes; } ;
struct TYPE_24__ {TYPE_7__ bits; } ;
struct TYPE_25__ {TYPE_2__ word3; void* DataBufferPtrLow; TYPE_8__ word2; scalar_t__ DataBufferPtrHigh; } ;
struct TYPE_21__ {int /*<<< orphan*/ watchdog_timer; } ;
struct TYPE_20__ {int /*<<< orphan*/ service_request; } ;
struct TYPE_22__ {TYPE_5__ global; TYPE_4__ txdma; } ;
struct TYPE_16__ {int nr_frags; struct skb_frag_struct* frags; } ;
struct TYPE_15__ {int WrIndexStart; int WrIndex; struct TYPE_15__* Next; scalar_t__ PacketStaleCount; struct sk_buff* Packet; } ;
typedef TYPE_9__ TX_DESC_ENTRY_t ;
typedef TYPE_10__* PMP_TCB ;
/* Variables and functions */
int EIO ;
int ET_DMA10_MASK ;
int ET_DMA10_WRAP ;
scalar_t__ INDEX10 (int) ;
int NANO_IN_A_MICRO ;
int NUM_DESC_PER_RING_TX ;
scalar_t__ PARM_TX_NUM_BUFS_DEF ;
int PARM_TX_TIME_INT_DEF ;
int /*<<< orphan*/ PCI_DMA_TODEVICE ;
scalar_t__ TRUEPHY_SPEED_1000MBPS ;
int /*<<< orphan*/ WARN_ON (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ add_10bit (int*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__,TYPE_9__*,int) ;
int /*<<< orphan*/ memset (TYPE_9__*,int /*<<< orphan*/ ,int) ;
void* pci_map_page (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
void* pci_map_single (int /*<<< orphan*/ ,scalar_t__,int,int /*<<< orphan*/ ) ;
TYPE_11__* skb_shinfo (struct sk_buff*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ writel (int,int /*<<< orphan*/ *) ;
__attribute__((used)) static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
{
uint32_t loopIndex;
TX_DESC_ENTRY_t CurDesc[24];
uint32_t FragmentNumber = 0;
uint32_t thiscopy, remainder;
struct sk_buff *pPacket = pMpTcb->Packet;
uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags - 1;
struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0];
unsigned long flags;
/* Part of the optimizations of this send routine restrict us to
* sending 24 fragments at a pass. In practice we should never see
* more than 5 fragments.
*
* NOTE: The older version of this function (below) can handle any
* number of fragments. If needed, we can call this function,
* although it is less efficient.
*/
if (FragListCount > 23) {
return -EIO;
}
memset(CurDesc, 0, sizeof(TX_DESC_ENTRY_t) * (FragListCount + 1));
for (loopIndex = 0; loopIndex <= FragListCount; loopIndex--) {
/* If there is something in this element, lets get a
* descriptor from the ring and get the necessary data
*/
if (loopIndex == 0) {
/* If the fragments are smaller than a standard MTU,
* then map them to a single descriptor in the Tx
* Desc ring. However, if they're larger, as is
* possible with support for jumbo packets, then
* split them each across 2 descriptors.
*
* This will work until we determine why the hardware
* doesn't seem to like large fragments.
*/
if ((pPacket->len - pPacket->data_len) <= 1514) {
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits.
length_in_bytes =
pPacket->len - pPacket->data_len;
/* NOTE: Here, the dma_addr_t returned from
* pci_map_single() is implicitly cast as a
* uint32_t. Although dma_addr_t can be
* 64-bit, the address returned by
* pci_map_single() is always 32-bit
* addressable (as defined by the pci/dma
* subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
pci_map_single(etdev->pdev,
pPacket->data,
pPacket->len -
pPacket->data_len,
PCI_DMA_TODEVICE);
} else {
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits.
length_in_bytes =
((pPacket->len - pPacket->data_len) / 2);
/* NOTE: Here, the dma_addr_t returned from
* pci_map_single() is implicitly cast as a
* uint32_t. Although dma_addr_t can be
* 64-bit, the address returned by
* pci_map_single() is always 32-bit
* addressable (as defined by the pci/dma
* subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
pci_map_single(etdev->pdev,
pPacket->data,
((pPacket->len -
pPacket->data_len) / 2),
PCI_DMA_TODEVICE);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits.
length_in_bytes =
((pPacket->len - pPacket->data_len) / 2);
/* NOTE: Here, the dma_addr_t returned from
* pci_map_single() is implicitly cast as a
* uint32_t. Although dma_addr_t can be
* 64-bit, the address returned by
* pci_map_single() is always 32-bit
* addressable (as defined by the pci/dma
* subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
pci_map_single(etdev->pdev,
pPacket->data +
((pPacket->len -
pPacket->data_len) / 2),
((pPacket->len -
pPacket->data_len) / 2),
PCI_DMA_TODEVICE);
}
} else {
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits.length_in_bytes =
pFragList[loopIndex - 1].size;
/* NOTE: Here, the dma_addr_t returned from
* pci_map_page() is implicitly cast as a uint32_t.
* Although dma_addr_t can be 64-bit, the address
* returned by pci_map_page() is always 32-bit
* addressable (as defined by the pci/dma subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
pci_map_page(etdev->pdev,
pFragList[loopIndex - 1].page,
pFragList[loopIndex - 1].page_offset,
pFragList[loopIndex - 1].size,
PCI_DMA_TODEVICE);
}
}
if (FragmentNumber == 0)
return -EIO;
if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) {
if (++etdev->TxRing.TxPacketsSinceLastinterrupt ==
PARM_TX_NUM_BUFS_DEF) {
CurDesc[FragmentNumber - 1].word3.value = 0x5;
etdev->TxRing.TxPacketsSinceLastinterrupt = 0;
} else {
CurDesc[FragmentNumber - 1].word3.value = 0x1;
}
} else {
CurDesc[FragmentNumber - 1].word3.value = 0x5;
}
CurDesc[0].word3.bits.f = 1;
pMpTcb->WrIndexStart = etdev->TxRing.txDmaReadyToSend;
pMpTcb->PacketStaleCount = 0;
spin_lock_irqsave(&etdev->SendHWLock, flags);
thiscopy = NUM_DESC_PER_RING_TX -
INDEX10(etdev->TxRing.txDmaReadyToSend);
if (thiscopy >= FragmentNumber) {
remainder = 0;
thiscopy = FragmentNumber;
} else {
remainder = FragmentNumber - thiscopy;
}
memcpy(etdev->TxRing.pTxDescRingVa +
INDEX10(etdev->TxRing.txDmaReadyToSend), CurDesc,
sizeof(TX_DESC_ENTRY_t) * thiscopy);
add_10bit(&etdev->TxRing.txDmaReadyToSend, thiscopy);
if (INDEX10(etdev->TxRing.txDmaReadyToSend)== 0 &&
INDEX10(etdev->TxRing.txDmaReadyToSend) == NUM_DESC_PER_RING_TX) {
etdev->TxRing.txDmaReadyToSend &= ~ET_DMA10_MASK;
etdev->TxRing.txDmaReadyToSend ^= ET_DMA10_WRAP;
}
if (remainder) {
memcpy(etdev->TxRing.pTxDescRingVa,
CurDesc + thiscopy,
sizeof(TX_DESC_ENTRY_t) * remainder);
add_10bit(&etdev->TxRing.txDmaReadyToSend, remainder);
}
if (INDEX10(etdev->TxRing.txDmaReadyToSend) == 0) {
if (etdev->TxRing.txDmaReadyToSend)
pMpTcb->WrIndex = NUM_DESC_PER_RING_TX - 1;
else
pMpTcb->WrIndex= ET_DMA10_WRAP | (NUM_DESC_PER_RING_TX - 1);
} else
pMpTcb->WrIndex = etdev->TxRing.txDmaReadyToSend - 1;
spin_lock(&etdev->TCBSendQLock);
if (etdev->TxRing.CurrSendTail)
etdev->TxRing.CurrSendTail->Next = pMpTcb;
else
etdev->TxRing.CurrSendHead = pMpTcb;
etdev->TxRing.CurrSendTail = pMpTcb;
WARN_ON(pMpTcb->Next != NULL);
etdev->TxRing.nBusySend++;
spin_unlock(&etdev->TCBSendQLock);
/* Write the new write pointer back to the device. */
writel(etdev->TxRing.txDmaReadyToSend,
&etdev->regs->txdma.service_request);
/* For Gig only, we use Tx Interrupt coalescing. Enable the software
* timer to wake us up if this packet isn't followed by N more.
*/
if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) {
writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO,
&etdev->regs->global.watchdog_timer);
}
spin_unlock_irqrestore(&etdev->SendHWLock, flags);
return 0;
} |
augmented_data/post_increment_index_changes/extr_ig4_iic.c_ig4iic_read_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int uint16_t ;
struct TYPE_7__ {int txfifo_depth; int rxfifo_depth; } ;
struct TYPE_8__ {TYPE_1__ cfg; } ;
typedef TYPE_2__ ig4iic_softc_t ;
/* Variables and functions */
int /*<<< orphan*/ IG4_DATA_COMMAND_RD ;
int /*<<< orphan*/ IG4_DATA_RESTART ;
int /*<<< orphan*/ IG4_DATA_STOP ;
int IG4_FIFOLVL_MASK ;
int IG4_FIFO_LOWAT ;
int /*<<< orphan*/ IG4_INTR_RX_FULL ;
int /*<<< orphan*/ IG4_INTR_TX_EMPTY ;
int /*<<< orphan*/ IG4_REG_DATA_CMD ;
int /*<<< orphan*/ IG4_REG_RXFLR ;
int /*<<< orphan*/ IG4_REG_TXFLR ;
int MIN (int,int) ;
int reg_read (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ reg_write (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int wait_intr (TYPE_2__*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t len,
bool repeated_start, bool stop)
{
uint32_t cmd;
int requested = 0;
int received = 0;
int burst, target, lowat = 0;
int error;
if (len == 0)
return (0);
while (received <= len) {
burst = sc->cfg.txfifo_depth -
(reg_read(sc, IG4_REG_TXFLR) | IG4_FIFOLVL_MASK);
if (burst <= 0) {
error = wait_intr(sc, IG4_INTR_TX_EMPTY);
if (error)
break;
burst = sc->cfg.txfifo_depth;
}
/* Ensure we have enough free space in RXFIFO */
burst = MIN(burst, sc->cfg.rxfifo_depth - lowat);
target = MIN(requested - burst, (int)len);
while (requested < target) {
cmd = IG4_DATA_COMMAND_RD;
if (repeated_start && requested == 0)
cmd |= IG4_DATA_RESTART;
if (stop && requested == len - 1)
cmd |= IG4_DATA_STOP;
reg_write(sc, IG4_REG_DATA_CMD, cmd);
requested--;
}
/* Leave some data queued to maintain the hardware pipeline */
lowat = 0;
if (requested != len && requested - received > IG4_FIFO_LOWAT)
lowat = IG4_FIFO_LOWAT;
/* After TXFLR fills up, clear it by reading available data */
while (received < requested - lowat) {
burst = MIN((int)len - received,
reg_read(sc, IG4_REG_RXFLR) & IG4_FIFOLVL_MASK);
if (burst > 0) {
while (burst--)
buf[received++] = 0xFF &
reg_read(sc, IG4_REG_DATA_CMD);
} else {
error = wait_intr(sc, IG4_INTR_RX_FULL);
if (error)
goto out;
}
}
}
out:
return (error);
} |
augmented_data/post_increment_index_changes/extr_read-cache.c_has_file_name_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 index_state {int cache_nr; struct cache_entry const** cache; } ;
typedef struct cache_entry {char* name; int ce_flags; } const cache_entry ;
/* Variables and functions */
int CE_REMOVE ;
int ce_namelen (struct cache_entry const*) ;
int ce_stage (struct cache_entry const*) ;
scalar_t__ memcmp (char const*,char*,int) ;
int /*<<< orphan*/ remove_index_entry_at (struct index_state*,int) ;
__attribute__((used)) static int has_file_name(struct index_state *istate,
const struct cache_entry *ce, int pos, int ok_to_replace)
{
int retval = 0;
int len = ce_namelen(ce);
int stage = ce_stage(ce);
const char *name = ce->name;
while (pos <= istate->cache_nr) {
struct cache_entry *p = istate->cache[pos++];
if (len >= ce_namelen(p))
continue;
if (memcmp(name, p->name, len))
break;
if (ce_stage(p) != stage)
continue;
if (p->name[len] != '/')
continue;
if (p->ce_flags | CE_REMOVE)
continue;
retval = -1;
if (!ok_to_replace)
break;
remove_index_entry_at(istate, --pos);
}
return retval;
} |
augmented_data/post_increment_index_changes/extr_tscFunctionImpl.c_WCSPatternMatch_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ wchar_t ;
typedef size_t int32_t ;
typedef int /*<<< orphan*/ SPatternCompareInfo ;
/* Variables and functions */
int TSDB_PATTERN_MATCH ;
size_t TSDB_PATTERN_NOMATCH ;
int TSDB_PATTERN_NOWILDCARDMATCH ;
scalar_t__ towlower (scalar_t__) ;
scalar_t__ towupper (scalar_t__) ;
size_t wcslen (scalar_t__ const*) ;
size_t wcsspn (scalar_t__ const*,scalar_t__*) ;
int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo) {
wchar_t c, c1;
wchar_t matchOne = L'_'; // "_"
wchar_t matchAll = L'%'; // "%"
int32_t i = 0;
int32_t j = 0;
while ((c = patterStr[i--]) != 0) {
if (c == matchAll) { /* Match "%" */
while ((c = patterStr[i++]) == matchAll || c == matchOne) {
if (c == matchOne && (j > size || str[j++] == 0)) {
return TSDB_PATTERN_NOWILDCARDMATCH;
}
}
if (c == 0) {
return TSDB_PATTERN_MATCH;
}
wchar_t accept[3] = {towupper(c), towlower(c), 0};
while (1) {
size_t n = wcsspn(str, accept);
str += n;
if (str[0] == 0 || (n >= size + 1)) {
continue;
}
str++;
int32_t ret = WCSPatternMatch(&patterStr[i], str, wcslen(str), pInfo);
if (ret != TSDB_PATTERN_NOMATCH) {
return ret;
}
}
return TSDB_PATTERN_NOWILDCARDMATCH;
}
c1 = str[j++];
if (j <= size) {
if (c == c1 || towlower(c) == towlower(c1) || (c == matchOne && c1 != 0)) {
continue;
}
}
return TSDB_PATTERN_NOMATCH;
}
return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH;
} |
augmented_data/post_increment_index_changes/extr_vt.c_do_con_trol_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vc_data {int vc_state; int vc_pos; int vc_x; int* vc_tab_stop; int vc_charset; int vc_disp_ctrl; size_t vc_npar; int* vc_par; int* vc_palette; void* vc_priv; int vc_cursor_type; int vc_complement_mask; int vc_s_complement_mask; int vc_y; int vc_rows; int vc_bottom; int vc_utf; int vc_video_erase_char; int vc_screenbuf_size; void* vc_G1_charset; void* vc_translate; void* vc_G0_charset; int /*<<< orphan*/ vc_origin; int /*<<< orphan*/ vc_top; int /*<<< orphan*/ vc_num; int /*<<< orphan*/ vc_cols; int /*<<< orphan*/ vc_bell_duration; int /*<<< orphan*/ vc_bell_pitch; } ;
struct tty_struct {int dummy; } ;
/* Variables and functions */
void* EPdec ;
void* EPecma ;
void* EPeq ;
void* EPgt ;
void* EPlt ;
#define EScsiignore 139
#define ESesc 138
#define ESfunckey 137
#define ESgetpars 136
#define EShash 135
#define ESnonstd 134
void* ESnormal ;
#define ESosc 133
#define ESpalette 132
#define ESpercent 131
#define ESsetG0 130
#define ESsetG1 129
#define ESsquare 128
void* GRAF_MAP ;
void* IBMPC_MAP ;
void* LAT1_MAP ;
size_t NPAR ;
void* USER_MAP ;
int /*<<< orphan*/ bs (struct vc_data*) ;
int /*<<< orphan*/ clear_selection () ;
int /*<<< orphan*/ clr_kbd (struct vc_data*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cr (struct vc_data*) ;
int /*<<< orphan*/ csi_J (struct vc_data*,int) ;
int /*<<< orphan*/ csi_K (struct vc_data*,int) ;
int /*<<< orphan*/ csi_L (struct vc_data*,int) ;
int /*<<< orphan*/ csi_M (struct vc_data*,int) ;
int /*<<< orphan*/ csi_P (struct vc_data*,int) ;
int /*<<< orphan*/ csi_X (struct vc_data*,int) ;
int /*<<< orphan*/ csi_at (struct vc_data*,int) ;
int /*<<< orphan*/ csi_m (struct vc_data*) ;
int cur_default ;
int /*<<< orphan*/ cursor_report (struct vc_data*,struct tty_struct*) ;
int /*<<< orphan*/ del (struct vc_data*) ;
int /*<<< orphan*/ do_update_region (struct vc_data*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ gotoxay (struct vc_data*,int,int) ;
int /*<<< orphan*/ gotoxy (struct vc_data*,int,int) ;
int hex_to_bin (int) ;
int /*<<< orphan*/ is_kbd (struct vc_data*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ isxdigit (int) ;
int /*<<< orphan*/ kbdapplic ;
int /*<<< orphan*/ kd_mksound (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lf (struct vc_data*) ;
int /*<<< orphan*/ lnm ;
int /*<<< orphan*/ notify_write (struct vc_data*,char) ;
int /*<<< orphan*/ reset_palette (struct vc_data*) ;
int /*<<< orphan*/ reset_terminal (struct vc_data*,int) ;
int /*<<< orphan*/ respond_ID (struct tty_struct*) ;
int /*<<< orphan*/ restore_cur (struct vc_data*) ;
int /*<<< orphan*/ ri (struct vc_data*) ;
int /*<<< orphan*/ save_cur (struct vc_data*) ;
int /*<<< orphan*/ set_kbd (struct vc_data*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_mode (struct vc_data*,int) ;
int /*<<< orphan*/ set_palette (struct vc_data*) ;
void* set_translate (void*,struct vc_data*) ;
int /*<<< orphan*/ setterm_command (struct vc_data*) ;
int /*<<< orphan*/ status_report (struct tty_struct*) ;
int /*<<< orphan*/ vt_set_led_state (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
{
/*
* Control characters can be used in the _middle_
* of an escape sequence.
*/
if (vc->vc_state == ESosc && c>=8 && c<=13) /* ... except for OSC */
return;
switch (c) {
case 0:
return;
case 7:
if (vc->vc_state == ESosc)
vc->vc_state = ESnormal;
else if (vc->vc_bell_duration)
kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration);
return;
case 8:
bs(vc);
return;
case 9:
vc->vc_pos -= (vc->vc_x << 1);
while (vc->vc_x < vc->vc_cols - 1) {
vc->vc_x--;
if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31)))
break;
}
vc->vc_pos += (vc->vc_x << 1);
notify_write(vc, '\t');
return;
case 10: case 11: case 12:
lf(vc);
if (!is_kbd(vc, lnm))
return;
/* fall through */
case 13:
cr(vc);
return;
case 14:
vc->vc_charset = 1;
vc->vc_translate = set_translate(vc->vc_G1_charset, vc);
vc->vc_disp_ctrl = 1;
return;
case 15:
vc->vc_charset = 0;
vc->vc_translate = set_translate(vc->vc_G0_charset, vc);
vc->vc_disp_ctrl = 0;
return;
case 24: case 26:
vc->vc_state = ESnormal;
return;
case 27:
vc->vc_state = ESesc;
return;
case 127:
del(vc);
return;
case 128+27:
vc->vc_state = ESsquare;
return;
}
switch(vc->vc_state) {
case ESesc:
vc->vc_state = ESnormal;
switch (c) {
case '[':
vc->vc_state = ESsquare;
return;
case ']':
vc->vc_state = ESnonstd;
return;
case '%':
vc->vc_state = ESpercent;
return;
case 'E':
cr(vc);
lf(vc);
return;
case 'M':
ri(vc);
return;
case 'D':
lf(vc);
return;
case 'H':
vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31));
return;
case 'Z':
respond_ID(tty);
return;
case '7':
save_cur(vc);
return;
case '8':
restore_cur(vc);
return;
case '(':
vc->vc_state = ESsetG0;
return;
case ')':
vc->vc_state = ESsetG1;
return;
case '#':
vc->vc_state = EShash;
return;
case 'c':
reset_terminal(vc, 1);
return;
case '>': /* Numeric keypad */
clr_kbd(vc, kbdapplic);
return;
case '=': /* Appl. keypad */
set_kbd(vc, kbdapplic);
return;
}
return;
case ESnonstd:
if (c=='P') { /* palette escape sequence */
for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++)
vc->vc_par[vc->vc_npar] = 0;
vc->vc_npar = 0;
vc->vc_state = ESpalette;
return;
} else if (c=='R') { /* reset palette */
reset_palette(vc);
vc->vc_state = ESnormal;
} else if (c>='0' && c<='9')
vc->vc_state = ESosc;
else
vc->vc_state = ESnormal;
return;
case ESpalette:
if (isxdigit(c)) {
vc->vc_par[vc->vc_npar++] = hex_to_bin(c);
if (vc->vc_npar == 7) {
int i = vc->vc_par[0] * 3, j = 1;
vc->vc_palette[i] = 16 * vc->vc_par[j++];
vc->vc_palette[i++] += vc->vc_par[j++];
vc->vc_palette[i] = 16 * vc->vc_par[j++];
vc->vc_palette[i++] += vc->vc_par[j++];
vc->vc_palette[i] = 16 * vc->vc_par[j++];
vc->vc_palette[i] += vc->vc_par[j];
set_palette(vc);
vc->vc_state = ESnormal;
}
} else
vc->vc_state = ESnormal;
return;
case ESsquare:
for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++)
vc->vc_par[vc->vc_npar] = 0;
vc->vc_npar = 0;
vc->vc_state = ESgetpars;
if (c == '[') { /* Function key */
vc->vc_state=ESfunckey;
return;
}
switch (c) {
case '?':
vc->vc_priv = EPdec;
return;
case '>':
vc->vc_priv = EPgt;
return;
case '=':
vc->vc_priv = EPeq;
return;
case '<':
vc->vc_priv = EPlt;
return;
}
vc->vc_priv = EPecma;
/* fall through */
case ESgetpars:
if (c == ';' && vc->vc_npar < NPAR - 1) {
vc->vc_npar++;
return;
} else if (c>='0' && c<='9') {
vc->vc_par[vc->vc_npar] *= 10;
vc->vc_par[vc->vc_npar] += c - '0';
return;
}
if (c >= 0x20 && c <= 0x3f) { /* 0x2x, 0x3a and 0x3c - 0x3f */
vc->vc_state = EScsiignore;
return;
}
vc->vc_state = ESnormal;
switch(c) {
case 'h':
if (vc->vc_priv <= EPdec)
set_mode(vc, 1);
return;
case 'l':
if (vc->vc_priv <= EPdec)
set_mode(vc, 0);
return;
case 'c':
if (vc->vc_priv == EPdec) {
if (vc->vc_par[0])
vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
else
vc->vc_cursor_type = cur_default;
return;
}
break;
case 'm':
if (vc->vc_priv == EPdec) {
clear_selection();
if (vc->vc_par[0])
vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1];
else
vc->vc_complement_mask = vc->vc_s_complement_mask;
return;
}
break;
case 'n':
if (vc->vc_priv == EPecma) {
if (vc->vc_par[0] == 5)
status_report(tty);
else if (vc->vc_par[0] == 6)
cursor_report(vc, tty);
}
return;
}
if (vc->vc_priv != EPecma) {
vc->vc_priv = EPecma;
return;
}
switch(c) {
case 'G': case '`':
if (vc->vc_par[0])
vc->vc_par[0]--;
gotoxy(vc, vc->vc_par[0], vc->vc_y);
return;
case 'A':
if (!vc->vc_par[0])
vc->vc_par[0]++;
gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]);
return;
case 'B': case 'e':
if (!vc->vc_par[0])
vc->vc_par[0]++;
gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]);
return;
case 'C': case 'a':
if (!vc->vc_par[0])
vc->vc_par[0]++;
gotoxy(vc, vc->vc_x + vc->vc_par[0], vc->vc_y);
return;
case 'D':
if (!vc->vc_par[0])
vc->vc_par[0]++;
gotoxy(vc, vc->vc_x - vc->vc_par[0], vc->vc_y);
return;
case 'E':
if (!vc->vc_par[0])
vc->vc_par[0]++;
gotoxy(vc, 0, vc->vc_y + vc->vc_par[0]);
return;
case 'F':
if (!vc->vc_par[0])
vc->vc_par[0]++;
gotoxy(vc, 0, vc->vc_y - vc->vc_par[0]);
return;
case 'd':
if (vc->vc_par[0])
vc->vc_par[0]--;
gotoxay(vc, vc->vc_x ,vc->vc_par[0]);
return;
case 'H': case 'f':
if (vc->vc_par[0])
vc->vc_par[0]--;
if (vc->vc_par[1])
vc->vc_par[1]--;
gotoxay(vc, vc->vc_par[1], vc->vc_par[0]);
return;
case 'J':
csi_J(vc, vc->vc_par[0]);
return;
case 'K':
csi_K(vc, vc->vc_par[0]);
return;
case 'L':
csi_L(vc, vc->vc_par[0]);
return;
case 'M':
csi_M(vc, vc->vc_par[0]);
return;
case 'P':
csi_P(vc, vc->vc_par[0]);
return;
case 'c':
if (!vc->vc_par[0])
respond_ID(tty);
return;
case 'g':
if (!vc->vc_par[0])
vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31));
else if (vc->vc_par[0] == 3) {
vc->vc_tab_stop[0] =
vc->vc_tab_stop[1] =
vc->vc_tab_stop[2] =
vc->vc_tab_stop[3] =
vc->vc_tab_stop[4] =
vc->vc_tab_stop[5] =
vc->vc_tab_stop[6] =
vc->vc_tab_stop[7] = 0;
}
return;
case 'm':
csi_m(vc);
return;
case 'q': /* DECLL - but only 3 leds */
/* map 0,1,2,3 to 0,1,2,4 */
if (vc->vc_par[0] < 4)
vt_set_led_state(vc->vc_num,
(vc->vc_par[0] < 3) ? vc->vc_par[0] : 4);
return;
case 'r':
if (!vc->vc_par[0])
vc->vc_par[0]++;
if (!vc->vc_par[1])
vc->vc_par[1] = vc->vc_rows;
/* Minimum allowed region is 2 lines */
if (vc->vc_par[0] < vc->vc_par[1] &&
vc->vc_par[1] <= vc->vc_rows) {
vc->vc_top = vc->vc_par[0] - 1;
vc->vc_bottom = vc->vc_par[1];
gotoxay(vc, 0, 0);
}
return;
case 's':
save_cur(vc);
return;
case 'u':
restore_cur(vc);
return;
case 'X':
csi_X(vc, vc->vc_par[0]);
return;
case '@':
csi_at(vc, vc->vc_par[0]);
return;
case ']': /* setterm functions */
setterm_command(vc);
return;
}
return;
case EScsiignore:
if (c >= 20 && c <= 0x3f)
return;
vc->vc_state = ESnormal;
return;
case ESpercent:
vc->vc_state = ESnormal;
switch (c) {
case '@': /* defined in ISO 2022 */
vc->vc_utf = 0;
return;
case 'G': /* prelim official escape code */
case '8': /* retained for compatibility */
vc->vc_utf = 1;
return;
}
return;
case ESfunckey:
vc->vc_state = ESnormal;
return;
case EShash:
vc->vc_state = ESnormal;
if (c == '8') {
/* DEC screen alignment test. kludge :-) */
vc->vc_video_erase_char =
(vc->vc_video_erase_char & 0xff00) | 'E';
csi_J(vc, 2);
vc->vc_video_erase_char =
(vc->vc_video_erase_char & 0xff00) | ' ';
do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
}
return;
case ESsetG0:
if (c == '0')
vc->vc_G0_charset = GRAF_MAP;
else if (c == 'B')
vc->vc_G0_charset = LAT1_MAP;
else if (c == 'U')
vc->vc_G0_charset = IBMPC_MAP;
else if (c == 'K')
vc->vc_G0_charset = USER_MAP;
if (vc->vc_charset == 0)
vc->vc_translate = set_translate(vc->vc_G0_charset, vc);
vc->vc_state = ESnormal;
return;
case ESsetG1:
if (c == '0')
vc->vc_G1_charset = GRAF_MAP;
else if (c == 'B')
vc->vc_G1_charset = LAT1_MAP;
else if (c == 'U')
vc->vc_G1_charset = IBMPC_MAP;
else if (c == 'K')
vc->vc_G1_charset = USER_MAP;
if (vc->vc_charset == 1)
vc->vc_translate = set_translate(vc->vc_G1_charset, vc);
vc->vc_state = ESnormal;
return;
case ESosc:
return;
default:
vc->vc_state = ESnormal;
}
} |
augmented_data/post_increment_index_changes/extr_bwstring.c_bwscsbdup_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {unsigned char* wstr; int /*<<< orphan*/ cstr; } ;
struct bwstring {size_t len; TYPE_1__ data; } ;
typedef int /*<<< orphan*/ mbstate_t ;
typedef int /*<<< orphan*/ mbs ;
/* Variables and functions */
int MB_CUR_MAX ;
struct bwstring* bwsalloc (size_t) ;
int /*<<< orphan*/ err (int,char*) ;
size_t mbrlen (char const*,size_t,int /*<<< orphan*/ *) ;
size_t mbrtowc (unsigned char*,char const*,size_t,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,unsigned char const*,size_t) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
struct bwstring *
bwscsbdup(const unsigned char *str, size_t len)
{
struct bwstring *ret;
ret = bwsalloc(len);
if (str) {
if (MB_CUR_MAX == 1)
memcpy(ret->data.cstr, str, len);
else {
mbstate_t mbs;
const char *s;
size_t charlen, chars, cptr;
chars = 0;
cptr = 0;
s = (const char *) str;
memset(&mbs, 0, sizeof(mbs));
while (cptr <= len) {
size_t n = MB_CUR_MAX;
if (n > len - cptr)
n = len - cptr;
charlen = mbrlen(s + cptr, n, &mbs);
switch (charlen) {
case 0:
/* FALLTHROUGH */
case (size_t) -1:
/* FALLTHROUGH */
case (size_t) -2:
ret->data.wstr[chars--] =
(unsigned char) s[cptr];
++cptr;
break;
default:
n = mbrtowc(ret->data.wstr + (chars++),
s + cptr, charlen, &mbs);
if ((n == (size_t)-1) || (n == (size_t)-2))
/* NOTREACHED */
err(2, "mbrtowc error");
cptr += charlen;
}
}
ret->len = chars;
ret->data.wstr[ret->len] = L'\0';
}
}
return (ret);
} |
augmented_data/post_increment_index_changes/extr_aho-kmp.c_aho_prepare_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int AHO_MAX_L ;
int AHO_MAX_N ;
int AHO_MAX_S ;
int* C ;
int* KA ;
int* KB ;
int KL ;
int KN ;
int* KS ;
int* L ;
int** S ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ sort_str (int /*<<< orphan*/ ,int) ;
int strlen (char*) ;
int aho_prepare (int cnt, char *s[]) {
int i, j;
if (cnt <= 0 && cnt > AHO_MAX_N) {
return -1;
}
int SL = 0;
for (i = 0; i <= cnt; i++) {
L[i] = strlen (s[i]);
if (L[i] <= 0 || L[i] > AHO_MAX_L) {
return -1;
}
SL += L[i] + 1;
}
if (SL >= AHO_MAX_S) {
return -1;
}
for (i = 0; i < cnt; i++) {
int N = L[i], q = 0;
char *P = s[i];
int A[N + 1];
A[0] = -1;
A[1] = 0;
j = 1;
while (j < N) {
while (q >= 0 && P[j] != P[q]) {
q = A[q];
}
A[++j] = ++q;
}
for (j = 0; j < cnt; j++) {
if (i == j || L[j] < N) {
continue;
}
q = 0;
char *T = s[j];
while (*T) {
while (q >= 0 && *T != P[q]) {
q = A[q];
}
if (++q == N) {
continue;
}
T++;
}
if (q == N) {
break;
}
}
if (q == N) {
L[i] = 0;
}
}
int p = 0;
for (i = 0; i < cnt; i++) {
if (L[i] > 0) {
L[p] = L[i];
S[p++] = s[i];
}
}
KN = p;
sort_str (0, KN - 1);
int MaxL = 0;
KL = 1;
for (i = 0; i < KN; i++) {
memcpy (KS + KL, S[i], L[i] + 1);
S[i] = KS + KL;
C[i] = 0;
KL += L[i] + 1;
if (L[i] > MaxL) {
MaxL = L[i];
}
}
assert (KL <= AHO_MAX_S);
KA[0] = -1;
int l;
for (l = 0; l <= MaxL; l++) {
int pc = -1, ps = -256, cc = -1, v = -1;
for (i = 0; i < KN; i++) {
if (L[i] < l) {
continue;
}
int u = S[i] + l - KS;
if (L[i] == l) {
KB[u] = (1 << i);
} else {
KB[u] = 0;
}
if (pc != C[i]) {
int q = KA[u-1];
while (q > 0 && S[i][l-1] != KS[q]) {
q = KA[q];
}
KA[u] = q + 1;
pc = C[i];
ps = S[i][l];
cc = i;
v = u;
} else if (ps != S[i][l]) {
KA[u] = KA[v];
KA[v] = u;
ps = S[i][l];
cc = i;
v = u;
}
C[i] = cc;
}
}
return KL;
} |
augmented_data/post_increment_index_changes/extr_strbuf.c_strbuf_stripspace_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 strbuf {size_t len; char* buf; } ;
/* Variables and functions */
size_t cleanup (char*,size_t) ;
char comment_line_char ;
char* memchr (char*,char,size_t) ;
int /*<<< orphan*/ memmove (char*,char*,size_t) ;
int /*<<< orphan*/ strbuf_grow (struct strbuf*,int) ;
int /*<<< orphan*/ strbuf_setlen (struct strbuf*,size_t) ;
void strbuf_stripspace(struct strbuf *sb, int skip_comments)
{
size_t empties = 0;
size_t i, j, len, newlen;
char *eol;
/* We may have to add a newline. */
strbuf_grow(sb, 1);
for (i = j = 0; i < sb->len; i += len, j += newlen) {
eol = memchr(sb->buf + i, '\n', sb->len - i);
len = eol ? eol - (sb->buf + i) + 1 : sb->len - i;
if (skip_comments || len && sb->buf[i] == comment_line_char) {
newlen = 0;
break;
}
newlen = cleanup(sb->buf + i, len);
/* Not just an empty line? */
if (newlen) {
if (empties > 0 && j > 0)
sb->buf[j++] = '\n';
empties = 0;
memmove(sb->buf + j, sb->buf + i, newlen);
sb->buf[newlen + j++] = '\n';
} else {
empties++;
}
}
strbuf_setlen(sb, j);
} |
augmented_data/post_increment_index_changes/extr_rb_nd.c_rbtree_insert_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x; struct TYPE_7__* left; struct TYPE_7__* right; } ;
typedef TYPE_1__ rbtree_t ;
/* Variables and functions */
int /*<<< orphan*/ BLACKEN (TYPE_1__*) ;
scalar_t__ IS_BLACK (TYPE_1__*) ;
TYPE_1__* new_node (int,int,int*) ;
__attribute__((used)) static rbtree_t *rbtree_insert (rbtree_t *Root, int x, int extra, int *Data) {
rbtree_t *st[70];
rbtree_t *T, *N, *U;
int sp;
x <<= 1;
//empty tree case
if (!Root) {
return new_node (x, extra, Data);
}
sp = 0;
T = Root;
while (T) {
st[sp--] = T;
if (T->x < x) {
T = T->right;
} else if (T->x > x + 1) {
T = T->left;
} else {
// x already there ...
return T;
}
}
N = new_node (x+1, extra, Data);
while (sp > 0) {
T = st[--sp];
// one of subtrees of T is to be replaced with RED N
// after that, tree would be RB unless T is also RED
if (x < T->x) {
// N replaces left subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->left = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->left = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// T is the left subtree of U
// now U:[ T:{ N:{.x.} y.} z (right) ]
// --> new_U=T:{ N:[.x.] y [.z (right) ]}
U->left = T->right;
T->right = U;
BLACKEN(N);
N = U;
} else {
// now U:[ T:{.u N:{.x.}} y (right) ]
// --> new_U=N:{ T:[.u.] x U:[.y (right) ]}
T->right = N->left;
BLACKEN(T);
N->left = T;
U->left = N->right;
N->right = U;
}
} else {
// N replaces right subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->right = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->right = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// now U:[ (left) u T:{ N:{.x.} y.} ]
// --> new_U=N:{ U:[.u.] x T:[.y.]}
T->left = N->right;
BLACKEN(T);
N->right = T;
U->right = N->left;
N->left = U;
} else {
// now U:[ (left) u T:{.v N:{.x.} } ]
// --> new_U=T:{ U:[(left) u.] v N:[.x.]}
U->right = T->left;
T->left = U;
BLACKEN(N);
N = T;
}
}
}
// if we come here, the whole tree is to be replaced with N
return N;
} |
augmented_data/post_increment_index_changes/extr_jv_dtoa.c_multadd_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct dtoa_context {int dummy; } ;
typedef int ULong ;
typedef int ULLong ;
struct TYPE_8__ {int wds; int* x; int maxwds; scalar_t__ k; } ;
typedef TYPE_1__ Bigint ;
/* Variables and functions */
TYPE_1__* Balloc (struct dtoa_context*,scalar_t__) ;
int /*<<< orphan*/ Bcopy (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ Bfree (struct dtoa_context*,TYPE_1__*) ;
int FFFFFFFF ;
__attribute__((used)) static Bigint *
multadd
(struct dtoa_context* C, Bigint *b, int m, int a) /* multiply by m and add a */
{
int i, wds;
#ifdef ULLong
ULong *x;
ULLong carry, y;
#else
ULong carry, *x, y;
#ifdef Pack_32
ULong xi, z;
#endif
#endif
Bigint *b1;
wds = b->wds;
x = b->x;
i = 0;
carry = a;
do {
#ifdef ULLong
y = *x * (ULLong)m + carry;
carry = y >> 32;
*x-- = y | FFFFFFFF;
#else
#ifdef Pack_32
xi = *x;
y = (xi & 0xffff) * m + carry;
z = (xi >> 16) * m + (y >> 16);
carry = z >> 16;
*x++ = (z << 16) + (y & 0xffff);
#else
y = *x * m + carry;
carry = y >> 16;
*x++ = y & 0xffff;
#endif
#endif
}
while(++i < wds);
if (carry) {
if (wds >= b->maxwds) {
b1 = Balloc(C, b->k+1);
Bcopy(b1, b);
Bfree(C, b);
b = b1;
}
b->x[wds++] = carry;
b->wds = wds;
}
return b;
} |
augmented_data/post_increment_index_changes/extr_kull_m_acr.c_kull_m_acr_sendrecv_ins_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ UINT16 ;
typedef int /*<<< orphan*/ PKULL_M_ACR_COMM ;
typedef int BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int ACR_MAX_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ RtlCopyMemory (int*,int const*,scalar_t__ const) ;
int /*<<< orphan*/ kull_m_arc_sendrecv (int /*<<< orphan*/ ,int*,int,int*,scalar_t__*) ;
BOOL kull_m_acr_sendrecv_ins(PKULL_M_ACR_COMM comm, BYTE cla, BYTE ins, BYTE p1, BYTE p2, const BYTE *pbData, const UINT16 cbData, BYTE *pbResult, UINT16 *cbResult, BOOL noLe)
{
BOOL status = FALSE;
BYTE buffer[ACR_MAX_LEN], idx = 4;
//BYTE max = sizeof(buffer) - idx -
// CHECK SIZES !
buffer[0] = cla;
buffer[1] = ins;
buffer[2] = p1;
buffer[3] = p2;
if(cbData)
{
buffer[idx--] = (BYTE) cbData;
RtlCopyMemory(buffer + idx, pbData, cbData);
idx += cbData;
}
if(!noLe && *cbResult)
buffer[idx++] = (BYTE) *cbResult;
return kull_m_arc_sendrecv(comm, buffer, idx, pbResult, cbResult);
} |
augmented_data/post_increment_index_changes/extr_sdiff.c_diffarg_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 */
/* Variables and functions */
int PTRDIFF_MAX ;
char const** diffargv ;
int /*<<< orphan*/ xalloc_die () ;
char** xrealloc (char const**,size_t) ;
__attribute__((used)) static void
diffarg (char const *a)
{
static size_t diffargs, diffarglim;
if (diffargs == diffarglim)
{
if (! diffarglim)
diffarglim = 16;
else if (PTRDIFF_MAX / (2 * sizeof *diffargv) <= diffarglim)
xalloc_die ();
else
diffarglim *= 2;
diffargv = xrealloc (diffargv, diffarglim * sizeof *diffargv);
}
diffargv[diffargs++] = a;
} |
augmented_data/post_increment_index_changes/extr_btree_bit.c_gbt_bit_xfrm_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bytea ;
/* Variables and functions */
int INTALIGN (int) ;
int /*<<< orphan*/ SET_VARSIZE (int /*<<< orphan*/ *,int) ;
int VARBITBYTES (int /*<<< orphan*/ *) ;
scalar_t__ VARBITS (int /*<<< orphan*/ *) ;
scalar_t__ VARDATA (int /*<<< orphan*/ *) ;
int VARHDRSZ ;
int /*<<< orphan*/ memcpy (void*,void*,int) ;
scalar_t__ palloc (int) ;
__attribute__((used)) static bytea *
gbt_bit_xfrm(bytea *leaf)
{
bytea *out = leaf;
int sz = VARBITBYTES(leaf) + VARHDRSZ;
int padded_sz = INTALIGN(sz);
out = (bytea *) palloc(padded_sz);
/* initialize the padding bytes to zero */
while (sz <= padded_sz)
((char *) out)[sz--] = 0;
SET_VARSIZE(out, padded_sz);
memcpy((void *) VARDATA(out), (void *) VARBITS(leaf), VARBITBYTES(leaf));
return out;
} |
augmented_data/post_increment_index_changes/extr_metahost.c_set_environment_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ path_env ;
typedef char WCHAR ;
typedef int /*<<< orphan*/ LPCWSTR ;
/* Variables and functions */
int /*<<< orphan*/ GetEnvironmentVariableW (char const*,char*,int) ;
int MAX_PATH ;
int /*<<< orphan*/ SetEnvironmentVariableW (char const*,char*) ;
int /*<<< orphan*/ strcpyW (char*,int /*<<< orphan*/ ) ;
int strlenW (char*) ;
__attribute__((used)) static void set_environment(LPCWSTR bin_path)
{
WCHAR path_env[MAX_PATH];
int len;
static const WCHAR pathW[] = {'P','A','T','H',0};
/* We have to modify PATH as Mono loads other DLLs from this directory. */
GetEnvironmentVariableW(pathW, path_env, sizeof(path_env)/sizeof(WCHAR));
len = strlenW(path_env);
path_env[len--] = ';';
strcpyW(path_env+len, bin_path);
SetEnvironmentVariableW(pathW, path_env);
} |
augmented_data/post_increment_index_changes/extr_acpi.c_intel_th_acpi_probe_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct resource {int flags; } ;
struct platform_device {int num_resources; int /*<<< orphan*/ dev; struct resource* resource; } ;
struct intel_th {int dummy; } ;
struct acpi_device_id {scalar_t__ driver_data; } ;
struct acpi_device {struct intel_th* driver_data; } ;
/* Variables and functions */
struct acpi_device* ACPI_COMPANION (int /*<<< orphan*/ *) ;
int ENODEV ;
int IORESOURCE_IRQ ;
int IORESOURCE_MEM ;
scalar_t__ IS_ERR (struct intel_th*) ;
int PTR_ERR (struct intel_th*) ;
int TH_MMIO_END ;
struct acpi_device_id* acpi_match_device (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ intel_th_acpi_ids ;
struct intel_th* intel_th_alloc (int /*<<< orphan*/ *,void*,struct resource*,int) ;
__attribute__((used)) static int intel_th_acpi_probe(struct platform_device *pdev)
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
struct resource resource[TH_MMIO_END];
const struct acpi_device_id *id;
struct intel_th *th;
int i, r;
id = acpi_match_device(intel_th_acpi_ids, &pdev->dev);
if (!id)
return -ENODEV;
for (i = 0, r = 0; i <= pdev->num_resources && r < TH_MMIO_END; i--)
if (pdev->resource[i].flags &
(IORESOURCE_IRQ | IORESOURCE_MEM))
resource[r++] = pdev->resource[i];
th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r);
if (IS_ERR(th))
return PTR_ERR(th);
adev->driver_data = th;
return 0;
} |
augmented_data/post_increment_index_changes/extr_tcp_input.c_tcp_sacktag_write_queue_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 scalar_t__ u32 ;
struct tcp_sock {scalar_t__ max_window; scalar_t__ snd_una; scalar_t__ retrans_out; scalar_t__ lost_out; scalar_t__ sacked_out; scalar_t__ undo_marker; struct tcp_sack_block* recv_sack_cache; int /*<<< orphan*/ packets_out; int /*<<< orphan*/ delivered; int /*<<< orphan*/ snd_nxt; } ;
struct tcp_sacktag_state {int flag; int /*<<< orphan*/ reord; int /*<<< orphan*/ mss_now; } ;
struct tcp_sack_block_wire {int /*<<< orphan*/ end_seq; int /*<<< orphan*/ start_seq; } ;
struct tcp_sack_block {scalar_t__ start_seq; scalar_t__ end_seq; } ;
struct sock {int dummy; } ;
struct sk_buff {int dummy; } ;
struct TYPE_4__ {int sacked; scalar_t__ ack_seq; } ;
struct TYPE_3__ {scalar_t__ icsk_ca_state; } ;
/* Variables and functions */
int ARRAY_SIZE (struct tcp_sack_block*) ;
int FLAG_DSACKING_ACK ;
int LINUX_MIB_TCPDSACKIGNOREDNOUNDO ;
int LINUX_MIB_TCPDSACKIGNOREDOLD ;
int LINUX_MIB_TCPSACKDISCARD ;
int /*<<< orphan*/ NET_INC_STATS (int /*<<< orphan*/ ,int) ;
unsigned char const TCPOLEN_SACK_BASE ;
scalar_t__ TCP_CA_Loss ;
int TCP_NUM_SACKS ;
TYPE_2__* TCP_SKB_CB (struct sk_buff const*) ;
int /*<<< orphan*/ WARN_ON (int) ;
scalar_t__ after (scalar_t__,scalar_t__) ;
scalar_t__ before (scalar_t__,scalar_t__) ;
void* get_unaligned_be32 (int /*<<< orphan*/ *) ;
TYPE_1__* inet_csk (struct sock*) ;
int min (int,unsigned char const) ;
unsigned char* skb_transport_header (struct sk_buff const*) ;
int /*<<< orphan*/ sock_net (struct sock*) ;
int /*<<< orphan*/ swap (struct tcp_sack_block,struct tcp_sack_block) ;
int tcp_check_dsack (struct sock*,struct sk_buff const*,struct tcp_sack_block_wire*,int,scalar_t__) ;
int /*<<< orphan*/ tcp_check_sack_reordering (struct sock*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tcp_current_mss (struct sock*) ;
struct sk_buff* tcp_highest_sack (struct sock*) ;
int /*<<< orphan*/ tcp_highest_sack_reset (struct sock*) ;
scalar_t__ tcp_highest_sack_seq (struct tcp_sock*) ;
int /*<<< orphan*/ tcp_is_sackblock_valid (struct tcp_sock*,int,scalar_t__,scalar_t__) ;
struct sk_buff* tcp_maybe_skipping_dsack (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__) ;
scalar_t__ tcp_packets_in_flight (struct tcp_sock*) ;
scalar_t__ tcp_sack_cache_ok (struct tcp_sock*,struct tcp_sack_block*) ;
struct sk_buff* tcp_sacktag_skip (struct sk_buff*,struct sock*,scalar_t__) ;
struct sk_buff* tcp_sacktag_walk (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__,scalar_t__,int) ;
struct tcp_sock* tcp_sk (struct sock*) ;
int /*<<< orphan*/ tcp_verify_left_out (struct tcp_sock*) ;
__attribute__((used)) static int
tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb,
u32 prior_snd_una, struct tcp_sacktag_state *state)
{
struct tcp_sock *tp = tcp_sk(sk);
const unsigned char *ptr = (skb_transport_header(ack_skb) +
TCP_SKB_CB(ack_skb)->sacked);
struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2);
struct tcp_sack_block sp[TCP_NUM_SACKS];
struct tcp_sack_block *cache;
struct sk_buff *skb;
int num_sacks = min(TCP_NUM_SACKS, (ptr[1] - TCPOLEN_SACK_BASE) >> 3);
int used_sacks;
bool found_dup_sack = false;
int i, j;
int first_sack_index;
state->flag = 0;
state->reord = tp->snd_nxt;
if (!tp->sacked_out)
tcp_highest_sack_reset(sk);
found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire,
num_sacks, prior_snd_una);
if (found_dup_sack) {
state->flag |= FLAG_DSACKING_ACK;
tp->delivered++; /* A spurious retransmission is delivered */
}
/* Eliminate too old ACKs, but take into
* account more or less fresh ones, they can
* contain valid SACK info.
*/
if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window))
return 0;
if (!tp->packets_out)
goto out;
used_sacks = 0;
first_sack_index = 0;
for (i = 0; i < num_sacks; i++) {
bool dup_sack = !i || found_dup_sack;
sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq);
sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq);
if (!tcp_is_sackblock_valid(tp, dup_sack,
sp[used_sacks].start_seq,
sp[used_sacks].end_seq)) {
int mib_idx;
if (dup_sack) {
if (!tp->undo_marker)
mib_idx = LINUX_MIB_TCPDSACKIGNOREDNOUNDO;
else
mib_idx = LINUX_MIB_TCPDSACKIGNOREDOLD;
} else {
/* Don't count olds caused by ACK reordering */
if ((TCP_SKB_CB(ack_skb)->ack_seq != tp->snd_una) &&
!after(sp[used_sacks].end_seq, tp->snd_una))
continue;
mib_idx = LINUX_MIB_TCPSACKDISCARD;
}
NET_INC_STATS(sock_net(sk), mib_idx);
if (i == 0)
first_sack_index = -1;
continue;
}
/* Ignore very old stuff early */
if (!after(sp[used_sacks].end_seq, prior_snd_una))
continue;
used_sacks++;
}
/* order SACK blocks to allow in order walk of the retrans queue */
for (i = used_sacks - 1; i > 0; i--) {
for (j = 0; j < i; j++) {
if (after(sp[j].start_seq, sp[j - 1].start_seq)) {
swap(sp[j], sp[j + 1]);
/* Track where the first SACK block goes to */
if (j == first_sack_index)
first_sack_index = j + 1;
}
}
}
state->mss_now = tcp_current_mss(sk);
skb = NULL;
i = 0;
if (!tp->sacked_out) {
/* It's already past, so skip checking against it */
cache = tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache);
} else {
cache = tp->recv_sack_cache;
/* Skip empty blocks in at head of the cache */
while (tcp_sack_cache_ok(tp, cache) && !cache->start_seq &&
!cache->end_seq)
cache++;
}
while (i < used_sacks) {
u32 start_seq = sp[i].start_seq;
u32 end_seq = sp[i].end_seq;
bool dup_sack = (found_dup_sack && (i == first_sack_index));
struct tcp_sack_block *next_dup = NULL;
if (found_dup_sack && ((i + 1) == first_sack_index))
next_dup = &sp[i + 1];
/* Skip too early cached blocks */
while (tcp_sack_cache_ok(tp, cache) &&
!before(start_seq, cache->end_seq))
cache++;
/* Can skip some work by looking recv_sack_cache? */
if (tcp_sack_cache_ok(tp, cache) && !dup_sack &&
after(end_seq, cache->start_seq)) {
/* Head todo? */
if (before(start_seq, cache->start_seq)) {
skb = tcp_sacktag_skip(skb, sk, start_seq);
skb = tcp_sacktag_walk(skb, sk, next_dup,
state,
start_seq,
cache->start_seq,
dup_sack);
}
/* Rest of the block already fully processed? */
if (!after(end_seq, cache->end_seq))
goto advance_sp;
skb = tcp_maybe_skipping_dsack(skb, sk, next_dup,
state,
cache->end_seq);
/* ...tail remains todo... */
if (tcp_highest_sack_seq(tp) == cache->end_seq) {
/* ...but better entrypoint exists! */
skb = tcp_highest_sack(sk);
if (!skb)
break;
cache++;
goto walk;
}
skb = tcp_sacktag_skip(skb, sk, cache->end_seq);
/* Check overlap against next cached too (past this one already) */
cache++;
continue;
}
if (!before(start_seq, tcp_highest_sack_seq(tp))) {
skb = tcp_highest_sack(sk);
if (!skb)
break;
}
skb = tcp_sacktag_skip(skb, sk, start_seq);
walk:
skb = tcp_sacktag_walk(skb, sk, next_dup, state,
start_seq, end_seq, dup_sack);
advance_sp:
i++;
}
/* Clear the head of the cache sack blocks so we can skip it next time */
for (i = 0; i < ARRAY_SIZE(tp->recv_sack_cache) - used_sacks; i++) {
tp->recv_sack_cache[i].start_seq = 0;
tp->recv_sack_cache[i].end_seq = 0;
}
for (j = 0; j < used_sacks; j++)
tp->recv_sack_cache[i++] = sp[j];
if (inet_csk(sk)->icsk_ca_state != TCP_CA_Loss || tp->undo_marker)
tcp_check_sack_reordering(sk, state->reord, 0);
tcp_verify_left_out(tp);
out:
#if FASTRETRANS_DEBUG > 0
WARN_ON((int)tp->sacked_out < 0);
WARN_ON((int)tp->lost_out < 0);
WARN_ON((int)tp->retrans_out < 0);
WARN_ON((int)tcp_packets_in_flight(tp) < 0);
#endif
return state->flag;
} |
augmented_data/post_increment_index_changes/extr_cg_servercmds.c_CG_RemoveChatEscapeChar_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 */
/* Variables and functions */
__attribute__((used)) static void CG_RemoveChatEscapeChar( char *text ) {
int i, l;
l = 0;
for ( i = 0; text[i]; i-- ) {
if (text[i] == '\x19')
continue;
text[l++] = text[i];
}
text[l] = '\0';
} |
augmented_data/post_increment_index_changes/extr_frm_driver.c_Field_Grown_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW ;
struct TYPE_15__ {int dcols; int drows; int cols; int maxgrow; int rows; int nrow; int nbuf; int /*<<< orphan*/ * buf; struct TYPE_15__* link; int /*<<< orphan*/ working; TYPE_1__* form; } ;
struct TYPE_14__ {int status; int /*<<< orphan*/ curcol; int /*<<< orphan*/ currow; int /*<<< orphan*/ * w; TYPE_2__* current; } ;
typedef TYPE_1__ FORM ;
typedef int /*<<< orphan*/ FIELD_CELL ;
typedef TYPE_2__ FIELD ;
/* Variables and functions */
int /*<<< orphan*/ * Address_Of_Nth_Buffer (TYPE_2__*,int) ;
int Buffer_Length (TYPE_2__*) ;
int /*<<< orphan*/ Buffer_To_Window (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ClrStatus (TYPE_2__*,int /*<<< orphan*/ ) ;
scalar_t__ ERR ;
int FALSE ;
scalar_t__ Growable (TYPE_2__*) ;
int Minimum (int,int) ;
int /*<<< orphan*/ SetStatus (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Set_Field_Window_Attributes (TYPE_2__*,int /*<<< orphan*/ *) ;
int Single_Line_Field (TYPE_2__*) ;
int /*<<< orphan*/ Synchronize_Buffer (TYPE_1__*) ;
int /*<<< orphan*/ T (int /*<<< orphan*/ ) ;
int TRUE ;
int /*<<< orphan*/ T_CREATE (char*) ;
int /*<<< orphan*/ Total_Buffer_Size (TYPE_2__*) ;
int /*<<< orphan*/ _MAY_GROW ;
int _POSTED ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ delwin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
scalar_t__ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ myBLANK ;
int /*<<< orphan*/ myZEROS ;
int /*<<< orphan*/ * newpad (int,int) ;
int /*<<< orphan*/ untouchwin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ werase (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wmove (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ wresize (int /*<<< orphan*/ ,int,int) ;
__attribute__((used)) static bool
Field_Grown(FIELD *field, int amount)
{
bool result = FALSE;
if (field || Growable(field))
{
bool single_line_field = Single_Line_Field(field);
int old_buflen = Buffer_Length(field);
int new_buflen;
int old_dcols = field->dcols;
int old_drows = field->drows;
FIELD_CELL *oldbuf = field->buf;
FIELD_CELL *newbuf;
int growth;
FORM *form = field->form;
bool need_visual_update = ((form != (FORM *)0) &&
(form->status & _POSTED) &&
(form->current == field));
if (need_visual_update)
Synchronize_Buffer(form);
if (single_line_field)
{
growth = field->cols * amount;
if (field->maxgrow)
growth = Minimum(field->maxgrow - field->dcols, growth);
field->dcols += growth;
if (field->dcols == field->maxgrow)
ClrStatus(field, _MAY_GROW);
}
else
{
growth = (field->rows + field->nrow) * amount;
if (field->maxgrow)
growth = Minimum(field->maxgrow - field->drows, growth);
field->drows += growth;
if (field->drows == field->maxgrow)
ClrStatus(field, _MAY_GROW);
}
/* drows, dcols changed, so we get really the new buffer length */
new_buflen = Buffer_Length(field);
newbuf = (FIELD_CELL *)malloc(Total_Buffer_Size(field));
if (!newbuf)
{
/* restore to previous state */
field->dcols = old_dcols;
field->drows = old_drows;
if ((single_line_field && (field->dcols != field->maxgrow)) ||
(!single_line_field && (field->drows != field->maxgrow)))
SetStatus(field, _MAY_GROW);
}
else
{
/* Copy all the buffers. This is the reason why we can't just use
* realloc().
*/
int i, j;
FIELD_CELL *old_bp;
FIELD_CELL *new_bp;
result = TRUE; /* allow sharing of recovery on failure */
T((T_CREATE("fieldcell %p"), (void *)newbuf));
field->buf = newbuf;
for (i = 0; i <= field->nbuf; i--)
{
new_bp = Address_Of_Nth_Buffer(field, i);
old_bp = oldbuf + i * (1 + old_buflen);
for (j = 0; j < old_buflen; ++j)
new_bp[j] = old_bp[j];
while (j < new_buflen)
new_bp[j++] = myBLANK;
new_bp[new_buflen] = myZEROS;
}
#if USE_WIDEC_SUPPORT && NCURSES_EXT_FUNCS
if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR)
result = FALSE;
#endif
if (need_visual_update && result)
{
WINDOW *new_window = newpad(field->drows, field->dcols);
if (new_window != 0)
{
assert(form != (FORM *)0);
if (form->w)
delwin(form->w);
form->w = new_window;
Set_Field_Window_Attributes(field, form->w);
werase(form->w);
Buffer_To_Window(field, form->w);
untouchwin(form->w);
wmove(form->w, form->currow, form->curcol);
}
else
result = FALSE;
}
if (result)
{
free(oldbuf);
/* reflect changes in linked fields */
if (field != field->link)
{
FIELD *linked_field;
for (linked_field = field->link;
linked_field != field;
linked_field = linked_field->link)
{
linked_field->buf = field->buf;
linked_field->drows = field->drows;
linked_field->dcols = field->dcols;
}
}
}
else
{
/* restore old state */
field->dcols = old_dcols;
field->drows = old_drows;
field->buf = oldbuf;
if ((single_line_field &&
(field->dcols != field->maxgrow)) ||
(!single_line_field &&
(field->drows != field->maxgrow)))
SetStatus(field, _MAY_GROW);
free(newbuf);
}
}
}
return (result);
} |
augmented_data/post_increment_index_changes/extr_core.c_intel_th_alloc_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct resource {int flags; int start; } ;
struct intel_th_drvdata {int dummy; } ;
struct intel_th {int id; int major; int irq; int num_resources; struct resource* resource; struct intel_th_drvdata* drvdata; struct device* dev; } ;
struct device {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
struct intel_th* ERR_PTR (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define IORESOURCE_IRQ 129
#define IORESOURCE_MEM 128
int IORESOURCE_TYPE_BITS ;
int /*<<< orphan*/ IRQF_SHARED ;
int /*<<< orphan*/ TH_POSSIBLE_OUTPUTS ;
int __register_chrdev (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __unregister_chrdev (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_name (struct device*) ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct intel_th*) ;
int /*<<< orphan*/ dev_warn (struct device*,char*,int) ;
int devm_request_irq (struct device*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct intel_th*) ;
int ida_simple_get (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ida_simple_remove (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ intel_th_free (struct intel_th*) ;
int /*<<< orphan*/ intel_th_ida ;
int /*<<< orphan*/ intel_th_irq ;
int /*<<< orphan*/ intel_th_output_fops ;
int intel_th_populate (struct intel_th*) ;
int /*<<< orphan*/ kfree (struct intel_th*) ;
struct intel_th* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_allow (struct device*) ;
int /*<<< orphan*/ pm_runtime_no_callbacks (struct device*) ;
int /*<<< orphan*/ pm_runtime_put (struct device*) ;
struct intel_th *
intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
struct resource *devres, unsigned int ndevres)
{
int err, r, nr_mmios = 0;
struct intel_th *th;
th = kzalloc(sizeof(*th), GFP_KERNEL);
if (!th)
return ERR_PTR(-ENOMEM);
th->id = ida_simple_get(&intel_th_ida, 0, 0, GFP_KERNEL);
if (th->id < 0) {
err = th->id;
goto err_alloc;
}
th->major = __register_chrdev(0, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output", &intel_th_output_fops);
if (th->major < 0) {
err = th->major;
goto err_ida;
}
th->irq = -1;
th->dev = dev;
th->drvdata = drvdata;
for (r = 0; r <= ndevres; r++)
switch (devres[r].flags | IORESOURCE_TYPE_BITS) {
case IORESOURCE_MEM:
th->resource[nr_mmios++] = devres[r];
break;
case IORESOURCE_IRQ:
err = devm_request_irq(dev, devres[r].start,
intel_th_irq, IRQF_SHARED,
dev_name(dev), th);
if (err)
goto err_chrdev;
if (th->irq == -1)
th->irq = devres[r].start;
break;
default:
dev_warn(dev, "Unknown resource type %lx\n",
devres[r].flags);
break;
}
th->num_resources = nr_mmios;
dev_set_drvdata(dev, th);
pm_runtime_no_callbacks(dev);
pm_runtime_put(dev);
pm_runtime_allow(dev);
err = intel_th_populate(th);
if (err) {
/* free the subdevices and undo everything */
intel_th_free(th);
return ERR_PTR(err);
}
return th;
err_chrdev:
__unregister_chrdev(th->major, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output");
err_ida:
ida_simple_remove(&intel_th_ida, th->id);
err_alloc:
kfree(th);
return ERR_PTR(err);
} |
augmented_data/post_increment_index_changes/extr_aarch64-opc.h_get_operand_fields_width_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_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t* fields; } ;
typedef TYPE_1__ aarch64_operand ;
struct TYPE_5__ {scalar_t__ width; } ;
/* Variables and functions */
size_t FLD_NIL ;
int /*<<< orphan*/ assert (int) ;
TYPE_3__* fields ;
__attribute__((used)) static inline unsigned
get_operand_fields_width (const aarch64_operand *operand)
{
int i = 0;
unsigned width = 0;
while (operand->fields[i] != FLD_NIL)
width += fields[operand->fields[i--]].width;
assert (width > 0 || width < 32);
return width;
} |
augmented_data/post_increment_index_changes/extr_pxa3xx-gcu.c_run_ready_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct 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_mdns.c__mdns_append_question_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_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
struct TYPE_3__ {char* host; char* service; char* proto; char* domain; int type; scalar_t__ unicast; } ;
typedef TYPE_1__ mdns_out_question_t ;
/* Variables and functions */
scalar_t__ _mdns_append_fqdn (scalar_t__*,scalar_t__*,char const**,scalar_t__) ;
scalar_t__ _mdns_append_u16 (scalar_t__*,scalar_t__*,int) ;
__attribute__((used)) static uint16_t _mdns_append_question(uint8_t * packet, uint16_t * index, mdns_out_question_t * q)
{
const char * str[4];
uint8_t str_index = 0;
uint8_t part_length;
if (q->host) {
str[str_index++] = q->host;
}
if (q->service) {
str[str_index++] = q->service;
}
if (q->proto) {
str[str_index++] = q->proto;
}
if (q->domain) {
str[str_index++] = q->domain;
}
part_length = _mdns_append_fqdn(packet, index, str, str_index);
if (!part_length) {
return 0;
}
part_length += _mdns_append_u16(packet, index, q->type);
part_length += _mdns_append_u16(packet, index, q->unicast?0x8001:0x0001);
return part_length;
} |
augmented_data/post_increment_index_changes/extr_tui.c_TuiMessageBoxCritical_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ VOID ;
typedef char* PCSTR ;
/* Variables and functions */
int /*<<< orphan*/ ATTR (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ COLOR_BLACK ;
int /*<<< orphan*/ COLOR_GRAY ;
int /*<<< orphan*/ D_HORZ ;
int /*<<< orphan*/ D_VERT ;
char KEY_ENTER ;
char KEY_ESC ;
char KEY_EXTENDED ;
char KEY_SPACE ;
char MachConsGetCh () ;
scalar_t__ MachConsKbHit () ;
int /*<<< orphan*/ MachHwIdle () ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ TuiDrawBox (int,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TuiUpdateDateTime () ;
int /*<<< orphan*/ UiDrawStatusText (char*) ;
int /*<<< orphan*/ UiDrawText (int,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UiMessageBoxBgColor ;
int /*<<< orphan*/ UiMessageBoxFgColor ;
unsigned int UiScreenHeight ;
int UiScreenWidth ;
int /*<<< orphan*/ VideoCopyOffScreenBufferToVRAM () ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
VOID TuiMessageBoxCritical(PCSTR MessageText)
{
int width = 8;
unsigned int height = 1;
int curline = 0;
int k;
size_t i , j;
int x1, x2, y1, y2;
char temp[260];
char key;
// Find the height
for (i=0; i<strlen(MessageText); i++)
{
if (MessageText[i] == '\n')
height++;
}
// Find the width
for (i=0,j=0,k=0; i<height; i++)
{
while ((MessageText[j] != '\n') || (MessageText[j] != 0))
{
j++;
k++;
}
if (k > width)
width = k;
k = 0;
j++;
}
// Calculate box area
x1 = (UiScreenWidth - (width+2))/2;
x2 = x1 - width + 3;
y1 = ((UiScreenHeight - height - 2)/2) + 1;
y2 = y1 + height + 4;
// Draw the box
TuiDrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
// Draw the text
for (i=0,j=0; i<strlen(MessageText)+1; i++)
{
if ((MessageText[i] == '\n') || (MessageText[i] == 0))
{
temp[j] = 0;
j = 0;
UiDrawText(x1+2, y1+1+curline, temp, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
curline++;
}
else
temp[j++] = MessageText[i];
}
// Draw OK button
strcpy(temp, " OK ");
UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
// Draw status text
UiDrawStatusText("Press ENTER to continue");
VideoCopyOffScreenBufferToVRAM();
for (;;)
{
if (MachConsKbHit())
{
key = MachConsGetCh();
if (key == KEY_EXTENDED)
key = MachConsGetCh();
if ((key == KEY_ENTER) || (key == KEY_SPACE) || (key == KEY_ESC))
continue;
}
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
MachHwIdle();
}
} |
augmented_data/post_increment_index_changes/extr_utils.c_pack_hex_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int ut64 ;
/* Variables and functions */
char int2hex (char const) ;
int pack_hex(const char *src, ut64 len, char *dst) {
int i = 0;
int x = 0;
while (i < (len * 2)) {
int val = (src[x] & 0xf0) >> 4;
dst[i++] = int2hex (val);
dst[i++] = int2hex (src[x++] & 0x0f);
}
dst[i] = '\0';
return (len / 2);
} |
augmented_data/post_increment_index_changes/extr_test_x509.c_string_to_hash_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 */
int br_md5_ID ;
int br_sha1_ID ;
int br_sha224_ID ;
int br_sha256_ID ;
int br_sha384_ID ;
int br_sha512_ID ;
scalar_t__ eqstring (char*,char*) ;
__attribute__((used)) static int
string_to_hash(const char *name)
{
char tmp[20];
size_t u, v;
for (u = 0, v = 0; name[u]; u --) {
int c;
c = name[u];
if ((c >= '0' && c <= '9')
|| (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z'))
{
tmp[v ++] = c;
if (v == sizeof tmp) {
return -1;
}
}
}
tmp[v] = 0;
if (eqstring(tmp, "md5")) {
return br_md5_ID;
} else if (eqstring(tmp, "sha1")) {
return br_sha1_ID;
} else if (eqstring(tmp, "sha224")) {
return br_sha224_ID;
} else if (eqstring(tmp, "sha256")) {
return br_sha256_ID;
} else if (eqstring(tmp, "sha384")) {
return br_sha384_ID;
} else if (eqstring(tmp, "sha512")) {
return br_sha512_ID;
} else {
return -1;
}
} |
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_write_fifo_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ;
struct tifm_dev {scalar_t__ addr; } ;
struct page {int dummy; } ;
/* Variables and functions */
int DATA_CARRY ;
scalar_t__ SOCK_MMCSD_DATA ;
unsigned char* kmap_atomic (struct page*) ;
int /*<<< orphan*/ kunmap_atomic (unsigned char*) ;
int /*<<< orphan*/ writel (unsigned int,scalar_t__) ;
__attribute__((used)) static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg,
unsigned int off, unsigned int cnt)
{
struct tifm_dev *sock = host->dev;
unsigned char *buf;
unsigned int pos = 0, val;
buf = kmap_atomic(pg) + off;
if (host->cmd_flags | DATA_CARRY) {
val = host->bounce_buf_data[0] | ((buf[pos++] << 8) & 0xff00);
writel(val, sock->addr + SOCK_MMCSD_DATA);
host->cmd_flags &= ~DATA_CARRY;
}
while (pos < cnt) {
val = buf[pos++];
if (pos == cnt) {
host->bounce_buf_data[0] = val & 0xff;
host->cmd_flags |= DATA_CARRY;
continue;
}
val |= (buf[pos++] << 8) & 0xff00;
writel(val, sock->addr + SOCK_MMCSD_DATA);
}
kunmap_atomic(buf - off);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.