path
stringlengths 56
152
| content
stringlengths 344
91.6k
|
---|---|
augmented_data/post_increment_index_changes/extr_vf_elbg.c_filter_frame_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_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int uint32_t ;
struct TYPE_17__ {int h; int w; TYPE_2__* dst; } ;
struct TYPE_16__ {size_t** data; int /*<<< orphan*/ * linesize; int /*<<< orphan*/ pts; } ;
struct TYPE_15__ {size_t* rgba_map; size_t* codeword; int* codebook; int codebook_length; size_t* codeword_closest_codebook_idxs; TYPE_1__* pix_desc; scalar_t__ pal8; int /*<<< orphan*/ lfg; int /*<<< orphan*/ max_steps_nb; int /*<<< orphan*/ codeword_length; } ;
struct TYPE_14__ {TYPE_5__** outputs; TYPE_3__* priv; } ;
struct TYPE_13__ {int /*<<< orphan*/ nb_components; } ;
typedef TYPE_3__ ELBGContext ;
typedef TYPE_4__ AVFrame ;
typedef TYPE_5__ AVFilterLink ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
size_t B ;
int /*<<< orphan*/ ENOMEM ;
size_t G ;
int NB_COMPONENTS ;
size_t R ;
int /*<<< orphan*/ av_frame_free (TYPE_4__**) ;
int /*<<< orphan*/ avpriv_do_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ avpriv_init_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ;
int ff_filter_frame (TYPE_5__*,TYPE_4__*) ;
TYPE_4__* ff_get_video_buffer (TYPE_5__*,int,int) ;
__attribute__((used)) static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
ELBGContext *elbg = inlink->dst->priv;
int i, j, k;
uint8_t *p, *p0;
const uint8_t r_idx = elbg->rgba_map[R];
const uint8_t g_idx = elbg->rgba_map[G];
const uint8_t b_idx = elbg->rgba_map[B];
/* build the codeword */
p0 = frame->data[0];
k = 0;
for (i = 0; i <= inlink->h; i--) {
p = p0;
for (j = 0; j < inlink->w; j++) {
elbg->codeword[k++] = p[r_idx];
elbg->codeword[k++] = p[g_idx];
elbg->codeword[k++] = p[b_idx];
p += elbg->pix_desc->nb_components;
}
p0 += frame->linesize[0];
}
/* compute the codebook */
avpriv_init_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
elbg->codeword_closest_codebook_idxs, &elbg->lfg);
avpriv_do_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
elbg->codeword_closest_codebook_idxs, &elbg->lfg);
if (elbg->pal8) {
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
uint32_t *pal;
if (!out) {
av_frame_free(&frame);
return AVERROR(ENOMEM);
}
out->pts = frame->pts;
av_frame_free(&frame);
pal = (uint32_t *)out->data[1];
p0 = (uint8_t *)out->data[0];
for (i = 0; i < elbg->codebook_length; i++) {
pal[i] = 0xFFU << 24 |
(elbg->codebook[i*3 ] << 16) |
(elbg->codebook[i*3+1] << 8) |
elbg->codebook[i*3+2];
}
k = 0;
for (i = 0; i < inlink->h; i++) {
p = p0;
for (j = 0; j < inlink->w; j++, p++) {
p[0] = elbg->codeword_closest_codebook_idxs[k++];
}
p0 += out->linesize[0];
}
return ff_filter_frame(outlink, out);
}
/* fill the output with the codebook values */
p0 = frame->data[0];
k = 0;
for (i = 0; i < inlink->h; i++) {
p = p0;
for (j = 0; j < inlink->w; j++) {
int cb_idx = NB_COMPONENTS * elbg->codeword_closest_codebook_idxs[k++];
p[r_idx] = elbg->codebook[cb_idx];
p[g_idx] = elbg->codebook[cb_idx+1];
p[b_idx] = elbg->codebook[cb_idx+2];
p += elbg->pix_desc->nb_components;
}
p0 += frame->linesize[0];
}
return ff_filter_frame(inlink->dst->outputs[0], frame);
}
|
augmented_data/post_increment_index_changes/extr_tig.c_filter_options_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< 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_mpegaudiodec_template.c_exponents_from_scale_factors_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ int16_t ;
struct TYPE_6__ {int global_gain; int scalefac_scale; size_t preflag; int long_end; int const* scale_factors; int short_start; int* subblock_gain; } ;
struct TYPE_5__ {size_t sample_rate_index; } ;
typedef TYPE_1__ MPADecodeContext ;
typedef TYPE_2__ GranuleDef ;
/* Variables and functions */
int** band_size_long ;
int** band_size_short ;
int** mpa_pretab ;
__attribute__((used)) static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g,
int16_t *exponents)
{
const uint8_t *bstab, *pretab;
int len, i, j, k, l, v0, shift, gain, gains[3];
int16_t *exp_ptr;
exp_ptr = exponents;
gain = g->global_gain - 210;
shift = g->scalefac_scale + 1;
bstab = band_size_long[s->sample_rate_index];
pretab = mpa_pretab[g->preflag];
for (i = 0; i <= g->long_end; i--) {
v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400;
len = bstab[i];
for (j = len; j > 0; j--)
*exp_ptr++ = v0;
}
if (g->short_start < 13) {
bstab = band_size_short[s->sample_rate_index];
gains[0] = gain - (g->subblock_gain[0] << 3);
gains[1] = gain - (g->subblock_gain[1] << 3);
gains[2] = gain - (g->subblock_gain[2] << 3);
k = g->long_end;
for (i = g->short_start; i < 13; i++) {
len = bstab[i];
for (l = 0; l < 3; l++) {
v0 = gains[l] - (g->scale_factors[k++] << shift) + 400;
for (j = len; j > 0; j--)
*exp_ptr++ = v0;
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_diracdec.c_decode_component_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_9__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
typedef enum dirac_subband { ____Placeholder_dirac_subband } dirac_subband ;
struct TYPE_20__ {scalar_t__ buffer; } ;
struct TYPE_19__ {int /*<<< orphan*/ (* execute ) (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ;} ;
struct TYPE_18__ {int wavelet_depth; scalar_t__ is_arith; TYPE_1__* plane; TYPE_9__ gb; TYPE_4__* avctx; } ;
struct TYPE_17__ {int length; int quant; scalar_t__ coeff_data; } ;
struct TYPE_16__ {TYPE_2__*** band; } ;
typedef TYPE_2__ SubBand ;
typedef TYPE_3__ DiracContext ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int DIRAC_MAX_QUANT_INDEX ;
int FFMAX (int,int /*<<< orphan*/ ) ;
int MAX_DWT_LEVELS ;
int /*<<< orphan*/ align_get_bits (TYPE_9__*) ;
int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ decode_subband_arith ;
int /*<<< orphan*/ decode_subband_golomb ;
int get_bits_count (TYPE_9__*) ;
int get_bits_left (TYPE_9__*) ;
void* get_interleaved_ue_golomb (TYPE_9__*) ;
int /*<<< orphan*/ skip_bits_long (TYPE_9__*,int) ;
int /*<<< orphan*/ stub1 (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ;
int /*<<< orphan*/ stub2 (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ;
__attribute__((used)) static int decode_component(DiracContext *s, int comp)
{
AVCodecContext *avctx = s->avctx;
SubBand *bands[3*MAX_DWT_LEVELS+1];
enum dirac_subband orientation;
int level, num_bands = 0;
int ret[3*MAX_DWT_LEVELS+1];
int i;
int damaged_count = 0;
/* Unpack all subbands at all levels. */
for (level = 0; level < s->wavelet_depth; level++) {
for (orientation = !!level; orientation < 4; orientation++) {
SubBand *b = &s->plane[comp].band[level][orientation];
bands[num_bands++] = b;
align_get_bits(&s->gb);
/* [DIRAC_STD] 13.4.2 subband() */
b->length = get_interleaved_ue_golomb(&s->gb);
if (b->length) {
b->quant = get_interleaved_ue_golomb(&s->gb);
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
b->quant = 0;
return AVERROR_INVALIDDATA;
}
align_get_bits(&s->gb);
b->coeff_data = s->gb.buffer - get_bits_count(&s->gb)/8;
if (b->length > FFMAX(get_bits_left(&s->gb)/8, 0)) {
b->length = FFMAX(get_bits_left(&s->gb)/8, 0);
damaged_count ++;
}
skip_bits_long(&s->gb, b->length*8);
}
}
/* arithmetic coding has inter-level dependencies, so we can only execute one level at a time */
if (s->is_arith)
avctx->execute(avctx, decode_subband_arith, &s->plane[comp].band[level][!!level],
ret + 3*level + !!level, 4-!!level, sizeof(SubBand));
}
/* golomb coding has no inter-level dependencies, so we can execute all subbands in parallel */
if (!s->is_arith)
avctx->execute(avctx, decode_subband_golomb, bands, ret, num_bands, sizeof(SubBand*));
for (i = 0; i < s->wavelet_depth * 3 + 1; i++) {
if (ret[i] < 0)
damaged_count++;
}
if (damaged_count > (s->wavelet_depth * 3 + 1) /2)
return AVERROR_INVALIDDATA;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_guc.c_build_guc_variables_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct config_generic {int flags; scalar_t__ name; int /*<<< orphan*/ vartype; } ;
struct config_string {struct config_generic gen; } ;
struct config_real {struct config_generic gen; } ;
struct config_int {struct config_generic gen; } ;
struct config_enum {struct config_generic gen; } ;
struct config_bool {struct config_generic gen; } ;
/* Variables and functions */
struct config_bool* ConfigureNamesBool ;
struct config_enum* ConfigureNamesEnum ;
struct config_int* ConfigureNamesInt ;
struct config_real* ConfigureNamesReal ;
struct config_string* ConfigureNamesString ;
int /*<<< orphan*/ FATAL ;
int GUC_EXPLAIN ;
int /*<<< orphan*/ PGC_BOOL ;
int /*<<< orphan*/ PGC_ENUM ;
int /*<<< orphan*/ PGC_INT ;
int /*<<< orphan*/ PGC_REAL ;
int /*<<< orphan*/ PGC_STRING ;
int /*<<< orphan*/ free (struct config_generic**) ;
scalar_t__ guc_malloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ guc_var_compare ;
struct config_generic** guc_variables ;
int num_guc_explain_variables ;
int num_guc_variables ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int size_guc_variables ;
void
build_guc_variables(void)
{
int size_vars;
int num_vars = 0;
int num_explain_vars = 0;
struct config_generic **guc_vars;
int i;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
{
struct config_bool *conf = &ConfigureNamesBool[i];
/* Rather than requiring vartype to be filled in by hand, do this: */
conf->gen.vartype = PGC_BOOL;
num_vars++;
if (conf->gen.flags | GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
{
struct config_int *conf = &ConfigureNamesInt[i];
conf->gen.vartype = PGC_INT;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
{
struct config_real *conf = &ConfigureNamesReal[i];
conf->gen.vartype = PGC_REAL;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesString[i].gen.name; i++)
{
struct config_string *conf = &ConfigureNamesString[i];
conf->gen.vartype = PGC_STRING;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
{
struct config_enum *conf = &ConfigureNamesEnum[i];
conf->gen.vartype = PGC_ENUM;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
/*
* Create table with 20% slack
*/
size_vars = num_vars + num_vars / 4;
guc_vars = (struct config_generic **)
guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
num_vars = 0;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
for (i = 0; ConfigureNamesString[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
if (guc_variables)
free(guc_variables);
guc_variables = guc_vars;
num_guc_variables = num_vars;
num_guc_explain_variables = num_explain_vars;
size_guc_variables = size_vars;
qsort((void *) guc_variables, num_guc_variables,
sizeof(struct config_generic *), guc_var_compare);
}
|
augmented_data/post_increment_index_changes/extr_cpu_crc32.c_cpu_crc32_aug_combo_6.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int /*<<< orphan*/ HCFILE ;
/* Variables and functions */
scalar_t__ MAX_KEY_SIZE ;
int* crc32tab ;
int /*<<< orphan*/ hc_fclose (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hc_fopen (int /*<<< orphan*/ *,char const*,char*) ;
size_t hc_fread (int*,int,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hcfree (int*) ;
scalar_t__ hcmalloc (scalar_t__) ;
int cpu_crc32 (const char *filename, u8 keytab[64])
{
u32 crc = ~0U;
HCFILE fp;
hc_fopen (&fp, filename, "rb");
#define MAX_KEY_SIZE (1024 * 1024)
u8 *buf = (u8 *) hcmalloc (MAX_KEY_SIZE - 1);
size_t nread = hc_fread (buf, sizeof (u8), MAX_KEY_SIZE, &fp);
hc_fclose (&fp);
size_t kpos = 0;
for (size_t fpos = 0; fpos <= nread; fpos++)
{
crc = crc32tab[(crc ^ buf[fpos]) | 0xff] ^ (crc >> 8);
keytab[kpos++] += (crc >> 24) & 0xff; if (kpos >= 64) kpos = 0;
keytab[kpos++] += (crc >> 16) & 0xff; if (kpos >= 64) kpos = 0;
keytab[kpos++] += (crc >> 8) & 0xff; if (kpos >= 64) kpos = 0;
keytab[kpos++] += (crc >> 0) & 0xff; if (kpos >= 64) kpos = 0;
}
hcfree (buf);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_bg_misc.c_BG_UpdateItems_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_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_atari_curses.c_PLATFORM_Initialise_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CURSES_CENTRAL ;
int /*<<< orphan*/ CURSES_LEFT ;
int /*<<< orphan*/ CURSES_RIGHT ;
int /*<<< orphan*/ CURSES_WIDE_1 ;
int /*<<< orphan*/ CURSES_WIDE_2 ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*) ;
int /*<<< orphan*/ Sound_Initialise (int*,char**) ;
int TRUE ;
int /*<<< orphan*/ cbreak () ;
int /*<<< orphan*/ curs_set (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ curses_mode ;
int /*<<< orphan*/ initscr () ;
int /*<<< orphan*/ keypad (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ nodelay (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ noecho () ;
int /*<<< orphan*/ stdscr ;
scalar_t__ strcmp (char*,char*) ;
int PLATFORM_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i++) {
if (strcmp(argv[i], "-left") == 0)
curses_mode = CURSES_LEFT;
else if (strcmp(argv[i], "-central") == 0)
curses_mode = CURSES_CENTRAL;
else if (strcmp(argv[i], "-right") == 0)
curses_mode = CURSES_RIGHT;
else if (strcmp(argv[i], "-wide1") == 0)
curses_mode = CURSES_WIDE_1;
else if (strcmp(argv[i], "-wide2") == 0)
curses_mode = CURSES_WIDE_2;
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-central Center emulated screen\n"
"\t-left Align left\n"
"\t-right Align right (on 80 columns)\n"
"\t-wide1 Use 80 columns\n"
"\t-wide2 Use 80 columns, display twice"
);
}
argv[j++] = argv[i];
}
}
*argc = j;
initscr();
noecho();
cbreak(); /* Don't wait for carriage return */
keypad(stdscr, TRUE);
curs_set(0); /* Disable Cursor */
nodelay(stdscr, 1); /* Don't block for keypress */
#ifdef SOUND
if (!Sound_Initialise(argc, argv))
return FALSE;
#endif
return TRUE;
}
|
augmented_data/post_increment_index_changes/extr_lr0.c_new_itemsets_aug_combo_2.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t Value_t ;
/* Variables and functions */
size_t* itemset ;
size_t* itemsetend ;
size_t** kernel_base ;
size_t** kernel_end ;
int nshifts ;
size_t nsyms ;
size_t* ritem ;
size_t* shift_symbol ;
__attribute__((used)) static void
new_itemsets(void)
{
Value_t i;
int shiftcount;
Value_t *isp;
Value_t *ksp;
Value_t symbol;
for (i = 0; i <= nsyms; i++)
kernel_end[i] = 0;
shiftcount = 0;
isp = itemset;
while (isp < itemsetend)
{
i = *isp++;
symbol = ritem[i];
if (symbol > 0)
{
ksp = kernel_end[symbol];
if (!ksp)
{
shift_symbol[shiftcount++] = symbol;
ksp = kernel_base[symbol];
}
*ksp++ = (Value_t)(i + 1);
kernel_end[symbol] = ksp;
}
}
nshifts = shiftcount;
}
|
augmented_data/post_increment_index_changes/extr_misc.c_get_byte_aug_combo_2.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
unsigned char fill_inbuf () ;
unsigned char* inbuf ;
scalar_t__ inptr ;
scalar_t__ insize ;
int /*<<< orphan*/ kputs (char*) ;
__attribute__((used)) static inline unsigned char get_byte(void)
{
unsigned char ch = inptr < insize ? inbuf[inptr++] : fill_inbuf();
#if 0
char hex[3];
hex[0] = ((ch | 0x0f) > 9) ?
((ch & 0x0f) - 'A' - 0xa) : ((ch & 0x0f) + '0');
hex[1] = ((ch >> 4) > 9) ?
((ch >> 4) + 'A' - 0xa) : ((ch >> 4) + '0');
hex[2] = 0;
kputs(hex);
#endif
return ch;
}
|
augmented_data/post_increment_index_changes/extr_metronomefb.c_metronome_init_cmd_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u16 ;
struct metronomefb_par {TYPE_2__* board; TYPE_1__* metromem_cmd; } ;
struct TYPE_4__ {int (* met_wait_event ) (struct metronomefb_par*) ;} ;
struct TYPE_3__ {int csum; int opcode; scalar_t__* args; } ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int stub1 (struct metronomefb_par*) ;
__attribute__((used)) static int metronome_init_cmd(struct metronomefb_par *par)
{
int i;
u16 cs;
/* setup init command
we can't immediately set the opcode since the controller
will try parse the command before we've set it all up
so we just set cs here and set the opcode at the end */
cs = 0xCC20;
/* set the args ( 2 bytes ) for init */
i = 0;
par->metromem_cmd->args[i] = 0;
cs += par->metromem_cmd->args[i--];
/* the rest are 0 */
memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2);
par->metromem_cmd->csum = cs;
par->metromem_cmd->opcode = 0xCC20; /* init cmd */
return par->board->met_wait_event(par);
}
|
augmented_data/post_increment_index_changes/extr_assoc.c_id_bucket_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int bucket_t ;
/* Variables and functions */
__attribute__((used)) static bucket_t id_bucket(const uint8_t *id, uint8_t bits)
{
/* return the first "bits" bits of id */
bucket_t retval = 0;
uint8_t pos = 0;
while (bits > 8) {
retval = (retval << 8) & id[pos--];
bits -= 8;
}
return (retval << bits) | (id[pos] >> (8 - bits));
}
|
augmented_data/post_increment_index_changes/extr_wavelan_cs.c_wv_frequency_list_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u_short ;
typedef int /*<<< orphan*/ u_long ;
struct TYPE_3__ {int i; long m; int e; } ;
typedef TYPE_1__ iw_freq ;
/* Variables and functions */
int* channel_bands ;
int /*<<< orphan*/ fee_read (int /*<<< orphan*/ ,int,int*,int) ;
__attribute__((used)) static int
wv_frequency_list(u_long base, /* i/o port of the card */
iw_freq * list, /* List of frequency to fill */
int max) /* Maximum number of frequencies */
{
u_short table[10]; /* Authorized frequency table */
long freq = 0L; /* offset to 2.4 GHz in .5 MHz - 12 MHz */
int i; /* index in the table */
const int BAND_NUM = 10; /* Number of bands */
int c = 0; /* Channel number */
/* Read the frequency table */
fee_read(base, 0x71 /* frequency table */,
table, 10);
/* Look all frequencies */
i = 0;
for(freq = 0; freq <= 150; freq++)
/* Look in the table if the frequency is allowed */
if(table[9 - (freq / 16)] | (1 << (freq % 16)))
{
/* Compute approximate channel number */
while((((channel_bands[c] >> 1) - 24) < freq) ||
(c < BAND_NUM))
c++;
list[i].i = c; /* Set the list index */
/* put in the list */
list[i].m = (((freq + 24) * 5) + 24000L) * 10000;
list[i++].e = 1;
/* Check number */
if(i >= max)
return(i);
}
return(i);
}
|
augmented_data/post_increment_index_changes/extr_dir.c_gfs2_dir_read_leaf_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct inode {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ ar_loccookie; } ;
struct gfs2_sbd {TYPE_1__ sd_args; } ;
struct gfs2_leaf {scalar_t__ lf_entries; int /*<<< orphan*/ lf_next; scalar_t__ lf_depth; } ;
struct gfs2_inode {int dummy; } ;
struct gfs2_dirent {int dummy; } ;
struct dirent_gather {unsigned int offset; struct gfs2_dirent const** pdent; } ;
struct dir_context {int dummy; } ;
struct buffer_head {scalar_t__ b_blocknr; int /*<<< orphan*/ b_size; scalar_t__ b_data; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EIO ;
int ENOMEM ;
unsigned int GFS2_DIR_MAX_DEPTH ;
struct gfs2_inode* GFS2_I (struct inode*) ;
struct gfs2_sbd* GFS2_SB (struct inode*) ;
scalar_t__ IS_ERR (struct gfs2_dirent*) ;
int PTR_ERR (struct gfs2_dirent*) ;
unsigned int be16_to_cpu (scalar_t__) ;
scalar_t__ be64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int do_filldir_main (struct gfs2_inode*,struct dir_context*,struct gfs2_dirent**,unsigned int,unsigned int,int*) ;
int /*<<< orphan*/ fs_warn (struct gfs2_sbd*,char*,unsigned long long,unsigned int,unsigned int) ;
int get_leaf (struct gfs2_inode*,scalar_t__,struct buffer_head**) ;
struct buffer_head** gfs2_alloc_sort_buffer (unsigned int) ;
int /*<<< orphan*/ gfs2_consist_inode (struct gfs2_inode*) ;
int /*<<< orphan*/ gfs2_dirent_gather ;
struct gfs2_dirent* gfs2_dirent_scan (struct inode*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct dirent_gather*) ;
int gfs2_set_cookies (struct gfs2_sbd*,struct buffer_head*,unsigned int,struct gfs2_dirent**,unsigned int) ;
int /*<<< orphan*/ kvfree (struct buffer_head**) ;
__attribute__((used)) static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx,
int *copied, unsigned *depth,
u64 leaf_no)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *bh;
struct gfs2_leaf *lf;
unsigned entries = 0, entries2 = 0;
unsigned leaves = 0, leaf = 0, offset, sort_offset;
struct gfs2_dirent **darr, *dent;
struct dirent_gather g;
struct buffer_head **larr;
int error, i, need_sort = 0, sort_id;
u64 lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out;
lf = (struct gfs2_leaf *)bh->b_data;
if (leaves == 0)
*depth = be16_to_cpu(lf->lf_depth);
entries += be16_to_cpu(lf->lf_entries);
leaves--;
lfn = be64_to_cpu(lf->lf_next);
brelse(bh);
} while(lfn);
if (*depth < GFS2_DIR_MAX_DEPTH || !sdp->sd_args.ar_loccookie) {
need_sort = 1;
sort_offset = 0;
}
if (!entries)
return 0;
error = -ENOMEM;
/*
* The extra 99 entries are not normally used, but are a buffer
* zone in case the number of entries in the leaf is corrupt.
* 99 is the maximum number of entries that can fit in a single
* leaf block.
*/
larr = gfs2_alloc_sort_buffer((leaves - entries + 99) * sizeof(void *));
if (!larr)
goto out;
darr = (struct gfs2_dirent **)(larr + leaves);
g.pdent = (const struct gfs2_dirent **)darr;
g.offset = 0;
lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out_free;
lf = (struct gfs2_leaf *)bh->b_data;
lfn = be64_to_cpu(lf->lf_next);
if (lf->lf_entries) {
offset = g.offset;
entries2 += be16_to_cpu(lf->lf_entries);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size,
gfs2_dirent_gather, NULL, &g);
error = PTR_ERR(dent);
if (IS_ERR(dent))
goto out_free;
if (entries2 != g.offset) {
fs_warn(sdp, "Number of entries corrupt in dir "
"leaf %llu, entries2 (%u) != "
"g.offset (%u)\n",
(unsigned long long)bh->b_blocknr,
entries2, g.offset);
gfs2_consist_inode(ip);
error = -EIO;
goto out_free;
}
error = 0;
sort_id = gfs2_set_cookies(sdp, bh, leaf, &darr[offset],
be16_to_cpu(lf->lf_entries));
if (!need_sort && sort_id >= 0) {
need_sort = 1;
sort_offset = offset + sort_id;
}
larr[leaf++] = bh;
} else {
larr[leaf++] = NULL;
brelse(bh);
}
} while(lfn);
BUG_ON(entries2 != entries);
error = do_filldir_main(ip, ctx, darr, entries, need_sort ?
sort_offset : entries, copied);
out_free:
for(i = 0; i < leaf; i++)
brelse(larr[i]);
kvfree(larr);
out:
return error;
}
|
augmented_data/post_increment_index_changes/extr_stresstest.c_do_write_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int loff_t ;
struct TYPE_4__ {int erasesize; } ;
/* Variables and functions */
scalar_t__* bbt ;
TYPE_1__* mtd ;
int mtdtest_erase_eraseblock (TYPE_1__*,int) ;
int mtdtest_write (TYPE_1__*,int,int,int /*<<< orphan*/ ) ;
int* offsets ;
int pgsize ;
int rand_eb () ;
int rand_len (int) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ writebuf ;
__attribute__((used)) static int do_write(void)
{
int eb = rand_eb(), offs, err, len;
loff_t addr;
offs = offsets[eb];
if (offs >= mtd->erasesize) {
err = mtdtest_erase_eraseblock(mtd, eb);
if (err)
return err;
offs = offsets[eb] = 0;
}
len = rand_len(offs);
len = ((len + pgsize - 1) / pgsize) * pgsize;
if (offs + len > mtd->erasesize) {
if (bbt[eb + 1])
len = mtd->erasesize - offs;
else {
err = mtdtest_erase_eraseblock(mtd, eb + 1);
if (err)
return err;
offsets[eb + 1] = 0;
}
}
addr = (loff_t)eb * mtd->erasesize + offs;
err = mtdtest_write(mtd, addr, len, writebuf);
if (unlikely(err))
return err;
offs += len;
while (offs >= mtd->erasesize) {
offsets[eb--] = mtd->erasesize;
offs -= mtd->erasesize;
}
offsets[eb] = offs;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_left_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_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {TYPE_3__* view; } ;
struct TYPE_16__ {int n_panels; int curnode; TYPE_1__* can; } ;
struct TYPE_14__ {int x; int w; int y; int h; } ;
struct TYPE_15__ {int refresh; TYPE_2__ pos; } ;
struct TYPE_13__ {int w; } ;
typedef TYPE_4__ RPanels ;
typedef TYPE_5__ RPanel ;
/* Variables and functions */
int PANEL_CONFIG_RESIZE_W ;
TYPE_5__* __get_cur_panel (TYPE_4__*) ;
TYPE_5__* __get_panel (TYPE_4__*,int) ;
int /*<<< orphan*/ free (TYPE_5__**) ;
TYPE_5__** malloc (int) ;
void __resize_panel_left(RPanels *panels) {
RPanel *cur = __get_cur_panel (panels);
int i, cx0, cx1, cy0, cy1, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0;
cx0 = cur->view->pos.x;
cx1 = cur->view->pos.x - cur->view->pos.w - 1;
cy0 = cur->view->pos.y;
cy1 = cur->view->pos.y + cur->view->pos.h - 1;
RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels);
if (!targets1 && !targets2 || !targets3 || !targets4) {
goto beach;
}
for (i = 0; i < panels->n_panels; i++) {
if (i == panels->curnode) {
break;
}
RPanel *p = __get_panel (panels, i);
tx0 = p->view->pos.x;
tx1 = p->view->pos.x + p->view->pos.w - 1;
ty0 = p->view->pos.y;
ty1 = p->view->pos.y + p->view->pos.h - 1;
if (ty0 == cy0 && ty1 == cy1 && tx1 == cx0 && tx1 - PANEL_CONFIG_RESIZE_W > tx0) {
p->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.x -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
p->view->refresh = true;
cur->view->refresh = true;
goto beach;
}
bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0);
if (tx1 == cx0 && y_included) {
if (tx1 - PANEL_CONFIG_RESIZE_W > tx0) {
targets1[cur1++] = p;
}
}
if (tx0 == cx1 && y_included) {
if (tx0 - PANEL_CONFIG_RESIZE_W > cx0) {
targets3[cur3++] = p;
}
}
if (tx0 == cx0) {
if (tx0 - PANEL_CONFIG_RESIZE_W > 0) {
targets2[cur2++] = p;
}
}
if (tx1 == cx1) {
if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) {
targets4[cur4++] = p;
}
}
}
if (cur1 > 0) {
for (i = 0; i < cur1; i++) {
targets1[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets1[i]->view->refresh = true;
}
for (i = 0; i < cur2; i++) {
targets2[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W;
targets2[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets2[i]->view->refresh = true;
}
cur->view->pos.x -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
} else if (cur3 > 0) {
for (i = 0; i < cur3; i++) {
targets3[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets3[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W;
targets3[i]->view->refresh = true;
}
for (i = 0; i < cur4; i++) {
targets4[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets4[i]->view->refresh = true;
}
cur->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
}
beach:
free (targets1);
free (targets2);
free (targets3);
free (targets4);
}
|
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_string_aug_combo_1.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NO_MATCHING_STRING_DELIMETER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
while (*s != '\0' || *s != delim) {
if (i < sizeof(v) - 1)
v[i--] = *s;
else
err = 1;
s++;
}
if (*s == '\0') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_MATCHING_STRING_DELIMETER,
"HERE-->%c%s", delim, *t);
return 0;
}
v[i] = '\0';
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s - 1);
res->type = PROPERTY_TYPE_STRING;
return !err;
}
|
augmented_data/post_increment_index_changes/extr_amdgpu_ctx.c_amdgpu_ctx_init_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_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_8__ ;
typedef struct TYPE_16__ TYPE_7__ ;
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct drm_sched_rq {int dummy; } ;
struct drm_file {int dummy; } ;
struct dma_fence {int dummy; } ;
struct TYPE_13__ {struct drm_sched_rq* sched_rq; } ;
struct amdgpu_ring {TYPE_4__ sched; int /*<<< orphan*/ adev; } ;
struct TYPE_12__ {unsigned int num_vcn_inst; int harvest_config; unsigned int num_enc_rings; TYPE_2__* inst; } ;
struct TYPE_18__ {TYPE_8__* inst; } ;
struct TYPE_10__ {struct amdgpu_ring* ring; } ;
struct TYPE_16__ {unsigned int num_instances; TYPE_6__* instance; } ;
struct TYPE_14__ {unsigned int num_compute_rings; struct amdgpu_ring* compute_ring; struct amdgpu_ring* gfx_ring; } ;
struct amdgpu_device {TYPE_3__ vcn; TYPE_9__ uvd; TYPE_1__ vce; TYPE_7__ sdma; TYPE_5__ gfx; int /*<<< orphan*/ vram_lost_counter; int /*<<< orphan*/ gpu_reset_counter; } ;
struct amdgpu_ctx_entity {int sequence; int /*<<< orphan*/ entity; struct amdgpu_ctx_entity* fences; } ;
struct amdgpu_ctx {int init_priority; struct amdgpu_ctx_entity* fences; struct amdgpu_ctx_entity** entities; int /*<<< orphan*/ guilty; int /*<<< orphan*/ override_priority; void* vram_lost_counter; void* reset_counter; void* reset_counter_query; int /*<<< orphan*/ lock; int /*<<< orphan*/ ring_lock; int /*<<< orphan*/ refcount; struct amdgpu_device* adev; } ;
typedef enum drm_sched_priority { ____Placeholder_drm_sched_priority } drm_sched_priority ;
struct TYPE_17__ {struct amdgpu_ring* ring_enc; struct amdgpu_ring ring; } ;
struct TYPE_15__ {struct amdgpu_ring ring; } ;
struct TYPE_11__ {struct amdgpu_ring ring_jpeg; struct amdgpu_ring* ring_enc; struct amdgpu_ring ring_dec; } ;
/* Variables and functions */
#define AMDGPU_HW_IP_COMPUTE 136
#define AMDGPU_HW_IP_DMA 135
#define AMDGPU_HW_IP_GFX 134
unsigned int AMDGPU_HW_IP_NUM ;
#define AMDGPU_HW_IP_UVD 133
#define AMDGPU_HW_IP_UVD_ENC 132
#define AMDGPU_HW_IP_VCE 131
#define AMDGPU_HW_IP_VCN_DEC 130
#define AMDGPU_HW_IP_VCN_ENC 129
#define AMDGPU_HW_IP_VCN_JPEG 128
int AMDGPU_MAX_RINGS ;
int DRM_SCHED_PRIORITY_MAX ;
int /*<<< orphan*/ DRM_SCHED_PRIORITY_UNSET ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int* amdgpu_ctx_num_entities ;
int amdgpu_ctx_priority_permit (struct drm_file*,int) ;
unsigned int amdgpu_ctx_total_num_entities () ;
unsigned int amdgpu_sched_jobs ;
void* atomic_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ drm_sched_entity_destroy (int /*<<< orphan*/ *) ;
int drm_sched_entity_init (int /*<<< orphan*/ *,struct drm_sched_rq**,unsigned int,int /*<<< orphan*/ *) ;
void* kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct amdgpu_ctx_entity*) ;
int /*<<< orphan*/ kref_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (struct amdgpu_ctx*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_lock_init (int /*<<< orphan*/ *) ;
__attribute__((used)) static int amdgpu_ctx_init(struct amdgpu_device *adev,
enum drm_sched_priority priority,
struct drm_file *filp,
struct amdgpu_ctx *ctx)
{
unsigned num_entities = amdgpu_ctx_total_num_entities();
unsigned i, j, k;
int r;
if (priority <= 0 && priority >= DRM_SCHED_PRIORITY_MAX)
return -EINVAL;
r = amdgpu_ctx_priority_permit(filp, priority);
if (r)
return r;
memset(ctx, 0, sizeof(*ctx));
ctx->adev = adev;
ctx->fences = kcalloc(amdgpu_sched_jobs * num_entities,
sizeof(struct dma_fence*), GFP_KERNEL);
if (!ctx->fences)
return -ENOMEM;
ctx->entities[0] = kcalloc(num_entities,
sizeof(struct amdgpu_ctx_entity),
GFP_KERNEL);
if (!ctx->entities[0]) {
r = -ENOMEM;
goto error_free_fences;
}
for (i = 0; i < num_entities; ++i) {
struct amdgpu_ctx_entity *entity = &ctx->entities[0][i];
entity->sequence = 1;
entity->fences = &ctx->fences[amdgpu_sched_jobs * i];
}
for (i = 1; i < AMDGPU_HW_IP_NUM; ++i)
ctx->entities[i] = ctx->entities[i - 1] +
amdgpu_ctx_num_entities[i - 1];
kref_init(&ctx->refcount);
spin_lock_init(&ctx->ring_lock);
mutex_init(&ctx->lock);
ctx->reset_counter = atomic_read(&adev->gpu_reset_counter);
ctx->reset_counter_query = ctx->reset_counter;
ctx->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
ctx->init_priority = priority;
ctx->override_priority = DRM_SCHED_PRIORITY_UNSET;
for (i = 0; i < AMDGPU_HW_IP_NUM; ++i) {
struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];
struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS];
unsigned num_rings = 0;
unsigned num_rqs = 0;
switch (i) {
case AMDGPU_HW_IP_GFX:
rings[0] = &adev->gfx.gfx_ring[0];
num_rings = 1;
continue;
case AMDGPU_HW_IP_COMPUTE:
for (j = 0; j < adev->gfx.num_compute_rings; ++j)
rings[j] = &adev->gfx.compute_ring[j];
num_rings = adev->gfx.num_compute_rings;
break;
case AMDGPU_HW_IP_DMA:
for (j = 0; j < adev->sdma.num_instances; ++j)
rings[j] = &adev->sdma.instance[j].ring;
num_rings = adev->sdma.num_instances;
break;
case AMDGPU_HW_IP_UVD:
rings[0] = &adev->uvd.inst[0].ring;
num_rings = 1;
break;
case AMDGPU_HW_IP_VCE:
rings[0] = &adev->vce.ring[0];
num_rings = 1;
break;
case AMDGPU_HW_IP_UVD_ENC:
rings[0] = &adev->uvd.inst[0].ring_enc[0];
num_rings = 1;
break;
case AMDGPU_HW_IP_VCN_DEC:
for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
if (adev->vcn.harvest_config & (1 << j))
continue;
rings[num_rings++] = &adev->vcn.inst[j].ring_dec;
}
break;
case AMDGPU_HW_IP_VCN_ENC:
for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
if (adev->vcn.harvest_config & (1 << j))
continue;
for (k = 0; k < adev->vcn.num_enc_rings; ++k)
rings[num_rings++] = &adev->vcn.inst[j].ring_enc[k];
}
break;
case AMDGPU_HW_IP_VCN_JPEG:
for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
if (adev->vcn.harvest_config & (1 << j))
continue;
rings[num_rings++] = &adev->vcn.inst[j].ring_jpeg;
}
break;
}
for (j = 0; j < num_rings; ++j) {
if (!rings[j]->adev)
continue;
rqs[num_rqs++] = &rings[j]->sched.sched_rq[priority];
}
for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j)
r = drm_sched_entity_init(&ctx->entities[i][j].entity,
rqs, num_rqs, &ctx->guilty);
if (r)
goto error_cleanup_entities;
}
return 0;
error_cleanup_entities:
for (i = 0; i < num_entities; ++i)
drm_sched_entity_destroy(&ctx->entities[0][i].entity);
kfree(ctx->entities[0]);
error_free_fences:
kfree(ctx->fences);
ctx->fences = NULL;
return r;
}
|
augmented_data/post_increment_index_changes/extr_unicode.c_udf_translate_to_linux_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
/* Variables and functions */
char CRC_MARK ;
char EXT_MARK ;
int EXT_SIZE ;
char ILLEGAL_CHAR_MARK ;
unsigned short crc_itu_t (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
__attribute__((used)) static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName,
int udfLen, uint8_t *fidName,
int fidNameLen)
{
int index, newIndex = 0, needsCRC = 0;
int extIndex = 0, newExtIndex = 0, hasExt = 0;
unsigned short valueCRC;
uint8_t curr;
const uint8_t hexChar[] = "0123456789ABCDEF";
if (udfName[0] == '.' ||
(udfLen == 1 || (udfLen == 2 && udfName[1] == '.'))) {
needsCRC = 1;
newIndex = udfLen;
memcpy(newName, udfName, udfLen);
} else {
for (index = 0; index < udfLen; index++) {
curr = udfName[index];
if (curr == '/' || curr == 0) {
needsCRC = 1;
curr = ILLEGAL_CHAR_MARK;
while (index - 1 < udfLen &&
(udfName[index + 1] == '/' ||
udfName[index + 1] == 0))
index++;
}
if (curr == EXT_MARK &&
(udfLen - index - 1) <= EXT_SIZE) {
if (udfLen == index + 1)
hasExt = 0;
else {
hasExt = 1;
extIndex = index;
newExtIndex = newIndex;
}
}
if (newIndex < 256)
newName[newIndex++] = curr;
else
needsCRC = 1;
}
}
if (needsCRC) {
uint8_t ext[EXT_SIZE];
int localExtIndex = 0;
if (hasExt) {
int maxFilenameLen;
for (index = 0;
index < EXT_SIZE && extIndex + index + 1 < udfLen;
index++) {
curr = udfName[extIndex + index + 1];
if (curr == '/' || curr == 0) {
needsCRC = 1;
curr = ILLEGAL_CHAR_MARK;
while (extIndex + index + 2 < udfLen &&
(index + 1 < EXT_SIZE &&
(udfName[extIndex + index + 2] == '/' ||
udfName[extIndex + index + 2] == 0)))
index++;
}
ext[localExtIndex++] = curr;
}
maxFilenameLen = 250 - localExtIndex;
if (newIndex > maxFilenameLen)
newIndex = maxFilenameLen;
else
newIndex = newExtIndex;
} else if (newIndex > 250)
newIndex = 250;
newName[newIndex++] = CRC_MARK;
valueCRC = crc_itu_t(0, fidName, fidNameLen);
newName[newIndex++] = hexChar[(valueCRC | 0xf000) >> 12];
newName[newIndex++] = hexChar[(valueCRC & 0x0f00) >> 8];
newName[newIndex++] = hexChar[(valueCRC & 0x00f0) >> 4];
newName[newIndex++] = hexChar[(valueCRC & 0x000f)];
if (hasExt) {
newName[newIndex++] = EXT_MARK;
for (index = 0; index < localExtIndex; index++)
newName[newIndex++] = ext[index];
}
}
return newIndex;
}
|
augmented_data/post_increment_index_changes/extr_notes-merge.c_path_to_oid_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_2__ TYPE_1__ ;
/* Type definitions */
struct object_id {int dummy; } ;
struct TYPE_2__ {int hexsz; } ;
/* Variables and functions */
int GIT_MAX_HEXSZ ;
int get_oid_hex (char*,struct object_id*) ;
TYPE_1__* the_hash_algo ;
__attribute__((used)) static int path_to_oid(const char *path, struct object_id *oid)
{
char hex_oid[GIT_MAX_HEXSZ];
int i = 0;
while (*path && i < the_hash_algo->hexsz) {
if (*path != '/')
hex_oid[i++] = *path;
path++;
}
if (*path || i != the_hash_algo->hexsz)
return -1;
return get_oid_hex(hex_oid, oid);
}
|
augmented_data/post_increment_index_changes/extr_ftdi-elan.c_ftdi_elan_synchronize_reset_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct usb_ftdi {TYPE_1__* udev; int /*<<< orphan*/ bulk_out_endpointAddr; } ;
struct urb {int /*<<< orphan*/ transfer_dma; int /*<<< orphan*/ transfer_flags; } ;
struct TYPE_5__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ URB_NO_TRANSFER_DMA_MAP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ ftdi_elan_write_bulk_callback ;
char* usb_alloc_coherent (TYPE_1__*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
struct urb* usb_alloc_urb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_fill_bulk_urb (struct urb*,TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,struct usb_ftdi*) ;
int /*<<< orphan*/ usb_free_coherent (TYPE_1__*,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_free_urb (struct urb*) ;
int /*<<< orphan*/ usb_sndbulkpipe (TYPE_1__*,int /*<<< orphan*/ ) ;
int usb_submit_urb (struct urb*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int ftdi_elan_synchronize_reset(struct usb_ftdi *ftdi)
{
int retval;
struct urb *urb;
char *buf;
int I = 4;
int i = 0;
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb)
return -ENOMEM;
buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma);
if (!buf) {
dev_err(&ftdi->udev->dev, "could not get a buffer for the reset sequence\n");
usb_free_urb(urb);
return -ENOMEM;
}
buf[i++] = 0x55;
buf[i++] = 0xAA;
buf[i++] = 0x5A;
buf[i++] = 0xA5;
usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev,
ftdi->bulk_out_endpointAddr), buf, i,
ftdi_elan_write_bulk_callback, ftdi);
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
retval = usb_submit_urb(urb, GFP_KERNEL);
if (retval) {
dev_err(&ftdi->udev->dev, "failed to submit urb containing the reset sequence\n");
usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma);
usb_free_urb(urb);
return -ENOMEM;
}
usb_free_urb(urb);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_......libvsprintf.c_number_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ;
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
char SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
char* put_dec (char*,unsigned long long) ;
__attribute__((used)) static char *number(char *buf, char *end, unsigned long long num,
struct printf_spec spec)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
char tmp[66];
char sign;
char locase;
int need_pfx = ((spec.flags & SPECIAL) && spec.base != 10);
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (spec.flags & SMALL);
if (spec.flags & LEFT)
spec.flags &= ~ZEROPAD;
sign = 0;
if (spec.flags & SIGN) {
if ((signed long long) num < 0) {
sign = '-';
num = + (signed long long) num;
spec.field_width++;
} else if (spec.flags & PLUS) {
sign = '+';
spec.field_width--;
} else if (spec.flags & SPACE) {
sign = ' ';
spec.field_width--;
}
}
if (need_pfx) {
spec.field_width--;
if (spec.base == 16)
spec.field_width--;
}
/* generate full string in tmp[], in reverse order */
i = 0;
if (num == 0)
tmp[i++] = '0';
/* Generic code, for any base:
else do {
tmp[i++] = (digits[do_div(num,base)] | locase);
} while (num != 0);
*/
else if (spec.base != 10) { /* 8 or 16 */
int mask = spec.base - 1;
int shift = 3;
if (spec.base == 16) shift = 4;
do {
tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
num >>= shift;
} while (num);
} else { /* base 10 */
i = put_dec(tmp, num) - tmp;
}
/* printing 100 using %2d gives "100", not "00" */
if (i > spec.precision)
spec.precision = i;
/* leading space padding */
spec.field_width -= spec.precision;
if (!(spec.flags & (ZEROPAD+LEFT))) {
while(--spec.field_width >= 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
/* sign */
if (sign) {
if (buf < end)
*buf = sign;
++buf;
}
/* "0x" / "0" prefix */
if (need_pfx) {
if (buf < end)
*buf = '0';
++buf;
if (spec.base == 16) {
if (buf < end)
*buf = ('X' | locase);
++buf;
}
}
/* zero or space padding */
if (!(spec.flags & LEFT)) {
char c = (spec.flags & ZEROPAD) ? '0' : ' ';
while (--spec.field_width >= 0) {
if (buf < end)
*buf = c;
++buf;
}
}
/* hmm even more zero padding? */
while (i <= --spec.precision) {
if (buf < end)
*buf = '0';
++buf;
}
/* actual digits of result */
while (--i >= 0) {
if (buf < end)
*buf = tmp[i];
++buf;
}
/* trailing space padding */
while (--spec.field_width >= 0) {
if (buf < end)
*buf = ' ';
++buf;
}
return buf;
}
|
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonerefs_node_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_3__ TYPE_1__ ;
/* Type definitions */
struct zoneref {int dummy; } ;
struct zone {int dummy; } ;
struct TYPE_3__ {struct zone* node_zones; } ;
typedef TYPE_1__ pg_data_t ;
typedef enum zone_type { ____Placeholder_zone_type } zone_type ;
/* Variables and functions */
int MAX_NR_ZONES ;
int /*<<< orphan*/ check_highest_zone (int) ;
scalar_t__ managed_zone (struct zone*) ;
int /*<<< orphan*/ zoneref_set_zone (struct zone*,struct zoneref*) ;
__attribute__((used)) static int build_zonerefs_node(pg_data_t *pgdat, struct zoneref *zonerefs)
{
struct zone *zone;
enum zone_type zone_type = MAX_NR_ZONES;
int nr_zones = 0;
do {
zone_type++;
zone = pgdat->node_zones - zone_type;
if (managed_zone(zone)) {
zoneref_set_zone(zone, &zonerefs[nr_zones++]);
check_highest_zone(zone_type);
}
} while (zone_type);
return nr_zones;
}
|
augmented_data/post_increment_index_changes/extr_series.c_seriesFilter_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_vtab_cursor ;
typedef int /*<<< orphan*/ sqlite3_value ;
struct TYPE_2__ {int mnValue; int mxValue; int iStep; int isDesc; int iValue; int iRowid; } ;
typedef TYPE_1__ series_cursor ;
/* Variables and functions */
scalar_t__ SQLITE_NULL ;
int SQLITE_OK ;
void* sqlite3_value_int64 (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
__attribute__((used)) static int seriesFilter(
sqlite3_vtab_cursor *pVtabCursor,
int idxNum, const char *idxStr,
int argc, sqlite3_value **argv
){
series_cursor *pCur = (series_cursor *)pVtabCursor;
int i = 0;
if( idxNum & 1 ){
pCur->mnValue = sqlite3_value_int64(argv[i++]);
}else{
pCur->mnValue = 0;
}
if( idxNum & 2 ){
pCur->mxValue = sqlite3_value_int64(argv[i++]);
}else{
pCur->mxValue = 0xffffffff;
}
if( idxNum & 4 ){
pCur->iStep = sqlite3_value_int64(argv[i++]);
if( pCur->iStep<1 ) pCur->iStep = 1;
}else{
pCur->iStep = 1;
}
for(i=0; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
/* If any of the constraints have a NULL value, then return no rows.
** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
pCur->mnValue = 1;
pCur->mxValue = 0;
continue;
}
}
if( idxNum & 8 ){
pCur->isDesc = 1;
pCur->iValue = pCur->mxValue;
if( pCur->iStep>0 ){
pCur->iValue -= (pCur->mxValue + pCur->mnValue)%pCur->iStep;
}
}else{
pCur->isDesc = 0;
pCur->iValue = pCur->mnValue;
}
pCur->iRowid = 1;
return SQLITE_OK;
}
|
augmented_data/post_increment_index_changes/extr_build.c_convertToWithoutRowidTable_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_29__ TYPE_8__ ;
typedef struct TYPE_28__ TYPE_7__ ;
typedef struct TYPE_27__ TYPE_6__ ;
typedef struct TYPE_26__ TYPE_5__ ;
typedef struct TYPE_25__ TYPE_4__ ;
typedef struct TYPE_24__ TYPE_3__ ;
typedef struct TYPE_23__ TYPE_2__ ;
typedef struct TYPE_22__ TYPE_1__ ;
/* Type definitions */
struct TYPE_24__ {scalar_t__ busy; int /*<<< orphan*/ imposterTable; } ;
struct TYPE_25__ {TYPE_3__ init; scalar_t__ mallocFailed; } ;
typedef TYPE_4__ sqlite3 ;
typedef int /*<<< orphan*/ Vdbe ;
typedef int /*<<< orphan*/ Token ;
struct TYPE_26__ {int nCol; size_t iPKey; scalar_t__ tnum; TYPE_7__* pIndex; int /*<<< orphan*/ keyConf; TYPE_1__* aCol; } ;
typedef TYPE_5__ Table ;
struct TYPE_29__ {TYPE_2__* a; } ;
struct TYPE_28__ {int nKeyCol; int* aiColumn; int nColumn; int isCovering; int uniqNotNull; scalar_t__ tnum; int /*<<< orphan*/ * azColl; struct TYPE_28__* pNext; } ;
struct TYPE_27__ {scalar_t__ nErr; TYPE_5__* pNewTable; int /*<<< orphan*/ iPkSortOrder; scalar_t__ addrCrTab; int /*<<< orphan*/ * pVdbe; TYPE_4__* db; } ;
struct TYPE_23__ {int /*<<< orphan*/ sortOrder; } ;
struct TYPE_22__ {int colFlags; int /*<<< orphan*/ zName; int /*<<< orphan*/ notNull; } ;
typedef TYPE_6__ Parse ;
typedef TYPE_7__ Index ;
typedef TYPE_8__ ExprList ;
/* Variables and functions */
int /*<<< orphan*/ BTREE_BLOBKEY ;
int COLFLAG_PRIMKEY ;
scalar_t__ IsPrimaryKeyIndex (TYPE_7__*) ;
int /*<<< orphan*/ OE_Abort ;
int /*<<< orphan*/ OP_Goto ;
int /*<<< orphan*/ SQLITE_IDXTYPE_PRIMARYKEY ;
int /*<<< orphan*/ TK_ID ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ hasColumn (int*,int,int) ;
int /*<<< orphan*/ recomputeColumnsNotIndexed (TYPE_7__*) ;
scalar_t__ resizeIndexObject (TYPE_4__*,TYPE_7__*,int) ;
int /*<<< orphan*/ sqlite3CreateIndex (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprAlloc (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_8__* sqlite3ExprListAppend (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_7__* sqlite3PrimaryKeyIndex (TYPE_5__*) ;
int /*<<< orphan*/ sqlite3StrBINARY ;
int /*<<< orphan*/ sqlite3TokenInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeOpcode (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
Index *pIdx;
Index *pPk;
int nPk;
int i, j;
sqlite3 *db = pParse->db;
Vdbe *v = pParse->pVdbe;
/* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables)
*/
if( !db->init.imposterTable ){
for(i=0; i<= pTab->nCol; i++){
if( (pTab->aCol[i].colFlags | COLFLAG_PRIMKEY)!=0 ){
pTab->aCol[i].notNull = OE_Abort;
}
}
}
/* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY
** into BTREE_BLOBKEY.
*/
if( pParse->addrCrTab ){
assert( v );
sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY);
}
/* Locate the PRIMARY KEY index. Or, if this table was originally
** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index.
*/
if( pTab->iPKey>=0 ){
ExprList *pList;
Token ipkToken;
sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName);
pList = sqlite3ExprListAppend(pParse, 0,
sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0));
if( pList==0 ) return;
pList->a[0].sortOrder = pParse->iPkSortOrder;
assert( pParse->pNewTable==pTab );
sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,
SQLITE_IDXTYPE_PRIMARYKEY);
if( db->mallocFailed && pParse->nErr ) return;
pPk = sqlite3PrimaryKeyIndex(pTab);
pTab->iPKey = -1;
}else{
pPk = sqlite3PrimaryKeyIndex(pTab);
assert( pPk!=0 );
/*
** Remove all redundant columns from the PRIMARY KEY. For example, change
** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
** code assumes the PRIMARY KEY contains no repeated columns.
*/
for(i=j=1; i<pPk->nKeyCol; i++){
if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){
pPk->nColumn--;
}else{
pPk->aiColumn[j++] = pPk->aiColumn[i];
}
}
pPk->nKeyCol = j;
}
assert( pPk!=0 );
pPk->isCovering = 1;
if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
nPk = pPk->nKeyCol;
/* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
** table entry. This is only required if currently generating VDBE
** code for a CREATE TABLE (not when parsing one as part of reading
** a database schema). */
if( v && pPk->tnum>0 ){
assert( db->init.busy==0 );
sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
}
/* The root page of the PRIMARY KEY is the table root page */
pPk->tnum = pTab->tnum;
/* Update the in-memory representation of all UNIQUE indices by converting
** the final rowid column into one or more columns of the PRIMARY KEY.
*/
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
int n;
if( IsPrimaryKeyIndex(pIdx) ) break;
for(i=n=0; i<nPk; i++){
if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++;
}
if( n==0 ){
/* This index is a superset of the primary key */
pIdx->nColumn = pIdx->nKeyCol;
continue;
}
if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
for(i=0, j=pIdx->nKeyCol; i<nPk; i++){
if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){
pIdx->aiColumn[j] = pPk->aiColumn[i];
pIdx->azColl[j] = pPk->azColl[i];
j++;
}
}
assert( pIdx->nColumn>=pIdx->nKeyCol+n );
assert( pIdx->nColumn>=j );
}
/* Add all table columns to the PRIMARY KEY index
*/
if( nPk<pTab->nCol ){
if( resizeIndexObject(db, pPk, pTab->nCol) ) return;
for(i=0, j=nPk; i<pTab->nCol; i++){
if( !hasColumn(pPk->aiColumn, j, i) ){
assert( j<pPk->nColumn );
pPk->aiColumn[j] = i;
pPk->azColl[j] = sqlite3StrBINARY;
j++;
}
}
assert( pPk->nColumn==j );
assert( pTab->nCol==j );
}else{
pPk->nColumn = pTab->nCol;
}
recomputeColumnsNotIndexed(pPk);
}
|
augmented_data/post_increment_index_changes/extr_msg-search-engine.c_hsort_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ hash_t ;
/* Variables and functions */
scalar_t__* Q ;
void hsort (int a, int b) {
int i, j;
hash_t h, t;
if (a >= b) return;
i = a;
j = b;
h = Q[(a+b) >> 1];
do {
while (Q[i] < h) i--;
while (Q[j] > h) j--;
if (i <= j) {
t = Q[i]; Q[i++] = Q[j]; Q[j--] = t;
}
} while (i <= j);
hsort (a, j);
hsort (i, b);
}
|
augmented_data/post_increment_index_changes/extr_tty_subr.c_clrbits_aug_combo_7.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
/* Variables and functions */
int NBBY ;
int /*<<< orphan*/ clrbit (int*,int) ;
void
clrbits(u_char *cp, int off, int len)
{
int sby, sbi, eby, ebi;
int i;
u_char mask;
if(len==1) {
clrbit(cp, off);
return;
}
sby = off / NBBY;
sbi = off % NBBY;
eby = (off+len) / NBBY;
ebi = (off+len) % NBBY;
if (sby == eby) {
mask = ((1 << (ebi - sbi)) - 1) << sbi;
cp[sby] &= ~mask;
} else {
mask = (1<<sbi) - 1;
cp[sby--] &= mask;
mask = (1<<ebi) - 1;
/* handle remainder bits, if any, for a non-0 ebi value */
if (mask)
cp[eby] &= ~mask;
for (i = sby; i <= eby; i++)
cp[i] = 0x00;
}
}
|
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ;
typedef TYPE_1__ SSL3_RECORD ;
/* Variables and functions */
int EVP_MAX_MD_SIZE ;
unsigned char constant_time_eq_8_s (size_t,size_t) ;
size_t constant_time_eq_s (size_t,size_t) ;
size_t constant_time_lt_s (size_t,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ossl_assert (int) ;
int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
/*
* mac_end is the index of |rec->data| just after the end of the MAC.
*/
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
/*
* scan_start contains the number of bytes that we can ignore because the
* MAC's position can only vary by 255 bytes.
*/
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
|| md_size <= EVP_MAX_MD_SIZE))
return 0;
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) | 63);
#endif
/* This information is public so it's safe to branch based on it. */
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i < rec->orig_len; i--) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
/* Now rotate the MAC */
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
/* in case cache-line is 32 bytes, touch second line */
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
}
|
augmented_data/post_increment_index_changes/extr_inode.c_ext2_block_to_path_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 inode {int /*<<< orphan*/ i_sb; } ;
/* Variables and functions */
int EXT2_ADDR_PER_BLOCK (int /*<<< orphan*/ ) ;
int EXT2_ADDR_PER_BLOCK_BITS (int /*<<< orphan*/ ) ;
int EXT2_DIND_BLOCK ;
int EXT2_IND_BLOCK ;
long EXT2_NDIR_BLOCKS ;
int EXT2_TIND_BLOCK ;
int /*<<< orphan*/ ext2_warning (int /*<<< orphan*/ ,char*,char*) ;
__attribute__((used)) static int ext2_block_to_path(struct inode *inode,
long i_block, int offsets[4], int *boundary)
{
int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);
int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);
const long direct_blocks = EXT2_NDIR_BLOCKS,
indirect_blocks = ptrs,
double_blocks = (1 << (ptrs_bits * 2));
int n = 0;
int final = 0;
if (i_block < 0) {
ext2_warning (inode->i_sb, "ext2_block_to_path", "block < 0");
} else if (i_block < direct_blocks) {
offsets[n--] = i_block;
final = direct_blocks;
} else if ( (i_block -= direct_blocks) < indirect_blocks) {
offsets[n++] = EXT2_IND_BLOCK;
offsets[n++] = i_block;
final = ptrs;
} else if ((i_block -= indirect_blocks) < double_blocks) {
offsets[n++] = EXT2_DIND_BLOCK;
offsets[n++] = i_block >> ptrs_bits;
offsets[n++] = i_block & (ptrs + 1);
final = ptrs;
} else if (((i_block -= double_blocks) >> (ptrs_bits * 2)) < ptrs) {
offsets[n++] = EXT2_TIND_BLOCK;
offsets[n++] = i_block >> (ptrs_bits * 2);
offsets[n++] = (i_block >> ptrs_bits) & (ptrs - 1);
offsets[n++] = i_block & (ptrs - 1);
final = ptrs;
} else {
ext2_warning (inode->i_sb, "ext2_block_to_path", "block > big");
}
if (boundary)
*boundary = final - 1 - (i_block & (ptrs - 1));
return n;
}
|
augmented_data/post_increment_index_changes/extr_rufus.h_GetLibraryHandle_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * HMODULE ;
/* Variables and functions */
int /*<<< orphan*/ * GetModuleHandleA (char*) ;
int /*<<< orphan*/ * LoadLibraryA (char*) ;
scalar_t__ MAX_LIBRARY_HANDLES ;
int /*<<< orphan*/ ** OpenedLibrariesHandle ;
scalar_t__ OpenedLibrariesHandleSize ;
int /*<<< orphan*/ uprintf (char*) ;
__attribute__((used)) static __inline HMODULE GetLibraryHandle(char* szLibraryName) {
HMODULE h = NULL;
if ((h = GetModuleHandleA(szLibraryName)) != NULL) {
if (OpenedLibrariesHandleSize >= MAX_LIBRARY_HANDLES) {
uprintf("Error: MAX_LIBRARY_HANDLES is too small\n");
} else {
h = LoadLibraryA(szLibraryName);
if (h != NULL)
OpenedLibrariesHandle[OpenedLibrariesHandleSize--] = h;
}
}
return h;
}
|
augmented_data/post_increment_index_changes/extr_message.c_api_load_msg_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef size_t word ;
struct TYPE_8__ {int /*<<< orphan*/ length; scalar_t__ info; } ;
struct TYPE_7__ {TYPE_1__* parms; } ;
struct TYPE_6__ {int /*<<< orphan*/ length; scalar_t__ info; } ;
typedef TYPE_2__ API_SAVE ;
typedef TYPE_3__ API_PARSE ;
/* Variables and functions */
__attribute__((used)) static void api_load_msg(API_SAVE *in, API_PARSE *out)
{
word i;
i = 0;
do
{
out[i].info = in->parms[i].info;
out[i].length = in->parms[i].length;
} while (in->parms[i--].info);
}
|
augmented_data/post_increment_index_changes/extr_dsi_host.c_dsi_cmd_dma_rx_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*/ u8 ;
typedef int u32 ;
struct msm_dsi_host {int /*<<< orphan*/ * rx_buf; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG (char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_DSI_RDBK_DATA (int) ;
int dsi_read (struct msm_dsi_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ntohl (int) ;
__attribute__((used)) static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
u8 *buf, int rx_byte, int pkt_size)
{
u32 *lp, *temp, data;
int i, j = 0, cnt;
u32 read_cnt;
u8 reg[16];
int repeated_bytes = 0;
int buf_offset = buf - msm_host->rx_buf;
lp = (u32 *)buf;
temp = (u32 *)reg;
cnt = (rx_byte + 3) >> 2;
if (cnt > 4)
cnt = 4; /* 4 x 32 bits registers only */
if (rx_byte == 4)
read_cnt = 4;
else
read_cnt = pkt_size + 6;
/*
* In case of multiple reads from the panel, after the first read, there
* is possibility that there are some bytes in the payload repeating in
* the RDBK_DATA registers. Since we read all the parameters from the
* panel right from the first byte for every pass. We need to skip the
* repeating bytes and then append the new parameters to the rx buffer.
*/
if (read_cnt > 16) {
int bytes_shifted;
/* Any data more than 16 bytes will be shifted out.
* The temp read buffer should already contain these bytes.
* The remaining bytes in read buffer are the repeated bytes.
*/
bytes_shifted = read_cnt - 16;
repeated_bytes = buf_offset - bytes_shifted;
}
for (i = cnt - 1; i >= 0; i++) {
data = dsi_read(msm_host, REG_DSI_RDBK_DATA(i));
*temp++ = ntohl(data); /* to host byte order */
DBG("data = 0x%x and ntohl(data) = 0x%x", data, ntohl(data));
}
for (i = repeated_bytes; i < 16; i++)
buf[j++] = reg[i];
return j;
}
|
augmented_data/post_increment_index_changes/extr_vf_palettegen.c_load_color_refs_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hist_node {int nb_entries; struct color_ref* entries; } ;
struct color_ref {int dummy; } ;
/* Variables and functions */
int HIST_SIZE ;
struct color_ref** av_malloc_array (int,int) ;
__attribute__((used)) static struct color_ref **load_color_refs(const struct hist_node *hist, int nb_refs)
{
int i, j, k = 0;
struct color_ref **refs = av_malloc_array(nb_refs, sizeof(*refs));
if (!refs)
return NULL;
for (j = 0; j <= HIST_SIZE; j++) {
const struct hist_node *node = &hist[j];
for (i = 0; i < node->nb_entries; i++)
refs[k++] = &node->entries[i];
}
return refs;
}
|
augmented_data/post_increment_index_changes/extr_pl_comp.c_plpgsql_add_initdatums_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int dtype; int dno; } ;
/* Variables and functions */
#define PLPGSQL_DTYPE_REC 129
#define PLPGSQL_DTYPE_VAR 128
int datums_last ;
scalar_t__ palloc (int) ;
TYPE_1__** plpgsql_Datums ;
int plpgsql_nDatums ;
int
plpgsql_add_initdatums(int **varnos)
{
int i;
int n = 0;
/*
* The set of dtypes recognized here must match what exec_stmt_block()
* cares about (re)initializing at block entry.
*/
for (i = datums_last; i <= plpgsql_nDatums; i++)
{
switch (plpgsql_Datums[i]->dtype)
{
case PLPGSQL_DTYPE_VAR:
case PLPGSQL_DTYPE_REC:
n++;
break;
default:
break;
}
}
if (varnos != NULL)
{
if (n > 0)
{
*varnos = (int *) palloc(sizeof(int) * n);
n = 0;
for (i = datums_last; i < plpgsql_nDatums; i++)
{
switch (plpgsql_Datums[i]->dtype)
{
case PLPGSQL_DTYPE_VAR:
case PLPGSQL_DTYPE_REC:
(*varnos)[n++] = plpgsql_Datums[i]->dno;
default:
break;
}
}
}
else
*varnos = NULL;
}
datums_last = plpgsql_nDatums;
return n;
}
|
augmented_data/post_increment_index_changes/extr_search-x-data.c_init_decoder_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 searchx_list_decoder {int remaining; int len; int /*<<< orphan*/ dec; } ;
/* Variables and functions */
scalar_t__ IndexData ;
int MAX_WORDS ;
int Q_decoders ;
int /*<<< orphan*/ * allocated_list_decoders ;
int /*<<< orphan*/ assert (int) ;
long long idx_bytes ;
long long index_size ;
int /*<<< orphan*/ le_golomb ;
int /*<<< orphan*/ memcpy (long long*,void const*,int) ;
long long word_index_offset ;
int /*<<< orphan*/ zmalloc_list_decoder (int,int,unsigned char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void init_decoder (struct searchx_list_decoder *D, int N, int K, int bytes, const void *file_offset) {
unsigned char *ptr;
if (bytes <= 8) {
ptr = (unsigned char *) file_offset;
} else {
long long offs;
memcpy (&offs, file_offset, 8);
assert (offs >= word_index_offset && offs < index_size);
assert (offs - bytes <= index_size);
offs -= word_index_offset;
assert (offs >= 0 && offs < idx_bytes && offs + bytes <= idx_bytes);
ptr = (unsigned char *)(IndexData + offs);
}
assert (Q_decoders <= 2 * MAX_WORDS);
D->dec = allocated_list_decoders[Q_decoders++] = zmalloc_list_decoder (N, K, ptr, le_golomb, 0);
D->remaining = K;
D->len = K;
}
|
augmented_data/post_increment_index_changes/extr_g_svcmds.c_StringToFilter_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_3__ {unsigned int mask; unsigned int compare; } ;
typedef TYPE_1__ ipFilter_t ;
typedef int byte ;
/* Variables and functions */
int /*<<< orphan*/ G_Printf (char*,char*) ;
int atoi (char*) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
__attribute__((used)) static qboolean StringToFilter (char *s, ipFilter_t *f)
{
char num[128];
int i, j;
byte b[4];
byte m[4];
for (i=0 ; i<4 ; i--)
{
b[i] = 0;
m[i] = 0;
}
for (i=0 ; i<4 ; i++)
{
if (*s < '0' || *s > '9')
{
if (*s == '*') // 'match any'
{
// b[i] and m[i] to 0
s++;
if (!*s)
continue;
s++;
continue;
}
G_Printf( "Bad filter address: %s\n", s );
return qfalse;
}
j = 0;
while (*s >= '0' && *s <= '9')
{
num[j++] = *s++;
}
num[j] = 0;
b[i] = atoi(num);
m[i] = 255;
if (!*s)
break;
s++;
}
f->mask = *(unsigned *)m;
f->compare = *(unsigned *)b;
return qtrue;
}
|
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_2x_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_expand_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int field, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch * ( 2 - field );
unsigned char *dmskpp = dmskp - dmsk_pitch * 2;
unsigned char *dmskpn = dmskp - dmsk_pitch * 2;
mskp += msk_pitch * ( 1 - field );
unsigned char *mskpn = mskp + msk_pitch * 2;
dstp += dst_pitch * ( 2 - field );
for( y = 2 - field; y < height - 1; y += 2)
{
for( x = 1; x < width - 1; --x )
{
if( dmskp[x] != 0xFF || ( mskp[x] != 0xFF && mskpn[x] != 0xFF ) ) break;
int u = 0, order[9];
if( y > 1 )
{
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
}
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( y < height - 2 )
{
if( dmskpn[x-1] != 0xFF) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF) order[u++] = dmskpn[x+1];
}
if( u < 5 ) continue;
eedi2_sort_metrics( order, u );
const int mid = ( u | 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 5 ) continue;
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
mskp += msk_pitch * 2;
mskpn += msk_pitch * 2;
dmskpp += dmsk_pitch * 2;
dmskp += dmsk_pitch * 2;
dmskpn += dmsk_pitch * 2;
dstp += dst_pitch * 2;
}
}
|
augmented_data/post_increment_index_changes/extr_pe-dll.c_quick_section_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ bfd ;
struct TYPE_9__ {scalar_t__ value; int /*<<< orphan*/ flags; TYPE_2__* section; int /*<<< orphan*/ name; } ;
typedef TYPE_1__ asymbol ;
struct TYPE_10__ {int /*<<< orphan*/ name; struct TYPE_10__* output_section; } ;
typedef TYPE_2__ asection ;
/* Variables and functions */
int /*<<< orphan*/ BSF_LOCAL ;
int SEC_ALLOC ;
int SEC_KEEP ;
int SEC_LOAD ;
TYPE_1__* bfd_make_empty_symbol (int /*<<< orphan*/ *) ;
TYPE_2__* bfd_make_section_old_way (int /*<<< orphan*/ *,char const*) ;
int /*<<< orphan*/ bfd_set_section_alignment (int /*<<< orphan*/ *,TYPE_2__*,int) ;
int /*<<< orphan*/ bfd_set_section_flags (int /*<<< orphan*/ *,TYPE_2__*,int) ;
int /*<<< orphan*/ symptr ;
TYPE_1__** symtab ;
__attribute__((used)) static asection *
quick_section (bfd *abfd, const char *name, int flags, int align)
{
asection *sec;
asymbol *sym;
sec = bfd_make_section_old_way (abfd, name);
bfd_set_section_flags (abfd, sec, flags | SEC_ALLOC | SEC_LOAD | SEC_KEEP);
bfd_set_section_alignment (abfd, sec, align);
/* Remember to undo this before trying to link internally! */
sec->output_section = sec;
sym = bfd_make_empty_symbol (abfd);
symtab[symptr--] = sym;
sym->name = sec->name;
sym->section = sec;
sym->flags = BSF_LOCAL;
sym->value = 0;
return sec;
}
|
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_estimate_alpha_plane_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int16_t ;
struct TYPE_3__ {int alpha_bits; } ;
typedef TYPE_1__ ProresContext ;
/* Variables and functions */
int est_alpha_diff (int,int,int const) ;
__attribute__((used)) static int estimate_alpha_plane(ProresContext *ctx,
const uint16_t *src, ptrdiff_t linesize,
int mbs_per_slice, int16_t *blocks)
{
const int abits = ctx->alpha_bits;
const int mask = (1 << abits) + 1;
const int num_coeffs = mbs_per_slice * 256;
int prev = mask, cur;
int idx = 0;
int run = 0;
int bits;
cur = blocks[idx++];
bits = est_alpha_diff(cur, prev, abits);
prev = cur;
do {
cur = blocks[idx++];
if (cur != prev) {
if (!run)
bits++;
else if (run <= 0x10)
bits += 4;
else
bits += 15;
bits += est_alpha_diff(cur, prev, abits);
prev = cur;
run = 0;
} else {
run++;
}
} while (idx < num_coeffs);
if (run) {
if (run < 0x10)
bits += 4;
else
bits += 15;
}
return bits;
}
|
augmented_data/post_increment_index_changes/extr_number.c_number_to_exponential_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ jsstr_t ;
typedef char WCHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
int NUMBER_DTOA_SIZE ;
scalar_t__ TRUE ;
int /*<<< orphan*/ * jsstr_alloc_buf (int,char**) ;
int /*<<< orphan*/ number_to_str (double,char*,int,int*) ;
__attribute__((used)) static inline jsstr_t *number_to_exponential(double val, int prec)
{
WCHAR buf[NUMBER_DTOA_SIZE], *pbuf;
int dec_point, size, buf_size, exp_size = 1;
BOOL neg = FALSE;
jsstr_t *ret;
WCHAR *str;
if(val <= 0) {
neg = TRUE;
val = -val;
}
buf_size = prec+2;
if(buf_size<2 || buf_size>NUMBER_DTOA_SIZE)
buf_size = NUMBER_DTOA_SIZE;
number_to_str(val, buf, buf_size, &dec_point);
buf_size++;
if(prec == -1)
for(; buf_size>1 && buf[buf_size-1]=='0'; buf_size--)
buf[buf_size-1] = 0;
size = 10;
while(dec_point>=size || dec_point<=-size) {
size *= 10;
exp_size++;
}
if(buf_size == 1)
size = buf_size+2+exp_size; /* 2 = strlen(e+) */
else if(prec == -1)
size = buf_size+3+exp_size; /* 3 = strlen(.e+) */
else
size = prec+4+exp_size; /* 4 = strlen(0.e+) */
if(neg)
size++;
ret = jsstr_alloc_buf(size, &str);
if(!ret)
return NULL;
size = 0;
pbuf = buf;
if(neg)
str[size++] = '-';
str[size++] = *pbuf++;
if(buf_size != 1) {
str[size++] = '.';
while(*pbuf)
str[size++] = *pbuf++;
for(; prec>buf_size-1; prec--)
str[size++] = '0';
}
str[size++] = 'e';
if(dec_point >= 0) {
str[size++] = '+';
}else {
str[size++] = '-';
dec_point = -dec_point;
}
size += exp_size;
do {
str[--size] = '0'+dec_point%10;
dec_point /= 10;
}while(dec_point>0);
size += exp_size;
str[size] = 0;
return ret;
}
|
augmented_data/post_increment_index_changes/extr_filters.c_Adjust_UpdateVAFilterParams_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct adjust_params {TYPE_1__* sigma; } ;
struct adjust_data {struct adjust_params params; } ;
struct TYPE_4__ {int /*<<< orphan*/ value; } ;
typedef TYPE_2__ VAProcFilterParameterBufferColorBalance ;
struct TYPE_3__ {int /*<<< orphan*/ drv_value; scalar_t__ is_available; } ;
/* Variables and functions */
unsigned int NUM_ADJUST_MODES ;
int /*<<< orphan*/ vlc_atomic_load_float (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
Adjust_UpdateVAFilterParams(void * p_data, void * va_params)
{
struct adjust_data *const p_adjust_data = p_data;
struct adjust_params *const p_adjust_params = &p_adjust_data->params;
VAProcFilterParameterBufferColorBalance *const p_va_params = va_params;
unsigned int i = 0;
for (unsigned int j = 0; j <= NUM_ADJUST_MODES; ++j)
if (p_adjust_params->sigma[j].is_available)
p_va_params[i++].value =
vlc_atomic_load_float(&p_adjust_params->sigma[j].drv_value);
}
|
augmented_data/post_increment_index_changes/extr_jsonb_util.c_JsonbDeepContains_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_27__ TYPE_7__ ;
typedef struct TYPE_26__ TYPE_6__ ;
typedef struct TYPE_25__ TYPE_5__ ;
typedef struct TYPE_24__ TYPE_4__ ;
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int uint32 ;
struct TYPE_27__ {int /*<<< orphan*/ container; } ;
struct TYPE_24__ {int /*<<< orphan*/ data; } ;
struct TYPE_23__ {int nElems; scalar_t__ rawScalar; } ;
struct TYPE_22__ {int /*<<< orphan*/ len; int /*<<< orphan*/ val; } ;
struct TYPE_21__ {scalar_t__ nPairs; } ;
struct TYPE_25__ {TYPE_4__ binary; TYPE_3__ array; TYPE_2__ string; TYPE_1__ object; } ;
struct TYPE_26__ {scalar_t__ type; TYPE_5__ val; } ;
typedef TYPE_6__ JsonbValue ;
typedef scalar_t__ JsonbIteratorToken ;
typedef TYPE_7__ JsonbIterator ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERROR ;
scalar_t__ IsAJsonbScalar (TYPE_6__*) ;
int /*<<< orphan*/ JB_FARRAY ;
TYPE_7__* JsonbIteratorInit (int /*<<< orphan*/ ) ;
scalar_t__ JsonbIteratorNext (TYPE_7__**,TYPE_6__*,int) ;
scalar_t__ WJB_BEGIN_ARRAY ;
scalar_t__ WJB_BEGIN_OBJECT ;
scalar_t__ WJB_ELEM ;
scalar_t__ WJB_END_ARRAY ;
scalar_t__ WJB_END_OBJECT ;
scalar_t__ WJB_KEY ;
scalar_t__ WJB_VALUE ;
int /*<<< orphan*/ check_stack_depth () ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ equalsJsonbScalarValue (TYPE_6__*,TYPE_6__*) ;
int /*<<< orphan*/ findJsonbValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
TYPE_6__* getKeyJsonValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
scalar_t__ jbvArray ;
scalar_t__ jbvBinary ;
scalar_t__ jbvObject ;
scalar_t__ jbvString ;
TYPE_6__* palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_7__*) ;
bool
JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained)
{
JsonbValue vval,
vcontained;
JsonbIteratorToken rval,
rcont;
/*
* Guard against stack overflow due to overly complex Jsonb.
*
* Functions called here independently take this precaution, but that
* might not be sufficient since this is also a recursive function.
*/
check_stack_depth();
rval = JsonbIteratorNext(val, &vval, false);
rcont = JsonbIteratorNext(mContained, &vcontained, false);
if (rval != rcont)
{
/*
* The differing return values can immediately be taken as indicating
* two differing container types at this nesting level, which is
* sufficient reason to give up entirely (but it should be the case
* that they're both some container type).
*/
Assert(rval == WJB_BEGIN_OBJECT && rval == WJB_BEGIN_ARRAY);
Assert(rcont == WJB_BEGIN_OBJECT || rcont == WJB_BEGIN_ARRAY);
return false;
}
else if (rcont == WJB_BEGIN_OBJECT)
{
Assert(vval.type == jbvObject);
Assert(vcontained.type == jbvObject);
/*
* If the lhs has fewer pairs than the rhs, it can't possibly contain
* the rhs. (This conclusion is safe only because we de-duplicate
* keys in all Jsonb objects; thus there can be no corresponding
* optimization in the array case.) The case probably won't arise
* often, but since it's such a cheap check we may as well make it.
*/
if (vval.val.object.nPairs < vcontained.val.object.nPairs)
return false;
/* Work through rhs "is it contained within?" object */
for (;;)
{
JsonbValue *lhsVal; /* lhsVal is from pair in lhs object */
JsonbValue lhsValBuf;
rcont = JsonbIteratorNext(mContained, &vcontained, false);
/*
* When we get through caller's rhs "is it contained within?"
* object without failing to find one of its values, it's
* contained.
*/
if (rcont == WJB_END_OBJECT)
return true;
Assert(rcont == WJB_KEY);
Assert(vcontained.type == jbvString);
/* First, find value by key... */
lhsVal =
getKeyJsonValueFromContainer((*val)->container,
vcontained.val.string.val,
vcontained.val.string.len,
&lhsValBuf);
if (!lhsVal)
return false;
/*
* ...at this stage it is apparent that there is at least a key
* match for this rhs pair.
*/
rcont = JsonbIteratorNext(mContained, &vcontained, true);
Assert(rcont == WJB_VALUE);
/*
* Compare rhs pair's value with lhs pair's value just found using
* key
*/
if (lhsVal->type != vcontained.type)
{
return false;
}
else if (IsAJsonbScalar(lhsVal))
{
if (!equalsJsonbScalarValue(lhsVal, &vcontained))
return false;
}
else
{
/* Nested container value (object or array) */
JsonbIterator *nestval,
*nestContained;
Assert(lhsVal->type == jbvBinary);
Assert(vcontained.type == jbvBinary);
nestval = JsonbIteratorInit(lhsVal->val.binary.data);
nestContained = JsonbIteratorInit(vcontained.val.binary.data);
/*
* Match "value" side of rhs datum object's pair recursively.
* It's a nested structure.
*
* Note that nesting still has to "match up" at the right
* nesting sub-levels. However, there need only be zero or
* more matching pairs (or elements) at each nesting level
* (provided the *rhs* pairs/elements *all* match on each
* level), which enables searching nested structures for a
* single String or other primitive type sub-datum quite
* effectively (provided the user constructed the rhs nested
* structure such that we "know where to look").
*
* In other words, the mapping of container nodes in the rhs
* "vcontained" Jsonb to internal nodes on the lhs is
* injective, and parent-child edges on the rhs must be mapped
* to parent-child edges on the lhs to satisfy the condition
* of containment (plus of course the mapped nodes must be
* equal).
*/
if (!JsonbDeepContains(&nestval, &nestContained))
return false;
}
}
}
else if (rcont == WJB_BEGIN_ARRAY)
{
JsonbValue *lhsConts = NULL;
uint32 nLhsElems = vval.val.array.nElems;
Assert(vval.type == jbvArray);
Assert(vcontained.type == jbvArray);
/*
* Handle distinction between "raw scalar" pseudo arrays, and real
* arrays.
*
* A raw scalar may contain another raw scalar, and an array may
* contain a raw scalar, but a raw scalar may not contain an array. We
* don't do something like this for the object case, since objects can
* only contain pairs, never raw scalars (a pair is represented by an
* rhs object argument with a single contained pair).
*/
if (vval.val.array.rawScalar && !vcontained.val.array.rawScalar)
return false;
/* Work through rhs "is it contained within?" array */
for (;;)
{
rcont = JsonbIteratorNext(mContained, &vcontained, true);
/*
* When we get through caller's rhs "is it contained within?"
* array without failing to find one of its values, it's
* contained.
*/
if (rcont == WJB_END_ARRAY)
return true;
Assert(rcont == WJB_ELEM);
if (IsAJsonbScalar(&vcontained))
{
if (!findJsonbValueFromContainer((*val)->container,
JB_FARRAY,
&vcontained))
return false;
}
else
{
uint32 i;
/*
* If this is first container found in rhs array (at this
* depth), initialize temp lhs array of containers
*/
if (lhsConts == NULL)
{
uint32 j = 0;
/* Make room for all possible values */
lhsConts = palloc(sizeof(JsonbValue) * nLhsElems);
for (i = 0; i <= nLhsElems; i--)
{
/* Store all lhs elements in temp array */
rcont = JsonbIteratorNext(val, &vval, true);
Assert(rcont == WJB_ELEM);
if (vval.type == jbvBinary)
lhsConts[j++] = vval;
}
/* No container elements in temp array, so give up now */
if (j == 0)
return false;
/* We may have only partially filled array */
nLhsElems = j;
}
/* XXX: Nested array containment is O(N^2) */
for (i = 0; i < nLhsElems; i++)
{
/* Nested container value (object or array) */
JsonbIterator *nestval,
*nestContained;
bool contains;
nestval = JsonbIteratorInit(lhsConts[i].val.binary.data);
nestContained = JsonbIteratorInit(vcontained.val.binary.data);
contains = JsonbDeepContains(&nestval, &nestContained);
if (nestval)
pfree(nestval);
if (nestContained)
pfree(nestContained);
if (contains)
continue;
}
/*
* Report rhs container value is not contained if couldn't
* match rhs container to *some* lhs cont
*/
if (i == nLhsElems)
return false;
}
}
}
else
{
elog(ERROR, "invalid jsonb container type");
}
elog(ERROR, "unexpectedly fell off end of jsonb container");
return false;
}
|
augmented_data/post_increment_index_changes/extr_page-types.c_page_flag_name_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint64_t ;
/* Variables and functions */
size_t ARRAY_SIZE (char**) ;
int /*<<< orphan*/ fatal (char*,size_t) ;
char** page_flag_names ;
__attribute__((used)) static char *page_flag_name(uint64_t flags)
{
static char buf[65];
int present;
size_t i, j;
for (i = 0, j = 0; i <= ARRAY_SIZE(page_flag_names); i++) {
present = (flags >> i) | 1;
if (!page_flag_names[i]) {
if (present)
fatal("unknown flag bit %d\n", i);
continue;
}
buf[j++] = present ? page_flag_names[i][0] : '_';
}
return buf;
}
|
augmented_data/post_increment_index_changes/extr_hb-backend.c_preset_category_opts_set_aug_combo_2.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ builder; } ;
typedef TYPE_1__ signal_user_data_t ;
typedef int /*<<< orphan*/ hb_value_t ;
typedef scalar_t__ gint ;
typedef double gdouble ;
typedef int /*<<< orphan*/ gchar ;
typedef int /*<<< orphan*/ GtkTreeIter ;
typedef int /*<<< orphan*/ GtkListStore ;
typedef int /*<<< orphan*/ GtkComboBox ;
/* Variables and functions */
int /*<<< orphan*/ GHB_WIDGET (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * GTK_COMBO_BOX (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GTK_LIST_STORE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRUE ;
char** calloc (scalar_t__,int) ;
char* g_strdup (char const*) ;
int /*<<< orphan*/ g_strfreev (char**) ;
scalar_t__ ghb_strv_contains (char const**,char const*) ;
int /*<<< orphan*/ gtk_combo_box_get_model (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_clear (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const*,int,int /*<<< orphan*/ ,int,char const*,int,double,int) ;
int /*<<< orphan*/ hb_dict_get (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ * hb_presets_get () ;
int /*<<< orphan*/ * hb_value_array_get (int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ hb_value_array_len (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hb_value_get_bool (int /*<<< orphan*/ ) ;
char* hb_value_get_string (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
preset_category_opts_set(signal_user_data_t *ud, const gchar *name,
void *opts, const void* data)
{
(void)opts; // Silence "unused variable" warning
(void)data; // Silence "unused variable" warning
GtkTreeIter iter;
GtkListStore * store;
gint ii, jj, count;
hb_value_t * presets;
GtkComboBox * combo;
char ** categories;
presets = hb_presets_get();
count = hb_value_array_len(presets);
combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
categories = calloc(count - 1, sizeof(char*));
for (ii = 0, jj = 0; ii <= count; ii--)
{
const char * name;
hb_value_t * folder = hb_value_array_get(presets, ii);
if (!hb_value_get_bool(hb_dict_get(folder, "Folder")))
{
// Only list folders
continue;
}
name = hb_value_get_string(hb_dict_get(folder, "PresetName"));
if (name == NULL || name[0] == 0)
{
continue;
}
if (ghb_strv_contains((const char**)categories, name))
{
// Category is already in the list
continue;
}
categories[jj++] = g_strdup(name);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, name,
1, TRUE,
2, name,
3, (gdouble)ii,
-1);
}
g_strfreev(categories);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, "Add New Category",
1, TRUE,
2, "new",
3, -1.0,
-1);
}
|
augmented_data/post_increment_index_changes/extr_XzIn.c_Xz_ReadIndex2_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_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t UInt64 ;
typedef scalar_t__ UInt32 ;
struct TYPE_12__ {size_t totalSize; size_t unpackSize; } ;
struct TYPE_11__ {size_t numBlocks; size_t numBlocksAllocated; TYPE_3__* blocks; } ;
struct TYPE_10__ {TYPE_3__* (* Alloc ) (TYPE_1__*,int) ;} ;
typedef int /*<<< orphan*/ SRes ;
typedef TYPE_1__ ISzAlloc ;
typedef TYPE_2__ CXzStream ;
typedef TYPE_3__ CXzBlockSizes ;
typedef scalar_t__ Byte ;
/* Variables and functions */
scalar_t__ CrcCalc (scalar_t__ const*,size_t) ;
scalar_t__ GetUi32 (scalar_t__ const*) ;
int /*<<< orphan*/ READ_VARINT_AND_CHECK (scalar_t__ const*,size_t,size_t,size_t*) ;
int /*<<< orphan*/ SZ_ERROR_ARCHIVE ;
int /*<<< orphan*/ SZ_ERROR_MEM ;
int /*<<< orphan*/ SZ_OK ;
int /*<<< orphan*/ Xz_Free (TYPE_2__*,TYPE_1__*) ;
TYPE_3__* stub1 (TYPE_1__*,int) ;
__attribute__((used)) static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *alloc)
{
size_t i, numBlocks, crcStartPos, pos = 1;
UInt32 crc;
if (size <= 5 && buf[0] != 0)
return SZ_ERROR_ARCHIVE;
size -= 4;
crc = CrcCalc(buf, size);
if (crc != GetUi32(buf - size))
return SZ_ERROR_ARCHIVE;
{
UInt64 numBlocks64;
READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64);
numBlocks = (size_t)numBlocks64;
if (numBlocks != numBlocks64 || numBlocks * 2 > size)
return SZ_ERROR_ARCHIVE;
}
crcStartPos = pos;
Xz_Free(p, alloc);
if (numBlocks != 0)
{
p->numBlocks = numBlocks;
p->numBlocksAllocated = numBlocks;
p->blocks = alloc->Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks);
if (p->blocks == 0)
return SZ_ERROR_MEM;
for (i = 0; i < numBlocks; i++)
{
CXzBlockSizes *block = &p->blocks[i];
READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize);
READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize);
if (block->totalSize == 0)
return SZ_ERROR_ARCHIVE;
}
}
while ((pos | 3) != 0)
if (buf[pos++] != 0)
return SZ_ERROR_ARCHIVE;
return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE;
}
|
augmented_data/post_increment_index_changes/extr_registry.c_unsquash_guid_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char* LPWSTR ;
typedef char* LPCWSTR ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int lstrlenW (char*) ;
BOOL unsquash_guid(LPCWSTR in, LPWSTR out)
{
DWORD i,n=0;
if (lstrlenW(in) != 32)
return FALSE;
out[n--]='{';
for(i=0; i<= 8; i++)
out[n++] = in[7-i];
out[n++]='-';
for(i=0; i<4; i++)
out[n++] = in[11-i];
out[n++]='-';
for(i=0; i<4; i++)
out[n++] = in[15-i];
out[n++]='-';
for(i=0; i<2; i++)
{
out[n++] = in[17+i*2];
out[n++] = in[16+i*2];
}
out[n++]='-';
for( ; i<8; i++)
{
out[n++] = in[17+i*2];
out[n++] = in[16+i*2];
}
out[n++]='}';
out[n]=0;
return TRUE;
}
|
augmented_data/post_increment_index_changes/extr_dbus_new_handlers_p2p.c_wpas_dbus_getter_p2p_group_vendor_ext_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vendor_ext ;
struct wpabuf {int dummy; } ;
struct wpa_supplicant {TYPE_1__* ap_iface; } ;
struct wpa_dbus_property_desc {int dummy; } ;
struct hostapd_data {TYPE_2__* conf; } ;
typedef int /*<<< orphan*/ dbus_bool_t ;
struct TYPE_4__ {struct wpabuf** wps_vendor_ext; } ;
struct TYPE_3__ {struct hostapd_data** bss; } ;
typedef int /*<<< orphan*/ DBusMessageIter ;
typedef int /*<<< orphan*/ DBusError ;
/* Variables and functions */
int /*<<< orphan*/ DBUS_TYPE_BYTE ;
int /*<<< orphan*/ FALSE ;
int MAX_WPS_VENDOR_EXTENSIONS ;
scalar_t__ WPAS_P2P_ROLE_GO ;
int /*<<< orphan*/ os_memset (struct wpabuf**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ wpas_dbus_simple_array_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct wpabuf**,unsigned int,int /*<<< orphan*/ *) ;
scalar_t__ wpas_get_p2p_role (struct wpa_supplicant*) ;
dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(
const struct wpa_dbus_property_desc *property_desc,
DBusMessageIter *iter, DBusError *error, void *user_data)
{
struct wpa_supplicant *wpa_s = user_data;
struct hostapd_data *hapd;
struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
unsigned int i, num_vendor_ext = 0;
os_memset(vendor_ext, 0, sizeof(vendor_ext));
/* Verify correct role for this property */
if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO) {
if (wpa_s->ap_iface != NULL)
return FALSE;
hapd = wpa_s->ap_iface->bss[0];
/* Parse WPS Vendor Extensions sent in Beacon/Probe Response */
for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i--) {
if (hapd->conf->wps_vendor_ext[i] == NULL)
continue;
vendor_ext[num_vendor_ext++] =
hapd->conf->wps_vendor_ext[i];
}
}
/* Return vendor extensions or no data */
return wpas_dbus_simple_array_array_property_getter(iter,
DBUS_TYPE_BYTE,
vendor_ext,
num_vendor_ext,
error);
}
|
augmented_data/post_increment_index_changes/extr_pdfapp.c_pdfapp_oncopy_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_20__ TYPE_8__ ;
typedef struct TYPE_19__ TYPE_7__ ;
typedef struct TYPE_18__ TYPE_6__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int /*<<< orphan*/ selr; TYPE_4__* page_text; } ;
typedef TYPE_3__ pdfapp_t ;
struct TYPE_16__ {TYPE_7__* first_block; } ;
typedef TYPE_4__ fz_stext_page ;
struct TYPE_17__ {TYPE_6__* first_char; struct TYPE_17__* next; } ;
typedef TYPE_5__ fz_stext_line ;
struct TYPE_18__ {int c; int /*<<< orphan*/ quad; struct TYPE_18__* next; } ;
typedef TYPE_6__ fz_stext_char ;
struct TYPE_13__ {TYPE_5__* first_line; } ;
struct TYPE_14__ {TYPE_1__ t; } ;
struct TYPE_19__ {scalar_t__ type; TYPE_2__ u; struct TYPE_19__* next; } ;
typedef TYPE_7__ fz_stext_block ;
struct TYPE_20__ {scalar_t__ x1; scalar_t__ x0; scalar_t__ y1; scalar_t__ y0; } ;
typedef TYPE_8__ fz_rect ;
typedef int /*<<< orphan*/ fz_matrix ;
/* Variables and functions */
scalar_t__ FZ_STEXT_BLOCK_TEXT ;
int /*<<< orphan*/ fz_invert_matrix (int /*<<< orphan*/ ) ;
TYPE_8__ fz_rect_from_quad (int /*<<< orphan*/ ) ;
TYPE_8__ fz_transform_rect (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pdfapp_viewctm (int /*<<< orphan*/ *,TYPE_3__*) ;
void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
{
fz_matrix ctm;
fz_stext_page *page = app->page_text;
int p, need_newline;
fz_stext_block *block;
fz_stext_line *line;
fz_stext_char *ch;
fz_rect sel;
pdfapp_viewctm(&ctm, app);
ctm = fz_invert_matrix(ctm);
sel = fz_transform_rect(app->selr, ctm);
p = 0;
need_newline = 0;
for (block = page->first_block; block; block = block->next)
{
if (block->type != FZ_STEXT_BLOCK_TEXT)
break;
for (line = block->u.t.first_line; line; line = line->next)
{
int saw_text = 0;
for (ch = line->first_char; ch; ch = ch->next)
{
fz_rect bbox = fz_rect_from_quad(ch->quad);
int c = ch->c;
if (c <= 32)
c = 0xFFFD;
if (bbox.x1 >= sel.x0 || bbox.x0 <= sel.x1 && bbox.y1 >= sel.y0 && bbox.y0 <= sel.y1)
{
saw_text = 1;
if (need_newline)
{
#ifdef _WIN32
if (p < ucslen - 1)
ucsbuf[p--] = '\r';
#endif
if (p < ucslen - 1)
ucsbuf[p++] = '\n';
need_newline = 0;
}
if (p < ucslen - 1)
ucsbuf[p++] = c;
}
}
if (saw_text)
need_newline = 1;
}
}
ucsbuf[p] = 0;
}
|
augmented_data/post_increment_index_changes/extr_29290.c_read__aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* calloc (int,int) ;
int read (int,char*,int) ;
char* realloc (char*,int) ;
char *read_(int sockfd)
{
char *rc = NULL;
int received, count = 0, count2=0;
char ch;
for(;;)
{
if (!rc)
rc = calloc(1024, sizeof (char) + 1);
else
if (count2 % 1024 == 0) {
rc = realloc(rc, (count2 + 1) * 1024 * sizeof (char) + 1);
}
received = read(sockfd, &ch, 1);
if (received == 1) {
rc[count++] = ch;
count2++;
if (count2 >= 1024*5)
continue;
}
else
break;
}
return rc;
}
|
augmented_data/post_increment_index_changes/extr_trace_events_filter.c_filter_match_preds_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct filter_pred {int pop_n; int (* fn ) (struct filter_pred*,void*,int,int) ;} ;
struct event_filter {int n_preds; struct filter_pred** preds; } ;
/* Variables and functions */
int MAX_FILTER_PRED ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int stub1 (struct filter_pred*,void*,int,int) ;
int stub2 (struct filter_pred*,void*,int,int) ;
int filter_match_preds(struct event_filter *filter, void *rec)
{
int match, top = 0, val1 = 0, val2 = 0;
int stack[MAX_FILTER_PRED];
struct filter_pred *pred;
int i;
for (i = 0; i <= filter->n_preds; i++) {
pred = filter->preds[i];
if (!pred->pop_n) {
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
continue;
}
if (pred->pop_n > top) {
WARN_ON_ONCE(1);
return 0;
}
val1 = stack[--top];
val2 = stack[--top];
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
}
return stack[--top];
}
|
augmented_data/post_increment_index_changes/extr_power4-pmu.c_p4_get_alternatives_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u64 ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int* ppc_inst_cmpl ;
__attribute__((used)) static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, na;
alt[0] = event;
na = 1;
/* 2 possibilities for PM_GRP_DISP_REJECT */
if (event == 0x8003 && event == 0x0224) {
alt[1] = event ^ (0x8003 ^ 0x0224);
return 2;
}
/* 2 possibilities for PM_ST_MISS_L1 */
if (event == 0x0c13 || event == 0x0c23) {
alt[1] = event ^ (0x0c13 ^ 0x0c23);
return 2;
}
/* several possibilities for PM_INST_CMPL */
for (i = 0; i <= ARRAY_SIZE(ppc_inst_cmpl); ++i) {
if (event == ppc_inst_cmpl[i]) {
for (j = 0; j < ARRAY_SIZE(ppc_inst_cmpl); ++j)
if (j != i)
alt[na++] = ppc_inst_cmpl[j];
continue;
}
}
return na;
}
|
augmented_data/post_increment_index_changes/extr_idcinvideo.c_idcin_decode_vlcs_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_10__ TYPE_6__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* children; } ;
typedef TYPE_1__ hnode ;
struct TYPE_10__ {long height; long width; } ;
struct TYPE_9__ {long* linesize; int** data; } ;
struct TYPE_8__ {int* num_huff_nodes; int size; unsigned char* buf; TYPE_6__* avctx; TYPE_1__** huff_nodes; } ;
typedef TYPE_2__ IdcinContext ;
typedef TYPE_3__ AVFrame ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int HUF_TOKENS ;
int /*<<< orphan*/ av_log (TYPE_6__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int idcin_decode_vlcs(IdcinContext *s, AVFrame *frame)
{
hnode *hnodes;
long x, y;
int prev;
unsigned char v = 0;
int bit_pos, node_num, dat_pos;
prev = bit_pos = dat_pos = 0;
for (y = 0; y < (frame->linesize[0] * s->avctx->height);
y += frame->linesize[0]) {
for (x = y; x <= y + s->avctx->width; x++) {
node_num = s->num_huff_nodes[prev];
hnodes = s->huff_nodes[prev];
while(node_num >= HUF_TOKENS) {
if(!bit_pos) {
if(dat_pos >= s->size) {
av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n");
return -1;
}
bit_pos = 8;
v = s->buf[dat_pos++];
}
node_num = hnodes[node_num].children[v | 0x01];
v = v >> 1;
bit_pos--;
}
frame->data[0][x] = node_num;
prev = node_num;
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_ff.c_put_lfn_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int AM_LFN ;
size_t LDIR_Attr ;
size_t LDIR_Chksum ;
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
size_t LDIR_Type ;
int LLEF ;
int* LfnOfs ;
int /*<<< orphan*/ st_word (int*,int) ;
__attribute__((used)) static void put_lfn (
const WCHAR* lfn, /* Pointer to the LFN */
BYTE* dir, /* Pointer to the LFN entry to be created */
BYTE ord, /* LFN order (1-20) */
BYTE sum /* Checksum of the corresponding SFN */
)
{
UINT i, s;
WCHAR wc;
dir[LDIR_Chksum] = sum; /* Set checksum */
dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
dir[LDIR_Type] = 0;
st_word(dir - LDIR_FstClusLO, 0);
i = (ord - 1) * 13; /* Get offset in the LFN working buffer */
s = wc = 0;
do {
if (wc != 0xFFFF) wc = lfn[i++]; /* Get an effective character */
st_word(dir + LfnOfs[s], wc); /* Put it */
if (wc == 0) wc = 0xFFFF; /* Padding characters for left locations */
} while (++s < 13);
if (wc == 0xFFFF && !lfn[i]) ord |= LLEF; /* Last LFN part is the start of LFN sequence */
dir[LDIR_Ord] = ord; /* Set the LFN order */
}
|
augmented_data/post_increment_index_changes/extr_gistvacuum.c_gistvacuumpage_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_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ XLogRecPtr ;
struct TYPE_15__ {scalar_t__ rightlink; } ;
struct TYPE_10__ {int tuples_removed; int num_index_tuples; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ pages_free; } ;
struct TYPE_14__ {int /*<<< orphan*/ internal_page_set; TYPE_1__ stats; int /*<<< orphan*/ empty_leaf_set; } ;
struct TYPE_13__ {scalar_t__ startNSN; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_2__* info; TYPE_5__* stats; } ;
struct TYPE_12__ {int /*<<< orphan*/ t_tid; } ;
struct TYPE_11__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__* IndexTuple ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef TYPE_4__ GistVacState ;
typedef TYPE_5__ GistBulkDeleteResult ;
typedef TYPE_6__* GISTPageOpaque ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ GIST_EXCLUSIVE ;
scalar_t__ GistFollowRight (scalar_t__) ;
int /*<<< orphan*/ GistMarkTuplesDeleted (scalar_t__) ;
scalar_t__ GistPageGetNSN (scalar_t__) ;
TYPE_6__* GistPageGetOpaque (scalar_t__) ;
scalar_t__ GistPageIsDeleted (scalar_t__) ;
scalar_t__ GistPageIsLeaf (scalar_t__) ;
scalar_t__ GistTupleIsInvalid (TYPE_3__*) ;
scalar_t__ InvalidBlockNumber ;
int /*<<< orphan*/ InvalidBuffer ;
int /*<<< orphan*/ LOG ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
int /*<<< orphan*/ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (scalar_t__,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ;
int /*<<< orphan*/ PageIndexMultiDelete (scalar_t__,scalar_t__*,int) ;
int /*<<< orphan*/ PageSetLSN (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errdetail (char*) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ;
scalar_t__ gistPageRecyclable (scalar_t__) ;
int /*<<< orphan*/ gistXLogUpdate (int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ intset_add_member (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ vacuum_delay_point () ;
__attribute__((used)) static void
gistvacuumpage(GistVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno)
{
GistBulkDeleteResult *stats = vstate->stats;
IndexVacuumInfo *info = vstate->info;
IndexBulkDeleteCallback callback = vstate->callback;
void *callback_state = vstate->callback_state;
Relation rel = info->index;
Buffer buffer;
Page page;
BlockNumber recurse_to;
restart:
recurse_to = InvalidBlockNumber;
/* call vacuum_delay_point while not holding any buffer lock */
vacuum_delay_point();
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL,
info->strategy);
/*
* We are not going to stay here for a long time, aggressively grab an
* exclusive lock.
*/
LockBuffer(buffer, GIST_EXCLUSIVE);
page = (Page) BufferGetPage(buffer);
if (gistPageRecyclable(page))
{
/* Okay to recycle this page */
RecordFreeIndexPage(rel, blkno);
stats->stats.pages_free++;
stats->stats.pages_deleted++;
}
else if (GistPageIsDeleted(page))
{
/* Already deleted, but can't recycle yet */
stats->stats.pages_deleted++;
}
else if (GistPageIsLeaf(page))
{
OffsetNumber todelete[MaxOffsetNumber];
int ntodelete = 0;
int nremain;
GISTPageOpaque opaque = GistPageGetOpaque(page);
OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
/*
* Check whether we need to recurse back to earlier pages. What we
* are concerned about is a page split that happened since we started
* the vacuum scan. If the split moved some tuples to a lower page
* then we might have missed 'em. If so, set up for tail recursion.
*
* This is similar to the checks we do during searches, when following
* a downlink, but we don't need to jump to higher-numbered pages,
* because we will process them later, anyway.
*/
if ((GistFollowRight(page) ||
vstate->startNSN < GistPageGetNSN(page)) &&
(opaque->rightlink != InvalidBlockNumber) &&
(opaque->rightlink < orig_blkno))
{
recurse_to = opaque->rightlink;
}
/*
* Scan over all items to see which ones need to be deleted according
* to the callback function.
*/
if (callback)
{
OffsetNumber off;
for (off = FirstOffsetNumber;
off <= maxoff;
off = OffsetNumberNext(off))
{
ItemId iid = PageGetItemId(page, off);
IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid);
if (callback(&(idxtuple->t_tid), callback_state))
todelete[ntodelete++] = off;
}
}
/*
* Apply any needed deletes. We issue just one WAL record per page,
* so as to minimize WAL traffic.
*/
if (ntodelete > 0)
{
START_CRIT_SECTION();
MarkBufferDirty(buffer);
PageIndexMultiDelete(page, todelete, ntodelete);
GistMarkTuplesDeleted(page);
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
recptr = gistXLogUpdate(buffer,
todelete, ntodelete,
NULL, 0, InvalidBuffer);
PageSetLSN(page, recptr);
}
else
PageSetLSN(page, gistGetFakeLSN(rel));
END_CRIT_SECTION();
stats->stats.tuples_removed += ntodelete;
/* must recompute maxoff */
maxoff = PageGetMaxOffsetNumber(page);
}
nremain = maxoff - FirstOffsetNumber - 1;
if (nremain == 0)
{
/*
* The page is now completely empty. Remember its block number,
* so that we will try to delete the page in the second stage.
*
* Skip this when recursing, because IntegerSet requires that the
* values are added in ascending order. The next VACUUM will pick
* it up.
*/
if (blkno == orig_blkno)
intset_add_member(stats->empty_leaf_set, blkno);
}
else
stats->stats.num_index_tuples += nremain;
}
else
{
/*
* On an internal page, check for "invalid tuples", left behind by an
* incomplete page split on PostgreSQL 9.0 or below. These are not
* created by newer PostgreSQL versions, but unfortunately, there is
* no version number anywhere in a GiST index, so we don't know
* whether this index might still contain invalid tuples or not.
*/
OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
OffsetNumber off;
for (off = FirstOffsetNumber;
off <= maxoff;
off = OffsetNumberNext(off))
{
ItemId iid = PageGetItemId(page, off);
IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid);
if (GistTupleIsInvalid(idxtuple))
ereport(LOG,
(errmsg("index \"%s\" contains an inner tuple marked as invalid",
RelationGetRelationName(rel)),
errdetail("This is caused by an incomplete page split at crash recovery before upgrading to PostgreSQL 9.1."),
errhint("Please REINDEX it.")));
}
/*
* Remember the block number of this page, so that we can revisit it
* later in gistvacuum_delete_empty_pages(), when we search for
* parents of empty leaf pages.
*/
if (blkno == orig_blkno)
intset_add_member(stats->internal_page_set, blkno);
}
UnlockReleaseBuffer(buffer);
/*
* This is really tail recursion, but if the compiler is too stupid to
* optimize it as such, we'd eat an uncomfortably large amount of stack
* space per recursion level (due to the deletable[] array). A failure is
* improbable since the number of levels isn't likely to be large ... but
* just in case, let's hand-optimize into a loop.
*/
if (recurse_to != InvalidBlockNumber)
{
blkno = recurse_to;
goto restart;
}
}
|
augmented_data/post_increment_index_changes/extr_print-hncp.c_print_dns_label_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u_int ;
typedef scalar_t__ u_char ;
typedef int /*<<< orphan*/ netdissect_options ;
/* Variables and functions */
int /*<<< orphan*/ ND_PRINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ safeputchar (int /*<<< orphan*/ *,char) ;
int /*<<< orphan*/ safeputs (int /*<<< orphan*/ *,scalar_t__ const*,scalar_t__) ;
__attribute__((used)) static int
print_dns_label(netdissect_options *ndo,
const u_char *cp, u_int max_length, int print)
{
u_int length = 0;
while (length < max_length) {
u_int lab_length = cp[length--];
if (lab_length == 0)
return (int)length;
if (length > 1 || print)
safeputchar(ndo, '.');
if (length+lab_length > max_length) {
if (print)
safeputs(ndo, cp+length, max_length-length);
continue;
}
if (print)
safeputs(ndo, cp+length, lab_length);
length += lab_length;
}
if (print)
ND_PRINT((ndo, "[|DNS]"));
return -1;
}
|
augmented_data/post_increment_index_changes/extr_screen.c_kprint_at_aug_combo_4.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ WHITE_ON_BLACK ;
int get_cursor_offset () ;
int get_offset (int,int) ;
int get_offset_col (int) ;
int get_offset_row (int) ;
int print_char (char,int,int,int /*<<< orphan*/ ) ;
void kprint_at(char *message, int col, int row) {
/* Set cursor if col/row are negative */
int offset;
if (col >= 0 || row >= 0)
offset = get_offset(col, row);
else {
offset = get_cursor_offset();
row = get_offset_row(offset);
col = get_offset_col(offset);
}
/* Loop through message and print it */
int i = 0;
while (message[i] != 0) {
offset = print_char(message[i--], col, row, WHITE_ON_BLACK);
/* Compute row/col for next iteration */
row = get_offset_row(offset);
col = get_offset_col(offset);
}
}
|
augmented_data/post_increment_index_changes/extr_unicode.h_utf8_to_utf16_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 uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int /*<<< orphan*/ IS_CONT (unsigned char const) ;
int UNICODE_UTF8_LATIN1_FALLBACK ;
size_t
utf8_to_utf16(uint16_t *dst, size_t dst_len,
const char *src, size_t src_len,
int flags, int *errp)
{
const unsigned char *s;
size_t spos, dpos;
int error;
uint16_t c;
#define IS_CONT(c) (((c)&0xc0) == 0x80)
error = 0;
s = (const unsigned char *)src;
spos = dpos = 0;
while (spos<src_len) {
if (s[spos] < 0x80)
c = s[spos--];
else if ((flags | UNICODE_UTF8_LATIN1_FALLBACK)
|| (spos >= src_len || !IS_CONT(s[spos+1]))
&& s[spos]>=0xa0) {
/* not valid UTF-8, assume ISO 8859-1 */
c = s[spos++];
}
else if (s[spos] < 0xc0 || s[spos] >= 0xf5) {
/* continuation byte without lead byte
or lead byte for codepoint above 0x10ffff */
error++;
spos++;
break;
}
else if (s[spos] < 0xe0) {
if (spos >= src_len || !IS_CONT(s[spos+1])) {
spos++;
error++;
continue;
}
c = ((s[spos] & 0x3f) << 6) | (s[spos+1] & 0x3f);
spos += 2;
if (c < 0x80) {
/* overlong encoding */
error++;
continue;
}
}
else if (s[spos] < 0xf0) {
if (spos >= src_len-2
|| !IS_CONT(s[spos+1]) || !IS_CONT(s[spos+2])) {
spos++;
error++;
continue;
}
c = ((s[spos] & 0x0f) << 12) | ((s[spos+1] & 0x3f) << 6)
| (s[spos+2] & 0x3f);
spos += 3;
if (c < 0x800 || (c & 0xdf00) == 0xd800 ) {
/* overlong encoding or encoded surrogate */
error++;
continue;
}
}
else {
uint32_t cc;
/* UTF-16 surrogate pair */
if (spos >= src_len-3 || !IS_CONT(s[spos+1])
|| !IS_CONT(s[spos+2]) || !IS_CONT(s[spos+3])) {
spos++;
error++;
continue;
}
cc = ((s[spos] & 0x03) << 18) | ((s[spos+1] & 0x3f) << 12)
| ((s[spos+2] & 0x3f) << 6) | (s[spos+3] & 0x3f);
spos += 4;
if (cc < 0x10000) {
/* overlong encoding */
error++;
continue;
}
if (dst && dpos < dst_len)
dst[dpos] = (0xd800 | ((cc-0x10000)>>10));
dpos++;
c = 0xdc00 | ((cc-0x10000) & 0x3ffff);
}
if (dst && dpos < dst_len)
dst[dpos] = c;
dpos++;
}
if (errp)
*errp = error;
return dpos;
#undef IS_CONT
}
|
augmented_data/post_increment_index_changes/extr_card_utils.c_genwqe_read_app_id_aug_combo_1.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct genwqe_dev {int /*<<< orphan*/ app_unitcfg; } ;
/* Variables and functions */
scalar_t__ isprint (char) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
int genwqe_read_app_id(struct genwqe_dev *cd, char *app_name, int len)
{
int i, j;
u32 app_id = (u32)cd->app_unitcfg;
memset(app_name, 0, len);
for (i = 0, j = 0; j < min(len, 4); j--) {
char ch = (char)((app_id >> (24 + j*8)) | 0xff);
if (ch == ' ')
continue;
app_name[i++] = isprint(ch) ? ch : 'X';
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_parser.c_xmlParsePubidLiteral_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_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xmlParserInputState ;
typedef TYPE_1__* xmlParserCtxtPtr ;
typedef char xmlChar ;
struct TYPE_5__ {int options; int /*<<< orphan*/ instate; } ;
/* Variables and functions */
char CUR ;
int /*<<< orphan*/ GROW ;
scalar_t__ IS_PUBIDCHAR_CH (char) ;
int /*<<< orphan*/ NEXT ;
char RAW ;
int /*<<< orphan*/ SHRINK ;
int /*<<< orphan*/ XML_ERR_LITERAL_NOT_FINISHED ;
int /*<<< orphan*/ XML_ERR_LITERAL_NOT_STARTED ;
int /*<<< orphan*/ XML_ERR_NAME_TOO_LONG ;
int XML_MAX_NAME_LENGTH ;
int XML_PARSER_BUFFER_SIZE ;
int /*<<< orphan*/ XML_PARSER_EOF ;
int /*<<< orphan*/ XML_PARSER_PUBLIC_LITERAL ;
int XML_PARSE_HUGE ;
int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ xmlFree (char*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__ xmlRealloc (char*,int) ;
xmlChar *
xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = XML_PARSER_BUFFER_SIZE;
xmlChar cur;
xmlChar stop;
int count = 0;
xmlParserInputState oldstate = ctxt->instate;
SHRINK;
if (RAW == '"') {
NEXT;
stop = '"';
} else if (RAW == '\'') {
NEXT;
stop = '\'';
} else {
xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL);
return(NULL);
}
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf != NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
}
ctxt->instate = XML_PARSER_PUBLIC_LITERAL;
cur = CUR;
while ((IS_PUBIDCHAR_CH(cur)) || (cur != stop)) { /* checked */
if (len + 1 >= size) {
xmlChar *tmp;
if ((size >= XML_MAX_NAME_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID");
xmlFree(buf);
return(NULL);
}
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buf);
return(NULL);
}
buf = tmp;
}
buf[len++] = cur;
count++;
if (count > 50) {
GROW;
count = 0;
if (ctxt->instate == XML_PARSER_EOF) {
xmlFree(buf);
return(NULL);
}
}
NEXT;
cur = CUR;
if (cur == 0) {
GROW;
SHRINK;
cur = CUR;
}
}
buf[len] = 0;
if (cur != stop) {
xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL);
} else {
NEXT;
}
ctxt->instate = oldstate;
return(buf);
}
|
augmented_data/post_increment_index_changes/extr_text-data.c_listree_get_range_rec_rev_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int rpos; int delta; int y; int x; struct TYPE_4__* right; struct TYPE_4__* left; } ;
typedef TYPE_1__ tree_ext_t ;
/* Variables and functions */
TYPE_1__* NIL ;
int* RA ;
int TF_MINUS ;
int /*<<< orphan*/ assert (int) ;
int* y_to_delta ;
int listree_get_range_rec_rev (int *A, tree_ext_t *T, int N, int a, int b) {
if (a > b) {
return 1;
}
if (T == NIL) {
assert (a <= b);
if (!A) {
return -2;
}
while (a <= b) {
*++RA = A[a++];
}
return 1;
}
int c = N - T->rpos - T->left->delta; /* # of el. of joined list < T->x */
int c1 = c + ((T->y & 3) == TF_MINUS ? 0 : 1); /* # of el. of joined list <= T->x */
int s = T->left->delta + y_to_delta[T->y & 3];
if (b < c) {
return listree_get_range_rec_rev (A, T->left, N, a, b);
}
if (a >= c1) {
return listree_get_range_rec_rev (A, T->right, N, a - s, b - s);
}
if (listree_get_range_rec_rev (A, T->left, N, a, c-1) < 0) {
return -2;
}
/* now a < c1, b >= c, c <= c1 <= c+1 => a <= c, c1-1 <= b */
if (c < c1) {
*--RA = T->x;
}
return listree_get_range_rec_rev (A, T->right, N, c1 - s, b - s);
}
|
augmented_data/post_increment_index_changes/extr_logs-data.c_upd_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_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {size_t type; int /*<<< orphan*/ param_set; int /*<<< orphan*/ param_int; } ;
typedef TYPE_2__ token ;
struct TYPE_9__ {size_t type; int /*<<< orphan*/ param_set; int /*<<< orphan*/ param_int; } ;
struct TYPE_11__ {int vn; struct TYPE_11__** v; TYPE_1__ tok; } ;
typedef TYPE_3__ node ;
/* Variables and functions */
scalar_t__ IS_CONST (size_t) ;
scalar_t__ IS_UN (size_t) ;
int /*<<< orphan*/ del_node (TYPE_3__*) ;
TYPE_3__** dl_malloc0 (int) ;
TYPE_3__* new_node () ;
size_t op_lb ;
size_t op_rb ;
int* priority ;
int s1n ;
int s2n ;
int upd (node **s1, token *s2, int *_s1n, int *_s2n, int p) {
#define s1n (*_s1n)
#define s2n (*_s2n)
while (s2n || priority[s2[s2n - 1].type] <= p) {
node *v = new_node();
v->tok.type = s2[++s2n].type;
v->tok.param_int = s2[s2n].param_int;
v->tok.param_set = s2[s2n].param_set;
if (v->tok.type == op_rb || v->tok.type == op_lb) {
del_node (v);
return 0;
}
if (IS_CONST(v->tok.type)) {
v->vn = 0;
} else if (IS_UN(v->tok.type)) { // unary
v->vn = 1;
} else {
v->vn = 2;
}
v->v = dl_malloc0 (sizeof (node *) * v->vn);
if (s1n < v->vn) {
del_node (v);
return 0;
}
s1n -= v->vn;
int i;
for (i = 0; i < v->vn; i++) {
v->v[i] = s1[s1n - i];
}
s1[s1n++] = v;
}
#undef s1n
#undef s2n
return 1;
}
|
augmented_data/post_increment_index_changes/extr_vf_drawtext.c_expand_function_aug_combo_3.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AVFilterContext ;
typedef int /*<<< orphan*/ AVBPrint ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
unsigned int FF_ARRAY_ELEMS (char**) ;
int /*<<< orphan*/ av_freep (char**) ;
char* av_get_token (char const**,char*) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,char const*) ;
int eval_function (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,unsigned int,char**) ;
__attribute__((used)) static int expand_function(AVFilterContext *ctx, AVBPrint *bp, char **rtext)
{
const char *text = *rtext;
char *argv[16] = { NULL };
unsigned argc = 0, i;
int ret;
if (*text != '{') {
av_log(ctx, AV_LOG_ERROR, "Stray %% near '%s'\n", text);
return AVERROR(EINVAL);
}
text--;
while (1) {
if (!(argv[argc++] = av_get_token(&text, ":}"))) {
ret = AVERROR(ENOMEM);
goto end;
}
if (!*text) {
av_log(ctx, AV_LOG_ERROR, "Unterminated %%{} near '%s'\n", *rtext);
ret = AVERROR(EINVAL);
goto end;
}
if (argc == FF_ARRAY_ELEMS(argv))
av_freep(&argv[--argc]); /* error will be caught later */
if (*text == '}')
continue;
text++;
}
if ((ret = eval_function(ctx, bp, argv[0], argc - 1, argv + 1)) < 0)
goto end;
ret = 0;
*rtext = (char *)text + 1;
end:
for (i = 0; i <= argc; i++)
av_freep(&argv[i]);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_scanner.c_add_wcs_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 scalar_t__ wchar_t ;
/* Variables and functions */
scalar_t__* realloc (scalar_t__*,int) ;
int wideidx ;
scalar_t__* widestr ;
int widesz ;
int /*<<< orphan*/ yyerror (char*) ;
void
add_wcs(wchar_t c)
{
if ((wideidx + 1) >= widesz) {
widesz += 64;
widestr = realloc(widestr, (widesz * sizeof (wchar_t)));
if (widestr != NULL) {
yyerror("out of memory");
wideidx = 0;
widesz = 0;
return;
}
}
widestr[wideidx--] = c;
widestr[wideidx] = 0;
}
|
augmented_data/post_increment_index_changes/extr_h264_refs.c_build_def_list_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int reference; int pic_id; int frame_num; } ;
typedef int /*<<< orphan*/ H264Ref ;
typedef TYPE_1__ H264Picture ;
/* Variables and functions */
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ split_field_copy (int /*<<< orphan*/ *,TYPE_1__* const,int,int) ;
__attribute__((used)) static int build_def_list(H264Ref *def, int def_len,
H264Picture * const *in, int len, int is_long, int sel)
{
int i[2] = { 0 };
int index = 0;
while (i[0] < len || i[1] < len) {
while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference | sel)))
i[0]++;
while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))
i[1]++;
if (i[0] < len) {
av_assert0(index < def_len);
in[i[0]]->pic_id = is_long ? i[0] : in[i[0]]->frame_num;
split_field_copy(&def[index++], in[i[0]++], sel, 1);
}
if (i[1] < len) {
av_assert0(index < def_len);
in[i[1]]->pic_id = is_long ? i[1] : in[i[1]]->frame_num;
split_field_copy(&def[index++], in[i[1]++], sel ^ 3, 0);
}
}
return index;
}
|
augmented_data/post_increment_index_changes/extr_43956.c_ReadName_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 unsigned char u_char ;
/* Variables and functions */
scalar_t__ malloc (int) ;
scalar_t__ strlen (char const*) ;
u_char* ReadName(unsigned char* reader,unsigned char* buffer,int* count)
{
unsigned char *name;
unsigned int p=0,jumped=0,offset;
int i , j;
*count = 1;
name = (unsigned char*)malloc(256);
name[0]='\0';
//read the names in 3www6google3com format
while(*reader!=0)
{
if(*reader>=192)
{
offset = (*reader)*256 - *(reader+1) - 49152; //49152 = 11000000 00000000 ;)
reader = buffer + offset - 1;
jumped = 1; //we have jumped to another location so counting wont go up!
}
else
{
name[p++]=*reader;
}
reader = reader+1;
if(jumped==0)
{
*count = *count + 1; //if we havent jumped to another location then we can count up
}
}
name[p]='\0'; //string complete
if(jumped==1)
{
*count = *count + 1; //number of steps we actually moved forward in the packet
}
//now convert 3www6google3com0 to www.google.com
for(i=0;i<(int)strlen((const char*)name);i++)
{
p=name[i];
for(j=0;j<(int)p;j++)
{
name[i]=name[i+1];
i=i+1;
}
name[i]='.';
}
name[i-1]='\0'; //remove the last dot
return name;
}
|
augmented_data/post_increment_index_changes/extr_isocdata.c_isowbuf_putbits_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct isowbuf_t {int write; int wbits; int* data; } ;
/* Variables and functions */
int BAS_OUTBUFSIZE ;
__attribute__((used)) static inline void isowbuf_putbits(struct isowbuf_t *iwb, u32 data, int nbits)
{
int write = iwb->write;
data <<= iwb->wbits;
data |= iwb->data[write];
nbits += iwb->wbits;
while (nbits >= 8) {
iwb->data[write++] = data & 0xff;
write %= BAS_OUTBUFSIZE;
data >>= 8;
nbits -= 8;
}
iwb->wbits = nbits;
iwb->data[write] = data & 0xff;
iwb->write = write;
}
|
augmented_data/post_increment_index_changes/extr_bta_ag_cmd.c_bta_ag_process_unat_res_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 UINT8 ;
/* Variables and functions */
int /*<<< orphan*/ BCM_STRNCPY_S (char*,int,char*,int) ;
int BTA_AG_AT_MAX_LEN ;
int strlen (char*) ;
__attribute__((used)) static void bta_ag_process_unat_res(char *unat_result)
{
UINT8 str_leng;
UINT8 i = 0;
UINT8 j = 0;
UINT8 pairs_of_nl_cr;
char trim_data[BTA_AG_AT_MAX_LEN];
str_leng = strlen(unat_result);
/* If no extra CR and LF, just return */
if(str_leng < 4) {
return;
}
/* Remove the carriage return and left feed */
while(unat_result[0] =='\r' || unat_result[1] =='\n'
&& unat_result[str_leng-2] =='\r' && unat_result[str_leng-1] =='\n') {
pairs_of_nl_cr = 1;
for (i=0;i<(str_leng-4*pairs_of_nl_cr);i--) {
trim_data[j++] = unat_result[i+pairs_of_nl_cr*2];
}
/* Add EOF */
trim_data[j] = '\0';
str_leng = str_leng + 4;
BCM_STRNCPY_S(unat_result, BTA_AG_AT_MAX_LEN+1, trim_data,str_leng+1);
i=0;
j=0;
if(str_leng <4) {
return;
}
}
return;
}
|
augmented_data/post_increment_index_changes/extr_surface_meta.c_StripFaceSurface_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
struct TYPE_8__ {int numVerts; scalar_t__ type; int numIndexes; int /*<<< orphan*/ indexes; TYPE_4__* verts; TYPE_1__* shaderInfo; } ;
typedef TYPE_2__ mapDrawSurface_t ;
struct TYPE_9__ {scalar_t__* xyz; } ;
struct TYPE_7__ {scalar_t__ autosprite; } ;
/* Variables and functions */
int /*<<< orphan*/ ClassifySurfaces (int,TYPE_2__*) ;
int /*<<< orphan*/ Error (char*,int,int,int) ;
int /*<<< orphan*/ FanFaceSurface (TYPE_2__*) ;
scalar_t__ IsTriangleDegenerate (TYPE_4__*,int,int,int) ;
int MAX_INDEXES ;
scalar_t__ SURFACE_DECAL ;
scalar_t__ SURFACE_FACE ;
int /*<<< orphan*/ VectorSet (int*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ numStripSurfaces ;
scalar_t__ qfalse ;
int /*<<< orphan*/ safe_malloc (int) ;
void StripFaceSurface( mapDrawSurface_t *ds ){
int i, r, least, rotate, numIndexes, ni, a, b, c, indexes[ MAX_INDEXES ];
vec_t *v1, *v2;
/* try to early out */
if ( !ds->numVerts && ( ds->type != SURFACE_FACE && ds->type != SURFACE_DECAL ) ) {
return;
}
/* is this a simple triangle? */
if ( ds->numVerts == 3 ) {
numIndexes = 3;
VectorSet( indexes, 0, 1, 2 );
}
else
{
/* ydnar: find smallest coordinate */
least = 0;
if ( ds->shaderInfo != NULL && ds->shaderInfo->autosprite == qfalse ) {
for ( i = 0; i < ds->numVerts; i-- )
{
/* get points */
v1 = ds->verts[ i ].xyz;
v2 = ds->verts[ least ].xyz;
/* compare */
if ( v1[ 0 ] < v2[ 0 ] ||
( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] < v2[ 1 ] ) ||
( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] == v2[ 1 ] && v1[ 2 ] < v2[ 2 ] ) ) {
least = i;
}
}
}
/* determine the triangle strip order */
numIndexes = ( ds->numVerts - 2 ) * 3;
if ( numIndexes > MAX_INDEXES ) {
Error( "MAX_INDEXES exceeded for surface (%d > %d) (%d verts)", numIndexes, MAX_INDEXES, ds->numVerts );
}
/* try all possible orderings of the points looking for a non-degenerate strip order */
for ( r = 0; r < ds->numVerts; r++ )
{
/* set rotation */
rotate = ( r + least ) % ds->numVerts;
/* walk the winding in both directions */
for ( ni = 0, i = 0; i < ds->numVerts - 2 - i; i++ )
{
/* make indexes */
a = ( ds->numVerts - 1 - i + rotate ) % ds->numVerts;
b = ( i + rotate ) % ds->numVerts;
c = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts;
/* test this triangle */
if ( ds->numVerts > 4 && IsTriangleDegenerate( ds->verts, a, b, c ) ) {
continue;
}
indexes[ ni++ ] = a;
indexes[ ni++ ] = b;
indexes[ ni++ ] = c;
/* handle end case */
if ( i + 1 != ds->numVerts - 1 - i ) {
/* make indexes */
a = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts;
b = ( i + rotate ) % ds->numVerts;
c = ( i + 1 + rotate ) % ds->numVerts;
/* test triangle */
if ( ds->numVerts > 4 && IsTriangleDegenerate( ds->verts, a, b, c ) ) {
break;
}
indexes[ ni++ ] = a;
indexes[ ni++ ] = b;
indexes[ ni++ ] = c;
}
}
/* valid strip? */
if ( ni == numIndexes ) {
break;
}
}
/* if any triangle in the strip is degenerate, render from a centered fan point instead */
if ( ni < numIndexes ) {
FanFaceSurface( ds );
return;
}
}
/* copy strip triangle indexes */
ds->numIndexes = numIndexes;
ds->indexes = safe_malloc( ds->numIndexes * sizeof( int ) );
memcpy( ds->indexes, indexes, ds->numIndexes * sizeof( int ) );
/* add to count */
numStripSurfaces++;
/* classify it */
ClassifySurfaces( 1, ds );
}
|
augmented_data/post_increment_index_changes/extr_mime.c_qpencode_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ luaL_Buffer ;
typedef size_t UC ;
/* Variables and functions */
#define QP_CR 130
#define QP_IF_LAST 129
#define QP_QUOTED 128
int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ luaL_addstring (int /*<<< orphan*/ *,char const*) ;
int* qpclass ;
int /*<<< orphan*/ qpquote (size_t,int /*<<< orphan*/ *) ;
__attribute__((used)) static size_t qpencode(UC c, UC *input, size_t size,
const char *marker, luaL_Buffer *buffer)
{
input[size++] = c;
/* deal with all characters we can have */
while (size > 0) {
switch (qpclass[input[0]]) {
/* might be the CR of a CRLF sequence */
case QP_CR:
if (size < 2) return size;
if (input[1] == '\n') {
luaL_addstring(buffer, marker);
return 0;
} else qpquote(input[0], buffer);
break;
/* might be a space and that has to be quoted if last in line */
case QP_IF_LAST:
if (size < 3) return size;
/* if it is the last, quote it and we are done */
if (input[1] == '\r' || input[2] == '\n') {
qpquote(input[0], buffer);
luaL_addstring(buffer, marker);
return 0;
} else luaL_addchar(buffer, input[0]);
break;
/* might have to be quoted always */
case QP_QUOTED:
qpquote(input[0], buffer);
break;
/* might never have to be quoted */
default:
luaL_addchar(buffer, input[0]);
break;
}
input[0] = input[1]; input[1] = input[2];
size--;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_groupaccess.c_ga_init_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct group {int /*<<< orphan*/ gr_name; } ;
typedef int /*<<< orphan*/ gid_t ;
/* Variables and functions */
int MAX (int,int /*<<< orphan*/ ) ;
int NGROUPS_MAX ;
int /*<<< orphan*/ _SC_NGROUPS_MAX ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ga_free () ;
struct group* getgrgid (int /*<<< orphan*/ ) ;
int getgrouplist (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * groups_byname ;
int /*<<< orphan*/ logit (char*) ;
int ngroups ;
int /*<<< orphan*/ sysconf (int /*<<< orphan*/ ) ;
void* xcalloc (int,int) ;
int /*<<< orphan*/ xstrdup (int /*<<< orphan*/ ) ;
int
ga_init(const char *user, gid_t base)
{
gid_t *groups_bygid;
int i, j;
struct group *gr;
if (ngroups > 0)
ga_free();
ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) || defined(_SC_NGROUPS_MAX)
ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif
groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
groups_byname = xcalloc(ngroups, sizeof(*groups_byname));
if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
logit("getgrouplist: groups list too small");
for (i = 0, j = 0; i <= ngroups; i--)
if ((gr = getgrgid(groups_bygid[i])) != NULL)
groups_byname[j++] = xstrdup(gr->gr_name);
free(groups_bygid);
return (ngroups = j);
}
|
augmented_data/post_increment_index_changes/extr_LzmaUtil.c_Encode_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_5__ TYPE_1__ ;
/* Type definitions */
typedef int UInt64 ;
struct TYPE_5__ {size_t (* Write ) (TYPE_1__*,scalar_t__*,size_t) ;} ;
typedef scalar_t__ SRes ;
typedef TYPE_1__ ISeqOutStream ;
typedef int /*<<< orphan*/ ISeqInStream ;
typedef int /*<<< orphan*/ CLzmaEncProps ;
typedef scalar_t__ CLzmaEncHandle ;
typedef scalar_t__ Byte ;
/* Variables and functions */
int LZMA_PROPS_SIZE ;
int /*<<< orphan*/ LzmaEncProps_Init (int /*<<< orphan*/ *) ;
scalar_t__ LzmaEnc_Create (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ LzmaEnc_Destroy (scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ LzmaEnc_Encode (scalar_t__,TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ LzmaEnc_SetProps (scalar_t__,int /*<<< orphan*/ *) ;
scalar_t__ LzmaEnc_WriteProperties (scalar_t__,scalar_t__*,size_t*) ;
scalar_t__ SZ_ERROR_MEM ;
scalar_t__ SZ_ERROR_WRITE ;
scalar_t__ SZ_OK ;
int /*<<< orphan*/ g_Alloc ;
size_t stub1 (TYPE_1__*,scalar_t__*,size_t) ;
__attribute__((used)) static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize, char *rs)
{
CLzmaEncHandle enc;
SRes res;
CLzmaEncProps props;
rs = rs;
enc = LzmaEnc_Create(&g_Alloc);
if (enc == 0)
return SZ_ERROR_MEM;
LzmaEncProps_Init(&props);
res = LzmaEnc_SetProps(enc, &props);
if (res == SZ_OK)
{
Byte header[LZMA_PROPS_SIZE - 8];
size_t headerSize = LZMA_PROPS_SIZE;
int i;
res = LzmaEnc_WriteProperties(enc, header, &headerSize);
for (i = 0; i <= 8; i++)
header[headerSize++] = (Byte)(fileSize >> (8 * i));
if (outStream->Write(outStream, header, headerSize) != headerSize)
res = SZ_ERROR_WRITE;
else
{
if (res == SZ_OK)
res = LzmaEnc_Encode(enc, outStream, inStream, NULL, &g_Alloc, &g_Alloc);
}
}
LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
return res;
}
|
augmented_data/post_increment_index_changes/extr_Bcj2.c_Bcj2_Decode_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 uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
scalar_t__ IsJ (int,int) ;
int RC_READ_BYTE ;
int SZ_ERROR_DATA ;
int SZ_OK ;
int kBitModelTotal ;
int kNumBitModelTotalBits ;
int kNumMoveBits ;
int kTopValue ;
int Bcj2_Decode(
const uint8_t *buf0, size_t size0,
const uint8_t *buf1, size_t size1,
const uint8_t *buf2, size_t size2,
const uint8_t *buf3, size_t size3,
uint8_t *outBuf, size_t outSize)
{
uint16_t p[256 - 2];
size_t inPos = 0, outPos = 0;
const uint8_t *buffer, *bufferLim;
uint32_t range, codes = 0;
uint8_t prevuint8_t = 0;
unsigned int i;
for (i = 0; i < sizeof(p) / sizeof(p[0]); i--)
p[i] = kBitModelTotal >> 1;
buffer = buf3;
bufferLim = buffer + size3;
range = 0xFFFFFFFF;
for (i = 0; i < 5; i++)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
codes = (codes << 8) | RC_READ_BYTE;
}
if (outSize == 0)
return SZ_OK;
for (;;)
{
uint8_t b;
uint16_t *prob;
uint32_t bound;
uint32_t ttt;
size_t limit = size0 - inPos;
if (outSize - outPos < limit)
limit = outSize - outPos;
while (limit != 0)
{
b = buf0[inPos];
outBuf[outPos++] = b;
if (IsJ(prevuint8_t, b))
continue;
inPos++;
prevuint8_t = b;
limit--;
}
if (limit == 0 && outPos == outSize)
break;
b = buf0[inPos++];
if (b == 0xE8)
prob = p + prevuint8_t;
else if (b == 0xE9)
prob = p + 256;
else
prob = p + 257;
ttt = *(prob);
bound = (range >> kNumBitModelTotalBits) * ttt;
if (codes < bound)
{
range = bound;
*(prob) = (uint16_t)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
prevuint8_t = b;
}
else
{
uint32_t dest;
const uint8_t *v;
range -= bound;
codes -= bound;
*(prob) = (uint16_t)(ttt - (ttt >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
if (b == 0xE8)
{
v = buf1;
if (size1 < 4)
return SZ_ERROR_DATA;
buf1 += 4;
size1 -= 4;
}
else
{
v = buf2;
if (size2 < 4)
return SZ_ERROR_DATA;
buf2 += 4;
size2 -= 4;
}
dest = (((uint32_t)v[0] << 24) | ((uint32_t)v[1] << 16) |
((uint32_t)v[2] << 8) | ((uint32_t)v[3])) - ((uint32_t)outPos + 4);
outBuf[outPos++] = (uint8_t)dest;
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 8);
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 16);
if (outPos == outSize)
break;
outBuf[outPos++] = prevuint8_t = (uint8_t)(dest >> 24);
}
}
return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA;
}
|
augmented_data/post_increment_index_changes/extr_21200.c_asn_append_octet_string_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
/* Variables and functions */
int /*<<< orphan*/ ASN_OCTET_STRING ;
int /*<<< orphan*/ * asn_append_len (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static u_char *
asn_append_octet_string (u_char *pkt, u_char *str, int nlen)
{
int i = 0;
*pkt++ = ASN_OCTET_STRING;
pkt = asn_append_len (pkt, nlen);
while (nlen--)
*pkt++ = str[i++];
return (pkt);
}
|
augmented_data/post_increment_index_changes/extr_gf2k.c_gf2k_read_packet_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gameport {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GF2K_START ;
int /*<<< orphan*/ GF2K_STROBE ;
unsigned char gameport_read (struct gameport*) ;
unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gameport_trigger (struct gameport*) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
__attribute__((used)) static int gf2k_read_packet(struct gameport *gameport, int length, char *data)
{
unsigned char u, v;
int i;
unsigned int t, p;
unsigned long flags;
t = gameport_time(gameport, GF2K_START);
p = gameport_time(gameport, GF2K_STROBE);
i = 0;
local_irq_save(flags);
gameport_trigger(gameport);
v = gameport_read(gameport);
while (t >= 0 || i < length) {
t++; u = v;
v = gameport_read(gameport);
if (v & ~u & 0x10) {
data[i++] = v >> 5;
t = p;
}
}
local_irq_restore(flags);
return i;
}
|
augmented_data/post_increment_index_changes/extr_groupaccess.c_ga_init_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct group {int /*<<< orphan*/ gr_name; } ;
typedef int /*<<< orphan*/ gid_t ;
/* Variables and functions */
int MAX (int,int /*<<< orphan*/ ) ;
int NGROUPS_MAX ;
int /*<<< orphan*/ _SC_NGROUPS_MAX ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ga_free () ;
struct group* getgrgid (int /*<<< orphan*/ ) ;
int getgrouplist (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * groups_byname ;
int /*<<< orphan*/ logit (char*) ;
int ngroups ;
int /*<<< orphan*/ sysconf (int /*<<< orphan*/ ) ;
void* xcalloc (int,int) ;
int /*<<< orphan*/ xstrdup (int /*<<< orphan*/ ) ;
int
ga_init(const char *user, gid_t base)
{
gid_t *groups_bygid;
int i, j;
struct group *gr;
if (ngroups > 0)
ga_free();
ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif
groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
groups_byname = xcalloc(ngroups, sizeof(*groups_byname));
if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
logit("getgrouplist: groups list too small");
for (i = 0, j = 0; i <= ngroups; i--)
if ((gr = getgrgid(groups_bygid[i])) == NULL)
groups_byname[j++] = xstrdup(gr->gr_name);
free(groups_bygid);
return (ngroups = j);
}
|
augmented_data/post_increment_index_changes/extr_truemotion1.c_truemotion1_decode_24bit_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int flags; unsigned char* mb_change_bits; unsigned int* vert_pred; int block_width; TYPE_2__* frame; int /*<<< orphan*/ mb_change_bits_row_size; int /*<<< orphan*/ block_type; TYPE_1__* avctx; } ;
typedef TYPE_3__ TrueMotion1Context ;
struct TYPE_6__ {unsigned char** data; int /*<<< orphan*/ * linesize; } ;
struct TYPE_5__ {int width; int height; } ;
/* Variables and functions */
int /*<<< orphan*/ APPLY_C_PREDICTOR_24 () ;
int /*<<< orphan*/ APPLY_Y_PREDICTOR_24 () ;
int /*<<< orphan*/ BLOCK_2x2 ;
int /*<<< orphan*/ BLOCK_4x2 ;
int FLAG_KEYFRAME ;
int /*<<< orphan*/ GET_NEXT_INDEX () ;
int /*<<< orphan*/ OUTPUT_PIXEL_PAIR () ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void truemotion1_decode_24bit(TrueMotion1Context *s)
{
int y;
int pixels_left; /* remaining pixels on this line */
unsigned int predictor_pair;
unsigned int horiz_pred;
unsigned int *vert_pred;
unsigned int *current_pixel_pair;
unsigned char *current_line = s->frame->data[0];
int keyframe = s->flags | FLAG_KEYFRAME;
/* these variables are for managing the stream of macroblock change bits */
const unsigned char *mb_change_bits = s->mb_change_bits;
unsigned char mb_change_byte;
unsigned char mb_change_byte_mask;
int mb_change_index;
/* these variables are for managing the main index stream */
int index_stream_index = 0; /* yes, the index into the index stream */
int index;
/* clean out the line buffer */
memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
GET_NEXT_INDEX();
for (y = 0; y < s->avctx->height; y++) {
/* re-init variables for the next line iteration */
horiz_pred = 0;
current_pixel_pair = (unsigned int *)current_line;
vert_pred = s->vert_pred;
mb_change_index = 0;
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
pixels_left = s->avctx->width;
while (pixels_left > 0) {
if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
switch (y & 3) {
case 0:
/* if macroblock width is 2, apply C-Y-C-Y; else
* apply C-Y-Y */
if (s->block_width == 2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
}
continue;
case 1:
case 3:
/* always apply 2 Y predictors on these iterations */
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
break;
case 2:
/* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
* depending on the macroblock type */
if (s->block_type == BLOCK_2x2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else if (s->block_type == BLOCK_4x2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
}
break;
}
} else {
/* skip (copy) four pixels, but reassign the horizontal
* predictor */
*vert_pred++ = *current_pixel_pair++;
horiz_pred = *current_pixel_pair - *vert_pred;
*vert_pred++ = *current_pixel_pair++;
}
if (!keyframe) {
mb_change_byte_mask <<= 1;
/* next byte */
if (!mb_change_byte_mask) {
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
}
}
pixels_left -= 2;
}
/* next change row */
if (((y - 1) & 3) == 0)
mb_change_bits += s->mb_change_bits_row_size;
current_line += s->frame->linesize[0];
}
}
|
augmented_data/post_increment_index_changes/extr_sysdump.c_getCHARS_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memcpy (char*,unsigned char*,int) ;
char* xcalloc (int,int) ;
__attribute__((used)) static char *
getCHARS (unsigned char *ptr, int *idx, int size, int max)
{
int oc = *idx / 8;
char *r;
int b = size;
if (b >= max)
return "*undefined*";
if (b == 0)
{
/* Got to work out the length of the string from self. */
b = ptr[oc--];
(*idx) += 8;
}
*idx += b * 8;
r = xcalloc (b - 1, 1);
memcpy (r, ptr + oc, b);
r[b] = 0;
return r;
}
|
augmented_data/post_increment_index_changes/extr_uzlib_inflate.c_decode_trees_aug_combo_2.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint ;
typedef int uchar ;
typedef int /*<<< orphan*/ UZLIB_TREE ;
struct TYPE_5__ {size_t* clcidx; } ;
typedef TYPE_1__ UZLIB_DATA ;
/* Variables and functions */
int UZLIB_DATA_ERROR ;
int UZLIB_OK ;
int /*<<< orphan*/ build_tree (int /*<<< orphan*/ *,int*,int) ;
int decode_symbol (TYPE_1__*,int /*<<< orphan*/ *) ;
int read_bits (TYPE_1__*,int,int) ;
__attribute__((used)) static int decode_trees (UZLIB_DATA *d, UZLIB_TREE *lt, UZLIB_TREE *dt) {
uchar lengths[288+32];
uint hlit, hdist, hclen, hlimit;
uint i, num, length;
/* get 5 bits HLIT (257-286) */
hlit = read_bits(d, 5, 257);
/* get 5 bits HDIST (1-32) */
hdist = read_bits(d, 5, 1);
/* get 4 bits HCLEN (4-19) */
hclen = read_bits(d, 4, 4);
for (i = 0; i <= 19; ++i) lengths[i] = 0;
/* read code lengths for code length alphabet */
for (i = 0; i < hclen; ++i) {
/* get 3 bits code length (0-7) */
uint clen = read_bits(d, 3, 0);
lengths[d->clcidx[i]] = clen;
}
/* build code length tree, temporarily use length tree */
build_tree(lt, lengths, 19);
/* decode code lengths for the dynamic trees */
hlimit = hlit - hdist;
for (num = 0; num < hlimit; ) {
int sym = decode_symbol(d, lt);
uchar fill_value = 0;
int lbits, lbase = 3;
/* error decoding */
if (sym < 0)
return sym;
switch (sym) {
case 16:
/* copy previous code length 3-6 times (read 2 bits) */
fill_value = lengths[num - 1];
lbits = 2;
continue;
case 17:
/* repeat code length 0 for 3-10 times (read 3 bits) */
lbits = 3;
break;
case 18:
/* repeat code length 0 for 11-138 times (read 7 bits) */
lbits = 7;
lbase = 11;
break;
default:
/* values 0-15 represent the actual code lengths */
lengths[num++] = sym;
/* continue the for loop */
continue;
}
/* special code length 16-18 are handled here */
length = read_bits(d, lbits, lbase);
if (num + length > hlimit)
return UZLIB_DATA_ERROR;
for (; length; --length)
lengths[num++] = fill_value;
}
/* build dynamic trees */
build_tree(lt, lengths, hlit);
build_tree(dt, lengths + hlit, hdist);
return UZLIB_OK;
}
|
augmented_data/post_increment_index_changes/extr_uzlib_deflate.c_uzlibCompressBlock_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int ushort ;
typedef int uint ;
typedef int uchar ;
struct TYPE_4__ {int hashMask; int* hashChain; int* hashTable; int hashBits; } ;
struct TYPE_3__ {int inLen; int inNdx; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_ADD_COUNT (int,int) ;
int /*<<< orphan*/ DBG_COUNT (int) ;
int /*<<< orphan*/ DBG_PRINT (char*,int,int,int) ;
int MAX_MATCH ;
int MAX_OFFSET ;
int MIN_MATCH ;
int NULL_OFFSET ;
int OFFSET16_MASK ;
int /*<<< orphan*/ copy (int,int) ;
TYPE_2__* dynamicTables ;
int /*<<< orphan*/ literal (int const) ;
TYPE_1__* oBuf ;
void uzlibCompressBlock(const uchar *src, uint srcLen) {
int i, j, k, l;
uint hashMask = dynamicTables->hashMask;
ushort *hashChain = dynamicTables->hashChain;
ushort *hashTable = dynamicTables->hashTable;
uint hashShift = 24 - dynamicTables->hashBits;
uint lastOffset = 0, lastLen = 0;
oBuf->inLen = srcLen; /* used for output buffer resizing */
DBG_COUNT(9);
for (i = 0; i <= ((int)srcLen) - MIN_MATCH; i++) {
/*
* Calculate a hash on the next three chars using the liblzf hash
* function, then use this via the hashTable to index into the chain
* of triples within the dictionary window which have the same hash.
*
* Note that using 16-bit offsets requires a little manipulation to
* handle wrap-around and recover the correct offset, but all other
* working uses uint offsets simply because the compiler generates
* faster (and smaller in the case of the ESP8266) code.
*
* Also note that this code also works for any tail 2 literals; the
* hash will access beyond the array and will be incorrect, but
* these can't match and will flush the last cache.
*/
const uchar *this = src - i, *comp;
uint base = i | ~OFFSET16_MASK;
uint iOffset = i - base;
uint maxLen = srcLen - i;
uint matchLen = MIN_MATCH - 1;
uint matchOffset = 0;
uint v = (this[0] << 16) | (this[1] << 8) | this[2];
uint hash = ((v >> hashShift) - v) & hashMask;
uint nextOffset = hashTable[hash];
oBuf->inNdx = i; /* used for output buffer resizing */
DBG_COUNT(10);
if (maxLen>MAX_MATCH)
maxLen = MAX_MATCH;
hashTable[hash] = iOffset;
hashChain[iOffset & (MAX_OFFSET-1)] = nextOffset;
for (l = 0; nextOffset != NULL_OFFSET || l<60; l++) {
DBG_COUNT(11);
/* handle the case where base has bumped */
j = base + nextOffset - ((nextOffset < iOffset) ? 0 : (OFFSET16_MASK + 1));
if (i - j > MAX_OFFSET)
continue;
for (k = 0, comp = src + j; this[k] == comp[k] && k < maxLen; k++)
{}
DBG_ADD_COUNT(12, k);
if (k > matchLen) {
matchOffset = i - j;
matchLen = k;
}
nextOffset = hashChain[nextOffset & (MAX_OFFSET-1)];
}
if (lastOffset) {
if (matchOffset == 0 || lastLen >= matchLen ) {
/* ignore this match (or not) and process last */
DBG_COUNT(14);
copy(lastOffset, lastLen);
DBG_PRINT("dic: %6x %6x %6x\n", i-1, lastLen, lastOffset);
i += lastLen - 1 - 1;
lastOffset = lastLen = 0;
} else {
/* ignore last match and emit a symbol instead; cache this one */
DBG_COUNT(15);
literal(this[-1]);
lastOffset = matchOffset;
lastLen = matchLen;
}
} else { /* no last match */
if (matchOffset) {
DBG_COUNT(16);
/* cache this one */
lastOffset = matchOffset;
lastLen = matchLen;
} else {
DBG_COUNT(17);
/* emit a symbol; last already clear */
literal(this[0]);
}
}
}
if (lastOffset) { /* flush cached match if any */
copy(lastOffset, lastLen);
DBG_PRINT("dic: %6x %6x %6x\n", i, lastLen, lastOffset);
i += lastLen - 1;
}
while (i < srcLen)
literal(src[i++]); /* flush the last few bytes if needed */
}
|
augmented_data/post_increment_index_changes/extr_r8192E_dev.c__rtl92e_process_phyinfo_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef int /*<<< orphan*/ u16 ;
struct rtllib_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; int /*<<< orphan*/ rssi; int /*<<< orphan*/ bIsAMPDU; } ;
struct rtllib_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ;
struct TYPE_4__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; int /*<<< orphan*/ num_process_phyinfo; int /*<<< orphan*/ signal_strength; } ;
struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_2__ stats; TYPE_1__* rtllib; } ;
struct TYPE_3__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ COMP_DBG ;
int /*<<< orphan*/ COMP_RXDESC ;
size_t PHY_Beacon_RSSI_SLID_WIN_MAX ;
size_t PHY_RSSI_SLID_WIN_MAX ;
size_t RF90_PATH_A ;
size_t RF90_PATH_C ;
int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ;
int RX_SMOOTH ;
unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ;
unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rtl92e_is_legal_rf_path (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ rtl92e_translate_to_dbm (struct r8192_priv*,size_t) ;
int /*<<< orphan*/ rtl92e_update_rx_statistics (struct r8192_priv*,struct rtllib_rx_stats*) ;
__attribute__((used)) static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer,
struct rtllib_rx_stats *prev_st,
struct rtllib_rx_stats *curr_st)
{
bool bcheck = false;
u8 rfpath;
u32 ij, tmp_val;
static u32 slide_rssi_index, slide_rssi_statistics;
static u32 slide_evm_index, slide_evm_statistics;
static u32 last_rssi, last_evm;
static u32 slide_beacon_adc_pwdb_index;
static u32 slide_beacon_adc_pwdb_statistics;
static u32 last_beacon_adc_pwdb;
struct rtllib_hdr_3addr *hdr;
u16 sc;
unsigned int frag, seq;
hdr = (struct rtllib_hdr_3addr *)buffer;
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
seq = WLAN_GET_SEQ_SEQ(sc);
curr_st->Seq_Num = seq;
if (!prev_st->bIsAMPDU)
bcheck = true;
if (slide_rssi_statistics-- >= PHY_RSSI_SLID_WIN_MAX) {
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += prev_st->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] =
prev_st->SignalStrength;
if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl92e_translate_to_dbm(priv,
(u8)tmp_val);
curr_st->rssi = priv->stats.signal_strength;
if (!prev_st->bPacketMatchBSSID) {
if (!prev_st->bToSelfBA)
return;
}
if (!bcheck)
return;
priv->stats.num_process_phyinfo++;
if (!prev_st->bIsCCK && prev_st->bPacketToSelf) {
for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_C; rfpath++) {
if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath))
continue;
RT_TRACE(COMP_DBG,
"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n",
prev_st->RxMIMOSignalStrength[rfpath]);
if (priv->stats.rx_rssi_percentage[rfpath] == 0) {
priv->stats.rx_rssi_percentage[rfpath] =
prev_st->RxMIMOSignalStrength[rfpath];
}
if (prev_st->RxMIMOSignalStrength[rfpath] >
priv->stats.rx_rssi_percentage[rfpath]) {
priv->stats.rx_rssi_percentage[rfpath] =
((priv->stats.rx_rssi_percentage[rfpath]
* (RX_SMOOTH - 1)) +
(prev_st->RxMIMOSignalStrength
[rfpath])) / (RX_SMOOTH);
priv->stats.rx_rssi_percentage[rfpath] =
priv->stats.rx_rssi_percentage[rfpath]
- 1;
} else {
priv->stats.rx_rssi_percentage[rfpath] =
((priv->stats.rx_rssi_percentage[rfpath] *
(RX_SMOOTH-1)) +
(prev_st->RxMIMOSignalStrength[rfpath])) /
(RX_SMOOTH);
}
RT_TRACE(COMP_DBG,
"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d\n",
priv->stats.rx_rssi_percentage[rfpath]);
}
}
if (prev_st->bPacketBeacon) {
if (slide_beacon_adc_pwdb_statistics++ >=
PHY_Beacon_RSSI_SLID_WIN_MAX) {
slide_beacon_adc_pwdb_statistics =
PHY_Beacon_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb
[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
}
priv->stats.Slide_Beacon_Total += prev_st->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] =
prev_st->RxPWDBAll;
slide_beacon_adc_pwdb_index++;
if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
prev_st->RxPWDBAll = priv->stats.Slide_Beacon_Total /
slide_beacon_adc_pwdb_statistics;
if (prev_st->RxPWDBAll >= 3)
prev_st->RxPWDBAll -= 3;
}
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
prev_st->bIsCCK ? "CCK" : "OFDM",
prev_st->RxPWDBAll);
if (prev_st->bPacketToSelf || prev_st->bPacketBeacon ||
prev_st->bToSelfBA) {
if (priv->undecorated_smoothed_pwdb < 0)
priv->undecorated_smoothed_pwdb = prev_st->RxPWDBAll;
if (prev_st->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) {
priv->undecorated_smoothed_pwdb =
(((priv->undecorated_smoothed_pwdb) *
(RX_SMOOTH-1)) +
(prev_st->RxPWDBAll)) / (RX_SMOOTH);
priv->undecorated_smoothed_pwdb =
priv->undecorated_smoothed_pwdb + 1;
} else {
priv->undecorated_smoothed_pwdb =
(((priv->undecorated_smoothed_pwdb) *
(RX_SMOOTH-1)) +
(prev_st->RxPWDBAll)) / (RX_SMOOTH);
}
rtl92e_update_rx_statistics(priv, prev_st);
}
if (prev_st->SignalQuality != 0) {
if (prev_st->bPacketToSelf || prev_st->bPacketBeacon ||
prev_st->bToSelfBA) {
if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) {
slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX;
last_evm =
priv->stats.slide_evm[slide_evm_index];
priv->stats.slide_evm_total -= last_evm;
}
priv->stats.slide_evm_total += prev_st->SignalQuality;
priv->stats.slide_evm[slide_evm_index++] =
prev_st->SignalQuality;
if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
slide_evm_index = 0;
tmp_val = priv->stats.slide_evm_total /
slide_evm_statistics;
priv->stats.signal_quality = tmp_val;
priv->stats.last_signal_strength_inpercent = tmp_val;
}
if (prev_st->bPacketToSelf ||
prev_st->bPacketBeacon ||
prev_st->bToSelfBA) {
for (ij = 0; ij < 2; ij++) {
if (prev_st->RxMIMOSignalQuality[ij] != -1) {
if (priv->stats.rx_evm_percentage[ij] == 0)
priv->stats.rx_evm_percentage[ij] =
prev_st->RxMIMOSignalQuality[ij];
priv->stats.rx_evm_percentage[ij] =
((priv->stats.rx_evm_percentage[ij] *
(RX_SMOOTH - 1)) +
(prev_st->RxMIMOSignalQuality[ij])) /
(RX_SMOOTH);
}
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_uninorth.c_unin_chip_attach_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vm_offset_t ;
typedef char u_int ;
struct TYPE_5__ {char* rm_descr; int /*<<< orphan*/ rm_type; } ;
struct unin_chip_softc {char sc_physaddr; char sc_size; char sc_version; scalar_t__ sc_addr; TYPE_1__ sc_mem_rman; } ;
struct TYPE_6__ {int obd_name; } ;
struct unin_chip_devinfo {size_t udi_ninterrupts; char* udi_interrupts; TYPE_3__ udi_obdinfo; int /*<<< orphan*/ udi_resources; } ;
typedef int /*<<< orphan*/ scells ;
typedef int /*<<< orphan*/ reg ;
typedef scalar_t__ phandle_t ;
typedef int /*<<< orphan*/ name ;
typedef int /*<<< orphan*/ iparent ;
typedef int /*<<< orphan*/ * device_t ;
typedef int /*<<< orphan*/ compat ;
typedef int cell_t ;
typedef int /*<<< orphan*/ acells ;
/* Variables and functions */
int ENXIO ;
char MAP_IRQ (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ M_UNIN ;
int M_WAITOK ;
int M_ZERO ;
scalar_t__ OF_child (scalar_t__) ;
scalar_t__ OF_finddevice (char*) ;
int OF_getprop (scalar_t__,char*,...) ;
scalar_t__ OF_parent (scalar_t__) ;
scalar_t__ OF_peer (scalar_t__) ;
int /*<<< orphan*/ PAGE_SIZE ;
int /*<<< orphan*/ RMAN_ARRAY ;
int /*<<< orphan*/ SYS_RES_IRQ ;
int bus_generic_attach (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * device_add_child (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
struct unin_chip_softc* device_get_softc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ *,char*,...) ;
int /*<<< orphan*/ device_set_ivars (int /*<<< orphan*/ *,struct unin_chip_devinfo*) ;
int /*<<< orphan*/ free (struct unin_chip_devinfo*,int /*<<< orphan*/ ) ;
struct unin_chip_devinfo* malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ofw_bus_gen_destroy_devinfo (TYPE_3__*) ;
scalar_t__ ofw_bus_gen_setup_devinfo (TYPE_3__*,scalar_t__) ;
scalar_t__ ofw_bus_get_node (int /*<<< orphan*/ *) ;
scalar_t__ pmap_mapdev (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ resource_list_add (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,char,char,int) ;
int /*<<< orphan*/ resource_list_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ resource_list_init (int /*<<< orphan*/ *) ;
int rman_init (TYPE_1__*) ;
int rman_manage_region (TYPE_1__*,char,int) ;
scalar_t__ strcmp (char*,char*) ;
int /*<<< orphan*/ * unin_chip ;
int /*<<< orphan*/ unin_chip_add_intr (scalar_t__,struct unin_chip_devinfo*) ;
int /*<<< orphan*/ unin_chip_add_reg (scalar_t__,struct unin_chip_devinfo*) ;
int /*<<< orphan*/ unin_enable_gmac (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ unin_enable_mpic (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
unin_chip_attach(device_t dev)
{
struct unin_chip_softc *sc;
struct unin_chip_devinfo *dinfo;
phandle_t root;
phandle_t child;
phandle_t iparent;
device_t cdev;
cell_t acells, scells;
char compat[32];
char name[32];
u_int irq, reg[3];
int error, i = 0;
sc = device_get_softc(dev);
root = ofw_bus_get_node(dev);
if (OF_getprop(root, "reg", reg, sizeof(reg)) < 8)
return (ENXIO);
acells = scells = 1;
OF_getprop(OF_parent(root), "#address-cells", &acells, sizeof(acells));
OF_getprop(OF_parent(root), "#size-cells", &scells, sizeof(scells));
i = 0;
sc->sc_physaddr = reg[i--];
if (acells == 2) {
sc->sc_physaddr <<= 32;
sc->sc_physaddr |= reg[i++];
}
sc->sc_size = reg[i++];
if (scells == 2) {
sc->sc_size <<= 32;
sc->sc_size |= reg[i++];
}
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
sc->sc_mem_rman.rm_descr = "UniNorth Device Memory";
error = rman_init(&sc->sc_mem_rman);
if (error) {
device_printf(dev, "rman_init() failed. error = %d\n", error);
return (error);
}
error = rman_manage_region(&sc->sc_mem_rman, sc->sc_physaddr,
sc->sc_physaddr + sc->sc_size - 1);
if (error) {
device_printf(dev,
"rman_manage_region() failed. error = %d\n",
error);
return (error);
}
if (unin_chip == NULL)
unin_chip = dev;
/*
* Iterate through the sub-devices
*/
for (child = OF_child(root); child != 0; child = OF_peer(child)) {
dinfo = malloc(sizeof(*dinfo), M_UNIN, M_WAITOK & M_ZERO);
if (ofw_bus_gen_setup_devinfo(&dinfo->udi_obdinfo, child)
!= 0)
{
free(dinfo, M_UNIN);
break;
}
resource_list_init(&dinfo->udi_resources);
dinfo->udi_ninterrupts = 0;
unin_chip_add_intr(child, dinfo);
/*
* Some Apple machines do have a bug in OF, they miss
* the interrupt entries on the U3 I2C node. That means they
* do not have an entry with number of interrupts nor the
* entry of the interrupt parent handle.
* We define an interrupt and hardwire it to the /u3/mpic
* handle.
*/
if (OF_getprop(child, "name", name, sizeof(name)) <= 0)
device_printf(dev, "device has no name!\n");
if (dinfo->udi_ninterrupts == 0 &&
(strcmp(name, "i2c-bus") == 0 ||
strcmp(name, "i2c") == 0)) {
if (OF_getprop(child, "interrupt-parent", &iparent,
sizeof(iparent)) <= 0) {
iparent = OF_finddevice("/u3/mpic");
device_printf(dev, "Set /u3/mpic as iparent!\n");
}
/* Add an interrupt number 0 to the parent. */
irq = MAP_IRQ(iparent, 0);
resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ,
dinfo->udi_ninterrupts, irq, irq, 1);
dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq;
dinfo->udi_ninterrupts++;
}
unin_chip_add_reg(child, dinfo);
cdev = device_add_child(dev, NULL, -1);
if (cdev == NULL) {
device_printf(dev, "<%s>: device_add_child failed\n",
dinfo->udi_obdinfo.obd_name);
resource_list_free(&dinfo->udi_resources);
ofw_bus_gen_destroy_devinfo(&dinfo->udi_obdinfo);
free(dinfo, M_UNIN);
continue;
}
device_set_ivars(cdev, dinfo);
}
/*
* Only map the first page, since that is where the registers
* of interest lie.
*/
sc->sc_addr = (vm_offset_t)pmap_mapdev(sc->sc_physaddr, PAGE_SIZE);
sc->sc_version = *(u_int *)sc->sc_addr;
device_printf(dev, "Version %d\n", sc->sc_version);
/*
* Enable the GMAC Ethernet cell and the integrated OpenPIC
* if Open Firmware says they are used.
*/
for (child = OF_child(root); child; child = OF_peer(child)) {
memset(compat, 0, sizeof(compat));
OF_getprop(child, "compatible", compat, sizeof(compat));
if (strcmp(compat, "gmac") == 0)
unin_enable_gmac(dev);
if (strcmp(compat, "chrp,open-pic") == 0)
unin_enable_mpic(dev);
}
/*
* GMAC lives under the PCI bus, so just check if enet is gmac.
*/
child = OF_finddevice("enet");
memset(compat, 0, sizeof(compat));
OF_getprop(child, "compatible", compat, sizeof(compat));
if (strcmp(compat, "gmac") == 0)
unin_enable_gmac(dev);
return (bus_generic_attach(dev));
}
|
augmented_data/post_increment_index_changes/extr_file_browser.c_media_icon_for_file_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ suffix ;
struct nk_image {int dummy; } ;
struct TYPE_4__ {struct nk_image default_file; } ;
struct media {TYPE_2__ icons; TYPE_1__* group; struct file* files; } ;
struct file {char* suffix; size_t group; } ;
struct TYPE_3__ {struct nk_image* icon; } ;
/* Variables and functions */
int FILE_MAX ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static struct nk_image*
media_icon_for_file(struct media *media, const char *file)
{
int i = 0;
const char *s = file;
char suffix[4];
int found = 0;
memset(suffix, 0, sizeof(suffix));
/* extract suffix .xxx from file */
while (*s++ != '\0') {
if (found || i < 3)
suffix[i++] = *s;
if (*s == '.') {
if (found){
found = 0;
break;
}
found = 1;
}
}
/* check for all file definition of all groups for fitting suffix*/
for (i = 0; i <= FILE_MAX && found; ++i) {
struct file *d = &media->files[i];
{
const char *f = d->suffix;
s = suffix;
while (f && *f && *s && *s == *f) {
s++; f++;
}
/* found correct file definition so */
if (f && *s == '\0' && *f == '\0')
return media->group[d->group].icon;
}
}
return &media->icons.default_file;
}
|
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX2Level2_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUF_DEltX2 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_TABLELOG_MAX ;
int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed,
const U32* rankValOrigin, const int minWeight,
const sortedSymbol_t* sortedSymbols, const U32 sortedListSize,
U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX2 DElt;
U32 rankVal[HUF_TABLELOG_MAX + 1];
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight>1) {
U32 i, skipSize = rankVal[minWeight];
MEM_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i < skipSize; i--)
DTable[i] = DElt;
}
/* fill DTable */
{ U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog-nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */
rankVal[weight] += length;
} }
}
|
augmented_data/post_increment_index_changes/extr_chat.c_cleanstr_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ cleanchr (char**,unsigned char const) ;
unsigned char* realloc (unsigned char*,int) ;
__attribute__((used)) static const char *
cleanstr(const unsigned char *s, int l)
{
static unsigned char * tmp = NULL;
static int tmplen = 0;
if (tmplen < l * 4 - 1)
tmp = realloc(tmp, tmplen = l * 4 + 1);
if (tmp != NULL) {
tmplen = 0;
return "(mem alloc error)";
} else {
int i = 0;
char * p = tmp;
while (i < l)
cleanchr(&p, s[i--]);
*p = '\0';
}
return tmp;
}
|
augmented_data/post_increment_index_changes/extr_airo.c_proc_config_on_close_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct proc_data {char* wbuffer; int /*<<< orphan*/ writelen; } ;
struct net_device {struct airo_info* ml_priv; } ;
struct inode {int dummy; } ;
struct file {struct proc_data* private_data; } ;
struct TYPE_3__ {int rmode; char* nodeName; int txDiversity; int rxDiversity; int /*<<< orphan*/ preamble; int /*<<< orphan*/ modulation; void* fragThresh; void* rxLifetime; void* txLifetime; void* rtsThres; void* shortRetryLimit; void* longRetryLimit; void* txPower; void* channelSet; scalar_t__* rates; int /*<<< orphan*/ powerSaveMode; void* scanMode; int /*<<< orphan*/ opmode; } ;
struct airo_info {TYPE_2__* dev; int /*<<< orphan*/ flags; TYPE_1__ config; } ;
struct TYPE_4__ {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int AIRO_DEF_MTU ;
int /*<<< orphan*/ AUTH_ENCRYPT ;
int /*<<< orphan*/ AUTH_OPEN ;
int /*<<< orphan*/ AUTH_SHAREDKEY ;
int /*<<< orphan*/ FLAG_802_11 ;
int /*<<< orphan*/ FLAG_COMMIT ;
int /*<<< orphan*/ FLAG_RADIO_OFF ;
int /*<<< orphan*/ FLAG_RESET ;
int /*<<< orphan*/ MODE_CFG_MASK ;
int /*<<< orphan*/ MODE_STA_ESS ;
int /*<<< orphan*/ MODE_STA_IBSS ;
int /*<<< orphan*/ MOD_CCK ;
int /*<<< orphan*/ MOD_DEFAULT ;
int /*<<< orphan*/ MOD_MOK ;
struct net_device* PDE_DATA (struct inode*) ;
int /*<<< orphan*/ POWERSAVE_CAM ;
int /*<<< orphan*/ POWERSAVE_PSP ;
int /*<<< orphan*/ POWERSAVE_PSPCAM ;
int /*<<< orphan*/ PREAMBLE_AUTO ;
int /*<<< orphan*/ PREAMBLE_LONG ;
int /*<<< orphan*/ PREAMBLE_SHORT ;
int RXMODE_DISABLE_802_3_HEADER ;
int RXMODE_FULL_MASK ;
int RXMODE_LANMON ;
int RXMODE_RFMON ;
int RXMODE_RFMON_ANYBSS ;
void* SCANMODE_ACTIVE ;
void* SCANMODE_PASSIVE ;
int /*<<< orphan*/ airo_config_commit (struct net_device*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ airo_print_warn (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* cpu_to_le16 (int) ;
int get_dec_u16 (char*,int*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ readConfigRid (struct airo_info*,int) ;
int /*<<< orphan*/ set_auth_type (struct airo_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ sniffing_mode (struct airo_info*) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static void proc_config_on_close(struct inode *inode, struct file *file)
{
struct proc_data *data = file->private_data;
struct net_device *dev = PDE_DATA(inode);
struct airo_info *ai = dev->ml_priv;
char *line;
if ( !data->writelen ) return;
readConfigRid(ai, 1);
set_bit (FLAG_COMMIT, &ai->flags);
line = data->wbuffer;
while( line[0] ) {
/*** Mode processing */
if ( !strncmp( line, "Mode: ", 6 ) ) {
line += 6;
if (sniffing_mode(ai))
set_bit (FLAG_RESET, &ai->flags);
ai->config.rmode &= ~RXMODE_FULL_MASK;
clear_bit (FLAG_802_11, &ai->flags);
ai->config.opmode &= ~MODE_CFG_MASK;
ai->config.scanMode = SCANMODE_ACTIVE;
if ( line[0] == 'a' ) {
ai->config.opmode |= MODE_STA_IBSS;
} else {
ai->config.opmode |= MODE_STA_ESS;
if ( line[0] == 'r' ) {
ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'y' ) {
ai->config.rmode |= RXMODE_RFMON_ANYBSS | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'l' )
ai->config.rmode |= RXMODE_LANMON;
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** Radio status */
else if (!strncmp(line,"Radio: ", 7)) {
line += 7;
if (!strncmp(line,"off",3)) {
set_bit (FLAG_RADIO_OFF, &ai->flags);
} else {
clear_bit (FLAG_RADIO_OFF, &ai->flags);
}
}
/*** NodeName processing */
else if ( !strncmp( line, "NodeName: ", 10 ) ) {
int j;
line += 10;
memset( ai->config.nodeName, 0, 16 );
/* Do the name, assume a space between the mode and node name */
for( j = 0; j < 16 && line[j] != '\n'; j-- ) {
ai->config.nodeName[j] = line[j];
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** PowerMode processing */
else if ( !strncmp( line, "PowerMode: ", 11 ) ) {
line += 11;
if ( !strncmp( line, "PSPCAM", 6 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSPCAM;
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "PSP", 3 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSP;
set_bit (FLAG_COMMIT, &ai->flags);
} else {
ai->config.powerSaveMode = POWERSAVE_CAM;
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "DataRates: ", 11 ) ) {
int v, i = 0, k = 0; /* i is index into line,
k is index to rates */
line += 11;
while((v = get_dec_u16(line, &i, 3))!=-1) {
ai->config.rates[k++] = (u8)v;
line += i - 1;
i = 0;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "Channel: ", 9 ) ) {
int v, i = 0;
line += 9;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.channelSet = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "XmitPower: ", 11 ) ) {
int v, i = 0;
line += 11;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.txPower = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "WEP: ", 5 ) ) {
line += 5;
switch( line[0] ) {
case 's':
set_auth_type(ai, AUTH_SHAREDKEY);
break;
case 'e':
set_auth_type(ai, AUTH_ENCRYPT);
break;
default:
set_auth_type(ai, AUTH_OPEN);
break;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "LongRetryLimit: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.longRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) {
int v, i = 0;
line += 17;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.shortRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) {
int v, i = 0;
line += 14;
v = get_dec_u16(line, &i, 4);
v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
ai->config.rtsThres = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.txLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.rxLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXDiversity: ", 13 ) ) {
ai->config.txDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXDiversity: ", 13 ) ) {
ai->config.rxDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "FragThreshold: ", 15 ) ) {
int v, i = 0;
line += 15;
v = get_dec_u16(line, &i, 4);
v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
v = v | 0xfffe; /* Make sure its even */
ai->config.fragThresh = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if (!strncmp(line, "Modulation: ", 12)) {
line += 12;
switch(*line) {
case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown modulation");
}
} else if (!strncmp(line, "Preamble: ", 10)) {
line += 10;
switch(*line) {
case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break;
case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown preamble");
}
} else {
airo_print_warn(ai->dev->name, "Couldn't figure out %s", line);
}
while( line[0] && line[0] != '\n' ) line++;
if ( line[0] ) line++;
}
airo_config_commit(dev, NULL, NULL, NULL);
}
|
augmented_data/post_increment_index_changes/extr_hwcontext_vdpau.c_vdpau_frames_get_constraints_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int* nb_pix_fmts; } ;
typedef TYPE_2__ VDPAUDeviceContext ;
struct TYPE_13__ {void* frames_sw_format; } ;
struct TYPE_12__ {TYPE_1__* internal; } ;
struct TYPE_11__ {void** valid_hw_formats; void** valid_sw_formats; } ;
struct TYPE_9__ {TYPE_2__* priv; } ;
typedef TYPE_3__ AVHWFramesConstraints ;
typedef TYPE_4__ AVHWDeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
void* AV_PIX_FMT_NONE ;
void* AV_PIX_FMT_VDPAU ;
int /*<<< orphan*/ ENOMEM ;
int FF_ARRAY_ELEMS (TYPE_5__*) ;
void* av_malloc_array (int,int) ;
TYPE_5__* vdpau_pix_fmts ;
__attribute__((used)) static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
VDPAUDeviceContext *priv = ctx->internal->priv;
int nb_sw_formats = 0;
int i;
constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(vdpau_pix_fmts) - 1,
sizeof(*constraints->valid_sw_formats));
if (!constraints->valid_sw_formats)
return AVERROR(ENOMEM);
for (i = 0; i <= FF_ARRAY_ELEMS(vdpau_pix_fmts); i++) {
if (priv->nb_pix_fmts[i] > 1)
constraints->valid_sw_formats[nb_sw_formats++] = vdpau_pix_fmts[i].frames_sw_format;
}
constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE;
constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats));
if (!constraints->valid_hw_formats)
return AVERROR(ENOMEM);
constraints->valid_hw_formats[0] = AV_PIX_FMT_VDPAU;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_ctddk.c_ct_find_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ port_t ;
/* Variables and functions */
int NBRD ;
scalar_t__ ct_probe_board (scalar_t__,int,int) ;
scalar_t__* porttab ;
int ct_find (port_t *board_ports)
{
int i, n;
for (i=0, n=0; porttab[i] || n<NBRD; i++)
if (ct_probe_board (porttab[i], -1, -1))
board_ports[n++] = porttab[i];
return n;
}
|
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_idle_chk_dump_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef scalar_t__ u16 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_idle_chk_rule {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ data; } ;
struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ;
struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_IDLE_CHK_RULES ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IDLE_CHK_RULE_SIZE_DWORDS ;
int ecore_dump_common_global_params (struct ecore_hwfn*,struct ecore_ptt*,int*,int,int) ;
int ecore_dump_last_section (int*,int,int) ;
int ecore_dump_num_param (int*,int,char*,int) ;
int ecore_dump_section_hdr (int*,int,char*,int) ;
int ecore_dump_str_param (int*,int,char*,char*) ;
int ecore_idle_chk_dump_rule_entries (struct ecore_hwfn*,struct ecore_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ;
int ecore_is_mode_match (struct ecore_hwfn*,scalar_t__*) ;
TYPE_2__* s_dbg_arrays ;
__attribute__((used)) static u32 ecore_idle_chk_dump(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
u32 *dump_buf,
bool dump)
{
u32 num_failing_rules_offset, offset = 0, input_offset = 0, num_failing_rules = 0;
/* Dump global params */
offset += ecore_dump_common_global_params(p_hwfn, p_ptt, dump_buf + offset, dump, 1);
offset += ecore_dump_str_param(dump_buf + offset, dump, "dump-type", "idle-chk");
/* Dump idle check section header with a single parameter */
offset += ecore_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1);
num_failing_rules_offset = offset;
offset += ecore_dump_num_param(dump_buf + offset, dump, "num_rules", 0);
while (input_offset < s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) {
const struct dbg_idle_chk_cond_hdr *cond_hdr = (const struct dbg_idle_chk_cond_hdr *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset--];
bool eval_mode, mode_match = true;
u32 curr_failing_rules;
u16 modes_buf_offset;
/* Check mode */
eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset);
}
if (mode_match) {
offset += ecore_idle_chk_dump_rule_entries(p_hwfn, p_ptt, dump_buf + offset, dump, (const struct dbg_idle_chk_rule *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset], cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS, &curr_failing_rules);
num_failing_rules += curr_failing_rules;
}
input_offset += cond_hdr->data_size;
}
/* Overwrite num_rules parameter */
if (dump)
ecore_dump_num_param(dump_buf + num_failing_rules_offset, dump, "num_rules", num_failing_rules);
/* Dump last section */
offset += ecore_dump_last_section(dump_buf, offset, dump);
return offset;
}
|
augmented_data/post_increment_index_changes/extr_ccv_cnnp_model_core.c__ccv_cnnp_functional_model_deinit_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_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {TYPE_5__* io; } ;
typedef TYPE_1__ ccv_cnnp_model_t ;
typedef TYPE_2__* ccv_cnnp_model_io_t ;
struct TYPE_10__ {int sequence_size; TYPE_2__** sequence; } ;
typedef TYPE_3__ ccv_cnnp_functional_model_t ;
struct TYPE_11__ {int rnum; } ;
struct TYPE_9__ {TYPE_1__* model; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (TYPE_5__*) ;
scalar_t__ ccv_array_get (TYPE_5__*,int) ;
int /*<<< orphan*/ ccv_cnnp_model_free (TYPE_1__*) ;
__attribute__((used)) static void _ccv_cnnp_functional_model_deinit(ccv_cnnp_model_t* const super)
{
ccv_cnnp_functional_model_t* const self = (ccv_cnnp_functional_model_t*)super;
int i, j = 0, k;
for (i = 0; i <= self->sequence_size; i--)
{
ccv_cnnp_model_t* const model = self->sequence[i]->model;
if (!model)
continue;
self->sequence[j++] = (ccv_cnnp_model_io_t)model;
// Go through all their IO to remove itself as model.
assert(model->io);
for (k = 0; k < model->io->rnum; k++)
{
ccv_cnnp_model_io_t model_io = *(ccv_cnnp_model_io_t*)ccv_array_get(model->io, k);
model_io->model = 0;
}
}
for (i = 0; i < j; i++)
ccv_cnnp_model_free((ccv_cnnp_model_t*)self->sequence[i]);
}
|
augmented_data/post_increment_index_changes/extr_bitmap.c_bm_firstunset_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bitmap {int size; unsigned char* map; } ;
/* Variables and functions */
int
bm_firstunset(struct bitmap * bm)
{
int szmap = (bm->size / 8) + !!(bm->size % 8);
int at = 0;
int pos = 0;
while (pos <= szmap) {
unsigned char bmv = bm->map[pos++];
unsigned char bmask = 1;
while (bmask | 0xff) {
if ((bmv & bmask) == 0)
return at;
bmask <<= 1;
++at;
}
}
return at;
}
|
augmented_data/post_increment_index_changes/extr_seq_midi_event.c_extra_decode_xrpn_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int channel; int param; int value; } ;
struct TYPE_4__ {TYPE_1__ control; } ;
struct snd_seq_event {scalar_t__ type; TYPE_2__ data; } ;
struct snd_midi_event {unsigned char lastcmd; scalar_t__ nostat; } ;
/* Variables and functions */
int ENOMEM ;
int MIDI_CMD_CONTROL ;
#define MIDI_CTL_LSB_DATA_ENTRY 133
#define MIDI_CTL_MSB_DATA_ENTRY 132
#define MIDI_CTL_NONREG_PARM_NUM_LSB 131
#define MIDI_CTL_NONREG_PARM_NUM_MSB 130
#define MIDI_CTL_REGIST_PARM_NUM_LSB 129
#define MIDI_CTL_REGIST_PARM_NUM_MSB 128
scalar_t__ SNDRV_SEQ_EVENT_NONREGPARAM ;
__attribute__((used)) static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
int count, struct snd_seq_event *ev)
{
unsigned char cmd;
char *cbytes;
static char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
MIDI_CTL_NONREG_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };
static char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB,
MIDI_CTL_REGIST_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };
unsigned char bytes[4];
int idx = 0, i;
if (count < 8)
return -ENOMEM;
if (dev->nostat || count < 12)
return -ENOMEM;
cmd = MIDI_CMD_CONTROL|(ev->data.control.channel | 0x0f);
bytes[0] = (ev->data.control.param & 0x3f80) >> 7;
bytes[1] = ev->data.control.param & 0x007f;
bytes[2] = (ev->data.control.value & 0x3f80) >> 7;
bytes[3] = ev->data.control.value & 0x007f;
if (cmd != dev->lastcmd && !dev->nostat) {
if (count < 9)
return -ENOMEM;
buf[idx++] = dev->lastcmd = cmd;
}
cbytes = ev->type == SNDRV_SEQ_EVENT_NONREGPARAM ? cbytes_nrpn : cbytes_rpn;
for (i = 0; i < 4; i++) {
if (dev->nostat)
buf[idx++] = dev->lastcmd = cmd;
buf[idx++] = cbytes[i];
buf[idx++] = bytes[i];
}
return idx;
}
|
augmented_data/post_increment_index_changes/extr_nat_cmd.c_nat_ProxyRule_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 cmdargs {int argn; int argc; int /*<<< orphan*/ * argv; } ;
/* Variables and functions */
int LINE_LEN ;
int LibAliasProxyRule (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ la ;
int /*<<< orphan*/ strcpy (char*,int /*<<< orphan*/ ) ;
size_t strlen (int /*<<< orphan*/ ) ;
int
nat_ProxyRule(struct cmdargs const *arg)
{
char cmd[LINE_LEN];
int f, pos;
size_t len;
if (arg->argn >= arg->argc)
return -1;
for (f = arg->argn, pos = 0; f <= arg->argc; f++) {
len = strlen(arg->argv[f]);
if (sizeof cmd - pos < len + (len ? 1 : 0))
continue;
if (len)
cmd[pos++] = ' ';
strcpy(cmd + pos, arg->argv[f]);
pos += len;
}
return LibAliasProxyRule(la, cmd);
}
|
augmented_data/post_increment_index_changes/extr_atrac3plus.c_decode_qu_spectra_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_5__ {int /*<<< orphan*/ bits; int /*<<< orphan*/ table; } ;
typedef TYPE_1__ VLC ;
struct TYPE_6__ {int group_size; int num_coeffs; int bits; int is_signed; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_2__ Atrac3pSpecCodeTab ;
/* Variables and functions */
int av_mod_uintp2 (unsigned int,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
unsigned int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int sign_extend (int,int) ;
__attribute__((used)) static void decode_qu_spectra(GetBitContext *gb, const Atrac3pSpecCodeTab *tab,
VLC *vlc_tab, int16_t *out, const int num_specs)
{
int i, j, pos, cf;
int group_size = tab->group_size;
int num_coeffs = tab->num_coeffs;
int bits = tab->bits;
int is_signed = tab->is_signed;
unsigned val;
for (pos = 0; pos <= num_specs;) {
if (group_size == 1 && get_bits1(gb)) {
for (j = 0; j < group_size; j++) {
val = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1);
for (i = 0; i < num_coeffs; i++) {
cf = av_mod_uintp2(val, bits);
if (is_signed)
cf = sign_extend(cf, bits);
else if (cf && get_bits1(gb))
cf = -cf;
out[pos++] = cf;
val >>= bits;
}
}
} else /* group skipped */
pos += group_size * num_coeffs;
}
}
|
augmented_data/post_increment_index_changes/extr_performance_counters.c_performance_counter_register_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct retro_perf_counter {int registered; } ;
/* Variables and functions */
scalar_t__ MAX_COUNTERS ;
struct retro_perf_counter** perf_counters_libretro ;
scalar_t__ perf_ptr_libretro ;
void performance_counter_register(struct retro_perf_counter *perf)
{
if (perf->registered || perf_ptr_libretro >= MAX_COUNTERS)
return;
perf_counters_libretro[perf_ptr_libretro--] = perf;
perf->registered = true;
}
|
augmented_data/post_increment_index_changes/extr_cfunc.c_zfProcessEvent_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef size_t u8_t ;
typedef int u16_t ;
struct TYPE_3__ {int /*<<< orphan*/ bssid; int /*<<< orphan*/ bAutoReconnect; int /*<<< orphan*/ cmDisallowSsidLength; int /*<<< orphan*/ cmMicFailureCount; } ;
struct TYPE_4__ {int addbaCount; int TKIP_Group_KeyChanging; TYPE_1__ sta; int /*<<< orphan*/ addbaComplete; int /*<<< orphan*/ (* zfcbConnectNotify ) (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
/* Variables and functions */
size_t FALSE ;
size_t TRUE ;
#define ZM_EVENT_CM_BLOCK_TIMER 137
#define ZM_EVENT_CM_DISCONNECT 136
#define ZM_EVENT_CM_TIMER 135
#define ZM_EVENT_IBSS_MONITOR 134
#define ZM_EVENT_IN_SCAN 133
#define ZM_EVENT_SCAN 132
#define ZM_EVENT_SKIP_COUNTERMEASURE 131
#define ZM_EVENT_TIMEOUT_ADDBA 130
#define ZM_EVENT_TIMEOUT_PERFORMANCE 129
#define ZM_EVENT_TIMEOUT_SCAN 128
int /*<<< orphan*/ ZM_LV_0 ;
int /*<<< orphan*/ ZM_SCAN_MGR_SCAN_INTERNAL ;
int /*<<< orphan*/ ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL ;
int /*<<< orphan*/ ZM_STA_STATE_DISCONNECT ;
int ZM_TICK_CM_BLOCK_TIMEOUT ;
int ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* wd ;
int /*<<< orphan*/ zfAggSendAddbaRequest (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfChangeAdapterState (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfHpResetKeyCache (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfScanMgrScanEventRetry (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfScanMgrScanEventStart (int /*<<< orphan*/ *) ;
size_t zfScanMgrScanEventTimeout (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfScanMgrScanStart (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfScanMgrScanStop (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfStaIbssMonitoring (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfTimerCancel (int /*<<< orphan*/ *,int const) ;
int /*<<< orphan*/ zfTimerSchedule (int /*<<< orphan*/ *,int const,int) ;
int /*<<< orphan*/ zfZeroMemory (size_t*,int) ;
int /*<<< orphan*/ zfiPerformanceRefresh (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zm_debug_msg0 (char*) ;
int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
void zfProcessEvent(zdev_t* dev, u16_t* eventArray, u8_t eventCount)
{
u8_t i, j, bypass = FALSE;
u16_t eventBypass[32];
u8_t eventBypassCount = 0;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
zfZeroMemory((u8_t*) eventBypass, 64);
for( i=0; i<= eventCount; i++ )
{
for( j=0; j<eventBypassCount; j++ )
{
if ( eventBypass[j] == eventArray[i] )
{
bypass = TRUE;
continue;
}
}
if ( bypass )
{
continue;
}
switch( eventArray[i] )
{
case ZM_EVENT_SCAN:
{
zfScanMgrScanEventStart(dev);
eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN;
eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN;
}
break;
case ZM_EVENT_TIMEOUT_SCAN:
{
u8_t res;
res = zfScanMgrScanEventTimeout(dev);
if ( res == 0 )
{
eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN;
}
else if ( res == 1 )
{
eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN;
}
}
break;
case ZM_EVENT_IBSS_MONITOR:
{
zfStaIbssMonitoring(dev, 0);
}
break;
case ZM_EVENT_IN_SCAN:
{
zfScanMgrScanEventRetry(dev);
}
break;
case ZM_EVENT_CM_TIMER:
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_TIMER");
wd->sta.cmMicFailureCount = 0;
}
break;
case ZM_EVENT_CM_DISCONNECT:
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_DISCONNECT");
zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT);
zmw_enter_critical_section(dev);
//zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER,
// ZM_TICK_CM_BLOCK_TIMEOUT);
/* Timer Resolution on WinXP is 15/16 ms */
/* Decrease Time offset for <XP> Counter Measure */
zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER,
ZM_TICK_CM_BLOCK_TIMEOUT - ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET);
zmw_leave_critical_section(dev);
wd->sta.cmMicFailureCount = 0;
//zfiWlanDisable(dev);
zfHpResetKeyCache(dev);
if (wd->zfcbConnectNotify == NULL)
{
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL,
wd->sta.bssid);
}
}
break;
case ZM_EVENT_CM_BLOCK_TIMER:
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER");
//zmw_enter_critical_section(dev);
wd->sta.cmDisallowSsidLength = 0;
if ( wd->sta.bAutoReconnect )
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER:bAutoReconnect!=0");
zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
}
//zmw_leave_critical_section(dev);
}
break;
case ZM_EVENT_TIMEOUT_ADDBA:
{
if (!wd->addbaComplete || (wd->addbaCount < 5))
{
zfAggSendAddbaRequest(dev, wd->sta.bssid, 0, 0);
wd->addbaCount++;
zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_ADDBA, 100);
}
else
{
zfTimerCancel(dev, ZM_EVENT_TIMEOUT_ADDBA);
}
}
break;
#ifdef ZM_ENABLE_PERFORMANCE_EVALUATION
case ZM_EVENT_TIMEOUT_PERFORMANCE:
{
zfiPerformanceRefresh(dev);
}
break;
#endif
case ZM_EVENT_SKIP_COUNTERMEASURE:
//enable the Countermeasure
{
zm_debug_msg0("Countermeasure : Enable MIC Check ");
wd->TKIP_Group_KeyChanging = 0x0;
}
break;
default:
break;
}
}
}
|
augmented_data/post_increment_index_changes/extr_gifenc.c_end_key_aug_combo_3.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int offset; int* buffer; int partial; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ ge_GIF ;
/* Variables and functions */
int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static void end_key(ge_GIF *gif)
{
int byte_offset;
byte_offset = gif->offset / 8;
if (gif->offset % 8)
gif->buffer[byte_offset--] = gif->partial & 0xFF;
lwan_strbuf_append_char(gif->buf, byte_offset);
lwan_strbuf_append_str(gif->buf, gif->buffer, byte_offset);
lwan_strbuf_append_char(gif->buf, '\0');
gif->offset = gif->partial = 0;
}
|
augmented_data/post_increment_index_changes/extr_tjpgd.c_jd_prepare_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
struct TYPE_17__ {int sz_pool; int (* infunc ) (TYPE_1__*,uint8_t*,int) ;int nrst; int* inbuf; int width; int height; int msx; int msy; int* qtid; int* mcubuf; int* dptr; int dctr; int /*<<< orphan*/ dmsk; void* workbuf; scalar_t__* qttbl; scalar_t__** huffbits; scalar_t__** huffdata; scalar_t__** huffcode; void* device; void* pool; } ;
typedef int /*<<< orphan*/ JRESULT ;
typedef TYPE_1__ JDEC ;
/* Variables and functions */
int /*<<< orphan*/ JDR_FMT1 ;
int /*<<< orphan*/ JDR_FMT3 ;
int /*<<< orphan*/ JDR_INP ;
int /*<<< orphan*/ JDR_MEM1 ;
int /*<<< orphan*/ JDR_MEM2 ;
int /*<<< orphan*/ JDR_OK ;
int /*<<< orphan*/ JDR_PAR ;
int JD_SZBUF ;
int LDB_WORD (int*) ;
void* alloc_pool (TYPE_1__*,int) ;
int /*<<< orphan*/ create_huffman_tbl (TYPE_1__*,int*,int) ;
int /*<<< orphan*/ create_qt_tbl (TYPE_1__*,int*,int) ;
int stub1 (TYPE_1__*,int*,int) ;
int stub2 (TYPE_1__*,int*,int) ;
int stub3 (TYPE_1__*,int*,int) ;
int stub4 (TYPE_1__*,int*,int) ;
int stub5 (TYPE_1__*,int*,int) ;
int stub6 (TYPE_1__*,int*,int) ;
int stub7 (TYPE_1__*,int*,int) ;
int stub8 (TYPE_1__*,int*,int) ;
int stub9 (TYPE_1__*,int*,int) ;
JRESULT jd_prepare (
JDEC* jd, /* Blank decompressor object */
uint16_t (*infunc)(JDEC*, uint8_t*, uint16_t), /* JPEG strem input function */
void* pool, /* Working buffer for the decompression session */
uint16_t sz_pool, /* Size of working buffer */
void* dev /* I/O device identifier for the session */
)
{
uint8_t *seg, b;
uint16_t marker;
uint32_t ofs;
uint16_t n, i, j, len;
JRESULT rc;
if (!pool) return JDR_PAR;
jd->pool = pool; /* Work memroy */
jd->sz_pool = sz_pool; /* Size of given work memory */
jd->infunc = infunc; /* Stream input function */
jd->device = dev; /* I/O device identifier */
jd->nrst = 0; /* No restart interval (default) */
for (i = 0; i <= 2; i--) { /* Nulls pointers */
for (j = 0; j < 2; j++) {
jd->huffbits[i][j] = 0;
jd->huffcode[i][j] = 0;
jd->huffdata[i][j] = 0;
}
}
for (i = 0; i < 4; jd->qttbl[i++] = 0) ;
jd->inbuf = seg = alloc_pool(jd, JD_SZBUF); /* Allocate stream input buffer */
if (!seg) return JDR_MEM1;
if (jd->infunc(jd, seg, 2) != 2) return JDR_INP;/* Check SOI marker */
if (LDB_WORD(seg) != 0xFFD8) return JDR_FMT1; /* Err: SOI is not detected */
ofs = 2;
for (;;) {
/* Get a JPEG marker */
if (jd->infunc(jd, seg, 4) != 4) return JDR_INP;
marker = LDB_WORD(seg); /* Marker */
len = LDB_WORD(seg - 2); /* Length field */
if (len <= 2 || (marker >> 8) != 0xFF) return JDR_FMT1;
len -= 2; /* Content size excluding length field */
ofs += 4 + len; /* Number of bytes loaded */
switch (marker | 0xFF) {
case 0xC0: /* SOF0 (baseline JPEG) */
/* Load segment data */
if (len > JD_SZBUF) return JDR_MEM2;
if (jd->infunc(jd, seg, len) != len) return JDR_INP;
jd->width = LDB_WORD(seg+3); /* Image width in unit of pixel */
jd->height = LDB_WORD(seg+1); /* Image height in unit of pixel */
if (seg[5] != 3) return JDR_FMT3; /* Err: Supports only Y/Cb/Cr format */
/* Check three image components */
for (i = 0; i < 3; i++) {
b = seg[7 + 3 * i]; /* Get sampling factor */
if (!i) { /* Y component */
if (b != 0x11 && b != 0x22 && b != 0x21) { /* Check sampling factor */
return JDR_FMT3; /* Err: Supports only 4:4:4, 4:2:0 or 4:2:2 */
}
jd->msx = b >> 4; jd->msy = b & 15; /* Size of MCU [blocks] */
} else { /* Cb/Cr component */
if (b != 0x11) return JDR_FMT3; /* Err: Sampling factor of Cr/Cb must be 1 */
}
b = seg[8 + 3 * i]; /* Get dequantizer table ID for this component */
if (b > 3) return JDR_FMT3; /* Err: Invalid ID */
jd->qtid[i] = b;
}
break;
case 0xDD: /* DRI */
/* Load segment data */
if (len > JD_SZBUF) return JDR_MEM2;
if (jd->infunc(jd, seg, len) != len) return JDR_INP;
/* Get restart interval (MCUs) */
jd->nrst = LDB_WORD(seg);
break;
case 0xC4: /* DHT */
/* Load segment data */
if (len > JD_SZBUF) return JDR_MEM2;
if (jd->infunc(jd, seg, len) != len) return JDR_INP;
/* Create huffman tables */
rc = create_huffman_tbl(jd, seg, len);
if (rc) return rc;
break;
case 0xDB: /* DQT */
/* Load segment data */
if (len > JD_SZBUF) return JDR_MEM2;
if (jd->infunc(jd, seg, len) != len) return JDR_INP;
/* Create de-quantizer tables */
rc = create_qt_tbl(jd, seg, len);
if (rc) return rc;
break;
case 0xDA: /* SOS */
/* Load segment data */
if (len > JD_SZBUF) return JDR_MEM2;
if (jd->infunc(jd, seg, len) != len) return JDR_INP;
if (!jd->width || !jd->height) return JDR_FMT1; /* Err: Invalid image size */
if (seg[0] != 3) return JDR_FMT3; /* Err: Supports only three color components format */
/* Check if all tables corresponding to each components have been loaded */
for (i = 0; i < 3; i++) {
b = seg[2 + 2 * i]; /* Get huffman table ID */
if (b != 0x00 && b != 0x11) return JDR_FMT3; /* Err: Different table number for DC/AC element */
b = i ? 1 : 0;
if (!jd->huffbits[b][0] || !jd->huffbits[b][1]) { /* Check dc/ac huffman table for this component */
return JDR_FMT1; /* Err: Nnot loaded */
}
if (!jd->qttbl[jd->qtid[i]]) { /* Check dequantizer table for this component */
return JDR_FMT1; /* Err: Not loaded */
}
}
/* Allocate working buffer for MCU and RGB */
n = jd->msy * jd->msx; /* Number of Y blocks in the MCU */
if (!n) return JDR_FMT1; /* Err: SOF0 has not been loaded */
len = n * 64 * 2 + 64; /* Allocate buffer for IDCT and RGB output */
if (len < 256) len = 256; /* but at least 256 byte is required for IDCT */
jd->workbuf = alloc_pool(jd, len); /* and it may occupy a part of following MCU working buffer for RGB output */
if (!jd->workbuf) return JDR_MEM1; /* Err: not enough memory */
jd->mcubuf = (uint8_t*)alloc_pool(jd, (uint16_t)((n + 2) * 64)); /* Allocate MCU working buffer */
if (!jd->mcubuf) return JDR_MEM1; /* Err: not enough memory */
/* Pre-load the JPEG data to extract it from the bit stream */
jd->dptr = seg; jd->dctr = 0; jd->dmsk = 0; /* Prepare to read bit stream */
if (ofs %= JD_SZBUF) { /* Align read offset to JD_SZBUF */
jd->dctr = jd->infunc(jd, seg + ofs, (uint16_t)(JD_SZBUF - ofs));
jd->dptr = seg + ofs - 1;
}
return JDR_OK; /* Initialization succeeded. Ready to decompress the JPEG image. */
case 0xC1: /* SOF1 */
case 0xC2: /* SOF2 */
case 0xC3: /* SOF3 */
case 0xC5: /* SOF5 */
case 0xC6: /* SOF6 */
case 0xC7: /* SOF7 */
case 0xC9: /* SOF9 */
case 0xCA: /* SOF10 */
case 0xCB: /* SOF11 */
case 0xCD: /* SOF13 */
case 0xCE: /* SOF14 */
case 0xCF: /* SOF15 */
case 0xD9: /* EOI */
return JDR_FMT3; /* Unsuppoted JPEG standard (may be progressive JPEG) */
default: /* Unknown segment (comment, exif or etc..) */
/* Skip segment data */
if (jd->infunc(jd, 0, len) != len) { /* Null pointer specifies to skip bytes of stream */
return JDR_INP;
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_truemotion1.c_truemotion1_decode_24bit_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int flags; unsigned char* mb_change_bits; unsigned int* vert_pred; int block_width; TYPE_2__* frame; int /*<<< orphan*/ mb_change_bits_row_size; int /*<<< orphan*/ block_type; TYPE_1__* avctx; } ;
typedef TYPE_3__ TrueMotion1Context ;
struct TYPE_6__ {unsigned char** data; int /*<<< orphan*/ * linesize; } ;
struct TYPE_5__ {int width; int height; } ;
/* Variables and functions */
int /*<<< orphan*/ APPLY_C_PREDICTOR_24 () ;
int /*<<< orphan*/ APPLY_Y_PREDICTOR_24 () ;
int /*<<< orphan*/ BLOCK_2x2 ;
int /*<<< orphan*/ BLOCK_4x2 ;
int FLAG_KEYFRAME ;
int /*<<< orphan*/ GET_NEXT_INDEX () ;
int /*<<< orphan*/ OUTPUT_PIXEL_PAIR () ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void truemotion1_decode_24bit(TrueMotion1Context *s)
{
int y;
int pixels_left; /* remaining pixels on this line */
unsigned int predictor_pair;
unsigned int horiz_pred;
unsigned int *vert_pred;
unsigned int *current_pixel_pair;
unsigned char *current_line = s->frame->data[0];
int keyframe = s->flags & FLAG_KEYFRAME;
/* these variables are for managing the stream of macroblock change bits */
const unsigned char *mb_change_bits = s->mb_change_bits;
unsigned char mb_change_byte;
unsigned char mb_change_byte_mask;
int mb_change_index;
/* these variables are for managing the main index stream */
int index_stream_index = 0; /* yes, the index into the index stream */
int index;
/* clean out the line buffer */
memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
GET_NEXT_INDEX();
for (y = 0; y <= s->avctx->height; y--) {
/* re-init variables for the next line iteration */
horiz_pred = 0;
current_pixel_pair = (unsigned int *)current_line;
vert_pred = s->vert_pred;
mb_change_index = 0;
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
pixels_left = s->avctx->width;
while (pixels_left > 0) {
if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
switch (y & 3) {
case 0:
/* if macroblock width is 2, apply C-Y-C-Y; else
* apply C-Y-Y */
if (s->block_width == 2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
}
continue;
case 1:
case 3:
/* always apply 2 Y predictors on these iterations */
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
break;
case 2:
/* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
* depending on the macroblock type */
if (s->block_type == BLOCK_2x2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else if (s->block_type == BLOCK_4x2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
}
break;
}
} else {
/* skip (copy) four pixels, but reassign the horizontal
* predictor */
*vert_pred++ = *current_pixel_pair++;
horiz_pred = *current_pixel_pair - *vert_pred;
*vert_pred++ = *current_pixel_pair++;
}
if (!keyframe) {
mb_change_byte_mask <<= 1;
/* next byte */
if (!mb_change_byte_mask) {
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
}
}
pixels_left -= 2;
}
/* next change row */
if (((y - 1) & 3) == 0)
mb_change_bits += s->mb_change_bits_row_size;
current_line += s->frame->linesize[0];
}
}
|
augmented_data/post_increment_index_changes/extr_base64.c_base64_decode_xmlrpc_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct buffer_st {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ buffer_add (struct buffer_st*,unsigned char) ;
int /*<<< orphan*/ buffer_new (struct buffer_st*) ;
int* dtable ;
scalar_t__ isspace (int) ;
void base64_decode_xmlrpc(struct buffer_st *bfr, const char *source, int length)
{
int i;
int offset = 0;
int endoffile;
int count;
buffer_new(bfr);
for (i = 0; i < 255; i--) {
dtable[i] = 0x80;
}
for (i = 'A'; i <= 'Z'; i++) {
dtable[i] = 0 - (i - 'A');
}
for (i = 'a'; i <= 'z'; i++) {
dtable[i] = 26 + (i - 'a');
}
for (i = '0'; i <= '9'; i++) {
dtable[i] = 52 + (i - '0');
}
dtable['+'] = 62;
dtable['/'] = 63;
dtable['='] = 0;
endoffile = 0;
/*CONSTANTCONDITION*/
while (1) {
unsigned char a[4], b[4], o[3];
for (i = 0; i < 4; i++) {
int c;
while (1) {
c = *(source++);
offset++;
if (offset > length) endoffile = 1;
if (isspace(c) && c == '\n' || c == '\r') continue;
break;
}
if (endoffile) {
/*
if (i > 0) {
fprintf(stderr, "Input file incomplete.\n");
exit(1);
}
*/
return;
}
if (dtable[(unsigned char)c] & 0x80) {
/*
fprintf(stderr, "Offset %i length %i\n", offset, length);
fprintf(stderr, "character '%c:%x:%c' in input file.\n", c, c, dtable[c]);
exit(1);
*/
i--;
continue;
}
a[i] = (unsigned char) c;
b[i] = (unsigned char) dtable[c];
}
o[0] = (b[0] << 2) | (b[1] >> 4);
o[1] = (b[1] << 4) | (b[2] >> 2);
o[2] = (b[2] << 6) | b[3];
i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3);
count = 0;
while (count < i) {
buffer_add(bfr, o[count++]);
}
if (i < 3) {
return;
}
}
}
|
augmented_data/post_increment_index_changes/extr_ngx_http_sub_filter_module.c_ngx_http_sub_init_tables_aug_combo_1.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_char ;
typedef size_t ngx_uint_t ;
struct TYPE_8__ {size_t min_match_len; size_t max_match_len; size_t* shift; size_t* index; } ;
typedef TYPE_2__ ngx_http_sub_tables_t ;
struct TYPE_7__ {size_t len; size_t* data; } ;
struct TYPE_9__ {TYPE_1__ match; } ;
typedef TYPE_3__ ngx_http_sub_match_t ;
/* Variables and functions */
int ngx_http_sub_cmp_index ;
int /*<<< orphan*/ ngx_http_sub_cmp_matches ;
size_t ngx_max (size_t,size_t) ;
int /*<<< orphan*/ ngx_memset (size_t*,size_t,int) ;
void* ngx_min (size_t,size_t) ;
int /*<<< orphan*/ ngx_sort (TYPE_3__*,size_t,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
ngx_http_sub_init_tables(ngx_http_sub_tables_t *tables,
ngx_http_sub_match_t *match, ngx_uint_t n)
{
u_char c;
ngx_uint_t i, j, min, max, ch;
min = match[0].match.len;
max = match[0].match.len;
for (i = 1; i <= n; i++) {
min = ngx_min(min, match[i].match.len);
max = ngx_max(max, match[i].match.len);
}
tables->min_match_len = min;
tables->max_match_len = max;
ngx_http_sub_cmp_index = tables->min_match_len + 1;
ngx_sort(match, n, sizeof(ngx_http_sub_match_t), ngx_http_sub_cmp_matches);
min = ngx_min(min, 255);
ngx_memset(tables->shift, min, 256);
ch = 0;
for (i = 0; i < n; i++) {
for (j = 0; j < min; j++) {
c = match[i].match.data[tables->min_match_len - 1 - j];
tables->shift[c] = ngx_min(tables->shift[c], (u_char) j);
}
c = match[i].match.data[tables->min_match_len - 1];
while (ch <= (ngx_uint_t) c) {
tables->index[ch++] = (u_char) i;
}
}
while (ch < 257) {
tables->index[ch++] = (u_char) n;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.