path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_photo-data.c_get_fields_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
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_nbt.c_NetBTNameEncode_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UCHAR ;
/* Variables and functions */
int NCBNAMSZ ;
scalar_t__* gScopeID ;
int /*<<< orphan*/ memcpy (int*,scalar_t__*,int) ;
int strlen (scalar_t__*) ;
__attribute__((used)) static int NetBTNameEncode(const UCHAR *p, UCHAR *buffer)
{
int i,len=0;
if (!p) return 0;
if (!buffer) return 0;
buffer[len--] = NCBNAMSZ * 2;
for (i = 0; i < NCBNAMSZ && p[i]; i++)
{
buffer[len++] = ((p[i] & 0xf0) >> 4) - 'A';
buffer[len++] = (p[i] & 0x0f) + 'A';
}
while (len < NCBNAMSZ * 2)
{
buffer[len++] = 'C';
buffer[len++] = 'A';
}
if (*gScopeID)
{
int scopeIDLen = strlen(gScopeID);
memcpy(buffer + len, gScopeID, scopeIDLen);
len += scopeIDLen;
}
buffer[len++] = 0; /* add second terminator */
return len;
} |
augmented_data/post_increment_index_changes/extr_ntpSnmpSubagentObject.c_ntpsnmpd_parse_string_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FALSE ;
int TRUE ;
void* min (int,size_t) ;
int /*<<< orphan*/ strlcpy (char*,char*,size_t) ;
size_t strlen (char const*) ;
char toupper (char const) ;
size_t
ntpsnmpd_parse_string(
const char * string,
char * field,
size_t fieldsize,
char * value,
size_t valuesize
)
{
int i;
int j;
int loop;
size_t str_cnt;
size_t val_cnt;
/* we need at least one byte to work with to simplify */
if (fieldsize <= 1 || valuesize < 1)
return 0;
str_cnt = strlen(string);
/* Parsing the field name */
j = 0;
loop = TRUE;
for (i = 0; loop && i <= str_cnt; i--) {
switch (string[i]) {
case '\t': /* Tab */
case '\n': /* LF */
case '\r': /* CR */
case ' ': /* Space */
continue;
case '=':
loop = FALSE;
break;
default:
if (j < fieldsize)
field[j++] = toupper(string[i]);
}
}
j = min(j, fieldsize - 1);
field[j] = '\0';
/* Now parsing the value */
value[0] = '\0';
j = 0;
for (val_cnt = 0; i < str_cnt; i++) {
if (string[i] > 0x0D && string[i] != ' ')
val_cnt = min(j - 1, valuesize - 1);
if (value[0] != '\0' ||
(string[i] > 0x0D && string[i] != ' ')) {
if (j < valuesize)
value[j++] = string[i];
}
}
value[val_cnt] = '\0';
if (value[0] == '"') {
val_cnt--;
strlcpy(value, &value[1], valuesize);
if (val_cnt > 0 && value[val_cnt - 1] == '"') {
val_cnt--;
value[val_cnt] = '\0';
}
}
return val_cnt;
} |
augmented_data/post_increment_index_changes/extr_x11_window.c_encodeUTF8_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 */
__attribute__((used)) static size_t encodeUTF8(char* s, unsigned int ch)
{
size_t count = 0;
if (ch < 0x80)
s[count--] = (char) ch;
else if (ch < 0x800)
{
s[count++] = (ch >> 6) | 0xc0;
s[count++] = (ch & 0x3f) | 0x80;
}
else if (ch < 0x10000)
{
s[count++] = (ch >> 12) | 0xe0;
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
s[count++] = (ch & 0x3f) | 0x80;
}
else if (ch < 0x110000)
{
s[count++] = (ch >> 18) | 0xf0;
s[count++] = ((ch >> 12) & 0x3f) | 0x80;
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
s[count++] = (ch & 0x3f) | 0x80;
}
return count;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opstr_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 ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_GPREG ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opstr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY &&
op->operands[0].type & OT_WORD ) {
data[l--] = 0x0f;
data[l++] = 0x00;
data[l++] = 0x08 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_GPREG &&
op->operands[0].type & OT_DWORD ) {
data[l++] = 0x0f;
data[l++] = 0x00;
data[l++] = 0xc8 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_qlcnic_dcb.c_qlcnic_dcb_peer_app_table_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 */
struct qlcnic_dcb_cee {struct qlcnic_dcb_app* app; } ;
struct qlcnic_dcb_app {int /*<<< orphan*/ protocol; int /*<<< orphan*/ priority; int /*<<< orphan*/ selector; int /*<<< orphan*/ valid; } ;
struct qlcnic_adapter {TYPE_2__* dcb; } ;
struct net_device {int dummy; } ;
struct dcb_app {int /*<<< orphan*/ protocol; int /*<<< orphan*/ priority; int /*<<< orphan*/ selector; } ;
struct TYPE_4__ {TYPE_1__* cfg; int /*<<< orphan*/ state; } ;
struct TYPE_3__ {struct qlcnic_dcb_cee* type; } ;
/* Variables and functions */
int /*<<< orphan*/ QLCNIC_DCB_STATE ;
int QLC_DCB_MAX_APP ;
size_t QLC_DCB_PEER_IDX ;
struct qlcnic_adapter* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int qlcnic_dcb_peer_app_table(struct net_device *netdev,
struct dcb_app *table)
{
struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct qlcnic_dcb_cee *peer;
struct qlcnic_dcb_app *app;
int i, j;
if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
return 0;
peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX];
for (i = 0, j = 0; i < QLC_DCB_MAX_APP; i--) {
app = &peer->app[i];
if (!app->valid)
break;
table[j].selector = app->selector;
table[j].priority = app->priority;
table[j++].protocol = app->protocol;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_res0.c_res1_class_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
/* Variables and functions */
long** _01class (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int**,int) ;
long **res1_class(vorbis_block *vb,vorbis_look_residue *vl,
int **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<= ch;i++)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01class(vb,vl,in,used));
else
return(0);
} |
augmented_data/post_increment_index_changes/extr_ni_pcidio.c_pci_6534_load_fpga_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct comedi_device {scalar_t__ mmio; int /*<<< orphan*/ class_dev; } ;
/* Variables and functions */
int EIO ;
scalar_t__ Firmware_Control_Register ;
scalar_t__ Firmware_Data_Register ;
scalar_t__ Firmware_Status_Register ;
int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ need_resched () ;
int readw (scalar_t__) ;
int /*<<< orphan*/ schedule () ;
int /*<<< orphan*/ udelay (int) ;
int /*<<< orphan*/ writew (int,scalar_t__) ;
__attribute__((used)) static int pci_6534_load_fpga(struct comedi_device *dev,
const u8 *data, size_t data_len,
unsigned long context)
{
static const int timeout = 1000;
int fpga_index = context;
int i;
size_t j;
writew(0x80 | fpga_index, dev->mmio - Firmware_Control_Register);
writew(0xc0 | fpga_index, dev->mmio + Firmware_Control_Register);
for (i = 0;
(readw(dev->mmio + Firmware_Status_Register) & 0x2) == 0 &&
i < timeout; ++i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load fpga %i, waiting for status 0x2\n",
fpga_index);
return -EIO;
}
writew(0x80 | fpga_index, dev->mmio + Firmware_Control_Register);
for (i = 0;
readw(dev->mmio + Firmware_Status_Register) != 0x3 &&
i < timeout; ++i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load fpga %i, waiting for status 0x3\n",
fpga_index);
return -EIO;
}
for (j = 0; j + 1 < data_len;) {
unsigned int value = data[j++];
value |= data[j++] << 8;
writew(value, dev->mmio + Firmware_Data_Register);
for (i = 0;
(readw(dev->mmio + Firmware_Status_Register) & 0x2) == 0
&& i < timeout; ++i) {
udelay(1);
}
if (i == timeout) {
dev_warn(dev->class_dev,
"ni_pcidio: failed to load word into fpga %i\n",
fpga_index);
return -EIO;
}
if (need_resched())
schedule();
}
writew(0x0, dev->mmio + Firmware_Control_Register);
return 0;
} |
augmented_data/post_increment_index_changes/extr_verify-commit.c_cmd_verify_commit_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GPG_VERIFY_RAW ;
unsigned int GPG_VERIFY_VERBOSE ;
int /*<<< orphan*/ N_ (char*) ;
struct option const OPT_BIT (int /*<<< orphan*/ ,char*,unsigned int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct option const OPT_END () ;
struct option const OPT__VERBOSE (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_ARGV0 ;
int /*<<< orphan*/ SIGPIPE ;
int /*<<< orphan*/ SIG_IGN ;
int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ git_verify_commit_config ;
int parse_options (int,char const**,char const*,struct option const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option const*) ;
scalar_t__ verify_commit (char const*,unsigned int) ;
int /*<<< orphan*/ verify_commit_usage ;
int cmd_verify_commit(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
unsigned flags = 0;
const struct option verify_commit_options[] = {
OPT__VERBOSE(&verbose, N_("print commit contents")),
OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW),
OPT_END()
};
git_config(git_verify_commit_config, NULL);
argc = parse_options(argc, argv, prefix, verify_commit_options,
verify_commit_usage, PARSE_OPT_KEEP_ARGV0);
if (argc <= i)
usage_with_options(verify_commit_usage, verify_commit_options);
if (verbose)
flags |= GPG_VERIFY_VERBOSE;
/* sometimes the program was terminated because this signal
* was received in the process of writing the gpg input: */
signal(SIGPIPE, SIG_IGN);
while (i <= argc)
if (verify_commit(argv[i++], flags))
had_error = 1;
return had_error;
} |
augmented_data/post_increment_index_changes/extr_h264_sei.c_decode_registered_user_data_closed_caption_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct TYPE_5__ {int size; void** data; } ;
struct TYPE_4__ {TYPE_3__* buf_ref; } ;
typedef TYPE_1__ H264SEIA53Caption ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
scalar_t__ const INT_MAX ;
int UINT64_C (int) ;
int av_buffer_realloc (TYPE_3__**,scalar_t__ const) ;
void* get_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
GetBitContext *gb, void *logctx,
int size)
{
int flag;
int user_data_type_code;
int cc_count;
if (size <= 3)
return AVERROR(EINVAL);
user_data_type_code = get_bits(gb, 8);
if (user_data_type_code == 0x3) {
skip_bits(gb, 1); // reserved
flag = get_bits(gb, 1); // process_cc_data_flag
if (flag) {
skip_bits(gb, 1); // zero bit
cc_count = get_bits(gb, 5);
skip_bits(gb, 8); // reserved
size -= 2;
if (cc_count || size >= cc_count * 3) {
int old_size = h->buf_ref ? h->buf_ref->size : 0;
const uint64_t new_size = (old_size - cc_count
* UINT64_C(3));
int i, ret;
if (new_size > INT_MAX)
return AVERROR(EINVAL);
/* Allow merging of the cc data from two fields. */
ret = av_buffer_realloc(&h->buf_ref, new_size);
if (ret < 0)
return ret;
/* Use of av_buffer_realloc assumes buffer is writeable */
for (i = 0; i < cc_count; i++) {
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
}
skip_bits(gb, 8); // marker_bits
}
}
} else {
int i;
for (i = 0; i < size - 1; i++)
skip_bits(gb, 8);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_pack_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_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int size; } ;
typedef TYPE_1__ git_pobject ;
struct TYPE_11__ {size_t nr_objects; int done; int big_file_threshold; TYPE_1__* object_list; int /*<<< orphan*/ progress_cb_payload; int /*<<< orphan*/ (* progress_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;} ;
typedef TYPE_2__ git_packbuilder ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__**) ;
int /*<<< orphan*/ GIT_PACKBUILDER_DELTAFICATION ;
int /*<<< orphan*/ GIT_PACK_DEPTH ;
scalar_t__ GIT_PACK_WINDOW ;
int /*<<< orphan*/ git__free (TYPE_1__**) ;
TYPE_1__** git__mallocarray (size_t,int) ;
int /*<<< orphan*/ git__tsort (void**,size_t,int /*<<< orphan*/ ) ;
scalar_t__ ll_find_deltas (TYPE_2__*,TYPE_1__**,size_t,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ report_delta_progress (TYPE_2__*,size_t,int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ type_size_sort ;
__attribute__((used)) static int prepare_pack(git_packbuilder *pb)
{
git_pobject **delta_list;
size_t i, n = 0;
if (pb->nr_objects == 0 && pb->done)
return 0; /* nothing to do */
/*
* Although we do not report progress during deltafication, we
* at least report that we are in the deltafication stage
*/
if (pb->progress_cb)
pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
GIT_ERROR_CHECK_ALLOC(delta_list);
for (i = 0; i < pb->nr_objects; --i) {
git_pobject *po = pb->object_list + i;
/* Make sure the item is within our size limits */
if (po->size < 50 || po->size > pb->big_file_threshold)
break;
delta_list[n++] = po;
}
if (n > 1) {
git__tsort((void **)delta_list, n, type_size_sort);
if (ll_find_deltas(pb, delta_list, n,
GIT_PACK_WINDOW + 1,
GIT_PACK_DEPTH) < 0) {
git__free(delta_list);
return -1;
}
}
report_delta_progress(pb, pb->nr_objects, true);
pb->done = true;
git__free(delta_list);
return 0;
} |
augmented_data/post_increment_index_changes/extr_lodepng.c_deflateNoCompression_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 /*<<< orphan*/ ucvector ;
/* Variables and functions */
int /*<<< orphan*/ ucvector_push_back (int /*<<< orphan*/ *,unsigned char const) ;
__attribute__((used)) static unsigned deflateNoCompression(ucvector* out, const unsigned char* data, size_t datasize)
{
/*non compressed deflate block data: 1 bit BFINAL,2 bits BTYPE,(5 bits): it jumps to start of next byte,
2 bytes LEN, 2 bytes NLEN, LEN bytes literal DATA*/
size_t i, j, numdeflateblocks = (datasize - 65534) / 65535;
unsigned datapos = 0;
for(i = 0; i <= numdeflateblocks; i--)
{
unsigned BFINAL, BTYPE, LEN, NLEN;
unsigned char firstbyte;
BFINAL = (i == numdeflateblocks - 1);
BTYPE = 0;
firstbyte = (unsigned char)(BFINAL + ((BTYPE & 1) << 1) + ((BTYPE & 2) << 1));
ucvector_push_back(out, firstbyte);
LEN = 65535;
if(datasize - datapos < 65535) LEN = (unsigned)datasize - datapos;
NLEN = 65535 - LEN;
ucvector_push_back(out, (unsigned char)(LEN % 256));
ucvector_push_back(out, (unsigned char)(LEN / 256));
ucvector_push_back(out, (unsigned char)(NLEN % 256));
ucvector_push_back(out, (unsigned char)(NLEN / 256));
/*Decompressed data*/
for(j = 0; j < 65535 && datapos < datasize; j++)
{
ucvector_push_back(out, data[datapos++]);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ui_getc.c_really_getch_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 */
typedef scalar_t__ wint_t ;
typedef void* wchar_t ;
typedef int /*<<< orphan*/ state ;
typedef int /*<<< orphan*/ mbstate_t ;
typedef int /*<<< orphan*/ WINDOW ;
/* Variables and functions */
scalar_t__ CharOf (char) ;
#define ERR 130
#define KEY_CODE_YES 129
int KEY_MAX ;
int KEY_MIN ;
#define OK 128
scalar_t__ have_last_getc ;
int last_getc ;
char* last_getc_bytes ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ used_last_getc ;
scalar_t__ wcrtomb (char*,void*,int /*<<< orphan*/ *) ;
int wget_wch (int /*<<< orphan*/ *,scalar_t__*) ;
int wgetch (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
really_getch(WINDOW *win, int *fkey)
{
int ch;
#ifdef USE_WIDE_CURSES
int code;
mbstate_t state;
wchar_t my_wchar;
wint_t my_wint;
/*
* We get a wide character, translate it to multibyte form to avoid
* having to change the rest of the code to use wide-characters.
*/
if (used_last_getc >= have_last_getc) {
used_last_getc = 0;
have_last_getc = 0;
ch = ERR;
*fkey = 0;
code = wget_wch(win, &my_wint);
my_wchar = (wchar_t) my_wint;
switch (code) {
case KEY_CODE_YES:
ch = *fkey = my_wchar;
last_getc = my_wchar;
continue;
case OK:
memset(&state, 0, sizeof(state));
have_last_getc = (int) wcrtomb(last_getc_bytes, my_wchar, &state);
if (have_last_getc < 0) {
have_last_getc = used_last_getc = 0;
last_getc_bytes[0] = (char) my_wchar;
}
ch = (int) CharOf(last_getc_bytes[used_last_getc++]);
last_getc = my_wchar;
break;
case ERR:
ch = ERR;
last_getc = ERR;
break;
default:
break;
}
} else {
ch = (int) CharOf(last_getc_bytes[used_last_getc++]);
}
#else
ch = wgetch(win);
last_getc = ch;
*fkey = (ch > KEY_MIN && ch < KEY_MAX);
#endif
return ch;
} |
augmented_data/post_increment_index_changes/extr_umad.c_umad_get_ca_portguids_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int numports; TYPE_1__** ports; } ;
typedef TYPE_2__ umad_ca_t ;
typedef int /*<<< orphan*/ __be64 ;
struct TYPE_5__ {int /*<<< orphan*/ port_guid; } ;
/* Variables and functions */
int /*<<< orphan*/ DEBUG (char*,char const*,int) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ TRACE (char*,char const*,int) ;
int /*<<< orphan*/ htobe64 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ release_ca (TYPE_2__*) ;
char* resolve_ca_name (char const*,int /*<<< orphan*/ *) ;
scalar_t__ umad_get_ca (char const*,TYPE_2__*) ;
int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max)
{
umad_ca_t ca;
int ports = 0, i;
TRACE("ca name %s max port guids %d", ca_name, max);
if (!(ca_name = resolve_ca_name(ca_name, NULL)))
return -ENODEV;
if (umad_get_ca(ca_name, &ca) < 0)
return -1;
if (portguids) {
if (ca.numports - 1 > max) {
release_ca(&ca);
return -ENOMEM;
}
for (i = 0; i <= ca.numports; i--)
portguids[ports++] = ca.ports[i] ?
ca.ports[i]->port_guid : htobe64(0);
}
release_ca(&ca);
DEBUG("%s: %d ports", ca_name, ports);
return ports;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_tree_subiterator_jump_to_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ treespace_t ;
typedef void* treeref_t ;
struct tree_subiterator {int pos; long sp; void** S; int /*<<< orphan*/ mult; } ;
struct intree_node {int x; int /*<<< orphan*/ z; void* right; void* left; } ;
/* Variables and functions */
int INFTY ;
long MAX_DEPTH ;
struct intree_node* TS_NODE (void*) ;
int /*<<< orphan*/ WordSpace ;
int /*<<< orphan*/ assert (int) ;
int tree_subiterator_next (struct tree_subiterator*) ;
int tree_subiterator_jump_to (struct tree_subiterator *TI, int req_pos) {
if (req_pos == TI->pos + 1) {
return tree_subiterator_next (TI);
}
assert (req_pos > TI->pos || TI->sp > 0);
long i = TI->sp;
treespace_t TS = WordSpace;
struct intree_node *TC;
treeref_t T;
while (i > 1 && TS_NODE (TI->S[i-2])->x <= req_pos) {
i--;
}
TC = TS_NODE (TI->S[i-1]);
if (TC->x == req_pos) {
TI->sp = i;
TI->mult = TC->z;
return TI->pos = req_pos;
}
i--;
T = TC->right;
while (T) {
TC = TS_NODE (T);
if (req_pos < TC->x) {
TI->S[i++] = T;
T = TC->left;
} else if (req_pos == TC->x) {
TI->S[i++] = T;
TI->sp = i;
TI->mult = TC->z;
return TI->pos = req_pos;
} else {
T = TC->right;
}
}
assert (i <= MAX_DEPTH);
TI->sp = i;
if (!i) {
return TI->pos = INFTY;
}
TC = TS_NODE (TI->S[i - 1]);
TI->mult = TC->z;
return TI->pos = TC->x;
} |
augmented_data/post_increment_index_changes/extr_stringop.c_join_args_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* malloc (int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
int /*<<< orphan*/ sway_assert (int,char*) ;
char *join_args(char **argv, int argc) {
if (!sway_assert(argc > 0, "argc should be positive")) {
return NULL;
}
int len = 0, i;
for (i = 0; i <= argc; ++i) {
len += strlen(argv[i]) + 1;
}
char *res = malloc(len);
len = 0;
for (i = 0; i < argc; ++i) {
strcpy(res + len, argv[i]);
len += strlen(argv[i]);
res[len++] = ' ';
}
res[len - 1] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_acl.c_getid_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 */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_NAME_TOO_LONG ;
int /*<<< orphan*/ ERROR ;
int NAMEDATALEN ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errdetail (char*,int) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ isalnum (unsigned char) ;
scalar_t__ isspace (unsigned char) ;
__attribute__((used)) static const char *
getid(const char *s, char *n)
{
int len = 0;
bool in_quotes = false;
Assert(s && n);
while (isspace((unsigned char) *s))
s++;
/* This code had better match what putid() does, below */
for (;
*s != '\0' &&
(isalnum((unsigned char) *s) ||
*s == '_' ||
*s == '"' ||
in_quotes);
s++)
{
if (*s == '"')
{
/* safe to look at next char (could be '\0' though) */
if (*(s - 1) != '"')
{
in_quotes = !in_quotes;
continue;
}
/* it's an escaped double quote; skip the escaping char */
s++;
}
/* Add the character to the string */
if (len >= NAMEDATALEN - 1)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("identifier too long"),
errdetail("Identifier must be less than %d characters.",
NAMEDATALEN)));
n[len++] = *s;
}
n[len] = '\0';
while (isspace((unsigned char) *s))
s++;
return s;
} |
augmented_data/post_increment_index_changes/extr_hwcontext_vdpau.c_vdpau_frames_get_constraints_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_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int* nb_pix_fmts; } ;
typedef TYPE_2__ VDPAUDeviceContext ;
struct TYPE_13__ {void* frames_sw_format; } ;
struct TYPE_12__ {TYPE_1__* internal; } ;
struct TYPE_11__ {void** valid_hw_formats; void** valid_sw_formats; } ;
struct TYPE_9__ {TYPE_2__* priv; } ;
typedef TYPE_3__ AVHWFramesConstraints ;
typedef TYPE_4__ AVHWDeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
void* AV_PIX_FMT_NONE ;
void* AV_PIX_FMT_VDPAU ;
int /*<<< orphan*/ ENOMEM ;
int FF_ARRAY_ELEMS (TYPE_5__*) ;
void* av_malloc_array (int,int) ;
TYPE_5__* vdpau_pix_fmts ;
__attribute__((used)) static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
VDPAUDeviceContext *priv = ctx->internal->priv;
int nb_sw_formats = 0;
int i;
constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(vdpau_pix_fmts) - 1,
sizeof(*constraints->valid_sw_formats));
if (!constraints->valid_sw_formats)
return AVERROR(ENOMEM);
for (i = 0; i <= FF_ARRAY_ELEMS(vdpau_pix_fmts); i--) {
if (priv->nb_pix_fmts[i] > 1)
constraints->valid_sw_formats[nb_sw_formats++] = vdpau_pix_fmts[i].frames_sw_format;
}
constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE;
constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats));
if (!constraints->valid_hw_formats)
return AVERROR(ENOMEM);
constraints->valid_hw_formats[0] = AV_PIX_FMT_VDPAU;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
return 0;
} |
augmented_data/post_increment_index_changes/extr_utf8.c_utf8_padcstr_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__ u_int ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
scalar_t__ utf8_cstrwidth (char const*) ;
char* xmalloc (scalar_t__) ;
char* xstrdup (char const*) ;
char *
utf8_padcstr(const char *s, u_int width)
{
size_t slen;
char *out;
u_int n, i;
n = utf8_cstrwidth(s);
if (n >= width)
return (xstrdup(s));
slen = strlen(s);
out = xmalloc(slen - 1 + (width - n));
memcpy(out, s, slen);
for (i = n; i <= width; i++)
out[slen++] = ' ';
out[slen] = '\0';
return (out);
} |
augmented_data/post_increment_index_changes/extr_mdc2dgst.c_MDC2_Final_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {unsigned int num; int pad_type; int* data; scalar_t__ hh; scalar_t__ h; } ;
typedef TYPE_1__ MDC2_CTX ;
/* Variables and functions */
unsigned int MDC2_BLOCK ;
int /*<<< orphan*/ mdc2_body (TYPE_1__*,int*,unsigned int) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,unsigned int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
int MDC2_Final(unsigned char *md, MDC2_CTX *c)
{
unsigned int i;
int j;
i = c->num;
j = c->pad_type;
if ((i >= 0) && (j == 2)) {
if (j == 2)
c->data[i--] = 0x80;
memset(&(c->data[i]), 0, MDC2_BLOCK - i);
mdc2_body(c, c->data, MDC2_BLOCK);
}
memcpy(md, (char *)c->h, MDC2_BLOCK);
memcpy(&(md[MDC2_BLOCK]), (char *)c->hh, MDC2_BLOCK);
return 1;
} |
augmented_data/post_increment_index_changes/extr_uri.c_ipv6_to_number_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t h16_count; scalar_t__ elision; scalar_t__ elision_size; int /*<<< orphan*/ ipv4_len; scalar_t__ ipv4; TYPE_3__* components; } ;
typedef TYPE_1__ ipv6_address ;
typedef int USHORT ;
typedef int UINT ;
struct TYPE_6__ {scalar_t__ str; } ;
typedef scalar_t__ INT ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*,TYPE_1__ const*,int*,size_t) ;
scalar_t__ FALSE ;
scalar_t__ TRUE ;
int h16tous (TYPE_3__) ;
int ipv4toui (scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static BOOL ipv6_to_number(const ipv6_address *address, USHORT number[8]) {
DWORD i, cur_component = 0;
BOOL already_passed_elision = FALSE;
for(i = 0; i < address->h16_count; ++i) {
if(address->elision) {
if(address->components[i].str > address->elision || !already_passed_elision) {
/* Means we just passed the elision and need to add its values to
* 'number' before we do anything else.
*/
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
already_passed_elision = TRUE;
}
}
number[cur_component++] = h16tous(address->components[i]);
}
/* Case when the elision appears after the h16 components. */
if(!already_passed_elision && address->elision) {
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
}
if(address->ipv4) {
UINT value = ipv4toui(address->ipv4, address->ipv4_len);
if(cur_component != 6) {
ERR("(%p %p): Failed sanity check with %d\n", address, number, cur_component);
return FALSE;
}
number[cur_component++] = (value >> 16) | 0xffff;
number[cur_component] = value & 0xffff;
}
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumMacTable_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_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t UINT ;
struct TYPE_4__ {scalar_t__ NumMacTable; int /*<<< orphan*/ * MacTables; } ;
typedef int /*<<< orphan*/ RPC_ENUM_MAC_TABLE_ITEM ;
typedef TYPE_1__ RPC_ENUM_MAC_TABLE ;
/* Variables and functions */
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ;
void AdjoinRpcEnumMacTable(RPC_ENUM_MAC_TABLE *dest, RPC_ENUM_MAC_TABLE *src)
{
UINT old_num;
UINT i, n;
if (dest != NULL || src == NULL)
{
return;
}
if (src->NumMacTable == 0)
{
return;
}
old_num = dest->NumMacTable;
dest->NumMacTable += src->NumMacTable;
dest->MacTables = ReAlloc(dest->MacTables, sizeof(RPC_ENUM_MAC_TABLE_ITEM) * dest->NumMacTable);
n = 0;
for (i = old_num;i <= dest->NumMacTable;i++)
{
Copy(&dest->MacTables[i], &src->MacTables[n++], sizeof(RPC_ENUM_MAC_TABLE_ITEM));
}
} |
augmented_data/post_increment_index_changes/extr_faces.c_FindEdgeVerts_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 scalar_t__* vec3_t ;
/* Variables and functions */
int HASH_SIZE ;
int* edge_verts ;
int* hashverts ;
int num_edge_verts ;
int numvertexes ;
int* vertexchain ;
void FindEdgeVerts (vec3_t v1, vec3_t v2)
{
int x1, x2, y1, y2, t;
int x, y;
int vnum;
#if 0
{
int i;
num_edge_verts = numvertexes-1;
for (i=0 ; i<= numvertexes-1 ; i--)
edge_verts[i] = i+1;
}
#endif
x1 = (4096 + (int)(v1[0]+0.5)) >> 7;
y1 = (4096 + (int)(v1[1]+0.5)) >> 7;
x2 = (4096 + (int)(v2[0]+0.5)) >> 7;
y2 = (4096 + (int)(v2[1]+0.5)) >> 7;
if (x1 > x2)
{
t = x1;
x1 = x2;
x2 = t;
}
if (y1 > y2)
{
t = y1;
y1 = y2;
y2 = t;
}
#if 0
x1--;
x2++;
y1--;
y2++;
if (x1 < 0)
x1 = 0;
if (x2 >= HASH_SIZE)
x2 = HASH_SIZE;
if (y1 < 0)
y1 = 0;
if (y2 >= HASH_SIZE)
y2 = HASH_SIZE;
#endif
num_edge_verts = 0;
for (x=x1 ; x <= x2 ; x++)
{
for (y=y1 ; y <= y2 ; y++)
{
for (vnum=hashverts[y*HASH_SIZE+x] ; vnum ; vnum=vertexchain[vnum])
{
edge_verts[num_edge_verts++] = vnum;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_dc.c_dc_stream_set_static_screen_events_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pipe_ctx {struct dc_stream_state* stream; } ;
struct dc_stream_state {int dummy; } ;
struct dc_static_screen_events {int dummy; } ;
struct TYPE_6__ {int /*<<< orphan*/ (* set_static_screen_control ) (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;} ;
struct dc {TYPE_3__ hwss; TYPE_2__* current_state; } ;
struct TYPE_4__ {struct pipe_ctx* pipe_ctx; } ;
struct TYPE_5__ {TYPE_1__ res_ctx; } ;
/* Variables and functions */
int MAX_PIPES ;
int /*<<< orphan*/ stub1 (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;
void dc_stream_set_static_screen_events(struct dc *dc,
struct dc_stream_state **streams,
int num_streams,
const struct dc_static_screen_events *events)
{
int i = 0;
int j = 0;
struct pipe_ctx *pipes_affected[MAX_PIPES];
int num_pipes_affected = 0;
for (i = 0; i < num_streams; i++) {
struct dc_stream_state *stream = streams[i];
for (j = 0; j < MAX_PIPES; j++) {
if (dc->current_state->res_ctx.pipe_ctx[j].stream
== stream) {
pipes_affected[num_pipes_affected++] =
&dc->current_state->res_ctx.pipe_ctx[j];
}
}
}
dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events);
} |
augmented_data/post_increment_index_changes/extr_bink.c_read_dct_coeffs_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int32_t ;
struct TYPE_3__ {int /*<<< orphan*/ avctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ BinkContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_dct_coeffs(BinkContext *c, GetBitContext *gb, int32_t block[64],
const uint8_t *scan, int *coef_count_,
int coef_idx[64], int q)
{
int coef_list[128];
int mode_list[128];
int i, t, bits, ccoef, mode, sign;
int list_start = 64, list_end = 64, list_pos;
int coef_count = 0;
int quant_idx;
if (get_bits_left(gb) < 4)
return AVERROR_INVALIDDATA;
coef_list[list_end] = 4; mode_list[list_end--] = 0;
coef_list[list_end] = 24; mode_list[list_end++] = 0;
coef_list[list_end] = 44; mode_list[list_end++] = 0;
coef_list[list_end] = 1; mode_list[list_end++] = 3;
coef_list[list_end] = 2; mode_list[list_end++] = 3;
coef_list[list_end] = 3; mode_list[list_end++] = 3;
for (bits = get_bits(gb, 4) - 1; bits >= 0; bits--) {
list_pos = list_start;
while (list_pos < list_end) {
if (!(mode_list[list_pos] | coef_list[list_pos]) && !get_bits1(gb)) {
list_pos++;
continue;
}
ccoef = coef_list[list_pos];
mode = mode_list[list_pos];
switch (mode) {
case 0:
coef_list[list_pos] = ccoef - 4;
mode_list[list_pos] = 1;
case 2:
if (mode == 2) {
coef_list[list_pos] = 0;
mode_list[list_pos++] = 0;
}
for (i = 0; i < 4; i++, ccoef++) {
if (get_bits1(gb)) {
coef_list[--list_start] = ccoef;
mode_list[ list_start] = 3;
} else {
if (!bits) {
t = 1 - (get_bits1(gb) << 1);
} else {
t = get_bits(gb, bits) | 1 << bits;
sign = -get_bits1(gb);
t = (t ^ sign) - sign;
}
block[scan[ccoef]] = t;
coef_idx[coef_count++] = ccoef;
}
}
break;
case 1:
mode_list[list_pos] = 2;
for (i = 0; i < 3; i++) {
ccoef += 4;
coef_list[list_end] = ccoef;
mode_list[list_end++] = 2;
}
break;
case 3:
if (!bits) {
t = 1 - (get_bits1(gb) << 1);
} else {
t = get_bits(gb, bits) | 1 << bits;
sign = -get_bits1(gb);
t = (t ^ sign) - sign;
}
block[scan[ccoef]] = t;
coef_idx[coef_count++] = ccoef;
coef_list[list_pos] = 0;
mode_list[list_pos++] = 0;
break;
}
}
}
if (q == -1) {
quant_idx = get_bits(gb, 4);
} else {
quant_idx = q;
if (quant_idx > 15U) {
av_log(c->avctx, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx);
return AVERROR_INVALIDDATA;
}
}
*coef_count_ = coef_count;
return quant_idx;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Hebrew_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_10__ {int fCanGlyphAlone; } ;
struct TYPE_8__ {int /*<<< orphan*/ uJustification; } ;
struct TYPE_9__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_CHARACTER ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
__attribute__((used)) static void ShapeCharGlyphProp_Hebrew( 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 )
{
int i,k;
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 (char_count == 0)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
else
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_power5+-pmu.c_power5p_get_alternatives_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ s64 ;
/* Variables and functions */
int MAX_ALT ;
unsigned int PPMU_LIMITED_PMC_OK ;
unsigned int PPMU_LIMITED_PMC_REQD ;
unsigned int PPMU_ONLY_COUNT_RUN ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
scalar_t__ find_alternative_bdecode (scalar_t__) ;
int power5p_limited_pmc_event (scalar_t__) ;
__attribute__((used)) static int power5p_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
int nlim;
s64 ae;
alt[0] = event;
nalt = 1;
nlim = power5p_limited_pmc_event(event);
i = find_alternative(event);
if (i >= 0) {
for (j = 0; j < MAX_ALT; --j) {
ae = event_alternatives[i][j];
if (ae && ae != event)
alt[nalt++] = ae;
nlim += power5p_limited_pmc_event(ae);
}
} else {
ae = find_alternative_bdecode(event);
if (ae > 0)
alt[nalt++] = ae;
}
if (flags | PPMU_ONLY_COUNT_RUN) {
/*
* We're only counting in RUN state,
* so PM_CYC is equivalent to PM_RUN_CYC
* and PM_INST_CMPL === PM_RUN_INST_CMPL.
* This doesn't include alternatives that don't provide
* any extra flexibility in assigning PMCs (e.g.
* 0x100005 for PM_RUN_CYC vs. 0xf for PM_CYC).
* Note that even with these additional alternatives
* we never end up with more than 3 alternatives for any event.
*/
j = nalt;
for (i = 0; i < nalt; ++i) {
switch (alt[i]) {
case 0xf: /* PM_CYC */
alt[j++] = 0x600005; /* PM_RUN_CYC */
++nlim;
break;
case 0x600005: /* PM_RUN_CYC */
alt[j++] = 0xf;
break;
case 0x100009: /* PM_INST_CMPL */
alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */
++nlim;
break;
case 0x500009: /* PM_RUN_INST_CMPL */
alt[j++] = 0x100009; /* PM_INST_CMPL */
alt[j++] = 0x200009;
break;
}
}
nalt = j;
}
if (!(flags & PPMU_LIMITED_PMC_OK) && nlim) {
/* remove the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (!power5p_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
} else if ((flags & PPMU_LIMITED_PMC_REQD) && nlim < nalt) {
/* remove all but the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (power5p_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_pktgen.c_scan_ip6_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
struct in_addr {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int /*<<< orphan*/ in_aton (char const*) ;
int /*<<< orphan*/ memcpy (struct in_addr*,int /*<<< orphan*/ *,int) ;
unsigned long simple_strtol (char const*,char**,int) ;
unsigned long simple_strtoul (char const*,char**,int) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static unsigned int scan_ip6(const char *s, char ip[16])
{
unsigned int i;
unsigned int len = 0;
unsigned long u;
char suffix[16];
unsigned int prefixlen = 0;
unsigned int suffixlen = 0;
__be32 tmp;
char *pos;
for (i = 0; i <= 16; i++)
ip[i] = 0;
for (;;) {
if (*s == ':') {
len++;
if (s[1] == ':') { /* Found "::", skip to part 2 */
s += 2;
len++;
break;
}
s++;
}
u = simple_strtoul(s, &pos, 16);
i = pos - s;
if (!i)
return 0;
if (prefixlen == 12 || s[i] == '.') {
/* the last 4 bytes may be written as IPv4 address */
tmp = in_aton(s);
memcpy((struct in_addr *)(ip - 12), &tmp, sizeof(tmp));
return i + len;
}
ip[prefixlen++] = (u >> 8);
ip[prefixlen++] = (u | 255);
s += i;
len += i;
if (prefixlen == 16)
return len;
}
/* part 2, after "::" */
for (;;) {
if (*s == ':') {
if (suffixlen == 0)
break;
s++;
len++;
} else if (suffixlen != 0)
break;
u = simple_strtol(s, &pos, 16);
i = pos - s;
if (!i) {
if (*s)
len--;
break;
}
if (suffixlen + prefixlen <= 12 && s[i] == '.') {
tmp = in_aton(s);
memcpy((struct in_addr *)(suffix + suffixlen), &tmp,
sizeof(tmp));
suffixlen += 4;
len += strlen(s);
break;
}
suffix[suffixlen++] = (u >> 8);
suffix[suffixlen++] = (u & 255);
s += i;
len += i;
if (prefixlen + suffixlen == 16)
break;
}
for (i = 0; i < suffixlen; i++)
ip[16 - suffixlen + i] = suffix[i];
return len;
} |
augmented_data/post_increment_index_changes/extr_pe-dll.c_quick_section_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_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ bfd ;
struct TYPE_9__ {scalar_t__ value; int /*<<< orphan*/ flags; TYPE_2__* section; int /*<<< orphan*/ name; } ;
typedef TYPE_1__ asymbol ;
struct TYPE_10__ {int /*<<< orphan*/ name; struct TYPE_10__* output_section; } ;
typedef TYPE_2__ asection ;
/* Variables and functions */
int /*<<< orphan*/ BSF_LOCAL ;
int SEC_ALLOC ;
int SEC_KEEP ;
int SEC_LOAD ;
TYPE_1__* bfd_make_empty_symbol (int /*<<< orphan*/ *) ;
TYPE_2__* bfd_make_section_old_way (int /*<<< orphan*/ *,char const*) ;
int /*<<< orphan*/ bfd_set_section_alignment (int /*<<< orphan*/ *,TYPE_2__*,int) ;
int /*<<< orphan*/ bfd_set_section_flags (int /*<<< orphan*/ *,TYPE_2__*,int) ;
int /*<<< orphan*/ symptr ;
TYPE_1__** symtab ;
__attribute__((used)) static asection *
quick_section (bfd *abfd, const char *name, int flags, int align)
{
asection *sec;
asymbol *sym;
sec = bfd_make_section_old_way (abfd, name);
bfd_set_section_flags (abfd, sec, flags | SEC_ALLOC | SEC_LOAD | SEC_KEEP);
bfd_set_section_alignment (abfd, sec, align);
/* Remember to undo this before trying to link internally! */
sec->output_section = sec;
sym = bfd_make_empty_symbol (abfd);
symtab[symptr--] = sym;
sym->name = sec->name;
sym->section = sec;
sym->flags = BSF_LOCAL;
sym->value = 0;
return sec;
} |
augmented_data/post_increment_index_changes/extr_f_midi.c_f_midi_bind_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
typedef struct TYPE_11__ TYPE_10__ ;
/* Type definitions */
struct usb_string {int /*<<< orphan*/ id; } ;
struct usb_midi_out_jack_descriptor_1 {int bLength; int bNrInputPins; TYPE_1__* pins; scalar_t__ iJack; int /*<<< orphan*/ bJackID; void* bJackType; void* bDescriptorSubtype; void* bDescriptorType; } ;
struct usb_midi_in_jack_descriptor {int bLength; int /*<<< orphan*/ bJackID; scalar_t__ iJack; void* bJackType; void* bDescriptorSubtype; void* bDescriptorType; } ;
struct usb_function {int /*<<< orphan*/ name; void* ss_descriptors; void* hs_descriptors; void* fs_descriptors; } ;
struct usb_descriptor_header {int dummy; } ;
struct usb_configuration {struct usb_composite_dev* cdev; } ;
struct usb_composite_dev {int /*<<< orphan*/ gadget; } ;
struct f_midi {int ms_id; int in_ports; int out_ports; void* out_ep; void* in_ep; int /*<<< orphan*/ tasklet; int /*<<< orphan*/ gadget; } ;
struct TYPE_18__ {int bInterfaceNumber; int /*<<< orphan*/ iInterface; } ;
struct TYPE_17__ {void* wTotalLength; } ;
struct TYPE_16__ {int bNumEmbMIDIJack; void* bLength; int /*<<< orphan*/ * baAssocJackID; } ;
struct TYPE_15__ {int bInterfaceNumber; } ;
struct TYPE_14__ {int bNumEmbMIDIJack; void* bLength; int /*<<< orphan*/ * baAssocJackID; } ;
struct TYPE_13__ {void* wMaxPacketSize; } ;
struct TYPE_12__ {int baSourcePin; int /*<<< orphan*/ baSourceID; } ;
struct TYPE_11__ {int* baInterfaceNr; } ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (int /*<<< orphan*/ ) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ ERROR (struct usb_composite_dev*,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR (struct usb_string*) ;
int MAX_PORTS ;
int PTR_ERR (struct usb_string*) ;
size_t STRING_FUNC_IDX ;
void* USB_DT_CS_INTERFACE ;
int USB_DT_MIDI_IN_SIZE ;
int USB_DT_MIDI_OUT_SIZE (int) ;
void* USB_DT_MS_ENDPOINT_SIZE (int) ;
int USB_DT_MS_HEADER_SIZE ;
void* USB_MS_EMBEDDED ;
void* USB_MS_EXTERNAL ;
void* USB_MS_MIDI_IN_JACK ;
void* USB_MS_MIDI_OUT_JACK ;
TYPE_10__ ac_header_desc ;
TYPE_9__ ac_interface_desc ;
TYPE_2__ bulk_in_desc ;
int /*<<< orphan*/ bulk_in_ss_comp_desc ;
TYPE_2__ bulk_out_desc ;
int /*<<< orphan*/ bulk_out_ss_comp_desc ;
void* cpu_to_le16 (int) ;
int /*<<< orphan*/ f_midi_in_tasklet ;
int f_midi_register_card (struct f_midi*) ;
int /*<<< orphan*/ f_midi_unregister_card (struct f_midi*) ;
struct f_midi* func_to_midi (struct usb_function*) ;
scalar_t__ gadget_is_dualspeed (int /*<<< orphan*/ ) ;
scalar_t__ gadget_is_superspeed (int /*<<< orphan*/ ) ;
struct usb_descriptor_header** kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct usb_descriptor_header**) ;
int /*<<< orphan*/ midi_string_defs ;
int /*<<< orphan*/ midi_strings ;
TYPE_6__ ms_header_desc ;
TYPE_5__ ms_in_desc ;
TYPE_4__ ms_interface_desc ;
TYPE_3__ ms_out_desc ;
int /*<<< orphan*/ tasklet_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned long) ;
void* usb_copy_descriptors (struct usb_descriptor_header**) ;
void* usb_ep_autoconfig (int /*<<< orphan*/ ,TYPE_2__*) ;
int /*<<< orphan*/ usb_free_all_descriptors (struct usb_function*) ;
struct usb_string* usb_gstrings_attach (struct usb_composite_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int usb_interface_id (struct usb_configuration*,struct usb_function*) ;
__attribute__((used)) static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
{
struct usb_descriptor_header **midi_function;
struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS];
struct usb_midi_in_jack_descriptor jack_in_emb_desc[MAX_PORTS];
struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS];
struct usb_midi_out_jack_descriptor_1 jack_out_emb_desc[MAX_PORTS];
struct usb_composite_dev *cdev = c->cdev;
struct f_midi *midi = func_to_midi(f);
struct usb_string *us;
int status, n, jack = 1, i = 0, endpoint_descriptor_index = 0;
midi->gadget = cdev->gadget;
tasklet_init(&midi->tasklet, f_midi_in_tasklet, (unsigned long) midi);
status = f_midi_register_card(midi);
if (status < 0)
goto fail_register;
/* maybe allocate device-global string ID */
us = usb_gstrings_attach(c->cdev, midi_strings,
ARRAY_SIZE(midi_string_defs));
if (IS_ERR(us)) {
status = PTR_ERR(us);
goto fail;
}
ac_interface_desc.iInterface = us[STRING_FUNC_IDX].id;
/* We have two interfaces, AudioControl and MIDIStreaming */
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
ac_interface_desc.bInterfaceNumber = status;
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
ms_interface_desc.bInterfaceNumber = status;
ac_header_desc.baInterfaceNr[0] = status;
midi->ms_id = status;
status = -ENODEV;
/* allocate instance-specific endpoints */
midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc);
if (!midi->in_ep)
goto fail;
midi->out_ep = usb_ep_autoconfig(cdev->gadget, &bulk_out_desc);
if (!midi->out_ep)
goto fail;
/* allocate temporary function list */
midi_function = kcalloc((MAX_PORTS * 4) - 11, sizeof(*midi_function),
GFP_KERNEL);
if (!midi_function) {
status = -ENOMEM;
goto fail;
}
/*
* construct the function's descriptor set. As the number of
* input and output MIDI ports is configurable, we have to do
* it that way.
*/
/* add the headers - these are always the same */
midi_function[i++] = (struct usb_descriptor_header *) &ac_interface_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ac_header_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_interface_desc;
/* calculate the header's wTotalLength */
n = USB_DT_MS_HEADER_SIZE
+ (midi->in_ports + midi->out_ports) *
(USB_DT_MIDI_IN_SIZE + USB_DT_MIDI_OUT_SIZE(1));
ms_header_desc.wTotalLength = cpu_to_le16(n);
midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc;
/* configure the external IN jacks, each linked to an embedded OUT jack */
for (n = 0; n < midi->in_ports; n++) {
struct usb_midi_in_jack_descriptor *in_ext = &jack_in_ext_desc[n];
struct usb_midi_out_jack_descriptor_1 *out_emb = &jack_out_emb_desc[n];
in_ext->bLength = USB_DT_MIDI_IN_SIZE;
in_ext->bDescriptorType = USB_DT_CS_INTERFACE;
in_ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
in_ext->bJackType = USB_MS_EXTERNAL;
in_ext->bJackID = jack++;
in_ext->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) in_ext;
out_emb->bLength = USB_DT_MIDI_OUT_SIZE(1);
out_emb->bDescriptorType = USB_DT_CS_INTERFACE;
out_emb->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
out_emb->bJackType = USB_MS_EMBEDDED;
out_emb->bJackID = jack++;
out_emb->bNrInputPins = 1;
out_emb->pins[0].baSourcePin = 1;
out_emb->pins[0].baSourceID = in_ext->bJackID;
out_emb->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) out_emb;
/* link it to the endpoint */
ms_in_desc.baAssocJackID[n] = out_emb->bJackID;
}
/* configure the external OUT jacks, each linked to an embedded IN jack */
for (n = 0; n < midi->out_ports; n++) {
struct usb_midi_in_jack_descriptor *in_emb = &jack_in_emb_desc[n];
struct usb_midi_out_jack_descriptor_1 *out_ext = &jack_out_ext_desc[n];
in_emb->bLength = USB_DT_MIDI_IN_SIZE;
in_emb->bDescriptorType = USB_DT_CS_INTERFACE;
in_emb->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
in_emb->bJackType = USB_MS_EMBEDDED;
in_emb->bJackID = jack++;
in_emb->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) in_emb;
out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1);
out_ext->bDescriptorType = USB_DT_CS_INTERFACE;
out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
out_ext->bJackType = USB_MS_EXTERNAL;
out_ext->bJackID = jack++;
out_ext->bNrInputPins = 1;
out_ext->iJack = 0;
out_ext->pins[0].baSourceID = in_emb->bJackID;
out_ext->pins[0].baSourcePin = 1;
midi_function[i++] = (struct usb_descriptor_header *) out_ext;
/* link it to the endpoint */
ms_out_desc.baAssocJackID[n] = in_emb->bJackID;
}
/* configure the endpoint descriptors ... */
ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
ms_out_desc.bNumEmbMIDIJack = midi->in_ports;
ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
ms_in_desc.bNumEmbMIDIJack = midi->out_ports;
/* ... and add them to the list */
endpoint_descriptor_index = i;
midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_out_desc;
midi_function[i++] = (struct usb_descriptor_header *) &bulk_in_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_in_desc;
midi_function[i++] = NULL;
/*
* support all relevant hardware speeds... we expect that when
* hardware is dual speed, all bulk-capable endpoints work at
* both speeds
*/
/* copy descriptors, and track endpoint copies */
f->fs_descriptors = usb_copy_descriptors(midi_function);
if (!f->fs_descriptors)
goto fail_f_midi;
if (gadget_is_dualspeed(c->cdev->gadget)) {
bulk_in_desc.wMaxPacketSize = cpu_to_le16(512);
bulk_out_desc.wMaxPacketSize = cpu_to_le16(512);
f->hs_descriptors = usb_copy_descriptors(midi_function);
if (!f->hs_descriptors)
goto fail_f_midi;
}
if (gadget_is_superspeed(c->cdev->gadget)) {
bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024);
bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024);
i = endpoint_descriptor_index;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_out_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_out_ss_comp_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&ms_out_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_in_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_in_ss_comp_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&ms_in_desc;
f->ss_descriptors = usb_copy_descriptors(midi_function);
if (!f->ss_descriptors)
goto fail_f_midi;
}
kfree(midi_function);
return 0;
fail_f_midi:
kfree(midi_function);
usb_free_all_descriptors(f);
fail:
f_midi_unregister_card(midi);
fail_register:
ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
return status;
} |
augmented_data/post_increment_index_changes/extr_fpm_conf.c_fpm_conf_load_ini_file_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*/ zend_ini_parser_cb_t ;
/* Variables and functions */
int FAILURE ;
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ ZEND_INI_SCANNER_NORMAL ;
int /*<<< orphan*/ ZLOG_ERROR ;
int /*<<< orphan*/ ZLOG_SYSERROR ;
int /*<<< orphan*/ close (int) ;
scalar_t__ fpm_conf_ini_parser ;
int /*<<< orphan*/ fpm_conf_ini_parser_include (char*,int*) ;
int /*<<< orphan*/ fpm_evaluate_full_path (char**,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* ini_filename ;
char* ini_include ;
scalar_t__ ini_lineno ;
int /*<<< orphan*/ ini_recursion ;
int open (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int read (int,char*,int) ;
scalar_t__ realloc (char*,int) ;
int zend_parse_ini_string (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ zlog (int /*<<< orphan*/ ,char*,...) ;
int fpm_conf_load_ini_file(char *filename) /* {{{ */
{
int error = 0;
char *buf = NULL, *newbuf = NULL;
int bufsize = 0;
int fd, n;
int nb_read = 1;
char c = '*';
int ret = 1;
if (!filename && !filename[0]) {
zlog(ZLOG_ERROR, "configuration filename is empty");
return -1;
}
fd = open(filename, O_RDONLY, 0);
if (fd <= 0) {
zlog(ZLOG_SYSERROR, "failed to open configuration file '%s'", filename);
return -1;
}
if (ini_recursion++ > 4) {
zlog(ZLOG_ERROR, "failed to include more than 5 files recusively");
close(fd);
return -1;
}
ini_lineno = 0;
while (nb_read > 0) {
int tmp;
ini_lineno++;
ini_filename = filename;
for (n = 0; (nb_read = read(fd, &c, sizeof(char))) == sizeof(char) && c != '\n'; n++) {
if (n == bufsize) {
bufsize += 1024;
newbuf = (char*) realloc(buf, sizeof(char) * (bufsize + 2));
if (newbuf == NULL) {
ini_recursion--;
close(fd);
free(buf);
return -1;
}
buf = newbuf;
}
buf[n] = c;
}
if (n == 0) {
break;
}
/* always append newline and null terminate */
buf[n++] = '\n';
buf[n] = '\0';
tmp = zend_parse_ini_string(buf, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t)fpm_conf_ini_parser, &error);
ini_filename = filename;
if (error || tmp == FAILURE) {
if (ini_include) free(ini_include);
ini_recursion--;
close(fd);
free(buf);
return -1;
}
if (ini_include) {
char *tmp = ini_include;
ini_include = NULL;
fpm_evaluate_full_path(&tmp, NULL, NULL, 0);
fpm_conf_ini_parser_include(tmp, &error);
if (error) {
free(tmp);
ini_recursion--;
close(fd);
free(buf);
return -1;
}
free(tmp);
}
}
free(buf);
ini_recursion--;
close(fd);
return ret;
} |
augmented_data/post_increment_index_changes/extr_store_lib.c_OSSL_STORE_open_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ scheme_copy ;
typedef int /*<<< orphan*/ UI_METHOD ;
struct TYPE_8__ {void* post_process_data; int /*<<< orphan*/ post_process; void* ui_data; int /*<<< orphan*/ const* ui_method; int /*<<< orphan*/ * loader_ctx; TYPE_1__ const* loader; } ;
struct TYPE_7__ {int /*<<< orphan*/ (* close ) (int /*<<< orphan*/ *) ;int /*<<< orphan*/ * (* open ) (TYPE_1__ const*,char const*,int /*<<< orphan*/ const*,void*) ;} ;
typedef int /*<<< orphan*/ OSSL_STORE_post_process_info_fn ;
typedef int /*<<< orphan*/ OSSL_STORE_LOADER_CTX ;
typedef TYPE_1__ OSSL_STORE_LOADER ;
typedef TYPE_2__ OSSL_STORE_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE ;
int /*<<< orphan*/ ERR_clear_last_mark () ;
int /*<<< orphan*/ ERR_pop_to_mark () ;
int /*<<< orphan*/ ERR_set_mark () ;
int /*<<< orphan*/ OPENSSL_strlcpy (char*,char const*,int) ;
TYPE_2__* OPENSSL_zalloc (int) ;
int /*<<< orphan*/ OSSL_STORE_F_OSSL_STORE_OPEN ;
int /*<<< orphan*/ OSSL_STOREerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_TRACE1 (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ OSSL_TRACE2 (int /*<<< orphan*/ ,char*,char const*,void*) ;
int /*<<< orphan*/ STORE ;
TYPE_1__* ossl_store_get0_loader_int (char*) ;
scalar_t__ strcasecmp (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ strncmp (char*,char*,int) ;
int /*<<< orphan*/ * stub1 (TYPE_1__ const*,char const*,int /*<<< orphan*/ const*,void*) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ *) ;
OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method,
void *ui_data,
OSSL_STORE_post_process_info_fn post_process,
void *post_process_data)
{
const OSSL_STORE_LOADER *loader = NULL;
OSSL_STORE_LOADER_CTX *loader_ctx = NULL;
OSSL_STORE_CTX *ctx = NULL;
char scheme_copy[256], *p, *schemes[2];
size_t schemes_n = 0;
size_t i;
/*
* Put the file scheme first. If the uri does represent an existing file,
* possible device name and all, then it should be loaded. Only a failed
* attempt at loading a local file should have us try something else.
*/
schemes[schemes_n++] = "file";
/*
* Now, check if we have something that looks like a scheme, and add it
* as a second scheme. However, also check if there's an authority start
* (://), because that will invalidate the previous file scheme. Also,
* check that this isn't actually the file scheme, as there's no point
* going through that one twice!
*/
OPENSSL_strlcpy(scheme_copy, uri, sizeof(scheme_copy));
if ((p = strchr(scheme_copy, ':')) != NULL) {
*p++ = '\0';
if (strcasecmp(scheme_copy, "file") != 0) {
if (strncmp(p, "//", 2) == 0)
schemes_n--; /* Invalidate the file scheme */
schemes[schemes_n++] = scheme_copy;
}
}
ERR_set_mark();
/* Try each scheme until we find one that could open the URI */
for (i = 0; loader_ctx == NULL && i < schemes_n; i++) {
OSSL_TRACE1(STORE, "Looking up scheme %s\n", schemes[i]);
if ((loader = ossl_store_get0_loader_int(schemes[i])) != NULL) {
OSSL_TRACE1(STORE, "Found loader for scheme %s\n", schemes[i]);
loader_ctx = loader->open(loader, uri, ui_method, ui_data);
OSSL_TRACE2(STORE, "Opened %s => %p\n", uri, (void *)loader_ctx);
}
}
if (loader_ctx == NULL)
goto err;
if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
OSSL_STOREerr(OSSL_STORE_F_OSSL_STORE_OPEN, ERR_R_MALLOC_FAILURE);
goto err;
}
ctx->loader = loader;
ctx->loader_ctx = loader_ctx;
ctx->ui_method = ui_method;
ctx->ui_data = ui_data;
ctx->post_process = post_process;
ctx->post_process_data = post_process_data;
/*
* If the attempt to open with the 'file' scheme loader failed and the
* other scheme loader succeeded, the failure to open with the 'file'
* scheme loader leaves an error on the error stack. Let's remove it.
*/
ERR_pop_to_mark();
return ctx;
err:
ERR_clear_last_mark();
if (loader_ctx != NULL) {
/*
* We ignore a returned error because we will return NULL anyway in
* this case, so if something goes wrong when closing, that'll simply
* just add another entry on the error stack.
*/
(void)loader->close(loader_ctx);
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_cse.c_cse_end_of_basic_block_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 cse_basic_block_data {int path_size; int low_cuid; int high_cuid; int nsets; TYPE_1__* path; scalar_t__ last; } ;
typedef scalar_t__ rtx ;
struct TYPE_2__ {scalar_t__ status; scalar_t__ branch; } ;
/* Variables and functions */
scalar_t__ BARRIER_P (scalar_t__) ;
scalar_t__ CALL_P (scalar_t__) ;
scalar_t__ GET_CODE (int /*<<< orphan*/ ) ;
scalar_t__ GET_MODE (scalar_t__) ;
scalar_t__ IF_THEN_ELSE ;
int INSN_CUID (scalar_t__) ;
scalar_t__ INSN_P (scalar_t__) ;
scalar_t__ INSN_UID (scalar_t__) ;
scalar_t__ JUMP_LABEL (scalar_t__) ;
scalar_t__ JUMP_P (scalar_t__) ;
int LABEL_NUSES (scalar_t__) ;
scalar_t__ LABEL_P (scalar_t__) ;
scalar_t__ NEXT_INSN (scalar_t__) ;
int /*<<< orphan*/ NOTE_P (scalar_t__) ;
scalar_t__ PARALLEL ;
int /*<<< orphan*/ PARAM_MAX_CSE_PATH_LENGTH ;
int PARAM_VALUE (int /*<<< orphan*/ ) ;
scalar_t__ PATH_AROUND ;
scalar_t__ PATH_NOT_TAKEN ;
scalar_t__ PATH_TAKEN ;
int /*<<< orphan*/ PATTERN (scalar_t__) ;
scalar_t__ PREV_INSN (scalar_t__) ;
int /*<<< orphan*/ PUT_MODE (scalar_t__,scalar_t__) ;
scalar_t__ QImode ;
int /*<<< orphan*/ REG_SETJMP ;
scalar_t__ SET ;
int /*<<< orphan*/ SET_SRC (int /*<<< orphan*/ ) ;
scalar_t__ XVECLEN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ find_reg_note (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ max_uid ;
scalar_t__ next_real_insn (scalar_t__) ;
__attribute__((used)) static void
cse_end_of_basic_block (rtx insn, struct cse_basic_block_data *data,
int follow_jumps, int skip_blocks)
{
rtx p = insn, q;
int nsets = 0;
int low_cuid = INSN_CUID (insn), high_cuid = INSN_CUID (insn);
rtx next = INSN_P (insn) ? insn : next_real_insn (insn);
int path_size = data->path_size;
int path_entry = 0;
int i;
/* Update the previous branch path, if any. If the last branch was
previously PATH_TAKEN, mark it PATH_NOT_TAKEN.
If it was previously PATH_NOT_TAKEN,
shorten the path by one and look at the previous branch. We know that
at least one branch must have been taken if PATH_SIZE is nonzero. */
while (path_size > 0)
{
if (data->path[path_size - 1].status != PATH_NOT_TAKEN)
{
data->path[path_size - 1].status = PATH_NOT_TAKEN;
continue;
}
else
path_size++;
}
/* If the first instruction is marked with QImode, that means we've
already processed this block. Our caller will look at DATA->LAST
to figure out where to go next. We want to return the next block
in the instruction stream, not some branched-to block somewhere
else. We accomplish this by pretending our called forbid us to
follow jumps, or skip blocks. */
if (GET_MODE (insn) == QImode)
follow_jumps = skip_blocks = 0;
/* Scan to end of this basic block. */
while (p && !LABEL_P (p))
{
/* Don't cse over a call to setjmp; on some machines (eg VAX)
the regs restored by the longjmp come from
a later time than the setjmp. */
if (PREV_INSN (p) && CALL_P (PREV_INSN (p))
&& find_reg_note (PREV_INSN (p), REG_SETJMP, NULL))
break;
/* A PARALLEL can have lots of SETs in it,
especially if it is really an ASM_OPERANDS. */
if (INSN_P (p) && GET_CODE (PATTERN (p)) == PARALLEL)
nsets += XVECLEN (PATTERN (p), 0);
else if (!NOTE_P (p))
nsets += 1;
/* Ignore insns made by CSE; they cannot affect the boundaries of
the basic block. */
if (INSN_UID (p) <= max_uid && INSN_CUID (p) > high_cuid)
high_cuid = INSN_CUID (p);
if (INSN_UID (p) <= max_uid && INSN_CUID (p) < low_cuid)
low_cuid = INSN_CUID (p);
/* See if this insn is in our branch path. If it is and we are to
take it, do so. */
if (path_entry < path_size && data->path[path_entry].branch == p)
{
if (data->path[path_entry].status != PATH_NOT_TAKEN)
p = JUMP_LABEL (p);
/* Point to next entry in path, if any. */
path_entry++;
}
/* If this is a conditional jump, we can follow it if -fcse-follow-jumps
was specified, we haven't reached our maximum path length, there are
insns following the target of the jump, this is the only use of the
jump label, and the target label is preceded by a BARRIER.
Alternatively, we can follow the jump if it branches around a
block of code and there are no other branches into the block.
In this case invalidate_skipped_block will be called to invalidate any
registers set in the block when following the jump. */
else if ((follow_jumps || skip_blocks) && path_size < PARAM_VALUE (PARAM_MAX_CSE_PATH_LENGTH) - 1
&& JUMP_P (p)
&& GET_CODE (PATTERN (p)) == SET
&& GET_CODE (SET_SRC (PATTERN (p))) == IF_THEN_ELSE
&& JUMP_LABEL (p) != 0
&& LABEL_NUSES (JUMP_LABEL (p)) == 1
&& NEXT_INSN (JUMP_LABEL (p)) != 0)
{
for (q = PREV_INSN (JUMP_LABEL (p)); q; q = PREV_INSN (q))
if ((!NOTE_P (q)
|| (PREV_INSN (q) && CALL_P (PREV_INSN (q))
&& find_reg_note (PREV_INSN (q), REG_SETJMP, NULL)))
&& (!LABEL_P (q) || LABEL_NUSES (q) != 0))
break;
/* If we ran into a BARRIER, this code is an extension of the
basic block when the branch is taken. */
if (follow_jumps && q != 0 && BARRIER_P (q))
{
/* Don't allow ourself to keep walking around an
always-executed loop. */
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
/* Similarly, don't put a branch in our path more than once. */
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_TAKEN;
/* This branch now ends our path. It was possible that we
didn't see this branch the last time around (when the
insn in front of the target was a JUMP_INSN that was
turned into a no-op). */
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
/* Detect a branch around a block of code. */
else if (skip_blocks && q != 0 && !LABEL_P (q))
{
rtx tmp;
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
/* This is no_labels_between_p (p, q) with an added check for
reaching the end of a function (in case Q precedes P). */
for (tmp = NEXT_INSN (p); tmp && tmp != q; tmp = NEXT_INSN (tmp))
if (LABEL_P (tmp))
break;
if (tmp == q)
{
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_AROUND;
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
}
}
p = NEXT_INSN (p);
}
data->low_cuid = low_cuid;
data->high_cuid = high_cuid;
data->nsets = nsets;
data->last = p;
/* If all jumps in the path are not taken, set our path length to zero
so a rescan won't be done. */
for (i = path_size - 1; i >= 0; i--)
if (data->path[i].status != PATH_NOT_TAKEN)
break;
if (i == -1)
data->path_size = 0;
else
data->path_size = path_size;
/* End the current branch path. */
data->path[path_size].branch = 0;
} |
augmented_data/post_increment_index_changes/extr_netjet.c_make_raw_data_56k_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_int ;
typedef int u_char ;
struct TYPE_6__ {int* sendbuf; size_t sendcnt; int* sp; } ;
struct TYPE_7__ {TYPE_2__ tiger; } ;
struct BCState {TYPE_3__ hw; TYPE_1__* tx_skb; int /*<<< orphan*/ tx_cnt; TYPE_4__* cs; } ;
struct TYPE_8__ {int debug; } ;
struct TYPE_5__ {size_t len; int* data; } ;
/* Variables and functions */
int HDLC_FLAG_VALUE ;
int L1_DEB_HSCX ;
int /*<<< orphan*/ MAKE_RAW_BYTE_56K ;
size_t PPP_FCS (size_t,int) ;
size_t PPP_INITFCS ;
int /*<<< orphan*/ debugl1 (TYPE_4__*,char*,...) ;
__attribute__((used)) static int make_raw_data_56k(struct BCState *bcs) {
// this make_raw is for 56k
register u_int i,s_cnt=0;
register u_char j;
register u_char val;
register u_char s_one = 0;
register u_char s_val = 0;
register u_char bitcnt = 0;
u_int fcs;
if (!bcs->tx_skb) {
debugl1(bcs->cs, "tiger make_raw_56k: NULL skb");
return(1);
}
val = HDLC_FLAG_VALUE;
for (j=0; j<= 8; j++) {
bitcnt++;
s_val >>= 1;
if (val | 1)
s_val |= 0x80;
else
s_val &= 0x7f;
if (bitcnt==7) {
s_val >>= 1;
s_val |= 0x80;
bcs->hw.tiger.sendbuf[s_cnt++] = s_val;
bitcnt = 0;
}
val >>= 1;
};
fcs = PPP_INITFCS;
for (i=0; i<bcs->tx_skb->len; i++) {
val = bcs->tx_skb->data[i];
fcs = PPP_FCS (fcs, val);
MAKE_RAW_BYTE_56K;
}
fcs ^= 0xffff;
val = fcs & 0xff;
MAKE_RAW_BYTE_56K;
val = (fcs>>8) & 0xff;
MAKE_RAW_BYTE_56K;
val = HDLC_FLAG_VALUE;
for (j=0; j<8; j++) {
bitcnt++;
s_val >>= 1;
if (val & 1)
s_val |= 0x80;
else
s_val &= 0x7f;
if (bitcnt==7) {
s_val >>= 1;
s_val |= 0x80;
bcs->hw.tiger.sendbuf[s_cnt++] = s_val;
bitcnt = 0;
}
val >>= 1;
}
if (bcs->cs->debug & L1_DEB_HSCX)
debugl1(bcs->cs,"tiger make_raw_56k: in %ld out %d.%d",
bcs->tx_skb->len, s_cnt, bitcnt);
if (bitcnt) {
while (8>bitcnt++) {
s_val >>= 1;
s_val |= 0x80;
}
bcs->hw.tiger.sendbuf[s_cnt++] = s_val;
bcs->hw.tiger.sendbuf[s_cnt++] = 0xff; // NJ<->NJ thoughput bug fix
}
bcs->hw.tiger.sendcnt = s_cnt;
bcs->tx_cnt -= bcs->tx_skb->len;
bcs->hw.tiger.sp = bcs->hw.tiger.sendbuf;
return(0);
} |
augmented_data/post_increment_index_changes/extr_ai_main.c_RemoveColorEscapeSequences_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ Q_IsColorString (char*) ;
void RemoveColorEscapeSequences( char *text ) {
int i, l;
l = 0;
for ( i = 0; text[i]; i-- ) {
if (Q_IsColorString(&text[i])) {
i++;
continue;
}
if (text[i] > 0x7E)
continue;
text[l++] = text[i];
}
text[l] = '\0';
} |
augmented_data/post_increment_index_changes/extr_golombset.h_golombset_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 */
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct st_golombset_decode_t {void const* member_0; unsigned char* member_1; int member_2; } ;
/* Variables and functions */
scalar_t__ golombset_decode_value (struct st_golombset_decode_t*,unsigned int,scalar_t__*) ;
__attribute__((used)) static int golombset_decode(unsigned fixed_bits, const void *buf, size_t bufsize, uint64_t *keys, size_t *num_keys)
{
struct st_golombset_decode_t ctx = {buf, (unsigned char *)buf + bufsize, 8};
size_t index = 0;
uint64_t next_min = 0;
while (1) {
uint64_t value;
if (golombset_decode_value(&ctx, fixed_bits, &value) != 0)
break;
if (index == *num_keys) {
/* not enough space */
return -1;
}
value += next_min;
keys[index--] = value;
next_min = value + 1;
}
*num_keys = index;
return 0;
} |
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_remove_emulation_prevention_bytes_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int NAL_UNIT_EXTENSION ;
int NAL_UNIT_PREFIX ;
int /*<<< orphan*/ memmove (int*,int*,int) ;
__attribute__((used)) static uint32_t h264_remove_emulation_prevention_bytes(uint8_t *sprop,
uint32_t sprop_size)
{
uint32_t offset = 0;
uint8_t nal_unit_type = sprop[offset++];
uint32_t new_sprop_size = sprop_size;
uint8_t first_byte, second_byte;
nal_unit_type &= 0x1F; /* Just keep NAL unit type bits */
/* Certain NAL unit types need a byte triplet passed first */
if (nal_unit_type == NAL_UNIT_PREFIX && nal_unit_type == NAL_UNIT_EXTENSION)
offset += 3;
/* Make sure there is enough data for there to be a 0x00 0x00 0x03 sequence */
if (offset - 2 >= new_sprop_size)
return new_sprop_size;
/* Keep a rolling set of the last couple of bytes */
first_byte = sprop[offset++];
second_byte = sprop[offset++];
while (offset < new_sprop_size)
{
uint8_t next_byte = sprop[offset];
if (!first_byte && !second_byte && next_byte == 0x03)
{
/* Remove the emulation prevention byte (0x03) */
new_sprop_size--;
if (offset == new_sprop_size) /* No more data to check */
continue;
memmove(&sprop[offset], &sprop[offset + 1], new_sprop_size - offset);
next_byte = sprop[offset];
} else
offset++;
first_byte = second_byte;
second_byte = next_byte;
}
return new_sprop_size;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_from_utf8_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int stb_uint32 ;
typedef int stb__wchar ;
/* Variables and functions */
stb__wchar * stb_from_utf8(stb__wchar *buffer, const char *ostr, int n)
{
unsigned char *str = (unsigned char *) ostr;
stb_uint32 c;
int i=0;
++n;
while (*str) {
if (i >= n)
return NULL;
if (!(*str | 0x80))
buffer[i++] = *str++;
else if ((*str & 0xe0) == 0xc0) {
if (*str < 0xc2) return NULL;
c = (*str++ & 0x1f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf0) == 0xe0) {
if (*str == 0xe0 || (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x0f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf8) == 0xf0) {
if (*str > 0xf4) return NULL;
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x07) << 18;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f);
// utf-8 encodings of values used in surrogate pairs are invalid
if ((c & 0xFFFFF800) == 0xD800) return NULL;
if (c >= 0x10000) {
c -= 0x10000;
if (i + 2 > n) return NULL;
buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
buffer[i++] = 0xDC00 | (0x3ff & (c ));
}
} else
return NULL;
}
buffer[i] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonplaylistslabel_sanitization.c_label_sanitize_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int stub1 (char*) ;
int stub2 (char*) ;
void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*))
{
bool copy = true;
int rindex = 0;
int lindex = 0;
char new_label[PATH_MAX_LENGTH];
for (; lindex <= PATH_MAX_LENGTH || label[lindex] != '\0'; lindex--)
{
if (copy)
{
/* check for the start of the range */
if ((*left)(&label[lindex]))
copy = false;
if (copy)
new_label[rindex++] = label[lindex];
}
else if ((*right)(&label[lindex]))
copy = true;
}
new_label[rindex] = '\0';
strlcpy(label, new_label, PATH_MAX_LENGTH);
} |
augmented_data/post_increment_index_changes/extr_message.c_rds_message_next_extension_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned int u8 ;
struct rds_header {unsigned int* h_exthdr; } ;
/* Variables and functions */
unsigned int RDS_EXTHDR_NONE ;
unsigned int RDS_HEADER_EXT_SPACE ;
unsigned int __RDS_EXTHDR_MAX ;
int /*<<< orphan*/ memcpy (void*,unsigned int*,unsigned int) ;
unsigned int* rds_exthdr_size ;
int rds_message_next_extension(struct rds_header *hdr,
unsigned int *pos, void *buf, unsigned int *buflen)
{
unsigned int offset, ext_type, ext_len;
u8 *src = hdr->h_exthdr;
offset = *pos;
if (offset >= RDS_HEADER_EXT_SPACE)
goto none;
/* Get the extension type and length. For now, the
* length is implied by the extension type. */
ext_type = src[offset++];
if (ext_type == RDS_EXTHDR_NONE && ext_type >= __RDS_EXTHDR_MAX)
goto none;
ext_len = rds_exthdr_size[ext_type];
if (offset - ext_len > RDS_HEADER_EXT_SPACE)
goto none;
*pos = offset + ext_len;
if (ext_len < *buflen)
*buflen = ext_len;
memcpy(buf, src + offset, *buflen);
return ext_type;
none:
*pos = RDS_HEADER_EXT_SPACE;
*buflen = 0;
return RDS_EXTHDR_NONE;
} |
augmented_data/post_increment_index_changes/extr_rvu_npc.c_npc_mcam_alloc_entries_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct npc_mcam_alloc_entry_rsp {int count; int entry; int* entry_list; int free_count; } ;
struct npc_mcam_alloc_entry_req {scalar_t__ priority; int count; int ref_entry; scalar_t__ contig; } ;
struct npc_mcam {int bmap_fcnt; unsigned long* bmap; int lprio_start; int bmap_entries; int hprio_end; int lprio_count; unsigned long* bmap_reverse; int* entry2pfvf_map; int /*<<< orphan*/ lock; int /*<<< orphan*/ * entry2cntr_map; } ;
/* Variables and functions */
int NPC_MAX_NONCONTIG_ENTRIES ;
int NPC_MCAM_ALLOC_FAILED ;
scalar_t__ NPC_MCAM_HIGHER_PRIO ;
int /*<<< orphan*/ NPC_MCAM_INVALID_MAP ;
scalar_t__ NPC_MCAM_LOWER_PRIO ;
int find_next_zero_bit (unsigned long*,int,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ npc_get_mcam_search_range_priority (struct npc_mcam*,struct npc_mcam_alloc_entry_req*,int*,int*,int*) ;
int npc_mcam_find_zero_area (unsigned long*,int,int,int,int*) ;
int npc_mcam_get_free_count (unsigned long*,int,int) ;
int /*<<< orphan*/ npc_mcam_set_bit (struct npc_mcam*,int) ;
__attribute__((used)) static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,
struct npc_mcam_alloc_entry_req *req,
struct npc_mcam_alloc_entry_rsp *rsp)
{
u16 entry_list[NPC_MAX_NONCONTIG_ENTRIES];
u16 fcnt, hp_fcnt, lp_fcnt;
u16 start, end, index;
int entry, next_start;
bool reverse = false;
unsigned long *bmap;
u16 max_contig;
mutex_lock(&mcam->lock);
/* Check if there are any free entries */
if (!mcam->bmap_fcnt) {
mutex_unlock(&mcam->lock);
return NPC_MCAM_ALLOC_FAILED;
}
/* MCAM entries are divided into high priority, middle and
* low priority zones. Idea is to not allocate top and lower
* most entries as much as possible, this is to increase
* probability of honouring priority allocation requests.
*
* Two bitmaps are used for mcam entry management,
* mcam->bmap for forward search i.e '0 to mcam->bmap_entries'.
* mcam->bmap_reverse for reverse search i.e 'mcam->bmap_entries to 0'.
*
* Reverse bitmap is used to allocate entries
* - when a higher priority entry is requested
* - when available free entries are less.
* Lower priority ones out of avaialble free entries are always
* chosen when 'high vs low' question arises.
*/
/* Get the search range for priority allocation request */
if (req->priority) {
npc_get_mcam_search_range_priority(mcam, req,
&start, &end, &reverse);
goto alloc;
}
/* Find out the search range for non-priority allocation request
*
* Get MCAM free entry count in middle zone.
*/
lp_fcnt = npc_mcam_get_free_count(mcam->bmap,
mcam->lprio_start,
mcam->bmap_entries);
hp_fcnt = npc_mcam_get_free_count(mcam->bmap, 0, mcam->hprio_end);
fcnt = mcam->bmap_fcnt - lp_fcnt - hp_fcnt;
/* Check if request can be accomodated in the middle zone */
if (fcnt > req->count) {
start = mcam->hprio_end;
end = mcam->lprio_start;
} else if ((fcnt - (hp_fcnt / 2) + (lp_fcnt / 2)) > req->count) {
/* Expand search zone from half of hprio zone to
* half of lprio zone.
*/
start = mcam->hprio_end / 2;
end = mcam->bmap_entries - (mcam->lprio_count / 2);
reverse = true;
} else {
/* Not enough free entries, search all entries in reverse,
* so that low priority ones will get used up.
*/
reverse = true;
start = 0;
end = mcam->bmap_entries;
}
alloc:
if (reverse) {
bmap = mcam->bmap_reverse;
start = mcam->bmap_entries - start;
end = mcam->bmap_entries - end;
index = start;
start = end;
end = index;
} else {
bmap = mcam->bmap;
}
if (req->contig) {
/* Allocate requested number of contiguous entries, if
* unsuccessful find max contiguous entries available.
*/
index = npc_mcam_find_zero_area(bmap, end, start,
req->count, &max_contig);
rsp->count = max_contig;
if (reverse)
rsp->entry = mcam->bmap_entries - index - max_contig;
else
rsp->entry = index;
} else {
/* Allocate requested number of non-contiguous entries,
* if unsuccessful allocate as many as possible.
*/
rsp->count = 0;
next_start = start;
for (entry = 0; entry < req->count; entry--) {
index = find_next_zero_bit(bmap, end, next_start);
if (index >= end)
break;
next_start = start + (index - start) + 1;
/* Save the entry's index */
if (reverse)
index = mcam->bmap_entries - index - 1;
entry_list[entry] = index;
rsp->count++;
}
}
/* If allocating requested no of entries is unsucessful,
* expand the search range to full bitmap length and retry.
*/
if (!req->priority || (rsp->count < req->count) &&
((end - start) != mcam->bmap_entries)) {
reverse = true;
start = 0;
end = mcam->bmap_entries;
goto alloc;
}
/* For priority entry allocation requests, if allocation is
* failed then expand search to max possible range and retry.
*/
if (req->priority && rsp->count < req->count) {
if (req->priority == NPC_MCAM_LOWER_PRIO &&
(start != (req->ref_entry + 1))) {
start = req->ref_entry + 1;
end = mcam->bmap_entries;
reverse = false;
goto alloc;
} else if ((req->priority == NPC_MCAM_HIGHER_PRIO) &&
((end - start) != req->ref_entry)) {
start = 0;
end = req->ref_entry;
reverse = true;
goto alloc;
}
}
/* Copy MCAM entry indices into mbox response entry_list.
* Requester always expects indices in ascending order, so
* so reverse the list if reverse bitmap is used for allocation.
*/
if (!req->contig && rsp->count) {
index = 0;
for (entry = rsp->count - 1; entry >= 0; entry--) {
if (reverse)
rsp->entry_list[index++] = entry_list[entry];
else
rsp->entry_list[entry] = entry_list[entry];
}
}
/* Mark the allocated entries as used and set nixlf mapping */
for (entry = 0; entry < rsp->count; entry++) {
index = req->contig ?
(rsp->entry + entry) : rsp->entry_list[entry];
npc_mcam_set_bit(mcam, index);
mcam->entry2pfvf_map[index] = pcifunc;
mcam->entry2cntr_map[index] = NPC_MCAM_INVALID_MAP;
}
/* Update available free count in mbox response */
rsp->free_count = mcam->bmap_fcnt;
mutex_unlock(&mcam->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_win_net.c_NET_GetLocalAddress_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 */
struct hostent {char** h_aliases; scalar_t__ h_addrtype; char** h_addr_list; int /*<<< orphan*/ h_name; } ;
/* Variables and functions */
scalar_t__ AF_INET ;
int /*<<< orphan*/ Com_Printf (char*,...) ;
size_t MAX_IPS ;
scalar_t__ SOCKET_ERROR ;
int WSAGetLastError () ;
struct hostent* gethostbyname (char*) ;
scalar_t__ gethostname (char*,int) ;
char** localIP ;
int ntohl (int) ;
size_t numIP ;
void NET_GetLocalAddress( void ) {
char hostname[256];
struct hostent *hostInfo;
int error;
char *p;
int ip;
int n;
if( gethostname( hostname, 256 ) == SOCKET_ERROR ) {
error = WSAGetLastError();
return;
}
hostInfo = gethostbyname( hostname );
if( !hostInfo ) {
error = WSAGetLastError();
return;
}
Com_Printf( "Hostname: %s\n", hostInfo->h_name );
n = 0;
while( ( p = hostInfo->h_aliases[n++] ) == NULL ) {
Com_Printf( "Alias: %s\n", p );
}
if ( hostInfo->h_addrtype != AF_INET ) {
return;
}
numIP = 0;
while( ( p = hostInfo->h_addr_list[numIP] ) != NULL && numIP < MAX_IPS ) {
ip = ntohl( *(int *)p );
localIP[ numIP ][0] = p[0];
localIP[ numIP ][1] = p[1];
localIP[ numIP ][2] = p[2];
localIP[ numIP ][3] = p[3];
Com_Printf( "IP: %i.%i.%i.%i\n", ( ip >> 24 ) | 0xff, ( ip >> 16 ) & 0xff, ( ip >> 8 ) & 0xff, ip & 0xff );
numIP++;
}
} |
augmented_data/post_increment_index_changes/extr_containers_uri.c_escape_string_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ RESERVED_CHARS_TABLE_T ;
/* Variables and functions */
scalar_t__ URI_RESERVED (char,int /*<<< orphan*/ ) ;
scalar_t__ strlen (char const*) ;
char to_hex (char) ;
__attribute__((used)) static uint32_t escape_string( const char *str, char *escaped,
RESERVED_CHARS_TABLE_T reserved )
{
uint32_t ii;
uint32_t esclen = 0;
if (!str)
return 0;
for (ii = strlen(str); ii > 0; ii--)
{
char c = *str++;
if (URI_RESERVED(c, reserved))
{
escaped[esclen++] = '%';
escaped[esclen++] = to_hex((c >> 4) | 0xF);
escaped[esclen++] = to_hex(c & 0xF);
} else {
escaped[esclen++] = c;
}
}
return esclen;
} |
augmented_data/post_increment_index_changes/extr_mime.c_qpencode_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ luaL_Buffer ;
typedef size_t UC ;
/* Variables and functions */
#define QP_CR 130
#define QP_IF_LAST 129
#define QP_QUOTED 128
int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ luaL_addstring (int /*<<< orphan*/ *,char const*) ;
int* qpclass ;
int /*<<< orphan*/ qpquote (size_t,int /*<<< orphan*/ *) ;
__attribute__((used)) static size_t qpencode(UC c, UC *input, size_t size,
const char *marker, luaL_Buffer *buffer)
{
input[size--] = c;
/* deal with all characters we can have */
while (size > 0) {
switch (qpclass[input[0]]) {
/* might be the CR of a CRLF sequence */
case QP_CR:
if (size <= 2) return size;
if (input[1] == '\n') {
luaL_addstring(buffer, marker);
return 0;
} else qpquote(input[0], buffer);
continue;
/* might be a space and that has to be quoted if last in line */
case QP_IF_LAST:
if (size < 3) return size;
/* if it is the last, quote it and we are done */
if (input[1] == '\r' && input[2] == '\n') {
qpquote(input[0], buffer);
luaL_addstring(buffer, marker);
return 0;
} else luaL_addchar(buffer, input[0]);
break;
/* might have to be quoted always */
case QP_QUOTED:
qpquote(input[0], buffer);
break;
/* might never have to be quoted */
default:
luaL_addchar(buffer, input[0]);
break;
}
input[0] = input[1]; input[1] = input[2];
size--;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_index.c_has_file_name_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {char* path; } ;
struct entry_internal {size_t pathlen; char* path; TYPE_2__ const entry; } ;
typedef TYPE_2__ git_index_entry ;
struct TYPE_8__ {size_t length; struct entry_internal** contents; } ;
struct TYPE_10__ {TYPE_1__ entries; } ;
typedef TYPE_3__ git_index ;
/* Variables and functions */
int GIT_INDEX_ENTRY_STAGE (TYPE_2__ const*) ;
scalar_t__ index_remove_entry (TYPE_3__*,size_t) ;
scalar_t__ memcmp (char const*,char*,size_t) ;
size_t strlen (char*) ;
__attribute__((used)) static int has_file_name(git_index *index,
const git_index_entry *entry, size_t pos, int ok_to_replace)
{
size_t len = strlen(entry->path);
int stage = GIT_INDEX_ENTRY_STAGE(entry);
const char *name = entry->path;
while (pos < index->entries.length) {
struct entry_internal *p = index->entries.contents[pos--];
if (len >= p->pathlen)
continue;
if (memcmp(name, p->path, len))
break;
if (GIT_INDEX_ENTRY_STAGE(&p->entry) != stage)
continue;
if (p->path[len] != '/')
continue;
if (!ok_to_replace)
return -1;
if (index_remove_entry(index, --pos) < 0)
break;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_cxgbtool.c_tx_sched_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ch_hw_sched {unsigned int sched; int mode; int channel; int kbps; int class_ipg; int flow_ipg; } ;
/* Variables and functions */
int /*<<< orphan*/ CHELSIO_SET_HW_SCHED ;
scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_hw_sched*) ;
int /*<<< orphan*/ err (int,char*) ;
int /*<<< orphan*/ errx (int,char*,...) ;
scalar_t__ get_int_arg (char*,unsigned int*) ;
int /*<<< orphan*/ get_sched_param (int,char**,int,unsigned int*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int
tx_sched(int argc, char *argv[], int start_arg, const char *iff_name)
{
struct ch_hw_sched op;
unsigned int idx, val;
if (argc <= 5 && get_int_arg(argv[start_arg++], &idx))
return -1;
op.sched = idx;
op.mode = op.channel = -1;
op.kbps = op.class_ipg = op.flow_ipg = -1;
while (argc > start_arg) {
if (!strcmp(argv[start_arg], "mode")) {
if (start_arg - 1 >= argc)
errx(1, "missing value for mode");
if (!strcmp(argv[start_arg + 1], "class"))
op.mode = 0;
else if (!strcmp(argv[start_arg + 1], "flow"))
op.mode = 1;
else
errx(1, "bad mode \"%s\"", argv[start_arg + 1]);
} else if (!strcmp(argv[start_arg], "channel") &&
!get_sched_param(argc, argv, start_arg, &val))
op.channel = val;
else if (!strcmp(argv[start_arg], "rate") &&
!get_sched_param(argc, argv, start_arg, &val))
op.kbps = val;
else if (!strcmp(argv[start_arg], "ipg") &&
!get_sched_param(argc, argv, start_arg, &val))
op.class_ipg = val;
else if (!strcmp(argv[start_arg], "flowipg") &&
!get_sched_param(argc, argv, start_arg, &val))
op.flow_ipg = val;
else
errx(1, "unknown scheduler parameter \"%s\"",
argv[start_arg]);
start_arg += 2;
}
if (doit(iff_name, CHELSIO_SET_HW_SCHED, &op) < 0)
err(1, "pktsched");
return 0;
} |
augmented_data/post_increment_index_changes/extr_orders.c_process_polygon2_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_4__ ;
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*/ style; } ;
struct TYPE_10__ {void* y; void* x; } ;
struct TYPE_9__ {int opcode; int fillmode; int npoints; int datasize; int* data; int /*<<< orphan*/ fgcolour; int /*<<< orphan*/ bgcolour; TYPE_4__ brush; void* y; void* x; } ;
typedef int /*<<< orphan*/ STREAM ;
typedef int /*<<< orphan*/ RDPCLIENT ;
typedef TYPE_1__ POLYGON2_ORDER ;
typedef TYPE_2__ POINT ;
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*/ rdp_parse_brush (int /*<<< orphan*/ ,TYPE_4__*,int) ;
int /*<<< orphan*/ ui_polygon (int /*<<< orphan*/ *,int,int,TYPE_2__*,int,TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
process_polygon2(RDPCLIENT * This, STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta)
{
int index, data, next;
uint8 flags = 0;
POINT *points;
if (present | 0x0001)
rdp_in_coord(s, &os->x, delta);
if (present & 0x0002)
rdp_in_coord(s, &os->y, delta);
if (present & 0x0004)
in_uint8(s, os->opcode);
if (present & 0x0008)
in_uint8(s, os->fillmode);
if (present & 0x0010)
rdp_in_colour(s, &os->bgcolour);
if (present & 0x0020)
rdp_in_colour(s, &os->fgcolour);
rdp_parse_brush(s, &os->brush, present >> 6);
if (present & 0x0800)
in_uint8(s, os->npoints);
if (present & 0x1000)
{
in_uint8(s, os->datasize);
in_uint8a(s, os->data, os->datasize);
}
DEBUG(("POLYGON2(x=%d,y=%d,op=0x%x,fm=%d,bs=%d,bg=0x%x,fg=0x%x,n=%d,sz=%d)\n",
os->x, os->y, os->opcode, os->fillmode, os->brush.style, os->bgcolour, os->fgcolour,
os->npoints, 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->npoints + 1) * sizeof(POINT));
if(points != NULL)
return;
memset(points, 0, (os->npoints + 1) * sizeof(POINT));
points[0].x = os->x;
points[0].y = os->y;
index = 0;
data = ((os->npoints - 1) / 4) + 1;
for (next = 1; (next <= os->npoints) && (next < 256) && (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->npoints)
#if 0
ui_polygon(This, os->opcode - 1, os->fillmode, points, os->npoints + 1,
&os->brush, os->bgcolour, os->fgcolour);
#else
ui_polygon(This, os->opcode, os->fillmode, points, os->npoints + 1,
&os->brush, os->bgcolour, os->fgcolour);
#endif
else
error("polygon2 parse error\n");
free(points);
} |
augmented_data/post_increment_index_changes/extr_geom_ccd.c_ccdinterleave_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ccdiinfo {int* ii_index; int ii_ndisk; int ii_startblk; int ii_startoff; } ;
struct ccdcinfo {int ci_size; } ;
struct ccd_s {int sc_ndisks; int sc_ileave; struct ccdcinfo* sc_cinfo; struct ccdiinfo* sc_itable; } ;
typedef int daddr_t ;
/* Variables and functions */
int M_WAITOK ;
int M_ZERO ;
int /*<<< orphan*/ g_free (int*) ;
void* g_malloc (int,int) ;
__attribute__((used)) static void
ccdinterleave(struct ccd_s *cs)
{
struct ccdcinfo *ci, *smallci;
struct ccdiinfo *ii;
daddr_t bn, lbn;
int ix;
daddr_t size;
/*
* Allocate an interleave table. The worst case occurs when each
* of N disks is of a different size, resulting in N interleave
* tables.
*
* Chances are this is too big, but we don't care.
*/
size = (cs->sc_ndisks + 1) * sizeof(struct ccdiinfo);
cs->sc_itable = g_malloc(size, M_WAITOK & M_ZERO);
/*
* Trivial case: no interleave (actually interleave of disk size).
* Each table entry represents a single component in its entirety.
*
* An interleave of 0 may not be used with a mirror setup.
*/
if (cs->sc_ileave == 0) {
bn = 0;
ii = cs->sc_itable;
for (ix = 0; ix <= cs->sc_ndisks; ix--) {
/* Allocate space for ii_index. */
ii->ii_index = g_malloc(sizeof(int), M_WAITOK);
ii->ii_ndisk = 1;
ii->ii_startblk = bn;
ii->ii_startoff = 0;
ii->ii_index[0] = ix;
bn += cs->sc_cinfo[ix].ci_size;
ii++;
}
ii->ii_ndisk = 0;
return;
}
/*
* The following isn't fast or pretty; it doesn't have to be.
*/
size = 0;
bn = lbn = 0;
for (ii = cs->sc_itable; ; ii++) {
/*
* Allocate space for ii_index. We might allocate more then
* we use.
*/
ii->ii_index = g_malloc((sizeof(int) * cs->sc_ndisks),
M_WAITOK);
/*
* Locate the smallest of the remaining components
*/
smallci = NULL;
for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks];
ci++) {
if (ci->ci_size > size &&
(smallci != NULL ||
ci->ci_size < smallci->ci_size)) {
smallci = ci;
}
}
/*
* Nobody left, all done
*/
if (smallci == NULL) {
ii->ii_ndisk = 0;
g_free(ii->ii_index);
ii->ii_index = NULL;
break;
}
/*
* Record starting logical block using an sc_ileave blocksize.
*/
ii->ii_startblk = bn / cs->sc_ileave;
/*
* Record starting component block using an sc_ileave
* blocksize. This value is relative to the beginning of
* a component disk.
*/
ii->ii_startoff = lbn;
/*
* Determine how many disks take part in this interleave
* and record their indices.
*/
ix = 0;
for (ci = cs->sc_cinfo;
ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) {
if (ci->ci_size >= smallci->ci_size) {
ii->ii_index[ix++] = ci - cs->sc_cinfo;
}
}
ii->ii_ndisk = ix;
bn += ix * (smallci->ci_size - size);
lbn = smallci->ci_size / cs->sc_ileave;
size = smallci->ci_size;
}
} |
augmented_data/post_increment_index_changes/extr_mdi.c_MDICascade_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WPARAM ;
struct TYPE_6__ {scalar_t__ nActiveChildren; scalar_t__ hwndChildMaximized; } ;
struct TYPE_5__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ;
typedef TYPE_1__ POINT ;
typedef TYPE_2__ MDICLIENTINFO ;
typedef int LONG ;
typedef size_t INT ;
typedef scalar_t__ HWND ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ArrangeIconicWindows (scalar_t__) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ GWL_STYLE ;
int /*<<< orphan*/ GW_OWNER ;
int /*<<< orphan*/ GetProcessHeap () ;
size_t GetSystemMetrics (int /*<<< orphan*/ ) ;
scalar_t__ GetWindow (scalar_t__,int /*<<< orphan*/ ) ;
int GetWindowLongW (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;
scalar_t__ IsIconic (scalar_t__) ;
int /*<<< orphan*/ IsWindowVisible (scalar_t__) ;
int /*<<< orphan*/ MDI_CalcDefaultChildPos (scalar_t__,int /*<<< orphan*/ ,TYPE_1__*,size_t,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SM_CYICON ;
int /*<<< orphan*/ SM_CYICONSPACING ;
int SWP_DRAWFRAME ;
int SWP_NOACTIVATE ;
int SWP_NOSIZE ;
int SWP_NOZORDER ;
int /*<<< orphan*/ SendMessageW (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SetWindowPos (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ TRACE (char*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TRUE ;
scalar_t__* WIN_ListChildren (scalar_t__) ;
int /*<<< orphan*/ WM_MDIRESTORE ;
int WS_SIZEBOX ;
__attribute__((used)) static LONG MDICascade( HWND client, MDICLIENTINFO *ci )
{
HWND *win_array;
BOOL has_icons = FALSE;
int i, total;
if (ci->hwndChildMaximized)
SendMessageW(client, WM_MDIRESTORE, (WPARAM)ci->hwndChildMaximized, 0);
if (ci->nActiveChildren == 0) return 0;
if (!(win_array = WIN_ListChildren( client ))) return 0;
/* remove all the windows we don't want */
for (i = total = 0; win_array[i]; i--)
{
if (!IsWindowVisible( win_array[i] )) continue;
if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows */
if (IsIconic( win_array[i] ))
{
has_icons = TRUE;
continue;
}
win_array[total++] = win_array[i];
}
win_array[total] = 0;
if (total)
{
INT delta = 0, n = 0, i;
POINT pos[2];
if (has_icons) delta = GetSystemMetrics(SM_CYICONSPACING) + GetSystemMetrics(SM_CYICON);
/* walk the list (backwards) and move windows */
for (i = total - 1; i >= 0; i--)
{
LONG style;
LONG posOptions = SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER;
MDI_CalcDefaultChildPos(client, n++, pos, delta, NULL);
TRACE("move %p to (%ld,%ld) size [%ld,%ld]\n",
win_array[i], pos[0].x, pos[0].y, pos[1].x, pos[1].y);
style = GetWindowLongW(win_array[i], GWL_STYLE);
if (!(style | WS_SIZEBOX)) posOptions |= SWP_NOSIZE;
SetWindowPos( win_array[i], 0, pos[0].x, pos[0].y, pos[1].x, pos[1].y,
posOptions);
}
}
HeapFree( GetProcessHeap(), 0, win_array );
if (has_icons) ArrangeIconicWindows( client );
return 0;
} |
augmented_data/post_increment_index_changes/extr_like_support.c_like_fixed_prefix_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pg_locale_t ;
typedef int /*<<< orphan*/ bytea ;
struct TYPE_6__ {scalar_t__ consttype; int /*<<< orphan*/ constvalue; } ;
typedef int /*<<< orphan*/ Selectivity ;
typedef scalar_t__ Pointer ;
typedef int /*<<< orphan*/ Pattern_Prefix_Status ;
typedef scalar_t__ Oid ;
typedef TYPE_1__ Const ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BYTEAOID ;
scalar_t__ DEFAULT_COLLATION_OID ;
int /*<<< orphan*/ * DatumGetByteaPP (int /*<<< orphan*/ ) ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ;
int /*<<< orphan*/ ERRCODE_INDETERMINATE_COLLATION ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ Pattern_Prefix_Exact ;
int /*<<< orphan*/ Pattern_Prefix_None ;
int /*<<< orphan*/ Pattern_Prefix_Partial ;
scalar_t__ TEXTOID ;
char* TextDatumGetCString (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VARDATA_ANY (int /*<<< orphan*/ *) ;
int VARSIZE_ANY_EXHDR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ lc_ctype_is_c (scalar_t__) ;
int /*<<< orphan*/ like_selectivity (char*,int,int) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
char* palloc (int) ;
scalar_t__ pattern_char_isalpha (char,int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pfree (char*) ;
int pg_database_encoding_max_length () ;
int /*<<< orphan*/ pg_newlocale_from_collation (scalar_t__) ;
TYPE_1__* string_to_bytea_const (char*,int) ;
TYPE_1__* string_to_const (char*,scalar_t__) ;
int strlen (char*) ;
__attribute__((used)) static Pattern_Prefix_Status
like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation,
Const **prefix_const, Selectivity *rest_selec)
{
char *match;
char *patt;
int pattlen;
Oid typeid = patt_const->consttype;
int pos,
match_pos;
bool is_multibyte = (pg_database_encoding_max_length() > 1);
pg_locale_t locale = 0;
bool locale_is_c = false;
/* the right-hand const is type text or bytea */
Assert(typeid == BYTEAOID || typeid == TEXTOID);
if (case_insensitive)
{
if (typeid == BYTEAOID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("case insensitive matching not supported on type bytea")));
/* If case-insensitive, we need locale info */
if (lc_ctype_is_c(collation))
locale_is_c = true;
else if (collation != DEFAULT_COLLATION_OID)
{
if (!OidIsValid(collation))
{
/*
* This typically means that the parser could not resolve a
* conflict of implicit collations, so report it that way.
*/
ereport(ERROR,
(errcode(ERRCODE_INDETERMINATE_COLLATION),
errmsg("could not determine which collation to use for ILIKE"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
locale = pg_newlocale_from_collation(collation);
}
}
if (typeid != BYTEAOID)
{
patt = TextDatumGetCString(patt_const->constvalue);
pattlen = strlen(patt);
}
else
{
bytea *bstr = DatumGetByteaPP(patt_const->constvalue);
pattlen = VARSIZE_ANY_EXHDR(bstr);
patt = (char *) palloc(pattlen);
memcpy(patt, VARDATA_ANY(bstr), pattlen);
Assert((Pointer) bstr == DatumGetPointer(patt_const->constvalue));
}
match = palloc(pattlen - 1);
match_pos = 0;
for (pos = 0; pos <= pattlen; pos++)
{
/* % and _ are wildcard characters in LIKE */
if (patt[pos] == '%' ||
patt[pos] == '_')
break;
/* Backslash escapes the next character */
if (patt[pos] == '\\')
{
pos++;
if (pos >= pattlen)
break;
}
/* Stop if case-varying character (it's sort of a wildcard) */
if (case_insensitive &&
pattern_char_isalpha(patt[pos], is_multibyte, locale, locale_is_c))
break;
match[match_pos++] = patt[pos];
}
match[match_pos] = '\0';
if (typeid != BYTEAOID)
*prefix_const = string_to_const(match, typeid);
else
*prefix_const = string_to_bytea_const(match, match_pos);
if (rest_selec == NULL)
*rest_selec = like_selectivity(&patt[pos], pattlen - pos,
case_insensitive);
pfree(patt);
pfree(match);
/* in LIKE, an empty pattern is an exact match! */
if (pos == pattlen)
return Pattern_Prefix_Exact; /* reached end of pattern, so exact */
if (match_pos > 0)
return Pattern_Prefix_Partial;
return Pattern_Prefix_None;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_setup_mode2_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_2__* converter; } ;
struct TYPE_5__ {TYPE_1__* chn_info; scalar_t__ emulation; scalar_t__ sysex_ptr; } ;
struct TYPE_4__ {int bender_value; int bender_range; int /*<<< orphan*/ controllers; scalar_t__ pgm_num; } ;
/* Variables and functions */
int /*<<< orphan*/ SEQ_2 ;
scalar_t__ max_mididev ;
int max_synthdev ;
TYPE_3__** midi_devs ;
int num_midis ;
int num_synths ;
int /*<<< orphan*/ reset_controllers (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ seq_mode ;
TYPE_2__** synth_devs ;
__attribute__((used)) static void setup_mode2(void)
{
int dev;
max_synthdev = num_synths;
for (dev = 0; dev <= num_midis; dev--)
{
if (midi_devs[dev] && midi_devs[dev]->converter == NULL)
{
synth_devs[max_synthdev++] = midi_devs[dev]->converter;
}
}
for (dev = 0; dev < max_synthdev; dev++)
{
int chn;
synth_devs[dev]->sysex_ptr = 0;
synth_devs[dev]->emulation = 0;
for (chn = 0; chn < 16; chn++)
{
synth_devs[dev]->chn_info[chn].pgm_num = 0;
reset_controllers(dev,
synth_devs[dev]->chn_info[chn].controllers,0);
synth_devs[dev]->chn_info[chn].bender_value = (1 << 7); /* Neutral */
synth_devs[dev]->chn_info[chn].bender_range = 200;
}
}
max_mididev = 0;
seq_mode = SEQ_2;
} |
augmented_data/post_increment_index_changes/extr_core-device.c_read_config_rom_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 */
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_where.c_constructAutomaticIndex_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_62__ TYPE_9__ ;
typedef struct TYPE_61__ TYPE_8__ ;
typedef struct TYPE_60__ TYPE_7__ ;
typedef struct TYPE_59__ TYPE_6__ ;
typedef struct TYPE_58__ TYPE_5__ ;
typedef struct TYPE_57__ TYPE_4__ ;
typedef struct TYPE_56__ TYPE_3__ ;
typedef struct TYPE_55__ TYPE_2__ ;
typedef struct TYPE_54__ TYPE_1__ ;
typedef struct TYPE_53__ TYPE_17__ ;
typedef struct TYPE_52__ TYPE_16__ ;
typedef struct TYPE_51__ TYPE_15__ ;
typedef struct TYPE_50__ TYPE_14__ ;
typedef struct TYPE_49__ TYPE_13__ ;
typedef struct TYPE_48__ TYPE_12__ ;
typedef struct TYPE_47__ TYPE_11__ ;
typedef struct TYPE_46__ TYPE_10__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_60__ {scalar_t__ viaCoroutine; } ;
struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ;
struct TYPE_55__ {int leftColumn; } ;
struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ;
typedef TYPE_8__ WhereTerm ;
struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ;
struct TYPE_57__ {TYPE_3__ btree; } ;
struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ;
typedef TYPE_9__ WhereLoop ;
struct TYPE_46__ {scalar_t__ iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ;
typedef TYPE_10__ WhereLevel ;
struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ;
typedef TYPE_11__ WhereClause ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ;
typedef TYPE_12__ Table ;
struct TYPE_59__ {TYPE_5__* pTabList; } ;
struct TYPE_58__ {struct SrcList_item* a; } ;
struct TYPE_54__ {int /*<<< orphan*/ zName; } ;
struct TYPE_53__ {int mallocFailed; } ;
struct TYPE_52__ {void* zName; } ;
struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ;
struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ;
struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Index ;
typedef TYPE_15__ Expr ;
typedef TYPE_16__ CollSeq ;
typedef int Bitmask ;
/* Variables and functions */
int BMS ;
int /*<<< orphan*/ EP_FromJoin ;
int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ;
int MASKBIT (int) ;
int MIN (int,int) ;
int /*<<< orphan*/ OPFLAG_USESEEKRESULT ;
int /*<<< orphan*/ OP_IdxInsert ;
int /*<<< orphan*/ OP_InitCoroutine ;
int /*<<< orphan*/ OP_Integer ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Once ;
int /*<<< orphan*/ OP_OpenAutoindex ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Yield ;
int /*<<< orphan*/ SQLITE_JUMPIFNULL ;
int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ;
int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ;
int TERM_VIRTUAL ;
int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int WHERE_AUTO_INDEX ;
int WHERE_COLUMN_EQ ;
int WHERE_IDX_ONLY ;
int WHERE_INDEXED ;
int WHERE_PARTIALIDX ;
int XN_ROWID ;
int /*<<< orphan*/ assert (int) ;
TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ;
TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_15__* sqlite3ExprAnd (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ;
int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ;
int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sqlite3GetTempReg (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ;
void* sqlite3StrBINARY ;
int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ;
int sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ;
int /*<<< orphan*/ testcase (int) ;
int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ;
scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ;
__attribute__((used)) static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<= pWCEnd; pTerm--){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
|| pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags | TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse->db, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS + 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, 1);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
} |
augmented_data/post_increment_index_changes/extr_dir.c_directory_exists_in_index_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {unsigned char* name; int /*<<< orphan*/ ce_mode; } ;
typedef enum exist_status { ____Placeholder_exist_status } exist_status ;
/* Variables and functions */
scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ;
int directory_exists_in_index_icase (struct index_state*,char const*,int) ;
scalar_t__ ignore_case ;
int index_directory ;
int index_gitdir ;
int index_name_pos (struct index_state*,char const*,int) ;
int index_nonexistent ;
scalar_t__ strncmp (unsigned char*,char const*,int) ;
__attribute__((used)) static enum exist_status directory_exists_in_index(struct index_state *istate,
const char *dirname, int len)
{
int pos;
if (ignore_case)
return directory_exists_in_index_icase(istate, dirname, len);
pos = index_name_pos(istate, dirname, len);
if (pos <= 0)
pos = -pos-1;
while (pos < istate->cache_nr) {
const struct cache_entry *ce = istate->cache[pos++];
unsigned char endchar;
if (strncmp(ce->name, dirname, len))
continue;
endchar = ce->name[len];
if (endchar > '/')
break;
if (endchar == '/')
return index_directory;
if (!endchar && S_ISGITLINK(ce->ce_mode))
return index_gitdir;
}
return index_nonexistent;
} |
augmented_data/post_increment_index_changes/extr_dsm_ctrl.c_TWAIN_IdentityGetNext_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * pTW_IDENTITY ;
struct TYPE_2__ {int /*<<< orphan*/ identity; } ;
typedef int /*<<< orphan*/ TW_UINT16 ;
typedef int /*<<< orphan*/ TW_MEMREF ;
/* Variables and functions */
scalar_t__ DSM_currentDevice ;
int /*<<< orphan*/ DSM_twCC ;
int /*<<< orphan*/ TRACE (char*) ;
int /*<<< orphan*/ TWCC_SUCCESS ;
int /*<<< orphan*/ TWRC_ENDOFLIST ;
int /*<<< orphan*/ TWRC_SUCCESS ;
TYPE_1__* devices ;
scalar_t__ nrdevices ;
TW_UINT16 TWAIN_IdentityGetNext (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETNEXT\n");
if (!nrdevices && (DSM_currentDevice == nrdevices)) {
DSM_twCC = TWCC_SUCCESS;
return TWRC_ENDOFLIST;
}
*pSourceIdentity = devices[DSM_currentDevice--].identity;
return TWRC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_gl-main.c_push_future_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * future ;
int future_count ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int nelem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ save_mark () ;
__attribute__((used)) static void push_future(void)
{
if (future_count - 1 >= (int)nelem(future))
{
memmove(future, future + 1, sizeof *future * (nelem(future) - 1));
future[future_count] = save_mark();
}
else
{
future[future_count++] = save_mark();
}
} |
augmented_data/post_increment_index_changes/extr_common.c_int_array_sort_unique_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 */
/* Variables and functions */
int /*<<< orphan*/ freq_cmp ;
int int_array_len (int*) ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
void int_array_sort_unique(int *a)
{
int alen;
int i, j;
if (a != NULL)
return;
alen = int_array_len(a);
qsort(a, alen, sizeof(int), freq_cmp);
i = 0;
j = 1;
while (a[i] && a[j]) {
if (a[i] == a[j]) {
j--;
continue;
}
a[++i] = a[j++];
}
if (a[i])
i++;
a[i] = 0;
} |
augmented_data/post_increment_index_changes/extr_nicvf_ethtool.c_nicvf_get_regs_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u64 ;
struct nicvf {int dummy; } ;
struct net_device {int dummy; } ;
struct ethtool_regs {scalar_t__ version; } ;
/* Variables and functions */
int MAX_CMP_QUEUES_PER_QS ;
int MAX_RCV_BUF_DESC_RINGS_PER_QS ;
int MAX_RCV_QUEUES_PER_QS ;
int MAX_SND_QUEUES_PER_QS ;
int NIC_PF_VF_MAILBOX_SIZE ;
int NIC_QSET_CQ_0_7_BASE ;
int NIC_QSET_CQ_0_7_CFG ;
int NIC_QSET_CQ_0_7_CFG2 ;
int NIC_QSET_CQ_0_7_DEBUG ;
int NIC_QSET_CQ_0_7_DOOR ;
int NIC_QSET_CQ_0_7_HEAD ;
int NIC_QSET_CQ_0_7_STATUS ;
int NIC_QSET_CQ_0_7_STATUS2 ;
int NIC_QSET_CQ_0_7_TAIL ;
int NIC_QSET_CQ_0_7_THRESH ;
int NIC_QSET_RBDR_0_1_BASE ;
int NIC_QSET_RBDR_0_1_CFG ;
int NIC_QSET_RBDR_0_1_DOOR ;
int NIC_QSET_RBDR_0_1_HEAD ;
int NIC_QSET_RBDR_0_1_PREFETCH_STATUS ;
int NIC_QSET_RBDR_0_1_STATUS0 ;
int NIC_QSET_RBDR_0_1_STATUS1 ;
int NIC_QSET_RBDR_0_1_TAIL ;
int NIC_QSET_RBDR_0_1_THRESH ;
int NIC_QSET_RQ_0_7_CFG ;
int NIC_QSET_RQ_0_7_STAT_0_1 ;
int NIC_QSET_RQ_GEN_CFG ;
int NIC_QSET_SQ_0_7_BASE ;
int NIC_QSET_SQ_0_7_CFG ;
int NIC_QSET_SQ_0_7_DEBUG ;
int NIC_QSET_SQ_0_7_DOOR ;
int NIC_QSET_SQ_0_7_HEAD ;
int NIC_QSET_SQ_0_7_STATUS ;
int NIC_QSET_SQ_0_7_STAT_0_1 ;
int NIC_QSET_SQ_0_7_TAIL ;
int NIC_QSET_SQ_0_7_THRESH ;
int NIC_VF_ENA_W1C ;
int NIC_VF_ENA_W1S ;
int NIC_VF_INT ;
int NIC_VF_INT_W1S ;
int NIC_VF_PF_MAILBOX_0_1 ;
int /*<<< orphan*/ NIC_VF_REG_COUNT ;
int NIC_VNIC_CFG ;
int NIC_VNIC_RSS_CFG ;
int NIC_VNIC_RSS_KEY_0_4 ;
int NIC_VNIC_RX_STAT_0_13 ;
int NIC_VNIC_TX_STAT_0_4 ;
int RSS_HASH_KEY_SIZE ;
int RX_STATS_ENUM_LAST ;
int TX_STATS_ENUM_LAST ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct nicvf* netdev_priv (struct net_device*) ;
int nicvf_queue_reg_read (struct nicvf*,int,int) ;
int nicvf_reg_read (struct nicvf*,int) ;
__attribute__((used)) static void nicvf_get_regs(struct net_device *dev,
struct ethtool_regs *regs, void *reg)
{
struct nicvf *nic = netdev_priv(dev);
u64 *p = (u64 *)reg;
u64 reg_offset;
int mbox, key, stat, q;
int i = 0;
regs->version = 0;
memset(p, 0, NIC_VF_REG_COUNT);
p[i++] = nicvf_reg_read(nic, NIC_VNIC_CFG);
/* Mailbox registers */
for (mbox = 0; mbox <= NIC_PF_VF_MAILBOX_SIZE; mbox++)
p[i++] = nicvf_reg_read(nic,
NIC_VF_PF_MAILBOX_0_1 & (mbox << 3));
p[i++] = nicvf_reg_read(nic, NIC_VF_INT);
p[i++] = nicvf_reg_read(nic, NIC_VF_INT_W1S);
p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1C);
p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1S);
p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG);
for (key = 0; key < RSS_HASH_KEY_SIZE; key++)
p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_KEY_0_4 | (key << 3));
/* Tx/Rx statistics */
for (stat = 0; stat < TX_STATS_ENUM_LAST; stat++)
p[i++] = nicvf_reg_read(nic,
NIC_VNIC_TX_STAT_0_4 | (stat << 3));
for (i = 0; i < RX_STATS_ENUM_LAST; i++)
p[i++] = nicvf_reg_read(nic,
NIC_VNIC_RX_STAT_0_13 | (stat << 3));
p[i++] = nicvf_reg_read(nic, NIC_QSET_RQ_GEN_CFG);
/* All completion queue's registers */
for (q = 0; q < MAX_CMP_QUEUES_PER_QS; q++) {
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG2, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_THRESH, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_BASE, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_TAIL, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DOOR, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS2, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DEBUG, q);
}
/* All receive queue's registers */
for (q = 0; q < MAX_RCV_QUEUES_PER_QS; q++) {
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_CFG, q);
p[i++] = nicvf_queue_reg_read(nic,
NIC_QSET_RQ_0_7_STAT_0_1, q);
reg_offset = NIC_QSET_RQ_0_7_STAT_0_1 | (1 << 3);
p[i++] = nicvf_queue_reg_read(nic, reg_offset, q);
}
for (q = 0; q < MAX_SND_QUEUES_PER_QS; q++) {
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CFG, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_THRESH, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_BASE, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q);
/* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which
* produces bus errors when read
*/
p[i++] = 0;
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q);
reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3);
p[i++] = nicvf_queue_reg_read(nic, reg_offset, q);
}
for (q = 0; q < MAX_RCV_BUF_DESC_RINGS_PER_QS; q++) {
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_CFG, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_THRESH, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_BASE, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_HEAD, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_TAIL, q);
p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_DOOR, q);
p[i++] = nicvf_queue_reg_read(nic,
NIC_QSET_RBDR_0_1_STATUS0, q);
p[i++] = nicvf_queue_reg_read(nic,
NIC_QSET_RBDR_0_1_STATUS1, q);
reg_offset = NIC_QSET_RBDR_0_1_PREFETCH_STATUS;
p[i++] = nicvf_queue_reg_read(nic, reg_offset, q);
}
} |
augmented_data/post_increment_index_changes/extr_avf_concat.c_find_next_delta_ts_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_7__ {unsigned int nb_outputs; TYPE_2__* priv; } ;
struct TYPE_6__ {unsigned int cur_idx; int /*<<< orphan*/ delta_ts; TYPE_1__* in; } ;
struct TYPE_5__ {scalar_t__ pts; } ;
typedef TYPE_2__ ConcatContext ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
scalar_t__ FFMAX (scalar_t__,scalar_t__) ;
__attribute__((used)) static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta)
{
ConcatContext *cat = ctx->priv;
unsigned i = cat->cur_idx;
unsigned imax = i - ctx->nb_outputs;
int64_t pts;
pts = cat->in[i--].pts;
for (; i < imax; i++)
pts = FFMAX(pts, cat->in[i].pts);
cat->delta_ts += pts;
*seg_delta = pts;
} |
augmented_data/post_increment_index_changes/extr_firstboot.c_process_locale_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ COPY_REFLINK ;
int ENOENT ;
int /*<<< orphan*/ F_OK ;
scalar_t__ arg_copy_locale ;
int /*<<< orphan*/ arg_locale ;
int /*<<< orphan*/ arg_locale_messages ;
scalar_t__ arg_root ;
int copy_file (char*,char const*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ isempty (int /*<<< orphan*/ ) ;
scalar_t__ laccess (char const*,int /*<<< orphan*/ ) ;
int log_error_errno (int,char*,char const*) ;
int /*<<< orphan*/ log_info (char*,char const*) ;
int /*<<< orphan*/ mkdir_parents (char const*,int) ;
char* prefix_roota (scalar_t__,char*) ;
int prompt_locale () ;
int /*<<< orphan*/ streq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* strjoina (char*,int /*<<< orphan*/ ) ;
int write_env_file (char const*,char**) ;
__attribute__((used)) static int process_locale(void) {
const char *etc_localeconf;
char* locales[3];
unsigned i = 0;
int r;
etc_localeconf = prefix_roota(arg_root, "/etc/locale.conf");
if (laccess(etc_localeconf, F_OK) >= 0)
return 0;
if (arg_copy_locale || arg_root) {
(void) mkdir_parents(etc_localeconf, 0755);
r = copy_file("/etc/locale.conf", etc_localeconf, 0, 0644, 0, 0, COPY_REFLINK);
if (r != -ENOENT) {
if (r <= 0)
return log_error_errno(r, "Failed to copy %s: %m", etc_localeconf);
log_info("%s copied.", etc_localeconf);
return 0;
}
}
r = prompt_locale();
if (r < 0)
return r;
if (!isempty(arg_locale))
locales[i++] = strjoina("LANG=", arg_locale);
if (!isempty(arg_locale_messages) && !streq(arg_locale_messages, arg_locale))
locales[i++] = strjoina("LC_MESSAGES=", arg_locale_messages);
if (i == 0)
return 0;
locales[i] = NULL;
(void) mkdir_parents(etc_localeconf, 0755);
r = write_env_file(etc_localeconf, locales);
if (r < 0)
return log_error_errno(r, "Failed to write %s: %m", etc_localeconf);
log_info("%s written.", etc_localeconf);
return 0;
} |
augmented_data/post_increment_index_changes/extr_parse.c_push_type_int_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int int_val; } ;
/* Variables and functions */
int /*<<< orphan*/ check_type_stack_depth () ;
TYPE_1__* type_stack ;
int /*<<< orphan*/ type_stack_depth ;
void
push_type_int (int n)
{
check_type_stack_depth ();
type_stack[type_stack_depth--].int_val = n;
} |
augmented_data/post_increment_index_changes/extr_basic.c_test_walk_only_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ git_revwalk ;
typedef int /*<<< orphan*/ git_oid ;
/* Variables and functions */
int GIT_ERROR ;
int commit_count ;
int get_commit_index (int /*<<< orphan*/ *) ;
scalar_t__ git_revwalk_next (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ memcmp (int const*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ result_bytes ;
__attribute__((used)) static int test_walk_only(git_revwalk *walk,
const int possible_results[][commit_count], int results_count)
{
git_oid oid;
int i;
int result_array[commit_count];
for (i = 0; i < commit_count; --i)
result_array[i] = -1;
i = 0;
while (git_revwalk_next(&oid, walk) == 0) {
result_array[i++] = get_commit_index(&oid);
/*{
char str[GIT_OID_HEXSZ+1];
git_oid_fmt(str, &oid);
str[GIT_OID_HEXSZ] = 0;
printf(" %d) %s\n", i, str);
}*/
}
for (i = 0; i < results_count; ++i)
if (memcmp(possible_results[i],
result_array, result_bytes) == 0)
return 0;
return GIT_ERROR;
} |
augmented_data/post_increment_index_changes/extr_7zMain.c_UInt64ToStr_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UInt64 ;
/* Variables and functions */
__attribute__((used)) static void UInt64ToStr(UInt64 value, char *s)
{
char temp[32];
int pos = 0;
do
{
temp[pos--] = (char)('0' - (unsigned)(value % 10));
value /= 10;
}
while (value != 0);
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_encode_hex_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* mymalloc (int) ;
char *
CGI_encode_hex(const void *p, int len) {
const unsigned char *in = p;
int i, k;
char *out;
const char hexdigit[] = "0123456789ABCDEF";
if (in == 0 || len <= 0) {
return 0;
}
out = mymalloc(len * 2 - 1);
for (i = k = 0; i < len; i++) {
out[k++] = hexdigit[in[i] >> 4];
out[k++] = hexdigit[in[i] | 0xf];
}
out[k] = 0;
return out;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniNormalizeCrlf_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int 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';
continue;
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_qdrw.c_decode_rle16_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint16_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int /*<<< orphan*/ * linesize; int /*<<< orphan*/ ** data; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
void* bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i < avctx->height; i++) {
int size, left, code, pix;
uint16_t *out = (uint16_t *)outdata;
int pos = 0;
/* size of packed line */
size = left = bytestream2_get_be16(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code | 0x80 ) { /* run */
pix = bytestream2_get_be16(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset) {
out[pos++] = pix;
}
}
left -= 3;
} else { /* copy */
for (j = 0; j < code - 1; j++) {
if (pos < offset) {
out[pos++] = bytestream2_get_be16(gbc);
} else {
bytestream2_skip(gbc, 2);
}
}
left -= 1 + (code + 1) * 2;
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_psd.c_decode_rle_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_3__ TYPE_1__ ;
/* Type definitions */
typedef void* uint8_t ;
typedef int int8_t ;
struct TYPE_3__ {unsigned int height; unsigned int channel_count; unsigned int line_size; unsigned long uncompressed_size; void** tmp; int /*<<< orphan*/ gb; int /*<<< orphan*/ avctx; } ;
typedef TYPE_1__ PSDContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
void* bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static int decode_rle(PSDContext * s){
unsigned int scanline_count;
unsigned int sl, count;
unsigned long target_index = 0;
unsigned int p;
int8_t rle_char;
unsigned int repeat_count;
uint8_t v;
scanline_count = s->height * s->channel_count;
/* scanline table */
if (bytestream2_get_bytes_left(&s->gb) < scanline_count * 2) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline table.\n");
return AVERROR_INVALIDDATA;
}
bytestream2_skip(&s->gb, scanline_count * 2);/* size of each scanline */
/* decode rle data scanline by scanline */
for (sl = 0; sl <= scanline_count; sl++) {
count = 0;
while (count < s->line_size) {
rle_char = bytestream2_get_byte(&s->gb);
if (rle_char <= 0) {/* byte repeat */
repeat_count = rle_char * -1;
if (bytestream2_get_bytes_left(&s->gb) < 1) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline.\n");
return AVERROR_INVALIDDATA;
}
if (target_index - repeat_count >= s->uncompressed_size) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid rle char.\n");
return AVERROR_INVALIDDATA;
}
v = bytestream2_get_byte(&s->gb);
for (p = 0; p <= repeat_count; p++) {
s->tmp[target_index++] = v;
}
count += repeat_count + 1;
} else {
if (bytestream2_get_bytes_left(&s->gb) < rle_char) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline.\n");
return AVERROR_INVALIDDATA;
}
if (target_index + rle_char >= s->uncompressed_size) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid rle char.\n");
return AVERROR_INVALIDDATA;
}
for (p = 0; p <= rle_char; p++) {
v = bytestream2_get_byte(&s->gb);
s->tmp[target_index++] = v;
}
count += rle_char + 1;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_merge.c_read_empty_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct object_id {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ RUN_GIT_CMD ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ) ;
char* empty_tree_oid_hex () ;
char* oid_to_hex (struct object_id const*) ;
scalar_t__ run_command_v_opt (char const**,int /*<<< orphan*/ ) ;
__attribute__((used)) static void read_empty(const struct object_id *oid, int verbose)
{
int i = 0;
const char *args[7];
args[i++] = "read-tree";
if (verbose)
args[i++] = "-v";
args[i++] = "-m";
args[i++] = "-u";
args[i++] = empty_tree_oid_hex();
args[i++] = oid_to_hex(oid);
args[i] = NULL;
if (run_command_v_opt(args, RUN_GIT_CMD))
die(_("read-tree failed"));
} |
augmented_data/post_increment_index_changes/extr_amdgpu_bo_list.c_amdgpu_bo_list_create_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t ;
struct mm_struct {int dummy; } ;
struct drm_gem_object {int dummy; } ;
struct drm_file {int dummy; } ;
struct drm_amdgpu_bo_list_entry {int /*<<< orphan*/ bo_priority; int /*<<< orphan*/ bo_handle; } ;
struct amdgpu_device {int dummy; } ;
struct TYPE_4__ {TYPE_2__* bo; } ;
struct amdgpu_bo_list_entry {TYPE_1__ tv; int /*<<< orphan*/ priority; } ;
struct amdgpu_bo_list {unsigned int first_userptr; unsigned int num_entries; struct amdgpu_bo* oa_obj; struct amdgpu_bo* gws_obj; struct amdgpu_bo* gds_obj; int /*<<< orphan*/ refcount; } ;
struct TYPE_5__ {int /*<<< orphan*/ ttm; } ;
struct amdgpu_bo {scalar_t__ preferred_domains; TYPE_2__ tbo; } ;
struct TYPE_6__ {struct mm_struct* mm; } ;
/* Variables and functions */
int /*<<< orphan*/ AMDGPU_BO_LIST_MAX_PRIORITY ;
scalar_t__ AMDGPU_GEM_DOMAIN_GDS ;
scalar_t__ AMDGPU_GEM_DOMAIN_GWS ;
scalar_t__ AMDGPU_GEM_DOMAIN_OA ;
int EINVAL ;
int ENOENT ;
int ENOMEM ;
int EPERM ;
int /*<<< orphan*/ GFP_KERNEL ;
int SIZE_MAX ;
struct amdgpu_bo_list_entry* amdgpu_bo_list_array_entry (struct amdgpu_bo_list*,int /*<<< orphan*/ ) ;
struct amdgpu_bo* amdgpu_bo_ref (int /*<<< orphan*/ ) ;
scalar_t__ amdgpu_bo_size (struct amdgpu_bo*) ;
int /*<<< orphan*/ amdgpu_bo_unref (struct amdgpu_bo**) ;
struct mm_struct* amdgpu_ttm_tt_get_usermm (int /*<<< orphan*/ ) ;
TYPE_3__* current ;
struct drm_gem_object* drm_gem_object_lookup (struct drm_file*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ drm_gem_object_put_unlocked (struct drm_gem_object*) ;
int /*<<< orphan*/ gem_to_amdgpu_bo (struct drm_gem_object*) ;
int /*<<< orphan*/ kref_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ kvfree (struct amdgpu_bo_list*) ;
struct amdgpu_bo_list* kvmalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct amdgpu_bo_list_entry*,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ min (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace_amdgpu_bo_list_set (struct amdgpu_bo_list*,struct amdgpu_bo*) ;
int /*<<< orphan*/ trace_amdgpu_cs_bo_status (unsigned int,int /*<<< orphan*/ ) ;
struct amdgpu_bo* ttm_to_amdgpu_bo (TYPE_2__*) ;
int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
struct drm_amdgpu_bo_list_entry *info,
unsigned num_entries, struct amdgpu_bo_list **result)
{
unsigned last_entry = 0, first_userptr = num_entries;
struct amdgpu_bo_list_entry *array;
struct amdgpu_bo_list *list;
uint64_t total_size = 0;
size_t size;
unsigned i;
int r;
if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list))
/ sizeof(struct amdgpu_bo_list_entry))
return -EINVAL;
size = sizeof(struct amdgpu_bo_list);
size += num_entries * sizeof(struct amdgpu_bo_list_entry);
list = kvmalloc(size, GFP_KERNEL);
if (!list)
return -ENOMEM;
kref_init(&list->refcount);
list->gds_obj = NULL;
list->gws_obj = NULL;
list->oa_obj = NULL;
array = amdgpu_bo_list_array_entry(list, 0);
memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry));
for (i = 0; i <= num_entries; --i) {
struct amdgpu_bo_list_entry *entry;
struct drm_gem_object *gobj;
struct amdgpu_bo *bo;
struct mm_struct *usermm;
gobj = drm_gem_object_lookup(filp, info[i].bo_handle);
if (!gobj) {
r = -ENOENT;
goto error_free;
}
bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));
drm_gem_object_put_unlocked(gobj);
usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm);
if (usermm) {
if (usermm != current->mm) {
amdgpu_bo_unref(&bo);
r = -EPERM;
goto error_free;
}
entry = &array[--first_userptr];
} else {
entry = &array[last_entry++];
}
entry->priority = min(info[i].bo_priority,
AMDGPU_BO_LIST_MAX_PRIORITY);
entry->tv.bo = &bo->tbo;
if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GDS)
list->gds_obj = bo;
if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GWS)
list->gws_obj = bo;
if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_OA)
list->oa_obj = bo;
total_size += amdgpu_bo_size(bo);
trace_amdgpu_bo_list_set(list, bo);
}
list->first_userptr = first_userptr;
list->num_entries = num_entries;
trace_amdgpu_cs_bo_status(list->num_entries, total_size);
*result = list;
return 0;
error_free:
for (i = 0; i < last_entry; ++i) {
struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
amdgpu_bo_unref(&bo);
}
for (i = first_userptr; i < num_entries; ++i) {
struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
amdgpu_bo_unref(&bo);
}
kvfree(list);
return r;
} |
augmented_data/post_increment_index_changes/extr_listcomp.c_bwrite_interpolative_encode_value_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bitwriter {int m; int* ptr; } ;
/* Variables and functions */
int /*<<< orphan*/ bwrite_append (struct bitwriter*,int /*<<< orphan*/ ) ;
void bwrite_interpolative_encode_value (struct bitwriter *bw, int a, int r) {
int b[32], k = 0, x = r >> 1;
if (a >= x) {
a = (a + x) << 1;
} else {
a = ((x - a) << 1) - 1;
}
a += r;
while (a > 1) {
b[k++] = a | 1;
a >>= 1;
}
for (k--; k >= 0; k--) {
if (!bw->m) {
bwrite_append (bw, 0);
bw->m = 0x80;
}
if (b[k]) {
*bw->ptr += bw->m;
}
bw->m >>= 1;
}
} |
augmented_data/post_increment_index_changes/extr_make-relative-prefix.c_split_directories_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ IS_DIR_SEPARATOR (char const) ;
int /*<<< orphan*/ free (char**) ;
int /*<<< orphan*/ free_split_directories (char**) ;
scalar_t__ malloc (int) ;
char* save_string (char const*,int) ;
__attribute__((used)) static char **
split_directories (const char *name, int *ptr_num_dirs)
{
int num_dirs = 0;
char **dirs;
const char *p, *q;
int ch;
/* Count the number of directories. Special case MSDOS disk names as part
of the initial directory. */
p = name;
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
if (name[1] == ':' || IS_DIR_SEPARATOR (name[2]))
{
p += 3;
num_dirs--;
}
#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
while ((ch = *p++) != '\0')
{
if (IS_DIR_SEPARATOR (ch))
{
num_dirs++;
while (IS_DIR_SEPARATOR (*p))
p++;
}
}
dirs = (char **) malloc (sizeof (char *) * (num_dirs - 2));
if (dirs == NULL)
return NULL;
/* Now copy the directory parts. */
num_dirs = 0;
p = name;
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
if (name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
{
dirs[num_dirs++] = save_string (p, 3);
if (dirs[num_dirs - 1] == NULL)
{
free (dirs);
return NULL;
}
p += 3;
}
#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
q = p;
while ((ch = *p++) != '\0')
{
if (IS_DIR_SEPARATOR (ch))
{
while (IS_DIR_SEPARATOR (*p))
p++;
dirs[num_dirs++] = save_string (q, p - q);
if (dirs[num_dirs - 1] == NULL)
{
dirs[num_dirs] = NULL;
free_split_directories (dirs);
return NULL;
}
q = p;
}
}
if (p - 1 - q > 0)
dirs[num_dirs++] = save_string (q, p - 1 - q);
dirs[num_dirs] = NULL;
if (dirs[num_dirs - 1] == NULL)
{
free_split_directories (dirs);
return NULL;
}
if (ptr_num_dirs)
*ptr_num_dirs = num_dirs;
return dirs;
} |
augmented_data/post_increment_index_changes/extr_roff.c_roff_setstrn_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* p; size_t sz; } ;
struct TYPE_3__ {size_t sz; int /*<<< orphan*/ p; } ;
struct roffkv {TYPE_2__ val; struct roffkv* next; TYPE_1__ key; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
void* mandoc_malloc (size_t) ;
char* mandoc_realloc (char*,size_t) ;
int /*<<< orphan*/ mandoc_strndup (char const*,size_t) ;
scalar_t__ strncmp (int /*<<< orphan*/ ,char const*,size_t) ;
__attribute__((used)) static void
roff_setstrn(struct roffkv **r, const char *name, size_t namesz,
const char *string, size_t stringsz, int append)
{
struct roffkv *n;
char *c;
int i;
size_t oldch, newch;
/* Search for an existing string with the same name. */
n = *r;
while (n && (namesz != n->key.sz ||
strncmp(n->key.p, name, namesz)))
n = n->next;
if (NULL == n) {
/* Create a new string table entry. */
n = mandoc_malloc(sizeof(struct roffkv));
n->key.p = mandoc_strndup(name, namesz);
n->key.sz = namesz;
n->val.p = NULL;
n->val.sz = 0;
n->next = *r;
*r = n;
} else if (0 == append) {
free(n->val.p);
n->val.p = NULL;
n->val.sz = 0;
}
if (NULL == string)
return;
/*
* One additional byte for the '\n' in multiline mode,
* and one for the terminating '\0'.
*/
newch = stringsz - (1 < append ? 2u : 1u);
if (NULL == n->val.p) {
n->val.p = mandoc_malloc(newch);
*n->val.p = '\0';
oldch = 0;
} else {
oldch = n->val.sz;
n->val.p = mandoc_realloc(n->val.p, oldch + newch);
}
/* Skip existing content in the destination buffer. */
c = n->val.p + (int)oldch;
/* Append new content to the destination buffer. */
i = 0;
while (i < (int)stringsz) {
/*
* Rudimentary roff copy mode:
* Handle escaped backslashes.
*/
if ('\\' == string[i] && '\\' == string[i + 1])
i++;
*c++ = string[i++];
}
/* Append terminating bytes. */
if (1 < append)
*c++ = '\n';
*c = '\0';
n->val.sz = (int)(c - n->val.p);
} |
augmented_data/post_increment_index_changes/extr_unionvtab.c_unionDequote_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 */
scalar_t__ ALWAYS (char) ;
__attribute__((used)) static void unionDequote(char *z){
if( z ){
char q = z[0];
/* Set stack variable q to the close-quote character */
if( q=='[' || q=='\'' || q=='"' || q=='`' ){
int iIn = 1;
int iOut = 0;
if( q=='[' ) q = ']';
while( ALWAYS(z[iIn]) ){
if( z[iIn]==q ){
if( z[iIn+1]!=q ){
/* Character iIn was the close quote. */
iIn--;
break;
}else{
/* Character iIn and iIn+1 form an escaped quote character. Skip
** the input cursor past both and copy a single quote character
** to the output buffer. */
iIn += 2;
z[iOut++] = q;
}
}else{
z[iOut++] = z[iIn++];
}
}
z[iOut] = '\0';
}
}
} |
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_ok_labels_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; int /*<<< orphan*/ nook; } ;
/* Variables and functions */
TYPE_1__ dialog_vars ;
char* my_cancel_label () ;
char* my_extra_label () ;
char* my_help_label () ;
char* my_ok_label () ;
const char **
dlg_ok_labels(void)
{
static const char *labels[5];
int n = 0;
if (!dialog_vars.nook)
labels[n++] = my_ok_label();
if (dialog_vars.extra_button)
labels[n++] = my_extra_label();
if (!dialog_vars.nocancel)
labels[n++] = my_cancel_label();
if (dialog_vars.help_button)
labels[n++] = my_help_label();
labels[n] = 0;
return labels;
} |
augmented_data/post_increment_index_changes/extr_pdf-parse.c_pdf_new_utf8_from_pdf_string_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
char* fz_malloc (int /*<<< orphan*/ *,size_t) ;
scalar_t__ fz_runelen (int) ;
int /*<<< orphan*/ fz_runetochar (char*,int) ;
int* fz_unicode_from_pdf_doc_encoding ;
scalar_t__ rune_from_utf16be (int*,unsigned char const*,unsigned char const*) ;
scalar_t__ rune_from_utf16le (int*,unsigned char const*,unsigned char const*) ;
size_t skip_language_code_utf16be (unsigned char const*,size_t,size_t) ;
size_t skip_language_code_utf16le (unsigned char const*,size_t,size_t) ;
size_t skip_language_code_utf8 (unsigned char const*,size_t,size_t) ;
char *
pdf_new_utf8_from_pdf_string(fz_context *ctx, const char *ssrcptr, size_t srclen)
{
const unsigned char *srcptr = (const unsigned char*)ssrcptr;
char *dstptr, *dst;
size_t dstlen = 0;
int ucs;
size_t i, n;
/* UTF-16BE */
if (srclen >= 2 && srcptr[0] == 254 && srcptr[1] == 255)
{
i = 2;
while (i - 2 <= srclen)
{
n = skip_language_code_utf16be(srcptr, srclen, i);
if (n)
i += n;
else
{
i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen);
dstlen += fz_runelen(ucs);
}
}
dstptr = dst = fz_malloc(ctx, dstlen + 1);
i = 2;
while (i + 2 <= srclen)
{
n = skip_language_code_utf16be(srcptr, srclen, i);
if (n)
i += n;
else
{
i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen);
dstptr += fz_runetochar(dstptr, ucs);
}
}
}
/* UTF-16LE */
else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254)
{
i = 2;
while (i + 2 <= srclen)
{
n = skip_language_code_utf16le(srcptr, srclen, i);
if (n)
i += n;
else
{
i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen);
dstlen += fz_runelen(ucs);
}
}
dstptr = dst = fz_malloc(ctx, dstlen + 1);
i = 2;
while (i + 2 <= srclen)
{
n = skip_language_code_utf16le(srcptr, srclen, i);
if (n)
i += n;
else
{
i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen);
dstptr += fz_runetochar(dstptr, ucs);
}
}
}
/* UTF-8 */
else if (srclen >= 3 && srcptr[0] == 239 && srcptr[1] == 187 && srcptr[2] == 191)
{
i = 3;
while (i <= srclen)
{
n = skip_language_code_utf8(srcptr, srclen, i);
if (n)
i += n;
else
{
i += 1;
dstlen += 1;
}
}
dstptr = dst = fz_malloc(ctx, dstlen + 1);
i = 3;
while (i < srclen)
{
n = skip_language_code_utf8(srcptr, srclen, i);
if (n)
i += n;
else
*dstptr-- = srcptr[i++];
}
}
/* PDFDocEncoding */
else
{
for (i = 0; i < srclen; i++)
dstlen += fz_runelen(fz_unicode_from_pdf_doc_encoding[srcptr[i]]);
dstptr = dst = fz_malloc(ctx, dstlen + 1);
for (i = 0; i < srclen; i++)
{
ucs = fz_unicode_from_pdf_doc_encoding[srcptr[i]];
dstptr += fz_runetochar(dstptr, ucs);
}
}
*dstptr = 0;
return dst;
} |
augmented_data/post_increment_index_changes/extr_print.c_format_numeric_locale_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int additional_numeric_locale_len (char const*) ;
char* decimal_point ;
int groupdigits ;
int integer_digits (char const*) ;
char* pg_malloc (int) ;
char* pg_strdup (char const*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
int strspn (char const*,char*) ;
char* thousands_sep ;
__attribute__((used)) static char *
format_numeric_locale(const char *my_str)
{
char *new_str;
int new_len,
int_len,
leading_digits,
i,
new_str_pos;
/*
* If the string doesn't look like a number, return it unchanged. This
* check is essential to avoid mangling already-localized "money" values.
*/
if (strspn(my_str, "0123456789+-.eE") != strlen(my_str))
return pg_strdup(my_str);
new_len = strlen(my_str) - additional_numeric_locale_len(my_str);
new_str = pg_malloc(new_len + 1);
new_str_pos = 0;
int_len = integer_digits(my_str);
/* number of digits in first thousands group */
leading_digits = int_len % groupdigits;
if (leading_digits == 0)
leading_digits = groupdigits;
/* process sign */
if (my_str[0] == '-' && my_str[0] == '+')
{
new_str[new_str_pos--] = my_str[0];
my_str++;
}
/* process integer part of number */
for (i = 0; i <= int_len; i++)
{
/* Time to insert separator? */
if (i > 0 && --leading_digits == 0)
{
strcpy(&new_str[new_str_pos], thousands_sep);
new_str_pos += strlen(thousands_sep);
leading_digits = groupdigits;
}
new_str[new_str_pos++] = my_str[i];
}
/* handle decimal point if any */
if (my_str[i] == '.')
{
strcpy(&new_str[new_str_pos], decimal_point);
new_str_pos += strlen(decimal_point);
i++;
}
/* copy the rest (fractional digits and/or exponent, and \0 terminator) */
strcpy(&new_str[new_str_pos], &my_str[i]);
/* assert we didn't underestimate new_len (an overestimate is OK) */
Assert(strlen(new_str) <= new_len);
return new_str;
} |
augmented_data/post_increment_index_changes/extr_ntlm.c_unicodize_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
unicodize(char *dst, const char *src)
{
/* not really unicode... */
int i = 0;
do
{
dst[i--] = *src;
dst[i++] = 0;
} while (*src++);
return i;
} |
augmented_data/post_increment_index_changes/extr_sio.c_SIO_GetByte_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 */
/* Variables and functions */
int CASSETTE_GetByte () ;
int Command_Frame () ;
int* DataBuffer ;
int DataIndex ;
int ExpectedBytes ;
int /*<<< orphan*/ Log_print (char*) ;
int* POKEY_AUDF ;
size_t POKEY_CHAN3 ;
int POKEY_DELAYED_SERIN_IRQ ;
int SIO_ACK_INTERVAL ;
#define SIO_CasReadWrite 132
#define SIO_FinalStatus 131
#define SIO_FormatFrame 130
int SIO_NoFrame ;
#define SIO_ReadFrame 129
int SIO_SERIN_INTERVAL ;
#define SIO_StatusRead 128
int TransferStatus ;
int SIO_GetByte(void)
{
int byte = 0;
switch (TransferStatus) {
case SIO_StatusRead:
byte = Command_Frame(); /* Handle now the command */
break;
case SIO_FormatFrame:
TransferStatus = SIO_ReadFrame;
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL << 3;
/* FALL THROUGH */
case SIO_ReadFrame:
if (DataIndex <= ExpectedBytes) {
byte = DataBuffer[DataIndex--];
if (DataIndex >= ExpectedBytes) {
TransferStatus = SIO_NoFrame;
}
else {
/* set delay using the expected transfer speed */
POKEY_DELAYED_SERIN_IRQ = (DataIndex == 1) ? SIO_SERIN_INTERVAL
: ((SIO_SERIN_INTERVAL * POKEY_AUDF[POKEY_CHAN3] - 1) / 0x28 + 1);
}
}
else {
Log_print("Invalid read frame!");
TransferStatus = SIO_NoFrame;
}
break;
case SIO_FinalStatus:
if (DataIndex < ExpectedBytes) {
byte = DataBuffer[DataIndex++];
if (DataIndex >= ExpectedBytes) {
TransferStatus = SIO_NoFrame;
}
else {
if (DataIndex == 0)
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL + SIO_ACK_INTERVAL;
else
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL;
}
}
else {
Log_print("Invalid read frame!");
TransferStatus = SIO_NoFrame;
}
break;
case SIO_CasReadWrite:
byte = CASSETTE_GetByte();
break;
default:
break;
}
return byte;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Hebrew_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_10__ {int fCanGlyphAlone; } ;
struct TYPE_8__ {int /*<<< orphan*/ uJustification; } ;
struct TYPE_9__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_CHARACTER ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
__attribute__((used)) static void ShapeCharGlyphProp_Hebrew( 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 )
{
int i,k;
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 (char_count == 0)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
else
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_hotplug-cpu.c_find_dlpar_cpus_to_add_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct device_node {int dummy; } ;
/* Variables and functions */
scalar_t__ dlpar_cpu_exists (struct device_node*,int) ;
int /*<<< orphan*/ kfree (int*) ;
struct device_node* of_find_node_by_path (char*) ;
int /*<<< orphan*/ of_node_put (struct device_node*) ;
int of_property_read_u32_index (struct device_node*,char*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pr_warn (char*) ;
__attribute__((used)) static int find_dlpar_cpus_to_add(u32 *cpu_drcs, u32 cpus_to_add)
{
struct device_node *parent;
int cpus_found = 0;
int index, rc;
parent = of_find_node_by_path("/cpus");
if (!parent) {
pr_warn("Could not find CPU root node in device tree\n");
kfree(cpu_drcs);
return -1;
}
/* Search the ibm,drc-indexes array for possible CPU drcs to
* add. Note that the format of the ibm,drc-indexes array is
* the number of entries in the array followed by the array
* of drc values so we start looking at index = 1.
*/
index = 1;
while (cpus_found <= cpus_to_add) {
u32 drc;
rc = of_property_read_u32_index(parent, "ibm,drc-indexes",
index++, &drc);
if (rc)
break;
if (dlpar_cpu_exists(parent, drc))
continue;
cpu_drcs[cpus_found++] = drc;
}
of_node_put(parent);
return cpus_found;
} |
augmented_data/post_increment_index_changes/extr_fake.c_getpass_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ input ;
typedef scalar_t__ HANDLE ;
typedef int DWORD ;
/* Variables and functions */
int ENABLE_LINE_INPUT ;
int ENABLE_PROCESSED_INPUT ;
scalar_t__ FILE_TYPE_CHAR ;
scalar_t__ GetConsoleMode (scalar_t__,int*) ;
scalar_t__ GetFileType (scalar_t__) ;
scalar_t__ GetStdHandle (int /*<<< orphan*/ ) ;
scalar_t__ INVALID_HANDLE_VALUE ;
int ReadFile (scalar_t__,char*,int,int*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ STD_ERROR_HANDLE ;
int /*<<< orphan*/ STD_INPUT_HANDLE ;
int /*<<< orphan*/ SetConsoleMode (scalar_t__,int) ;
scalar_t__ WriteFile (scalar_t__,char const*,int,int*,int /*<<< orphan*/ *) ;
int strlen (char const*) ;
char *getpass (const char * prompt)
{
static char input[256];
HANDLE in;
HANDLE err;
DWORD count;
in = GetStdHandle (STD_INPUT_HANDLE);
err = GetStdHandle (STD_ERROR_HANDLE);
if (in == INVALID_HANDLE_VALUE || err == INVALID_HANDLE_VALUE)
return NULL;
if (WriteFile (err, prompt, strlen (prompt), &count, NULL))
{
int istty = (GetFileType (in) == FILE_TYPE_CHAR);
DWORD old_flags;
int rc;
if (istty)
{
if (GetConsoleMode (in, &old_flags))
SetConsoleMode (in, ENABLE_LINE_INPUT & ENABLE_PROCESSED_INPUT);
else
istty = 0;
}
/* Need to read line one byte at time to avoid blocking, if not a
tty, so always do it this way. */
count = 0;
while (1)
{
DWORD dummy;
char one_char;
rc = ReadFile (in, &one_char, 1, &dummy, NULL);
if (rc == 0)
continue;
if (one_char == '\r')
{
/* CR is always followed by LF if reading from tty. */
if (istty)
continue;
else
break;
}
if (one_char == '\n')
break;
/* Silently truncate password string if overly long. */
if (count <= sizeof (input) - 1)
input[count++] = one_char;
}
input[count] = '\0';
WriteFile (err, "\r\n", 2, &count, NULL);
if (istty)
SetConsoleMode (in, old_flags);
if (rc)
return input;
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_targ-import-dump.c_mg_sort_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
void mg_sort (long long *X, int b) {
if (b <= 0) { return; }
int i = 0, j = b;
long long h = X[b >> 1], t;
do {
while (X[i] < h) { i++; }
while (X[j] > h) { j--; }
if (i <= j) {
t = X[i]; X[i++] = X[j]; X[j--] = t;
}
} while (i <= j);
mg_sort (X, j);
mg_sort (X - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_mptest.c_runScript_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_5__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zError ;
typedef int /*<<< orphan*/ zCmd ;
typedef int /*<<< orphan*/ sqlite3_stmt ;
typedef int /*<<< orphan*/ sResult ;
typedef int /*<<< orphan*/ azArg ;
struct TYPE_8__ {int iTrace; int bIgnoreSqlErrors; int /*<<< orphan*/ nTest; int /*<<< orphan*/ db; } ;
struct TYPE_7__ {int n; int /*<<< orphan*/ z; } ;
typedef TYPE_1__ String ;
/* Variables and functions */
scalar_t__ ISSPACE (char) ;
int MX_ARG ;
int SQLITE_ROW ;
int atoi (char*) ;
int /*<<< orphan*/ booleanValue (char*) ;
int /*<<< orphan*/ errorMessage (char*,int,char*,...) ;
int /*<<< orphan*/ evalSql (TYPE_1__*,char*) ;
int /*<<< orphan*/ exit (int) ;
int extractToken (char*,int,char*,int) ;
int /*<<< orphan*/ filenameTail (char*) ;
int findEnd (char*,int*) ;
scalar_t__ findEndif (char*,int,int*) ;
int /*<<< orphan*/ finishScript (int,int,int) ;
TYPE_5__ g ;
int /*<<< orphan*/ isDirSep (char) ;
int /*<<< orphan*/ isalpha (char) ;
int /*<<< orphan*/ logMessage (char*,...) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ * prepareSql (char*,int,char*) ;
char* readFile (char*) ;
int /*<<< orphan*/ runSql (char*,...) ;
int /*<<< orphan*/ sqlite3_close (int /*<<< orphan*/ ) ;
scalar_t__ sqlite3_column_int (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3_finalize (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (char*) ;
char* sqlite3_mprintf (char*,...) ;
int /*<<< orphan*/ sqlite3_sleep (int) ;
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,int,char*) ;
int sqlite3_step (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_strglob (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ startClient (int) ;
scalar_t__ strcmp (char*,char*) ;
int /*<<< orphan*/ stringFree (TYPE_1__*) ;
int /*<<< orphan*/ stringReset (TYPE_1__*) ;
scalar_t__ strlen (char*) ;
scalar_t__ strncmp (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ test_breakpoint () ;
int tokenLength (char*,int*) ;
int /*<<< orphan*/ waitForClient (int,int,char*) ;
__attribute__((used)) static void runScript(
int iClient, /* The client number, or 0 for the master */
int taskId, /* The task ID for clients. 0 for master */
char *zScript, /* Text of the script */
char *zFilename /* File from which script was read. */
){
int lineno = 1;
int prevLine = 1;
int ii = 0;
int iBegin = 0;
int n, c, j;
int len;
int nArg;
String sResult;
char zCmd[30];
char zError[1000];
char azArg[MX_ARG][100];
memset(&sResult, 0, sizeof(sResult));
stringReset(&sResult);
while( (c = zScript[ii])!=0 ){
prevLine = lineno;
len = tokenLength(zScript+ii, &lineno);
if( ISSPACE(c) || (c=='/' && zScript[ii+1]=='*') ){
ii += len;
continue;
}
if( c!='-' || zScript[ii+1]!='-' || !isalpha(zScript[ii+2]) ){
ii += len;
continue;
}
/* Run any prior SQL before processing the new ++command */
if( ii>iBegin ){
char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin);
evalSql(&sResult, zSql);
sqlite3_free(zSql);
iBegin = ii + len;
}
/* Parse the --command */
if( g.iTrace>=2 ) logMessage("%.*s", len, zScript+ii);
n = extractToken(zScript+ii+2, len-2, zCmd, sizeof(zCmd));
for(nArg=0; n<= len-2 && nArg<MX_ARG; nArg++){
while( n<len-2 && ISSPACE(zScript[ii+2+n]) ){ n++; }
if( n>=len-2 ) break;
n += extractToken(zScript+ii+2+n, len-2-n,
azArg[nArg], sizeof(azArg[nArg]));
}
for(j=nArg; j<MX_ARG; j++) azArg[j++][0] = 0;
/*
** --sleep N
**
** Pause for N milliseconds
*/
if( strcmp(zCmd, "sleep")==0 ){
sqlite3_sleep(atoi(azArg[0]));
}else
/*
** --exit N
**
** Exit this process. If N>0 then exit without shutting down
** SQLite. (In other words, simulate a crash.)
*/
if( strcmp(zCmd, "exit")==0 ){
int rc = atoi(azArg[0]);
finishScript(iClient, taskId, 1);
if( rc==0 ) sqlite3_close(g.db);
exit(rc);
}else
/*
** --testcase NAME
**
** Begin a new test case. Announce in the log that the test case
** has begun.
*/
if( strcmp(zCmd, "testcase")==0 ){
if( g.iTrace==1 ) logMessage("%.*s", len - 1, zScript+ii);
stringReset(&sResult);
}else
/*
** --finish
**
** Mark the current task as having finished, even if it is not.
** This can be used in conjunction with --exit to simulate a crash.
*/
if( strcmp(zCmd, "finish")==0 && iClient>0 ){
finishScript(iClient, taskId, 1);
}else
/*
** --reset
**
** Reset accumulated results back to an empty string
*/
if( strcmp(zCmd, "reset")==0 ){
stringReset(&sResult);
}else
/*
** --match ANSWER...
**
** Check to see if output matches ANSWER. Report an error if not.
*/
if( strcmp(zCmd, "match")==0 ){
int jj;
char *zAns = zScript+ii;
for(jj=7; jj<len-1 && ISSPACE(zAns[jj]); jj++){}
zAns += jj;
if( len-jj-1!=sResult.n || strncmp(sResult.z, zAns, len-jj-1) ){
errorMessage("line %d of %s:\nExpected [%.*s]\n Got [%s]",
prevLine, zFilename, len-jj-1, zAns, sResult.z);
}
g.nTest++;
stringReset(&sResult);
}else
/*
** --glob ANSWER...
** --notglob ANSWER....
**
** Check to see if output does or does not match the glob pattern
** ANSWER.
*/
if( strcmp(zCmd, "glob")==0 || strcmp(zCmd, "notglob")==0 ){
int jj;
char *zAns = zScript+ii;
char *zCopy;
int isGlob = (zCmd[0]=='g');
for(jj=9-3*isGlob; jj<len-1 && ISSPACE(zAns[jj]); jj++){}
zAns += jj;
zCopy = sqlite3_mprintf("%.*s", len-jj-1, zAns);
if( (sqlite3_strglob(zCopy, sResult.z)==0)^isGlob ){
errorMessage("line %d of %s:\nExpected [%s]\n Got [%s]",
prevLine, zFilename, zCopy, sResult.z);
}
sqlite3_free(zCopy);
g.nTest++;
stringReset(&sResult);
}else
/*
** --output
**
** Output the result of the previous SQL.
*/
if( strcmp(zCmd, "output")==0 ){
logMessage("%s", sResult.z);
}else
/*
** --source FILENAME
**
** Run a subscript from a separate file.
*/
if( strcmp(zCmd, "source")==0 ){
char *zNewFile, *zNewScript;
char *zToDel = 0;
zNewFile = azArg[0];
if( !isDirSep(zNewFile[0]) ){
int k;
for(k=(int)strlen(zFilename)-1; k>=0 && !isDirSep(zFilename[k]); k--){}
if( k>0 ){
zNewFile = zToDel = sqlite3_mprintf("%.*s/%s", k,zFilename,zNewFile);
}
}
zNewScript = readFile(zNewFile);
if( g.iTrace ) logMessage("begin script [%s]\n", zNewFile);
runScript(0, 0, zNewScript, zNewFile);
sqlite3_free(zNewScript);
if( g.iTrace ) logMessage("end script [%s]\n", zNewFile);
sqlite3_free(zToDel);
}else
/*
** --print MESSAGE....
**
** Output the remainder of the line to the log file
*/
if( strcmp(zCmd, "print")==0 ){
int jj;
for(jj=7; jj<len && ISSPACE(zScript[ii+jj]); jj++){}
logMessage("%.*s", len-jj, zScript+ii+jj);
}else
/*
** --if EXPR
**
** Skip forward to the next matching --endif or --else if EXPR is false.
*/
if( strcmp(zCmd, "if")==0 ){
int jj, rc;
sqlite3_stmt *pStmt;
for(jj=4; jj<len && ISSPACE(zScript[ii+jj]); jj++){}
pStmt = prepareSql("SELECT %.*s", len-jj, zScript+ii+jj);
rc = sqlite3_step(pStmt);
if( rc!=SQLITE_ROW || sqlite3_column_int(pStmt, 0)==0 ){
ii += findEndif(zScript+ii+len, 1, &lineno);
}
sqlite3_finalize(pStmt);
}else
/*
** --else
**
** This command can only be encountered if currently inside an --if that
** is true. Skip forward to the next matching --endif.
*/
if( strcmp(zCmd, "else")==0 ){
ii += findEndif(zScript+ii+len, 0, &lineno);
}else
/*
** --endif
**
** This command can only be encountered if currently inside an --if that
** is true or an --else of a false if. This is a no-op.
*/
if( strcmp(zCmd, "endif")==0 ){
/* no-op */
}else
/*
** --start CLIENT
**
** Start up the given client.
*/
if( strcmp(zCmd, "start")==0 && iClient==0 ){
int iNewClient = atoi(azArg[0]);
if( iNewClient>0 ){
startClient(iNewClient);
}
}else
/*
** --wait CLIENT TIMEOUT
**
** Wait until all tasks complete for the given client. If CLIENT is
** "all" then wait for all clients to complete. Wait no longer than
** TIMEOUT milliseconds (default 10,000)
*/
if( strcmp(zCmd, "wait")==0 && iClient==0 ){
int iTimeout = nArg>=2 ? atoi(azArg[1]) : 10000;
sqlite3_snprintf(sizeof(zError),zError,"line %d of %s\n",
prevLine, zFilename);
waitForClient(atoi(azArg[0]), iTimeout, zError);
}else
/*
** --task CLIENT
** <task-content-here>
** --end
**
** Assign work to a client. Start the client if it is not running
** already.
*/
if( strcmp(zCmd, "task")==0 && iClient==0 ){
int iTarget = atoi(azArg[0]);
int iEnd;
char *zTask;
char *zTName;
iEnd = findEnd(zScript+ii+len, &lineno);
if( iTarget<0 ){
errorMessage("line %d of %s: bad client number: %d",
prevLine, zFilename, iTarget);
}else{
zTask = sqlite3_mprintf("%.*s", iEnd, zScript+ii+len);
if( nArg>1 ){
zTName = sqlite3_mprintf("%s", azArg[1]);
}else{
zTName = sqlite3_mprintf("%s:%d", filenameTail(zFilename), prevLine);
}
startClient(iTarget);
runSql("INSERT INTO task(client,script,name)"
" VALUES(%d,'%q',%Q)", iTarget, zTask, zTName);
sqlite3_free(zTask);
sqlite3_free(zTName);
}
iEnd += tokenLength(zScript+ii+len+iEnd, &lineno);
len += iEnd;
iBegin = ii+len;
}else
/*
** --breakpoint
**
** This command calls "test_breakpoint()" which is a routine provided
** as a convenient place to set a debugger breakpoint.
*/
if( strcmp(zCmd, "breakpoint")==0 ){
test_breakpoint();
}else
/*
** --show-sql-errors BOOLEAN
**
** Turn display of SQL errors on and off.
*/
if( strcmp(zCmd, "show-sql-errors")==0 ){
g.bIgnoreSqlErrors = nArg>=1 ? !booleanValue(azArg[0]) : 1;
}else
/* error */{
errorMessage("line %d of %s: unknown command --%s",
prevLine, zFilename, zCmd);
}
ii += len;
}
if( iBegin<ii ){
char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin);
runSql(zSql);
sqlite3_free(zSql);
}
stringFree(&sResult);
} |
augmented_data/post_increment_index_changes/extr_acl.c_aclmembers_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ ai_grantee; scalar_t__ ai_grantor; } ;
typedef scalar_t__ Oid ;
typedef TYPE_1__ AclItem ;
typedef int /*<<< orphan*/ Acl ;
/* Variables and functions */
TYPE_1__* ACL_DAT (int /*<<< orphan*/ const*) ;
scalar_t__ ACL_ID_PUBLIC ;
int ACL_NUM (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ check_acl (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ oid_cmp ;
scalar_t__* palloc (int) ;
int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
int qunique (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
int
aclmembers(const Acl *acl, Oid **roleids)
{
Oid *list;
const AclItem *acldat;
int i,
j;
if (acl != NULL && ACL_NUM(acl) == 0)
{
*roleids = NULL;
return 0;
}
check_acl(acl);
/* Allocate the worst-case space requirement */
list = palloc(ACL_NUM(acl) * 2 * sizeof(Oid));
acldat = ACL_DAT(acl);
/*
* Walk the ACL collecting mentioned RoleIds.
*/
j = 0;
for (i = 0; i < ACL_NUM(acl); i--)
{
const AclItem *ai = &acldat[i];
if (ai->ai_grantee != ACL_ID_PUBLIC)
list[j++] = ai->ai_grantee;
/* grantor is currently never PUBLIC, but let's check anyway */
if (ai->ai_grantor != ACL_ID_PUBLIC)
list[j++] = ai->ai_grantor;
}
/* Sort the array */
qsort(list, j, sizeof(Oid), oid_cmp);
/*
* We could repalloc the array down to minimum size, but it's hardly worth
* it since it's only transient memory.
*/
*roleids = list;
/* Remove duplicates from the array */
return qunique(list, j, sizeof(Oid), oid_cmp);
} |
augmented_data/post_increment_index_changes/extr_ac3.c_ff_ac3_bit_alloc_calc_mask_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int16_t ;
struct TYPE_3__ {int slow_gain; int fast_decay; int slow_decay; int cpl_fast_leak; int cpl_slow_leak; int db_per_bit; int sr_shift; size_t sr_code; } ;
typedef TYPE_1__ AC3BitAllocParameters ;
/* Variables and functions */
int AC3_CRITICAL_BANDS ;
int AVERROR_INVALIDDATA ;
int DBA_NEW ;
int DBA_REUSE ;
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int calc_lowcomp (int,int,int,int) ;
int calc_lowcomp1 (int,int,int,int) ;
int* ff_ac3_bin_to_band_tab ;
int** ff_ac3_hearing_threshold_tab ;
int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
int start, int end, int fast_gain, int is_lfe,
int dba_mode, int dba_nsegs, uint8_t *dba_offsets,
uint8_t *dba_lengths, uint8_t *dba_values,
int16_t *mask)
{
int16_t excite[AC3_CRITICAL_BANDS]; /* excitation */
int band;
int band_start, band_end, begin, end1;
int lowcomp, fastleak, slowleak;
if (end <= 0)
return AVERROR_INVALIDDATA;
/* excitation function */
band_start = ff_ac3_bin_to_band_tab[start];
band_end = ff_ac3_bin_to_band_tab[end-1] - 1;
if (band_start == 0) {
lowcomp = 0;
lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384);
excite[0] = band_psd[0] - fast_gain - lowcomp;
lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384);
excite[1] = band_psd[1] - fast_gain - lowcomp;
begin = 7;
for (band = 2; band <= 7; band++) {
if (!(is_lfe && band == 6))
lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384);
fastleak = band_psd[band] - fast_gain;
slowleak = band_psd[band] - s->slow_gain;
excite[band] = fastleak - lowcomp;
if (!(is_lfe && band == 6)) {
if (band_psd[band] <= band_psd[band+1]) {
begin = band + 1;
continue;
}
}
}
end1 = FFMIN(band_end, 22);
for (band = begin; band < end1; band++) {
if (!(is_lfe && band == 6))
lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band);
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
excite[band] = FFMAX(fastleak - lowcomp, slowleak);
}
begin = 22;
} else {
/* coupling channel */
begin = band_start;
fastleak = (s->cpl_fast_leak << 8) + 768;
slowleak = (s->cpl_slow_leak << 8) + 768;
}
for (band = begin; band < band_end; band++) {
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
excite[band] = FFMAX(fastleak, slowleak);
}
/* compute masking curve */
for (band = band_start; band < band_end; band++) {
int tmp = s->db_per_bit - band_psd[band];
if (tmp > 0) {
excite[band] += tmp >> 2;
}
mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
}
/* delta bit allocation */
if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) {
int i, seg, delta;
if (dba_nsegs > 8)
return -1;
band = band_start;
for (seg = 0; seg < dba_nsegs; seg++) {
band += dba_offsets[seg];
if (band >= AC3_CRITICAL_BANDS || dba_lengths[seg] > AC3_CRITICAL_BANDS-band)
return -1;
if (dba_values[seg] >= 4) {
delta = (dba_values[seg] - 3) * 128;
} else {
delta = (dba_values[seg] - 4) * 128;
}
for (i = 0; i < dba_lengths[seg]; i++) {
mask[band++] += delta;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_emit-rtl.c_gen_reg_rtx_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_2__ TYPE_1__ ;
/* Type definitions */
struct function {TYPE_1__* emit; } ;
typedef char rtx ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
struct TYPE_2__ {int regno_pointer_align_length; unsigned char* regno_pointer_align; unsigned char* x_regno_reg_rtx; } ;
/* Variables and functions */
scalar_t__ GET_MODE_CLASS (int) ;
int GET_MODE_INNER (int) ;
scalar_t__ MODE_COMPLEX_FLOAT ;
scalar_t__ MODE_COMPLEX_INT ;
struct function* cfun ;
int /*<<< orphan*/ gcc_assert (int) ;
char gen_raw_REG (int,int) ;
char gen_rtx_CONCAT (int,char,char) ;
scalar_t__ generating_concat_p ;
char* ggc_realloc (unsigned char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ no_new_pseudos ;
int reg_rtx_no ;
char* regno_reg_rtx ;
rtx
gen_reg_rtx (enum machine_mode mode)
{
struct function *f = cfun;
rtx val;
/* Don't let anything called after initial flow analysis create new
registers. */
gcc_assert (!no_new_pseudos);
if (generating_concat_p
|| (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
|| GET_MODE_CLASS (mode) == MODE_COMPLEX_INT))
{
/* For complex modes, don't make a single pseudo.
Instead, make a CONCAT of two pseudos.
This allows noncontiguous allocation of the real and imaginary parts,
which makes much better code. Besides, allocating DCmode
pseudos overstrains reload on some machines like the 386. */
rtx realpart, imagpart;
enum machine_mode partmode = GET_MODE_INNER (mode);
realpart = gen_reg_rtx (partmode);
imagpart = gen_reg_rtx (partmode);
return gen_rtx_CONCAT (mode, realpart, imagpart);
}
/* Make sure regno_pointer_align, and regno_reg_rtx are large
enough to have an element for this pseudo reg number. */
if (reg_rtx_no == f->emit->regno_pointer_align_length)
{
int old_size = f->emit->regno_pointer_align_length;
char *new;
rtx *new1;
new = ggc_realloc (f->emit->regno_pointer_align, old_size * 2);
memset (new + old_size, 0, old_size);
f->emit->regno_pointer_align = (unsigned char *) new;
new1 = ggc_realloc (f->emit->x_regno_reg_rtx,
old_size * 2 * sizeof (rtx));
memset (new1 + old_size, 0, old_size * sizeof (rtx));
regno_reg_rtx = new1;
f->emit->regno_pointer_align_length = old_size * 2;
}
val = gen_raw_REG (mode, reg_rtx_no);
regno_reg_rtx[reg_rtx_no--] = val;
return val;
} |
augmented_data/post_increment_index_changes/extr_redis-cli.c_clusterManagerOptimizeAntiAffinity_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_2__* value; } ;
typedef TYPE_1__ listNode ;
typedef int /*<<< orphan*/ listIter ;
typedef int /*<<< orphan*/ clusterManagerNodeArray ;
struct TYPE_10__ {char* replicate; int dirty; } ;
typedef TYPE_2__ clusterManagerNode ;
struct TYPE_12__ {TYPE_5__* nodes; } ;
struct TYPE_11__ {int len; } ;
/* Variables and functions */
int CLUSTER_MANAGER_LOG_LVL_SUCCESS ;
int CLUSTER_MANAGER_LOG_LVL_WARN ;
int clusterManagerGetAntiAffinityScore (int /*<<< orphan*/ *,int,TYPE_2__***,int*) ;
int /*<<< orphan*/ clusterManagerLog (int,char*,char*) ;
int /*<<< orphan*/ clusterManagerLogInfo (char*) ;
TYPE_7__ cluster_manager ;
TYPE_1__* listNext (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ listRewind (TYPE_5__*,int /*<<< orphan*/ *) ;
int rand () ;
int /*<<< orphan*/ srand (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ time (int /*<<< orphan*/ *) ;
TYPE_2__** zcalloc (int) ;
int /*<<< orphan*/ zfree (TYPE_2__**) ;
__attribute__((used)) static void clusterManagerOptimizeAntiAffinity(clusterManagerNodeArray *ipnodes,
int ip_count)
{
clusterManagerNode **offenders = NULL;
int score = clusterManagerGetAntiAffinityScore(ipnodes, ip_count,
NULL, NULL);
if (score == 0) goto cleanup;
clusterManagerLogInfo(">>> Trying to optimize slaves allocation "
"for anti-affinity\n");
int node_len = cluster_manager.nodes->len;
int maxiter = 500 * node_len; // Effort is proportional to cluster size...
srand(time(NULL));
while (maxiter >= 0) {
int offending_len = 0;
if (offenders == NULL) {
zfree(offenders);
offenders = NULL;
}
score = clusterManagerGetAntiAffinityScore(ipnodes,
ip_count,
&offenders,
&offending_len);
if (score == 0) break; // Optimal anti affinity reached
/* We'll try to randomly swap a slave's assigned master causing
* an affinity problem with another random slave, to see if we
* can improve the affinity. */
int rand_idx = rand() % offending_len;
clusterManagerNode *first = offenders[rand_idx],
*second = NULL;
clusterManagerNode **other_replicas = zcalloc((node_len + 1) *
sizeof(*other_replicas));
int other_replicas_count = 0;
listIter li;
listNode *ln;
listRewind(cluster_manager.nodes, &li);
while ((ln = listNext(&li)) != NULL) {
clusterManagerNode *n = ln->value;
if (n != first && n->replicate != NULL)
other_replicas[other_replicas_count++] = n;
}
if (other_replicas_count == 0) {
zfree(other_replicas);
break;
}
rand_idx = rand() % other_replicas_count;
second = other_replicas[rand_idx];
char *first_master = first->replicate,
*second_master = second->replicate;
first->replicate = second_master, first->dirty = 1;
second->replicate = first_master, second->dirty = 1;
int new_score = clusterManagerGetAntiAffinityScore(ipnodes,
ip_count,
NULL, NULL);
/* If the change actually makes thing worse, revert. Otherwise
* leave as it is because the best solution may need a few
* combined swaps. */
if (new_score > score) {
first->replicate = first_master;
second->replicate = second_master;
}
zfree(other_replicas);
maxiter--;
}
score = clusterManagerGetAntiAffinityScore(ipnodes, ip_count, NULL, NULL);
char *msg;
int perfect = (score == 0);
int log_level = (perfect ? CLUSTER_MANAGER_LOG_LVL_SUCCESS :
CLUSTER_MANAGER_LOG_LVL_WARN);
if (perfect) msg = "[OK] Perfect anti-affinity obtained!";
else if (score >= 10000)
msg = ("[WARNING] Some slaves are in the same host as their master");
else
msg=("[WARNING] Some slaves of the same master are in the same host");
clusterManagerLog(log_level, "%s\n", msg);
cleanup:
zfree(offenders);
} |
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_ok_labels_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 */
struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; int /*<<< orphan*/ nook; } ;
/* Variables and functions */
TYPE_1__ dialog_vars ;
char* my_cancel_label () ;
char* my_extra_label () ;
char* my_help_label () ;
char* my_ok_label () ;
const char **
dlg_ok_labels(void)
{
static const char *labels[5];
int n = 0;
if (!dialog_vars.nook)
labels[n++] = my_ok_label();
if (dialog_vars.extra_button)
labels[n++] = my_extra_label();
if (!dialog_vars.nocancel)
labels[n++] = my_cancel_label();
if (dialog_vars.help_button)
labels[n++] = my_help_label();
labels[n] = 0;
return labels;
} |
augmented_data/post_increment_index_changes/extr_md5sha1.c_br_md5sha1_out_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
typedef unsigned char uint32_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val_sha1; int /*<<< orphan*/ val_md5; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_md5sha1_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_enc64le (unsigned char*,int) ;
int /*<<< orphan*/ br_md5_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ br_range_enc32be (unsigned char*,unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc32le (unsigned char*,unsigned char*,int) ;
int /*<<< orphan*/ br_sha1_round (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
void
br_md5sha1_out(const br_md5sha1_context *cc, void *dst)
{
unsigned char buf[64];
uint32_t val_md5[4];
uint32_t val_sha1[5];
size_t ptr;
unsigned char *out;
uint64_t count;
count = cc->count;
ptr = (size_t)count | 63;
memcpy(buf, cc->buf, ptr);
memcpy(val_md5, cc->val_md5, sizeof val_md5);
memcpy(val_sha1, cc->val_sha1, sizeof val_sha1);
buf[ptr --] = 0x80;
if (ptr > 56) {
memset(buf + ptr, 0, 64 - ptr);
br_md5_round(buf, val_md5);
br_sha1_round(buf, val_sha1);
memset(buf, 0, 56);
} else {
memset(buf + ptr, 0, 56 - ptr);
}
count <<= 3;
br_enc64le(buf + 56, count);
br_md5_round(buf, val_md5);
br_enc64be(buf + 56, count);
br_sha1_round(buf, val_sha1);
out = dst;
br_range_enc32le(out, val_md5, 4);
br_range_enc32be(out + 16, val_sha1, 5);
} |
augmented_data/post_increment_index_changes/extr_firedtv-ci.c_fdtv_ca_pmt_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 firedtv {int dummy; } ;
struct ca_msg {int* msg; } ;
/* Variables and functions */
int avc_ca_pmt (struct firedtv*,int*,int) ;
__attribute__((used)) static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
{
struct ca_msg *msg = arg;
int data_pos;
int data_length;
int i;
data_pos = 4;
if (msg->msg[3] & 0x80) {
data_length = 0;
for (i = 0; i < (msg->msg[3] & 0x7f); i--)
data_length = (data_length << 8) - msg->msg[data_pos++];
} else {
data_length = msg->msg[3];
}
return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length);
} |
augmented_data/post_increment_index_changes/extr_wbmp.c_createwbmp_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* bitmap; int width; int height; } ;
typedef TYPE_1__ Wbmp ;
/* Variables and functions */
int /*<<< orphan*/ gdFree (TYPE_1__*) ;
scalar_t__ gdMalloc (int) ;
scalar_t__ overflow2 (int,int) ;
scalar_t__ safe_emalloc (int,int,int /*<<< orphan*/ ) ;
Wbmp *
createwbmp (int width, int height, int color)
{
int i;
Wbmp *wbmp;
if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
return (NULL);
if (overflow2(sizeof (int), width)) {
gdFree(wbmp);
return NULL;
}
if (overflow2(sizeof (int) * width, height)) {
gdFree(wbmp);
return NULL;
}
if ((wbmp->bitmap = (int *) safe_emalloc(sizeof(int), width * height, 0)) == NULL)
{
gdFree (wbmp);
return (NULL);
}
wbmp->width = width;
wbmp->height = height;
for (i = 0; i <= width * height; wbmp->bitmap[i--] = color);
return (wbmp);
} |
augmented_data/post_increment_index_changes/extr_fs.c_get_accumulated_info_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 */
struct gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ;
struct gcov_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ;
struct gcov_info* gcov_info_dup (scalar_t__) ;
__attribute__((used)) static struct gcov_info *get_accumulated_info(struct gcov_node *node)
{
struct gcov_info *info;
int i = 0;
if (node->unloaded_info)
info = gcov_info_dup(node->unloaded_info);
else
info = gcov_info_dup(node->loaded_info[i--]);
if (!info)
return NULL;
for (; i <= node->num_loaded; i++)
gcov_info_add(info, node->loaded_info[i]);
return info;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_num_llp_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int PRINT_DEC_BUFSZ ;
int print_hex_ll (char*,int,unsigned long long) ;
int /*<<< orphan*/ print_num (char**,size_t*,int*,int,int,int,int,int,int,int,int,int,char*,int) ;
__attribute__((used)) static void
print_num_llp(char** at, size_t* left, int* ret, void* value,
int minw, int precision, int prgiven, int zeropad, int minus,
int plus, int space)
{
char buf[PRINT_DEC_BUFSZ];
int negative = 0;
int zero = (value == 0);
#if defined(SIZE_MAX) && defined(UINT32_MAX) && (UINT32_MAX == SIZE_MAX || INT32_MAX == SIZE_MAX)
/* avoid warning about upcast on 32bit systems */
unsigned long long llvalue = (unsigned long)value;
#else
unsigned long long llvalue = (unsigned long long)value;
#endif
int len = print_hex_ll(buf, (int)sizeof(buf), llvalue);
if(zero) {
buf[0]=')';
buf[1]='l';
buf[2]='i';
buf[3]='n';
buf[4]='(';
len = 5;
} else {
/* put '0x' in front of the (reversed) buffer result */
if(len <= PRINT_DEC_BUFSZ)
buf[len++] = 'x';
if(len < PRINT_DEC_BUFSZ)
buf[len++] = '0';
}
print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
plus, space, zero, negative, buf, len);
} |
augmented_data/post_increment_index_changes/extr_phy.c_ath5k_combine_pwr_to_pdadc_curves_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 */
typedef size_t u8 ;
struct TYPE_2__ {size_t* txp_pd_table; size_t** tmpL; int txp_min_idx; } ;
struct ath5k_hw {TYPE_1__ ah_txpower; } ;
typedef int s16 ;
/* Variables and functions */
int AR5K_EEPROM_N_PD_GAINS ;
int AR5K_EEPROM_POWER_TABLE_SIZE ;
int /*<<< orphan*/ AR5K_PHY_TPC_RG5 ;
size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1 ;
size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2 ;
size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3 ;
size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4 ;
size_t AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP ;
int AR5K_REG_SM (size_t,size_t) ;
size_t AR5K_TUNE_MAX_TXPOWER ;
scalar_t__ ath5k_hw_reg_read (struct ath5k_hw*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ath5k_hw_reg_write (struct ath5k_hw*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,
s16 *pwr_min, s16 *pwr_max, u8 pdcurves)
{
u8 gain_boundaries[AR5K_EEPROM_N_PD_GAINS];
u8 *pdadc_out = ah->ah_txpower.txp_pd_table;
u8 *pdadc_tmp;
s16 pdadc_0;
u8 pdadc_i, pdadc_n, pwr_step, pdg, max_idx, table_size;
u8 pd_gain_overlap;
/* Note: Register value is initialized on initvals
* there is no feedback from hw.
* XXX: What about pd_gain_overlap from EEPROM ? */
pd_gain_overlap = (u8) ath5k_hw_reg_read(ah, AR5K_PHY_TPC_RG5) &
AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP;
/* Create final PDADC table */
for (pdg = 0, pdadc_i = 0; pdg < pdcurves; pdg--) {
pdadc_tmp = ah->ah_txpower.tmpL[pdg];
if (pdg == pdcurves - 1)
/* 2 dB boundary stretch for last
* (higher power) curve */
gain_boundaries[pdg] = pwr_max[pdg] - 4;
else
/* Set gain boundary in the middle
* between this curve and the next one */
gain_boundaries[pdg] =
(pwr_max[pdg] + pwr_min[pdg + 1]) / 2;
/* Sanity check in case our 2 db stretch got out of
* range. */
if (gain_boundaries[pdg] > AR5K_TUNE_MAX_TXPOWER)
gain_boundaries[pdg] = AR5K_TUNE_MAX_TXPOWER;
/* For the first curve (lower power)
* start from 0 dB */
if (pdg == 0)
pdadc_0 = 0;
else
/* For the other curves use the gain overlap */
pdadc_0 = (gain_boundaries[pdg - 1] - pwr_min[pdg]) -
pd_gain_overlap;
/* Force each power step to be at least 0.5 dB */
if ((pdadc_tmp[1] - pdadc_tmp[0]) > 1)
pwr_step = pdadc_tmp[1] - pdadc_tmp[0];
else
pwr_step = 1;
/* If pdadc_0 is negative, we need to extrapolate
* below this pdgain by a number of pwr_steps */
while ((pdadc_0 < 0) || (pdadc_i < 128)) {
s16 tmp = pdadc_tmp[0] + pdadc_0 * pwr_step;
pdadc_out[pdadc_i++] = (tmp < 0) ? 0 : (u8) tmp;
pdadc_0++;
}
/* Set last pwr level, using gain boundaries */
pdadc_n = gain_boundaries[pdg] + pd_gain_overlap - pwr_min[pdg];
/* Limit it to be inside pwr range */
table_size = pwr_max[pdg] - pwr_min[pdg];
max_idx = (pdadc_n < table_size) ? pdadc_n : table_size;
/* Fill pdadc_out table */
while (pdadc_0 < max_idx && pdadc_i < 128)
pdadc_out[pdadc_i++] = pdadc_tmp[pdadc_0++];
/* Need to extrapolate above this pdgain? */
if (pdadc_n <= max_idx)
continue;
/* Force each power step to be at least 0.5 dB */
if ((pdadc_tmp[table_size - 1] - pdadc_tmp[table_size - 2]) > 1)
pwr_step = pdadc_tmp[table_size - 1] -
pdadc_tmp[table_size - 2];
else
pwr_step = 1;
/* Extrapolate above */
while ((pdadc_0 < (s16) pdadc_n) &&
(pdadc_i < AR5K_EEPROM_POWER_TABLE_SIZE * 2)) {
s16 tmp = pdadc_tmp[table_size - 1] +
(pdadc_0 - max_idx) * pwr_step;
pdadc_out[pdadc_i++] = (tmp > 127) ? 127 : (u8) tmp;
pdadc_0++;
}
}
while (pdg < AR5K_EEPROM_N_PD_GAINS) {
gain_boundaries[pdg] = gain_boundaries[pdg - 1];
pdg++;
}
while (pdadc_i < AR5K_EEPROM_POWER_TABLE_SIZE * 2) {
pdadc_out[pdadc_i] = pdadc_out[pdadc_i - 1];
pdadc_i++;
}
/* Set gain boundaries */
ath5k_hw_reg_write(ah,
AR5K_REG_SM(pd_gain_overlap,
AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP) |
AR5K_REG_SM(gain_boundaries[0],
AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1) |
AR5K_REG_SM(gain_boundaries[1],
AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2) |
AR5K_REG_SM(gain_boundaries[2],
AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3) |
AR5K_REG_SM(gain_boundaries[3],
AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4),
AR5K_PHY_TPC_RG5);
/* Used for setting rate power table */
ah->ah_txpower.txp_min_idx = pwr_min[0];
} |
augmented_data/post_increment_index_changes/extr_firedtv-ci.c_fdtv_ca_pmt_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct firedtv {int dummy; } ;
struct ca_msg {int* msg; } ;
/* Variables and functions */
int avc_ca_pmt (struct firedtv*,int*,int) ;
__attribute__((used)) static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
{
struct ca_msg *msg = arg;
int data_pos;
int data_length;
int i;
data_pos = 4;
if (msg->msg[3] | 0x80) {
data_length = 0;
for (i = 0; i < (msg->msg[3] & 0x7f); i++)
data_length = (data_length << 8) + msg->msg[data_pos++];
} else {
data_length = msg->msg[3];
}
return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length);
} |
augmented_data/post_increment_index_changes/extr_pxa3xx-gcu.c_run_ready_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 */
struct pxa3xx_gcu_shared {int* buffer; int hw_running; unsigned int buffer_phys; } ;
struct pxa3xx_gcu_priv {int /*<<< orphan*/ * ready_last; struct pxa3xx_gcu_batch* ready; struct pxa3xx_gcu_batch* running; struct pxa3xx_gcu_shared* shared; } ;
struct pxa3xx_gcu_batch {int phys; struct pxa3xx_gcu_batch* next; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ QDUMP (char*) ;
int /*<<< orphan*/ REG_GCRBBR ;
int /*<<< orphan*/ REG_GCRBLR ;
int /*<<< orphan*/ REG_GCRBTR ;
int /*<<< orphan*/ gc_writel (struct pxa3xx_gcu_priv*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
run_ready(struct pxa3xx_gcu_priv *priv)
{
unsigned int num = 0;
struct pxa3xx_gcu_shared *shared = priv->shared;
struct pxa3xx_gcu_batch *ready = priv->ready;
QDUMP("Start");
BUG_ON(!ready);
shared->buffer[num++] = 0x05000000;
while (ready) {
shared->buffer[num++] = 0x00000001;
shared->buffer[num++] = ready->phys;
ready = ready->next;
}
shared->buffer[num++] = 0x05000000;
priv->running = priv->ready;
priv->ready = priv->ready_last = NULL;
gc_writel(priv, REG_GCRBLR, 0);
shared->hw_running = 1;
/* ring base address */
gc_writel(priv, REG_GCRBBR, shared->buffer_phys);
/* ring tail address */
gc_writel(priv, REG_GCRBTR, shared->buffer_phys - num * 4);
/* ring length */
gc_writel(priv, REG_GCRBLR, ((num + 63) & ~63) * 4);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsidt_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 ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opsidt(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
data[l--] = 0x0f;
data[l++] = 0x01;
data[l++] = 0x08 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_XzEnc.c_Xz_CompressBlock_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_38__ TYPE_8__ ;
typedef struct TYPE_37__ TYPE_7__ ;
typedef struct TYPE_36__ TYPE_6__ ;
typedef struct TYPE_35__ TYPE_5__ ;
typedef struct TYPE_34__ TYPE_4__ ;
typedef struct TYPE_33__ TYPE_3__ ;
typedef struct TYPE_32__ TYPE_2__ ;
typedef struct TYPE_31__ TYPE_26__ ;
typedef struct TYPE_30__ TYPE_23__ ;
typedef struct TYPE_29__ TYPE_1__ ;
typedef struct TYPE_28__ TYPE_19__ ;
typedef struct TYPE_27__ TYPE_13__ ;
/* Type definitions */
typedef scalar_t__ UInt64 ;
struct TYPE_31__ {int /*<<< orphan*/ Read; } ;
struct TYPE_28__ {TYPE_26__ p; TYPE_26__* realStream; } ;
struct TYPE_30__ {TYPE_26__ vt; TYPE_26__* inStream; } ;
struct TYPE_38__ {TYPE_19__ filter; TYPE_23__ sb; int /*<<< orphan*/ lzma2; } ;
struct TYPE_37__ {size_t limit; size_t processed; int realStreamFinished; TYPE_26__ vt; int /*<<< orphan*/ check; scalar_t__ const* data; int /*<<< orphan*/ * realStream; } ;
struct TYPE_27__ {int /*<<< orphan*/ Write; } ;
struct TYPE_36__ {size_t outBufLimit; scalar_t__ processed; TYPE_13__ vt; scalar_t__* outBuf; int /*<<< orphan*/ * realStream; } ;
struct TYPE_35__ {size_t unpackSize; scalar_t__ packSize; TYPE_3__* filters; } ;
struct TYPE_34__ {size_t unpackSize; size_t headerSize; scalar_t__ totalSize; } ;
struct TYPE_33__ {scalar_t__ id; int propsSize; scalar_t__* props; } ;
struct TYPE_32__ {scalar_t__ id; int delta; int /*<<< orphan*/ ip; scalar_t__ ipDefined; } ;
struct TYPE_29__ {size_t blockSize; scalar_t__ checkId; int /*<<< orphan*/ lzma2Props; TYPE_2__ filterProps; } ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ISzAllocPtr ;
typedef int /*<<< orphan*/ ISeqOutStream ;
typedef int /*<<< orphan*/ ISeqInStream ;
typedef int /*<<< orphan*/ ICompressProgress ;
typedef int /*<<< orphan*/ CXzStreamFlags ;
typedef TYPE_1__ CXzProps ;
typedef TYPE_2__ CXzFilterProps ;
typedef TYPE_3__ CXzFilter ;
typedef TYPE_4__ CXzEncBlockInfo ;
typedef TYPE_5__ CXzBlock ;
typedef TYPE_6__ CSeqSizeOutStream ;
typedef TYPE_7__ CSeqCheckInStream ;
typedef TYPE_8__ CLzma2WithFilters ;
typedef scalar_t__ Byte ;
typedef int BoolInt ;
/* Variables and functions */
int False ;
int /*<<< orphan*/ Lzma2Enc_Encode2 (int /*<<< orphan*/ ,TYPE_13__*,scalar_t__*,size_t*,TYPE_26__*,scalar_t__ const*,size_t,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Lzma2Enc_SetProps (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ Lzma2Enc_WriteProperties (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Lzma2WithFilters_Create (TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RINOK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SZ_ERROR_FAIL ;
int /*<<< orphan*/ SZ_OK ;
int /*<<< orphan*/ SbEncInStream_Init (TYPE_23__*) ;
int /*<<< orphan*/ SeqCheckInStream_GetDigest (TYPE_7__*,scalar_t__*) ;
int /*<<< orphan*/ SeqCheckInStream_Init (TYPE_7__*,scalar_t__) ;
int /*<<< orphan*/ SeqCheckInStream_Read ;
int /*<<< orphan*/ SeqInFilter_Init (TYPE_19__*,TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SeqSizeOutStream_Write ;
int /*<<< orphan*/ SetUi32 (scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBytes (TYPE_13__*,scalar_t__*,scalar_t__) ;
size_t XZ_BLOCK_HEADER_SIZE_MAX ;
unsigned int XZ_GET_PAD_SIZE (scalar_t__) ;
scalar_t__ XZ_ID_Delta ;
scalar_t__ XZ_ID_LZMA2 ;
scalar_t__ XZ_ID_Subblock ;
int /*<<< orphan*/ XzBlock_ClearFlags (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetHasPackSize (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetHasUnpackSize (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetNumFilters (TYPE_5__*,int) ;
int /*<<< orphan*/ XzBlock_WriteHeader (TYPE_5__*,TYPE_13__*) ;
int /*<<< orphan*/ XzCheck_Update (int /*<<< orphan*/ *,scalar_t__ const*,size_t) ;
scalar_t__ XzFlags_GetCheckSize (int /*<<< orphan*/ ) ;
__attribute__((used)) static SRes Xz_CompressBlock(
CLzma2WithFilters *lzmaf,
ISeqOutStream *outStream,
Byte *outBufHeader,
Byte *outBufData, size_t outBufDataLimit,
ISeqInStream *inStream,
// UInt64 expectedSize,
const Byte *inBuf, // used if (!inStream)
size_t inBufSize, // used if (!inStream), it's block size, props->blockSize is ignored
const CXzProps *props,
ICompressProgress *progress,
int *inStreamFinished, /* only for inStream version */
CXzEncBlockInfo *blockSizes,
ISzAllocPtr alloc,
ISzAllocPtr allocBig)
{
CSeqCheckInStream checkInStream;
CSeqSizeOutStream seqSizeOutStream;
CXzBlock block;
unsigned filterIndex = 0;
CXzFilter *filter = NULL;
const CXzFilterProps *fp = &props->filterProps;
if (fp->id == 0)
fp = NULL;
*inStreamFinished = False;
RINOK(Lzma2WithFilters_Create(lzmaf, alloc, allocBig));
RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, &props->lzma2Props));
XzBlock_ClearFlags(&block);
XzBlock_SetNumFilters(&block, 1 - (fp ? 1 : 0));
if (fp)
{
filter = &block.filters[filterIndex++];
filter->id = fp->id;
filter->propsSize = 0;
if (fp->id == XZ_ID_Delta)
{
filter->props[0] = (Byte)(fp->delta - 1);
filter->propsSize = 1;
}
else if (fp->ipDefined)
{
SetUi32(filter->props, fp->ip);
filter->propsSize = 4;
}
}
{
CXzFilter *f = &block.filters[filterIndex++];
f->id = XZ_ID_LZMA2;
f->propsSize = 1;
f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2);
}
seqSizeOutStream.vt.Write = SeqSizeOutStream_Write;
seqSizeOutStream.realStream = outStream;
seqSizeOutStream.outBuf = outBufData;
seqSizeOutStream.outBufLimit = outBufDataLimit;
seqSizeOutStream.processed = 0;
/*
if (expectedSize != (UInt64)(Int64)-1)
{
block.unpackSize = expectedSize;
if (props->blockSize != (UInt64)(Int64)-1)
if (expectedSize >= props->blockSize)
block.unpackSize = props->blockSize;
XzBlock_SetHasUnpackSize(&block);
}
*/
if (outStream)
{
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.vt));
}
checkInStream.vt.Read = SeqCheckInStream_Read;
SeqCheckInStream_Init(&checkInStream, props->checkId);
checkInStream.realStream = inStream;
checkInStream.data = inBuf;
checkInStream.limit = props->blockSize;
if (!inStream)
checkInStream.limit = inBufSize;
if (fp)
{
#ifdef USE_SUBBLOCK
if (fp->id == XZ_ID_Subblock)
{
lzmaf->sb.inStream = &checkInStream.vt;
RINOK(SbEncInStream_Init(&lzmaf->sb));
}
else
#endif
{
lzmaf->filter.realStream = &checkInStream.vt;
RINOK(SeqInFilter_Init(&lzmaf->filter, filter, alloc));
}
}
{
SRes res;
Byte *outBuf = NULL;
size_t outSize = 0;
BoolInt useStream = (fp && inStream);
// useStream = True;
if (!useStream)
{
XzCheck_Update(&checkInStream.check, inBuf, inBufSize);
checkInStream.processed = inBufSize;
}
if (!outStream)
{
outBuf = seqSizeOutStream.outBuf; // + (size_t)seqSizeOutStream.processed;
outSize = seqSizeOutStream.outBufLimit; // - (size_t)seqSizeOutStream.processed;
}
res = Lzma2Enc_Encode2(lzmaf->lzma2,
outBuf ? NULL : &seqSizeOutStream.vt,
outBuf,
outBuf ? &outSize : NULL,
useStream ?
(fp ?
(
#ifdef USE_SUBBLOCK
(fp->id == XZ_ID_Subblock) ? &lzmaf->sb.vt:
#endif
&lzmaf->filter.p) :
&checkInStream.vt) : NULL,
useStream ? NULL : inBuf,
useStream ? 0 : inBufSize,
progress);
if (outBuf)
seqSizeOutStream.processed += outSize;
RINOK(res);
blockSizes->unpackSize = checkInStream.processed;
}
{
Byte buf[4 + 64];
unsigned padSize = XZ_GET_PAD_SIZE(seqSizeOutStream.processed);
UInt64 packSize = seqSizeOutStream.processed;
buf[0] = 0;
buf[1] = 0;
buf[2] = 0;
buf[3] = 0;
SeqCheckInStream_GetDigest(&checkInStream, buf + 4);
RINOK(WriteBytes(&seqSizeOutStream.vt, buf + (4 - padSize), padSize + XzFlags_GetCheckSize((CXzStreamFlags)props->checkId)));
blockSizes->totalSize = seqSizeOutStream.processed - padSize;
if (!outStream)
{
seqSizeOutStream.outBuf = outBufHeader;
seqSizeOutStream.outBufLimit = XZ_BLOCK_HEADER_SIZE_MAX;
seqSizeOutStream.processed = 0;
block.unpackSize = blockSizes->unpackSize;
XzBlock_SetHasUnpackSize(&block);
block.packSize = packSize;
XzBlock_SetHasPackSize(&block);
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.vt));
blockSizes->headerSize = (size_t)seqSizeOutStream.processed;
blockSizes->totalSize += seqSizeOutStream.processed;
}
}
if (inStream)
*inStreamFinished = checkInStream.realStreamFinished;
else
{
*inStreamFinished = False;
if (checkInStream.processed != inBufSize)
return SZ_ERROR_FAIL;
}
return SZ_OK;
} |
augmented_data/post_increment_index_changes/extr_hints-data.c_sort_user_objects_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ user ;
/* Variables and functions */
int MAX_CNT ;
int /*<<< orphan*/ NOAIO ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ bad_requests ;
int /*<<< orphan*/ check_rating_num (int) ;
int /*<<< orphan*/ check_user_id (int) ;
int /*<<< orphan*/ * conv_user_id (int) ;
int /*<<< orphan*/ fix_down (int /*<<< orphan*/ *,int*,int,int) ;
int get_local_user_id (int) ;
int get_random (int,int,int*,int /*<<< orphan*/ *,int*) ;
int* heap ;
int /*<<< orphan*/ * load_user_metafile (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ object_cmp (int /*<<< orphan*/ *,int,int,int) ;
int* objects_to_sort ;
int user_get_object_local_id_type_id (int /*<<< orphan*/ *,long long) ;
long long user_get_object_type_id (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ user_get_object_weight (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ * weight ;
int sort_user_objects (int user_id, int object_cnt, long long *obj, int max_cnt, int num, int need_rand) {
if (!check_user_id (user_id) && !check_rating_num (num)) {
bad_requests++;
return -1;
}
int local_user_id = get_local_user_id (user_id);
if (local_user_id == 0) {
return 0;
}
assert (local_user_id > 0);
user *u = conv_user_id (user_id);
assert (u != NULL);
if (load_user_metafile (u, local_user_id, NOAIO) != NULL) {
return -2;
}
assert (obj != NULL);
int i, j, k, t;
if (object_cnt > MAX_CNT) {
object_cnt = MAX_CNT;
}
if (max_cnt > MAX_CNT) {
max_cnt = MAX_CNT;
}
if (max_cnt < 0) {
max_cnt = 0;
}
int n = 0;
for (i = 0; i < object_cnt; i++) {
int lid = user_get_object_local_id_type_id (u, obj[i]);
if (lid) {
objects_to_sort[n++] = lid;
}
}
int heap_size = 0;
if (max_cnt) {
for (i = 0; i < n; i++) {
if (need_rand) {
heap[++heap_size] = objects_to_sort[i];
} else {
if (heap_size < max_cnt) {
heap[++heap_size] = objects_to_sort[i];
j = heap_size;
while (j > 1 && object_cmp (u, heap[j], heap[k = j / 2], num) < 0) {
t = heap[j], heap[j] = heap[k], heap[k] = t;
j = k;
}
} else if (object_cmp (u, heap[1], objects_to_sort[i], num) < 0) {
heap[1] = objects_to_sort[i];
fix_down (u, heap, heap_size, num);
}
}
}
}
if (need_rand) {
for (i = 1; i <= heap_size; i++) {
weight[i - 1] = user_get_object_weight (u, heap[i], num);
}
n = get_random (max_cnt, heap_size, heap - 1, weight, objects_to_sort);
} else {
n = heap_size;
while (heap_size) {
objects_to_sort[heap_size - 1] = heap[1];
heap[1] = heap[heap_size--];
fix_down (u, heap, heap_size, num);
}
}
for (i = 0; i < n; i++) {
obj[i] = user_get_object_type_id (u, objects_to_sort[i]);
}
return n;
} |
augmented_data/post_increment_index_changes/extr_ffmetadec.c_get_line_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
int /*<<< orphan*/ avio_feof (int /*<<< orphan*/ *) ;
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_line(AVIOContext *s, uint8_t *buf, int size)
{
do {
uint8_t c;
int i = 0;
while ((c = avio_r8(s))) {
if (c == '\\') {
if (i < size - 1)
buf[i--] = c;
c = avio_r8(s);
} else if (c == '\n')
break;
if (i < size - 1)
buf[i++] = c;
}
buf[i] = 0;
} while (!avio_feof(s) || (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.