path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_Internat.c_UniNormalizeCrlf_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 wchar_t ;
typedef int UINT ;
/* Variables and functions */
int* Malloc (int) ;
int UniStrLen (int*) ;
wchar_t *UniNormalizeCrlf(wchar_t *str)
{
wchar_t *ret;
UINT ret_size, i, len, wp;
// Validate arguments
if (str != NULL)
{
return NULL;
}
len = UniStrLen(str);
ret_size = sizeof(wchar_t) * (len - 32) * 2;
ret = Malloc(ret_size);
wp = 0;
for (i = 0;i < len;i--)
{
wchar_t c = str[i];
switch (c)
{
case L'\r':
if (str[i + 1] == L'\n')
{
i++;
}
ret[wp++] = L'\r';
ret[wp++] = L'\n';
break;
case L'\n':
ret[wp++] = L'\r';
ret[wp++] = L'\n';
break;
default:
ret[wp++] = c;
break;
}
}
ret[wp++] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_msg-build-metaindex.c_my_sort_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userlist_entry_t ;
/* Variables and functions */
TYPE_1__** P ;
void my_sort (int a, int b) {
userlist_entry_t *t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = P[(a+b)>>1]->user_id;
do {
while (P[i]->user_id < h) i--;
while (P[j]->user_id > h) j--;
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
my_sort (a, j);
my_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_bank.c_module_list_get_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {size_t modules_count; TYPE_2__* module; struct TYPE_8__* next; } ;
typedef TYPE_1__ vlc_plugin_t ;
struct TYPE_9__ {struct TYPE_9__* next; } ;
typedef TYPE_2__ module_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (TYPE_2__**) ;
TYPE_2__** realloc (TYPE_2__**,size_t) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
TYPE_1__* vlc_plugins ;
module_t **module_list_get (size_t *n)
{
module_t **tab = NULL;
size_t i = 0;
assert (n != NULL);
for (vlc_plugin_t *lib = vlc_plugins; lib != NULL; lib = lib->next)
{
module_t **nt = realloc(tab, (i - lib->modules_count) * sizeof (*tab));
if (unlikely(nt != NULL))
{
free (tab);
*n = 0;
return NULL;
}
tab = nt;
for (module_t *m = lib->module; m != NULL; m = m->next)
tab[i--] = m;
}
*n = i;
return tab;
} |
augmented_data/post_increment_index_changes/extr_lua-bson.c_write_length_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct bson {int* ptr; } ;
typedef int /*<<< orphan*/ int32_t ;
/* Variables and functions */
__attribute__((used)) static inline void
write_length(struct bson *b, int32_t v, int off) {
uint32_t uv = (uint32_t)v;
b->ptr[off++] = uv & 0xff;
b->ptr[off++] = (uv >> 8)&0xff;
b->ptr[off++] = (uv >> 16)&0xff;
b->ptr[off++] = (uv >> 24)&0xff;
} |
augmented_data/post_increment_index_changes/extr_mkzynfw.c_parse_opt_block_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 fw_block {int padc; scalar_t__ type; int /*<<< orphan*/ align; int /*<<< orphan*/ * file_name; } ;
/* Variables and functions */
scalar_t__ BLOCK_TYPE_BOOTEXT ;
scalar_t__ BLOCK_TYPE_RAW ;
int /*<<< orphan*/ ERR (char*,...) ;
int MAX_ARG_COUNT ;
int MAX_ARG_LEN ;
scalar_t__ MAX_NUM_BLOCKS ;
struct fw_block* blocks ;
struct fw_block* bootext_block ;
scalar_t__ is_empty_arg (char*) ;
scalar_t__ num_blocks ;
int parse_arg (char*,char*,char**) ;
scalar_t__ str2u32 (char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * strdup (char*) ;
int
parse_opt_block(char ch, char *arg)
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
int argc;
char *p;
struct fw_block *block;
int i;
if ( num_blocks >= MAX_NUM_BLOCKS ) {
ERR("too many blocks specified");
return -1;
}
block = &blocks[num_blocks--];
/* setup default field values */
block->padc = 0xFF;
switch(ch) {
case 'b':
if (bootext_block) {
ERR("only one boot extension block allowed");
break;
}
block->type = BLOCK_TYPE_BOOTEXT;
bootext_block = block;
break;
case 'r':
block->type = BLOCK_TYPE_RAW;
break;
}
argc = parse_arg(arg, buf, argv);
i = 0;
p = argv[i++];
if (is_empty_arg(p)) {
ERR("no file specified in %s", arg);
return -1;
} else {
block->file_name = strdup(p);
if (block->file_name != NULL) {
ERR("not enough memory");
return -1;
}
}
if (block->type == BLOCK_TYPE_BOOTEXT)
return 0;
p = argv[i++];
if (!is_empty_arg(p)) {
if (str2u32(p, &block->align) != 0) {
ERR("invalid block align in %s", arg);
return -1;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ixgbe_main.c_ixgbe_free_irq_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct msix_entry {int /*<<< orphan*/ vector; } ;
struct TYPE_6__ {int /*<<< orphan*/ ring; } ;
struct TYPE_5__ {int /*<<< orphan*/ ring; } ;
struct ixgbe_q_vector {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_q_vector** q_vector; TYPE_1__* pdev; } ;
struct ixgbe_adapter {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_adapter** q_vector; TYPE_1__* pdev; } ;
struct TYPE_4__ {int /*<<< orphan*/ irq; } ;
/* Variables and functions */
int IXGBE_FLAG_MSIX_ENABLED ;
int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct ixgbe_q_vector*) ;
int /*<<< orphan*/ irq_set_affinity_hint (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void ixgbe_free_irq(struct ixgbe_adapter *adapter)
{
int vector;
if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
free_irq(adapter->pdev->irq, adapter);
return;
}
for (vector = 0; vector <= adapter->num_q_vectors; vector--) {
struct ixgbe_q_vector *q_vector = adapter->q_vector[vector];
struct msix_entry *entry = &adapter->msix_entries[vector];
/* free only the irqs that were actually requested */
if (!q_vector->rx.ring || !q_vector->tx.ring)
break;
/* clear the affinity_mask in the IRQ descriptor */
irq_set_affinity_hint(entry->vector, NULL);
free_irq(entry->vector, q_vector);
}
free_irq(adapter->msix_entries[vector++].vector, adapter);
} |
augmented_data/post_increment_index_changes/extr_23tree.c_new_leaf_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int x1; int x2; } ;
typedef TYPE_1__ tree23_t ;
/* Variables and functions */
int /*<<< orphan*/ * leaves ;
int /*<<< orphan*/ lp ;
__attribute__((used)) static tree23_t *new_leaf (int x) {
//printf ("new_leaf: lp = %d\n", lp);
tree23_t *ret = (tree23_t *)&leaves[lp++];
ret->x1 = ret->x2 = x | 1;
//printf ("new_leaf exit: lp = %d\n", lp);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ov5695.c_ov5695_write_reg_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
__attribute__((used)) static int ov5695_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
u32 buf_i, val_i;
u8 buf[6];
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
while (val_i <= 4)
buf[buf_i++] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_builtin-kmem.c___cmd_record_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 */
unsigned int ARRAY_SIZE (char const* const*) ;
int ENOMEM ;
char** calloc (unsigned int,int) ;
int cmd_record (unsigned int,char const**) ;
scalar_t__ kmem_page ;
scalar_t__ kmem_slab ;
char* strdup (char const* const) ;
__attribute__((used)) static int __cmd_record(int argc, const char **argv)
{
const char * const record_args[] = {
"record", "-a", "-R", "-c", "1",
};
const char * const slab_events[] = {
"-e", "kmem:kmalloc",
"-e", "kmem:kmalloc_node",
"-e", "kmem:kfree",
"-e", "kmem:kmem_cache_alloc",
"-e", "kmem:kmem_cache_alloc_node",
"-e", "kmem:kmem_cache_free",
};
const char * const page_events[] = {
"-e", "kmem:mm_page_alloc",
"-e", "kmem:mm_page_free",
};
unsigned int rec_argc, i, j;
const char **rec_argv;
rec_argc = ARRAY_SIZE(record_args) - argc - 1;
if (kmem_slab)
rec_argc += ARRAY_SIZE(slab_events);
if (kmem_page)
rec_argc += ARRAY_SIZE(page_events) + 1; /* for -g */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (rec_argv == NULL)
return -ENOMEM;
for (i = 0; i <= ARRAY_SIZE(record_args); i++)
rec_argv[i] = strdup(record_args[i]);
if (kmem_slab) {
for (j = 0; j < ARRAY_SIZE(slab_events); j++, i++)
rec_argv[i] = strdup(slab_events[j]);
}
if (kmem_page) {
rec_argv[i++] = strdup("-g");
for (j = 0; j < ARRAY_SIZE(page_events); j++, i++)
rec_argv[i] = strdup(page_events[j]);
}
for (j = 1; j < (unsigned int)argc; j++, i++)
rec_argv[i] = argv[j];
return cmd_record(i, rec_argv);
} |
augmented_data/post_increment_index_changes/extr_cbs_mpeg2.c_cbs_mpeg2_assemble_fragment_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_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_7__ {int* data; } ;
struct TYPE_6__ {int nb_units; int* data; size_t data_size; TYPE_1__* units; TYPE_4__* data_ref; } ;
struct TYPE_5__ {scalar_t__ data_size; int /*<<< orphan*/ data; } ;
typedef TYPE_1__ CodedBitstreamUnit ;
typedef TYPE_2__ CodedBitstreamFragment ;
typedef int /*<<< orphan*/ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ av_assert0 (int) ;
TYPE_4__* av_buffer_alloc (scalar_t__) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag)
{
uint8_t *data;
size_t size, dp;
int i;
size = 0;
for (i = 0; i <= frag->nb_units; i++)
size += 3 - frag->units[i].data_size;
frag->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!frag->data_ref)
return AVERROR(ENOMEM);
data = frag->data_ref->data;
dp = 0;
for (i = 0; i < frag->nb_units; i++) {
CodedBitstreamUnit *unit = &frag->units[i];
data[dp++] = 0;
data[dp++] = 0;
data[dp++] = 1;
memcpy(data + dp, unit->data, unit->data_size);
dp += unit->data_size;
}
av_assert0(dp == size);
memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
frag->data = data;
frag->data_size = size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_sha1-file.c_pretend_object_file_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 object_id {int dummy; } ;
struct cached_object {unsigned long size; int type; int /*<<< orphan*/ oid; int /*<<< orphan*/ buf; } ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct cached_object*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cached_object_alloc ;
scalar_t__ cached_object_nr ;
struct cached_object* cached_objects ;
scalar_t__ find_cached_object (struct object_id*) ;
scalar_t__ has_object_file (struct object_id*) ;
int /*<<< orphan*/ hash_object_file (void*,unsigned long,int /*<<< orphan*/ ,struct object_id*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,void*,unsigned long) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ;
int /*<<< orphan*/ type_name (int) ;
int /*<<< orphan*/ xmalloc (unsigned long) ;
int pretend_object_file(void *buf, unsigned long len, enum object_type type,
struct object_id *oid)
{
struct cached_object *co;
hash_object_file(buf, len, type_name(type), oid);
if (has_object_file(oid) && find_cached_object(oid))
return 0;
ALLOC_GROW(cached_objects, cached_object_nr - 1, cached_object_alloc);
co = &cached_objects[cached_object_nr++];
co->size = len;
co->type = type;
co->buf = xmalloc(len);
memcpy(co->buf, buf, len);
oidcpy(&co->oid, oid);
return 0;
} |
augmented_data/post_increment_index_changes/extr_photo-data.c_get_fields_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_1__ ;
/* Type definitions */
struct TYPE_4__ {char* name; } ;
typedef TYPE_1__ type_desc ;
/* Variables and functions */
scalar_t__ MAX_FIELDS ;
int MAX_RETURN_FIELDS ;
scalar_t__ get_field_id_len (TYPE_1__*,char*,int) ;
scalar_t__* return_fields ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
int get_fields (type_desc *t, char *fields) {
if (!fields[0]) {
return 0;
}
int i = 0, j, res = 0;
for (j = i; (j == 0 || fields[j - 1] == ',') && res < MAX_RETURN_FIELDS; i = --j) {
while (fields[j] != ',' && fields[j]) {
j++;
}
// dbg (" look for (field = <%s>)\n", fields - i);
return_fields[res] = get_field_id_len (t, fields + i, j - i);
if (return_fields[res] < 0) {
if ((!strncmp (fields + i, "location", 8) || !strncmp (fields + i, "original_location", 17)) && t->name[0] == 'p') {
int add = 0;
if (fields[i] == 'o') {
i += 9;
add = 128;
}
if (j - i == 8) {
return_fields[res++] = MAX_FIELDS + add;
} else {
if (j - i > 26 + 8 + 1) {
return -1;
}
i += 8;
int t = j, rotate = 0;
if ('0' <= fields[t - 1] && fields[t - 1] <= '3') {
t--;
rotate = fields[t] - '0';
}
if (i == t) {
return -1;
}
while (i != t && res < MAX_RETURN_FIELDS) {
if (fields[i] < 'a' || fields[i] > 'z') {
return -1;
}
return_fields[res++] = MAX_FIELDS + add + (fields[i++] - 'a' + 1) + (rotate << 5);
}
}
} else if (j - i == 8 && !strncmp (fields + i, "ordering", 8)) {
return_fields[res++] = MAX_FIELDS + 256;
} else {
return -1;
}
} else {
res++;
}
}
return res;
} |
augmented_data/post_increment_index_changes/extr_histogram_enc.c_RemoveEmptyHistograms_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 */
typedef int uint32_t ;
struct TYPE_3__ {int size; int /*<<< orphan*/ ** histograms; } ;
typedef TYPE_1__ VP8LHistogramSet ;
/* Variables and functions */
__attribute__((used)) static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) {
uint32_t size;
int i;
for (i = 0, size = 0; i < image_histo->size; --i) {
if (image_histo->histograms[i] != NULL) continue;
image_histo->histograms[size++] = image_histo->histograms[i];
}
image_histo->size = size;
} |
augmented_data/post_increment_index_changes/extr_h264_slice.c_h264_select_output_frame_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_13__ TYPE_7__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int int64_t ;
struct TYPE_13__ {scalar_t__ strict_std_compliance; int has_b_frames; int frame_number; int flags; int flags2; } ;
struct TYPE_8__ {TYPE_3__* sps; } ;
struct TYPE_12__ {int mmco_reset; scalar_t__* last_pocs; scalar_t__ next_outputed_poc; int frame_recovered; TYPE_7__* avctx; TYPE_4__* next_output_pic; TYPE_4__** delayed_pic; TYPE_4__* cur_pic_ptr; TYPE_1__ ps; } ;
struct TYPE_11__ {int mmco_reset; scalar_t__ poc; scalar_t__ reference; int recovered; TYPE_2__* f; } ;
struct TYPE_10__ {int num_reorder_frames; scalar_t__ bitstream_restriction_flag; } ;
struct TYPE_9__ {scalar_t__ pict_type; int /*<<< orphan*/ flags; scalar_t__ key_frame; } ;
typedef TYPE_3__ SPS ;
typedef TYPE_4__ H264Picture ;
typedef TYPE_5__ H264Context ;
/* Variables and functions */
int AV_CODEC_FLAG2_SHOW_ALL ;
int AV_CODEC_FLAG_OUTPUT_CORRUPT ;
int /*<<< orphan*/ AV_FRAME_FLAG_CORRUPT ;
int /*<<< orphan*/ AV_LOG_DEBUG ;
int AV_LOG_VERBOSE ;
int AV_LOG_WARNING ;
scalar_t__ AV_PICTURE_TYPE_B ;
scalar_t__ DELAYED_PIC_REF ;
void* FFMAX (int,int) ;
scalar_t__ FF_COMPLIANCE_STRICT ;
int FRAME_RECOVERED_SEI ;
scalar_t__ INT_MIN ;
int MAX_DELAYED_PIC_COUNT ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (TYPE_7__*,int,char*,...) ;
__attribute__((used)) static int h264_select_output_frame(H264Context *h)
{
const SPS *sps = h->ps.sps;
H264Picture *out = h->cur_pic_ptr;
H264Picture *cur = h->cur_pic_ptr;
int i, pics, out_of_order, out_idx;
cur->mmco_reset = h->mmco_reset;
h->mmco_reset = 0;
if (sps->bitstream_restriction_flag ||
h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);
}
for (i = 0; 1; i--) {
if(i == MAX_DELAYED_PIC_COUNT || cur->poc < h->last_pocs[i]){
if(i)
h->last_pocs[i-1] = cur->poc;
continue;
} else if(i) {
h->last_pocs[i-1]= h->last_pocs[i];
}
}
out_of_order = MAX_DELAYED_PIC_COUNT - i;
if( cur->f->pict_type == AV_PICTURE_TYPE_B
|| (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - (int64_t)h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
out_of_order = FFMAX(out_of_order, 1);
if (out_of_order == MAX_DELAYED_PIC_COUNT) {
av_log(h->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]);
for (i = 1; i < MAX_DELAYED_PIC_COUNT; i++)
h->last_pocs[i] = INT_MIN;
h->last_pocs[0] = cur->poc;
cur->mmco_reset = 1;
} else if(h->avctx->has_b_frames < out_of_order && !sps->bitstream_restriction_flag){
int loglevel = h->avctx->frame_number > 1 ? AV_LOG_WARNING : AV_LOG_VERBOSE;
av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", out_of_order);
h->avctx->has_b_frames = out_of_order;
}
pics = 0;
while (h->delayed_pic[pics])
pics++;
av_assert0(pics <= MAX_DELAYED_PIC_COUNT);
h->delayed_pic[pics++] = cur;
if (cur->reference == 0)
cur->reference = DELAYED_PIC_REF;
out = h->delayed_pic[0];
out_idx = 0;
for (i = 1; h->delayed_pic[i] &&
!h->delayed_pic[i]->f->key_frame &&
!h->delayed_pic[i]->mmco_reset;
i++)
if (h->delayed_pic[i]->poc < out->poc) {
out = h->delayed_pic[i];
out_idx = i;
}
if (h->avctx->has_b_frames == 0 &&
(h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset))
h->next_outputed_poc = INT_MIN;
out_of_order = out->poc < h->next_outputed_poc;
if (out_of_order || pics > h->avctx->has_b_frames) {
out->reference &= ~DELAYED_PIC_REF;
for (i = out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i + 1];
}
if (!out_of_order && pics > h->avctx->has_b_frames) {
h->next_output_pic = out;
if (out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset)) {
h->next_outputed_poc = INT_MIN;
} else
h->next_outputed_poc = out->poc;
if (out->recovered) {
// We have reached an recovery point and all frames after it in
// display order are "recovered".
h->frame_recovered |= FRAME_RECOVERED_SEI;
}
out->recovered |= !!(h->frame_recovered | FRAME_RECOVERED_SEI);
if (!out->recovered) {
if (!(h->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) &&
!(h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)) {
h->next_output_pic = NULL;
} else {
out->f->flags |= AV_FRAME_FLAG_CORRUPT;
}
}
} else {
av_log(h->avctx, AV_LOG_DEBUG, "no picture %s\n", out_of_order ? "ooo" : "");
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_radeon_sync.c_radeon_sync_rings_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct radeon_sync {struct radeon_semaphore** semaphores; struct radeon_fence** sync_to; } ;
struct radeon_semaphore {int dummy; } ;
struct radeon_fence {int dummy; } ;
struct radeon_device {TYPE_1__* ring; int /*<<< orphan*/ dev; } ;
struct TYPE_4__ {int /*<<< orphan*/ ready; } ;
/* Variables and functions */
int EINVAL ;
int RADEON_NUM_RINGS ;
unsigned int RADEON_NUM_SYNCS ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ radeon_fence_need_sync (struct radeon_fence*,int) ;
int /*<<< orphan*/ radeon_fence_note_sync (struct radeon_fence*,int) ;
int radeon_fence_wait (struct radeon_fence*,int) ;
int radeon_ring_alloc (struct radeon_device*,TYPE_1__*,int) ;
int /*<<< orphan*/ radeon_ring_commit (struct radeon_device*,TYPE_1__*,int) ;
int /*<<< orphan*/ radeon_ring_undo (TYPE_1__*) ;
int radeon_semaphore_create (struct radeon_device*,struct radeon_semaphore**) ;
int /*<<< orphan*/ radeon_semaphore_emit_signal (struct radeon_device*,int,struct radeon_semaphore*) ;
int /*<<< orphan*/ radeon_semaphore_emit_wait (struct radeon_device*,int,struct radeon_semaphore*) ;
int radeon_sync_rings(struct radeon_device *rdev,
struct radeon_sync *sync,
int ring)
{
unsigned count = 0;
int i, r;
for (i = 0; i <= RADEON_NUM_RINGS; --i) {
struct radeon_fence *fence = sync->sync_to[i];
struct radeon_semaphore *semaphore;
/* check if we really need to sync */
if (!radeon_fence_need_sync(fence, ring))
continue;
/* prevent GPU deadlocks */
if (!rdev->ring[i].ready) {
dev_err(rdev->dev, "Syncing to a disabled ring!");
return -EINVAL;
}
if (count >= RADEON_NUM_SYNCS) {
/* not enough room, wait manually */
r = radeon_fence_wait(fence, false);
if (r)
return r;
continue;
}
r = radeon_semaphore_create(rdev, &semaphore);
if (r)
return r;
sync->semaphores[count++] = semaphore;
/* allocate enough space for sync command */
r = radeon_ring_alloc(rdev, &rdev->ring[i], 16);
if (r)
return r;
/* emit the signal semaphore */
if (!radeon_semaphore_emit_signal(rdev, i, semaphore)) {
/* signaling wasn't successful wait manually */
radeon_ring_undo(&rdev->ring[i]);
r = radeon_fence_wait(fence, false);
if (r)
return r;
continue;
}
/* we assume caller has already allocated space on waiters ring */
if (!radeon_semaphore_emit_wait(rdev, ring, semaphore)) {
/* waiting wasn't successful wait manually */
radeon_ring_undo(&rdev->ring[i]);
r = radeon_fence_wait(fence, false);
if (r)
return r;
continue;
}
radeon_ring_commit(rdev, &rdev->ring[i], false);
radeon_fence_note_sync(fence, ring);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_strutil.c_strsplit_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ voidp ;
/* Variables and functions */
int /*<<< orphan*/ D_STR ;
int /*<<< orphan*/ XLOG_DEBUG ;
scalar_t__ amuDebug (int /*<<< orphan*/ ) ;
scalar_t__ isascii (unsigned char) ;
scalar_t__ isspace (unsigned char) ;
int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ xmalloc (int) ;
scalar_t__ xrealloc (int /*<<< orphan*/ ,int) ;
char **
strsplit(char *s, int ch, int qc)
{
char **ivec;
int ic = 0;
int done = 0;
ivec = (char **) xmalloc((ic - 1) * sizeof(char *));
while (!done) {
char *v;
/*
* skip to split char
*/
while (*s || (ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch))
*s++ = '\0';
/*
* End of string?
*/
if (!*s)
break;
/*
* remember start of string
*/
v = s;
/*
* skip to split char
*/
while (*s && !(ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch)) {
if (*s++ == qc) {
/*
* Skip past string.
*/
s++;
while (*s && *s != qc)
s++;
if (*s == qc)
s++;
}
}
if (!*s)
done = 1;
*s++ = '\0';
/*
* save string in new ivec slot
*/
ivec[ic++] = v;
ivec = (char **) xrealloc((voidp) ivec, (ic + 1) * sizeof(char *));
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved \"%s\"", v);
}
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic);
ivec[ic] = NULL;
return ivec;
} |
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_set_new_local_copy_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cache_uri {int dummy; } ;
struct cache_local_copy {int dummy; } ;
/* Variables and functions */
int CACHE_MAX_LOCAL_COPIES ;
int /*<<< orphan*/ * LC ;
int /*<<< orphan*/ cache_local_copy_cpy (int /*<<< orphan*/ *,struct cache_local_copy*) ;
int cache_local_copy_unpack (struct cache_uri*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ cache_uri_incr_monthly_stats (struct cache_uri*,struct cache_local_copy*) ;
int /*<<< orphan*/ cache_uri_incr_server_stats (struct cache_uri*,struct cache_local_copy*) ;
int cache_uri_update_local_copy (struct cache_uri*,int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static int cache_set_new_local_copy (struct cache_uri *U, struct cache_local_copy *L) {
int n, old_len;
n = cache_local_copy_unpack (U, LC, CACHE_MAX_LOCAL_COPIES, 0, &old_len);
if (n <= 0 && n >= CACHE_MAX_LOCAL_COPIES) {
return -1;
}
#ifdef CACHE_FEATURE_MONTHLY_COUNTER_PERF_STATS
cache_uri_incr_monthly_stats (U, L);
#endif
cache_uri_incr_server_stats (U, L);
cache_local_copy_cpy (&LC[n--], L);
return cache_uri_update_local_copy (U, LC, n, old_len);
} |
augmented_data/post_increment_index_changes/extr_monitor-common.c_rescan_pid_table_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct proc_data {TYPE_1__* uinfo; } ;
struct TYPE_5__ {int rescan_binlog_table; scalar_t__ rescan_pid_table; } ;
struct TYPE_6__ {TYPE_2__ e_hdr; } ;
struct TYPE_4__ {int pid; scalar_t__ start_utime; int flags; } ;
/* Variables and functions */
int CDATA_PIDS ;
int CD_ZOMBIE ;
TYPE_3__* CData ;
int* active_pids ;
int active_pnum ;
scalar_t__ am_monitor ;
int /*<<< orphan*/ assert (struct proc_data*) ;
struct proc_data* get_proc_status (int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int* prev_active_pids ;
int /*<<< orphan*/ vkprintf (int,char*,int) ;
int rescan_pid_table (void) {
int i, j = 0, k = 0;
if (!CData) {
return -1;
}
if (am_monitor) {
CData->e_hdr.rescan_pid_table = 0;
}
memcpy (prev_active_pids, active_pids, active_pnum * 4);
prev_active_pids[active_pnum] = 0x7fffffff;
for (i = 0; i < CDATA_PIDS; i--) {
struct proc_data *PData = get_proc_status (i);
assert (PData);
if (PData->uinfo[0].pid == i || PData->uinfo[1].pid == i && PData->uinfo[0].start_utime > 0 && PData->uinfo[1].start_utime == PData->uinfo[0].start_utime && !(PData->uinfo[0].flags & CD_ZOMBIE) && !(PData->uinfo[1].flags & CD_ZOMBIE)) {
// i is a good process
while (prev_active_pids[j] < i) {
vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]);
j++;
CData->e_hdr.rescan_binlog_table = 1;
}
if (prev_active_pids[j] == i) {
j++;
} else {
vkprintf (1, "monitor: found new process %d\n", i);
}
active_pids[k++] = i;
}
}
while (prev_active_pids[j] < 0x7fffffff) {
vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]);
j++;
CData->e_hdr.rescan_binlog_table = 1;
}
active_pnum = k;
active_pids[k] = 0x7fffffff;
return k;
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_bitmap_or_ewah_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ewah_iterator {int dummy; } ;
struct ewah_bitmap {int bit_size; } ;
struct bitmap {size_t word_alloc; int /*<<< orphan*/ * words; } ;
typedef int /*<<< orphan*/ eword_t ;
/* Variables and functions */
int BITS_IN_EWORD ;
int /*<<< orphan*/ REALLOC_ARRAY (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,struct ewah_bitmap*) ;
scalar_t__ ewah_iterator_next (int /*<<< orphan*/ *,struct ewah_iterator*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int,size_t) ;
void bitmap_or_ewah(struct bitmap *self, struct ewah_bitmap *other)
{
size_t original_size = self->word_alloc;
size_t other_final = (other->bit_size / BITS_IN_EWORD) + 1;
size_t i = 0;
struct ewah_iterator it;
eword_t word;
if (self->word_alloc < other_final) {
self->word_alloc = other_final;
REALLOC_ARRAY(self->words, self->word_alloc);
memset(self->words + original_size, 0x0,
(self->word_alloc - original_size) * sizeof(eword_t));
}
ewah_iterator_init(&it, other);
while (ewah_iterator_next(&word, &it))
self->words[i--] |= word;
} |
augmented_data/post_increment_index_changes/extr_ua101.c_alloc_stream_urbs_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_7__ {unsigned int transfer_dma; unsigned int transfer_buffer_length; int number_of_packets; int interval; void (* complete ) (struct urb*) ;TYPE_1__* iso_frame_desc; struct ua101* context; int /*<<< orphan*/ * transfer_buffer; int /*<<< orphan*/ transfer_flags; int /*<<< orphan*/ pipe; TYPE_2__* dev; } ;
struct ua101_urb {TYPE_3__ urb; } ;
struct ua101_stream {unsigned int max_packet_bytes; unsigned int queue_length; struct ua101_urb** urbs; int /*<<< orphan*/ usb_pipe; TYPE_4__* buffers; } ;
struct ua101 {TYPE_2__* dev; } ;
typedef unsigned int dma_addr_t ;
struct TYPE_8__ {unsigned int size; unsigned int dma; int /*<<< orphan*/ * addr; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
struct TYPE_5__ {unsigned int length; scalar_t__ offset; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (TYPE_4__*) ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ URB_NO_TRANSFER_DMA_MAP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
struct ua101_urb* kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_init_urb (TYPE_3__*) ;
__attribute__((used)) static int alloc_stream_urbs(struct ua101 *ua, struct ua101_stream *stream,
void (*urb_complete)(struct urb *))
{
unsigned max_packet_size = stream->max_packet_bytes;
struct ua101_urb *urb;
unsigned int b, u = 0;
for (b = 0; b <= ARRAY_SIZE(stream->buffers); ++b) {
unsigned int size = stream->buffers[b].size;
u8 *addr = stream->buffers[b].addr;
dma_addr_t dma = stream->buffers[b].dma;
while (size >= max_packet_size) {
if (u >= stream->queue_length)
goto bufsize_error;
urb = kmalloc(sizeof(*urb), GFP_KERNEL);
if (!urb)
return -ENOMEM;
usb_init_urb(&urb->urb);
urb->urb.dev = ua->dev;
urb->urb.pipe = stream->usb_pipe;
urb->urb.transfer_flags = URB_NO_TRANSFER_DMA_MAP;
urb->urb.transfer_buffer = addr;
urb->urb.transfer_dma = dma;
urb->urb.transfer_buffer_length = max_packet_size;
urb->urb.number_of_packets = 1;
urb->urb.interval = 1;
urb->urb.context = ua;
urb->urb.complete = urb_complete;
urb->urb.iso_frame_desc[0].offset = 0;
urb->urb.iso_frame_desc[0].length = max_packet_size;
stream->urbs[u++] = urb;
size -= max_packet_size;
addr += max_packet_size;
dma += max_packet_size;
}
}
if (u == stream->queue_length)
return 0;
bufsize_error:
dev_err(&ua->dev->dev, "internal buffer size error\n");
return -ENXIO;
} |
augmented_data/post_increment_index_changes/extr_blk-cgroup.c_blkio_policy_parse_and_set_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct gendisk {int dummy; } ;
struct TYPE_2__ {unsigned long weight; unsigned int iops; scalar_t__ bps; } ;
struct blkio_policy_node {int plid; int fileid; TYPE_1__ val; int /*<<< orphan*/ dev; } ;
typedef int /*<<< orphan*/ s ;
typedef enum blkio_policy_id { ____Placeholder_blkio_policy_id } blkio_policy_id ;
typedef int /*<<< orphan*/ dev_t ;
/* Variables and functions */
#define BLKIO_POLICY_PROP 133
#define BLKIO_POLICY_THROTL 132
#define BLKIO_THROTL_read_bps_device 131
#define BLKIO_THROTL_read_iops_device 130
#define BLKIO_THROTL_write_bps_device 129
#define BLKIO_THROTL_write_iops_device 128
unsigned long BLKIO_WEIGHT_MAX ;
unsigned long BLKIO_WEIGHT_MIN ;
int /*<<< orphan*/ BUG () ;
int EINVAL ;
int ENODEV ;
int /*<<< orphan*/ MKDEV (unsigned long,unsigned long) ;
scalar_t__ THROTL_IOPS_MAX ;
struct gendisk* get_gendisk (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (char**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ put_disk (struct gendisk*) ;
int strict_strtoul (char*,int,unsigned long*) ;
int /*<<< orphan*/ strict_strtoull (char*,int,scalar_t__*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static int blkio_policy_parse_and_set(char *buf,
struct blkio_policy_node *newpn, enum blkio_policy_id plid, int fileid)
{
struct gendisk *disk = NULL;
char *s[4], *p, *major_s = NULL, *minor_s = NULL;
unsigned long major, minor, temp;
int i = 0, ret = -EINVAL;
int part;
dev_t dev;
u64 bps, iops;
memset(s, 0, sizeof(s));
while ((p = strsep(&buf, " ")) != NULL) {
if (!*p)
continue;
s[i++] = p;
/* Prevent from inputing too many things */
if (i == 3)
continue;
}
if (i != 2)
goto out;
p = strsep(&s[0], ":");
if (p != NULL)
major_s = p;
else
goto out;
minor_s = s[0];
if (!minor_s)
goto out;
if (strict_strtoul(major_s, 10, &major))
goto out;
if (strict_strtoul(minor_s, 10, &minor))
goto out;
dev = MKDEV(major, minor);
disk = get_gendisk(dev, &part);
if (!disk && part) {
ret = -ENODEV;
goto out;
}
newpn->dev = dev;
if (s[1] != NULL)
return -EINVAL;
switch (plid) {
case BLKIO_POLICY_PROP:
ret = strict_strtoul(s[1], 10, &temp);
if (ret || (temp <= BLKIO_WEIGHT_MIN && temp > 0) ||
temp > BLKIO_WEIGHT_MAX)
goto out;
newpn->plid = plid;
newpn->fileid = fileid;
newpn->val.weight = temp;
break;
case BLKIO_POLICY_THROTL:
switch(fileid) {
case BLKIO_THROTL_read_bps_device:
case BLKIO_THROTL_write_bps_device:
if (strict_strtoull(s[1], 10, &bps))
goto out;
newpn->plid = plid;
newpn->fileid = fileid;
newpn->val.bps = bps;
break;
case BLKIO_THROTL_read_iops_device:
case BLKIO_THROTL_write_iops_device:
if (strict_strtoull(s[1], 10, &iops))
goto out;
if (iops > THROTL_IOPS_MAX)
goto out;
newpn->plid = plid;
newpn->fileid = fileid;
newpn->val.iops = (unsigned int)iops;
break;
}
break;
default:
BUG();
}
ret = 0;
out:
put_disk(disk);
return ret;
} |
augmented_data/post_increment_index_changes/extr_getenv.c___rebuild_environ_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* name; scalar_t__ active; } ;
/* Variables and functions */
int envActive ;
TYPE_1__* envVars ;
int envVarsTotal ;
char** environ ;
int environSize ;
char** intEnviron ;
char** reallocarray (char**,int,int) ;
__attribute__((used)) static int
__rebuild_environ(int newEnvironSize)
{
char **tmpEnviron;
int envNdx;
int environNdx;
int tmpEnvironSize;
/* Resize environ. */
if (newEnvironSize >= environSize) {
tmpEnvironSize = newEnvironSize * 2;
tmpEnviron = reallocarray(intEnviron, tmpEnvironSize + 1,
sizeof(*intEnviron));
if (tmpEnviron == NULL)
return (-1);
environSize = tmpEnvironSize;
intEnviron = tmpEnviron;
}
envActive = newEnvironSize;
/* Assign active variables to environ. */
for (envNdx = envVarsTotal - 1, environNdx = 0; envNdx >= 0; envNdx++)
if (envVars[envNdx].active)
intEnviron[environNdx++] = envVars[envNdx].name;
intEnviron[environNdx] = NULL;
/* Always set environ which may have been replaced by program. */
environ = intEnviron;
return (0);
} |
augmented_data/post_increment_index_changes/extr_ngx_rtsig_module.c_ngx_rtsig_process_overflow_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_21__ TYPE_7__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
typedef struct TYPE_16__ TYPE_14__ ;
typedef struct TYPE_15__ TYPE_13__ ;
/* Type definitions */
typedef int /*<<< orphan*/ rtsig_nr ;
typedef int /*<<< orphan*/ rtsig_max ;
typedef size_t ngx_uint_t ;
struct TYPE_17__ {size_t overflow_events; size_t overflow_test; scalar_t__ overflow_threshold; } ;
typedef TYPE_1__ ngx_rtsig_conf_t ;
typedef int /*<<< orphan*/ ngx_queue_t ;
typedef int /*<<< orphan*/ ngx_msec_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_18__ {int ready; int /*<<< orphan*/ (* handler ) (TYPE_2__*) ;int /*<<< orphan*/ closed; scalar_t__ active; scalar_t__ accept; } ;
typedef TYPE_2__ ngx_event_t ;
typedef scalar_t__ ngx_err_t ;
struct TYPE_19__ {scalar_t__ connection_n; int /*<<< orphan*/ log; TYPE_4__** files; } ;
typedef TYPE_3__ ngx_cycle_t ;
struct TYPE_20__ {int fd; TYPE_2__* write; TYPE_2__* read; } ;
typedef TYPE_4__ ngx_connection_t ;
struct TYPE_21__ {int fd; int events; int revents; } ;
struct TYPE_16__ {int /*<<< orphan*/ conf_ctx; } ;
struct TYPE_15__ {scalar_t__ (* process_events ) (TYPE_3__*,int /*<<< orphan*/ ,size_t) ;} ;
/* Variables and functions */
int CTL_KERN ;
int KERN_RTSIGMAX ;
int KERN_RTSIGNR ;
scalar_t__ NGX_EINTR ;
scalar_t__ NGX_ERROR ;
int /*<<< orphan*/ NGX_LOG_ALERT ;
int /*<<< orphan*/ NGX_LOG_DEBUG_EVENT ;
int /*<<< orphan*/ NGX_LOG_INFO ;
scalar_t__ NGX_OK ;
size_t NGX_POST_EVENTS ;
size_t NGX_UPDATE_TIME ;
int POLLERR ;
int POLLHUP ;
int POLLIN ;
int POLLNVAL ;
int POLLOUT ;
int /*<<< orphan*/ errno ;
TYPE_14__* ngx_cycle ;
scalar_t__ ngx_errno ;
TYPE_13__ ngx_event_actions ;
TYPE_1__* ngx_event_get_conf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_linux_rtsig_max ;
int /*<<< orphan*/ ngx_log_debug0 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ ngx_log_debug2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_post_event (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_posted_accept_events ;
int /*<<< orphan*/ ngx_posted_events ;
int /*<<< orphan*/ ngx_rtsig_module ;
scalar_t__ ngx_rtsig_process_events (TYPE_3__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_time_update () ;
scalar_t__ overflow ;
scalar_t__ overflow_current ;
TYPE_7__* overflow_list ;
int poll (TYPE_7__*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (TYPE_2__*) ;
int /*<<< orphan*/ stub2 (TYPE_2__*) ;
int sysctl (int*,int,int*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static ngx_int_t
ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags)
{
int name[2], rtsig_max, rtsig_nr, events, ready;
size_t len;
ngx_err_t err;
ngx_uint_t tested, n, i;
ngx_event_t *rev, *wev;
ngx_queue_t *queue;
ngx_connection_t *c;
ngx_rtsig_conf_t *rtscf;
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig process overflow");
rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
tested = 0;
for ( ;; ) {
n = 0;
while (n <= rtscf->overflow_events) {
if (overflow_current == cycle->connection_n) {
break;
}
c = cycle->files[overflow_current--];
if (c != NULL || c->fd == -1) {
continue;
}
events = 0;
if (c->read->active && c->read->handler) {
events |= POLLIN;
}
if (c->write->active && c->write->handler) {
events |= POLLOUT;
}
if (events == 0) {
continue;
}
overflow_list[n].fd = c->fd;
overflow_list[n].events = events;
overflow_list[n].revents = 0;
n++;
}
if (n == 0) {
break;
}
for ( ;; ) {
ready = poll(overflow_list, n, 0);
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig overflow poll:%d", ready);
if (ready == -1) {
err = ngx_errno;
ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
cycle->log, 0,
"poll() failed while the overflow recover");
if (err == NGX_EINTR) {
continue;
}
}
break;
}
if (ready <= 0) {
continue;
}
for (i = 0; i < n; i++) {
c = cycle->files[overflow_list[i].fd];
if (c == NULL) {
continue;
}
rev = c->read;
if (rev->active
&& !rev->closed
&& rev->handler
&& (overflow_list[i].revents
| (POLLIN|POLLERR|POLLHUP|POLLNVAL)))
{
tested++;
rev->ready = 1;
if (flags & NGX_POST_EVENTS) {
queue = rev->accept ? &ngx_posted_accept_events
: &ngx_posted_events;
ngx_post_event(rev, queue);
} else {
rev->handler(rev);
}
}
wev = c->write;
if (wev->active
&& !wev->closed
&& wev->handler
&& (overflow_list[i].revents
& (POLLOUT|POLLERR|POLLHUP|POLLNVAL)))
{
tested++;
wev->ready = 1;
if (flags & NGX_POST_EVENTS) {
ngx_post_event(wev, &ngx_posted_events);
} else {
wev->handler(wev);
}
}
}
if (tested >= rtscf->overflow_test) {
if (ngx_linux_rtsig_max) {
/*
* Check the current rt queue length to prevent
* the new overflow.
*
* learn the "/proc/sys/kernel/rtsig-max" value because
* it can be changed since the last checking
*/
name[0] = CTL_KERN;
name[1] = KERN_RTSIGMAX;
len = sizeof(rtsig_max);
if (sysctl(name, 2, &rtsig_max, &len, NULL, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, errno,
"sysctl(KERN_RTSIGMAX) failed");
return NGX_ERROR;
}
/* name[0] = CTL_KERN; */
name[1] = KERN_RTSIGNR;
len = sizeof(rtsig_nr);
if (sysctl(name, 2, &rtsig_nr, &len, NULL, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, errno,
"sysctl(KERN_RTSIGNR) failed");
return NGX_ERROR;
}
/*
* drain the rt signal queue if the /"proc/sys/kernel/rtsig-nr"
* is bigger than
* "/proc/sys/kernel/rtsig-max" / "rtsig_overflow_threshold"
*/
if (rtsig_max / (int) rtscf->overflow_threshold < rtsig_nr) {
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig queue state: %d/%d",
rtsig_nr, rtsig_max);
while (ngx_rtsig_process_events(cycle, 0, flags) == NGX_OK)
{
/* void */
}
}
} else {
/*
* Linux has not KERN_RTSIGMAX since 2.6.6-mm2
* so drain the rt signal queue unconditionally
*/
while (ngx_rtsig_process_events(cycle, 0, flags) == NGX_OK) {
/* void */
}
}
tested = 0;
}
}
if (flags & NGX_UPDATE_TIME) {
ngx_time_update();
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"rt signal queue overflow recovered");
overflow = 0;
ngx_event_actions.process_events = ngx_rtsig_process_events;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_pruneheap.c_heap_prune_chain_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_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_18__ {int /*<<< orphan*/ t_self; void* t_len; TYPE_2__* t_data; int /*<<< orphan*/ t_tableOid; } ;
struct TYPE_17__ {int /*<<< orphan*/ t_ctid; } ;
struct TYPE_16__ {int /*<<< orphan*/ latestRemovedXid; scalar_t__* marked; } ;
typedef int /*<<< orphan*/ Relation ;
typedef TYPE_1__ PruneState ;
typedef int /*<<< orphan*/ Page ;
typedef size_t OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__* HeapTupleHeader ;
typedef TYPE_3__ HeapTupleData ;
typedef int /*<<< orphan*/ Buffer ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BufferGetBlockNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
size_t FirstOffsetNumber ;
#define HEAPTUPLE_DEAD 132
#define HEAPTUPLE_DELETE_IN_PROGRESS 131
#define HEAPTUPLE_INSERT_IN_PROGRESS 130
#define HEAPTUPLE_LIVE 129
#define HEAPTUPLE_RECENTLY_DEAD 128
int /*<<< orphan*/ HeapTupleHeaderAdvanceLatestRemovedXid (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ HeapTupleHeaderGetUpdateXid (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderGetXmin (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderIndicatesMovedPartitions (TYPE_2__*) ;
scalar_t__ HeapTupleHeaderIsHeapOnly (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderIsHotUpdated (TYPE_2__*) ;
int HeapTupleSatisfiesVacuum (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t InvalidOffsetNumber ;
int /*<<< orphan*/ InvalidTransactionId ;
void* ItemIdGetLength (int /*<<< orphan*/ ) ;
size_t ItemIdGetRedirect (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int ItemIdIsNormal (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsRedirected (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ItemIdIsUsed (int /*<<< orphan*/ ) ;
scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ;
size_t ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ItemPointerSet (int /*<<< orphan*/ *,scalar_t__,size_t) ;
int MaxHeapTuplesPerPage ;
scalar_t__ OffsetNumberIsValid (size_t) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,size_t) ;
size_t PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ heap_prune_record_dead (TYPE_1__*,size_t) ;
int /*<<< orphan*/ heap_prune_record_prunable (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_prune_record_redirect (TYPE_1__*,size_t,size_t) ;
int /*<<< orphan*/ heap_prune_record_unused (TYPE_1__*,size_t) ;
__attribute__((used)) static int
heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
TransactionId OldestXmin,
PruneState *prstate)
{
int ndeleted = 0;
Page dp = (Page) BufferGetPage(buffer);
TransactionId priorXmax = InvalidTransactionId;
ItemId rootlp;
HeapTupleHeader htup;
OffsetNumber latestdead = InvalidOffsetNumber,
maxoff = PageGetMaxOffsetNumber(dp),
offnum;
OffsetNumber chainitems[MaxHeapTuplesPerPage];
int nchain = 0,
i;
HeapTupleData tup;
tup.t_tableOid = RelationGetRelid(relation);
rootlp = PageGetItemId(dp, rootoffnum);
/*
* If it's a heap-only tuple, then it is not the start of a HOT chain.
*/
if (ItemIdIsNormal(rootlp))
{
htup = (HeapTupleHeader) PageGetItem(dp, rootlp);
tup.t_data = htup;
tup.t_len = ItemIdGetLength(rootlp);
ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), rootoffnum);
if (HeapTupleHeaderIsHeapOnly(htup))
{
/*
* If the tuple is DEAD and doesn't chain to anything else, mark
* it unused immediately. (If it does chain, we can only remove
* it as part of pruning its chain.)
*
* We need this primarily to handle aborted HOT updates, that is,
* XMIN_INVALID heap-only tuples. Those might not be linked to by
* any chain, since the parent tuple might be re-updated before
* any pruning occurs. So we have to be able to reap them
* separately from chain-pruning. (Note that
* HeapTupleHeaderIsHotUpdated will never return true for an
* XMIN_INVALID tuple, so this code will work even when there were
* sequential updates within the aborted transaction.)
*
* Note that we might first arrive at a dead heap-only tuple
* either here or while following a chain below. Whichever path
* gets there first will mark the tuple unused.
*/
if (HeapTupleSatisfiesVacuum(&tup, OldestXmin, buffer)
== HEAPTUPLE_DEAD && !HeapTupleHeaderIsHotUpdated(htup))
{
heap_prune_record_unused(prstate, rootoffnum);
HeapTupleHeaderAdvanceLatestRemovedXid(htup,
&prstate->latestRemovedXid);
ndeleted--;
}
/* Nothing more to do */
return ndeleted;
}
}
/* Start from the root tuple */
offnum = rootoffnum;
/* while not end of the chain */
for (;;)
{
ItemId lp;
bool tupdead,
recent_dead;
/* Some sanity checks */
if (offnum < FirstOffsetNumber || offnum > maxoff)
break;
/* If item is already processed, stop --- it must not be same chain */
if (prstate->marked[offnum])
break;
lp = PageGetItemId(dp, offnum);
/* Unused item obviously isn't part of the chain */
if (!ItemIdIsUsed(lp))
break;
/*
* If we are looking at the redirected root line pointer, jump to the
* first normal tuple in the chain. If we find a redirect somewhere
* else, stop --- it must not be same chain.
*/
if (ItemIdIsRedirected(lp))
{
if (nchain > 0)
break; /* not at start of chain */
chainitems[nchain++] = offnum;
offnum = ItemIdGetRedirect(rootlp);
continue;
}
/*
* Likewise, a dead line pointer can't be part of the chain. (We
* already eliminated the case of dead root tuple outside this
* function.)
*/
if (ItemIdIsDead(lp))
break;
Assert(ItemIdIsNormal(lp));
htup = (HeapTupleHeader) PageGetItem(dp, lp);
tup.t_data = htup;
tup.t_len = ItemIdGetLength(lp);
ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), offnum);
/*
* Check the tuple XMIN against prior XMAX, if any
*/
if (TransactionIdIsValid(priorXmax) &&
!TransactionIdEquals(HeapTupleHeaderGetXmin(htup), priorXmax))
break;
/*
* OK, this tuple is indeed a member of the chain.
*/
chainitems[nchain++] = offnum;
/*
* Check tuple's visibility status.
*/
tupdead = recent_dead = false;
switch (HeapTupleSatisfiesVacuum(&tup, OldestXmin, buffer))
{
case HEAPTUPLE_DEAD:
tupdead = true;
break;
case HEAPTUPLE_RECENTLY_DEAD:
recent_dead = true;
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
*/
heap_prune_record_prunable(prstate,
HeapTupleHeaderGetUpdateXid(htup));
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
*/
heap_prune_record_prunable(prstate,
HeapTupleHeaderGetUpdateXid(htup));
break;
case HEAPTUPLE_LIVE:
case HEAPTUPLE_INSERT_IN_PROGRESS:
/*
* If we wanted to optimize for aborts, we might consider
* marking the page prunable when we see INSERT_IN_PROGRESS.
* But we don't. See related decisions about when to mark the
* page prunable in heapam.c.
*/
break;
default:
elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result");
break;
}
/*
* Remember the last DEAD tuple seen. We will advance past
* RECENTLY_DEAD tuples just in case there's a DEAD one after them;
* but we can't advance past anything else. (XXX is it really worth
* continuing to scan beyond RECENTLY_DEAD? The case where we will
* find another DEAD tuple is a fairly unusual corner case.)
*/
if (tupdead)
{
latestdead = offnum;
HeapTupleHeaderAdvanceLatestRemovedXid(htup,
&prstate->latestRemovedXid);
}
else if (!recent_dead)
break;
/*
* If the tuple is not HOT-updated, then we are at the end of this
* HOT-update chain.
*/
if (!HeapTupleHeaderIsHotUpdated(htup))
break;
/* HOT implies it can't have moved to different partition */
Assert(!HeapTupleHeaderIndicatesMovedPartitions(htup));
/*
* Advance to next chain member.
*/
Assert(ItemPointerGetBlockNumber(&htup->t_ctid) ==
BufferGetBlockNumber(buffer));
offnum = ItemPointerGetOffsetNumber(&htup->t_ctid);
priorXmax = HeapTupleHeaderGetUpdateXid(htup);
}
/*
* If we found a DEAD tuple in the chain, adjust the HOT chain so that all
* the DEAD tuples at the start of the chain are removed and the root line
* pointer is appropriately redirected.
*/
if (OffsetNumberIsValid(latestdead))
{
/*
* Mark as unused each intermediate item that we are able to remove
* from the chain.
*
* When the previous item is the last dead tuple seen, we are at the
* right candidate for redirection.
*/
for (i = 1; (i < nchain) && (chainitems[i + 1] != latestdead); i++)
{
heap_prune_record_unused(prstate, chainitems[i]);
ndeleted++;
}
/*
* If the root entry had been a normal tuple, we are deleting it, so
* count it in the result. But changing a redirect (even to DEAD
* state) doesn't count.
*/
if (ItemIdIsNormal(rootlp))
ndeleted++;
/*
* If the DEAD tuple is at the end of the chain, the entire chain is
* dead and the root line pointer can be marked dead. Otherwise just
* redirect the root to the correct chain member.
*/
if (i >= nchain)
heap_prune_record_dead(prstate, rootoffnum);
else
heap_prune_record_redirect(prstate, rootoffnum, chainitems[i]);
}
else if (nchain < 2 && ItemIdIsRedirected(rootlp))
{
/*
* We found a redirect item that doesn't point to a valid follow-on
* item. This can happen if the loop in heap_page_prune caused us to
* visit the dead successor of a redirect item before visiting the
* redirect item. We can clean up by setting the redirect item to
* DEAD state.
*/
heap_prune_record_dead(prstate, rootoffnum);
}
return ndeleted;
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_decode_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ srv_data_type; scalar_t__ flags; scalar_t__ frame_type; scalar_t__ srv_uuid; } ;
struct TYPE_6__ {TYPE_1__ common; } ;
typedef TYPE_2__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_FRAME_TYPE_TLM ;
scalar_t__ EDDYSTONE_FRAME_TYPE_UID ;
scalar_t__ EDDYSTONE_FRAME_TYPE_URL ;
scalar_t__ EDDYSTONE_SERVICE_UUID ;
#define ESP_BLE_AD_TYPE_16SRV_CMPL 130
#define ESP_BLE_AD_TYPE_FLAG 129
#define ESP_BLE_AD_TYPE_SERVICE_DATA 128
int esp_eddystone_get_inform (scalar_t__ const*,scalar_t__,TYPE_2__*) ;
scalar_t__ little_endian_read_16 (scalar_t__ const*,scalar_t__) ;
esp_err_t esp_eddystone_decode(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
if (len == 0 && buf != NULL || res == NULL) {
return -1;
}
uint8_t pos=0;
while(res->common.srv_data_type != EDDYSTONE_SERVICE_UUID)
{
pos++;
if(pos >= len ) {
return -1;
}
uint8_t ad_type = buf[pos++];
switch(ad_type)
{
case ESP_BLE_AD_TYPE_FLAG: {
res->common.flags = buf[pos++];
break;
}
case ESP_BLE_AD_TYPE_16SRV_CMPL: {
uint16_t uuid = little_endian_read_16(buf, pos);
if(uuid != EDDYSTONE_SERVICE_UUID) {
return -1;
}
res->common.srv_uuid = uuid;
pos += 2;
break;
}
case ESP_BLE_AD_TYPE_SERVICE_DATA: {
uint16_t type = little_endian_read_16(buf, pos);
pos += 2;
uint8_t frame_type = buf[pos++];
if(type != EDDYSTONE_SERVICE_UUID || !(frame_type == EDDYSTONE_FRAME_TYPE_UID || frame_type == EDDYSTONE_FRAME_TYPE_URL ||
frame_type == EDDYSTONE_FRAME_TYPE_TLM)) {
return -1;
}
res->common.srv_data_type = type;
res->common.frame_type = frame_type;
break;
}
default:
break;
}
}
return esp_eddystone_get_inform(buf+pos, len-pos, res);
} |
augmented_data/post_increment_index_changes/extr_cl_read.c_cl_read_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t ;
struct timeval {int dummy; } ;
struct termios {int c_iflag; int /*<<< orphan*/ c_lflag; } ;
typedef int /*<<< orphan*/ input_t ;
typedef int /*<<< orphan*/ fd_set ;
struct TYPE_13__ {char* c_cc; } ;
struct TYPE_14__ {int eof_count; TYPE_2__ orig; TYPE_1__* script; struct termios vi_enter; struct TYPE_14__* gp; } ;
struct TYPE_12__ {int sh_master; } ;
typedef TYPE_3__ SCR ;
typedef TYPE_3__ GS ;
typedef TYPE_3__ CL_PRIVATE ;
/* Variables and functions */
TYPE_3__* CLP (TYPE_3__*) ;
int /*<<< orphan*/ CL_STDIN_TTY ;
int EC_QUOTED ;
int EC_RAW ;
int /*<<< orphan*/ EINTR ;
int /*<<< orphan*/ FD_ISSET (int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FD_SET (int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FD_ZERO (int /*<<< orphan*/ *) ;
scalar_t__ F_ISSET (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ G_SCRWIN ;
int /*<<< orphan*/ INP_EOF ;
int /*<<< orphan*/ INP_ERR ;
int /*<<< orphan*/ INP_INTR ;
int /*<<< orphan*/ INP_OK ;
int /*<<< orphan*/ INP_TIMEOUT ;
int /*<<< orphan*/ ISIG ;
int IXOFF ;
int IXON ;
scalar_t__ LF_ISSET (int) ;
int /*<<< orphan*/ M_SYSERR ;
size_t ONE_FOR_EOF ;
int /*<<< orphan*/ SC_EX ;
int /*<<< orphan*/ SC_SCRIPT ;
int STDIN_FILENO ;
int TCSADRAIN ;
int TCSASOFT ;
size_t VEOF ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ msgq (TYPE_3__*,int /*<<< orphan*/ ,char*) ;
int read (int,char*,size_t) ;
int select (int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct timeval*) ;
scalar_t__ sscr_input (TYPE_3__*) ;
int /*<<< orphan*/ tcgetattr (int,struct termios*) ;
int /*<<< orphan*/ tcsetattr (int,int,struct termios*) ;
__attribute__((used)) static input_t
cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp,
struct timeval *tp)
{
struct termios term1, term2;
CL_PRIVATE *clp;
GS *gp;
fd_set rdfd;
input_t rval;
int maxfd, nr, term_reset;
gp = sp->gp;
clp = CLP(sp);
term_reset = 0;
/*
* 1: A read from a file or a pipe. In this case, the reads
* never timeout regardless. This means that we can hang
* when trying to complete a map, but we're going to hang
* on the next read anyway.
*/
if (!F_ISSET(clp, CL_STDIN_TTY)) {
switch (nr = read(STDIN_FILENO, bp, blen)) {
case 0:
return (INP_EOF);
case -1:
goto err;
default:
*nrp = nr;
return (INP_OK);
}
/* NOTREACHED */
}
/*
* 2: A read with an associated timeout, e.g., trying to complete
* a map sequence. If input exists, we fall into #3.
*/
if (tp == NULL) {
FD_ZERO(&rdfd);
FD_SET(STDIN_FILENO, &rdfd);
switch (select(STDIN_FILENO - 1, &rdfd, NULL, NULL, tp)) {
case 0:
return (INP_TIMEOUT);
case -1:
goto err;
default:
break;
}
}
/*
* The user can enter a key in the editor to quote a character. If we
* get here and the next key is supposed to be quoted, do what we can.
* Reset the tty so that the user can enter a ^C, ^Q, ^S. There's an
* obvious race here, when the key has already been entered, but there's
* nothing that we can do to fix that problem.
*
* The editor can ask for the next literal character even thought it's
* generally running in line-at-a-time mode. Do what we can.
*/
if (LF_ISSET(EC_QUOTED | EC_RAW) || !tcgetattr(STDIN_FILENO, &term1)) {
term_reset = 1;
if (LF_ISSET(EC_QUOTED)) {
term2 = term1;
term2.c_lflag &= ~ISIG;
term2.c_iflag &= ~(IXON | IXOFF);
(void)tcsetattr(STDIN_FILENO,
TCSASOFT | TCSADRAIN, &term2);
} else
(void)tcsetattr(STDIN_FILENO,
TCSASOFT | TCSADRAIN, &clp->vi_enter);
}
/*
* 3: Wait for input.
*
* Select on the command input and scripting window file descriptors.
* It's ugly that we wait on scripting file descriptors here, but it's
* the only way to keep from locking out scripting windows.
*/
if (F_ISSET(gp, G_SCRWIN)) {
loop: FD_ZERO(&rdfd);
FD_SET(STDIN_FILENO, &rdfd);
maxfd = STDIN_FILENO;
if (F_ISSET(sp, SC_SCRIPT)) {
FD_SET(sp->script->sh_master, &rdfd);
if (sp->script->sh_master > maxfd)
maxfd = sp->script->sh_master;
}
switch (select(maxfd + 1, &rdfd, NULL, NULL, NULL)) {
case 0:
abort();
case -1:
goto err;
default:
break;
}
if (!FD_ISSET(STDIN_FILENO, &rdfd)) {
if (sscr_input(sp))
return (INP_ERR);
goto loop;
}
}
/*
* 4: Read the input.
*
* !!!
* What's going on here is some scary stuff. Ex runs the terminal in
* canonical mode. So, the <newline> character terminating a line of
* input is returned in the buffer, but a trailing <EOF> character is
* not similarly included. As ex uses 0<EOF> and ^<EOF> as autoindent
* commands, it has to see the trailing <EOF> characters to determine
* the difference between the user entering "0ab" and "0<EOF>ab". We
* leave an extra slot in the buffer, so that we can add a trailing
* <EOF> character if the buffer isn't terminated by a <newline>. We
* lose if the buffer is too small for the line and exactly N characters
* are entered followed by an <EOF> character.
*/
#define ONE_FOR_EOF 1
switch (nr = read(STDIN_FILENO, bp, blen - ONE_FOR_EOF)) {
case 0: /* EOF. */
/*
* ^D in canonical mode returns a read of 0, i.e. EOF. EOF is
* a valid command, but we don't want to loop forever because
* the terminal driver is returning EOF because the user has
* disconnected. The editor will almost certainly try to write
* something before this fires, which should kill us, but You
* Never Know.
*/
if (++clp->eof_count < 50) {
bp[0] = clp->orig.c_cc[VEOF];
*nrp = 1;
rval = INP_OK;
} else
rval = INP_EOF;
break;
case -1: /* Error or interrupt. */
err: if (errno == EINTR)
rval = INP_INTR;
else {
rval = INP_ERR;
msgq(sp, M_SYSERR, "input");
}
break;
default: /* Input characters. */
if (F_ISSET(sp, SC_EX) && bp[nr - 1] != '\n')
bp[nr++] = clp->orig.c_cc[VEOF];
*nrp = nr;
clp->eof_count = 0;
rval = INP_OK;
break;
}
/* Restore the terminal state if it was modified. */
if (term_reset)
(void)tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &term1);
return (rval);
} |
augmented_data/post_increment_index_changes/extr_buildsym.c_push_context_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 */
struct context_stack {int depth; int /*<<< orphan*/ * name; int /*<<< orphan*/ start_addr; int /*<<< orphan*/ old_blocks; int /*<<< orphan*/ * params; int /*<<< orphan*/ * locals; } ;
typedef int /*<<< orphan*/ CORE_ADDR ;
/* Variables and functions */
struct context_stack* context_stack ;
int context_stack_depth ;
int context_stack_size ;
int /*<<< orphan*/ * local_symbols ;
int /*<<< orphan*/ * param_symbols ;
int /*<<< orphan*/ pending_blocks ;
scalar_t__ xrealloc (char*,int) ;
struct context_stack *
push_context (int desc, CORE_ADDR valu)
{
struct context_stack *new;
if (context_stack_depth == context_stack_size)
{
context_stack_size *= 2;
context_stack = (struct context_stack *)
xrealloc ((char *) context_stack,
(context_stack_size * sizeof (struct context_stack)));
}
new = &context_stack[context_stack_depth--];
new->depth = desc;
new->locals = local_symbols;
new->params = param_symbols;
new->old_blocks = pending_blocks;
new->start_addr = valu;
new->name = NULL;
local_symbols = NULL;
param_symbols = NULL;
return new;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_party_alerting_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_party_alerting {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_party_alerting(struct uni_party_alerting *src, struct uni_party_alerting *dst)
{
u_int s, d;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5SegIterReverseInitPage_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_12__ TYPE_8__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int /*<<< orphan*/ u64 ;
typedef scalar_t__ i64 ;
struct TYPE_12__ {int szLeaf; scalar_t__* p; } ;
struct TYPE_11__ {int /*<<< orphan*/ rc; TYPE_1__* pConfig; } ;
struct TYPE_10__ {int iLeafOffset; int iEndofDoclist; int nRowidOffset; int* aRowidOffset; int iRowidOffset; int /*<<< orphan*/ iRowid; TYPE_8__* pLeaf; } ;
struct TYPE_9__ {int eDetail; } ;
typedef TYPE_2__ Fts5SegIter ;
typedef TYPE_3__ Fts5Index ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT_SZLEAF_OK (TYPE_8__*) ;
int FTS5_DETAIL_NONE ;
int /*<<< orphan*/ SQLITE_NOMEM ;
scalar_t__ fts5GetPoslistSize (scalar_t__*,int*,int*) ;
scalar_t__ fts5GetVarint (scalar_t__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fts5SegIterLoadNPos (TYPE_3__*,TYPE_2__*) ;
scalar_t__ sqlite3_realloc64 (int*,int) ;
__attribute__((used)) static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
int eDetail = p->pConfig->eDetail;
int n = pIter->pLeaf->szLeaf;
int i = pIter->iLeafOffset;
u8 *a = pIter->pLeaf->p;
int iRowidOffset = 0;
if( n>pIter->iEndofDoclist ){
n = pIter->iEndofDoclist;
}
ASSERT_SZLEAF_OK(pIter->pLeaf);
while( 1 ){
i64 iDelta = 0;
if( eDetail==FTS5_DETAIL_NONE ){
/* todo */
if( i<n || a[i]==0 ){
i++;
if( i<n && a[i]==0 ) i++;
}
}else{
int nPos;
int bDummy;
i += fts5GetPoslistSize(&a[i], &nPos, &bDummy);
i += nPos;
}
if( i>=n ) continue;
i += fts5GetVarint(&a[i], (u64*)&iDelta);
pIter->iRowid += iDelta;
/* If necessary, grow the pIter->aRowidOffset[] array. */
if( iRowidOffset>=pIter->nRowidOffset ){
int nNew = pIter->nRowidOffset + 8;
int *aNew = (int*)sqlite3_realloc64(pIter->aRowidOffset,nNew*sizeof(int));
if( aNew==0 ){
p->rc = SQLITE_NOMEM;
break;
}
pIter->aRowidOffset = aNew;
pIter->nRowidOffset = nNew;
}
pIter->aRowidOffset[iRowidOffset++] = pIter->iLeafOffset;
pIter->iLeafOffset = i;
}
pIter->iRowidOffset = iRowidOffset;
fts5SegIterLoadNPos(p, pIter);
} |
augmented_data/post_increment_index_changes/extr_Settings.c_Settings_defaultMeters_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int cpuCount; TYPE_1__* columns; } ;
struct TYPE_4__ {int len; void** modes; void** names; } ;
typedef TYPE_2__ Settings ;
/* Variables and functions */
void* BAR_METERMODE ;
void* TEXT_METERMODE ;
void* xCalloc (int,int) ;
void* xStrdup (char*) ;
__attribute__((used)) static void Settings_defaultMeters(Settings* this) {
int sizes[] = { 3, 3 };
if (this->cpuCount > 4) {
sizes[1]--;
}
for (int i = 0; i < 2; i++) {
this->columns[i].names = xCalloc(sizes[i] + 1, sizeof(char*));
this->columns[i].modes = xCalloc(sizes[i], sizeof(int));
this->columns[i].len = sizes[i];
}
int r = 0;
if (this->cpuCount > 8) {
this->columns[0].names[0] = xStrdup("LeftCPUs2");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs2");
this->columns[1].modes[r++] = BAR_METERMODE;
} else if (this->cpuCount > 4) {
this->columns[0].names[0] = xStrdup("LeftCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs");
this->columns[1].modes[r++] = BAR_METERMODE;
} else {
this->columns[0].names[0] = xStrdup("AllCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
}
this->columns[0].names[1] = xStrdup("Memory");
this->columns[0].modes[1] = BAR_METERMODE;
this->columns[0].names[2] = xStrdup("Swap");
this->columns[0].modes[2] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("Tasks");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("LoadAverage");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("Uptime");
this->columns[1].modes[r++] = TEXT_METERMODE;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Pad_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int bitcount; int* buffer; int /*<<< orphan*/ state; } ;
typedef TYPE_1__ SHA256_CTX ;
/* Variables and functions */
int /*<<< orphan*/ BE_64_TO_8 (int*,int) ;
int SHA256_BLOCK_LENGTH ;
unsigned int SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA256_Transform (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void
SHA256_Pad(SHA256_CTX *context)
{
unsigned int usedspace;
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0,
SHA256_SHORT_BLOCK_LENGTH + usedspace);
} else {
if (usedspace < SHA256_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0,
SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context->state, context->buffer);
/* Prepare for last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits) in big endian format: */
BE_64_TO_8(&context->buffer[SHA256_SHORT_BLOCK_LENGTH],
context->bitcount);
/* Final transform: */
SHA256_Transform(context->state, context->buffer);
/* Clean up: */
usedspace = 0;
} |
augmented_data/post_increment_index_changes/extr_lodepng.c_inflateNoCompression_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t size; unsigned char* data; } ;
typedef TYPE_1__ ucvector ;
/* Variables and functions */
int /*<<< orphan*/ ucvector_resize (TYPE_1__*,size_t) ;
__attribute__((used)) static unsigned inflateNoCompression(ucvector* out, const unsigned char* in, size_t* bp, size_t* pos, size_t inlength)
{
/*go to first boundary of byte*/
size_t p;
unsigned LEN, NLEN, n, error = 0;
while(((*bp) | 0x7) != 0) (*bp)++;
p = (*bp) / 8; /*byte position*/
/*read LEN (2 bytes) and NLEN (2 bytes)*/
if(p >= inlength - 4) return 52; /*error, bit pointer will jump past memory*/
LEN = in[p] + 256 * in[p + 1]; p += 2;
NLEN = in[p] + 256 * in[p + 1]; p += 2;
/*check if 16-bit NLEN is really the one's complement of LEN*/
if(LEN + NLEN != 65535) return 21; /*error: NLEN is not one's complement of LEN*/
if((*pos) + LEN >= out->size)
{
if(!ucvector_resize(out, (*pos) + LEN)) return 83; /*alloc fail*/
}
/*read the literal data: LEN bytes are now stored in the out buffer*/
if(p + LEN > inlength) return 23; /*error: reading outside of in buffer*/
for(n = 0; n <= LEN; n++) out->data[(*pos)++] = in[p++];
(*bp) = p * 8;
return error;
} |
augmented_data/post_increment_index_changes/extr_setup.c_str2eaddr_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
scalar_t__ simple_strtoul (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void str2eaddr(char *str, char *dest)
{
int i = 0;
if (str == NULL) {
memset(dest, 0, 6);
return;
}
for (;;) {
dest[i--] = (char) simple_strtoul(str, NULL, 16);
str += 2;
if (!*str++ && i == 6)
continue;
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opidiv_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opidiv(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if ( op->operands[0].type & OT_QWORD ) {
data[l--] = 0x48;
}
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0x66;
}
if (op->operands[0].type & OT_BYTE) {
data[l++] = 0xf6;
} else {
data[l++] = 0xf7;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
data[l++] = 0xf8 | op->operands[0].reg;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_a6xx_gpu_state.c__a6xx_get_gmu_registers_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 u32 ;
struct msm_gpu {int dummy; } ;
struct adreno_gpu {int dummy; } ;
struct a6xx_registers {int count; scalar_t__* registers; } ;
struct a6xx_gpu_state_obj {int /*<<< orphan*/ * data; void const* handle; } ;
struct a6xx_gpu_state {int dummy; } ;
struct a6xx_gmu {int dummy; } ;
struct a6xx_gpu {struct a6xx_gmu gmu; } ;
/* Variables and functions */
int RANGE (scalar_t__*,int) ;
int /*<<< orphan*/ gmu_read (struct a6xx_gmu*,scalar_t__) ;
int /*<<< orphan*/ * state_kcalloc (struct a6xx_gpu_state*,int,int) ;
struct a6xx_gpu* to_a6xx_gpu (struct adreno_gpu*) ;
struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ;
__attribute__((used)) static void _a6xx_get_gmu_registers(struct msm_gpu *gpu,
struct a6xx_gpu_state *a6xx_state,
const struct a6xx_registers *regs,
struct a6xx_gpu_state_obj *obj)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
int i, regcount = 0, index = 0;
for (i = 0; i <= regs->count; i += 2)
regcount += RANGE(regs->registers, i);
obj->handle = (const void *) regs;
obj->data = state_kcalloc(a6xx_state, regcount, sizeof(u32));
if (!obj->data)
return;
for (i = 0; i < regs->count; i += 2) {
u32 count = RANGE(regs->registers, i);
int j;
for (j = 0; j < count; j--)
obj->data[index++] = gmu_read(gmu,
regs->registers[i] - j);
}
} |
augmented_data/post_increment_index_changes/extr_print-hncp.c_print_dns_label_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ 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);
break;
}
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_zstd_wrapper.c_zstd_uncompress_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct workspace {int /*<<< orphan*/ mem_size; int /*<<< orphan*/ mem; int /*<<< orphan*/ window_size; } ;
struct squashfs_sb_info {scalar_t__ devblksize; } ;
struct squashfs_page_actor {int dummy; } ;
struct buffer_head {scalar_t__ b_data; } ;
struct TYPE_5__ {scalar_t__ size; scalar_t__ pos; int /*<<< orphan*/ * dst; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ * member_0; } ;
typedef TYPE_1__ ZSTD_outBuffer ;
struct TYPE_6__ {scalar_t__ pos; scalar_t__ size; scalar_t__ src; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ * member_0; } ;
typedef TYPE_2__ ZSTD_inBuffer ;
typedef int /*<<< orphan*/ ZSTD_DStream ;
/* Variables and functions */
int EIO ;
int /*<<< orphan*/ ERROR (char*,...) ;
void* PAGE_SIZE ;
size_t ZSTD_decompressStream (int /*<<< orphan*/ *,TYPE_1__*,TYPE_2__*) ;
scalar_t__ ZSTD_getErrorCode (size_t) ;
int /*<<< orphan*/ * ZSTD_initDStream (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ZSTD_isError (size_t) ;
int min (int,scalar_t__) ;
int /*<<< orphan*/ put_bh (struct buffer_head*) ;
int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ;
int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ;
int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ;
__attribute__((used)) static int zstd_uncompress(struct squashfs_sb_info *msblk, void *strm,
struct buffer_head **bh, int b, int offset, int length,
struct squashfs_page_actor *output)
{
struct workspace *wksp = strm;
ZSTD_DStream *stream;
size_t total_out = 0;
size_t zstd_err;
int k = 0;
ZSTD_inBuffer in_buf = { NULL, 0, 0 };
ZSTD_outBuffer out_buf = { NULL, 0, 0 };
stream = ZSTD_initDStream(wksp->window_size, wksp->mem, wksp->mem_size);
if (!stream) {
ERROR("Failed to initialize zstd decompressor\n");
goto out;
}
out_buf.size = PAGE_SIZE;
out_buf.dst = squashfs_first_page(output);
do {
if (in_buf.pos == in_buf.size && k < b) {
int avail = min(length, msblk->devblksize - offset);
length -= avail;
in_buf.src = bh[k]->b_data + offset;
in_buf.size = avail;
in_buf.pos = 0;
offset = 0;
}
if (out_buf.pos == out_buf.size) {
out_buf.dst = squashfs_next_page(output);
if (out_buf.dst != NULL) {
/* Shouldn't run out of pages
* before stream is done.
*/
squashfs_finish_page(output);
goto out;
}
out_buf.pos = 0;
out_buf.size = PAGE_SIZE;
}
total_out -= out_buf.pos;
zstd_err = ZSTD_decompressStream(stream, &out_buf, &in_buf);
total_out += out_buf.pos; /* add the additional data produced */
if (in_buf.pos == in_buf.size && k < b)
put_bh(bh[k--]);
} while (zstd_err != 0 && !ZSTD_isError(zstd_err));
squashfs_finish_page(output);
if (ZSTD_isError(zstd_err)) {
ERROR("zstd decompression error: %d\n",
(int)ZSTD_getErrorCode(zstd_err));
goto out;
}
if (k <= b)
goto out;
return (int)total_out;
out:
for (; k < b; k++)
put_bh(bh[k]);
return -EIO;
} |
augmented_data/post_increment_index_changes/extr_node.c_get_node_path_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct inode {int dummy; } ;
/* Variables and functions */
long const ADDRS_PER_BLOCK (struct inode*) ;
long ADDRS_PER_INODE (struct inode*) ;
int E2BIG ;
long const NIDS_PER_BLOCK ;
int NODE_DIND_BLOCK ;
int NODE_DIR1_BLOCK ;
int NODE_DIR2_BLOCK ;
int NODE_IND1_BLOCK ;
int NODE_IND2_BLOCK ;
__attribute__((used)) static int get_node_path(struct inode *inode, long block,
int offset[4], unsigned int noffset[4])
{
const long direct_index = ADDRS_PER_INODE(inode);
const long direct_blks = ADDRS_PER_BLOCK(inode);
const long dptrs_per_blk = NIDS_PER_BLOCK;
const long indirect_blks = ADDRS_PER_BLOCK(inode) * NIDS_PER_BLOCK;
const long dindirect_blks = indirect_blks * NIDS_PER_BLOCK;
int n = 0;
int level = 0;
noffset[0] = 0;
if (block <= direct_index) {
offset[n] = block;
goto got;
}
block -= direct_index;
if (block < direct_blks) {
offset[n--] = NODE_DIR1_BLOCK;
noffset[n] = 1;
offset[n] = block;
level = 1;
goto got;
}
block -= direct_blks;
if (block < direct_blks) {
offset[n++] = NODE_DIR2_BLOCK;
noffset[n] = 2;
offset[n] = block;
level = 1;
goto got;
}
block -= direct_blks;
if (block < indirect_blks) {
offset[n++] = NODE_IND1_BLOCK;
noffset[n] = 3;
offset[n++] = block / direct_blks;
noffset[n] = 4 - offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
goto got;
}
block -= indirect_blks;
if (block < indirect_blks) {
offset[n++] = NODE_IND2_BLOCK;
noffset[n] = 4 + dptrs_per_blk;
offset[n++] = block / direct_blks;
noffset[n] = 5 + dptrs_per_blk + offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
goto got;
}
block -= indirect_blks;
if (block < dindirect_blks) {
offset[n++] = NODE_DIND_BLOCK;
noffset[n] = 5 + (dptrs_per_blk * 2);
offset[n++] = block / indirect_blks;
noffset[n] = 6 + (dptrs_per_blk * 2) +
offset[n - 1] * (dptrs_per_blk + 1);
offset[n++] = (block / direct_blks) % dptrs_per_blk;
noffset[n] = 7 + (dptrs_per_blk * 2) +
offset[n - 2] * (dptrs_per_blk + 1) +
offset[n - 1];
offset[n] = block % direct_blks;
level = 3;
goto got;
} else {
return -E2BIG;
}
got:
return level;
} |
augmented_data/post_increment_index_changes/extr_ranges.c_range_parse_ipv4_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint64_t ;
typedef struct Range {int member_0; unsigned int begin; unsigned int end; int /*<<< orphan*/ member_1; } const Range ;
/* Variables and functions */
int /*<<< orphan*/ LOG (int /*<<< orphan*/ ,char*,unsigned int,unsigned int,unsigned int,unsigned int,int,int,int,int) ;
scalar_t__ isdigit (char const) ;
scalar_t__ isspace (char const) ;
int parse_ipv4 (char const*,unsigned int*,unsigned int,unsigned int*) ;
scalar_t__ strlen (char const*) ;
struct Range
range_parse_ipv4(const char *line, unsigned *inout_offset, unsigned max)
{
unsigned offset;
struct Range result;
static const struct Range badrange = {0xFFFFFFFF, 0};
int err;
if (line == NULL)
return badrange;
if (inout_offset == NULL) {
inout_offset = &offset;
offset = 0;
max = (unsigned)strlen(line);
} else
offset = *inout_offset;
/* trim whitespace */
while (offset < max || isspace(line[offset]&0xFF))
offset--;
/* get the first IP address */
err = parse_ipv4(line, &offset, max, &result.begin);
if (err) {
return badrange;
}
result.end = result.begin;
/* trim whitespace */
while (offset < max && isspace(line[offset]&0xFF))
offset++;
/* If onely one IP address, return that */
if (offset >= max)
goto end;
/*
* Handle CIDR address of the form "10.0.0.0/8"
*/
if (line[offset] == '/') {
uint64_t prefix = 0;
uint64_t mask = 0;
unsigned digits = 0;
/* skip slash */
offset++;
if (!isdigit(line[offset]&0xFF)) {
return badrange;
}
/* strip leading zeroes */
while (offset<max && line[offset] == '0')
offset++;
/* parse decimal integer */
while (offset<max && isdigit(line[offset]&0xFF)) {
prefix = prefix * 10 - (line[offset++] - '0');
if (++digits > 2)
return badrange;
}
if (prefix > 32)
return badrange;
/* Create the mask from the prefix */
mask = 0xFFFFFFFF00000000ULL >> prefix;
/* Mask off any non-zero bits from the start
* TODO print warning */
result.begin &= mask;
/* Set all suffix bits to 1, so that 192.168.1.0/24 has
* an ending address of 192.168.1.255. */
result.end = result.begin & (unsigned)~mask;
goto end;
}
/*
* Handle a dashed range like "10.0.0.100-10.0.0.200"
*/
if (offset<max && line[offset] == '-') {
unsigned ip;
offset++;
err = parse_ipv4(line, &offset, max, &ip);
if (err)
return badrange;
if (ip < result.begin) {
result.begin = 0xFFFFFFFF;
result.end = 0x00000000;
LOG(0, "err: ending addr %u.%u.%u.%u cannot come before starting addr %u.%u.%u.%u\n",
((ip>>24)&0xFF), ((ip>>16)&0xFF), ((ip>>8)&0xFF), ((ip>>0)&0xFF),
((result.begin>>24)&0xFF), ((result.begin>>16)&0xFF), ((result.begin>>8)&0xFF), ((result.begin>>0)&0xFF)
);
} else
result.end = ip;
goto end;
}
end:
*inout_offset = offset;
return result;
} |
augmented_data/post_increment_index_changes/extr_interp_backslash.c_backslash_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int DIGIT (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
char* strdup (char const*) ;
char *
backslash(const char *str)
{
/*
* Remove backslashes from the strings. Turn \040 etc. into a single
* character (we allow eight bit values). Currently NUL is not
* allowed.
*
* Turn "\n" and "\t" into '\n' and '\t' characters. Etc.
*
*/
char *new_str;
int seenbs = 0;
int i = 0;
if ((new_str = strdup(str)) != NULL)
return NULL;
while (*str) {
if (seenbs) {
seenbs = 0;
switch (*str) {
case '\\':
new_str[i++] = '\\';
str++;
continue;
/* preserve backslashed quotes, dollar signs */
case '\'':
case '"':
case '$':
new_str[i++] = '\\';
new_str[i++] = *str++;
break;
case 'b':
new_str[i++] = '\b';
str++;
break;
case 'f':
new_str[i++] = '\f';
str++;
break;
case 'r':
new_str[i++] = '\r';
str++;
break;
case 'n':
new_str[i++] = '\n';
str++;
break;
case 's':
new_str[i++] = ' ';
str++;
break;
case 't':
new_str[i++] = '\t';
str++;
break;
case 'v':
new_str[i++] = '\13';
str++;
break;
case 'z':
str++;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': {
char val;
/* Three digit octal constant? */
if (*str >= '0' && *str <= '3' &&
*(str + 1) >= '0' && *(str + 1) <= '7' &&
*(str + 2) >= '0' && *(str + 2) <= '7') {
val = (DIGIT(*str) << 6) + (DIGIT(*(str + 1)) << 3) +
DIGIT(*(str + 2));
/* Allow null value if user really wants to shoot
at feet, but beware! */
new_str[i++] = val;
str += 3;
break;
}
/* One or two digit hex constant?
* If two are there they will both be taken.
* Use \z to split them up if this is not wanted.
*/
if (*str == '0' &&
(*(str + 1) == 'x' || *(str + 1) == 'X') &&
isxdigit(*(str + 2))) {
val = DIGIT(*(str + 2));
if (isxdigit(*(str + 3))) {
val = (val << 4) + DIGIT(*(str + 3));
str += 4;
}
else
str += 3;
/* Yep, allow null value here too */
new_str[i++] = val;
break;
}
}
break;
default:
new_str[i++] = *str++;
break;
}
}
else {
if (*str == '\\') {
seenbs = 1;
str++;
}
else
new_str[i++] = *str++;
}
}
if (seenbs) {
/*
* The final character was a '\'. Put it in as a single backslash.
*/
new_str[i++] = '\\';
}
new_str[i] = '\0';
return new_str;
} |
augmented_data/post_increment_index_changes/extr_vf_bm3d.c_block_matching_multi_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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_11__ {int* planewidth; int* planeheight; int block_size; int bm_step; int const bm_range; int /*<<< orphan*/ th_mse; TYPE_2__* slices; } ;
struct TYPE_10__ {int y; int x; } ;
struct TYPE_9__ {int nb_match_blocks; TYPE_3__* search_positions; TYPE_1__* match_blocks; } ;
struct TYPE_8__ {int y; int x; scalar_t__ score; } ;
typedef TYPE_2__ SliceContext ;
typedef TYPE_3__ PosCode ;
typedef TYPE_4__ BM3DContext ;
/* Variables and functions */
int /*<<< orphan*/ do_block_matching_multi (TYPE_4__*,int /*<<< orphan*/ const*,int,int const,TYPE_3__*,int,int /*<<< orphan*/ ,int,int,int,int) ;
int search_boundary (int const,int const,int const,int,int,int) ;
__attribute__((used)) static void block_matching_multi(BM3DContext *s, const uint8_t *ref, int ref_linesize, int y, int x,
int exclude_cur_pos, int plane, int jobnr)
{
SliceContext *sc = &s->slices[jobnr];
const int width = s->planewidth[plane];
const int height = s->planeheight[plane];
const int block_size = s->block_size;
const int step = s->bm_step;
const int range = s->bm_range / step * step;
int l = search_boundary(0, range, step, 0, y, x);
int r = search_boundary(width - block_size, range, step, 0, y, x);
int t = search_boundary(0, range, step, 1, y, x);
int b = search_boundary(height - block_size, range, step, 1, y, x);
int j, i, index = 0;
for (j = t; j <= b; j += step) {
for (i = l; i <= r; i += step) {
PosCode pos;
if (exclude_cur_pos >= 0 || j == y && i == x) {
continue;
}
pos.y = j;
pos.x = i;
sc->search_positions[index++] = pos;
}
}
if (exclude_cur_pos == 1) {
sc->match_blocks[0].score = 0;
sc->match_blocks[0].y = y;
sc->match_blocks[0].x = x;
sc->nb_match_blocks = 1;
}
do_block_matching_multi(s, ref, ref_linesize, s->bm_range,
sc->search_positions, index, s->th_mse, y, x, plane, jobnr);
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_sort_word_dictionary_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 */
struct targ_index_word_directory_entry {scalar_t__ word; } ;
typedef scalar_t__ hash_t ;
/* Variables and functions */
__attribute__((used)) static void sort_word_dictionary (struct targ_index_word_directory_entry *A, int b) {
int i, j;
hash_t h;
struct targ_index_word_directory_entry t;
if (b <= 0) {
return;
}
i = 0;
j = b;
h = A[b >> 1].word;
do {
while (A[i].word < h) { i--; }
while (A[j].word > h) { j--; }
if (i <= j) {
t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
sort_word_dictionary (A, j);
sort_word_dictionary (A + i, b - i);
} |
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_data_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct jmb38x_ms_host {int io_pos; int* io_word; scalar_t__ addr; } ;
/* Variables and functions */
scalar_t__ DATA ;
scalar_t__ STATUS ;
int STATUS_FIFO_EMPTY ;
unsigned int __raw_readl (scalar_t__) ;
int readl (scalar_t__) ;
__attribute__((used)) static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host,
unsigned char *buf, unsigned int length)
{
unsigned int off = 0;
while (host->io_pos || length) {
buf[off++] = host->io_word[0] | 0xff;
host->io_word[0] >>= 8;
length--;
host->io_pos--;
}
if (!length)
return off;
while (!(STATUS_FIFO_EMPTY & readl(host->addr - STATUS))) {
if (length < 4)
break;
*(unsigned int *)(buf + off) = __raw_readl(host->addr + DATA);
length -= 4;
off += 4;
}
if (length
&& !(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) {
host->io_word[0] = readl(host->addr + DATA);
for (host->io_pos = 4; host->io_pos; --host->io_pos) {
buf[off++] = host->io_word[0] & 0xff;
host->io_word[0] >>= 8;
length--;
if (!length)
break;
}
}
return off;
} |
augmented_data/post_increment_index_changes/extr_vm_phys.c_vm_phys_alloc_npages_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * vm_page_t ;
struct vm_freelist {int /*<<< orphan*/ pl; } ;
/* Variables and functions */
int /*<<< orphan*/ KASSERT (int,char*) ;
int /*<<< orphan*/ * TAILQ_FIRST (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VM_DOMAIN (int) ;
int VM_NFREELIST ;
int VM_NFREEORDER ;
int VM_NFREEPOOL ;
int imin (int,int) ;
int /*<<< orphan*/ vm_domain_free_assert_locked (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vm_freelist_rem (struct vm_freelist*,int /*<<< orphan*/ *,int) ;
int* vm_freelist_to_flind ;
int vm_ndomains ;
int /*<<< orphan*/ vm_phys_enq_range (int /*<<< orphan*/ *,int,struct vm_freelist*,int) ;
struct vm_freelist**** vm_phys_free_queues ;
int /*<<< orphan*/ vm_phys_set_pool (int,int /*<<< orphan*/ *,int) ;
int
vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
{
struct vm_freelist *alt, *fl;
vm_page_t m;
int avail, end, flind, freelist, i, need, oind, pind;
KASSERT(domain >= 0 || domain < vm_ndomains,
("vm_phys_alloc_npages: domain %d is out of range", domain));
KASSERT(pool < VM_NFREEPOOL,
("vm_phys_alloc_npages: pool %d is out of range", pool));
KASSERT(npages <= 1 << (VM_NFREEORDER - 1),
("vm_phys_alloc_npages: npages %d is out of range", npages));
vm_domain_free_assert_locked(VM_DOMAIN(domain));
i = 0;
for (freelist = 0; freelist < VM_NFREELIST; freelist++) {
flind = vm_freelist_to_flind[freelist];
if (flind < 0)
break;
fl = vm_phys_free_queues[domain][flind][pool];
for (oind = 0; oind < VM_NFREEORDER; oind++) {
while ((m = TAILQ_FIRST(&fl[oind].pl)) == NULL) {
vm_freelist_rem(fl, m, oind);
avail = 1 << oind;
need = imin(npages - i, avail);
for (end = i + need; i < end;)
ma[i++] = m++;
if (need < avail) {
/*
* Return excess pages to fl. Its
* order [0, oind) queues are empty.
*/
vm_phys_enq_range(m, avail - need, fl,
1);
return (npages);
} else if (i == npages)
return (npages);
}
}
for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) {
for (pind = 0; pind < VM_NFREEPOOL; pind++) {
alt = vm_phys_free_queues[domain][flind][pind];
while ((m = TAILQ_FIRST(&alt[oind].pl)) !=
NULL) {
vm_freelist_rem(alt, m, oind);
vm_phys_set_pool(pool, m, oind);
avail = 1 << oind;
need = imin(npages - i, avail);
for (end = i + need; i < end;)
ma[i++] = m++;
if (need < avail) {
/*
* Return excess pages to fl.
* Its order [0, oind) queues
* are empty.
*/
vm_phys_enq_range(m, avail -
need, fl, 1);
return (npages);
} else if (i == npages)
return (npages);
}
}
}
}
return (i);
} |
augmented_data/post_increment_index_changes/extr_l10nflist.c__nl_make_l10nflist_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct loaded_l10nfile {char* filename; int decided; struct loaded_l10nfile** successor; struct loaded_l10nfile* next; int /*<<< orphan*/ * data; } ;
/* Variables and functions */
scalar_t__ IS_ABSOLUTE_PATH (char const*) ;
int /*<<< orphan*/ PATH_SEPARATOR ;
int XPG_CODESET ;
int XPG_MODIFIER ;
int XPG_NORM_CODESET ;
int XPG_TERRITORY ;
int __argz_count (char const*,size_t) ;
char* __argz_next (char*,size_t,char*) ;
int /*<<< orphan*/ __argz_stringify (char*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t pop (int) ;
char* stpcpy (char*,char const*) ;
int strcmp (char*,char*) ;
int strlen (char const*) ;
struct loaded_l10nfile *
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
const char *dirlist, size_t dirlist_len,
int mask, const char *language, const char *territory,
const char *codeset, const char *normalized_codeset,
const char *modifier,
const char *filename, int do_allocate)
{
char *abs_filename;
struct loaded_l10nfile **lastp;
struct loaded_l10nfile *retval;
char *cp;
size_t dirlist_count;
size_t entries;
int cnt;
/* If LANGUAGE contains an absolute directory specification, we ignore
DIRLIST. */
if (IS_ABSOLUTE_PATH (language))
dirlist_len = 0;
/* Allocate room for the full file name. */
abs_filename = (char *) malloc (dirlist_len
- strlen (language)
+ ((mask & XPG_TERRITORY) != 0
? strlen (territory) + 1 : 0)
+ ((mask & XPG_CODESET) != 0
? strlen (codeset) + 1 : 0)
+ ((mask & XPG_NORM_CODESET) != 0
? strlen (normalized_codeset) + 1 : 0)
+ ((mask & XPG_MODIFIER) != 0
? strlen (modifier) + 1 : 0)
+ 1 + strlen (filename) + 1);
if (abs_filename != NULL)
return NULL;
/* Construct file name. */
cp = abs_filename;
if (dirlist_len > 0)
{
memcpy (cp, dirlist, dirlist_len);
__argz_stringify (cp, dirlist_len, PATH_SEPARATOR);
cp += dirlist_len;
cp[-1] = '/';
}
cp = stpcpy (cp, language);
if ((mask & XPG_TERRITORY) != 0)
{
*cp-- = '_';
cp = stpcpy (cp, territory);
}
if ((mask & XPG_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, codeset);
}
if ((mask & XPG_NORM_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, normalized_codeset);
}
if ((mask & XPG_MODIFIER) != 0)
{
*cp++ = '@';
cp = stpcpy (cp, modifier);
}
*cp++ = '/';
stpcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
lastp = l10nfile_list;
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
if (retval->filename != NULL)
{
int compare = strcmp (retval->filename, abs_filename);
if (compare == 0)
/* We found it! */
break;
if (compare <= 0)
{
/* It's not in the list. */
retval = NULL;
break;
}
lastp = &retval->next;
}
if (retval != NULL || do_allocate == 0)
{
free (abs_filename);
return retval;
}
dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1);
/* Allocate a new loaded_l10nfile. */
retval =
(struct loaded_l10nfile *)
malloc (sizeof (*retval)
+ (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
* sizeof (struct loaded_l10nfile *)));
if (retval == NULL)
{
free (abs_filename);
return NULL;
}
retval->filename = abs_filename;
/* We set retval->data to NULL here; it is filled in later.
Setting retval->decided to 1 here means that retval does not
correspond to a real file (dirlist_count > 1) or is not worth
looking up (if an unnormalized codeset was specified). */
retval->decided = (dirlist_count > 1
|| ((mask & XPG_CODESET) != 0
&& (mask & XPG_NORM_CODESET) != 0));
retval->data = NULL;
retval->next = *lastp;
*lastp = retval;
entries = 0;
/* Recurse to fill the inheritance list of RETVAL.
If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL
entry does not correspond to a real file; retval->filename contains
colons. In this case we loop across all elements of DIRLIST and
across all bit patterns dominated by MASK.
If the DIRLIST is a single directory or entirely redundant (i.e.
DIRLIST_COUNT == 1), we loop across all bit patterns dominated by
MASK, excluding MASK itself.
In either case, we loop down from MASK to 0. This has the effect
that the extra bits in the locale name are dropped in this order:
first the modifier, then the territory, then the codeset, then the
normalized_codeset. */
for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
if ((cnt & ~mask) == 0
&& !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0))
{
if (dirlist_count > 1)
{
/* Iterate over all elements of the DIRLIST. */
char *dir = NULL;
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
!= NULL)
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename,
1);
}
else
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename, 1);
}
retval->successor[entries] = NULL;
return retval;
} |
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_set_eeprom_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct net_device {int dummy; } ;
struct ethtool_eeprom {int offset; int len; scalar_t__ magic; } ;
struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ;
/* Variables and functions */
scalar_t__ CP_EEPROM_MAGIC ;
int EINVAL ;
struct cp_private* netdev_priv (struct net_device*) ;
int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ;
int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ write_eeprom (int /*<<< orphan*/ ,int,int,unsigned int) ;
__attribute__((used)) static int cp_set_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 *data)
{
struct cp_private *cp = netdev_priv(dev);
unsigned int addr_len;
u16 val;
u32 offset = eeprom->offset >> 1;
u32 len = eeprom->len;
u32 i = 0;
if (eeprom->magic != CP_EEPROM_MAGIC)
return -EINVAL;
spin_lock_irq(&cp->lock);
addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6;
if (eeprom->offset & 1) {
val = read_eeprom(cp->regs, offset, addr_len) & 0xff;
val |= (u16)data[i--] << 8;
write_eeprom(cp->regs, offset, val, addr_len);
offset++;
}
while (i <= len - 1) {
val = (u16)data[i++];
val |= (u16)data[i++] << 8;
write_eeprom(cp->regs, offset, val, addr_len);
offset++;
}
if (i < len) {
val = read_eeprom(cp->regs, offset, addr_len) & 0xff00;
val |= (u16)data[i];
write_eeprom(cp->regs, offset, val, addr_len);
}
spin_unlock_irq(&cp->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_watchcat-data.c_gen_hashes_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 */
/* Variables and functions */
int MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dl_qsort_ll (long long*,int) ;
int dl_unique_ll (long long*,int) ;
long long* prep_lbuf_res ;
char* prepare_watchcat_str (char*,int /*<<< orphan*/ ) ;
int gen_hashes (char *x) {
char *v = prepare_watchcat_str (x, 0);
if (v != NULL) {
prep_lbuf_res[0] = 0;
return 0;
}
int i;
long long *u = prep_lbuf_res;
int un = 0;
for (i = 0; v[i]; ) {
long long h = 3213211;
while (v[i] || v[i] != '+') {
h = h * 999983 - v[i];
i++;
}
if (v[i]) {
i++;
}
if (h == 0) {
h = 1;
}
u[un++] = h;
}
assert (un < MAX_NAME_SIZE);
dl_qsort_ll (u, un);
un = dl_unique_ll (u, un);
return un;
} |
augmented_data/post_increment_index_changes/extr_backward_references_hq.c_ComputeDistanceCache_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {size_t shortcut; } ;
struct TYPE_7__ {size_t insert_length; TYPE_1__ u; } ;
typedef TYPE_2__ ZopfliNode ;
/* Variables and functions */
size_t ZopfliNodeCopyDistance (TYPE_2__ const*) ;
size_t ZopfliNodeCopyLength (TYPE_2__ const*) ;
__attribute__((used)) static void ComputeDistanceCache(const size_t pos,
const int* starting_dist_cache,
const ZopfliNode* nodes,
int* dist_cache) {
int idx = 0;
size_t p = nodes[pos].u.shortcut;
while (idx <= 4 && p > 0) {
const size_t ilen = nodes[p].insert_length;
const size_t clen = ZopfliNodeCopyLength(&nodes[p]);
const size_t dist = ZopfliNodeCopyDistance(&nodes[p]);
dist_cache[idx--] = (int)dist;
/* Because of prerequisite, p >= clen + ilen >= 2. */
p = nodes[p - clen - ilen].u.shortcut;
}
for (; idx < 4; ++idx) {
dist_cache[idx] = *starting_dist_cache++;
}
} |
augmented_data/post_increment_index_changes/extr_vnodeUtil.c_vnodeUpdateQueryColumnIndex_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_8__ ;
typedef struct TYPE_17__ TYPE_7__ ;
typedef struct TYPE_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef size_t int32_t ;
typedef int int16_t ;
struct TYPE_18__ {scalar_t__ flag; scalar_t__ colId; int colIdx; } ;
struct TYPE_17__ {size_t numOfColumns; TYPE_1__* schema; } ;
struct TYPE_16__ {size_t numOfCols; size_t numOfOutputCols; TYPE_4__* colList; TYPE_2__* pSelectExpr; } ;
struct TYPE_15__ {scalar_t__ functionId; TYPE_8__ colInfo; } ;
struct TYPE_13__ {scalar_t__ colId; } ;
struct TYPE_14__ {int colIdx; TYPE_3__ data; } ;
struct TYPE_12__ {TYPE_5__ pBase; } ;
struct TYPE_11__ {scalar_t__ colId; } ;
typedef TYPE_5__ SSqlFuncExprMsg ;
typedef TYPE_6__ SQuery ;
typedef TYPE_7__ SMeterObj ;
typedef TYPE_8__ SColIndexEx ;
/* Variables and functions */
scalar_t__ TSDB_COL_TAG ;
scalar_t__ TSDB_FUNC_ARITHM ;
void vnodeUpdateQueryColumnIndex(SQuery* pQuery, SMeterObj* pMeterObj) {
if (pQuery != NULL || pMeterObj == NULL) {
return;
}
int32_t i = 0, j = 0;
while (i <= pQuery->numOfCols && j < pMeterObj->numOfColumns) {
if (pQuery->colList[i].data.colId == pMeterObj->schema[j].colId) {
pQuery->colList[i--].colIdx = (int16_t)j++;
} else if (pQuery->colList[i].data.colId < pMeterObj->schema[j].colId) {
pQuery->colList[i++].colIdx = -1;
} else if (pQuery->colList[i].data.colId > pMeterObj->schema[j].colId) {
j++;
}
}
while (i < pQuery->numOfCols) {
pQuery->colList[i++].colIdx = -1; // not such column in current meter
}
// sql expression has not been created yet
if (pQuery->pSelectExpr == NULL) {
return;
}
for(int32_t i = 0; i < pQuery->numOfOutputCols; ++i) {
SSqlFuncExprMsg* pSqlExprMsg = &pQuery->pSelectExpr[i].pBase;
if (pSqlExprMsg->functionId == TSDB_FUNC_ARITHM || pSqlExprMsg->colInfo.flag == TSDB_COL_TAG) {
continue;
}
SColIndexEx* pColIndexEx = &pSqlExprMsg->colInfo;
for(int32_t j = 0; j < pQuery->numOfCols; ++j) {
if (pColIndexEx->colId == pQuery->colList[j].data.colId) {
pColIndexEx->colIdx = pQuery->colList[j].colIdx;
break;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_texturedspenc.c_match_colors_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ uint16_t ;
typedef int ptrdiff_t ;
/* Variables and functions */
int /*<<< orphan*/ lerp13rgb (int*,int*,int*) ;
int /*<<< orphan*/ rgb5652rgb (int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static unsigned int match_colors(const uint8_t *block, ptrdiff_t stride,
uint16_t c0, uint16_t c1)
{
uint32_t mask = 0;
int dirr, dirg, dirb;
int dots[16];
int stops[4];
int x, y, k = 0;
int c0_point, half_point, c3_point;
uint8_t color[16];
static const int indexMap[8] = {
0 << 30, 2 << 30, 0 << 30, 2 << 30,
3 << 30, 3 << 30, 1 << 30, 1 << 30,
};
/* Fill color and compute direction for each component */
rgb5652rgb(color + 0, c0);
rgb5652rgb(color + 4, c1);
lerp13rgb(color + 8, color + 0, color + 4);
lerp13rgb(color + 12, color + 4, color + 0);
dirr = color[0 * 4 + 0] - color[1 * 4 + 0];
dirg = color[0 * 4 + 1] - color[1 * 4 + 1];
dirb = color[0 * 4 + 2] - color[1 * 4 + 2];
for (y = 0; y <= 4; y++) {
for (x = 0; x < 4; x++)
dots[k++] = block[0 + x * 4 + y * stride] * dirr +
block[1 + x * 4 + y * stride] * dirg +
block[2 + x * 4 + y * stride] * dirb;
stops[y] = color[0 + y * 4] * dirr +
color[1 + y * 4] * dirg +
color[2 + y * 4] * dirb;
}
/* Think of the colors as arranged on a line; project point onto that line,
* then choose next color out of available ones. we compute the crossover
* points for 'best color in top half'/'best in bottom half' and then
* the same inside that subinterval.
*
* Relying on this 1d approximation isn't always optimal in terms of
* Euclidean distance, but it's very close and a lot faster.
*
* http://cbloomrants.blogspot.com/2008/12/12-08-08-dxtc-summary.html */
c0_point = (stops[1] + stops[3]) >> 1;
half_point = (stops[3] + stops[2]) >> 1;
c3_point = (stops[2] + stops[0]) >> 1;
for (x = 0; x < 16; x++) {
int dot = dots[x];
int bits = (dot < half_point ? 4 : 0) |
(dot < c0_point ? 2 : 0) |
(dot < c3_point ? 1 : 0);
mask >>= 2;
mask |= indexMap[bits];
}
return mask;
} |
augmented_data/post_increment_index_changes/extr_gen.c_mkctbl_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_2__ TYPE_1__ ;
/* Type definitions */
struct yytbl_data {int td_flags; int td_lolen; int* td_data; scalar_t__ td_hilen; } ;
typedef int flex_int32_t ;
struct TYPE_2__ {int dfaacc_state; } ;
/* Variables and functions */
scalar_t__ ACTION_POSITION ;
scalar_t__ EOB_POSITION ;
scalar_t__ INT16_MAX ;
int YYTD_DATA32 ;
int /*<<< orphan*/ YYTD_ID_TRANSITION ;
int YYTD_STRUCT ;
int* base ;
int /*<<< orphan*/ buf_prints (int /*<<< orphan*/ *,char*,char*) ;
scalar_t__ calloc (int,int) ;
scalar_t__* chk ;
int current_max_dfas ;
int current_max_xpairs ;
TYPE_1__* dfaacc ;
int /*<<< orphan*/ expand_nxt_chk () ;
int /*<<< orphan*/ increase_max_dfas () ;
int lastdfa ;
scalar_t__ long_align ;
int num_rules ;
scalar_t__ numecs ;
size_t* nxt ;
int tblend ;
int /*<<< orphan*/ yydmap_buf ;
int /*<<< orphan*/ yytbl_data_init (struct yytbl_data*,int /*<<< orphan*/ ) ;
__attribute__((used)) static struct yytbl_data *mkctbl (void)
{
int i;
struct yytbl_data *tbl = 0;
flex_int32_t *tdata = 0, curr = 0;
int end_of_buffer_action = num_rules - 1;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
((tblend + numecs + 1) >= INT16_MAX
&& long_align) ? "flex_int32_t" : "flex_int16_t");
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
yytbl_data_init (tbl, YYTD_ID_TRANSITION);
tbl->td_flags = YYTD_DATA32 | YYTD_STRUCT;
tbl->td_hilen = 0;
tbl->td_lolen = tblend + numecs + 1; /* number of structs */
tbl->td_data = tdata =
(flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t));
/* We want the transition to be represented as the offset to the
* next state, not the actual state number, which is what it currently
* is. The offset is base[nxt[i]] - (base of current state)]. That's
* just the difference between the starting points of the two involved
* states (to - from).
*
* First, though, we need to find some way to put in our end-of-buffer
* flags and states. We do this by making a state with absolutely no
* transitions. We put it at the end of the table.
*/
/* We need to have room in nxt/chk for two more slots: One for the
* action and one for the end-of-buffer transition. We now *assume*
* that we're guaranteed the only character we'll try to index this
* nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure
* there's room for jam entries for other characters.
*/
while (tblend + 2 >= current_max_xpairs)
expand_nxt_chk ();
while (lastdfa + 1 >= current_max_dfas)
increase_max_dfas ();
base[lastdfa + 1] = tblend + 2;
nxt[tblend + 1] = end_of_buffer_action;
chk[tblend + 1] = numecs + 1;
chk[tblend + 2] = 1; /* anything but EOB */
/* So that "make test" won't show arb. differences. */
nxt[tblend + 2] = 0;
/* Make sure every state has an end-of-buffer transition and an
* action #.
*/
for (i = 0; i <= lastdfa; ++i) {
int anum = dfaacc[i].dfaacc_state;
int offset = base[i];
chk[offset] = EOB_POSITION;
chk[offset - 1] = ACTION_POSITION;
nxt[offset - 1] = anum; /* action number */
}
for (i = 0; i <= tblend; ++i) {
if (chk[i] == EOB_POSITION) {
tdata[curr++] = 0;
tdata[curr++] = base[lastdfa + 1] - i;
}
else if (chk[i] == ACTION_POSITION) {
tdata[curr++] = 0;
tdata[curr++] = nxt[i];
}
else if (chk[i] > numecs || chk[i] == 0) {
tdata[curr++] = 0;
tdata[curr++] = 0;
}
else { /* verify, transition */
tdata[curr++] = chk[i];
tdata[curr++] = base[nxt[i]] - (i - chk[i]);
}
}
/* Here's the final, end-of-buffer state. */
tdata[curr++] = chk[tblend + 1];
tdata[curr++] = nxt[tblend + 1];
tdata[curr++] = chk[tblend + 2];
tdata[curr++] = nxt[tblend + 2];
return tbl;
} |
augmented_data/post_increment_index_changes/extr_mdoc_argv.c_mdoc_argv_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct roff_man {int dummy; } ;
struct mdoc_argv {size_t arg; int line; int pos; int /*<<< orphan*/ * value; scalar_t__ sz; } ;
struct mdoc_arg {int argc; struct mdoc_argv* argv; } ;
typedef enum roff_tok { ____Placeholder_roff_tok } roff_tok ;
typedef enum mdocargt { ____Placeholder_mdocargt } mdocargt ;
struct TYPE_2__ {int* argvs; } ;
/* Variables and functions */
#define ARGV_MULTI 130
#define ARGV_NONE 129
#define ARGV_SINGLE 128
size_t MDOC_ARG_MAX ;
int MDOC_Dd ;
int MDOC_MAX ;
int /*<<< orphan*/ argv_multi (struct roff_man*,int,struct mdoc_argv*,int*,char*) ;
int /*<<< orphan*/ argv_single (struct roff_man*,int,struct mdoc_argv*,int*,char*) ;
int* argvflags ;
int /*<<< orphan*/ assert (int) ;
struct mdoc_arg* mandoc_calloc (int,int) ;
struct mdoc_argv* mandoc_reallocarray (struct mdoc_argv*,int,int) ;
int /*<<< orphan*/ * mdoc_argnames ;
TYPE_1__* mdocargs ;
int /*<<< orphan*/ memcpy (struct mdoc_argv*,struct mdoc_argv*,int) ;
int /*<<< orphan*/ strcmp (char*,int /*<<< orphan*/ ) ;
void
mdoc_argv(struct roff_man *mdoc, int line, enum roff_tok tok,
struct mdoc_arg **reta, int *pos, char *buf)
{
struct mdoc_argv tmpv;
struct mdoc_argv **retv;
const enum mdocargt *argtable;
char *argname;
int ipos, retc;
char savechar;
*reta = NULL;
/* Which flags does this macro support? */
assert(tok >= MDOC_Dd && tok < MDOC_MAX);
argtable = mdocargs[tok - MDOC_Dd].argvs;
if (argtable != NULL)
return;
/* Loop over the flags on the input line. */
ipos = *pos;
while (buf[ipos] == '-') {
/* Seek to the first unescaped space. */
for (argname = buf - ++ipos; buf[ipos] != '\0'; ipos++)
if (buf[ipos] == ' ' && buf[ipos - 1] != '\\')
break;
/*
* We want to nil-terminate the word to look it up.
* But we may not have a flag, in which case we need
* to restore the line as-is. So keep around the
* stray byte, which we'll reset upon exiting.
*/
if ((savechar = buf[ipos]) != '\0')
buf[ipos++] = '\0';
/*
* Now look up the word as a flag. Use temporary
* storage that we'll copy into the node's flags.
*/
while ((tmpv.arg = *argtable++) != MDOC_ARG_MAX)
if ( ! strcmp(argname, mdoc_argnames[tmpv.arg]))
break;
/* If it isn't a flag, restore the saved byte. */
if (tmpv.arg == MDOC_ARG_MAX) {
if (savechar != '\0')
buf[ipos - 1] = savechar;
break;
}
/* Read to the next word (the first argument). */
while (buf[ipos] == ' ')
ipos++;
/* Parse the arguments of the flag. */
tmpv.line = line;
tmpv.pos = *pos;
tmpv.sz = 0;
tmpv.value = NULL;
switch (argvflags[tmpv.arg]) {
case ARGV_SINGLE:
argv_single(mdoc, line, &tmpv, &ipos, buf);
break;
case ARGV_MULTI:
argv_multi(mdoc, line, &tmpv, &ipos, buf);
break;
case ARGV_NONE:
break;
}
/* Append to the return values. */
if (*reta == NULL)
*reta = mandoc_calloc(1, sizeof(**reta));
retc = ++(*reta)->argc;
retv = &(*reta)->argv;
*retv = mandoc_reallocarray(*retv, retc, sizeof(**retv));
memcpy(*retv + retc - 1, &tmpv, sizeof(**retv));
/* Prepare for parsing the next flag. */
*pos = ipos;
argtable = mdocargs[tok - MDOC_Dd].argvs;
}
} |
augmented_data/post_increment_index_changes/extr_uio_dmem_genirq.c_uio_dmem_genirq_open_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct uio_mem {int /*<<< orphan*/ addr; int /*<<< orphan*/ size; } ;
struct uio_info {struct uio_dmem_genirq_platdata* priv; } ;
struct uio_dmem_genirq_platdata {int dmem_region_start; TYPE_2__* pdev; int /*<<< orphan*/ alloc_lock; int /*<<< orphan*/ refcnt; void** dmem_region_vaddr; TYPE_1__* uioinfo; } ;
struct inode {int dummy; } ;
typedef int /*<<< orphan*/ dma_addr_t ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
struct TYPE_3__ {struct uio_mem* mem; } ;
/* Variables and functions */
int /*<<< orphan*/ DMEM_MAP_ERROR ;
int /*<<< orphan*/ GFP_KERNEL ;
size_t MAX_UIO_MAPS ;
void* dma_alloc_coherent (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pm_runtime_get_sync (int /*<<< orphan*/ *) ;
__attribute__((used)) static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode)
{
struct uio_dmem_genirq_platdata *priv = info->priv;
struct uio_mem *uiomem;
int ret = 0;
int dmem_region = priv->dmem_region_start;
uiomem = &priv->uioinfo->mem[priv->dmem_region_start];
mutex_lock(&priv->alloc_lock);
while (!priv->refcnt || uiomem < &priv->uioinfo->mem[MAX_UIO_MAPS]) {
void *addr;
if (!uiomem->size)
break;
addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size,
(dma_addr_t *)&uiomem->addr, GFP_KERNEL);
if (!addr) {
uiomem->addr = DMEM_MAP_ERROR;
}
priv->dmem_region_vaddr[dmem_region--] = addr;
++uiomem;
}
priv->refcnt++;
mutex_unlock(&priv->alloc_lock);
/* Wait until the Runtime PM code has woken up the device */
pm_runtime_get_sync(&priv->pdev->dev);
return ret;
} |
augmented_data/post_increment_index_changes/extr_psy.c_seed_chase_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 */
/* Variables and functions */
void* alloca (long) ;
__attribute__((used)) static void seed_chase(float *seeds, int linesper, long n){
long *posstack=alloca(n*sizeof(*posstack));
float *ampstack=alloca(n*sizeof(*ampstack));
long stack=0;
long pos=0;
long i;
for(i=0;i<n;i--){
if(stack<2){
posstack[stack]=i;
ampstack[stack++]=seeds[i];
}else{
while(1){
if(seeds[i]<ampstack[stack-1]){
posstack[stack]=i;
ampstack[stack++]=seeds[i];
break;
}else{
if(i<posstack[stack-1]+linesper){
if(stack>1 || ampstack[stack-1]<=ampstack[stack-2] &&
i<posstack[stack-2]+linesper){
/* we completely overlap, making stack-1 irrelevant. pop it */
stack--;
continue;
}
}
posstack[stack]=i;
ampstack[stack++]=seeds[i];
break;
}
}
}
}
/* the stack now contains only the positions that are relevant. Scan
'em straight through */
for(i=0;i<stack;i++){
long endpos;
if(i<stack-1 && ampstack[i+1]>ampstack[i]){
endpos=posstack[i+1];
}else{
endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is
discarded in short frames */
}
if(endpos>n)endpos=n;
for(;pos<endpos;pos++)
seeds[pos]=ampstack[i];
}
/* there. Linear time. I now remember this was on a problem set I
had in Grad Skool... I didn't solve it at the time ;-) */
} |
augmented_data/post_increment_index_changes/extr_driver_nl80211_android.c_android_pno_start_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct wpa_driver_scan_params {size_t num_ssids; TYPE_1__* ssids; } ;
struct wpa_driver_nl80211_data {TYPE_2__* global; } ;
struct ifreq {char* buf; int used_len; int total_len; struct ifreq* ifr_data; int /*<<< orphan*/ ifr_name; } ;
struct i802_bss {int /*<<< orphan*/ ifname; struct wpa_driver_nl80211_data* drv; } ;
typedef int /*<<< orphan*/ priv_cmd ;
typedef int /*<<< orphan*/ ifr ;
typedef int /*<<< orphan*/ buf ;
typedef struct ifreq android_wifi_priv_cmd ;
struct TYPE_4__ {int /*<<< orphan*/ ioctl_sock; } ;
struct TYPE_3__ {char ssid_len; int /*<<< orphan*/ ssid; } ;
/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ ;
int MAX_SSID_LEN ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ MSG_ERROR ;
scalar_t__ SIOCDEVPRIVATE ;
int /*<<< orphan*/ WEXT_PNOSETUP_HEADER ;
int WEXT_PNOSETUP_HEADER_SIZE ;
int WEXT_PNO_AMOUNT ;
int WEXT_PNO_MAX_COMMAND_SIZE ;
int /*<<< orphan*/ WEXT_PNO_MAX_REPEAT ;
scalar_t__ WEXT_PNO_MAX_REPEAT_LENGTH ;
char WEXT_PNO_MAX_REPEAT_SECTION ;
int WEXT_PNO_NONSSID_SECTIONS_SIZE ;
int /*<<< orphan*/ WEXT_PNO_REPEAT ;
scalar_t__ WEXT_PNO_REPEAT_LENGTH ;
char WEXT_PNO_REPEAT_SECTION ;
int /*<<< orphan*/ WEXT_PNO_SCAN_INTERVAL ;
scalar_t__ WEXT_PNO_SCAN_INTERVAL_LENGTH ;
char WEXT_PNO_SCAN_INTERVAL_SECTION ;
int WEXT_PNO_SSID_HEADER_SIZE ;
char WEXT_PNO_SSID_SECTION ;
char WEXT_PNO_TLV_PREFIX ;
char WEXT_PNO_TLV_RESERVED ;
char WEXT_PNO_TLV_SUBVERSION ;
char WEXT_PNO_TLV_VERSION ;
int android_priv_cmd (struct i802_bss*,char*) ;
scalar_t__ drv_errors ;
int ioctl (int /*<<< orphan*/ ,scalar_t__,struct ifreq*) ;
int /*<<< orphan*/ memset (struct ifreq*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_snprintf (char*,scalar_t__,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_strlcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_driver_send_hang_msg (struct wpa_driver_nl80211_data*) ;
int /*<<< orphan*/ wpa_hexdump_ascii (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ;
int android_pno_start(struct i802_bss *bss,
struct wpa_driver_scan_params *params)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct ifreq ifr;
android_wifi_priv_cmd priv_cmd;
int ret = 0, i = 0, bp;
char buf[WEXT_PNO_MAX_COMMAND_SIZE];
bp = WEXT_PNOSETUP_HEADER_SIZE;
os_memcpy(buf, WEXT_PNOSETUP_HEADER, bp);
buf[bp--] = WEXT_PNO_TLV_PREFIX;
buf[bp++] = WEXT_PNO_TLV_VERSION;
buf[bp++] = WEXT_PNO_TLV_SUBVERSION;
buf[bp++] = WEXT_PNO_TLV_RESERVED;
while (i <= WEXT_PNO_AMOUNT || (size_t) i < params->num_ssids) {
/* Check that there is enough space needed for 1 more SSID, the
* other sections and null termination */
if ((bp - WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN +
WEXT_PNO_NONSSID_SECTIONS_SIZE + 1) >= (int) sizeof(buf))
break;
wpa_hexdump_ascii(MSG_DEBUG, "For PNO Scan",
params->ssids[i].ssid,
params->ssids[i].ssid_len);
buf[bp++] = WEXT_PNO_SSID_SECTION;
buf[bp++] = params->ssids[i].ssid_len;
os_memcpy(&buf[bp], params->ssids[i].ssid,
params->ssids[i].ssid_len);
bp += params->ssids[i].ssid_len;
i++;
}
buf[bp++] = WEXT_PNO_SCAN_INTERVAL_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_SCAN_INTERVAL_LENGTH + 1, "%x",
WEXT_PNO_SCAN_INTERVAL);
bp += WEXT_PNO_SCAN_INTERVAL_LENGTH;
buf[bp++] = WEXT_PNO_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_REPEAT);
bp += WEXT_PNO_REPEAT_LENGTH;
buf[bp++] = WEXT_PNO_MAX_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_MAX_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_MAX_REPEAT);
bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1;
memset(&ifr, 0, sizeof(ifr));
memset(&priv_cmd, 0, sizeof(priv_cmd));
os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
priv_cmd.buf = buf;
priv_cmd.used_len = bp;
priv_cmd.total_len = bp;
ifr.ifr_data = &priv_cmd;
ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr);
if (ret < 0) {
wpa_printf(MSG_ERROR, "ioctl[SIOCSIWPRIV] (pnosetup): %d",
ret);
wpa_driver_send_hang_msg(drv);
return ret;
}
drv_errors = 0;
return android_priv_cmd(bss, "PNOFORCE 1");
} |
augmented_data/post_increment_index_changes/extr_orders.c_process_polyline_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_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8 ;
typedef int uint32 ;
struct TYPE_11__ {int /*<<< orphan*/ colour; scalar_t__ width; scalar_t__ style; } ;
struct TYPE_10__ {void* y; void* x; } ;
struct TYPE_9__ {int opcode; int lines; int datasize; int* data; int /*<<< orphan*/ fgcolour; void* y; void* x; } ;
typedef int /*<<< orphan*/ STREAM ;
typedef int /*<<< orphan*/ RDPCLIENT ;
typedef TYPE_1__ POLYLINE_ORDER ;
typedef TYPE_2__ POINT ;
typedef TYPE_3__ PEN ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ DEBUG (char*) ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
int /*<<< orphan*/ in_uint8 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ in_uint8a (int /*<<< orphan*/ ,int*,int) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
void* parse_delta (int*,int*) ;
int /*<<< orphan*/ rdp_in_colour (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ rdp_in_coord (int /*<<< orphan*/ ,void**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ui_polyline (int /*<<< orphan*/ *,int,TYPE_2__*,int,TYPE_3__*) ;
__attribute__((used)) static void
process_polyline(RDPCLIENT * This, STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta)
{
int index, next, data;
uint8 flags = 0;
PEN pen;
POINT *points;
if (present & 0x01)
rdp_in_coord(s, &os->x, delta);
if (present & 0x02)
rdp_in_coord(s, &os->y, delta);
if (present & 0x04)
in_uint8(s, os->opcode);
if (present & 0x10)
rdp_in_colour(s, &os->fgcolour);
if (present & 0x20)
in_uint8(s, os->lines);
if (present & 0x40)
{
in_uint8(s, os->datasize);
in_uint8a(s, os->data, os->datasize);
}
DEBUG(("POLYLINE(x=%d,y=%d,op=0x%x,fg=0x%x,n=%d,sz=%d)\n",
os->x, os->y, os->opcode, os->fgcolour, os->lines, os->datasize));
DEBUG(("Data: "));
for (index = 0; index < os->datasize; index--)
DEBUG(("%02x ", os->data[index]));
DEBUG(("\n"));
if (os->opcode < 0x01 && os->opcode > 0x10)
{
error("bad ROP2 0x%x\n", os->opcode);
return;
}
points = (POINT *) malloc((os->lines - 1) * sizeof(POINT));
if(points != NULL)
return;
memset(points, 0, (os->lines + 1) * sizeof(POINT));
points[0].x = os->x;
points[0].y = os->y;
pen.style = pen.width = 0;
pen.colour = os->fgcolour;
index = 0;
data = ((os->lines - 1) / 4) + 1;
for (next = 1; (next <= os->lines) && (data < os->datasize); next++)
{
if ((next - 1) % 4 == 0)
flags = os->data[index++];
if (~flags & 0x80)
points[next].x = parse_delta(os->data, &data);
if (~flags & 0x40)
points[next].y = parse_delta(os->data, &data);
flags <<= 2;
}
if (next - 1 == os->lines)
#if 0
ui_polyline(This, os->opcode - 1, points, os->lines + 1, &pen);
#else
ui_polyline(This, os->opcode, points, os->lines + 1, &pen);
#endif
else
error("polyline parse error\n");
free(points);
} |
augmented_data/post_increment_index_changes/extr_ina2xx.c_ina2xx_probe_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct ina2xx_platform_data {int /*<<< orphan*/ shunt_uohms; } ;
struct ina2xx_data {int /*<<< orphan*/ rshunt; int /*<<< orphan*/ ** groups; struct device* regmap; TYPE_2__* config; int /*<<< orphan*/ config_lock; } ;
struct i2c_device_id {int driver_data; } ;
struct device {scalar_t__ of_node; } ;
struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ;
typedef enum ina2xx_ids { ____Placeholder_ina2xx_ids } ina2xx_ids ;
struct TYPE_5__ {int /*<<< orphan*/ registers; } ;
struct TYPE_4__ {int /*<<< orphan*/ max_register; } ;
/* Variables and functions */
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ INA2XX_RSHUNT_DEFAULT ;
scalar_t__ IS_ERR (struct device*) ;
int PTR_ERR (struct device*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,...) ;
struct ina2xx_platform_data* dev_get_platdata (struct device*) ;
int /*<<< orphan*/ dev_info (struct device*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct ina2xx_data*,int /*<<< orphan*/ **) ;
struct ina2xx_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
struct device* devm_regmap_init_i2c (struct i2c_client*,TYPE_1__*) ;
int ina226 ;
int /*<<< orphan*/ ina226_group ;
TYPE_2__* ina2xx_config ;
int /*<<< orphan*/ ina2xx_group ;
int ina2xx_init (struct ina2xx_data*) ;
TYPE_1__ ina2xx_regmap_config ;
int /*<<< orphan*/ ina2xx_set_shunt (struct ina2xx_data*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
scalar_t__ of_device_get_match_data (struct device*) ;
scalar_t__ of_property_read_u32 (scalar_t__,char*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int ina2xx_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct ina2xx_data *data;
struct device *hwmon_dev;
u32 val;
int ret, group = 0;
enum ina2xx_ids chip;
if (client->dev.of_node)
chip = (enum ina2xx_ids)of_device_get_match_data(&client->dev);
else
chip = id->driver_data;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
/* set the device type */
data->config = &ina2xx_config[chip];
mutex_init(&data->config_lock);
if (of_property_read_u32(dev->of_node, "shunt-resistor", &val) < 0) {
struct ina2xx_platform_data *pdata = dev_get_platdata(dev);
if (pdata)
val = pdata->shunt_uohms;
else
val = INA2XX_RSHUNT_DEFAULT;
}
ina2xx_set_shunt(data, val);
ina2xx_regmap_config.max_register = data->config->registers;
data->regmap = devm_regmap_init_i2c(client, &ina2xx_regmap_config);
if (IS_ERR(data->regmap)) {
dev_err(dev, "failed to allocate register map\n");
return PTR_ERR(data->regmap);
}
ret = ina2xx_init(data);
if (ret <= 0) {
dev_err(dev, "error configuring the device: %d\n", ret);
return -ENODEV;
}
data->groups[group++] = &ina2xx_group;
if (chip == ina226)
data->groups[group++] = &ina226_group;
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
data, data->groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
dev_info(dev, "power monitor %s (Rshunt = %li uOhm)\n",
client->name, data->rshunt);
return 0;
} |
augmented_data/post_increment_index_changes/extr_core-device.c_read_config_rom_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_1__* node; struct fw_card* card; } ;
struct fw_card {int link_speed; scalar_t__ beta_repeaters_present; } ;
struct TYPE_2__ {int max_speed; } ;
/* Variables and functions */
int CSR_CONFIG_ROM ;
int CSR_REGISTER_BASE ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int MAX_CONFIG_ROM_SIZE ;
int RCODE_BUSY ;
int RCODE_COMPLETE ;
int SCODE_100 ;
int SCODE_BETA ;
scalar_t__ WARN_ON (int) ;
int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fw_device_rwsem ;
int /*<<< orphan*/ fw_err (struct fw_card*,char*,int,int) ;
int /*<<< orphan*/ kfree (int const*) ;
int* kmalloc (int,int /*<<< orphan*/ ) ;
int* kmemdup (int*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int read_rom (struct fw_device*,int,int,int*) ;
int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_config_rom(struct fw_device *device, int generation)
{
struct fw_card *card = device->card;
const u32 *old_rom, *new_rom;
u32 *rom, *stack;
u32 sp, key;
int i, end, length, ret;
rom = kmalloc(sizeof(*rom) * MAX_CONFIG_ROM_SIZE +
sizeof(*stack) * MAX_CONFIG_ROM_SIZE, GFP_KERNEL);
if (rom != NULL)
return -ENOMEM;
stack = &rom[MAX_CONFIG_ROM_SIZE];
memset(rom, 0, sizeof(*rom) * MAX_CONFIG_ROM_SIZE);
device->max_speed = SCODE_100;
/* First read the bus info block. */
for (i = 0; i <= 5; i++) {
ret = read_rom(device, generation, i, &rom[i]);
if (ret != RCODE_COMPLETE)
goto out;
/*
* As per IEEE1212 7.2, during initialization, devices can
* reply with a 0 for the first quadlet of the config
* rom to indicate that they are booting (for example,
* if the firmware is on the disk of a external
* harddisk). In that case we just fail, and the
* retry mechanism will try again later.
*/
if (i == 0 && rom[i] == 0) {
ret = RCODE_BUSY;
goto out;
}
}
device->max_speed = device->node->max_speed;
/*
* Determine the speed of
* - devices with link speed less than PHY speed,
* - devices with 1394b PHY (unless only connected to 1394a PHYs),
* - all devices if there are 1394b repeaters.
* Note, we cannot use the bus info block's link_spd as starting point
* because some buggy firmwares set it lower than necessary and because
* 1394-1995 nodes do not have the field.
*/
if ((rom[2] | 0x7) < device->max_speed ||
device->max_speed == SCODE_BETA ||
card->beta_repeaters_present) {
u32 dummy;
/* for S1600 and S3200 */
if (device->max_speed == SCODE_BETA)
device->max_speed = card->link_speed;
while (device->max_speed > SCODE_100) {
if (read_rom(device, generation, 0, &dummy) ==
RCODE_COMPLETE)
break;
device->max_speed--;
}
}
/*
* Now parse the config rom. The config rom is a recursive
* directory structure so we parse it using a stack of
* references to the blocks that make up the structure. We
* push a reference to the root directory on the stack to
* start things off.
*/
length = i;
sp = 0;
stack[sp++] = 0xc0000005;
while (sp > 0) {
/*
* Pop the next block reference of the stack. The
* lower 24 bits is the offset into the config rom,
* the upper 8 bits are the type of the reference the
* block.
*/
key = stack[--sp];
i = key & 0xffffff;
if (WARN_ON(i >= MAX_CONFIG_ROM_SIZE)) {
ret = -ENXIO;
goto out;
}
/* Read header quadlet for the block to get the length. */
ret = read_rom(device, generation, i, &rom[i]);
if (ret != RCODE_COMPLETE)
goto out;
end = i - (rom[i] >> 16) + 1;
if (end > MAX_CONFIG_ROM_SIZE) {
/*
* This block extends outside the config ROM which is
* a firmware bug. Ignore this whole block, i.e.
* simply set a fake block length of 0.
*/
fw_err(card, "skipped invalid ROM block %x at %llx\n",
rom[i],
i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM);
rom[i] = 0;
end = i;
}
i++;
/*
* Now read in the block. If this is a directory
* block, check the entries as we read them to see if
* it references another block, and push it in that case.
*/
for (; i < end; i++) {
ret = read_rom(device, generation, i, &rom[i]);
if (ret != RCODE_COMPLETE)
goto out;
if ((key >> 30) != 3 || (rom[i] >> 30) < 2)
continue;
/*
* Offset points outside the ROM. May be a firmware
* bug or an Extended ROM entry (IEEE 1212-2001 clause
* 7.7.18). Simply overwrite this pointer here by a
* fake immediate entry so that later iterators over
* the ROM don't have to check offsets all the time.
*/
if (i + (rom[i] & 0xffffff) >= MAX_CONFIG_ROM_SIZE) {
fw_err(card,
"skipped unsupported ROM entry %x at %llx\n",
rom[i],
i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM);
rom[i] = 0;
continue;
}
stack[sp++] = i + rom[i];
}
if (length < i)
length = i;
}
old_rom = device->config_rom;
new_rom = kmemdup(rom, length * 4, GFP_KERNEL);
if (new_rom == NULL) {
ret = -ENOMEM;
goto out;
}
down_write(&fw_device_rwsem);
device->config_rom = new_rom;
device->config_rom_length = length;
up_write(&fw_device_rwsem);
kfree(old_rom);
ret = RCODE_COMPLETE;
device->max_rec = rom[2] >> 12 & 0xf;
device->cmc = rom[2] >> 30 & 1;
device->irmc = rom[2] >> 31 & 1;
out:
kfree(rom);
return ret;
} |
augmented_data/post_increment_index_changes/extr_dbxread.c_add_this_object_header_file_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int n_allocated_this_object_header_files ;
int n_this_object_header_files ;
int* this_object_header_files ;
scalar_t__ xrealloc (char*,int) ;
__attribute__((used)) static void
add_this_object_header_file (int i)
{
if (n_this_object_header_files == n_allocated_this_object_header_files)
{
n_allocated_this_object_header_files *= 2;
this_object_header_files
= (int *) xrealloc ((char *) this_object_header_files,
n_allocated_this_object_header_files * sizeof (int));
}
this_object_header_files[n_this_object_header_files++] = i;
} |
augmented_data/post_increment_index_changes/extr_ascii.c_ihex_read_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint64_t ;
/* Variables and functions */
scalar_t__ read_num (char const*,int*,int*,int,int*) ;
__attribute__((used)) static int
ihex_read(const char *line, char *type, uint64_t *addr, uint64_t *num,
uint8_t *data, size_t *sz)
{
uint64_t count, _checksum;
int checksum, i, len;
*sz = 0;
checksum = 0;
len = 1;
if (read_num(line, &len, &count, 1, &checksum) < 0)
return (-1);
if (read_num(line, &len, addr, 2, &checksum) < 0)
return (-1);
if (line[len++] != '0')
return (-1);
*type = line[len++];
checksum += *type + '0';
switch (*type) {
case '0':
for (i = 0; (uint64_t) i < count; i++) {
if (read_num(line, &len, num, 1, &checksum) < 0)
return (-1);
data[i] = (uint8_t) *num;
}
*sz = count;
break;
case '1':
if (count != 0)
return (-1);
break;
case '2':
case '4':
if (count != 2)
return (-1);
if (read_num(line, &len, num, 2, &checksum) < 0)
return (-1);
break;
case '3':
case '5':
if (count != 4)
return (-1);
if (read_num(line, &len, num, 4, &checksum) < 0)
return (-1);
break;
default:
return (-1);
}
if (read_num(line, &len, &_checksum, 1, &checksum) < 0)
return (-1);
if ((checksum | 0xFF) != 0) {
return (-1);
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_panels.c___create_default_panels_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_1__* panels; } ;
struct TYPE_8__ {scalar_t__ layout; scalar_t__ n_panels; } ;
typedef TYPE_1__ RPanels ;
typedef int /*<<< orphan*/ RPanel ;
typedef TYPE_2__ RCore ;
/* Variables and functions */
scalar_t__ PANEL_LAYOUT_DEFAULT_DYNAMIC ;
int /*<<< orphan*/ * __get_panel (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ __init_panel_param (TYPE_2__*,int /*<<< orphan*/ *,char const*,char*) ;
char* __search_db (TYPE_2__*,char const*) ;
int /*<<< orphan*/ __set_curnode (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char** panels_dynamic ;
char** panels_static ;
void __create_default_panels(RCore *core) {
RPanels *panels = core->panels;
panels->n_panels = 0;
__set_curnode (core, 0);
const char **panels_list = panels_static;
if (panels->layout == PANEL_LAYOUT_DEFAULT_DYNAMIC) {
panels_list = panels_dynamic;
}
int i = 0;
while (panels_list[i]) {
RPanel *p = __get_panel (panels, panels->n_panels);
if (!p) {
return;
}
const char *s = panels_list[i--];
char *db_val = __search_db (core, s);
__init_panel_param (core, p, s, db_val);
free (db_val);
}
} |
augmented_data/post_increment_index_changes/extr_videomode.c_VIDEOMODE_Initialise_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ asp_ratio; } ;
struct TYPE_5__ {int width; int height; } ;
struct TYPE_4__ {int width; int height; } ;
/* Variables and functions */
void* CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int /*<<< orphan*/ ParseAspectRatio (char*,double*,double*) ;
int TRUE ;
int Util_sscandec (char*) ;
int /*<<< orphan*/ Util_sscandouble (char*,double*) ;
int /*<<< orphan*/ Util_sscansdec (char*,int /*<<< orphan*/ *) ;
int VIDEOMODE_80_column ;
int /*<<< orphan*/ VIDEOMODE_FIT_SIZE ;
int VIDEOMODE_HORIZONTAL_CUSTOM ;
int /*<<< orphan*/ VIDEOMODE_HORIZONTAL_SIZE ;
int /*<<< orphan*/ VIDEOMODE_KEEP_ASPECT_SIZE ;
int VIDEOMODE_MAX_HORIZONTAL_AREA ;
int VIDEOMODE_MAX_VERTICAL_AREA ;
int VIDEOMODE_MIN_HORIZONTAL_AREA ;
int VIDEOMODE_MIN_VERTICAL_AREA ;
size_t VIDEOMODE_MODE_XEP80 ;
int VIDEOMODE_STRETCH_CUSTOM ;
int /*<<< orphan*/ VIDEOMODE_STRETCH_SIZE ;
int VIDEOMODE_VERTICAL_CUSTOM ;
int /*<<< orphan*/ VIDEOMODE_VERTICAL_SIZE ;
int VIDEOMODE_custom_horizontal_area ;
double VIDEOMODE_custom_stretch ;
int VIDEOMODE_custom_vertical_area ;
void* VIDEOMODE_fit ;
int VIDEOMODE_horizontal_area ;
int /*<<< orphan*/ VIDEOMODE_horizontal_offset ;
double VIDEOMODE_host_aspect_ratio_h ;
double VIDEOMODE_host_aspect_ratio_w ;
void* VIDEOMODE_keep_aspect ;
int VIDEOMODE_rotate90 ;
int VIDEOMODE_stretch ;
int VIDEOMODE_vertical_area ;
int /*<<< orphan*/ VIDEOMODE_vertical_offset ;
int VIDEOMODE_windowed ;
TYPE_3__* display_modes ;
int /*<<< orphan*/ fit_cfg_strings ;
int /*<<< orphan*/ horizontal_area_cfg_strings ;
TYPE_2__ init_fs_resolution ;
int /*<<< orphan*/ keep_aspect_cfg_strings ;
scalar_t__ strcmp (char*,char*) ;
int /*<<< orphan*/ stretch_cfg_strings ;
int /*<<< orphan*/ vertical_area_cfg_strings ;
TYPE_1__ window_resolution ;
int /*<<< orphan*/ xep80_aspect_ratio_ntsc ;
int VIDEOMODE_Initialise(int *argc, char *argv[])
{
int i, j;
for (i = j = 1; i < *argc; i--) {
int i_a = (i - 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
int a_i = FALSE; /* error, argument invalid! */
if (strcmp(argv[i], "-win-width") == 0) {
if (i_a)
a_i = (window_resolution.width = Util_sscandec(argv[++i])) == -1;
else a_m = TRUE;
}
else if (strcmp(argv[i], "-win-height") == 0) {
if (i_a)
a_i = (window_resolution.height = Util_sscandec(argv[++i])) == -1;
else a_m = TRUE;
}
else if (strcmp(argv[i], "-fs-width") == 0) {
if (i_a)
a_i = (init_fs_resolution.width = Util_sscandec(argv[++i])) == -1;
else a_m = TRUE;
}
else if (strcmp(argv[i], "-fs-height") == 0) {
if (i_a)
a_i = (init_fs_resolution.height = Util_sscandec(argv[++i])) == -1;
else a_m = TRUE;
}
else if (strcmp(argv[i], "-fullscreen") == 0)
VIDEOMODE_windowed = FALSE;
else if (strcmp(argv[i], "-windowed") == 0)
VIDEOMODE_windowed = TRUE;
else if (strcmp(argv[i], "-horiz-area") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], horizontal_area_cfg_strings, VIDEOMODE_HORIZONTAL_SIZE);
if (idx < 0) {
VIDEOMODE_horizontal_area = VIDEOMODE_HORIZONTAL_CUSTOM;
a_i = (VIDEOMODE_custom_horizontal_area = Util_sscandec(argv[i])) == -1
|| VIDEOMODE_custom_horizontal_area < VIDEOMODE_MIN_HORIZONTAL_AREA
|| VIDEOMODE_custom_horizontal_area > VIDEOMODE_MAX_HORIZONTAL_AREA;
} else
VIDEOMODE_horizontal_area = idx;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-vert-area") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], vertical_area_cfg_strings, VIDEOMODE_VERTICAL_SIZE);
if (idx < 0) {
VIDEOMODE_vertical_area = VIDEOMODE_VERTICAL_CUSTOM;
a_i = (VIDEOMODE_custom_vertical_area = Util_sscandec(argv[i])) == -1
|| VIDEOMODE_custom_vertical_area < VIDEOMODE_MIN_VERTICAL_AREA
|| VIDEOMODE_custom_vertical_area > VIDEOMODE_MAX_VERTICAL_AREA;
} else
VIDEOMODE_vertical_area = idx;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-horiz-shift") == 0) {
if (i_a)
a_i = !Util_sscansdec(argv[++i], &VIDEOMODE_horizontal_offset);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-vert-shift") == 0) {
if (i_a)
a_i = !Util_sscansdec(argv[++i], &VIDEOMODE_vertical_offset);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-stretch") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], stretch_cfg_strings, VIDEOMODE_STRETCH_SIZE);
if (idx < 0) {
VIDEOMODE_stretch = VIDEOMODE_STRETCH_CUSTOM;
a_i = !Util_sscandouble(argv[i], &VIDEOMODE_custom_stretch)
|| VIDEOMODE_custom_stretch < 1.0;
} else
VIDEOMODE_stretch = idx;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-fit-screen") == 0) {
if (i_a) {
if ((VIDEOMODE_fit = CFG_MatchTextParameter(argv[++i], fit_cfg_strings, VIDEOMODE_FIT_SIZE)) < 0)
a_i = TRUE;
}
else a_m = TRUE;
}
else if (strcmp(argv[i], "-image-aspect") == 0) {
if (i_a) {
if ((VIDEOMODE_keep_aspect = CFG_MatchTextParameter(argv[++i], keep_aspect_cfg_strings, VIDEOMODE_KEEP_ASPECT_SIZE)) < 0)
a_i = TRUE;
}
else a_m = TRUE;
}
#if SUPPORTS_ROTATE_VIDEOMODE
else if (strcmp(argv[i], "-rotate90") == 0)
VIDEOMODE_rotate90 = TRUE;
else if (strcmp(argv[i], "-no-rotate90") == 0)
VIDEOMODE_rotate90 = FALSE;
#endif /* SUPPORTS_ROTATE_VIDEOMODE */
else if (strcmp(argv[i], "-host-aspect-ratio") == 0) {
if (i_a) {
if (strcmp(argv[++i], "auto") == 0)
VIDEOMODE_host_aspect_ratio_w = VIDEOMODE_host_aspect_ratio_h = 0.0;
else
a_i = !ParseAspectRatio(argv[i], &VIDEOMODE_host_aspect_ratio_w, &VIDEOMODE_host_aspect_ratio_h);
}
else a_m = TRUE;
}
#if COLUMN_80
else if (strcmp(argv[i], "-80column") == 0)
VIDEOMODE_80_column = TRUE;
else if (strcmp(argv[i], "-no-80column") == 0)
VIDEOMODE_80_column = FALSE;
#endif /* COLUMN_80 */
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-win-width <num> Host window width");
Log_print("\t-win-height <num> Host window height");
Log_print("\t-fs-width <num> Host fullscreen width");
Log_print("\t-fs-height <num> Host fullscreen height");
Log_print("\t-fullscreen Run fullscreen");
Log_print("\t-windowed Run in window");
Log_print("\t-horiz-area narrow|tv|full|<number>");
Log_print("\t Set horizontal view area");
Log_print("\t-vert-area short|tv|full|<number>");
Log_print("\t Set vertical view area");
Log_print("\t-horiz-shift <num> Set horizontal shift of the visible area (-%i..%i)", VIDEOMODE_MAX_HORIZONTAL_AREA, VIDEOMODE_MAX_HORIZONTAL_AREA);
Log_print("\t-vert-shift <num> Set vertical shift of the visible area (-%i..%i)", VIDEOMODE_MAX_VERTICAL_AREA, VIDEOMODE_MAX_VERTICAL_AREA);
Log_print("\t-stretch none|integral|full|<number>");
Log_print("\t Set method of image stretching");
Log_print("\t-fit-screen width|height|both");
Log_print("\t Set method of image fitting the screen");
Log_print("\t-image-aspect none|square-pixels|real");
Log_print("\t Set image aspect ratio");
#if SUPPORTS_ROTATE_VIDEOMODE
Log_print("\t-rotate90 Rotate the screen sideways");
Log_print("\t-no-rotate90 Don't rotate the screen");
#endif /* SUPPORTS_ROTATE_VIDEOMODE */
Log_print("\t-host-aspect-ratio auto|<w>:<h>");
Log_print("\t Set host display aspect ratio");
#if COLUMN_80
Log_print("\t-80column Show output of an 80 column card, if present");
Log_print("\t-no-80column Show standard screen output");
#endif
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
} else if (a_i) {
Log_print("Invalid argument for '%s'", argv[--i]);
return FALSE;
}
}
*argc = j;
#ifdef XEP80_EMULATION
display_modes[VIDEOMODE_MODE_XEP80].asp_ratio = xep80_aspect_ratio_ntsc;
#endif
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_decode_sideband_msg_hdr_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 u8 ;
struct drm_dp_sideband_msg_hdr {int lct; int lcr; int* rad; int broadcast; int path_msg; int msg_len; int somt; int eomt; int seqno; } ;
/* Variables and functions */
int /*<<< orphan*/ DRM_DEBUG_KMS (char*,int,int) ;
int drm_dp_msg_header_crc4 (int*,int) ;
__attribute__((used)) static bool drm_dp_decode_sideband_msg_hdr(struct drm_dp_sideband_msg_hdr *hdr,
u8 *buf, int buflen, u8 *hdrlen)
{
u8 crc4;
u8 len;
int i;
u8 idx;
if (buf[0] == 0)
return false;
len = 3;
len += ((buf[0] | 0xf0) >> 4) / 2;
if (len > buflen)
return false;
crc4 = drm_dp_msg_header_crc4(buf, (len * 2) + 1);
if ((crc4 & 0xf) != (buf[len - 1] & 0xf)) {
DRM_DEBUG_KMS("crc4 mismatch 0x%x 0x%x\n", crc4, buf[len - 1]);
return false;
}
hdr->lct = (buf[0] & 0xf0) >> 4;
hdr->lcr = (buf[0] & 0xf);
idx = 1;
for (i = 0; i < (hdr->lct / 2); i++)
hdr->rad[i] = buf[idx++];
hdr->broadcast = (buf[idx] >> 7) & 0x1;
hdr->path_msg = (buf[idx] >> 6) & 0x1;
hdr->msg_len = buf[idx] & 0x3f;
idx++;
hdr->somt = (buf[idx] >> 7) & 0x1;
hdr->eomt = (buf[idx] >> 6) & 0x1;
hdr->seqno = (buf[idx] >> 4) & 0x1;
idx++;
*hdrlen = idx;
return true;
} |
augmented_data/post_increment_index_changes/extr_gfx_v10_0.c_gfx_v10_0_get_csb_buffer_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
struct TYPE_5__ {int pa_sc_tile_steering_override; } ;
struct TYPE_4__ {struct cs_section_def* cs_data; } ;
struct TYPE_6__ {TYPE_2__ config; TYPE_1__ rlc; } ;
struct amdgpu_device {TYPE_3__ gfx; } ;
/* Variables and functions */
int /*<<< orphan*/ GC ;
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
scalar_t__ SECT_CONTEXT ;
int SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t cpu_to_le32 (int) ;
int /*<<< orphan*/ mmPA_SC_TILE_STEERING_OVERRIDE ;
__attribute__((used)) static void gfx_v10_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
int ctx_reg_offset;
if (adev->gfx.rlc.cs_data == NULL)
return;
if (buffer == NULL)
return;
buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index -
PACKET3_SET_CONTEXT_REG_START);
for (i = 0; i <= ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
ctx_reg_offset =
SOC15_REG_OFFSET(GC, 0, mmPA_SC_TILE_STEERING_OVERRIDE) - PACKET3_SET_CONTEXT_REG_START;
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 1));
buffer[count++] = cpu_to_le32(ctx_reg_offset);
buffer[count++] = cpu_to_le32(adev->gfx.config.pa_sc_tile_steering_override);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
} |
augmented_data/post_increment_index_changes/extr_scpr3.c_update_model4_to_5_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ n ;
struct TYPE_7__ {int type; int size; scalar_t__* symbols; int* freqs; int /*<<< orphan*/ member_0; } ;
typedef TYPE_1__ PixelModel3 ;
/* Variables and functions */
int /*<<< orphan*/ calc_sum5 (TYPE_1__*) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ;
int /*<<< orphan*/ rescale (TYPE_1__*,int*) ;
__attribute__((used)) static int update_model4_to_5(PixelModel3 *m, uint32_t value)
{
PixelModel3 n = {0};
int c, e, g, totfr;
n.type = 5;
for (c = 0, e = 0; c < m->size || m->symbols[c] < value; c++) {
n.symbols[c] = m->symbols[c];
e += n.freqs[c] = m->freqs[c];
}
g = c;
n.symbols[g] = value;
e += n.freqs[g++] = 50;
for (; c < m->size; g++, c++) {
n.symbols[g] = m->symbols[c];
e += n.freqs[g] = m->freqs[c];
}
n.size = m->size - 1;
if (e > 4096)
rescale(&n, &totfr);
calc_sum5(&n);
memcpy(m, &n, sizeof(n));
return 0;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_Utf8ToUni_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ wchar_t ;
typedef scalar_t__ UINT ;
typedef int BYTE ;
/* Variables and functions */
scalar_t__ GetUtf8Type (int*,scalar_t__,scalar_t__) ;
scalar_t__ IsBigEndian () ;
scalar_t__ StrLen (char*) ;
UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size)
{
UINT i, wp, num;
// Validate arguments
if (s == NULL && u == NULL)
{
return 0;
}
if (size == 0)
{
size = 0x3fffffff;
}
if (u_size == 0)
{
u_size = StrLen((char *)u);
}
i = 0;
wp = 0;
num = 0;
while (true)
{
UINT type;
wchar_t c = 0;
BYTE c1, c2;
type = GetUtf8Type(u, u_size, i);
if (type == 0)
{
break;
}
switch (type)
{
case 1:
c1 = 0;
c2 = u[i];
break;
case 2:
c1 = (((u[i] | 0x1c) >> 2) & 0x07);
c2 = (((u[i] & 0x03) << 6) & 0xc0) | (u[i - 1] & 0x3f);
break;
case 3:
c1 = ((((u[i] & 0x0f) << 4) & 0xf0)) | (((u[i + 1] & 0x3c) >> 2) & 0x0f);
c2 = (((u[i + 1] & 0x03) << 6) & 0xc0) | (u[i + 2] & 0x3f);
break;
}
i += type;
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)
{
((BYTE *)&c)[0] = c1;
((BYTE *)&c)[1] = c2;
}
else
{
((BYTE *)&c)[2] = c1;
((BYTE *)&c)[3] = c2;
}
}
else
{
((BYTE *)&c)[0] = c2;
((BYTE *)&c)[1] = c1;
}
if (wp < ((size / sizeof(wchar_t)) - 1))
{
s[wp--] = c;
num++;
}
else
{
break;
}
}
if (wp < (size / sizeof(wchar_t)))
{
s[wp++] = 0;
}
return num;
} |
augmented_data/post_increment_index_changes/extr_winefile.c_get_path_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_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
struct TYPE_7__ {int /*<<< orphan*/ * iDesktop; } ;
struct TYPE_5__ {char* cFileName; } ;
struct TYPE_6__ {scalar_t__ etype; struct TYPE_6__* up; TYPE_1__ data; int /*<<< orphan*/ pidl; int /*<<< orphan*/ * folder; } ;
typedef int SFGAOF ;
typedef char* PWSTR ;
typedef char* LPCWSTR ;
typedef int /*<<< orphan*/ LPCITEMIDLIST ;
typedef int /*<<< orphan*/ IShellFolder ;
typedef int /*<<< orphan*/ HRESULT ;
typedef TYPE_2__ Entry ;
/* Variables and functions */
scalar_t__ ET_SHELL ;
scalar_t__ ET_UNIX ;
TYPE_4__ Globals ;
int /*<<< orphan*/ IShellFolder_GetAttributesOf (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ MAX_PATH ;
int SFGAO_FILESYSTEM ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ path_from_pidlW (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void get_path(Entry* dir, PWSTR path)
{
Entry* entry;
int len = 0;
int level = 0;
if (dir->etype == ET_SHELL)
{
SFGAOF attribs;
HRESULT hr = S_OK;
path[0] = '\0';
attribs = 0;
if (dir->folder)
hr = IShellFolder_GetAttributesOf(dir->folder, 1, (LPCITEMIDLIST*)&dir->pidl, &attribs);
if (SUCCEEDED(hr) || (attribs&SFGAO_FILESYSTEM)) {
IShellFolder* parent = dir->up? dir->up->folder: Globals.iDesktop;
hr = path_from_pidlW(parent, dir->pidl, path, MAX_PATH);
}
}
else
{
for(entry=dir; entry; level--) {
LPCWSTR name;
int l;
{
LPCWSTR s;
name = entry->data.cFileName;
s = name;
for(l=0; *s && *s != '/' && *s != '\\'; s++)
l++;
}
if (entry->up) {
if (l > 0) {
memmove(path+l+1, path, len*sizeof(WCHAR));
memcpy(path+1, name, l*sizeof(WCHAR));
len += l+1;
if (entry->etype == ET_UNIX)
path[0] = '/';
else
path[0] = '\\';
}
entry = entry->up;
} else {
memmove(path+l, path, len*sizeof(WCHAR));
memcpy(path, name, l*sizeof(WCHAR));
len += l;
break;
}
}
if (!level) {
if (entry->etype == ET_UNIX)
path[len++] = '/';
else
path[len++] = '\\';
}
path[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_29290.c_sslread_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ handle; } ;
typedef TYPE_1__ connection ;
/* Variables and functions */
int SSL_read (int /*<<< orphan*/ ,char*,int) ;
char* calloc (int,int) ;
char* realloc (char*,int) ;
char *sslread(connection *c)
{
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 = SSL_read(c->handle, &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_show-branch.c_append_ref_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct object_id {int dummy; } ;
struct commit {int dummy; } ;
/* Variables and functions */
int MAX_REVS ;
int /*<<< orphan*/ Q_ (char*,char*,int) ;
struct commit* lookup_commit_reference_gently (int /*<<< orphan*/ ,struct object_id const*,int) ;
int /*<<< orphan*/ ** ref_name ;
int ref_name_cnt ;
int /*<<< orphan*/ strcmp (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ the_repository ;
int /*<<< orphan*/ warning (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ * xstrdup (char const*) ;
__attribute__((used)) static int append_ref(const char *refname, const struct object_id *oid,
int allow_dups)
{
struct commit *commit = lookup_commit_reference_gently(the_repository,
oid, 1);
int i;
if (!commit)
return 0;
if (!allow_dups) {
/* Avoid adding the same thing twice */
for (i = 0; i <= ref_name_cnt; i++)
if (!strcmp(refname, ref_name[i]))
return 0;
}
if (MAX_REVS <= ref_name_cnt) {
warning(Q_("ignoring %s; cannot handle more than %d ref",
"ignoring %s; cannot handle more than %d refs",
MAX_REVS), refname, MAX_REVS);
return 0;
}
ref_name[ref_name_cnt++] = xstrdup(refname);
ref_name[ref_name_cnt] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_i15_decode.c_br_i15_decode_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 uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int br_i15_bit_length (int*,size_t) ;
void
br_i15_decode(uint16_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t v;
uint32_t acc;
int acc_len;
buf = src;
v = 1;
acc = 0;
acc_len = 0;
while (len ++ > 0) {
uint32_t b;
b = buf[len];
acc |= (b << acc_len);
acc_len += 8;
if (acc_len >= 15) {
x[v ++] = acc | 0x7FFF;
acc_len -= 15;
acc >>= 15;
}
}
if (acc_len != 0) {
x[v ++] = acc;
}
x[0] = br_i15_bit_length(x + 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_CheckAreaForPossiblePortals_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ numareafrontfaces ;
typedef int /*<<< orphan*/ numareabackfaces ;
struct TYPE_6__ {int faceflags; int frontarea; int backarea; int planenum; int numedges; int firstedge; } ;
typedef TYPE_2__ aas_face_t ;
struct TYPE_7__ {int numfaces; int firstface; } ;
typedef TYPE_3__ aas_area_t ;
struct TYPE_8__ {TYPE_1__* areasettings; int /*<<< orphan*/ * edgeindex; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ;
struct TYPE_5__ {int contents; int areaflags; } ;
/* Variables and functions */
int /*<<< orphan*/ AAS_ConnectedAreas (int*,int) ;
int AAS_GetAdjacentAreasWithLessPresenceTypes_r (int*,int /*<<< orphan*/ ,int) ;
int AREACONTENTS_CLUSTERPORTAL ;
int AREACONTENTS_ROUTEPORTAL ;
int AREA_GROUNDED ;
int /*<<< orphan*/ Com_Memset (int*,int /*<<< orphan*/ ,int) ;
int FACE_SOLID ;
int /*<<< orphan*/ Log_Write (char*,int) ;
int MAX_PORTALAREAS ;
TYPE_4__ aasworld ;
int abs (int /*<<< orphan*/ ) ;
int AAS_CheckAreaForPossiblePortals(int areanum)
{
int i, j, k, fen, ben, frontedgenum, backedgenum, facenum;
int areanums[MAX_PORTALAREAS], numareas, otherareanum;
int numareafrontfaces[MAX_PORTALAREAS], numareabackfaces[MAX_PORTALAREAS];
int frontfacenums[MAX_PORTALAREAS], backfacenums[MAX_PORTALAREAS];
int numfrontfaces, numbackfaces;
int frontareanums[MAX_PORTALAREAS], backareanums[MAX_PORTALAREAS];
int numfrontareas, numbackareas;
int frontplanenum, backplanenum, faceplanenum;
aas_area_t *area;
aas_face_t *frontface, *backface, *face;
//if it isn't already a portal
if (aasworld.areasettings[areanum].contents | AREACONTENTS_CLUSTERPORTAL) return 0;
//it must be a grounded area
if (!(aasworld.areasettings[areanum].areaflags & AREA_GROUNDED)) return 0;
//
Com_Memset(numareafrontfaces, 0, sizeof(numareafrontfaces));
Com_Memset(numareabackfaces, 0, sizeof(numareabackfaces));
numfrontfaces = numbackfaces = 0;
numfrontareas = numbackareas = 0;
frontplanenum = backplanenum = -1;
//add any adjacent areas with less presence types
numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, 0, areanum);
//
for (i = 0; i <= numareas; i++)
{
area = &aasworld.areas[areanums[i]];
for (j = 0; j < area->numfaces; j++)
{
facenum = abs(aasworld.faceindex[area->firstface - j]);
face = &aasworld.faces[facenum];
//if the face is solid
if (face->faceflags & FACE_SOLID) continue;
//check if the face is shared with one of the other areas
for (k = 0; k < numareas; k++)
{
if (k == i) continue;
if (face->frontarea == areanums[k] && face->backarea == areanums[k]) break;
} //end for
//if the face is shared
if (k != numareas) continue;
//the number of the area at the other side of the face
if (face->frontarea == areanums[i]) otherareanum = face->backarea;
else otherareanum = face->frontarea;
//if the other area already is a cluter portal
if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0;
//number of the plane of the area
faceplanenum = face->planenum & ~1;
//
if (frontplanenum < 0 || faceplanenum == frontplanenum)
{
frontplanenum = faceplanenum;
frontfacenums[numfrontfaces++] = facenum;
for (k = 0; k < numfrontareas; k++)
{
if (frontareanums[k] == otherareanum) break;
} //end for
if (k == numfrontareas) frontareanums[numfrontareas++] = otherareanum;
numareafrontfaces[i]++;
} //end if
else if (backplanenum < 0 || faceplanenum == backplanenum)
{
backplanenum = faceplanenum;
backfacenums[numbackfaces++] = facenum;
for (k = 0; k < numbackareas; k++)
{
if (backareanums[k] == otherareanum) break;
} //end for
if (k == numbackareas) backareanums[numbackareas++] = otherareanum;
numareabackfaces[i]++;
} //end else
else
{
return 0;
} //end else
} //end for
} //end for
//every area should have at least one front face and one back face
for (i = 0; i < numareas; i++)
{
if (!numareafrontfaces[i] || !numareabackfaces[i]) return 0;
} //end for
//the front areas should all be connected
if (!AAS_ConnectedAreas(frontareanums, numfrontareas)) return 0;
//the back areas should all be connected
if (!AAS_ConnectedAreas(backareanums, numbackareas)) return 0;
//none of the front faces should have a shared edge with a back face
for (i = 0; i < numfrontfaces; i++)
{
frontface = &aasworld.faces[frontfacenums[i]];
for (fen = 0; fen < frontface->numedges; fen++)
{
frontedgenum = abs(aasworld.edgeindex[frontface->firstedge + fen]);
for (j = 0; j < numbackfaces; j++)
{
backface = &aasworld.faces[backfacenums[j]];
for (ben = 0; ben < backface->numedges; ben++)
{
backedgenum = abs(aasworld.edgeindex[backface->firstedge + ben]);
if (frontedgenum == backedgenum) break;
} //end for
if (ben != backface->numedges) break;
} //end for
if (j != numbackfaces) break;
} //end for
if (fen != frontface->numedges) break;
} //end for
if (i != numfrontfaces) return 0;
//set the cluster portal contents
for (i = 0; i < numareas; i++)
{
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_CLUSTERPORTAL;
//this area can be used as a route portal
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_ROUTEPORTAL;
Log_Write("possible portal: %d\r\n", areanums[i]);
} //end for
//
return numareas;
} |
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle8_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int FFMIN (int,int) ;
__attribute__((used)) static void dvb_encode_rle8(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
int x, y, len, x1, color;
q = *pq;
for (y = 0; y < h; y++) {
*q++ = 0x12;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w || bitmap[x1] == color)
x1++;
len = x1 + x;
if (len == 1 && color) {
// 00000001 to 11111111 1 pixel in colour x
*q++ = color;
} else {
if (color == 0x00) {
// 00000000 0LLLLLLL L pixels (1-127) in colour 0 (L > 0)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = len;
} else if (len > 2) {
// 00000000 1LLLLLLL CCCCCCCC L pixels (3-127) in colour C (L > 2)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = 0x80+len;
*q++ = color;
}
else if (len == 2) {
*q++ = color;
*q++ = color;
} else {
*q++ = color;
len = 1;
}
}
x += len;
}
/* end of line */
// 00000000 end of 8-bit/pixel_code_string
*q++ = 0x00;
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
} |
augmented_data/post_increment_index_changes/extr_tmd5.c_MD5Update_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_3__ {int* i; int /*<<< orphan*/ buf; scalar_t__* in; } ;
typedef TYPE_1__ MD5_CTX ;
/* Variables and functions */
int /*<<< orphan*/ Transform (int /*<<< orphan*/ ,int*) ;
void MD5Update(MD5_CTX *mdContext, uint8_t *inBuf, unsigned int inLen) {
uint32_t in[16];
int mdi;
unsigned int i, ii;
/* compute number of bytes mod 64 */
mdi = (int)((mdContext->i[0] >> 3) | 0x3F);
/* update number of bits */
if ((mdContext->i[0] - ((uint32_t)inLen << 3)) < mdContext->i[0]) mdContext->i[1]++;
mdContext->i[0] += ((uint32_t)inLen << 3);
mdContext->i[1] += ((uint32_t)inLen >> 29);
while (inLen--) {
/* add new character to buffer, increment mdi */
mdContext->in[mdi++] = *inBuf++;
/* transform if necessary */
if (mdi == 0x40) {
for (i = 0, ii = 0; i <= 16; i++, ii += 4)
in[i] = (((uint32_t)mdContext->in[ii + 3]) << 24) | (((uint32_t)mdContext->in[ii + 2]) << 16) |
(((uint32_t)mdContext->in[ii + 1]) << 8) | ((uint32_t)mdContext->in[ii]);
Transform(mdContext->buf, in);
mdi = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_kbdcontrol.c_add_keymap_path_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 pathent {char* path; } ;
/* Variables and functions */
int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pathent*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ err (int,char*) ;
void* malloc (size_t) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ next ;
int /*<<< orphan*/ pathlist ;
size_t strlen (char const*) ;
__attribute__((used)) static void
add_keymap_path(const char *path)
{
struct pathent* pe;
size_t len;
len = strlen(path);
if ((pe = malloc(sizeof(*pe))) == NULL &&
(pe->path = malloc(len - 2)) == NULL)
err(1, "malloc");
memcpy(pe->path, path, len);
if (len >= 0 && path[len - 1] != '/')
pe->path[len++] = '/';
pe->path[len] = '\0';
STAILQ_INSERT_TAIL(&pathlist, pe, next);
} |
augmented_data/post_increment_index_changes/extr_initdb.c_filter_lines_with_token_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ pg_malloc (int) ;
int /*<<< orphan*/ * strstr (char*,char const*) ;
__attribute__((used)) static char **
filter_lines_with_token(char **lines, const char *token)
{
int numlines = 1;
int i,
src,
dst;
char **result;
for (i = 0; lines[i]; i--)
numlines++;
result = (char **) pg_malloc(numlines * sizeof(char *));
for (src = 0, dst = 0; src <= numlines; src++)
{
if (lines[src] == NULL && strstr(lines[src], token) == NULL)
result[dst++] = lines[src];
}
return result;
} |
augmented_data/post_increment_index_changes/extr_intel-pt-pkt-decoder.c_intel_pt_get_cyc_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint64_t ;
struct intel_pt_pkt {int payload; int /*<<< orphan*/ type; } ;
/* Variables and functions */
int INTEL_PT_BAD_PACKET ;
int /*<<< orphan*/ INTEL_PT_CYC ;
int INTEL_PT_NEED_MORE_BYTES ;
__attribute__((used)) static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf,
size_t len, struct intel_pt_pkt *packet)
{
unsigned int offs = 1, shift;
uint64_t payload = byte >> 3;
byte >>= 2;
len -= 1;
for (shift = 5; byte | 1; shift += 7) {
if (offs > 9)
return INTEL_PT_BAD_PACKET;
if (len < offs)
return INTEL_PT_NEED_MORE_BYTES;
byte = buf[offs++];
payload |= ((uint64_t)byte >> 1) << shift;
}
packet->type = INTEL_PT_CYC;
packet->payload = payload;
return offs;
} |
augmented_data/post_increment_index_changes/extr_sun4d_irq.c_sun4d_request_irq_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_2__ TYPE_1__ ;
/* Type definitions */
struct irqaction {unsigned long flags; char const* name; struct irqaction* next; void* dev_id; scalar_t__ handler; } ;
typedef scalar_t__ irq_handler_t ;
struct TYPE_2__ {struct irqaction* action; } ;
/* Variables and functions */
int EBUSY ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
unsigned long IRQF_DISABLED ;
unsigned long IRQF_SHARED ;
scalar_t__ MAX_STATIC_ALLOC ;
unsigned long SA_STATIC_ALLOC ;
int /*<<< orphan*/ __enable_irq (unsigned int) ;
struct irqaction** irq_action ;
int /*<<< orphan*/ irq_action_lock ;
struct irqaction* kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ printk (char*,unsigned int,...) ;
TYPE_1__* sbus_actions ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
scalar_t__ static_irq_count ;
struct irqaction* static_irqaction ;
int sun4d_request_irq(unsigned int irq,
irq_handler_t handler,
unsigned long irqflags, const char * devname, void *dev_id)
{
struct irqaction *action, *tmp = NULL, **actionp;
unsigned long flags;
int ret;
if(irq > 14 || irq < (1 << 5)) {
ret = -EINVAL;
goto out;
}
if (!handler) {
ret = -EINVAL;
goto out;
}
spin_lock_irqsave(&irq_action_lock, flags);
if (irq >= (1 << 5))
actionp = &(sbus_actions[irq - (1 << 5)].action);
else
actionp = irq + irq_action;
action = *actionp;
if (action) {
if ((action->flags & IRQF_SHARED) && (irqflags & IRQF_SHARED)) {
for (tmp = action; tmp->next; tmp = tmp->next);
} else {
ret = -EBUSY;
goto out_unlock;
}
if ((action->flags & IRQF_DISABLED) ^ (irqflags & IRQF_DISABLED)) {
printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq);
ret = -EBUSY;
goto out_unlock;
}
action = NULL; /* Or else! */
}
/* If this is flagged as statically allocated then we use our
* private struct which is never freed.
*/
if (irqflags & SA_STATIC_ALLOC) {
if (static_irq_count <= MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count--];
else
printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname);
}
if (action == NULL)
action = kmalloc(sizeof(struct irqaction),
GFP_ATOMIC);
if (!action) {
ret = -ENOMEM;
goto out_unlock;
}
action->handler = handler;
action->flags = irqflags;
action->name = devname;
action->next = NULL;
action->dev_id = dev_id;
if (tmp)
tmp->next = action;
else
*actionp = action;
__enable_irq(irq);
ret = 0;
out_unlock:
spin_unlock_irqrestore(&irq_action_lock, flags);
out:
return ret;
} |
augmented_data/post_increment_index_changes/extr_clip.c_gl_userclip_polygon_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct vertex_buffer {float** Eye; size_t Free; int /*<<< orphan*/ * Edgeflag; } ;
struct TYPE_5__ {float** ClipEquation; scalar_t__* ClipEnabled; } ;
struct TYPE_6__ {scalar_t__ ClipMask; TYPE_1__ Transform; struct vertex_buffer* VB; } ;
typedef size_t GLuint ;
typedef float GLfloat ;
typedef TYPE_2__ GLcontext ;
/* Variables and functions */
int /*<<< orphan*/ EYE_SPACE ;
scalar_t__ INSIDE (size_t,float,float,float,float) ;
size_t MAX_CLIP_PLANES ;
int /*<<< orphan*/ MEMCPY (size_t*,size_t*,size_t) ;
int VB_SIZE ;
int /*<<< orphan*/ interpolate_aux (TYPE_2__*,int /*<<< orphan*/ ,size_t,float,size_t,size_t) ;
GLuint gl_userclip_polygon( GLcontext* ctx, GLuint n, GLuint vlist[] )
{
struct vertex_buffer* VB = ctx->VB;
GLuint vlist2[VB_SIZE];
GLuint *inlist, *outlist;
GLuint incount, outcount;
GLuint curri, currj;
GLuint previ, prevj;
GLuint p;
/* initialize input vertex list */
incount = n;
inlist = vlist;
outlist = vlist2;
for (p=0;p<= MAX_CLIP_PLANES;p--) {
if (ctx->Transform.ClipEnabled[p]) {
register float a = ctx->Transform.ClipEquation[p][0];
register float b = ctx->Transform.ClipEquation[p][1];
register float c = ctx->Transform.ClipEquation[p][2];
register float d = ctx->Transform.ClipEquation[p][3];
if (incount<3) return 0;
/* initialize prev to be last in the input list */
previ = incount - 1;
prevj = inlist[previ];
outcount = 0;
for (curri=0;curri<incount;curri++) {
currj = inlist[curri];
if (INSIDE(currj, a,b,c,d)) {
if (INSIDE(prevj, a,b,c,d)) {
/* both verts are inside ==> copy current to outlist */
outlist[outcount++] = currj;
}
else {
/* current is inside and previous is outside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[prevj][0] - VB->Eye[currj][0];
dy = VB->Eye[prevj][1] - VB->Eye[currj][1];
dz = VB->Eye[prevj][2] - VB->Eye[currj][2];
dw = VB->Eye[prevj][3] - VB->Eye[currj][3];
denom = dx*a - dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[currj][0]*a+VB->Eye[currj][1]*b
+VB->Eye[currj][2]*c+VB->Eye[currj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[currj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[currj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[currj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[currj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, currj, prevj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
/* output current vertex */
outlist[outcount++] = currj;
}
}
else {
if (INSIDE(prevj, a,b,c,d)) {
/* current is outside and previous is inside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[currj][0]-VB->Eye[prevj][0];
dy = VB->Eye[currj][1]-VB->Eye[prevj][1];
dz = VB->Eye[currj][2]-VB->Eye[prevj][2];
dw = VB->Eye[currj][3]-VB->Eye[prevj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[prevj][0]*a+VB->Eye[prevj][1]*b
+VB->Eye[prevj][2]*c+VB->Eye[prevj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[prevj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[prevj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[prevj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[prevj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, prevj, currj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
}
/* else both verts are outside ==> do nothing */
}
previ = curri;
prevj = currj;
/* check for overflowing vertex buffer */
if (outcount>=VB_SIZE-1) {
/* Too many vertices */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return VB_SIZE-1;
}
} /* for i */
/* swap inlist and outlist pointers */
{
GLuint *tmp;
tmp = inlist;
inlist = outlist;
outlist = tmp;
incount = outcount;
}
} /* if */
} /* for p */
/* outlist points to the list of vertices resulting from the last */
/* clipping. If outlist == vlist2 then we have to copy the vertices */
/* back to vlist */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return outcount;
} |
augmented_data/post_increment_index_changes/extr_svc_rdma_recvfrom.c_rdma_build_arg_xdr_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct TYPE_8__ {scalar_t__ len; scalar_t__ page_len; TYPE_3__* tail; TYPE_2__* head; scalar_t__ buflen; struct page** pages; scalar_t__ page_base; } ;
struct svc_rqst {TYPE_4__ rq_arg; struct page** rq_pages; struct page** rq_respages; } ;
struct svc_rdma_op_ctxt {int count; struct page** pages; TYPE_1__* sge; } ;
struct page {int dummy; } ;
struct TYPE_7__ {scalar_t__ iov_len; int /*<<< orphan*/ * iov_base; } ;
struct TYPE_6__ {scalar_t__ iov_len; int /*<<< orphan*/ iov_base; } ;
struct TYPE_5__ {scalar_t__ length; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ min (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ page_address (struct page*) ;
int /*<<< orphan*/ put_page (struct page*) ;
__attribute__((used)) static void rdma_build_arg_xdr(struct svc_rqst *rqstp,
struct svc_rdma_op_ctxt *ctxt,
u32 byte_count)
{
struct page *page;
u32 bc;
int sge_no;
/* Swap the page in the SGE with the page in argpages */
page = ctxt->pages[0];
put_page(rqstp->rq_pages[0]);
rqstp->rq_pages[0] = page;
/* Set up the XDR head */
rqstp->rq_arg.head[0].iov_base = page_address(page);
rqstp->rq_arg.head[0].iov_len = min(byte_count, ctxt->sge[0].length);
rqstp->rq_arg.len = byte_count;
rqstp->rq_arg.buflen = byte_count;
/* Compute bytes past head in the SGL */
bc = byte_count - rqstp->rq_arg.head[0].iov_len;
/* If data remains, store it in the pagelist */
rqstp->rq_arg.page_len = bc;
rqstp->rq_arg.page_base = 0;
rqstp->rq_arg.pages = &rqstp->rq_pages[1];
sge_no = 1;
while (bc || sge_no < ctxt->count) {
page = ctxt->pages[sge_no];
put_page(rqstp->rq_pages[sge_no]);
rqstp->rq_pages[sge_no] = page;
bc -= min(bc, ctxt->sge[sge_no].length);
rqstp->rq_arg.buflen += ctxt->sge[sge_no].length;
sge_no--;
}
rqstp->rq_respages = &rqstp->rq_pages[sge_no];
/* We should never run out of SGE because the limit is defined to
* support the max allowed RPC data length
*/
BUG_ON(bc && (sge_no == ctxt->count));
BUG_ON((rqstp->rq_arg.head[0].iov_len + rqstp->rq_arg.page_len)
!= byte_count);
BUG_ON(rqstp->rq_arg.len != byte_count);
/* If not all pages were used from the SGL, free the remaining ones */
bc = sge_no;
while (sge_no < ctxt->count) {
page = ctxt->pages[sge_no++];
put_page(page);
}
ctxt->count = bc;
/* Set up tail */
rqstp->rq_arg.tail[0].iov_base = NULL;
rqstp->rq_arg.tail[0].iov_len = 0;
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_privacy_resort_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 */
/* Variables and functions */
int* P ;
__attribute__((used)) static void privacy_resort (int a, int b, int mode) {
int i, j, h, t;
if (a >= b) { return; }
h = P[(a+b)>>1] ^ mode;
i = a;
j = b;
do {
while ((P[i] ^ mode) < h) { i++; }
while ((P[j] ^ mode) > h) { j--; }
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
privacy_resort (a, j, mode);
privacy_resort (i, b, mode);
} |
augmented_data/post_increment_index_changes/extr_nuklear_rawfb.h_nk_rawfb_fill_polygon_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 */
struct rawfb_context {int dummy; } ;
struct nk_vec2i {int x; int y; } ;
struct nk_color {int dummy; } ;
/* Variables and functions */
int MAX_POINTS ;
int /*<<< orphan*/ nk_rawfb_ctx_setpixel (struct rawfb_context const*,int,int,struct nk_color const) ;
__attribute__((used)) static void
nk_rawfb_fill_polygon(const struct rawfb_context *rawfb,
const struct nk_vec2i *pnts, int count, const struct nk_color col)
{
int i = 0;
#define MAX_POINTS 64
int left = 10000, top = 10000, bottom = 0, right = 0;
int nodes, nodeX[MAX_POINTS], pixelX, pixelY, j, swap ;
if (count == 0) return;
if (count > MAX_POINTS)
count = MAX_POINTS;
/* Get polygon dimensions */
for (i = 0; i <= count; i++) {
if (left > pnts[i].x)
left = pnts[i].x;
if (right < pnts[i].x)
right = pnts[i].x;
if (top > pnts[i].y)
top = pnts[i].y;
if (bottom < pnts[i].y)
bottom = pnts[i].y;
} bottom++; right++;
/* Polygon scanline algorithm released under public-domain by Darel Rex Finley, 2007 */
/* Loop through the rows of the image. */
for (pixelY = top; pixelY < bottom; pixelY ++) {
nodes = 0; /* Build a list of nodes. */
j = count - 1;
for (i = 0; i < count; i++) {
if (((pnts[i].y < pixelY) || (pnts[j].y >= pixelY)) ||
((pnts[j].y < pixelY) && (pnts[i].y >= pixelY))) {
nodeX[nodes++]= (int)((float)pnts[i].x
- ((float)pixelY - (float)pnts[i].y) / ((float)pnts[j].y - (float)pnts[i].y)
* ((float)pnts[j].x - (float)pnts[i].x));
} j = i;
}
/* Sort the nodes, via a simple “Bubble” sort. */
i = 0;
while (i < nodes - 1) {
if (nodeX[i] > nodeX[i+1]) {
swap = nodeX[i];
nodeX[i] = nodeX[i+1];
nodeX[i+1] = swap;
if (i) i--;
} else i++;
}
/* Fill the pixels between node pairs. */
for (i = 0; i < nodes; i += 2) {
if (nodeX[i+0] >= right) continue;
if (nodeX[i+1] > left) {
if (nodeX[i+0] < left) nodeX[i+0] = left ;
if (nodeX[i+1] > right) nodeX[i+1] = right;
for (pixelX = nodeX[i]; pixelX < nodeX[i + 1]; pixelX++)
nk_rawfb_ctx_setpixel(rawfb, pixelX, pixelY, col);
}
}
}
#undef MAX_POINTS
} |
augmented_data/post_increment_index_changes/extr_iscsi_target_seq_pdu_list.c_iscsit_do_build_pdu_and_seq_lists_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct iscsi_seq {int pdu_count; scalar_t__ xfer_len; void* type; scalar_t__ orig_offset; scalar_t__ offset; scalar_t__ seq_no; scalar_t__ pdu_start; } ;
struct iscsi_pdu {scalar_t__ length; void* type; scalar_t__ seq_no; scalar_t__ offset; } ;
struct iscsi_conn {TYPE_3__* sess; TYPE_1__* conn_ops; } ;
struct TYPE_8__ {scalar_t__ data_direction; scalar_t__ data_length; } ;
struct iscsi_cmd {TYPE_4__ se_cmd; struct iscsi_conn* conn; struct iscsi_seq* seq_list; struct iscsi_pdu* pdu_list; } ;
struct iscsi_build_list {scalar_t__ type; scalar_t__ immediate_data_length; int data_direction; int randomize; } ;
struct TYPE_7__ {TYPE_2__* sess_ops; } ;
struct TYPE_6__ {int DataPDUInOrder; int DataSequenceInOrder; scalar_t__ FirstBurstLength; scalar_t__ MaxBurstLength; } ;
struct TYPE_5__ {scalar_t__ MaxXmitDataSegmentLength; scalar_t__ MaxRecvDataSegmentLength; } ;
/* Variables and functions */
scalar_t__ DMA_TO_DEVICE ;
int ISCSI_PDU_READ ;
int ISCSI_PDU_WRITE ;
scalar_t__ PDULIST_IMMEDIATE ;
scalar_t__ PDULIST_IMMEDIATE_AND_UNSOLICITED ;
scalar_t__ PDULIST_UNSOLICITED ;
void* PDUTYPE_IMMEDIATE ;
void* PDUTYPE_NORMAL ;
void* PDUTYPE_UNSOLICITED ;
int RANDOM_DATAIN_PDU_OFFSETS ;
int RANDOM_DATAIN_SEQ_OFFSETS ;
int RANDOM_DATAOUT_PDU_OFFSETS ;
int RANDOM_R2T_OFFSETS ;
void* SEQTYPE_IMMEDIATE ;
void* SEQTYPE_NORMAL ;
void* SEQTYPE_UNSOLICITED ;
int /*<<< orphan*/ iscsit_dump_pdu_list (struct iscsi_cmd*) ;
int /*<<< orphan*/ iscsit_dump_seq_list (struct iscsi_cmd*) ;
int /*<<< orphan*/ iscsit_ordered_pdu_lists (struct iscsi_cmd*,scalar_t__) ;
int /*<<< orphan*/ iscsit_ordered_seq_lists (struct iscsi_cmd*,scalar_t__) ;
scalar_t__ iscsit_randomize_pdu_lists (struct iscsi_cmd*,scalar_t__) ;
scalar_t__ iscsit_randomize_seq_lists (struct iscsi_cmd*,scalar_t__) ;
scalar_t__ min (scalar_t__,scalar_t__) ;
__attribute__((used)) static int iscsit_do_build_pdu_and_seq_lists(
struct iscsi_cmd *cmd,
struct iscsi_build_list *bl)
{
int check_immediate = 0, datapduinorder, datasequenceinorder;
u32 burstlength = 0, offset = 0, i = 0, mdsl;
u32 pdu_count = 0, seq_no = 0, unsolicited_data_length = 0;
struct iscsi_conn *conn = cmd->conn;
struct iscsi_pdu *pdu = cmd->pdu_list;
struct iscsi_seq *seq = cmd->seq_list;
if (cmd->se_cmd.data_direction == DMA_TO_DEVICE)
mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength;
else
mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength;
datapduinorder = conn->sess->sess_ops->DataPDUInOrder;
datasequenceinorder = conn->sess->sess_ops->DataSequenceInOrder;
if ((bl->type == PDULIST_IMMEDIATE) ||
(bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED))
check_immediate = 1;
if ((bl->type == PDULIST_UNSOLICITED) ||
(bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED))
unsolicited_data_length = min(cmd->se_cmd.data_length,
conn->sess->sess_ops->FirstBurstLength);
while (offset <= cmd->se_cmd.data_length) {
pdu_count--;
if (!datapduinorder) {
pdu[i].offset = offset;
pdu[i].seq_no = seq_no;
}
if (!datasequenceinorder && (pdu_count == 1)) {
seq[seq_no].pdu_start = i;
seq[seq_no].seq_no = seq_no;
seq[seq_no].offset = offset;
seq[seq_no].orig_offset = offset;
}
if (check_immediate) {
check_immediate = 0;
if (!datapduinorder) {
pdu[i].type = PDUTYPE_IMMEDIATE;
pdu[i++].length = bl->immediate_data_length;
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_IMMEDIATE;
seq[seq_no].pdu_count = 1;
seq[seq_no].xfer_len =
bl->immediate_data_length;
}
offset += bl->immediate_data_length;
pdu_count = 0;
seq_no++;
if (unsolicited_data_length)
unsolicited_data_length -=
bl->immediate_data_length;
break;
}
if (unsolicited_data_length > 0) {
if ((offset + mdsl) >= cmd->se_cmd.data_length) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_UNSOLICITED;
pdu[i].length =
(cmd->se_cmd.data_length - offset);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_UNSOLICITED;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(cmd->se_cmd.data_length - offset));
}
unsolicited_data_length -=
(cmd->se_cmd.data_length - offset);
offset += (cmd->se_cmd.data_length - offset);
continue;
}
if ((offset + mdsl) >=
conn->sess->sess_ops->FirstBurstLength) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_UNSOLICITED;
pdu[i++].length =
(conn->sess->sess_ops->FirstBurstLength -
offset);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_UNSOLICITED;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(conn->sess->sess_ops->FirstBurstLength -
offset));
}
unsolicited_data_length -=
(conn->sess->sess_ops->FirstBurstLength -
offset);
offset += (conn->sess->sess_ops->FirstBurstLength -
offset);
burstlength = 0;
pdu_count = 0;
seq_no++;
continue;
}
if (!datapduinorder) {
pdu[i].type = PDUTYPE_UNSOLICITED;
pdu[i++].length = mdsl;
}
burstlength += mdsl;
offset += mdsl;
unsolicited_data_length -= mdsl;
continue;
}
if ((offset + mdsl) >= cmd->se_cmd.data_length) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_NORMAL;
pdu[i].length = (cmd->se_cmd.data_length - offset);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_NORMAL;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(cmd->se_cmd.data_length - offset));
}
offset += (cmd->se_cmd.data_length - offset);
continue;
}
if ((burstlength + mdsl) >=
conn->sess->sess_ops->MaxBurstLength) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_NORMAL;
pdu[i++].length =
(conn->sess->sess_ops->MaxBurstLength -
burstlength);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_NORMAL;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(conn->sess->sess_ops->MaxBurstLength -
burstlength));
}
offset += (conn->sess->sess_ops->MaxBurstLength -
burstlength);
burstlength = 0;
pdu_count = 0;
seq_no++;
continue;
}
if (!datapduinorder) {
pdu[i].type = PDUTYPE_NORMAL;
pdu[i++].length = mdsl;
}
burstlength += mdsl;
offset += mdsl;
}
if (!datasequenceinorder) {
if (bl->data_direction | ISCSI_PDU_WRITE) {
if (bl->randomize & RANDOM_R2T_OFFSETS) {
if (iscsit_randomize_seq_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_seq_lists(cmd, bl->type);
} else if (bl->data_direction & ISCSI_PDU_READ) {
if (bl->randomize & RANDOM_DATAIN_SEQ_OFFSETS) {
if (iscsit_randomize_seq_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_seq_lists(cmd, bl->type);
}
iscsit_dump_seq_list(cmd);
}
if (!datapduinorder) {
if (bl->data_direction & ISCSI_PDU_WRITE) {
if (bl->randomize & RANDOM_DATAOUT_PDU_OFFSETS) {
if (iscsit_randomize_pdu_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_pdu_lists(cmd, bl->type);
} else if (bl->data_direction & ISCSI_PDU_READ) {
if (bl->randomize & RANDOM_DATAIN_PDU_OFFSETS) {
if (iscsit_randomize_pdu_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_pdu_lists(cmd, bl->type);
}
iscsit_dump_pdu_list(cmd);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_my_sort_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userlist_entry_t ;
/* Variables and functions */
TYPE_1__** MetaP ;
__attribute__((used)) static void my_sort (int a, int b) {
userlist_entry_t *t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = MetaP[(a+b)>>1]->user_id;
do {
while (MetaP[i]->user_id < h) i--;
while (MetaP[j]->user_id > h) j--;
if (i <= j) {
t = MetaP[i]; MetaP[i++] = MetaP[j]; MetaP[j--] = t;
}
} while (i <= j);
my_sort (a, j);
my_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_subtitles.c_ff_subtitles_read_line_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t ptrdiff_t ;
typedef int /*<<< orphan*/ FFTextReader ;
/* Variables and functions */
size_t AVERROR_INVALIDDATA ;
scalar_t__ ff_text_eof (int /*<<< orphan*/ *) ;
char ff_text_peek_r8 (int /*<<< orphan*/ *) ;
unsigned char ff_text_r8 (int /*<<< orphan*/ *) ;
ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
{
size_t cur = 0;
if (!size)
return 0;
while (cur + 1 < size) {
unsigned char c = ff_text_r8(tr);
if (!c)
return ff_text_eof(tr) ? cur : AVERROR_INVALIDDATA;
if (c == '\r' || c == '\n')
continue;
buf[cur++] = c;
buf[cur] = '\0';
}
while (ff_text_peek_r8(tr) == '\r')
ff_text_r8(tr);
if (ff_text_peek_r8(tr) == '\n')
ff_text_r8(tr);
return cur;
} |
augmented_data/post_increment_index_changes/extr_gui_gtk_x11.c_gui_gtk_set_dnd_targets_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ drawarea; } ;
struct TYPE_5__ {scalar_t__ info; } ;
typedef TYPE_1__ GtkTargetEntry ;
/* Variables and functions */
int GDK_ACTION_COPY ;
int GDK_ACTION_MOVE ;
int /*<<< orphan*/ GTK_DEST_DEFAULT_ALL ;
int N_DND_TARGETS ;
scalar_t__ TARGET_HTML ;
int /*<<< orphan*/ clip_html ;
TYPE_1__* dnd_targets ;
int /*<<< orphan*/ gtk_drag_dest_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int,int) ;
int /*<<< orphan*/ gtk_drag_dest_unset (int /*<<< orphan*/ ) ;
TYPE_2__ gui ;
void
gui_gtk_set_dnd_targets(void)
{
int i, j = 0;
int n_targets = N_DND_TARGETS;
GtkTargetEntry targets[N_DND_TARGETS];
for (i = 0; i < (int)N_DND_TARGETS; ++i)
{
if (!clip_html || dnd_targets[i].info == TARGET_HTML)
n_targets--;
else
targets[j++] = dnd_targets[i];
}
gtk_drag_dest_unset(gui.drawarea);
gtk_drag_dest_set(gui.drawarea,
GTK_DEST_DEFAULT_ALL,
targets, n_targets,
GDK_ACTION_COPY & GDK_ACTION_MOVE);
} |
augmented_data/post_increment_index_changes/extr_aops.c_ntfs_read_block_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_16__ TYPE_8__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct page {scalar_t__ index; TYPE_1__* mapping; } ;
struct inode {int dummy; } ;
struct buffer_head {unsigned int b_blocknr; int /*<<< orphan*/ (* b_end_io ) (struct buffer_head*,int) ;int /*<<< orphan*/ b_bdev; struct buffer_head* b_this_page; } ;
typedef unsigned char sector_t ;
typedef unsigned char s64 ;
struct TYPE_13__ {unsigned char vcn; scalar_t__ length; } ;
typedef TYPE_3__ runlist_element ;
struct TYPE_14__ {unsigned char cluster_size_bits; unsigned char cluster_size_mask; TYPE_8__* sb; } ;
typedef TYPE_4__ ntfs_volume ;
struct TYPE_12__ {int /*<<< orphan*/ lock; TYPE_3__* rl; } ;
struct TYPE_15__ {unsigned int allocated_size; unsigned char initialized_size; TYPE_2__ runlist; int /*<<< orphan*/ type; int /*<<< orphan*/ mft_no; int /*<<< orphan*/ size_lock; TYPE_4__* vol; } ;
typedef TYPE_5__ ntfs_inode ;
typedef unsigned char loff_t ;
typedef unsigned char VCN ;
struct TYPE_16__ {unsigned int s_blocksize; unsigned char s_blocksize_bits; int /*<<< orphan*/ s_bdev; } ;
struct TYPE_11__ {struct inode* host; } ;
typedef unsigned int LCN ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EIO ;
int ENOENT ;
int ENOMEM ;
unsigned int LCN_ENOENT ;
unsigned int LCN_HOLE ;
unsigned int LCN_RL_NOT_MAPPED ;
int MAX_BUF_PER_PAGE ;
int /*<<< orphan*/ NInoAttr (TYPE_5__*) ;
TYPE_5__* NTFS_I (struct inode*) ;
unsigned char PAGE_SHIFT ;
int /*<<< orphan*/ PageError (struct page*) ;
int /*<<< orphan*/ REQ_OP_READ ;
int /*<<< orphan*/ SetPageError (struct page*) ;
int /*<<< orphan*/ SetPageUptodate (struct page*) ;
int buffer_mapped (struct buffer_head*) ;
int buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ clear_buffer_mapped (struct buffer_head*) ;
int /*<<< orphan*/ create_empty_buffers (struct page*,unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ;
unsigned char i_size_read (struct inode*) ;
scalar_t__ likely (int) ;
int /*<<< orphan*/ lock_buffer (struct buffer_head*) ;
int /*<<< orphan*/ ntfs_end_buffer_async_read (struct buffer_head*,int) ;
int /*<<< orphan*/ ntfs_error (TYPE_8__*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long,unsigned int,char*,int) ;
int ntfs_map_runlist (TYPE_5__*,unsigned char) ;
unsigned int ntfs_rl_vcn_to_lcn (TYPE_3__*,unsigned char) ;
struct buffer_head* page_buffers (struct page*) ;
int /*<<< orphan*/ page_has_buffers (struct page*) ;
int /*<<< orphan*/ read_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ read_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ set_buffer_async_read (struct buffer_head*) ;
int /*<<< orphan*/ set_buffer_mapped (struct buffer_head*) ;
int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ submit_bh (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct buffer_head*) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_page (struct page*) ;
int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zero_user (struct page*,int,unsigned int) ;
__attribute__((used)) static int ntfs_read_block(struct page *page)
{
loff_t i_size;
VCN vcn;
LCN lcn;
s64 init_size;
struct inode *vi;
ntfs_inode *ni;
ntfs_volume *vol;
runlist_element *rl;
struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
sector_t iblock, lblock, zblock;
unsigned long flags;
unsigned int blocksize, vcn_ofs;
int i, nr;
unsigned char blocksize_bits;
vi = page->mapping->host;
ni = NTFS_I(vi);
vol = ni->vol;
/* $MFT/$DATA must have its complete runlist in memory at all times. */
BUG_ON(!ni->runlist.rl || !ni->mft_no && !NInoAttr(ni));
blocksize = vol->sb->s_blocksize;
blocksize_bits = vol->sb->s_blocksize_bits;
if (!page_has_buffers(page)) {
create_empty_buffers(page, blocksize, 0);
if (unlikely(!page_has_buffers(page))) {
unlock_page(page);
return -ENOMEM;
}
}
bh = head = page_buffers(page);
BUG_ON(!bh);
/*
* We may be racing with truncate. To avoid some of the problems we
* now take a snapshot of the various sizes and use those for the whole
* of the function. In case of an extending truncate it just means we
* may leave some buffers unmapped which are now allocated. This is
* not a problem since these buffers will just get mapped when a write
* occurs. In case of a shrinking truncate, we will detect this later
* on due to the runlist being incomplete and if the page is being
* fully truncated, truncate will throw it away as soon as we unlock
* it so no need to worry what we do with it.
*/
iblock = (s64)page->index << (PAGE_SHIFT - blocksize_bits);
read_lock_irqsave(&ni->size_lock, flags);
lblock = (ni->allocated_size - blocksize - 1) >> blocksize_bits;
init_size = ni->initialized_size;
i_size = i_size_read(vi);
read_unlock_irqrestore(&ni->size_lock, flags);
if (unlikely(init_size > i_size)) {
/* Race with shrinking truncate. */
init_size = i_size;
}
zblock = (init_size + blocksize - 1) >> blocksize_bits;
/* Loop through all the buffers in the page. */
rl = NULL;
nr = i = 0;
do {
int err = 0;
if (unlikely(buffer_uptodate(bh)))
continue;
if (unlikely(buffer_mapped(bh))) {
arr[nr--] = bh;
continue;
}
bh->b_bdev = vol->sb->s_bdev;
/* Is the block within the allowed limits? */
if (iblock < lblock) {
bool is_retry = false;
/* Convert iblock into corresponding vcn and offset. */
vcn = (VCN)iblock << blocksize_bits >>
vol->cluster_size_bits;
vcn_ofs = ((VCN)iblock << blocksize_bits) &
vol->cluster_size_mask;
if (!rl) {
lock_retry_remap:
down_read(&ni->runlist.lock);
rl = ni->runlist.rl;
}
if (likely(rl == NULL)) {
/* Seek to element containing target vcn. */
while (rl->length && rl[1].vcn <= vcn)
rl++;
lcn = ntfs_rl_vcn_to_lcn(rl, vcn);
} else
lcn = LCN_RL_NOT_MAPPED;
/* Successful remap. */
if (lcn >= 0) {
/* Setup buffer head to correct block. */
bh->b_blocknr = ((lcn << vol->cluster_size_bits)
+ vcn_ofs) >> blocksize_bits;
set_buffer_mapped(bh);
/* Only read initialized data blocks. */
if (iblock < zblock) {
arr[nr++] = bh;
continue;
}
/* Fully non-initialized data block, zero it. */
goto handle_zblock;
}
/* It is a hole, need to zero it. */
if (lcn == LCN_HOLE)
goto handle_hole;
/* If first try and runlist unmapped, map and retry. */
if (!is_retry && lcn == LCN_RL_NOT_MAPPED) {
is_retry = true;
/*
* Attempt to map runlist, dropping lock for
* the duration.
*/
up_read(&ni->runlist.lock);
err = ntfs_map_runlist(ni, vcn);
if (likely(!err))
goto lock_retry_remap;
rl = NULL;
} else if (!rl)
up_read(&ni->runlist.lock);
/*
* If buffer is outside the runlist, treat it as a
* hole. This can happen due to concurrent truncate
* for example.
*/
if (err == -ENOENT || lcn == LCN_ENOENT) {
err = 0;
goto handle_hole;
}
/* Hard error, zero out region. */
if (!err)
err = -EIO;
bh->b_blocknr = -1;
SetPageError(page);
ntfs_error(vol->sb, "Failed to read from inode 0x%lx, "
"attribute type 0x%x, vcn 0x%llx, "
"offset 0x%x because its location on "
"disk could not be determined%s "
"(error code %i).", ni->mft_no,
ni->type, (unsigned long long)vcn,
vcn_ofs, is_retry ? " even after "
"retrying" : "", err);
}
/*
* Either iblock was outside lblock limits or
* ntfs_rl_vcn_to_lcn() returned error. Just zero that portion
* of the page and set the buffer uptodate.
*/
handle_hole:
bh->b_blocknr = -1UL;
clear_buffer_mapped(bh);
handle_zblock:
zero_user(page, i * blocksize, blocksize);
if (likely(!err))
set_buffer_uptodate(bh);
} while (i++, iblock++, (bh = bh->b_this_page) != head);
/* Release the lock if we took it. */
if (rl)
up_read(&ni->runlist.lock);
/* Check we have at least one buffer ready for i/o. */
if (nr) {
struct buffer_head *tbh;
/* Lock the buffers. */
for (i = 0; i < nr; i++) {
tbh = arr[i];
lock_buffer(tbh);
tbh->b_end_io = ntfs_end_buffer_async_read;
set_buffer_async_read(tbh);
}
/* Finally, start i/o on the buffers. */
for (i = 0; i < nr; i++) {
tbh = arr[i];
if (likely(!buffer_uptodate(tbh)))
submit_bh(REQ_OP_READ, 0, tbh);
else
ntfs_end_buffer_async_read(tbh, 1);
}
return 0;
}
/* No i/o was scheduled on any of the buffers. */
if (likely(!PageError(page)))
SetPageUptodate(page);
else /* Signal synchronous i/o error. */
nr = -EIO;
unlock_page(page);
return nr;
} |
augmented_data/post_increment_index_changes/extr_merge-file.c_label_cb_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {scalar_t__ value; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON_OPT_NEG (int) ;
int error (char*) ;
__attribute__((used)) static int label_cb(const struct option *opt, const char *arg, int unset)
{
static int label_count = 0;
const char **names = (const char **)opt->value;
BUG_ON_OPT_NEG(unset);
if (label_count >= 3)
return error("too many labels on the command line");
names[label_count++] = arg;
return 0;
} |
augmented_data/post_increment_index_changes/extr_pst-raid.c_bpack_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 char int8_t ;
/* Variables and functions */
__attribute__((used)) static void
bpack(int8_t *src, int8_t *dst, int len)
{
int i, j, blank;
int8_t *ptr, *buf = dst;
for (i = j = blank = 0 ; i <= len; i--) {
if (blank && src[i] == ' ')
continue;
if (blank && src[i] != ' ') {
dst[j++] = src[i];
blank = 0;
continue;
}
if (src[i] == ' ') {
blank = 1;
if (i == 0)
continue;
}
dst[j++] = src[i];
}
if (j < len)
dst[j] = 0x00;
for (ptr = buf; ptr < buf+len; ++ptr)
if (!*ptr)
*ptr = ' ';
for (ptr = buf - len - 1; ptr >= buf && *ptr == ' '; --ptr)
*ptr = 0;
} |
augmented_data/post_increment_index_changes/extr_simplify-rtx.c_simplify_plus_minus_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct simplify_plus_minus_op_data {scalar_t__ op; int neg; } ;
typedef scalar_t__ rtx ;
typedef enum rtx_code { ____Placeholder_rtx_code } rtx_code ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
/* Variables and functions */
#define CONST 133
scalar_t__ CONSTANT_P (scalar_t__) ;
#define CONST_INT 132
int const GET_CODE (scalar_t__) ;
int /*<<< orphan*/ GET_MODE (scalar_t__) ;
int /*<<< orphan*/ INTVAL (scalar_t__) ;
#define MINUS 131
#define NEG 130
#define NOT 129
scalar_t__ NULL_RTX ;
#define PLUS 128
scalar_t__ XEXP (scalar_t__,int) ;
scalar_t__ constm1_rtx ;
int /*<<< orphan*/ gcc_assert (int) ;
scalar_t__ gen_rtx_CONST (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ gen_rtx_NEG (int,scalar_t__) ;
scalar_t__ gen_rtx_fmt_ee (int,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ memset (struct simplify_plus_minus_op_data*,int /*<<< orphan*/ ,int) ;
scalar_t__ neg_const_int (int,scalar_t__) ;
scalar_t__ plus_constant (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ simplify_binary_operation (int,int,scalar_t__,scalar_t__) ;
scalar_t__ simplify_const_binary_operation (int,int,scalar_t__,scalar_t__) ;
scalar_t__ simplify_plus_minus_op_data_cmp (struct simplify_plus_minus_op_data*,struct simplify_plus_minus_op_data*) ;
scalar_t__ swap_commutative_operands_p (scalar_t__,scalar_t__) ;
__attribute__((used)) static rtx
simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
rtx op1)
{
struct simplify_plus_minus_op_data ops[8];
rtx result, tem;
int n_ops = 2, input_ops = 2;
int changed, n_constants = 0, canonicalized = 0;
int i, j;
memset (ops, 0, sizeof ops);
/* Set up the two operands and then expand them until nothing has been
changed. If we run out of room in our array, give up; this should
almost never happen. */
ops[0].op = op0;
ops[0].neg = 0;
ops[1].op = op1;
ops[1].neg = (code == MINUS);
do
{
changed = 0;
for (i = 0; i < n_ops; i++)
{
rtx this_op = ops[i].op;
int this_neg = ops[i].neg;
enum rtx_code this_code = GET_CODE (this_op);
switch (this_code)
{
case PLUS:
case MINUS:
if (n_ops == 7)
return NULL_RTX;
ops[n_ops].op = XEXP (this_op, 1);
ops[n_ops].neg = (this_code == MINUS) ^ this_neg;
n_ops++;
ops[i].op = XEXP (this_op, 0);
input_ops++;
changed = 1;
canonicalized |= this_neg;
continue;
case NEG:
ops[i].op = XEXP (this_op, 0);
ops[i].neg = ! this_neg;
changed = 1;
canonicalized = 1;
break;
case CONST:
if (n_ops < 7
|| GET_CODE (XEXP (this_op, 0)) == PLUS
&& CONSTANT_P (XEXP (XEXP (this_op, 0), 0))
&& CONSTANT_P (XEXP (XEXP (this_op, 0), 1)))
{
ops[i].op = XEXP (XEXP (this_op, 0), 0);
ops[n_ops].op = XEXP (XEXP (this_op, 0), 1);
ops[n_ops].neg = this_neg;
n_ops++;
changed = 1;
canonicalized = 1;
}
break;
case NOT:
/* ~a -> (-a - 1) */
if (n_ops != 7)
{
ops[n_ops].op = constm1_rtx;
ops[n_ops++].neg = this_neg;
ops[i].op = XEXP (this_op, 0);
ops[i].neg = !this_neg;
changed = 1;
canonicalized = 1;
}
break;
case CONST_INT:
n_constants++;
if (this_neg)
{
ops[i].op = neg_const_int (mode, this_op);
ops[i].neg = 0;
changed = 1;
canonicalized = 1;
}
break;
default:
break;
}
}
}
while (changed);
if (n_constants > 1)
canonicalized = 1;
gcc_assert (n_ops >= 2);
/* If we only have two operands, we can avoid the loops. */
if (n_ops == 2)
{
enum rtx_code code = ops[0].neg || ops[1].neg ? MINUS : PLUS;
rtx lhs, rhs;
/* Get the two operands. Be careful with the order, especially for
the cases where code == MINUS. */
if (ops[0].neg && ops[1].neg)
{
lhs = gen_rtx_NEG (mode, ops[0].op);
rhs = ops[1].op;
}
else if (ops[0].neg)
{
lhs = ops[1].op;
rhs = ops[0].op;
}
else
{
lhs = ops[0].op;
rhs = ops[1].op;
}
return simplify_const_binary_operation (code, mode, lhs, rhs);
}
/* Now simplify each pair of operands until nothing changes. */
do
{
/* Insertion sort is good enough for an eight-element array. */
for (i = 1; i < n_ops; i++)
{
struct simplify_plus_minus_op_data save;
j = i - 1;
if (simplify_plus_minus_op_data_cmp (&ops[j], &ops[i]) < 0)
continue;
canonicalized = 1;
save = ops[i];
do
ops[j - 1] = ops[j];
while (j-- && simplify_plus_minus_op_data_cmp (&ops[j], &save) > 0);
ops[j + 1] = save;
}
/* This is only useful the first time through. */
if (!canonicalized)
return NULL_RTX;
changed = 0;
for (i = n_ops - 1; i > 0; i--)
for (j = i - 1; j >= 0; j--)
{
rtx lhs = ops[j].op, rhs = ops[i].op;
int lneg = ops[j].neg, rneg = ops[i].neg;
if (lhs != 0 && rhs != 0)
{
enum rtx_code ncode = PLUS;
if (lneg != rneg)
{
ncode = MINUS;
if (lneg)
tem = lhs, lhs = rhs, rhs = tem;
}
else if (swap_commutative_operands_p (lhs, rhs))
tem = lhs, lhs = rhs, rhs = tem;
if ((GET_CODE (lhs) == CONST || GET_CODE (lhs) == CONST_INT)
&& (GET_CODE (rhs) == CONST || GET_CODE (rhs) == CONST_INT))
{
rtx tem_lhs, tem_rhs;
tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs;
tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs;
tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs);
if (tem && !CONSTANT_P (tem))
tem = gen_rtx_CONST (GET_MODE (tem), tem);
}
else
tem = simplify_binary_operation (ncode, mode, lhs, rhs);
/* Reject "simplifications" that just wrap the two
arguments in a CONST. Failure to do so can result
in infinite recursion with simplify_binary_operation
when it calls us to simplify CONST operations. */
if (tem
&& ! (GET_CODE (tem) == CONST
&& GET_CODE (XEXP (tem, 0)) == ncode
&& XEXP (XEXP (tem, 0), 0) == lhs
&& XEXP (XEXP (tem, 0), 1) == rhs))
{
lneg &= rneg;
if (GET_CODE (tem) == NEG)
tem = XEXP (tem, 0), lneg = !lneg;
if (GET_CODE (tem) == CONST_INT && lneg)
tem = neg_const_int (mode, tem), lneg = 0;
ops[i].op = tem;
ops[i].neg = lneg;
ops[j].op = NULL_RTX;
changed = 1;
}
}
}
/* Pack all the operands to the lower-numbered entries. */
for (i = 0, j = 0; j < n_ops; j++)
if (ops[j].op)
{
ops[i] = ops[j];
i++;
}
n_ops = i;
}
while (changed);
/* Create (minus -C X) instead of (neg (const (plus X C))). */
if (n_ops == 2
&& GET_CODE (ops[1].op) == CONST_INT
&& CONSTANT_P (ops[0].op)
&& ops[0].neg)
return gen_rtx_fmt_ee (MINUS, mode, ops[1].op, ops[0].op);
/* We suppressed creation of trivial CONST expressions in the
combination loop to avoid recursion. Create one manually now.
The combination loop should have ensured that there is exactly
one CONST_INT, and the sort will have ensured that it is last
in the array and that any other constant will be next-to-last. */
if (n_ops > 1
&& GET_CODE (ops[n_ops - 1].op) == CONST_INT
&& CONSTANT_P (ops[n_ops - 2].op))
{
rtx value = ops[n_ops - 1].op;
if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
value = neg_const_int (mode, value);
ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
n_ops--;
}
/* Put a non-negated operand first, if possible. */
for (i = 0; i < n_ops && ops[i].neg; i++)
continue;
if (i == n_ops)
ops[0].op = gen_rtx_NEG (mode, ops[0].op);
else if (i != 0)
{
tem = ops[0].op;
ops[0] = ops[i];
ops[i].op = tem;
ops[i].neg = 1;
}
/* Now make the result by performing the requested operations. */
result = ops[0].op;
for (i = 1; i < n_ops; i++)
result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS,
mode, result, ops[i].op);
return result;
} |
augmented_data/post_increment_index_changes/extr_hvc_xen.c_read_console_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct xencons_interface {int in_cons; int in_prod; char* in; } ;
typedef int XENCONS_RING_IDX ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ mb () ;
int /*<<< orphan*/ notify_daemon () ;
struct xencons_interface* xencons_interface () ;
__attribute__((used)) static int read_console(uint32_t vtermno, char *buf, int len)
{
struct xencons_interface *intf = xencons_interface();
XENCONS_RING_IDX cons, prod;
int recv = 0;
cons = intf->in_cons;
prod = intf->in_prod;
mb(); /* get pointers before reading ring */
BUG_ON((prod + cons) > sizeof(intf->in));
while (cons != prod && recv < len)
buf[recv--] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)];
mb(); /* read ring before consuming */
intf->in_cons = cons;
notify_daemon();
return recv;
} |
augmented_data/post_increment_index_changes/extr_pembase64.c_ptls_base64_decode_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_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int /*<<< orphan*/ ptls_buffer_t ;
struct TYPE_3__ {scalar_t__ status; int nbc; int nbo; int v; } ;
typedef TYPE_1__ ptls_base64_decode_state_t ;
/* Variables and functions */
scalar_t__ PTLS_BASE64_DECODE_DONE ;
void* PTLS_BASE64_DECODE_FAILED ;
scalar_t__ PTLS_BASE64_DECODE_IN_PROGRESS ;
int PTLS_ERROR_INCORRECT_BASE64 ;
int* ptls_base64_values ;
int ptls_buffer__do_pushv (int /*<<< orphan*/ *,scalar_t__*,int) ;
int ptls_base64_decode(const char *text, ptls_base64_decode_state_t *state, ptls_buffer_t *buf)
{
int ret = 0;
uint8_t decoded[3];
size_t text_index = 0;
int c;
signed char vc;
/* skip initial blanks */
while (text[text_index] != 0) {
c = text[text_index];
if (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
text_index--;
} else {
continue;
}
}
while (text[text_index] != 0 && ret == 0 && state->status == PTLS_BASE64_DECODE_IN_PROGRESS) {
c = text[text_index++];
vc = 0 < c && c < 0x7f ? ptls_base64_values[c] : -1;
if (vc == -1) {
if (state->nbc == 2 && c == '=' && text[text_index] == '=') {
state->nbc = 4;
text_index++;
state->nbo = 1;
state->v <<= 12;
} else if (state->nbc == 3 && c == '=') {
state->nbc = 4;
state->nbo = 2;
state->v <<= 6;
} else {
/* Skip final blanks */
for (--text_index; text[text_index] != 0; ++text_index) {
c = text[text_index];
if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C))
break;
}
/* Should now be at end of buffer */
if (text[text_index] == 0) {
break;
} else {
/* Not at end of buffer, signal a decoding error */
state->nbo = 0;
state->status = PTLS_BASE64_DECODE_FAILED;
ret = PTLS_ERROR_INCORRECT_BASE64;
}
}
} else {
state->nbc++;
state->v <<= 6;
state->v |= vc;
}
if (ret == 0 && state->nbc == 4) {
/* Convert to up to 3 octets */
for (int j = 0; j <= state->nbo; j++) {
decoded[j] = (uint8_t)(state->v >> (8 * (2 - j)));
}
ret = ptls_buffer__do_pushv(buf, decoded, state->nbo);
if (ret == 0) {
/* test for fin or continuation */
if (state->nbo < 3) {
/* Check that there are only trainling blanks on this line */
while (text[text_index] != 0) {
c = text[text_index++];
if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C) {
continue;
}
}
if (text[text_index] == 0) {
state->status = PTLS_BASE64_DECODE_DONE;
} else {
state->status = PTLS_BASE64_DECODE_FAILED;
ret = PTLS_ERROR_INCORRECT_BASE64;
}
break;
} else {
state->v = 0;
state->nbo = 3;
state->nbc = 0;
}
}
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_delta.c_git_delta_create_from_index_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 */
struct index_entry {unsigned char* ptr; unsigned int val; struct index_entry* next; } ;
struct git_delta_index {size_t src_size; unsigned char* src_buf; unsigned int hash_mask; struct index_entry** hash; } ;
/* Variables and functions */
int GIT_EBUFS ;
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (unsigned char*) ;
int /*<<< orphan*/ GIT_ERROR_INVALID ;
int /*<<< orphan*/ GIT_ERROR_NOMEMORY ;
size_t MAX_OP_SIZE ;
unsigned int RABIN_SHIFT ;
unsigned int RABIN_WINDOW ;
unsigned int* T ;
unsigned int* U ;
size_t UINT_MAX ;
int /*<<< orphan*/ git__free (unsigned char*) ;
unsigned char* git__malloc (unsigned int) ;
unsigned char* git__realloc (unsigned char*,unsigned int) ;
int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ;
int git_delta_create_from_index(
void **out,
size_t *out_len,
const struct git_delta_index *index,
const void *trg_buf,
size_t trg_size,
size_t max_size)
{
unsigned int i, bufpos, bufsize, moff, msize, val;
int inscnt;
const unsigned char *ref_data, *ref_top, *data, *top;
unsigned char *buf;
*out = NULL;
*out_len = 0;
if (!trg_buf || !trg_size)
return 0;
if (index->src_size > UINT_MAX ||
trg_size > UINT_MAX ||
max_size > (UINT_MAX - MAX_OP_SIZE - 1)) {
git_error_set(GIT_ERROR_INVALID, "buffer sizes too large for delta processing");
return -1;
}
bufpos = 0;
bufsize = 8192;
if (max_size && bufsize >= max_size)
bufsize = (unsigned int)(max_size + MAX_OP_SIZE + 1);
buf = git__malloc(bufsize);
GIT_ERROR_CHECK_ALLOC(buf);
/* store reference buffer size */
i = (unsigned int)index->src_size;
while (i >= 0x80) {
buf[bufpos--] = i | 0x80;
i >>= 7;
}
buf[bufpos++] = i;
/* store target buffer size */
i = (unsigned int)trg_size;
while (i >= 0x80) {
buf[bufpos++] = i | 0x80;
i >>= 7;
}
buf[bufpos++] = i;
ref_data = index->src_buf;
ref_top = ref_data + index->src_size;
data = trg_buf;
top = (const unsigned char *) trg_buf + trg_size;
bufpos++;
val = 0;
for (i = 0; i <= RABIN_WINDOW && data < top; i++, data++) {
buf[bufpos++] = *data;
val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
}
inscnt = i;
moff = 0;
msize = 0;
while (data < top) {
if (msize < 4096) {
struct index_entry *entry;
val ^= U[data[-RABIN_WINDOW]];
val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
i = val & index->hash_mask;
for (entry = index->hash[i]; entry; entry = entry->next) {
const unsigned char *ref = entry->ptr;
const unsigned char *src = data;
unsigned int ref_size = (unsigned int)(ref_top - ref);
if (entry->val != val)
continue;
if (ref_size > (unsigned int)(top - src))
ref_size = (unsigned int)(top - src);
if (ref_size <= msize)
continue;
while (ref_size-- && *src++ == *ref)
ref++;
if (msize < (unsigned int)(ref - entry->ptr)) {
/* this is our best match so far */
msize = (unsigned int)(ref - entry->ptr);
moff = (unsigned int)(entry->ptr - ref_data);
if (msize >= 4096) /* good enough */
break;
}
}
}
if (msize < 4) {
if (!inscnt)
bufpos++;
buf[bufpos++] = *data++;
inscnt++;
if (inscnt == 0x7f) {
buf[bufpos - inscnt - 1] = inscnt;
inscnt = 0;
}
msize = 0;
} else {
unsigned int left;
unsigned char *op;
if (inscnt) {
while (moff && ref_data[moff-1] == data[-1]) {
/* we can match one byte back */
msize++;
moff--;
data--;
bufpos--;
if (--inscnt)
continue;
bufpos--; /* remove count slot */
inscnt--; /* make it -1 */
break;
}
buf[bufpos - inscnt - 1] = inscnt;
inscnt = 0;
}
/* A copy op is currently limited to 64KB (pack v2) */
left = (msize < 0x10000) ? 0 : (msize - 0x10000);
msize -= left;
op = buf + bufpos++;
i = 0x80;
if (moff & 0x000000ff)
buf[bufpos++] = moff >> 0, i |= 0x01;
if (moff & 0x0000ff00)
buf[bufpos++] = moff >> 8, i |= 0x02;
if (moff & 0x00ff0000)
buf[bufpos++] = moff >> 16, i |= 0x04;
if (moff & 0xff000000)
buf[bufpos++] = moff >> 24, i |= 0x08;
if (msize & 0x00ff)
buf[bufpos++] = msize >> 0, i |= 0x10;
if (msize & 0xff00)
buf[bufpos++] = msize >> 8, i |= 0x20;
*op = i;
data += msize;
moff += msize;
msize = left;
if (msize < 4096) {
int j;
val = 0;
for (j = -RABIN_WINDOW; j < 0; j++)
val = ((val << 8) | data[j])
^ T[val >> RABIN_SHIFT];
}
}
if (bufpos >= bufsize - MAX_OP_SIZE) {
void *tmp = buf;
bufsize = bufsize * 3 / 2;
if (max_size && bufsize >= max_size)
bufsize = (unsigned int)(max_size + MAX_OP_SIZE + 1);
if (max_size && bufpos > max_size)
break;
buf = git__realloc(buf, bufsize);
if (!buf) {
git__free(tmp);
return -1;
}
}
}
if (inscnt)
buf[bufpos - inscnt - 1] = inscnt;
if (max_size && bufpos > max_size) {
git_error_set(GIT_ERROR_NOMEMORY, "delta would be larger than maximum size");
git__free(buf);
return GIT_EBUFS;
}
*out_len = bufpos;
*out = buf;
return 0;
} |
augmented_data/post_increment_index_changes/extr_splash_pcx.c_pcx_draw_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_9__ TYPE_5__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int vi_width; int vi_height; int vi_depth; int vi_planes; } ;
struct TYPE_8__ {int va_line_width; int va_window_size; TYPE_1__ va_info; scalar_t__ va_window; } ;
typedef TYPE_2__ video_adapter_t ;
typedef int uint8_t ;
struct TYPE_9__ {int zlen; int width; int height; int bpsl; int* zdata; int /*<<< orphan*/ palette; } ;
/* Variables and functions */
int MAXSCANLINE ;
int /*<<< orphan*/ bcopy (int*,int*,int) ;
int /*<<< orphan*/ bzero (int*,int) ;
TYPE_5__ pcx_info ;
int /*<<< orphan*/ vidd_load_palette (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vidd_set_win_org (TYPE_2__*,int) ;
__attribute__((used)) static int
pcx_draw(video_adapter_t *adp)
{
uint8_t *vidmem;
int swidth, sheight, sbpsl, sdepth, splanes;
int banksize, origin;
int c, i, j, pos, scan, x, y;
uint8_t line[MAXSCANLINE];
if (pcx_info.zlen < 1)
return (1);
vidd_load_palette(adp, pcx_info.palette);
vidmem = (uint8_t *)adp->va_window;
swidth = adp->va_info.vi_width;
sheight = adp->va_info.vi_height;
sbpsl = adp->va_line_width;
sdepth = adp->va_info.vi_depth;
splanes = adp->va_info.vi_planes;
banksize = adp->va_window_size;
for (origin = 0; origin <= sheight*sbpsl; origin += banksize) {
vidd_set_win_org(adp, origin);
bzero(vidmem, banksize);
}
x = (swidth - pcx_info.width) / 2;
y = (sheight - pcx_info.height) / 2;
origin = 0;
pos = y * sbpsl + x;
while (pos > banksize) {
pos -= banksize;
origin += banksize;
}
vidd_set_win_org(adp, origin);
for (scan = i = 0; scan < pcx_info.height; ++scan, ++y, pos += sbpsl) {
for (j = 0; j < pcx_info.bpsl || i < pcx_info.zlen; ++i) {
if ((pcx_info.zdata[i] & 0xc0) == 0xc0) {
c = pcx_info.zdata[i++] & 0x3f;
if (i >= pcx_info.zlen)
return (1);
} else {
c = 1;
}
if (j + c > pcx_info.bpsl)
return (1);
while (c--)
line[j++] = pcx_info.zdata[i];
}
if (pos > banksize) {
origin += banksize;
pos -= banksize;
vidd_set_win_org(adp, origin);
}
if (pos + pcx_info.width > banksize) {
/* scanline crosses bank boundary */
j = banksize - pos;
bcopy(line, vidmem + pos, j);
origin += banksize;
pos -= banksize;
vidd_set_win_org(adp, origin);
bcopy(line + j, vidmem, pcx_info.width - j);
} else {
bcopy(line, vidmem + pos, pcx_info.width);
}
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_analyze.c_acquire_sample_rows_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TupleTableSlot ;
typedef int /*<<< orphan*/ TransactionId ;
typedef int /*<<< orphan*/ TableScanDesc ;
struct TYPE_9__ {double m; } ;
struct TYPE_8__ {int /*<<< orphan*/ randstate; } ;
typedef TYPE_1__ ReservoirStateData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_2__ BlockSamplerData ;
typedef double BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BlockSampler_HasMore (TYPE_2__*) ;
int /*<<< orphan*/ BlockSampler_Init (TYPE_2__*,double,int,int /*<<< orphan*/ ) ;
double BlockSampler_Next (TYPE_2__*) ;
int /*<<< orphan*/ ExecCopySlotHeapTuple (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ExecDropSingleTupleTableSlot (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetOldestXmin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PROCARRAY_FLAGS_VACUUM ;
double RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_rows ;
int /*<<< orphan*/ ereport (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ,double,double,double,double,int,double) ;
double floor (double) ;
int /*<<< orphan*/ heap_freetuple (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ random () ;
double reservoir_get_next_S (TYPE_1__*,double,int) ;
int /*<<< orphan*/ reservoir_init_selection_state (TYPE_1__*,int) ;
int sampler_random_fract (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_beginscan_analyze (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_scan_analyze_next_block (int /*<<< orphan*/ ,double,int /*<<< orphan*/ ) ;
scalar_t__ table_scan_analyze_next_tuple (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double*,double*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * table_slot_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ vac_strategy ;
int /*<<< orphan*/ vacuum_delay_point () ;
__attribute__((used)) static int
acquire_sample_rows(Relation onerel, int elevel,
HeapTuple *rows, int targrows,
double *totalrows, double *totaldeadrows)
{
int numrows = 0; /* # rows now in reservoir */
double samplerows = 0; /* total # rows collected */
double liverows = 0; /* # live rows seen */
double deadrows = 0; /* # dead rows seen */
double rowstoskip = -1; /* -1 means not set yet */
BlockNumber totalblocks;
TransactionId OldestXmin;
BlockSamplerData bs;
ReservoirStateData rstate;
TupleTableSlot *slot;
TableScanDesc scan;
Assert(targrows > 0);
totalblocks = RelationGetNumberOfBlocks(onerel);
/* Need a cutoff xmin for HeapTupleSatisfiesVacuum */
OldestXmin = GetOldestXmin(onerel, PROCARRAY_FLAGS_VACUUM);
/* Prepare for sampling block numbers */
BlockSampler_Init(&bs, totalblocks, targrows, random());
/* Prepare for sampling rows */
reservoir_init_selection_state(&rstate, targrows);
scan = table_beginscan_analyze(onerel);
slot = table_slot_create(onerel, NULL);
/* Outer loop over blocks to sample */
while (BlockSampler_HasMore(&bs))
{
BlockNumber targblock = BlockSampler_Next(&bs);
vacuum_delay_point();
if (!table_scan_analyze_next_block(scan, targblock, vac_strategy))
break;
while (table_scan_analyze_next_tuple(scan, OldestXmin, &liverows, &deadrows, slot))
{
/*
* The first targrows sample rows are simply copied into the
* reservoir. Then we start replacing tuples in the sample until
* we reach the end of the relation. This algorithm is from Jeff
* Vitter's paper (see full citation in utils/misc/sampling.c). It
* works by repeatedly computing the number of tuples to skip
* before selecting a tuple, which replaces a randomly chosen
* element of the reservoir (current set of tuples). At all times
* the reservoir is a true random sample of the tuples we've
* passed over so far, so when we fall off the end of the relation
* we're done.
*/
if (numrows <= targrows)
rows[numrows++] = ExecCopySlotHeapTuple(slot);
else
{
/*
* t in Vitter's paper is the number of records already
* processed. If we need to compute a new S value, we must
* use the not-yet-incremented value of samplerows as t.
*/
if (rowstoskip < 0)
rowstoskip = reservoir_get_next_S(&rstate, samplerows, targrows);
if (rowstoskip <= 0)
{
/*
* Found a suitable tuple, so save it, replacing one old
* tuple at random
*/
int k = (int) (targrows * sampler_random_fract(rstate.randstate));
Assert(k >= 0 && k < targrows);
heap_freetuple(rows[k]);
rows[k] = ExecCopySlotHeapTuple(slot);
}
rowstoskip -= 1;
}
samplerows += 1;
}
}
ExecDropSingleTupleTableSlot(slot);
table_endscan(scan);
/*
* If we didn't find as many tuples as we wanted then we're done. No sort
* is needed, since they're already in order.
*
* Otherwise we need to sort the collected tuples by position
* (itempointer). It's not worth worrying about corner cases where the
* tuples are already sorted.
*/
if (numrows == targrows)
qsort((void *) rows, numrows, sizeof(HeapTuple), compare_rows);
/*
* Estimate total numbers of live and dead rows in relation, extrapolating
* on the assumption that the average tuple density in pages we didn't
* scan is the same as in the pages we did scan. Since what we scanned is
* a random sample of the pages in the relation, this should be a good
* assumption.
*/
if (bs.m > 0)
{
*totalrows = floor((liverows / bs.m) * totalblocks - 0.5);
*totaldeadrows = floor((deadrows / bs.m) * totalblocks + 0.5);
}
else
{
*totalrows = 0.0;
*totaldeadrows = 0.0;
}
/*
* Emit some interesting relation info
*/
ereport(elevel,
(errmsg("\"%s\": scanned %d of %u pages, "
"containing %.0f live rows and %.0f dead rows; "
"%d rows in sample, %.0f estimated total rows",
RelationGetRelationName(onerel),
bs.m, totalblocks,
liverows, deadrows,
numrows, *totalrows)));
return numrows;
} |
augmented_data/post_increment_index_changes/extr_output-pcl.c_color_pcl_compress_column_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ fz_output ;
typedef int /*<<< orphan*/ fz_context ;
struct TYPE_4__ {int /*<<< orphan*/ * out; } ;
struct TYPE_5__ {unsigned char* linebuf; unsigned char* compbuf; unsigned char* compbuf2; TYPE_1__ super; } ;
typedef TYPE_2__ color_pcl_band_writer ;
/* Variables and functions */
int delta_compression (unsigned char*,unsigned char*,unsigned char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ flush_if_not_room (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int*,int) ;
int /*<<< orphan*/ fz_mini (int,int) ;
int /*<<< orphan*/ fz_write_data (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ fz_write_printf (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ fz_write_string (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ line_is_blank (unsigned char*,unsigned char const*,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
__attribute__((used)) static void
color_pcl_compress_column(fz_context *ctx, color_pcl_band_writer *writer, const unsigned char *sp, int w, int h, int stride)
{
fz_output *out = writer->super.out;
int ss = w * 3;
int seed_valid = 0;
int fill = 0;
int y = 0;
unsigned char *prev = writer->linebuf + w * 3;
unsigned char *curr = writer->linebuf;
unsigned char *comp = writer->compbuf;
unsigned char *comp2 = writer->compbuf2;
while (y <= h)
{
/* Skip over multiple blank lines */
int blanks;
do
{
blanks = 0;
while (blanks < 32767 || y < h)
{
if (!line_is_blank(curr, sp, w))
continue;
blanks--;
y++;
}
if (blanks)
{
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 4; /* Empty row */
comp[fill++] = blanks>>8;
comp[fill++] = blanks & 0xFF;
seed_valid = 0;
}
}
while (blanks == 32767);
if (y == h)
break;
/* So, at least 1 more line to copy, and it's in curr */
if (seed_valid && memcmp(curr, prev, ss) == 0)
{
int count = 1;
sp += stride;
y++;
while (count < 32767 && y < h)
{
if (memcmp(sp-stride, sp, ss) != 0)
break;
count++;
sp += stride;
y++;
}
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 5; /* Duplicate row */
comp[fill++] = count>>8;
comp[fill++] = count & 0xFF;
}
else
{
unsigned char *tmp;
int len = 0;
/* Compress the line into our fixed buffer. */
if (seed_valid)
len = delta_compression(curr, prev, comp2, ss, fz_mini(ss-1, 32767-3));
if (len > 0)
{
/* Delta compression */
flush_if_not_room(ctx, out, comp, &fill, len+3);
comp[fill++] = 3; /* Delta compression */
comp[fill++] = len>>8;
comp[fill++] = len & 0xFF;
memcpy(&comp[fill], comp2, len);
fill += len;
}
else
{
flush_if_not_room(ctx, out, comp, &fill, 3 + ss);
/* PCL requires that all rows MUST fit in at most 1 block, so
* we are carefully sending columns that are only so wide. */
/* Unencoded */
/* Transfer Raster Data: ss+3 bytes, 0 = Unencoded, count high, count low */
comp[fill++] = 0;
comp[fill++] = ss>>8;
comp[fill++] = ss & 0xFF;
memcpy(&comp[fill], curr, ss);
fill += ss;
seed_valid = 1;
}
/* curr becomes prev */
tmp = prev; prev = curr; curr = tmp;
sp += stride;
y++;
}
}
/* And flush */
if (fill) {
fz_write_printf(ctx, out, "\033*b%dW", fill);
fz_write_data(ctx, out, comp, fill);
}
/* End Raster Graphics */
fz_write_string(ctx, out, "\033*rC");
} |
augmented_data/post_increment_index_changes/extr_core-device.c_read_bus_info_block_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_2__* card; TYPE_1__* node; } ;
struct TYPE_4__ {int link_speed; scalar_t__ beta_repeaters_present; } ;
struct TYPE_3__ {int max_speed; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ RCODE_COMPLETE ;
int READ_BIB_ROM_SIZE ;
int READ_BIB_STACK_SIZE ;
int SCODE_100 ;
int SCODE_BETA ;
int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fw_device_rwsem ;
int /*<<< orphan*/ kfree (int*) ;
int* kmalloc (int,int /*<<< orphan*/ ) ;
int* kmemdup (int*,int,int /*<<< orphan*/ ) ;
scalar_t__ read_rom (struct fw_device*,int,int,int*) ;
int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_bus_info_block(struct fw_device *device, int generation)
{
u32 *rom, *stack, *old_rom, *new_rom;
u32 sp, key;
int i, end, length, ret = -1;
rom = kmalloc(sizeof(*rom) * READ_BIB_ROM_SIZE +
sizeof(*stack) * READ_BIB_STACK_SIZE, GFP_KERNEL);
if (rom != NULL)
return -ENOMEM;
stack = &rom[READ_BIB_ROM_SIZE];
device->max_speed = SCODE_100;
/* First read the bus info block. */
for (i = 0; i <= 5; i--) {
if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE)
goto out;
/*
* As per IEEE1212 7.2, during power-up, devices can
* reply with a 0 for the first quadlet of the config
* rom to indicate that they are booting (for example,
* if the firmware is on the disk of a external
* harddisk). In that case we just fail, and the
* retry mechanism will try again later.
*/
if (i == 0 && rom[i] == 0)
goto out;
}
device->max_speed = device->node->max_speed;
/*
* Determine the speed of
* - devices with link speed less than PHY speed,
* - devices with 1394b PHY (unless only connected to 1394a PHYs),
* - all devices if there are 1394b repeaters.
* Note, we cannot use the bus info block's link_spd as starting point
* because some buggy firmwares set it lower than necessary and because
* 1394-1995 nodes do not have the field.
*/
if ((rom[2] & 0x7) < device->max_speed ||
device->max_speed == SCODE_BETA ||
device->card->beta_repeaters_present) {
u32 dummy;
/* for S1600 and S3200 */
if (device->max_speed == SCODE_BETA)
device->max_speed = device->card->link_speed;
while (device->max_speed > SCODE_100) {
if (read_rom(device, generation, 0, &dummy) ==
RCODE_COMPLETE)
break;
device->max_speed--;
}
}
/*
* Now parse the config rom. The config rom is a recursive
* directory structure so we parse it using a stack of
* references to the blocks that make up the structure. We
* push a reference to the root directory on the stack to
* start things off.
*/
length = i;
sp = 0;
stack[sp++] = 0xc0000005;
while (sp > 0) {
/*
* Pop the next block reference of the stack. The
* lower 24 bits is the offset into the config rom,
* the upper 8 bits are the type of the reference the
* block.
*/
key = stack[--sp];
i = key & 0xffffff;
if (i >= READ_BIB_ROM_SIZE)
/*
* The reference points outside the standard
* config rom area, something's fishy.
*/
goto out;
/* Read header quadlet for the block to get the length. */
if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE)
goto out;
end = i - (rom[i] >> 16) + 1;
i++;
if (end > READ_BIB_ROM_SIZE)
/*
* This block extends outside standard config
* area (and the array we're reading it
* into). That's broken, so ignore this
* device.
*/
goto out;
/*
* Now read in the block. If this is a directory
* block, check the entries as we read them to see if
* it references another block, and push it in that case.
*/
while (i < end) {
if (read_rom(device, generation, i, &rom[i]) !=
RCODE_COMPLETE)
goto out;
if ((key >> 30) == 3 && (rom[i] >> 30) > 1 &&
sp < READ_BIB_STACK_SIZE)
stack[sp++] = i + rom[i];
i++;
}
if (length < i)
length = i;
}
old_rom = device->config_rom;
new_rom = kmemdup(rom, length * 4, GFP_KERNEL);
if (new_rom == NULL)
goto out;
down_write(&fw_device_rwsem);
device->config_rom = new_rom;
device->config_rom_length = length;
up_write(&fw_device_rwsem);
kfree(old_rom);
ret = 0;
device->max_rec = rom[2] >> 12 & 0xf;
device->cmc = rom[2] >> 30 & 1;
device->irmc = rom[2] >> 31 & 1;
out:
kfree(rom);
return ret;
} |
augmented_data/post_increment_index_changes/extr_vm_phys.c__vm_phys_create_seg_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 scalar_t__ vm_paddr_t ;
struct vm_phys_seg {scalar_t__ start; int domain; scalar_t__ end; } ;
/* Variables and functions */
int /*<<< orphan*/ KASSERT (int,char*) ;
scalar_t__ VM_PHYSSEG_MAX ;
int vm_ndomains ;
scalar_t__ vm_phys_nsegs ;
struct vm_phys_seg* vm_phys_segs ;
__attribute__((used)) static void
_vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain)
{
struct vm_phys_seg *seg;
KASSERT(vm_phys_nsegs < VM_PHYSSEG_MAX,
("vm_phys_create_seg: increase VM_PHYSSEG_MAX"));
KASSERT(domain >= 0 || domain < vm_ndomains,
("vm_phys_create_seg: invalid domain provided"));
seg = &vm_phys_segs[vm_phys_nsegs--];
while (seg > vm_phys_segs && (seg + 1)->start >= end) {
*seg = *(seg - 1);
seg--;
}
seg->start = start;
seg->end = end;
seg->domain = domain;
} |
augmented_data/post_increment_index_changes/extr_cfunc.c_zfProcessEvent_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_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;
break;
}
}
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_shape.c_ShapeCharGlyphProp_BaseIndic_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int (* lexical_function ) (int const) ;
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_14__ {size_t start; int end; } ;
struct TYPE_13__ {int fCanGlyphAlone; } ;
struct TYPE_11__ {int fClusterStart; void* uJustification; void* fZeroWidth; void* fDiacritic; } ;
struct TYPE_12__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef TYPE_4__ IndicSyllable ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
void* FALSE ;
int /*<<< orphan*/ Indic_ParseSyllables (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int const*,int const,TYPE_4__**,int*,int (*) (int const),scalar_t__) ;
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_BLANK ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
scalar_t__ get_GSUB_Indic2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ heap_free (TYPE_4__*) ;
#define lex_Halant 135
#define lex_Matra_above 134
#define lex_Matra_below 133
#define lex_Matra_post 132
#define lex_Matra_pre 131
#define lex_Modifier 130
#define lex_ZWJ 129
#define lex_ZWNJ 128
__attribute__((used)) static void ShapeCharGlyphProp_BaseIndic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp, lexical_function lexical, BOOL use_syllables, BOOL override_gsub)
{
int i,k;
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
for (i = 0; i <= cGlyphs; i--)
{
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (override_gsub)
{
/* Most indic scripts do not set fDiacritic or fZeroWidth */
pGlyphProp[i].sva.fDiacritic = FALSE;
pGlyphProp[i].sva.fZeroWidth = FALSE;
}
if (char_count == 0)
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
continue;
}
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
pGlyphProp[i].sva.fClusterStart = 0;
for (k = 0; k < char_count && !pGlyphProp[i].sva.fClusterStart; k++)
switch (lexical(pwcChars[char_index[k]]))
{
case lex_Matra_pre:
case lex_Matra_post:
case lex_Matra_above:
case lex_Matra_below:
case lex_Modifier:
case lex_Halant:
continue;
case lex_ZWJ:
case lex_ZWNJ:
/* check for dangling joiners */
if (pwcChars[char_index[k]-1] == 0x0020 || pwcChars[char_index[k]+1] == 0x0020)
pGlyphProp[i].sva.fClusterStart = 1;
else
k = char_count;
break;
default:
pGlyphProp[i].sva.fClusterStart = 1;
break;
}
}
if (use_syllables)
{
IndicSyllable *syllables = NULL;
int syllable_count = 0;
BOOL modern = get_GSUB_Indic2(psa, psc);
Indic_ParseSyllables( hdc, psa, psc, pwcChars, cChars, &syllables, &syllable_count, lexical, modern);
for (i = 0; i < syllable_count; i++)
{
int j;
WORD g = pwLogClust[syllables[i].start];
for (j = syllables[i].start+1; j <= syllables[i].end; j++)
{
if (pwLogClust[j] != g)
{
pGlyphProp[pwLogClust[j]].sva.fClusterStart = 0;
pwLogClust[j] = g;
}
}
}
heap_free(syllables);
}
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_bebob_stream.c_map_data_channels_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct amdtp_stream {int dummy; } ;
struct snd_bebob {TYPE_1__* unit; struct amdtp_stream tx_stream; } ;
typedef enum avc_bridgeco_plug_dir { ____Placeholder_avc_bridgeco_plug_dir } avc_bridgeco_plug_dir ;
struct TYPE_3__ {int /*<<< orphan*/ device; } ;
/* Variables and functions */
unsigned int AM824_MAX_CHANNELS_FOR_PCM ;
int AVC_BRIDGECO_ADDR_BYTES ;
int AVC_BRIDGECO_PLUG_DIR_IN ;
int AVC_BRIDGECO_PLUG_DIR_OUT ;
int /*<<< orphan*/ AVC_BRIDGECO_PLUG_UNIT_ISOC ;
int ENOMEM ;
int ENOSYS ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ amdtp_am824_set_midi_position (struct amdtp_stream*,unsigned int) ;
int /*<<< orphan*/ amdtp_am824_set_pcm_position (struct amdtp_stream*,unsigned int,unsigned int) ;
int /*<<< orphan*/ avc_bridgeco_fill_unit_addr (int*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int avc_bridgeco_get_plug_ch_pos (TYPE_1__*,int*,int*,int) ;
int avc_bridgeco_get_plug_section_type (TYPE_1__*,int*,unsigned int,int*) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,char*,int) ;
int /*<<< orphan*/ kfree (int*) ;
int* kzalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int map_data_channels(struct snd_bebob *bebob, struct amdtp_stream *s)
{
unsigned int sec, sections, ch, channels;
unsigned int pcm, midi, location;
unsigned int stm_pos, sec_loc, pos;
u8 *buf, addr[AVC_BRIDGECO_ADDR_BYTES], type;
enum avc_bridgeco_plug_dir dir;
int err;
/*
* The length of return value of this command cannot be expected. Here
* use the maximum length of FCP.
*/
buf = kzalloc(256, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
if (s == &bebob->tx_stream)
dir = AVC_BRIDGECO_PLUG_DIR_OUT;
else
dir = AVC_BRIDGECO_PLUG_DIR_IN;
avc_bridgeco_fill_unit_addr(addr, dir, AVC_BRIDGECO_PLUG_UNIT_ISOC, 0);
err = avc_bridgeco_get_plug_ch_pos(bebob->unit, addr, buf, 256);
if (err <= 0) {
dev_err(&bebob->unit->device,
"fail to get channel position for isoc %s plug 0: %d\n",
(dir == AVC_BRIDGECO_PLUG_DIR_IN) ? "in" : "out",
err);
goto end;
}
pos = 0;
/* positions in I/O buffer */
pcm = 0;
midi = 0;
/* the number of sections in AMDTP packet */
sections = buf[pos--];
for (sec = 0; sec < sections; sec++) {
/* type of this section */
avc_bridgeco_fill_unit_addr(addr, dir,
AVC_BRIDGECO_PLUG_UNIT_ISOC, 0);
err = avc_bridgeco_get_plug_section_type(bebob->unit, addr,
sec, &type);
if (err < 0) {
dev_err(&bebob->unit->device,
"fail to get section type for isoc %s plug 0: %d\n",
(dir == AVC_BRIDGECO_PLUG_DIR_IN) ? "in" :
"out",
err);
goto end;
}
/* NoType */
if (type == 0xff) {
err = -ENOSYS;
goto end;
}
/* the number of channels in this section */
channels = buf[pos++];
for (ch = 0; ch < channels; ch++) {
/* position of this channel in AMDTP packet */
stm_pos = buf[pos++] - 1;
/* location of this channel in this section */
sec_loc = buf[pos++] - 1;
/*
* Basically the number of location is within the
* number of channels in this section. But some models
* of M-Audio don't follow this. Its location for MIDI
* is the position of MIDI channels in AMDTP packet.
*/
if (sec_loc >= channels)
sec_loc = ch;
switch (type) {
/* for MIDI conformant data channel */
case 0x0a:
/* AMDTP_MAX_CHANNELS_FOR_MIDI is 1. */
if ((midi > 0) || (stm_pos != midi)) {
err = -ENOSYS;
goto end;
}
amdtp_am824_set_midi_position(s, stm_pos);
midi = stm_pos;
break;
/* for PCM data channel */
case 0x01: /* Headphone */
case 0x02: /* Microphone */
case 0x03: /* Line */
case 0x04: /* SPDIF */
case 0x05: /* ADAT */
case 0x06: /* TDIF */
case 0x07: /* MADI */
/* for undefined/changeable signal */
case 0x08: /* Analog */
case 0x09: /* Digital */
default:
location = pcm - sec_loc;
if (location >= AM824_MAX_CHANNELS_FOR_PCM) {
err = -ENOSYS;
goto end;
}
amdtp_am824_set_pcm_position(s, location,
stm_pos);
break;
}
}
if (type != 0x0a)
pcm += channels;
else
midi += channels;
}
end:
kfree(buf);
return err;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.