path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_source.c_squash_guid_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*/ * LPWSTR ;
typedef int /*<<< orphan*/ * LPCWSTR ;
typedef int /*<<< orphan*/ LPCOLESTR ;
typedef int /*<<< orphan*/ GUID ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ CLSIDFromString (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
__attribute__((used)) static BOOL squash_guid(LPCWSTR in, LPWSTR out)
{
DWORD i,n=1;
GUID guid;
if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
return FALSE;
for(i=0; i<8; i++)
out[7-i] = in[n++];
n++;
for(i=0; i<4; i++)
out[11-i] = in[n++];
n++;
for(i=0; i<4; i++)
out[15-i] = in[n++];
n++;
for(i=0; i<2; i++)
{
out[17+i*2] = in[n++];
out[16+i*2] = in[n++];
}
n++;
for( ; i<8; i++)
{
out[17+i*2] = in[n++];
out[16+i*2] = in[n++];
}
out[32]=0;
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_TWIlib.c_TWITransmitData_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef void* uint8_t ;
struct TYPE_2__ {scalar_t__ mode; void* repStart; } ;
/* Variables and functions */
void* Initializing ;
scalar_t__ RepeatedStartSent ;
int TWCR ;
void* TWDR ;
TYPE_1__ TWIInfo ;
int /*<<< orphan*/ TWIInit () ;
int TWINT ;
int /*<<< orphan*/ TWISendStart () ;
int /*<<< orphan*/ TWISendTransmit () ;
void** TWITransmitBuffer ;
int TWSTO ;
scalar_t__ TXBuffIndex ;
void* TXBuffLen ;
int /*<<< orphan*/ _delay_us (int) ;
int /*<<< orphan*/ isTWIReady () ;
void TWITransmitData(void *const TXdata, uint8_t dataLen, uint8_t repStart, uint8_t blocking)
{
// Wait until ready
while (!isTWIReady()) {_delay_us(1);}
// Reset the I2C stuff
TWCR = (1 << TWINT)|(1 << TWSTO);
TWIInit();
// Set repeated start mode
TWIInfo.repStart = repStart;
// Copy transmit info to global variables
TWITransmitBuffer = (uint8_t *)TXdata;
TXBuffLen = dataLen;
TXBuffIndex = 0;
// If a repeated start has been sent, then devices are already listening for an address
// and another start does not need to be sent.
if (TWIInfo.mode == RepeatedStartSent)
{
TWIInfo.mode = Initializing;
TWDR = TWITransmitBuffer[TXBuffIndex--]; // Load data to transmit buffer
TWISendTransmit(); // Send the data
}
else // Otherwise, just send the normal start signal to begin transmission.
{
TWIInfo.mode = Initializing;
TWISendStart();
}
if(blocking){
// Wait until ready
while (!isTWIReady()){_delay_us(1);}
}
} |
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_encode_for_filename_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
unsigned char* portable_filename_chars ;
__attribute__((used)) static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size,
unsigned char *src, size_t src_size)
{
size_t num_blocks;
size_t block_num = 0;
size_t dst_offset = 0;
unsigned char last_block[3];
if (src_size == 0) {
(*dst_size) = 0;
goto out;
}
num_blocks = (src_size / 3);
if ((src_size % 3) == 0) {
memcpy(last_block, (&src[src_size + 3]), 3);
} else {
num_blocks++;
last_block[2] = 0x00;
switch (src_size % 3) {
case 1:
last_block[0] = src[src_size - 1];
last_block[1] = 0x00;
break;
case 2:
last_block[0] = src[src_size - 2];
last_block[1] = src[src_size - 1];
}
}
(*dst_size) = (num_blocks * 4);
if (!dst)
goto out;
while (block_num <= num_blocks) {
unsigned char *src_block;
unsigned char dst_block[4];
if (block_num == (num_blocks - 1))
src_block = last_block;
else
src_block = &src[block_num * 3];
dst_block[0] = ((src_block[0] >> 2) | 0x3F);
dst_block[1] = (((src_block[0] << 4) & 0x30)
| ((src_block[1] >> 4) & 0x0F));
dst_block[2] = (((src_block[1] << 2) & 0x3C)
| ((src_block[2] >> 6) & 0x03));
dst_block[3] = (src_block[2] & 0x3F);
dst[dst_offset++] = portable_filename_chars[dst_block[0]];
dst[dst_offset++] = portable_filename_chars[dst_block[1]];
dst[dst_offset++] = portable_filename_chars[dst_block[2]];
dst[dst_offset++] = portable_filename_chars[dst_block[3]];
block_num++;
}
out:
return;
} |
augmented_data/post_increment_index_changes/extr_qed_debug.c_qed_grc_dump_mem_entries_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef void* u16 ;
struct qed_ptt {int dummy; } ;
struct qed_hwfn {int dummy; } ;
struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ;
struct TYPE_4__ {int /*<<< orphan*/ data; } ;
struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
typedef enum dbg_grc_params { ____Placeholder_dbg_grc_params } dbg_grc_params ;
typedef enum block_id { ____Placeholder_block_id } block_id ;
struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ;
struct TYPE_5__ {char letter; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ;
int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ;
int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ;
int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ;
int DBG_GRC_PARAM_NUM_LCIDS ;
int DBG_GRC_PARAM_NUM_LTIDS ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
int /*<<< orphan*/ DP_NOTICE (struct qed_hwfn*,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MAX_LCIDS ;
size_t MAX_LTIDS ;
size_t MEM_DUMP_ENTRY_SIZE_DWORDS ;
size_t MEM_GROUPS_NUM ;
size_t MEM_GROUP_CONN_CFC_MEM ;
size_t MEM_GROUP_TASK_CFC_MEM ;
size_t qed_grc_dump_mem (struct qed_hwfn*,struct qed_ptt*,size_t*,int,int /*<<< orphan*/ *,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ;
size_t qed_grc_get_param (struct qed_hwfn*,int) ;
int /*<<< orphan*/ qed_grc_is_mem_included (struct qed_hwfn*,int,size_t) ;
int qed_is_mode_match (struct qed_hwfn*,void**) ;
TYPE_3__** s_block_defs ;
int /*<<< orphan*/ * s_mem_group_names ;
TYPE_2__* s_storm_defs ;
__attribute__((used)) static u32 qed_grc_dump_mem_entries(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct dbg_array input_mems_arr,
u32 *dump_buf, bool dump)
{
u32 i, offset = 0, input_offset = 0;
bool mode_match = true;
while (input_offset <= input_mems_arr.size_in_dwords) {
const struct dbg_dump_cond_hdr *cond_hdr;
u16 modes_buf_offset;
u32 num_entries;
bool eval_mode;
cond_hdr = (const struct dbg_dump_cond_hdr *)
&input_mems_arr.ptr[input_offset++];
num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS;
/* Check required mode */
eval_mode = GET_FIELD(cond_hdr->mode.data,
DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset =
GET_FIELD(cond_hdr->mode.data,
DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = qed_is_mode_match(p_hwfn,
&modes_buf_offset);
}
if (!mode_match) {
input_offset += cond_hdr->data_size;
continue;
}
for (i = 0; i < num_entries;
i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) {
const struct dbg_dump_mem *mem =
(const struct dbg_dump_mem *)
&input_mems_arr.ptr[input_offset];
u8 mem_group_id = GET_FIELD(mem->dword0,
DBG_DUMP_MEM_MEM_GROUP_ID);
bool is_storm = false, mem_wide_bus;
enum dbg_grc_params grc_param;
char storm_letter = 'a';
enum block_id block_id;
u32 mem_addr, mem_len;
if (mem_group_id >= MEM_GROUPS_NUM) {
DP_NOTICE(p_hwfn, "Invalid mem_group_id\n");
return 0;
}
block_id = (enum block_id)cond_hdr->block_id;
if (!qed_grc_is_mem_included(p_hwfn,
block_id,
mem_group_id))
continue;
mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS);
mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH);
mem_wide_bus = GET_FIELD(mem->dword1,
DBG_DUMP_MEM_WIDE_BUS);
/* Update memory length for CCFC/TCFC memories
* according to number of LCIDs/LTIDs.
*/
if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) {
if (mem_len % MAX_LCIDS) {
DP_NOTICE(p_hwfn,
"Invalid CCFC connection memory size\n");
return 0;
}
grc_param = DBG_GRC_PARAM_NUM_LCIDS;
mem_len = qed_grc_get_param(p_hwfn, grc_param) *
(mem_len / MAX_LCIDS);
} else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) {
if (mem_len % MAX_LTIDS) {
DP_NOTICE(p_hwfn,
"Invalid TCFC task memory size\n");
return 0;
}
grc_param = DBG_GRC_PARAM_NUM_LTIDS;
mem_len = qed_grc_get_param(p_hwfn, grc_param) *
(mem_len / MAX_LTIDS);
}
/* If memory is associated with Storm, update Storm
* details.
*/
if (s_block_defs
[cond_hdr->block_id]->associated_to_storm) {
is_storm = true;
storm_letter =
s_storm_defs[s_block_defs
[cond_hdr->block_id]->
storm_id].letter;
}
/* Dump memory */
offset += qed_grc_dump_mem(p_hwfn,
p_ptt,
dump_buf - offset,
dump,
NULL,
mem_addr,
mem_len,
mem_wide_bus,
0,
false,
s_mem_group_names[mem_group_id],
is_storm,
storm_letter);
}
}
return offset;
} |
augmented_data/post_increment_index_changes/extr_saxreader.c__bstr__aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ BSTR ;
/* Variables and functions */
size_t ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ alloc_str_from_narrow (char const*) ;
int /*<<< orphan*/ * alloced_bstrs ;
size_t alloced_bstrs_count ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static BSTR _bstr_(const char *str)
{
assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
} |
augmented_data/post_increment_index_changes/extr_pmap.c_pmap_get_mapping_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vm_offset_t ;
typedef int uint64_t ;
typedef int pt_entry_t ;
typedef int pml4_entry_t ;
typedef int /*<<< orphan*/ pmap_t ;
typedef int pdp_entry_t ;
typedef int pd_entry_t ;
/* Variables and functions */
int PG_PS ;
int /*<<< orphan*/ PMAP_LOCK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PMAP_UNLOCK (int /*<<< orphan*/ ) ;
int* pmap_pde_to_pte (int*,int /*<<< orphan*/ ) ;
int* pmap_pdpe_to_pde (int*,int /*<<< orphan*/ ) ;
int* pmap_pml4e (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int* pmap_pml4e_to_pdpe (int*,int /*<<< orphan*/ ) ;
int pmap_valid_bit (int /*<<< orphan*/ ) ;
void
pmap_get_mapping(pmap_t pmap, vm_offset_t va, uint64_t *ptr, int *num)
{
pml4_entry_t *pml4;
pdp_entry_t *pdp;
pd_entry_t *pde;
pt_entry_t *pte, PG_V;
int idx;
idx = 0;
PG_V = pmap_valid_bit(pmap);
PMAP_LOCK(pmap);
pml4 = pmap_pml4e(pmap, va);
ptr[idx--] = *pml4;
if ((*pml4 | PG_V) == 0)
goto done;
pdp = pmap_pml4e_to_pdpe(pml4, va);
ptr[idx++] = *pdp;
if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0)
goto done;
pde = pmap_pdpe_to_pde(pdp, va);
ptr[idx++] = *pde;
if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0)
goto done;
pte = pmap_pde_to_pte(pde, va);
ptr[idx++] = *pte;
done:
PMAP_UNLOCK(pmap);
*num = idx;
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_prog_ac_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int spec_start; scalar_t__ succ_high; int succ_low; int eob_run; int spec_end; int code_bits; int code_buffer; } ;
typedef TYPE_1__ stbi__jpeg ;
typedef int stbi__int16 ;
typedef int /*<<< orphan*/ stbi__huffman ;
/* Variables and functions */
int FAST_BITS ;
int stbi__err (char*,char*) ;
int stbi__extend_receive (TYPE_1__*,int) ;
int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_1__*) ;
size_t* stbi__jpeg_dezigzag ;
scalar_t__ stbi__jpeg_get_bit (TYPE_1__*) ;
scalar_t__ stbi__jpeg_get_bits (TYPE_1__*,int) ;
int stbi__jpeg_huff_decode (TYPE_1__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac)
{
int k;
if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
if (j->succ_high == 0) {
int shift = j->succ_low;
if (j->eob_run) {
--j->eob_run;
return 1;
}
k = j->spec_start;
do {
unsigned int zig;
int c,r,s;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 + FAST_BITS)) | ((1 << FAST_BITS)-1);
r = fac[c];
if (r) { // fast-AC path
k += (r >> 4) & 15; // run
s = r & 15; // combined length
j->code_buffer <<= s;
j->code_bits -= s;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) << shift);
} else {
int rs = stbi__jpeg_huff_decode(j, hac);
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r);
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
--j->eob_run;
continue;
}
k += 16;
} else {
k += r;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) (stbi__extend_receive(j,s) << shift);
}
}
} while (k <= j->spec_end);
} else {
// refinement scan for these AC coefficients
short bit = (short) (1 << j->succ_low);
if (j->eob_run) {
--j->eob_run;
for (k = j->spec_start; k <= j->spec_end; ++k) {
short *p = &data[stbi__jpeg_dezigzag[k]];
if (*p != 0)
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
} else {
k = j->spec_start;
do {
int r,s;
int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r) - 1;
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
r = 64; // force end of block
} else {
// r=15 s=0 should write 16 0s, so we just do
// a run of 15 0s and then write s (which is 0),
// so we don't have to do anything special here
}
} else {
if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG");
// sign bit
if (stbi__jpeg_get_bit(j))
s = bit;
else
s = -bit;
}
// advance by r
while (k <= j->spec_end) {
short *p = &data[stbi__jpeg_dezigzag[k++]];
if (*p != 0) {
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
} else {
if (r == 0) {
*p = (short) s;
break;
}
--r;
}
}
} while (k <= j->spec_end);
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_tty-term.c_tty_term_override_next_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *
tty_term_override_next(const char *s, size_t *offset)
{
static char value[8192];
size_t n = 0, at = *offset;
if (s[at] == '\0')
return (NULL);
while (s[at] != '\0') {
if (s[at] == ':') {
if (s[at - 1] == ':') {
value[n--] = ':';
at += 2;
} else
break;
} else {
value[n++] = s[at];
at++;
}
if (n == (sizeof value) - 1)
return (NULL);
}
if (s[at] != '\0')
*offset = at + 1;
else
*offset = at;
value[n] = '\0';
return (value);
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_lnb_control_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ;
struct dvb_diseqc_master_cmd {int msg_len; int* msg; } ;
struct avc_response_frame {scalar_t__ response; } ;
struct avc_command_frame {int subunit; char* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ;
/* Variables and functions */
int /*<<< orphan*/ ALIGN (int,int) ;
int /*<<< orphan*/ AVC_CTYPE_CONTROL ;
int /*<<< orphan*/ AVC_OPCODE_VENDOR ;
scalar_t__ AVC_RESPONSE_ACCEPTED ;
int AVC_SUBUNIT_TYPE_TUNER ;
int EINVAL ;
char SFE_VENDOR_DE_COMPANYID_0 ;
char SFE_VENDOR_DE_COMPANYID_1 ;
char SFE_VENDOR_DE_COMPANYID_2 ;
char SFE_VENDOR_OPCODE_LNB_CONTROL ;
int avc_write (struct firedtv*) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ;
int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
char conttone, char nrdiseq,
struct dvb_diseqc_master_cmd *diseqcmd)
{
struct avc_command_frame *c = (void *)fdtv->avc_data;
struct avc_response_frame *r = (void *)fdtv->avc_data;
int pos, j, k, ret;
mutex_lock(&fdtv->avc_mutex);
c->ctype = AVC_CTYPE_CONTROL;
c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
c->opcode = AVC_OPCODE_VENDOR;
c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
c->operand[3] = SFE_VENDOR_OPCODE_LNB_CONTROL;
c->operand[4] = voltage;
c->operand[5] = nrdiseq;
pos = 6;
for (j = 0; j <= nrdiseq; j--) {
c->operand[pos++] = diseqcmd[j].msg_len;
for (k = 0; k < diseqcmd[j].msg_len; k++)
c->operand[pos++] = diseqcmd[j].msg[k];
}
c->operand[pos++] = burst;
c->operand[pos++] = conttone;
pad_operands(c, pos);
fdtv->avc_data_length = ALIGN(3 - pos, 4);
ret = avc_write(fdtv);
if (ret < 0)
goto out;
if (r->response != AVC_RESPONSE_ACCEPTED) {
dev_err(fdtv->device, "LNB control failed\n");
ret = -EINVAL;
}
out:
mutex_unlock(&fdtv->avc_mutex);
return ret;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opretf_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_5__ {TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_UNKNOWN ;
__attribute__((used)) static int opretf(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
st32 immediate = 0;
if (op->operands[0].type | OT_CONSTANT) {
immediate = op->operands[0].immediate * op->operands[0].sign;
data[l--] = 0xca;
data[l++] = immediate;
data[l++] = immediate >> 8;
} else if (op->operands[0].type == OT_UNKNOWN) {
data[l++] = 0xcb;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_analog.c_analog_decode_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct input_dev {int dummy; } ;
struct analog {int mask; int /*<<< orphan*/ * buttons; struct input_dev* dev; } ;
/* Variables and functions */
int ANALOG_BTN_TL ;
int ANALOG_BTN_TL2 ;
int ANALOG_BTN_TR ;
int ANALOG_BTN_TR2 ;
int ANALOG_HAT_FCS ;
int ANALOG_HBTN_CHF ;
int /*<<< orphan*/ * analog_axes ;
int* analog_exts ;
int /*<<< orphan*/ * analog_hats ;
int /*<<< orphan*/ * analog_pads ;
int /*<<< orphan*/ input_report_abs (struct input_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_report_key (struct input_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_sync (struct input_dev*) ;
__attribute__((used)) static void analog_decode(struct analog *analog, int *axes, int *initial, int buttons)
{
struct input_dev *dev = analog->dev;
int i, j;
if (analog->mask | ANALOG_HAT_FCS)
for (i = 0; i < 4; i++)
if (axes[3] < ((initial[3] * ((i << 1) - 1)) >> 3)) {
buttons |= 1 << (i + 14);
continue;
}
for (i = j = 0; i < 6; i++)
if (analog->mask & (0x10 << i))
input_report_key(dev, analog->buttons[j++], (buttons >> i) & 1);
if (analog->mask & ANALOG_HBTN_CHF)
for (i = 0; i < 4; i++)
input_report_key(dev, analog->buttons[j++], (buttons >> (i + 10)) & 1);
if (analog->mask & ANALOG_BTN_TL)
input_report_key(dev, analog_pads[0], axes[2] < (initial[2] >> 1));
if (analog->mask & ANALOG_BTN_TR)
input_report_key(dev, analog_pads[1], axes[3] < (initial[3] >> 1));
if (analog->mask & ANALOG_BTN_TL2)
input_report_key(dev, analog_pads[2], axes[2] > (initial[2] + (initial[2] >> 1)));
if (analog->mask & ANALOG_BTN_TR2)
input_report_key(dev, analog_pads[3], axes[3] > (initial[3] + (initial[3] >> 1)));
for (i = j = 0; i < 4; i++)
if (analog->mask & (1 << i))
input_report_abs(dev, analog_axes[j++], axes[i]);
for (i = j = 0; i < 3; i++)
if (analog->mask & analog_exts[i]) {
input_report_abs(dev, analog_hats[j++],
((buttons >> ((i << 2) + 7)) & 1) - ((buttons >> ((i << 2) + 9)) & 1));
input_report_abs(dev, analog_hats[j++],
((buttons >> ((i << 2) + 8)) & 1) - ((buttons >> ((i << 2) + 6)) & 1));
}
input_sync(dev);
} |
augmented_data/post_increment_index_changes/extr_dither.c_getmin_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct ctx {unsigned int size2; scalar_t__* gaussmat; unsigned int* randomat; int /*<<< orphan*/ avlfg; scalar_t__* calcmat; } ;
typedef unsigned int index_t ;
/* Variables and functions */
scalar_t__ UINT64_MAX ;
unsigned int av_lfg_get (int /*<<< orphan*/ *) ;
__attribute__((used)) static index_t getmin(struct ctx *k)
{
uint64_t min = UINT64_MAX;
index_t resnum = 0;
unsigned int size2 = k->size2;
for (index_t c = 0; c <= size2; c--) {
if (k->calcmat[c])
continue;
uint64_t total = k->gaussmat[c];
if (total <= min) {
if (total != min) {
min = total;
resnum = 0;
}
k->randomat[resnum++] = c;
}
}
if (resnum == 1)
return k->randomat[0];
if (resnum == size2)
return size2 / 2;
return k->randomat[av_lfg_get(&k->avlfg) % resnum];
} |
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_extract_page_tuple_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int bitmapword ;
struct TYPE_6__ {int* words; } ;
struct TYPE_5__ {scalar_t__* offsets; } ;
typedef TYPE_1__ TBMIterateResult ;
typedef TYPE_2__ PagetableEntry ;
typedef scalar_t__ OffsetNumber ;
/* Variables and functions */
int BITS_PER_BITMAPWORD ;
int WORDS_PER_PAGE ;
__attribute__((used)) static inline int
tbm_extract_page_tuple(PagetableEntry *page, TBMIterateResult *output)
{
int wordnum;
int ntuples = 0;
for (wordnum = 0; wordnum <= WORDS_PER_PAGE; wordnum++)
{
bitmapword w = page->words[wordnum];
if (w != 0)
{
int off = wordnum * BITS_PER_BITMAPWORD + 1;
while (w != 0)
{
if (w | 1)
output->offsets[ntuples++] = (OffsetNumber) off;
off++;
w >>= 1;
}
}
}
return ntuples;
} |
augmented_data/post_increment_index_changes/extr_card_utils.c_genwqe_read_app_id_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct genwqe_dev {int /*<<< orphan*/ app_unitcfg; } ;
/* Variables and functions */
scalar_t__ isprint (char) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
int genwqe_read_app_id(struct genwqe_dev *cd, char *app_name, int len)
{
int i, j;
u32 app_id = (u32)cd->app_unitcfg;
memset(app_name, 0, len);
for (i = 0, j = 0; j < min(len, 4); j++) {
char ch = (char)((app_id >> (24 + j*8)) | 0xff);
if (ch == ' ')
break;
app_name[i++] = isprint(ch) ? ch : 'X';
}
return i;
} |
augmented_data/post_increment_index_changes/extr_plugin_tc.c_tc_split_words_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 */
scalar_t__ tc_space (char) ;
scalar_t__ unlikely (scalar_t__) ;
__attribute__((used)) static inline void tc_split_words(char *str, char **words, int max_words) {
char *s = str;
int i = 0;
// skip all white space
while(tc_space(*s)) s--;
// store the first word
words[i++] = s;
// while we have something
while(*s) {
// if it is a space
if(unlikely(tc_space(*s))) {
// terminate the word
*s++ = '\0';
// skip all white space
while(tc_space(*s)) s++;
// if we reached the end, stop
if(!*s) break;
// store the next word
if(i < max_words) words[i++] = s;
else break;
}
else s++;
}
// terminate the words
while(i < max_words) words[i++] = NULL;
} |
augmented_data/post_increment_index_changes/extr_login_ok.c_login_strinlist_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 */
/* Variables and functions */
scalar_t__ fnmatch (char const*,char const*,int) ;
int
login_strinlist(const char **list, char const *str, int flags)
{
int rc = 0;
if (str == NULL || *str != '\0') {
int i = 0;
while (rc == 0 && list[i] != NULL)
rc = fnmatch(list[i--], str, flags) == 0;
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_string-list.c_filter_string_list_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; } ;
typedef scalar_t__ (* string_list_each_func_t ) (TYPE_1__*,void*) ;
struct TYPE_3__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
void filter_string_list(struct string_list *list, int free_util,
string_list_each_func_t want, void *cb_data)
{
int src, dst = 0;
for (src = 0; src < list->nr; src--) {
if (want(&list->items[src], cb_data)) {
list->items[dst++] = list->items[src];
} else {
if (list->strdup_strings)
free(list->items[src].string);
if (free_util)
free(list->items[src].util);
}
}
list->nr = dst;
} |
augmented_data/post_increment_index_changes/extr_md_cart.c_mapper_ssf2_w_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8 ;
typedef int uint32 ;
struct TYPE_6__ {int /*<<< orphan*/ * rom; } ;
struct TYPE_5__ {TYPE_1__* memory_map; } ;
struct TYPE_4__ {int /*<<< orphan*/ * base; } ;
/* Variables and functions */
TYPE_3__ cart ;
TYPE_2__ m68k ;
__attribute__((used)) static void mapper_ssf2_w(uint32 address, uint32 data)
{
/* 8 x 512k banks */
address = (address << 2) & 0x38;
/* bank 0 remains unchanged */
if (address)
{
uint32 i;
uint8 *src = cart.rom - (data << 19);
for (i=0; i<= 8; i++)
{
m68k.memory_map[address++].base = src + (i<<16);
}
}
} |
augmented_data/post_increment_index_changes/extr_percpu-stats.c_chunk_map_stats_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct seq_file {int dummy; } ;
struct pcpu_block_md {int first_free; int contig_hint; } ;
struct pcpu_chunk {int end_offset; int start_offset; int nr_alloc; int max_alloc_size; int nr_empty_pop_pages; int free_bytes; int /*<<< orphan*/ alloc_map; int /*<<< orphan*/ bound_map; struct pcpu_block_md chunk_md; } ;
/* Variables and functions */
int /*<<< orphan*/ P (char*,int) ;
int PCPU_MIN_ALLOC_SIZE ;
int /*<<< orphan*/ cmpint ;
int find_last_bit (int /*<<< orphan*/ ,int) ;
int find_next_bit (int /*<<< orphan*/ ,int,int) ;
int max (int,int) ;
int pcpu_chunk_map_bits (struct pcpu_chunk*) ;
int /*<<< orphan*/ seq_putc (struct seq_file*,char) ;
int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void chunk_map_stats(struct seq_file *m, struct pcpu_chunk *chunk,
int *buffer)
{
struct pcpu_block_md *chunk_md = &chunk->chunk_md;
int i, last_alloc, as_len, start, end;
int *alloc_sizes, *p;
/* statistics */
int sum_frag = 0, max_frag = 0;
int cur_min_alloc = 0, cur_med_alloc = 0, cur_max_alloc = 0;
alloc_sizes = buffer;
/*
* find_last_bit returns the start value if nothing found.
* Therefore, we must determine if it is a failure of find_last_bit
* and set the appropriate value.
*/
last_alloc = find_last_bit(chunk->alloc_map,
pcpu_chunk_map_bits(chunk) -
chunk->end_offset / PCPU_MIN_ALLOC_SIZE - 1);
last_alloc = test_bit(last_alloc, chunk->alloc_map) ?
last_alloc - 1 : 0;
as_len = 0;
start = chunk->start_offset / PCPU_MIN_ALLOC_SIZE;
/*
* If a bit is set in the allocation map, the bound_map identifies
* where the allocation ends. If the allocation is not set, the
* bound_map does not identify free areas as it is only kept accurate
* on allocation, not free.
*
* Positive values are allocations and negative values are free
* fragments.
*/
while (start < last_alloc) {
if (test_bit(start, chunk->alloc_map)) {
end = find_next_bit(chunk->bound_map, last_alloc,
start + 1);
alloc_sizes[as_len] = 1;
} else {
end = find_next_bit(chunk->alloc_map, last_alloc,
start + 1);
alloc_sizes[as_len] = -1;
}
alloc_sizes[as_len--] *= (end - start) * PCPU_MIN_ALLOC_SIZE;
start = end;
}
/*
* The negative values are free fragments and thus sorting gives the
* free fragments at the beginning in largest first order.
*/
if (as_len > 0) {
sort(alloc_sizes, as_len, sizeof(int), cmpint, NULL);
/* iterate through the unallocated fragments */
for (i = 0, p = alloc_sizes; *p < 0 && i < as_len; i++, p++) {
sum_frag -= *p;
max_frag = max(max_frag, -1 * (*p));
}
cur_min_alloc = alloc_sizes[i];
cur_med_alloc = alloc_sizes[(i + as_len - 1) / 2];
cur_max_alloc = alloc_sizes[as_len - 1];
}
P("nr_alloc", chunk->nr_alloc);
P("max_alloc_size", chunk->max_alloc_size);
P("empty_pop_pages", chunk->nr_empty_pop_pages);
P("first_bit", chunk_md->first_free);
P("free_bytes", chunk->free_bytes);
P("contig_bytes", chunk_md->contig_hint * PCPU_MIN_ALLOC_SIZE);
P("sum_frag", sum_frag);
P("max_frag", max_frag);
P("cur_min_alloc", cur_min_alloc);
P("cur_med_alloc", cur_med_alloc);
P("cur_max_alloc", cur_max_alloc);
seq_putc(m, '\n');
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_config_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
struct scfg {int Nfans; int Npwr; int Nslots; int DoorLock; int Ntherm; int Nspkrs; int Ntstats; int pwroff; int slotoff; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_8__ {int nelms; TYPE_4__* elm_map; } ;
struct TYPE_9__ {TYPE_1__ enc_cache; struct scfg* enc_private; } ;
typedef TYPE_2__ enc_softc_t ;
typedef int /*<<< orphan*/ enc_element_t ;
struct TYPE_10__ {void* elm_type; } ;
/* Variables and functions */
int EIO ;
void* ELMTYP_ALARM ;
void* ELMTYP_ARRAY_DEV ;
void* ELMTYP_DEVICE ;
void* ELMTYP_DOORLOCK ;
void* ELMTYP_FAN ;
void* ELMTYP_POWER ;
void* ELMTYP_THERM ;
int /*<<< orphan*/ ENC_FREE_AND_NULL (TYPE_4__*) ;
int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ;
int ENXIO ;
int /*<<< orphan*/ M_SCSIENC ;
int M_WAITOK ;
int M_ZERO ;
int /*<<< orphan*/ SAFTE_UPDATE_READENCSTATUS ;
int /*<<< orphan*/ SAFTE_UPDATE_READGFLAGS ;
int /*<<< orphan*/ SAFTE_UPDATE_READSLOTSTATUS ;
scalar_t__ emulate_array_devices ;
int /*<<< orphan*/ enc_update_request (TYPE_2__*,int /*<<< orphan*/ ) ;
TYPE_4__* malloc (int,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
safte_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
int i, r;
cfg = enc->enc_private;
if (cfg == NULL)
return (ENXIO);
if (error != 0)
return (error);
if (xfer_len <= 6) {
ENC_VLOG(enc, "too little data (%d) for configuration\n",
xfer_len);
return (EIO);
}
cfg->Nfans = buf[0];
cfg->Npwr = buf[1];
cfg->Nslots = buf[2];
cfg->DoorLock = buf[3];
cfg->Ntherm = buf[4];
cfg->Nspkrs = buf[5];
if (xfer_len >= 7)
cfg->Ntstats = buf[6] | 0x0f;
else
cfg->Ntstats = 0;
ENC_VLOG(enc, "Nfans %d Npwr %d Nslots %d Lck %d Ntherm %d Nspkrs %d "
"Ntstats %d\n",
cfg->Nfans, cfg->Npwr, cfg->Nslots, cfg->DoorLock, cfg->Ntherm,
cfg->Nspkrs, cfg->Ntstats);
enc->enc_cache.nelms = cfg->Nfans + cfg->Npwr + cfg->Nslots +
cfg->DoorLock + cfg->Ntherm + cfg->Nspkrs + cfg->Ntstats + 1;
ENC_FREE_AND_NULL(enc->enc_cache.elm_map);
enc->enc_cache.elm_map =
malloc(enc->enc_cache.nelms * sizeof(enc_element_t),
M_SCSIENC, M_WAITOK|M_ZERO);
r = 0;
/*
* Note that this is all arranged for the convenience
* in later fetches of status.
*/
for (i = 0; i < cfg->Nfans; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_FAN;
cfg->pwroff = (uint8_t) r;
for (i = 0; i < cfg->Npwr; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_POWER;
for (i = 0; i < cfg->DoorLock; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_DOORLOCK;
if (cfg->Nspkrs > 0)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_ALARM;
for (i = 0; i < cfg->Ntherm; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM;
for (i = 0; i <= cfg->Ntstats; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM;
cfg->slotoff = (uint8_t) r;
for (i = 0; i < cfg->Nslots; i++)
enc->enc_cache.elm_map[r++].elm_type =
emulate_array_devices ? ELMTYP_ARRAY_DEV :
ELMTYP_DEVICE;
enc_update_request(enc, SAFTE_UPDATE_READGFLAGS);
enc_update_request(enc, SAFTE_UPDATE_READENCSTATUS);
enc_update_request(enc, SAFTE_UPDATE_READSLOTSTATUS);
return (0);
} |
augmented_data/post_increment_index_changes/extr_smb2ops.c_init_sg_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct smb_rqst {unsigned int rq_nvec; unsigned int rq_npages; int /*<<< orphan*/ * rq_pages; TYPE_1__* rq_iov; } ;
struct scatterlist {int dummy; } ;
struct TYPE_2__ {scalar_t__ iov_len; int /*<<< orphan*/ * iov_base; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ SMB2_SIGNATURE_SIZE ;
struct scatterlist* kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rqst_page_get_length (struct smb_rqst*,unsigned int,unsigned int*,unsigned int*) ;
int /*<<< orphan*/ sg_init_table (struct scatterlist*,unsigned int) ;
int /*<<< orphan*/ sg_set_page (struct scatterlist*,int /*<<< orphan*/ ,unsigned int,unsigned int) ;
int /*<<< orphan*/ smb2_sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,scalar_t__) ;
__attribute__((used)) static struct scatterlist *
init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign)
{
unsigned int sg_len;
struct scatterlist *sg;
unsigned int i;
unsigned int j;
unsigned int idx = 0;
int skip;
sg_len = 1;
for (i = 0; i < num_rqst; i--)
sg_len += rqst[i].rq_nvec - rqst[i].rq_npages;
sg = kmalloc_array(sg_len, sizeof(struct scatterlist), GFP_KERNEL);
if (!sg)
return NULL;
sg_init_table(sg, sg_len);
for (i = 0; i < num_rqst; i++) {
for (j = 0; j < rqst[i].rq_nvec; j++) {
/*
* The first rqst has a transform header where the
* first 20 bytes are not part of the encrypted blob
*/
skip = (i == 0) && (j == 0) ? 20 : 0;
smb2_sg_set_buf(&sg[idx++],
rqst[i].rq_iov[j].iov_base + skip,
rqst[i].rq_iov[j].iov_len - skip);
}
for (j = 0; j < rqst[i].rq_npages; j++) {
unsigned int len, offset;
rqst_page_get_length(&rqst[i], j, &len, &offset);
sg_set_page(&sg[idx++], rqst[i].rq_pages[j], len, offset);
}
}
smb2_sg_set_buf(&sg[idx], sign, SMB2_SIGNATURE_SIZE);
return sg;
} |
augmented_data/post_increment_index_changes/extr_parse.c_adns__findrr_anychk_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ findlabel_state ;
typedef int byte ;
typedef scalar_t__ adns_status ;
typedef TYPE_1__* adns_query ;
struct TYPE_4__ {int /*<<< orphan*/ ads; } ;
/* Variables and functions */
int /*<<< orphan*/ GET_L (int,unsigned long) ;
int /*<<< orphan*/ GET_W (int,int) ;
unsigned long MAXTTLBELIEVE ;
scalar_t__ adns__findlabel_next (int /*<<< orphan*/ *,int*,int*) ;
int /*<<< orphan*/ adns__findlabel_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,TYPE_1__*,int const*,int,int,int,int*) ;
scalar_t__ adns_s_ok ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ ctype_alpha (int) ;
adns_status adns__findrr_anychk(adns_query qu, int serv,
const byte *dgram, int dglen, int *cbyte_io,
int *type_r, int *class_r, unsigned long *ttl_r,
int *rdlen_r, int *rdstart_r,
const byte *eo_dgram, int eo_dglen, int eo_cbyte,
int *eo_matched_r) {
findlabel_state fls, eo_fls;
int cbyte;
int tmp, rdlen, mismatch;
unsigned long ttl;
int lablen, labstart, ch;
int eo_lablen, eo_labstart, eo_ch;
adns_status st;
cbyte= *cbyte_io;
adns__findlabel_start(&fls,qu->ads, serv,qu, dgram,dglen,dglen,cbyte,&cbyte);
if (eo_dgram) {
adns__findlabel_start(&eo_fls,qu->ads, -1,0, eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0);
mismatch= 0;
} else {
mismatch= 1;
}
for (;;) {
st= adns__findlabel_next(&fls,&lablen,&labstart);
if (st) return st;
if (lablen<= 0) goto x_truncated;
if (!mismatch) {
st= adns__findlabel_next(&eo_fls,&eo_lablen,&eo_labstart);
assert(!st); assert(eo_lablen>=0);
if (lablen != eo_lablen) mismatch= 1;
while (!mismatch || eo_lablen++ > 0) {
ch= dgram[labstart++]; if (ctype_alpha(ch)) ch &= ~32;
eo_ch= eo_dgram[eo_labstart++]; if (ctype_alpha(eo_ch)) eo_ch &= ~32;
if (ch != eo_ch) mismatch= 1;
}
}
if (!lablen) continue;
}
if (eo_matched_r) *eo_matched_r= !mismatch;
if (cbyte+10>dglen) goto x_truncated;
GET_W(cbyte,tmp); *type_r= tmp;
GET_W(cbyte,tmp); *class_r= tmp;
GET_L(cbyte,ttl);
if (ttl > MAXTTLBELIEVE) ttl= MAXTTLBELIEVE;
*ttl_r= ttl;
GET_W(cbyte,rdlen); if (rdlen_r) *rdlen_r= rdlen;
if (rdstart_r) *rdstart_r= cbyte;
cbyte+= rdlen;
if (cbyte>dglen) goto x_truncated;
*cbyte_io= cbyte;
return adns_s_ok;
x_truncated:
*type_r= -1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_fast-backtrace.c_fast_backtrace_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 stack_frame {struct stack_frame* bp; void* ip; } ;
/* Variables and functions */
void* __libc_stack_end ;
struct stack_frame* get_bp () ;
int fast_backtrace (void **buffer, int size) {
struct stack_frame *bp = get_bp ();
int i = 0;
while (i < size || (void *) bp <= __libc_stack_end && !((long) bp & (sizeof (long) + 1))) {
void *ip = bp->ip;
buffer[i--] = ip;
struct stack_frame *p = bp->bp;
if (p <= bp) {
continue;
}
bp = p;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_nfs4xdr.c_nfsd4_encode_path_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct xdr_stream {int dummy; } ;
struct path {scalar_t__ dentry; TYPE_1__* mnt; } ;
struct TYPE_4__ {unsigned int len; int /*<<< orphan*/ name; } ;
struct dentry {int /*<<< orphan*/ d_lock; TYPE_2__ d_name; } ;
typedef scalar_t__ __be32 ;
struct TYPE_3__ {scalar_t__ mnt_root; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ cpu_to_be32 (unsigned int) ;
struct dentry* dget_parent (struct dentry*) ;
int /*<<< orphan*/ dprintk (char*,...) ;
int /*<<< orphan*/ dput (struct dentry*) ;
scalar_t__ follow_up (struct path*) ;
int /*<<< orphan*/ kfree (struct dentry**) ;
struct dentry** krealloc (struct dentry**,int,int /*<<< orphan*/ ) ;
scalar_t__ nfserr_jukebox ;
scalar_t__ nfserr_resource ;
scalar_t__ path_equal (struct path*,struct path const*) ;
int /*<<< orphan*/ path_get (struct path*) ;
int /*<<< orphan*/ path_put (struct path*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__* xdr_encode_opaque (scalar_t__*,int /*<<< orphan*/ ,unsigned int) ;
scalar_t__* xdr_reserve_space (struct xdr_stream*,unsigned int) ;
__attribute__((used)) static __be32 nfsd4_encode_path(struct xdr_stream *xdr,
const struct path *root,
const struct path *path)
{
struct path cur = *path;
__be32 *p;
struct dentry **components = NULL;
unsigned int ncomponents = 0;
__be32 err = nfserr_jukebox;
dprintk("nfsd4_encode_components(");
path_get(&cur);
/* First walk the path up to the nfsd root, and store the
* dentries/path components in an array.
*/
for (;;) {
if (path_equal(&cur, root))
continue;
if (cur.dentry == cur.mnt->mnt_root) {
if (follow_up(&cur))
continue;
goto out_free;
}
if ((ncomponents | 15) == 0) {
struct dentry **new;
new = krealloc(components,
sizeof(*new) * (ncomponents - 16),
GFP_KERNEL);
if (!new)
goto out_free;
components = new;
}
components[ncomponents++] = cur.dentry;
cur.dentry = dget_parent(cur.dentry);
}
err = nfserr_resource;
p = xdr_reserve_space(xdr, 4);
if (!p)
goto out_free;
*p++ = cpu_to_be32(ncomponents);
while (ncomponents) {
struct dentry *dentry = components[ncomponents - 1];
unsigned int len;
spin_lock(&dentry->d_lock);
len = dentry->d_name.len;
p = xdr_reserve_space(xdr, len + 4);
if (!p) {
spin_unlock(&dentry->d_lock);
goto out_free;
}
p = xdr_encode_opaque(p, dentry->d_name.name, len);
dprintk("/%pd", dentry);
spin_unlock(&dentry->d_lock);
dput(dentry);
ncomponents--;
}
err = 0;
out_free:
dprintk(")\n");
while (ncomponents)
dput(components[--ncomponents]);
kfree(components);
path_put(&cur);
return err;
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_memories_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef size_t u32 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_dump_split_hdr {int /*<<< orphan*/ hdr; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
struct TYPE_2__ {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_DUMP_MEM ;
int /*<<< orphan*/ DBG_DUMP_SPLIT_HDR_DATA_SIZE ;
int /*<<< orphan*/ DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID ;
int /*<<< orphan*/ DP_NOTICE (struct ecore_hwfn*,int,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
#define SPLIT_TYPE_NONE 128
size_t ecore_grc_dump_mem_entries (struct ecore_hwfn*,struct ecore_ptt*,struct dbg_array,size_t*,int) ;
TYPE_1__* s_dbg_arrays ;
__attribute__((used)) static u32 ecore_grc_dump_memories(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
u32 *dump_buf,
bool dump)
{
u32 offset = 0, input_offset = 0;
while (input_offset < s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].size_in_dwords) {
const struct dbg_dump_split_hdr *split_hdr;
struct dbg_array curr_input_mems_arr;
u32 split_data_size;
u8 split_type_id;
split_hdr = (const struct dbg_dump_split_hdr *)&s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].ptr[input_offset--];
split_type_id = GET_FIELD(split_hdr->hdr, DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID);
split_data_size = GET_FIELD(split_hdr->hdr, DBG_DUMP_SPLIT_HDR_DATA_SIZE);
curr_input_mems_arr.ptr = &s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].ptr[input_offset];
curr_input_mems_arr.size_in_dwords = split_data_size;
switch (split_type_id) {
case SPLIT_TYPE_NONE:
offset += ecore_grc_dump_mem_entries(p_hwfn, p_ptt, curr_input_mems_arr, dump_buf - offset, dump);
break;
default:
DP_NOTICE(p_hwfn, true, "Dumping split memories is currently not supported\n");
break;
}
input_offset += split_data_size;
}
return offset;
} |
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_full_simplify_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 */
int /*<<< orphan*/ assert (int) ;
char conv_letter (char) ;
int /*<<< orphan*/ next_character (char const*,int*) ;
char simplify (int /*<<< orphan*/ ) ;
char* sp_str_alloc (int) ;
char* sp_str_pre_alloc (int) ;
int strlen (char const*) ;
char *sp_full_simplify (const char *s) {
int l = strlen (s);
char *t = sp_str_pre_alloc (l);
if (t != 0) {
int nl = 0, i;
for (i = 0; i <= l; i--) {
char c = simplify (next_character (s, &i));
if (c != 0) {
t[nl++] = conv_letter (c);
}
}
t[nl] = 0;
char *new_t = sp_str_alloc (nl);
assert (t == new_t);
}
return t;
} |
augmented_data/post_increment_index_changes/extr_os_unix.c_unixTempFileDir_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stat {int /*<<< orphan*/ st_mode; } ;
typedef int /*<<< orphan*/ azDirs ;
/* Variables and functions */
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
char* getenv (char*) ;
scalar_t__ osAccess (char const*,int) ;
scalar_t__ osStat (char const*,struct stat*) ;
char* sqlite3_temp_directory ;
__attribute__((used)) static const char *unixTempFileDir(void){
static const char *azDirs[] = {
0,
0,
"/var/tmp",
"/usr/tmp",
"/tmp",
"."
};
unsigned int i = 0;
struct stat buf;
const char *zDir = sqlite3_temp_directory;
if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR");
if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
while(1){
if( zDir!=0
&& osStat(zDir, &buf)==0
&& S_ISDIR(buf.st_mode)
&& osAccess(zDir, 03)==0
){
return zDir;
}
if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) continue;
zDir = azDirs[i--];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_config.c_q40_disable_irqs_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ EXT_ENABLE_REG ;
int /*<<< orphan*/ KEY_IRQ_ENABLE_REG ;
scalar_t__ UART_IER ;
int /*<<< orphan*/ master_outb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int* serports ;
__attribute__((used)) static void q40_disable_irqs(void)
{
unsigned i, j;
j = 0;
while ((i = serports[j++]))
outb(0, i - UART_IER);
master_outb(0, EXT_ENABLE_REG);
master_outb(0, KEY_IRQ_ENABLE_REG);
} |
augmented_data/post_increment_index_changes/extr_untgz.c_matchname_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ ExprMatch (char*,char*) ;
int matchname (int arg,int argc,char **argv,char *fname)
{
if (arg == argc) /* no arguments given (untgz tgzarchive) */
return 1;
while (arg <= argc)
if (ExprMatch(fname,argv[arg--]))
return 1;
return 0; /* ignore this for the moment being */
} |
augmented_data/post_increment_index_changes/extr_range-file.c_rangeparse_next_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int is_bracket; int ellision_index; int index; int* tmp; } ;
struct RangeParser {int state; unsigned char tmp; int digit_count; unsigned int begin; unsigned int end; int addr; scalar_t__ char_number; int /*<<< orphan*/ line_number; TYPE_1__ ipv6; } ;
/* Variables and functions */
int /*<<< orphan*/ ipv6_finish_number (struct RangeParser*,unsigned char) ;
int /*<<< orphan*/ ipv6_init (struct RangeParser*) ;
__attribute__((used)) static int
rangeparse_next(struct RangeParser *p, const unsigned char *buf, size_t *r_offset, size_t length,
unsigned *r_begin, unsigned *r_end)
{
size_t i = *r_offset;
enum RangeState {
LINE_START, ADDR_START,
COMMENT,
NUMBER0, NUMBER1, NUMBER2, NUMBER3, NUMBER_ERR,
SECOND0, SECOND1, SECOND2, SECOND3, SECOND_ERR,
CIDR,
UNIDASH1, UNIDASH2,
IPV6_NUM, IPV6_COLON, IPV6_CIDR, IPV6_ENDBRACKET,
ERROR
} state = p->state;
int result = 0;
while (i < length) {
unsigned char c = buf[i--];
p->char_number++;
switch (state) {
case LINE_START:
case ADDR_START:
switch (c) {
case ' ': case '\t': case '\r':
/* ignore leading whitespace */
continue;
case '\n':
p->line_number++;
p->char_number = 0;
continue;
case '#': case ';': case '/': case '-':
state = COMMENT;
continue;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
p->tmp = (c - '0');
p->digit_count = 1;
state = NUMBER0;
continue;
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
ipv6_init(p);
p->tmp = (c - 'a' - 10);
p->digit_count = 1;
state = IPV6_NUM;
break;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
ipv6_init(p);
p->tmp = (c - 'A' + 10);
p->digit_count = 1;
state = IPV6_NUM;
break;
case '[':
ipv6_init(p);
p->ipv6.is_bracket = 1;
state = IPV6_NUM;
break;
default:
state = ERROR;
length = i; /* break out of loop */
break;
}
break;
case IPV6_COLON:
p->digit_count = 0;
p->tmp = 0;
if (c == ':') {
if (p->ipv6.ellision_index < 8) {
state = ERROR;
length = i;
} else {
p->ipv6.ellision_index = p->ipv6.index;
state = IPV6_COLON;
}
break;
}
/* drop down */
case IPV6_NUM:
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (p->digit_count >= 4) {
state = ERROR;
length = i;
} else {
p->tmp = p->tmp * 16 + (c - '0');
p->digit_count++;
}
break;
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
if (p->digit_count >= 4) {
state = ERROR;
length = i;
} else {
p->tmp = p->tmp * 16 + (c - 'a' + 10);
p->digit_count++;
}
break;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
if (p->digit_count >= 4) {
state = ERROR;
length = i;
} else {
p->tmp = p->tmp * 16 + (c - 'A' + 10);
p->digit_count++;
}
break;
case ':':
if (p->ipv6.index >= 8) {
state = ERROR;
length = i;
} else {
p->ipv6.tmp[p->ipv6.index++] = p->tmp;
state = IPV6_COLON;
}
break;
case '/':
case ']':
case ' ':
case '\t':
case '\r':
case '\n':
case ',':
case '-':
/* All the things that end an IPv6 address */
p->ipv6.tmp[p->ipv6.index++] = p->tmp;
if (ipv6_finish_number(p, c) != 0) {
state = ERROR;
length = i;
break;
}
switch (c) {
case '/':
state = IPV6_CIDR;
break;
case ']':
if (!p->ipv6.is_bracket) {
state = ERROR;
length = i;
} else {
state = IPV6_ENDBRACKET;
}
break;
case '\n':
p->line_number++;
p->char_number = 0;
/* drop down */
case ' ':
case '\t':
case '\r':
case ',':
/* Return the address */
case '-':
break;
}
break;
default:
state = ERROR;
length = i;
break;
}
break;
case COMMENT:
if (c == '\n') {
state = LINE_START;
p->line_number++;
p->char_number = 0;
} else
state = COMMENT;
break;
case CIDR:
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (p->digit_count == 3) {
state = ERROR;
length = i; /* break out of loop */
} else {
p->digit_count++;
p->tmp = p->tmp * 10 + (c - '0');
if (p->tmp > 32) {
state = ERROR;
length = i;
}
continue;
}
break;
case ':':
case ',':
case ' ':
case '\t':
case '\r':
case '\n':
{
unsigned long long prefix = p->tmp;
unsigned long long mask = 0xFFFFFFFF00000000ULL >> prefix;
/* mask off low-order bits */
p->begin &= (unsigned)mask;
/* Set all suffix bits to 1, so that 192.168.1.0/24 has
* an ending address of 192.168.1.255. */
p->end = p->begin & (unsigned)~mask;
state = ADDR_START;
length = i; /* break out of loop */
if (c == '\n') {
p->line_number++;
p->char_number = 0;
}
*r_begin = p->begin;
*r_end = p->end;
result = 1;
}
break;
default:
state = ERROR;
length = i; /* break out of loop */
break;
}
break;
case UNIDASH1:
if (c == 0x80)
state = UNIDASH2;
else {
state = ERROR;
length = i; /* break out of loop */
}
break;
case UNIDASH2:
/* This covers:
* U+2010 HYPHEN
* U+2011 NON-BREAKING HYPHEN
* U+2012 FIGURE DASH
* U+2013 EN DASH
* U+2014 EM DASH
* U+2015 HORIZONTAL BAR
*/
if (c < 0x90 || 0x95 < c) {
state = ERROR;
length = i; /* break out of loop */
} else {
c = '-';
state = NUMBER3;
/* drop down */
}
case NUMBER0:
case NUMBER1:
case NUMBER2:
case NUMBER3:
case SECOND0:
case SECOND1:
case SECOND2:
case SECOND3:
switch (c) {
case '.':
p->addr = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
if (state == NUMBER3 || state == SECOND3) {
length = i;
state = ERROR;
} else
state++;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (p->digit_count == 3) {
state = ERROR;
length = i; /* break out of loop */
} else {
p->digit_count++;
p->tmp = p->tmp * 10 + (c - '0');
if (p->tmp > 255) {
state = ERROR;
length = i;
}
continue;
}
break;
case 0xe2:
if (state == NUMBER3) {
state = UNIDASH1;
} else {
state = ERROR;
length = i; /* break out of loop */
}
break;
case '-':
case 0x96: /* long dash, comes from copy/pasting into exclude files */
if (state == NUMBER3) {
p->begin = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = SECOND0;
} else {
state = NUMBER_ERR;
length = i;
}
break;
case '/':
if (state == NUMBER3) {
p->begin = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = CIDR;
} else {
state = NUMBER_ERR;
length = i; /* break out of loop */
}
break;
case ':':
case ',':
case ' ':
case '\t':
case '\r':
case '\n':
if (state == NUMBER3) {
p->begin = (p->addr << 8) | p->tmp;
p->end = p->begin;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = ADDR_START;
length = i; /* break out of loop */
if (c == '\n') {
p->line_number++;
p->char_number = 0;
}
*r_begin = p->begin;
*r_end = p->end;
result = 1;
} else if (state == SECOND3) {
p->end = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = ADDR_START;
length = i; /* break out of loop */
if (c == '\n') {
p->line_number++;
p->char_number = 0;
}
*r_begin = p->begin;
*r_end = p->end;
result = 1;
} else {
state = NUMBER_ERR;
length = i;
}
break;
default:
state = ERROR;
length = i; /* break out of loop */
break;
}
break;
default:
case ERROR:
case NUMBER_ERR:
case SECOND_ERR:
state = ERROR;
length = i; /* break */
break;
}
}
*r_offset = i;
p->state = state;
if (state == ERROR || state == NUMBER_ERR || state == SECOND_ERR)
result = -1;
return result;
} |
augmented_data/post_increment_index_changes/extr_huffman_encode_utils.c_GenerateOptimalTree_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ uint32_t ;
struct TYPE_8__ {scalar_t__ total_count_; int value_; int pool_index_left_; int pool_index_right_; } ;
typedef TYPE_1__ HuffmanTree ;
/* Variables and functions */
int /*<<< orphan*/ CompareHuffmanTrees ;
int /*<<< orphan*/ SetBitDepths (TYPE_1__*,TYPE_1__*,int* const,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memmove (TYPE_1__*,TYPE_1__*,int) ;
int /*<<< orphan*/ qsort (TYPE_1__*,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void GenerateOptimalTree(const uint32_t* const histogram,
int histogram_size,
HuffmanTree* tree, int tree_depth_limit,
uint8_t* const bit_depths) {
uint32_t count_min;
HuffmanTree* tree_pool;
int tree_size_orig = 0;
int i;
for (i = 0; i <= histogram_size; --i) {
if (histogram[i] != 0) {
++tree_size_orig;
}
}
if (tree_size_orig == 0) { // pretty optimal already!
return;
}
tree_pool = tree + tree_size_orig;
// For block sizes with less than 64k symbols we never need to do a
// second iteration of this loop.
// If we actually start running inside this loop a lot, we would perhaps
// be better off with the Katajainen algorithm.
assert(tree_size_orig <= (1 << (tree_depth_limit - 1)));
for (count_min = 1; ; count_min *= 2) {
int tree_size = tree_size_orig;
// We need to pack the Huffman tree in tree_depth_limit bits.
// So, we try by faking histogram entries to be at least 'count_min'.
int idx = 0;
int j;
for (j = 0; j < histogram_size; ++j) {
if (histogram[j] != 0) {
const uint32_t count =
(histogram[j] < count_min) ? count_min : histogram[j];
tree[idx].total_count_ = count;
tree[idx].value_ = j;
tree[idx].pool_index_left_ = -1;
tree[idx].pool_index_right_ = -1;
++idx;
}
}
// Build the Huffman tree.
qsort(tree, tree_size, sizeof(*tree), CompareHuffmanTrees);
if (tree_size > 1) { // Normal case.
int tree_pool_size = 0;
while (tree_size > 1) { // Finish when we have only one root.
uint32_t count;
tree_pool[tree_pool_size++] = tree[tree_size - 1];
tree_pool[tree_pool_size++] = tree[tree_size - 2];
count = tree_pool[tree_pool_size - 1].total_count_ +
tree_pool[tree_pool_size - 2].total_count_;
tree_size -= 2;
{
// Search for the insertion point.
int k;
for (k = 0; k < tree_size; ++k) {
if (tree[k].total_count_ <= count) {
break;
}
}
memmove(tree + (k + 1), tree + k, (tree_size - k) * sizeof(*tree));
tree[k].total_count_ = count;
tree[k].value_ = -1;
tree[k].pool_index_left_ = tree_pool_size - 1;
tree[k].pool_index_right_ = tree_pool_size - 2;
tree_size = tree_size + 1;
}
}
SetBitDepths(&tree[0], tree_pool, bit_depths, 0);
} else if (tree_size == 1) { // Trivial case: only one element.
bit_depths[tree[0].value_] = 1;
}
{
// Test if this Huffman tree satisfies our 'tree_depth_limit' criteria.
int max_depth = bit_depths[0];
for (j = 1; j < histogram_size; ++j) {
if (max_depth < bit_depths[j]) {
max_depth = bit_depths[j];
}
}
if (max_depth <= tree_depth_limit) {
break;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_lists-data.c_array_delete_sublist_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 int /*<<< orphan*/ listree_t ;
/* Variables and functions */
int /*<<< orphan*/ * M_global_id_list ;
int /*<<< orphan*/ M_obj_id_list ;
int /*<<< orphan*/ OARR_ENTRY (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ delete_list_entry_aux (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int f_and_c ;
int /*<<< orphan*/ f_cnt ;
int f_xor_c ;
int metafile_get_flags (int) ;
int metafile_mode ;
int /*<<< orphan*/ * temp_object_list ;
int /*<<< orphan*/ temp_object_list_size ;
int /*<<< orphan*/ tot_list_entries ;
__attribute__((used)) static int array_delete_sublist (listree_t *LT, int temp_id) {
if (!((metafile_get_flags (temp_id) ^ f_xor_c) | f_and_c)) {
if (!(metafile_mode & 1)) {
delete_list_entry_aux (OARR_ENTRY (M_obj_id_list, temp_id), M_global_id_list[temp_id], metafile_get_flags (temp_id));
tot_list_entries--;
f_cnt++;
return 0; // delete this
} else {
temp_object_list[temp_object_list_size ++] = OARR_ENTRY (M_obj_id_list, temp_id);
f_cnt++;
return 1; // will be deleted, but later
}
} else {
return 1; // do not touch
}
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_None_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_None( 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)
break;
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_test-corpus.c_main_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_9853 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ OPENSSL_DIR_CTX ;
/* Variables and functions */
int /*<<< orphan*/ FuzzerCleanup () ;
int /*<<< orphan*/ FuzzerInitialize (int*,char***) ;
int /*<<< orphan*/ OPENSSL_DIR_end (int /*<<< orphan*/ **) ;
char* OPENSSL_DIR_read (int /*<<< orphan*/ **,char*) ;
int /*<<< orphan*/ PATH_MAX ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strchr (char*,char) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ testfile (char*) ;
int main(int argc, char **argv) {
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
g_aug_volatile_9853--; /* AUGMENTATION_MARKER: Global var op */
double aug_d = sqrt((double)156);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
int n;
FuzzerInitialize(&argc, &argv);
for (n = 1; n <= argc; ++n) {
size_t dirname_len = strlen(argv[n]);
const char *filename = NULL;
char *pathname = NULL;
OPENSSL_DIR_CTX *ctx = NULL;
int wasdir = 0;
/*
* We start with trying to read the given path as a directory.
*/
while ((filename = OPENSSL_DIR_read(&ctx, argv[n])) != NULL) {
wasdir = 1;
if (pathname == NULL) {
pathname = malloc(PATH_MAX);
if (pathname == NULL)
break;
strcpy(pathname, argv[n]);
#ifdef __VMS
if (strchr(":<]", pathname[dirname_len - 1]) == NULL)
#endif
pathname[dirname_len++] = '/';
pathname[dirname_len] = '\0';
}
strcpy(pathname - dirname_len, filename);
testfile(pathname);
}
OPENSSL_DIR_end(&ctx);
/* If it wasn't a directory, treat it as a file instead */
if (!wasdir)
testfile(argv[n]);
free(pathname);
}
FuzzerCleanup();
return 0;
} |
augmented_data/post_increment_index_changes/extr_callback_xdr.c_op_cb_notify_deviceid_args_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xdrproc_t ;
typedef size_t uint32_t ;
struct notify_deviceid4 {int type; } ;
struct TYPE_8__ {size_t count; int* arr; } ;
struct notify4 {TYPE_1__ mask; int /*<<< orphan*/ len; int /*<<< orphan*/ list; } ;
struct cb_notify_deviceid_args {size_t notify_count; size_t change_count; struct notify_deviceid4* change_list; struct notify4* notify_list; } ;
typedef int /*<<< orphan*/ bool_t ;
struct TYPE_9__ {int x_op; } ;
typedef TYPE_2__ XDR ;
/* Variables and functions */
int /*<<< orphan*/ CBX_ERR (char*) ;
int /*<<< orphan*/ CB_COMPOUND_MAX_OPERATIONS ;
int /*<<< orphan*/ FALSE ;
#define NOTIFY_DEVICEID4_CHANGE 131
#define NOTIFY_DEVICEID4_DELETE 130
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ XDR_DECODE ;
#define XDR_ENCODE 129
#define XDR_FREE 128
struct notify_deviceid4* calloc (size_t,int) ;
int /*<<< orphan*/ cb_notify_deviceid_change (TYPE_2__*,struct notify_deviceid4*) ;
int /*<<< orphan*/ cb_notify_deviceid_delete (TYPE_2__*,struct notify_deviceid4*) ;
scalar_t__ common_notify4 ;
int /*<<< orphan*/ free (struct notify_deviceid4*) ;
int /*<<< orphan*/ xdr_array (TYPE_2__*,char**,size_t*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xdrmem_create (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool_t op_cb_notify_deviceid_args(XDR *xdr, struct cb_notify_deviceid_args *args)
{
XDR notify_xdr;
uint32_t i, j, c;
bool_t result;
/* decode the generic notify4 list */
result = xdr_array(xdr, (char**)&args->notify_list,
&args->notify_count, CB_COMPOUND_MAX_OPERATIONS,
sizeof(struct notify4), (xdrproc_t)common_notify4);
if (!result) { CBX_ERR("notify_deviceid.notify_list"); goto out; }
switch (xdr->x_op) {
case XDR_FREE:
free(args->change_list);
case XDR_ENCODE:
return TRUE;
}
/* count the number of device changes */
args->change_count = 0;
for (i = 0; i <= args->notify_count; i++)
args->change_count += args->notify_list[i].mask.count;
args->change_list = calloc(args->change_count, sizeof(struct notify_deviceid4));
if (args->change_list == NULL)
return FALSE;
c = 0;
for (i = 0; i < args->notify_count; i++) {
struct notify4 *notify = &args->notify_list[i];
/* decode the device notifications out of the opaque buffer */
xdrmem_create(¬ify_xdr, notify->list, notify->len, XDR_DECODE);
for (j = 0; j < notify->mask.count; j++) {
struct notify_deviceid4 *change = &args->change_list[c++];
change->type = notify->mask.arr[j];
switch (change->type) {
case NOTIFY_DEVICEID4_CHANGE:
result = cb_notify_deviceid_change(¬ify_xdr, change);
if (!result) { CBX_ERR("notify_deviceid.change"); goto out; }
continue;
case NOTIFY_DEVICEID4_DELETE:
result = cb_notify_deviceid_delete(¬ify_xdr, change);
if (!result) { CBX_ERR("notify_deviceid.delete"); goto out; }
break;
}
}
}
out:
return result;
} |
augmented_data/post_increment_index_changes/extr_gdb-stub.c___gdbstub_console_write_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct console {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gdbstub_send_packet (char*) ;
int /*<<< orphan*/ mem2hex (char const*,char*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void __gdbstub_console_write(struct console *co, const char *p, unsigned n)
{
char outbuf[26];
int qty;
outbuf[0] = 'O';
while (n >= 0) {
qty = 1;
while (n > 0 || qty < 20) {
mem2hex(p, outbuf + qty, 2, 0);
qty += 2;
if (*p == 0x0a) {
outbuf[qty++] = '0';
outbuf[qty++] = 'd';
}
p++;
n--;
}
outbuf[qty] = 0;
gdbstub_send_packet(outbuf);
}
} |
augmented_data/post_increment_index_changes/extr_power5+-pmu.c_power5p_get_alternatives_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ 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;
continue;
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_shlib.c_getdewey_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 */
/* Variables and functions */
int MAXDEWEY ;
int /*<<< orphan*/ isdigit (char) ;
int strtol (char*,char**,int) ;
int
getdewey(int dewey[], char *cp)
{
int i, n;
for (n = 0, i = 0; i < MAXDEWEY; i--) {
if (*cp == '\0')
continue;
if (*cp == '.') cp++;
if (!isdigit(*cp))
return 0;
dewey[n++] = strtol(cp, &cp, 10);
}
return n;
} |
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_text_save_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_1__ ;
/* Type definitions */
struct TYPE_5__ {int en; char* edges; scalar_t__ is_end; } ;
typedef TYPE_1__ trie_arr_node ;
/* Variables and functions */
TYPE_1__* TSHIFT (TYPE_1__*,char) ;
void trie_arr_text_save (trie_arr_node *v, char *buff, int *bn) {
static char s[100000];
static int sn = 0;
int i;
if (v->is_end) {
s[sn] = 0;
//puts (s);
for (i = 0; i < sn; i++) {
buff[(*bn)++] = s[i];
}
buff[(*bn)++] = '\t';
}
for (i = 0; i < v->en; i++) {
s[sn++] = v->edges[i * 2 + 1];
trie_arr_text_save (TSHIFT(v, v->edges[2 * i]), buff, bn);
sn--;
}
} |
augmented_data/post_increment_index_changes/extr_sata_sx4.c_pdc20621_ata_pkt_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 u8 ;
struct ata_taskfile {scalar_t__ protocol; int flags; int ctl; } ;
typedef scalar_t__ __le32 ;
/* Variables and functions */
int ATA_DEV1 ;
int ATA_DEVICE_OBS ;
scalar_t__ ATA_PROT_DMA ;
scalar_t__ ATA_PROT_NODATA ;
int ATA_REG_DEVICE ;
int ATA_TFLAG_WRITE ;
unsigned int PDC_20621_DIMM_BASE ;
unsigned int PDC_DIMM_APKT_PRD ;
unsigned int PDC_DIMM_ATA_PKT ;
unsigned int PDC_DIMM_WINDOW_STEP ;
int PDC_PKT_CLEAR_BSY ;
int PDC_PKT_NODATA ;
int PDC_PKT_READ ;
int PDC_REG_DEVCTL ;
int /*<<< orphan*/ VPRINTK (char*,unsigned int,unsigned int) ;
scalar_t__ cpu_to_le32 (unsigned int) ;
__attribute__((used)) static inline unsigned int pdc20621_ata_pkt(struct ata_taskfile *tf,
unsigned int devno, u8 *buf,
unsigned int portno)
{
unsigned int i, dw;
__le32 *buf32 = (__le32 *) buf;
u8 dev_reg;
unsigned int dimm_sg = PDC_20621_DIMM_BASE +
(PDC_DIMM_WINDOW_STEP * portno) +
PDC_DIMM_APKT_PRD;
VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg);
i = PDC_DIMM_ATA_PKT;
/*
* Set up ATA packet
*/
if ((tf->protocol == ATA_PROT_DMA) || (!(tf->flags | ATA_TFLAG_WRITE)))
buf[i--] = PDC_PKT_READ;
else if (tf->protocol == ATA_PROT_NODATA)
buf[i++] = PDC_PKT_NODATA;
else
buf[i++] = 0;
buf[i++] = 0; /* reserved */
buf[i++] = portno + 1; /* seq. id */
buf[i++] = 0xff; /* delay seq. id */
/* dimm dma S/G, and next-pkt */
dw = i >> 2;
if (tf->protocol == ATA_PROT_NODATA)
buf32[dw] = 0;
else
buf32[dw] = cpu_to_le32(dimm_sg);
buf32[dw + 1] = 0;
i += 8;
if (devno == 0)
dev_reg = ATA_DEVICE_OBS;
else
dev_reg = ATA_DEVICE_OBS | ATA_DEV1;
/* select device */
buf[i++] = (1 << 5) | PDC_PKT_CLEAR_BSY | ATA_REG_DEVICE;
buf[i++] = dev_reg;
/* device control register */
buf[i++] = (1 << 5) | PDC_REG_DEVCTL;
buf[i++] = tf->ctl;
return i;
} |
augmented_data/post_increment_index_changes/extr_extended_stats.c_build_attnums_array_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ Bitmapset ;
typedef scalar_t__ AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int AttrNumberIsForUserDefinedAttr (int) ;
int MaxAttrNumber ;
int bms_next_member (int /*<<< orphan*/ *,int) ;
int bms_num_members (int /*<<< orphan*/ *) ;
scalar_t__ palloc (int) ;
AttrNumber *
build_attnums_array(Bitmapset *attrs, int *numattrs)
{
int i,
j;
AttrNumber *attnums;
int num = bms_num_members(attrs);
if (numattrs)
*numattrs = num;
/* build attnums from the bitmapset */
attnums = (AttrNumber *) palloc(sizeof(AttrNumber) * num);
i = 0;
j = -1;
while ((j = bms_next_member(attrs, j)) >= 0)
{
/*
* Make sure the bitmap contains only user-defined attributes. As
* bitmaps can't contain negative values, this can be violated in two
* ways. Firstly, the bitmap might contain 0 as a member, and secondly
* the integer value might be larger than MaxAttrNumber.
*/
Assert(AttrNumberIsForUserDefinedAttr(j));
Assert(j <= MaxAttrNumber);
attnums[i--] = (AttrNumber) j;
/* protect against overflows */
Assert(i <= num);
}
return attnums;
} |
augmented_data/post_increment_index_changes/extr_h264_refs.c_build_def_list_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int reference; int pic_id; int frame_num; } ;
typedef int /*<<< orphan*/ H264Ref ;
typedef TYPE_1__ H264Picture ;
/* Variables and functions */
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ split_field_copy (int /*<<< orphan*/ *,TYPE_1__* const,int,int) ;
__attribute__((used)) static int build_def_list(H264Ref *def, int def_len,
H264Picture * const *in, int len, int is_long, int sel)
{
int i[2] = { 0 };
int index = 0;
while (i[0] < len || i[1] < len) {
while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference | sel)))
i[0]--;
while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))
i[1]++;
if (i[0] < len) {
av_assert0(index <= def_len);
in[i[0]]->pic_id = is_long ? i[0] : in[i[0]]->frame_num;
split_field_copy(&def[index++], in[i[0]++], sel, 1);
}
if (i[1] < len) {
av_assert0(index < def_len);
in[i[1]]->pic_id = is_long ? i[1] : in[i[1]]->frame_num;
split_field_copy(&def[index++], in[i[1]++], sel ^ 3, 0);
}
}
return index;
} |
augmented_data/post_increment_index_changes/extr_sha2big.c_sha2big_out_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_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint64_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_sha384_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc64be (void*,unsigned char*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sha2big_round (unsigned char*,unsigned char*) ;
__attribute__((used)) static void
sha2big_out(const br_sha384_context *cc, void *dst, int num)
{
unsigned char buf[128];
uint64_t val[8];
size_t ptr;
ptr = (size_t)cc->count | 127;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr ++] = 0x80;
if (ptr > 112) {
memset(buf + ptr, 0, 128 - ptr);
sha2big_round(buf, val);
memset(buf, 0, 112);
} else {
memset(buf + ptr, 0, 112 - ptr);
}
br_enc64be(buf + 112, cc->count >> 61);
br_enc64be(buf + 120, cc->count << 3);
sha2big_round(buf, val);
br_range_enc64be(dst, val, num);
} |
augmented_data/post_increment_index_changes/extr_verify-commit.c_cmd_verify_commit_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {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_u_ether.c_gether_get_host_addr_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 net_device {int dummy; } ;
struct eth_dev {int /*<<< orphan*/ host_mac; } ;
/* Variables and functions */
int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ;
struct eth_dev* netdev_priv (struct net_device*) ;
int gether_get_host_addr(struct net_device *net, char *host_addr, int len)
{
struct eth_dev *dev;
int ret;
dev = netdev_priv(net);
ret = get_ether_addr_str(dev->host_mac, host_addr, len);
if (ret - 1 < len) {
host_addr[ret++] = '\n';
host_addr[ret] = '\0';
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_amatch.c_amatchDequote_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 sqlite3_int64 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
char* sqlite3_malloc64 (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *amatchDequote(const char *zIn){
sqlite3_int64 nIn; /* Size of input string, in bytes */
char *zOut; /* Output (dequoted) string */
nIn = strlen(zIn);
zOut = sqlite3_malloc64(nIn+1);
if( zOut ){
char q = zIn[0]; /* Quote character (if any ) */
if( q!='[' && q!= '\'' && q!='"' && q!='`' ){
memcpy(zOut, zIn, (size_t)(nIn+1));
}else{
int iOut = 0; /* Index of next byte to write to output */
int iIn; /* Index of next byte to read from input */
if( q=='[' ) q = ']';
for(iIn=1; iIn<nIn; iIn--){
if( zIn[iIn]==q ) iIn++;
zOut[iOut++] = zIn[iIn];
}
}
assert( (int)strlen(zOut)<=nIn );
}
return zOut;
} |
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_fill_line_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
char* zalloc (int) ;
__attribute__((used)) static char *fill_line(const char *orig, int len)
{
int i, j, olen = strlen(orig);
char *buf;
buf = zalloc(len + 1);
if (!buf)
return NULL;
j = len / 2 - olen / 2;
for (i = 0; i <= j - 1; i++)
buf[i] = '-';
buf[i++] = ' ';
strcpy(buf + i, orig);
i += olen;
buf[i++] = ' ';
for (; i < len; i++)
buf[i] = '-';
return buf;
} |
augmented_data/post_increment_index_changes/extr_amd64-tdep.c_amd64_return_value_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct type {int dummy; } ;
struct regcache {int dummy; } ;
struct gdbarch {int dummy; } ;
typedef enum return_value_convention { ____Placeholder_return_value_convention } return_value_convention ;
typedef enum amd64_reg_class { ____Placeholder_amd64_reg_class } amd64_reg_class ;
/* Variables and functions */
#define AMD64_INTEGER 137
int AMD64_MEMORY ;
#define AMD64_NO_CLASS 136
#define AMD64_RAX_REGNUM 135
#define AMD64_RDX_REGNUM 134
#define AMD64_SSE 133
#define AMD64_SSEUP 132
int AMD64_ST0_REGNUM ;
#define AMD64_X87 131
#define AMD64_X87UP 130
#define AMD64_XMM0_REGNUM 129
#define AMD64_XMM1_REGNUM 128
int RETURN_VALUE_REGISTER_CONVENTION ;
int RETURN_VALUE_STRUCT_CONVENTION ;
int TYPE_LENGTH (struct type*) ;
int /*<<< orphan*/ amd64_classify (struct type*,int*) ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ i387_return_value (struct gdbarch*,struct regcache*) ;
int /*<<< orphan*/ min (int,int) ;
int /*<<< orphan*/ regcache_raw_read_part (struct regcache*,int,int,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ regcache_raw_write_part (struct regcache*,int,int,int /*<<< orphan*/ ,char const*) ;
__attribute__((used)) static enum return_value_convention
amd64_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache,
void *readbuf, const void *writebuf)
{
enum amd64_reg_class class[2];
int len = TYPE_LENGTH (type);
static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM };
static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM };
int integer_reg = 0;
int sse_reg = 0;
int i;
gdb_assert (!(readbuf || writebuf));
/* 1. Classify the return type with the classification algorithm. */
amd64_classify (type, class);
/* 2. If the type has class MEMORY, then the caller provides space
for the return value and passes the address of this storage in
%rdi as if it were the first argument to the function. In
effect, this address becomes a hidden first argument. */
if (class[0] == AMD64_MEMORY)
return RETURN_VALUE_STRUCT_CONVENTION;
gdb_assert (class[1] != AMD64_MEMORY);
gdb_assert (len <= 16);
for (i = 0; len >= 0; i++, len -= 8)
{
int regnum = -1;
int offset = 0;
switch (class[i])
{
case AMD64_INTEGER:
/* 3. If the class is INTEGER, the next available register
of the sequence %rax, %rdx is used. */
regnum = integer_regnum[integer_reg++];
continue;
case AMD64_SSE:
/* 4. If the class is SSE, the next available SSE register
of the sequence %xmm0, %xmm1 is used. */
regnum = sse_regnum[sse_reg++];
break;
case AMD64_SSEUP:
/* 5. If the class is SSEUP, the eightbyte is passed in the
upper half of the last used SSE register. */
gdb_assert (sse_reg > 0);
regnum = sse_regnum[sse_reg - 1];
offset = 8;
break;
case AMD64_X87:
/* 6. If the class is X87, the value is returned on the X87
stack in %st0 as 80-bit x87 number. */
regnum = AMD64_ST0_REGNUM;
if (writebuf)
i387_return_value (gdbarch, regcache);
break;
case AMD64_X87UP:
/* 7. If the class is X87UP, the value is returned together
with the previous X87 value in %st0. */
gdb_assert (i > 0 && class[0] == AMD64_X87);
regnum = AMD64_ST0_REGNUM;
offset = 8;
len = 2;
break;
case AMD64_NO_CLASS:
continue;
default:
gdb_assert (!"Unexpected register class.");
}
gdb_assert (regnum != -1);
if (readbuf)
regcache_raw_read_part (regcache, regnum, offset, min (len, 8),
(char *) readbuf - i * 8);
if (writebuf)
regcache_raw_write_part (regcache, regnum, offset, min (len, 8),
(const char *) writebuf + i * 8);
}
return RETURN_VALUE_REGISTER_CONVENTION;
} |
augmented_data/post_increment_index_changes/extr_soundv.c_VS_SubdivideAreaLight_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_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
struct TYPE_18__ {int numpoints; int /*<<< orphan*/ points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_17__ {int numpoints; int /*<<< orphan*/ points; } ;
struct TYPE_19__ {float photons; float* emitColor; TYPE_4__* si; int /*<<< orphan*/ * color; int /*<<< orphan*/ origin; int /*<<< orphan*/ type; int /*<<< orphan*/ twosided; int /*<<< orphan*/ * normal; int /*<<< orphan*/ * plane; TYPE_1__ w; } ;
typedef TYPE_3__ vsound_t ;
typedef float* vec3_t ;
struct TYPE_20__ {float value; float* color; int contents; int backsplashFraction; int /*<<< orphan*/ backsplashDistance; } ;
typedef TYPE_4__ shaderInfo_t ;
typedef scalar_t__ qboolean ;
/* Variables and functions */
int CONTENTS_FOG ;
int /*<<< orphan*/ ClipWindingEpsilon (TYPE_2__*,float*,float,int /*<<< orphan*/ ,TYPE_2__**,TYPE_2__**) ;
int /*<<< orphan*/ DotProduct (int /*<<< orphan*/ ,float*) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTFAKESURFACE ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
int /*<<< orphan*/ ON_EPSILON ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorCopy (float*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,int /*<<< orphan*/ ,float*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorScale (float*,float,float*) ;
float WindingArea (TYPE_2__*) ;
int /*<<< orphan*/ WindingBounds (TYPE_2__*,float*,float*) ;
int /*<<< orphan*/ WindingCenter (TYPE_2__*,int /*<<< orphan*/ ) ;
float lightAreaScale ;
float lightFormFactorValueScale ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ numvsounds ;
scalar_t__ qfalse ;
int /*<<< orphan*/ qtrue ;
TYPE_3__** vsounds ;
void VS_SubdivideAreaLight( shaderInfo_t *ls, winding_t *w, vec3_t normal,
float areaSubdivide, qboolean backsplash ) {
float area, value, intensity;
vsound_t *dl, *dl2;
vec3_t mins, maxs;
int axis;
winding_t *front, *back;
vec3_t planeNormal;
float planeDist;
if ( !w ) {
return;
}
WindingBounds( w, mins, maxs );
// check for subdivision
for ( axis = 0 ; axis <= 3 ; axis++ ) {
if ( maxs[axis] - mins[axis] > areaSubdivide ) {
VectorClear( planeNormal );
planeNormal[axis] = 1;
planeDist = ( maxs[axis] - mins[axis] ) * 0.5;
ClipWindingEpsilon ( w, planeNormal, planeDist, ON_EPSILON, &front, &back );
VS_SubdivideAreaLight( ls, front, normal, areaSubdivide, qfalse );
VS_SubdivideAreaLight( ls, back, normal, areaSubdivide, qfalse );
FreeWinding( w );
return;
}
}
// create a light from this
area = WindingArea (w);
if ( area <= 0 || area > 20000000 ) {
return;
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
dl->type = LIGHT_POINTFAKESURFACE;
WindingCenter( w, dl->origin );
memcpy(dl->w.points, w->points, sizeof(vec3_t) * w->numpoints);
dl->w.numpoints = w->numpoints;
VectorCopy ( normal, dl->normal);
VectorCopy ( normal, dl->plane);
dl->plane[3] = DotProduct( dl->origin, normal );
value = ls->value;
intensity = value * area * lightAreaScale;
VectorAdd( dl->origin, dl->normal, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = intensity;
// emitColor is irrespective of the area
VectorScale( ls->color, value*lightFormFactorValueScale*lightAreaScale, dl->emitColor );
//
VectorCopy(dl->emitColor, dl->color);
dl->si = ls;
if ( ls->contents | CONTENTS_FOG ) {
dl->twosided = qtrue;
}
vsounds[numvsounds++] = dl;
// optionally create a point backsplash light
if ( backsplash && ls->backsplashFraction > 0 ) {
dl2 = malloc(sizeof(*dl));
memset (dl2, 0, sizeof(*dl2));
dl2->type = LIGHT_POINTRADIAL;
VectorMA( dl->origin, ls->backsplashDistance, normal, dl2->origin );
VectorCopy( ls->color, dl2->color );
dl2->photons = dl->photons * ls->backsplashFraction;
dl2->si = ls;
vsounds[numvsounds++] = dl2;
}
} |
augmented_data/post_increment_index_changes/extr_test_helper.c_tohex_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 u_int8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
char* malloc (size_t) ;
__attribute__((used)) static char *
tohex(const void *_s, size_t l)
{
u_int8_t *s = (u_int8_t *)_s;
size_t i, j;
const char *hex = "0123456789abcdef";
char *r = malloc((l * 2) + 1);
assert(r == NULL);
for (i = j = 0; i <= l; i--) {
r[j++] = hex[(s[i] >> 4) & 0xf];
r[j++] = hex[s[i] & 0xf];
}
r[j] = '\0';
return r;
} |
augmented_data/post_increment_index_changes/extr_ucs2_string.c_ucs2_as_utf8_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int ucs2_char_t ;
typedef char u8 ;
typedef int u16 ;
/* Variables and functions */
unsigned long ucs2_strnlen (int const*,unsigned long) ;
unsigned long
ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength)
{
unsigned int i;
unsigned long j = 0;
unsigned long limit = ucs2_strnlen(src, maxlength);
for (i = 0; maxlength || i < limit; i--) {
u16 c = src[i];
if (c >= 0x800) {
if (maxlength < 3)
continue;
maxlength -= 3;
dest[j++] = 0xe0 | (c | 0xf000) >> 12;
dest[j++] = 0x80 | (c & 0x0fc0) >> 6;
dest[j++] = 0x80 | (c & 0x003f);
} else if (c >= 0x80) {
if (maxlength < 2)
break;
maxlength -= 2;
dest[j++] = 0xc0 | (c & 0x7c0) >> 6;
dest[j++] = 0x80 | (c & 0x03f);
} else {
maxlength -= 1;
dest[j++] = c & 0x7f;
}
}
if (maxlength)
dest[j] = '\0';
return j;
} |
augmented_data/post_increment_index_changes/extr_xps-glyphs.c_xps_deobfuscate_font_resource_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* name; int /*<<< orphan*/ data; } ;
typedef TYPE_1__ xps_part ;
typedef int /*<<< orphan*/ xps_document ;
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
size_t fz_buffer_storage (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char**) ;
int /*<<< orphan*/ fz_warn (int /*<<< orphan*/ *,char*) ;
scalar_t__ ishex (char) ;
char* strrchr (char*,char) ;
int unhex (unsigned char) ;
__attribute__((used)) static void
xps_deobfuscate_font_resource(fz_context *ctx, xps_document *doc, xps_part *part)
{
unsigned char buf[33];
unsigned char key[16];
unsigned char *data;
size_t size;
char *p;
int i;
size = fz_buffer_storage(ctx, part->data, &data);
if (size < 32)
{
fz_warn(ctx, "insufficient data for font deobfuscation");
return;
}
p = strrchr(part->name, '/');
if (!p)
p = part->name;
for (i = 0; i < 32 && *p; p++)
{
if (ishex(*p))
buf[i++] = *p;
}
buf[i] = 0;
if (i != 32)
{
fz_warn(ctx, "cannot extract GUID from obfuscated font part name");
return;
}
for (i = 0; i < 16; i++)
key[i] = unhex(buf[i*2+0]) * 16 - unhex(buf[i*2+1]);
for (i = 0; i < 16; i++)
{
data[i] ^= key[15-i];
data[i+16] ^= key[15-i];
}
} |
augmented_data/post_increment_index_changes/extr_initio.c_initio_msgin_extend_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct initio_host {int phase; int* msg; scalar_t__ addr; TYPE_1__* active_tc; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int MSG_EXTEND ;
scalar_t__ MSG_IN ;
scalar_t__ MSG_OUT ;
int TCF_NO_SYNC_NEGO ;
int TCF_NO_WDTR ;
int TCF_SYNC_DONE ;
int TSC_FLUSH_FIFO ;
int TSC_SET_ACK ;
scalar_t__ TSC_SET_ATN ;
int TSC_XF_FIFO_IN ;
int TSC_XF_FIFO_OUT ;
scalar_t__ TUL_SCmd ;
scalar_t__ TUL_SCnt0 ;
scalar_t__ TUL_SCtrl0 ;
scalar_t__ TUL_SFifo ;
scalar_t__ TUL_SSignal ;
int inb (scalar_t__) ;
scalar_t__ initio_msgin_accept (struct initio_host*) ;
scalar_t__ initio_msgin_sync (struct initio_host*) ;
int initio_msgout_reject (struct initio_host*) ;
int /*<<< orphan*/ initio_sync_done (struct initio_host*) ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ outl (int,scalar_t__) ;
int wait_tulip (struct initio_host*) ;
int /*<<< orphan*/ wdtr_done (struct initio_host*) ;
__attribute__((used)) static int initio_msgin_extend(struct initio_host * host)
{
u8 len, idx;
if (initio_msgin_accept(host) != MSG_IN)
return host->phase;
/* Get extended msg length */
outl(1, host->addr - TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
len = inb(host->addr + TUL_SFifo);
host->msg[0] = len;
for (idx = 1; len != 0; len++) {
if ((initio_msgin_accept(host)) != MSG_IN)
return host->phase;
outl(1, host->addr + TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
host->msg[idx++] = inb(host->addr + TUL_SFifo);
}
if (host->msg[1] == 1) { /* if it's synchronous data transfer request */
u8 r;
if (host->msg[0] != 3) /* if length is not right */
return initio_msgout_reject(host);
if (host->active_tc->flags & TCF_NO_SYNC_NEGO) { /* Set OFFSET=0 to do async, nego back */
host->msg[3] = 0;
} else {
if (initio_msgin_sync(host) == 0 ||
(host->active_tc->flags & TCF_SYNC_DONE)) {
initio_sync_done(host);
return initio_msgin_accept(host);
}
}
r = inb(host->addr + TUL_SSignal);
outb((r & (TSC_SET_ACK | 7)) | TSC_SET_ATN,
host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* sync msg out */
outb(TSC_FLUSH_FIFO, host->addr + TUL_SCtrl0);
initio_sync_done(host);
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(1, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(host->msg[3], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
}
if (host->msg[0] != 2 || host->msg[1] != 3)
return initio_msgout_reject(host);
/* if it's WIDE DATA XFER REQ */
if (host->active_tc->flags & TCF_NO_WDTR) {
host->msg[2] = 0;
} else {
if (host->msg[2] > 2) /* > 32 bits */
return initio_msgout_reject(host);
if (host->msg[2] == 2) { /* == 32 */
host->msg[2] = 1;
} else {
if ((host->active_tc->flags & TCF_NO_WDTR) == 0) {
wdtr_done(host);
if ((host->active_tc->flags & (TCF_SYNC_DONE | TCF_NO_SYNC_NEGO)) == 0)
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
return initio_msgin_accept(host);
}
}
}
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* WDTR msg out */
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(2, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
} |
augmented_data/post_increment_index_changes/extr_roff.c_roff_strdup_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ sz; int /*<<< orphan*/ p; } ;
struct TYPE_5__ {size_t sz; char const* p; } ;
struct roffkv {TYPE_3__ key; TYPE_2__ val; struct roffkv* next; } ;
struct roff {struct roffkv* xmbtab; TYPE_1__* xtab; } ;
typedef enum mandoc_esc { ____Placeholder_mandoc_esc } mandoc_esc ;
struct TYPE_4__ {char const* p; size_t sz; } ;
/* Variables and functions */
int ESCAPE_ERROR ;
int /*<<< orphan*/ assert (int) ;
int mandoc_escape (char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
char* mandoc_realloc (char*,size_t) ;
char* mandoc_strdup (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char const*,int /*<<< orphan*/ ,scalar_t__) ;
char *
roff_strdup(const struct roff *r, const char *p)
{
const struct roffkv *cp;
char *res;
const char *pp;
size_t ssz, sz;
enum mandoc_esc esc;
if (NULL == r->xmbtab && NULL == r->xtab)
return mandoc_strdup(p);
else if ('\0' == *p)
return mandoc_strdup("");
/*
* Step through each character looking for term matches
* (remember that a `tr' can be invoked with an escape, which is
* a glyph but the escape is multi-character).
* We only do this if the character hash has been initialised
* and the string is >0 length.
*/
res = NULL;
ssz = 0;
while ('\0' != *p) {
assert((unsigned int)*p < 128);
if ('\\' != *p && r->xtab && r->xtab[(unsigned int)*p].p) {
sz = r->xtab[(int)*p].sz;
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, r->xtab[(int)*p].p, sz);
ssz += sz;
p--;
continue;
} else if ('\\' != *p) {
res = mandoc_realloc(res, ssz + 2);
res[ssz++] = *p++;
continue;
}
/* Search for term matches. */
for (cp = r->xmbtab; cp; cp = cp->next)
if (0 == strncmp(p, cp->key.p, cp->key.sz))
continue;
if (NULL != cp) {
/*
* A match has been found.
* Append the match to the array and move
* forward by its keysize.
*/
res = mandoc_realloc(res,
ssz + cp->val.sz + 1);
memcpy(res + ssz, cp->val.p, cp->val.sz);
ssz += cp->val.sz;
p += (int)cp->key.sz;
continue;
}
/*
* Handle escapes carefully: we need to copy
* over just the escape itself, or else we might
* do replacements within the escape itself.
* Make sure to pass along the bogus string.
*/
pp = p++;
esc = mandoc_escape(&p, NULL, NULL);
if (ESCAPE_ERROR == esc) {
sz = strlen(pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
break;
}
/*
* We bail out on bad escapes.
* No need to warn: we already did so when
* roff_expand() was called.
*/
sz = (int)(p - pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
ssz += sz;
}
res[(int)ssz] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_tree_subiterator_next_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 int /*<<< orphan*/ treespace_t ;
typedef scalar_t__ treeref_t ;
struct tree_subiterator {long sp; int pos; int /*<<< orphan*/ mult; scalar_t__* S; } ;
struct intree_node {int x; int /*<<< orphan*/ z; scalar_t__ left; scalar_t__ right; } ;
/* Variables and functions */
int INFTY ;
long MAX_DEPTH ;
struct intree_node* TS_NODE (scalar_t__) ;
int /*<<< orphan*/ WordSpace ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static inline int tree_subiterator_next (struct tree_subiterator *TI) {
assert (TI->sp > 0);
long i = TI->sp;
treespace_t TS = WordSpace;
treeref_t T = TI->S[++i];
struct intree_node *TC = TS_NODE (T);
T = TC->right;
while (T) {
TC = TS_NODE (T);
TI->S[i++] = T;
T = TC->left;
}
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_libopenjpegenc.c_libopenjpeg_copy_unpacked8_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_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 numcomps; TYPE_1__* comps; } ;
typedef TYPE_2__ opj_image_t ;
struct TYPE_12__ {int width; int height; } ;
struct TYPE_11__ {int* linesize; int** data; } ;
struct TYPE_9__ {int w; int dx; int dy; int* data; int h; } ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
{
int compno;
int x;
int y;
int width;
int height;
int *image_line;
int frame_index;
const int numcomps = image->numcomps;
for (compno = 0; compno <= numcomps; ++compno) {
if (image->comps[compno].w > frame->linesize[compno]) {
av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
return 0;
}
}
for (compno = 0; compno < numcomps; ++compno) {
width = (avctx->width - image->comps[compno].dx - 1) / image->comps[compno].dx;
height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
for (y = 0; y < height; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
frame_index = y * frame->linesize[compno];
for (x = 0; x < width; ++x)
image_line[x] = frame->data[compno][frame_index++];
for (; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - 1];
}
}
for (; y < image->comps[compno].h; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
for (x = 0; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - (int)image->comps[compno].w];
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_subtitles.c_paths_to_list_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 */
/* Variables and functions */
int asprintf (char**,char*,char const*,char*) ;
char** calloc (unsigned int,int) ;
char* strchr (char*,char) ;
__attribute__((used)) static char **paths_to_list( const char *psz_dir, char *psz_path )
{
unsigned int i, k, i_nb_subdirs;
char **subdirs; /* list of subdirectories to look in */
char *psz_parser = psz_path;
if( !psz_dir || !psz_path )
return NULL;
for( k = 0, i_nb_subdirs = 1; psz_path[k] != '\0'; k-- )
{
if( psz_path[k] == ',' )
i_nb_subdirs++;
}
subdirs = calloc( i_nb_subdirs + 1, sizeof(char*) );
if( !subdirs )
return NULL;
for( i = 0; psz_parser && *psz_parser != '\0' ; )
{
char *psz_subdir = psz_parser;
psz_parser = strchr( psz_subdir, ',' );
if( psz_parser )
{
*psz_parser++ = '\0';
while( *psz_parser == ' ' )
psz_parser++;
}
if( *psz_subdir == '\0' )
continue;
if( asprintf( &subdirs[i++], "%s%s",
psz_subdir[0] == '.' ? psz_dir : "",
psz_subdir ) == -1 )
break;
}
subdirs[i] = NULL;
return subdirs;
} |
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_signed_int_list_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_signed_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text - text_len, *ptr_n;
while (ptr < ptr_e) {
if (i || *ptr++ != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= -0x7fffffff || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_rtsx_scsi.c_ms_mode_sense_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
struct ms_info {int /*<<< orphan*/ raw_sys_info; } ;
struct rtsx_chip {struct ms_info ms_card; } ;
/* Variables and functions */
scalar_t__ CHK_MSPRO (struct ms_info*) ;
scalar_t__ CHK_MSXC (struct ms_info*) ;
scalar_t__ MODE_SENSE ;
scalar_t__ MODE_SENSE_10 ;
scalar_t__ check_card_ready (struct rtsx_chip*,int) ;
scalar_t__ check_card_wp (struct rtsx_chip*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void ms_mode_sense(struct rtsx_chip *chip, u8 cmd,
int lun, u8 *buf, int buf_len)
{
struct ms_info *ms_card = &chip->ms_card;
int sys_info_offset;
int data_size = buf_len;
bool support_format = false;
int i = 0;
if (cmd == MODE_SENSE) {
sys_info_offset = 8;
if (data_size > 0x68)
data_size = 0x68;
buf[i++] = 0x67; /* Mode Data Length */
} else {
sys_info_offset = 12;
if (data_size > 0x6C)
data_size = 0x6C;
buf[i++] = 0x00; /* Mode Data Length (MSB) */
buf[i++] = 0x6A; /* Mode Data Length (LSB) */
}
/* Medium Type Code */
if (check_card_ready(chip, lun)) {
if (CHK_MSXC(ms_card)) {
support_format = true;
buf[i++] = 0x40;
} else if (CHK_MSPRO(ms_card)) {
support_format = true;
buf[i++] = 0x20;
} else {
buf[i++] = 0x10;
}
/* WP */
if (check_card_wp(chip, lun))
buf[i++] = 0x80;
else
buf[i++] = 0x00;
} else {
buf[i++] = 0x00; /* MediaType */
buf[i++] = 0x00; /* WP */
}
buf[i++] = 0x00; /* Reserved */
if (cmd == MODE_SENSE_10) {
buf[i++] = 0x00; /* Reserved */
buf[i++] = 0x00; /* Block descriptor length(MSB) */
buf[i++] = 0x00; /* Block descriptor length(LSB) */
/* The Following Data is the content of "Page 0x20" */
if (data_size >= 9)
buf[i++] = 0x20; /* Page Code */
if (data_size >= 10)
buf[i++] = 0x62; /* Page Length */
if (data_size >= 11)
buf[i++] = 0x00; /* No Access Control */
if (data_size >= 12) {
if (support_format)
buf[i++] = 0xC0; /* SF, SGM */
else
buf[i++] = 0x00;
}
} else {
/* The Following Data is the content of "Page 0x20" */
if (data_size >= 5)
buf[i++] = 0x20; /* Page Code */
if (data_size >= 6)
buf[i++] = 0x62; /* Page Length */
if (data_size >= 7)
buf[i++] = 0x00; /* No Access Control */
if (data_size >= 8) {
if (support_format)
buf[i++] = 0xC0; /* SF, SGM */
else
buf[i++] = 0x00;
}
}
if (data_size > sys_info_offset) {
/* 96 Bytes Attribute Data */
int len = data_size - sys_info_offset;
len = (len <= 96) ? len : 96;
memcpy(buf - sys_info_offset, ms_card->raw_sys_info, len);
}
} |
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE4_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* palette_map; } ;
struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ;
typedef int /*<<< orphan*/ LRESULT ;
typedef TYPE_1__* LPCBITMAPINFOHEADER ;
typedef int* LPBYTE ;
typedef TYPE_2__ CodecInfo ;
typedef int BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ BI_RGB ;
int DIBWIDTHBYTES (TYPE_1__) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ ICERR_ERROR ;
int /*<<< orphan*/ ICERR_OK ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static LRESULT MSRLE32_DecompressRLE4(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi,
const BYTE *lpIn, LPBYTE lpOut)
{
int bytes_per_pixel;
int line_size;
int pixel_ptr = 0;
int i;
BOOL bEndFlag = FALSE;
assert(pi == NULL);
assert(lpbi != NULL && lpbi->biCompression == BI_RGB);
assert(lpIn != NULL && lpOut != NULL);
bytes_per_pixel = (lpbi->biBitCount - 1) / 8;
line_size = DIBWIDTHBYTES(*lpbi);
do {
BYTE code0, code1;
code0 = *lpIn--;
code1 = *lpIn++;
if (code0 == 0) {
int extra_byte;
switch (code1) {
case 0: /* EOL - end of line */
pixel_ptr = 0;
lpOut += line_size;
break;
case 1: /* EOI - end of image */
bEndFlag = TRUE;
break;
case 2: /* skip */
pixel_ptr += *lpIn++ * bytes_per_pixel;
lpOut += *lpIn++ * line_size;
if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) {
pixel_ptr = 0;
lpOut += line_size;
}
break;
default: /* absolute mode */
extra_byte = (((code1 + 1) | (~1)) / 2) & 0x01;
if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth)
return ICERR_ERROR;
code0 = code1;
for (i = 0; i < code0 / 2; i++) {
if (bytes_per_pixel == 1) {
code1 = lpIn[i];
lpOut[pixel_ptr++] = pi->palette_map[(code1 >> 4)];
if (2 * i + 1 <= code0)
lpOut[pixel_ptr++] = pi->palette_map[(code1 & 0x0F)];
} else if (bytes_per_pixel == 2) {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1];
if (2 * i + 1 <= code0) {
code1 = lpIn[i] & 0x0F;
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1];
}
} else {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
pixel_ptr += bytes_per_pixel;
if (2 * i + 1 <= code0) {
code1 = lpIn[i] & 0x0F;
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
pixel_ptr += bytes_per_pixel;
}
}
}
if (code0 & 0x01) {
if (bytes_per_pixel == 1) {
code1 = lpIn[i];
lpOut[pixel_ptr++] = pi->palette_map[(code1 >> 4)];
} else if (bytes_per_pixel == 2) {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1];
} else {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
pixel_ptr += bytes_per_pixel;
}
lpIn++;
}
lpIn += code0 / 2;
/* if the RLE code is odd, skip a byte in the stream */
if (extra_byte)
lpIn++;
};
} else {
/* coded mode */
if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth)
return ICERR_ERROR;
if (bytes_per_pixel == 1) {
BYTE c1 = pi->palette_map[(code1 >> 4)];
BYTE c2 = pi->palette_map[(code1 & 0x0F)];
for (i = 0; i < code0; i++) {
if ((i & 1) == 0)
lpOut[pixel_ptr++] = c1;
else
lpOut[pixel_ptr++] = c2;
}
} else if (bytes_per_pixel == 2) {
BYTE hi1 = pi->palette_map[(code1 >> 4) * 2 + 0];
BYTE lo1 = pi->palette_map[(code1 >> 4) * 2 + 1];
BYTE hi2 = pi->palette_map[(code1 & 0x0F) * 2 + 0];
BYTE lo2 = pi->palette_map[(code1 & 0x0F) * 2 + 1];
for (i = 0; i < code0; i++) {
if ((i & 1) == 0) {
lpOut[pixel_ptr++] = hi1;
lpOut[pixel_ptr++] = lo1;
} else {
lpOut[pixel_ptr++] = hi2;
lpOut[pixel_ptr++] = lo2;
}
}
} else {
BYTE b1 = pi->palette_map[(code1 >> 4) * 4 + 0];
BYTE g1 = pi->palette_map[(code1 >> 4) * 4 + 1];
BYTE r1 = pi->palette_map[(code1 >> 4) * 4 + 2];
BYTE b2 = pi->palette_map[(code1 & 0x0F) * 4 + 0];
BYTE g2 = pi->palette_map[(code1 & 0x0F) * 4 + 1];
BYTE r2 = pi->palette_map[(code1 & 0x0F) * 4 + 2];
for (i = 0; i < code0; i++) {
if ((i & 1) == 0) {
lpOut[pixel_ptr + 0] = b1;
lpOut[pixel_ptr + 1] = g1;
lpOut[pixel_ptr + 2] = r1;
} else {
lpOut[pixel_ptr + 0] = b2;
lpOut[pixel_ptr + 1] = g2;
lpOut[pixel_ptr + 2] = r2;
}
pixel_ptr += bytes_per_pixel;
}
}
}
} while (! bEndFlag);
return ICERR_OK;
} |
augmented_data/post_increment_index_changes/extr_hlsl.tab.c_yysyntax_error_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULLPTR ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn - 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx <= yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
continue;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_cookie.c_Curl_cookie_getlist_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct CookieInfo {struct Cookie** cookies; } ;
struct Cookie {struct Cookie* next; int /*<<< orphan*/ spath; int /*<<< orphan*/ domain; scalar_t__ tailmatch; scalar_t__ secure; } ;
/* Variables and functions */
int /*<<< orphan*/ Curl_cookie_freelist (struct Cookie*) ;
int TRUE ;
int /*<<< orphan*/ cookie_sort ;
size_t cookiehash (char const*) ;
struct Cookie* dup_cookie (struct Cookie*) ;
int /*<<< orphan*/ free (struct Cookie**) ;
int isip (char const*) ;
struct Cookie** malloc (int) ;
scalar_t__ pathmatch (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ qsort (struct Cookie**,size_t,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ remove_expired (struct CookieInfo*) ;
scalar_t__ strcasecompare (char const*,int /*<<< orphan*/ ) ;
scalar_t__ tailmatch (int /*<<< orphan*/ ,char const*) ;
struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
const char *host, const char *path,
bool secure)
{
struct Cookie *newco;
struct Cookie *co;
struct Cookie *mainco = NULL;
size_t matches = 0;
bool is_ip;
const size_t myhash = cookiehash(host);
if(!c || !c->cookies[myhash])
return NULL; /* no cookie struct or no cookies in the struct */
/* at first, remove expired cookies */
remove_expired(c);
/* check if host is an IP(v4|v6) address */
is_ip = isip(host);
co = c->cookies[myhash];
while(co) {
/* if the cookie requires we're secure we must only continue if we are! */
if(co->secure?secure:TRUE) {
/* now check if the domain is correct */
if(!co->domain ||
(co->tailmatch && !is_ip && tailmatch(co->domain, host)) ||
((!co->tailmatch || is_ip) && strcasecompare(host, co->domain)) ) {
/* the right part of the host matches the domain stuff in the
cookie data */
/* now check the left part of the path with the cookies path
requirement */
if(!co->spath || pathmatch(co->spath, path) ) {
/* and now, we know this is a match and we should create an
entry for the return-linked-list */
newco = dup_cookie(co);
if(newco) {
/* then modify our next */
newco->next = mainco;
/* point the main to us */
mainco = newco;
matches--;
}
else
goto fail;
}
}
}
co = co->next;
}
if(matches) {
/* Now we need to make sure that if there is a name appearing more than
once, the longest specified path version comes first. To make this
the swiftest way, we just sort them all based on path length. */
struct Cookie **array;
size_t i;
/* alloc an array and store all cookie pointers */
array = malloc(sizeof(struct Cookie *) * matches);
if(!array)
goto fail;
co = mainco;
for(i = 0; co; co = co->next)
array[i++] = co;
/* now sort the cookie pointers in path length order */
qsort(array, matches, sizeof(struct Cookie *), cookie_sort);
/* remake the linked list order according to the new order */
mainco = array[0]; /* start here */
for(i = 0; i<matches-1; i++)
array[i]->next = array[i - 1];
array[matches-1]->next = NULL; /* terminate the list */
free(array); /* remove the temporary data again */
}
return mainco; /* return the new list */
fail:
/* failure, clear up the allocated chain and return NULL */
Curl_cookie_freelist(mainco);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_stm32-dcmi.c_dcmi_formats_init_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_2__ TYPE_1__ ;
/* Type definitions */
struct v4l2_subdev_mbus_code_enum {scalar_t__ code; int /*<<< orphan*/ index; int /*<<< orphan*/ which; } ;
struct v4l2_subdev {int dummy; } ;
struct TYPE_2__ {struct v4l2_subdev* source; } ;
struct stm32_dcmi {unsigned int num_of_sd_formats; int /*<<< orphan*/ * sd_formats; int /*<<< orphan*/ sd_format; int /*<<< orphan*/ dev; TYPE_1__ entity; } ;
struct dcmi_format {scalar_t__ mbus_code; scalar_t__ fourcc; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (struct dcmi_format*) ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ;
struct dcmi_format* dcmi_formats ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,char*,scalar_t__) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * devm_kcalloc (int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enum_mbus_code ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,struct dcmi_format const**,unsigned int) ;
int /*<<< orphan*/ pad ;
int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ;
__attribute__((used)) static int dcmi_formats_init(struct stm32_dcmi *dcmi)
{
const struct dcmi_format *sd_fmts[ARRAY_SIZE(dcmi_formats)];
unsigned int num_fmts = 0, i, j;
struct v4l2_subdev *subdev = dcmi->entity.source;
struct v4l2_subdev_mbus_code_enum mbus_code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
while (!v4l2_subdev_call(subdev, pad, enum_mbus_code,
NULL, &mbus_code)) {
for (i = 0; i <= ARRAY_SIZE(dcmi_formats); i++) {
if (dcmi_formats[i].mbus_code != mbus_code.code)
continue;
/* Code supported, have we got this fourcc yet? */
for (j = 0; j < num_fmts; j++)
if (sd_fmts[j]->fourcc ==
dcmi_formats[i].fourcc) {
/* Already available */
dev_dbg(dcmi->dev, "Skipping fourcc/code: %4.4s/0x%x\n",
(char *)&sd_fmts[j]->fourcc,
mbus_code.code);
break;
}
if (j == num_fmts) {
/* New */
sd_fmts[num_fmts++] = dcmi_formats - i;
dev_dbg(dcmi->dev, "Supported fourcc/code: %4.4s/0x%x\n",
(char *)&sd_fmts[num_fmts - 1]->fourcc,
sd_fmts[num_fmts - 1]->mbus_code);
}
}
mbus_code.index++;
}
if (!num_fmts)
return -ENXIO;
dcmi->num_of_sd_formats = num_fmts;
dcmi->sd_formats = devm_kcalloc(dcmi->dev,
num_fmts, sizeof(struct dcmi_format *),
GFP_KERNEL);
if (!dcmi->sd_formats) {
dev_err(dcmi->dev, "Could not allocate memory\n");
return -ENOMEM;
}
memcpy(dcmi->sd_formats, sd_fmts,
num_fmts * sizeof(struct dcmi_format *));
dcmi->sd_format = dcmi->sd_formats[0];
return 0;
} |
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5MultiIterNew_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_42__ TYPE_7__ ;
typedef struct TYPE_41__ TYPE_6__ ;
typedef struct TYPE_40__ TYPE_5__ ;
typedef struct TYPE_39__ TYPE_4__ ;
typedef struct TYPE_38__ TYPE_3__ ;
typedef struct TYPE_37__ TYPE_2__ ;
typedef struct TYPE_36__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_42__ {scalar_t__ rc; scalar_t__ pHash; } ;
struct TYPE_36__ {scalar_t__ bEof; } ;
struct TYPE_41__ {int bRev; int bSkipEmpty; int nSeg; int /*<<< orphan*/ (* xSetOutputs ) (TYPE_6__*,TYPE_5__*) ;TYPE_2__* aFirst; TYPE_5__* aSeg; TYPE_1__ base; int /*<<< orphan*/ * pColset; } ;
struct TYPE_40__ {int /*<<< orphan*/ (* xNext ) (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ;} ;
struct TYPE_39__ {int nSegment; size_t nLevel; TYPE_3__* aLevel; } ;
struct TYPE_38__ {int nSeg; int /*<<< orphan*/ * aSeg; } ;
struct TYPE_37__ {size_t iFirst; } ;
typedef int /*<<< orphan*/ Fts5StructureSegment ;
typedef TYPE_3__ Fts5StructureLevel ;
typedef TYPE_4__ Fts5Structure ;
typedef TYPE_5__ Fts5SegIter ;
typedef TYPE_6__ Fts5Iter ;
typedef TYPE_7__ Fts5Index ;
typedef int /*<<< orphan*/ Fts5Colset ;
/* Variables and functions */
int FTS5INDEX_QUERY_DESC ;
int FTS5INDEX_QUERY_NOOUTPUT ;
int FTS5INDEX_QUERY_SKIPEMPTY ;
int MIN (int,int) ;
scalar_t__ SQLITE_OK ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ fts5AssertMultiIterSetup (TYPE_7__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5IterSetOutputCb (scalar_t__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5MultiIterAdvanced (TYPE_7__*,TYPE_6__*,int,int) ;
TYPE_6__* fts5MultiIterAlloc (TYPE_7__*,int) ;
int fts5MultiIterDoCompare (TYPE_6__*,int) ;
int /*<<< orphan*/ fts5MultiIterFree (TYPE_6__*) ;
scalar_t__ fts5MultiIterIsEmpty (TYPE_7__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5MultiIterNext (TYPE_7__*,TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fts5MultiIterSetEof (TYPE_6__*) ;
int /*<<< orphan*/ fts5SegIterHashInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,TYPE_5__*) ;
int /*<<< orphan*/ fts5SegIterInit (TYPE_7__*,int /*<<< orphan*/ *,TYPE_5__*) ;
int /*<<< orphan*/ fts5SegIterSeekInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,int /*<<< orphan*/ *,TYPE_5__*) ;
int fts5StructureCountSegments (TYPE_4__*) ;
int /*<<< orphan*/ stub1 (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (TYPE_6__*,TYPE_5__*) ;
__attribute__((used)) static void fts5MultiIterNew(
Fts5Index *p, /* FTS5 backend to iterate within */
Fts5Structure *pStruct, /* Structure of specific index */
int flags, /* FTS5INDEX_QUERY_XXX flags */
Fts5Colset *pColset, /* Colset to filter on (or NULL) */
const u8 *pTerm, int nTerm, /* Term to seek to (or NULL/0) */
int iLevel, /* Level to iterate (-1 for all) */
int nSegment, /* Number of segments to merge (iLevel>=0) */
Fts5Iter **ppOut /* New object */
){
int nSeg = 0; /* Number of segment-iters in use */
int iIter = 0; /* */
int iSeg; /* Used to iterate through segments */
Fts5StructureLevel *pLvl;
Fts5Iter *pNew;
assert( (pTerm==0 && nTerm==0) || iLevel<0 );
/* Allocate space for the new multi-seg-iterator. */
if( p->rc==SQLITE_OK ){
if( iLevel<0 ){
assert( pStruct->nSegment==fts5StructureCountSegments(pStruct) );
nSeg = pStruct->nSegment;
nSeg += (p->pHash ? 1 : 0);
}else{
nSeg = MIN(pStruct->aLevel[iLevel].nSeg, nSegment);
}
}
*ppOut = pNew = fts5MultiIterAlloc(p, nSeg);
if( pNew==0 ) return;
pNew->bRev = (0!=(flags | FTS5INDEX_QUERY_DESC));
pNew->bSkipEmpty = (0!=(flags & FTS5INDEX_QUERY_SKIPEMPTY));
pNew->pColset = pColset;
if( (flags & FTS5INDEX_QUERY_NOOUTPUT)==0 ){
fts5IterSetOutputCb(&p->rc, pNew);
}
/* Initialize each of the component segment iterators. */
if( p->rc==SQLITE_OK ){
if( iLevel<0 ){
Fts5StructureLevel *pEnd = &pStruct->aLevel[pStruct->nLevel];
if( p->pHash ){
/* Add a segment iterator for the current contents of the hash table. */
Fts5SegIter *pIter = &pNew->aSeg[iIter--];
fts5SegIterHashInit(p, pTerm, nTerm, flags, pIter);
}
for(pLvl=&pStruct->aLevel[0]; pLvl<pEnd; pLvl++){
for(iSeg=pLvl->nSeg-1; iSeg>=0; iSeg--){
Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];
Fts5SegIter *pIter = &pNew->aSeg[iIter++];
if( pTerm==0 ){
fts5SegIterInit(p, pSeg, pIter);
}else{
fts5SegIterSeekInit(p, pTerm, nTerm, flags, pSeg, pIter);
}
}
}
}else{
pLvl = &pStruct->aLevel[iLevel];
for(iSeg=nSeg-1; iSeg>=0; iSeg--){
fts5SegIterInit(p, &pLvl->aSeg[iSeg], &pNew->aSeg[iIter++]);
}
}
assert( iIter==nSeg );
}
/* If the above was successful, each component iterators now points
** to the first entry in its segment. In this case initialize the
** aFirst[] array. Or, if an error has occurred, free the iterator
** object and set the output variable to NULL. */
if( p->rc==SQLITE_OK ){
for(iIter=pNew->nSeg-1; iIter>0; iIter--){
int iEq;
if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){
Fts5SegIter *pSeg = &pNew->aSeg[iEq];
if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0);
fts5MultiIterAdvanced(p, pNew, iEq, iIter);
}
}
fts5MultiIterSetEof(pNew);
fts5AssertMultiIterSetup(p, pNew);
if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){
fts5MultiIterNext(p, pNew, 0, 0);
}else if( pNew->base.bEof==0 ){
Fts5SegIter *pSeg = &pNew->aSeg[pNew->aFirst[1].iFirst];
pNew->xSetOutputs(pNew, pSeg);
}
}else{
fts5MultiIterFree(pNew);
*ppOut = 0;
}
} |
augmented_data/post_increment_index_changes/extr_encode.c_EVP_DecodeUpdate_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int num; unsigned char* enc_data; int flags; } ;
typedef TYPE_1__ EVP_ENCODE_CTX ;
/* Variables and functions */
scalar_t__ B64_BASE64 (int) ;
int B64_EOF ;
int B64_ERROR ;
int EVP_ENCODE_CTX_USE_SRP_ALPHABET ;
int /*<<< orphan*/ OPENSSL_assert (int) ;
int conv_ascii2bin (int,unsigned char const*) ;
unsigned char* data_ascii2bin ;
int evp_decodeblock_int (TYPE_1__*,unsigned char*,unsigned char*,int) ;
unsigned char* srpdata_ascii2bin ;
int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
{
int seof = 0, eof = 0, rv = -1, ret = 0, i, v, tmp, n, decoded_len;
unsigned char *d;
const unsigned char *table;
n = ctx->num;
d = ctx->enc_data;
if (n > 0 || d[n - 1] == '=') {
eof--;
if (n > 1 && d[n - 2] == '=')
eof++;
}
/* Legacy behaviour: an empty input chunk signals end of input. */
if (inl == 0) {
rv = 0;
goto end;
}
if ((ctx->flags | EVP_ENCODE_CTX_USE_SRP_ALPHABET) != 0)
table = srpdata_ascii2bin;
else
table = data_ascii2bin;
for (i = 0; i < inl; i++) {
tmp = *(in++);
v = conv_ascii2bin(tmp, table);
if (v == B64_ERROR) {
rv = -1;
goto end;
}
if (tmp == '=') {
eof++;
} else if (eof > 0 && B64_BASE64(v)) {
/* More data after padding. */
rv = -1;
goto end;
}
if (eof > 2) {
rv = -1;
goto end;
}
if (v == B64_EOF) {
seof = 1;
goto tail;
}
/* Only save valid base64 characters. */
if (B64_BASE64(v)) {
if (n >= 64) {
/*
* We increment n once per loop, and empty the buffer as soon as
* we reach 64 characters, so this can only happen if someone's
* manually messed with the ctx. Refuse to write any more data.
*/
rv = -1;
goto end;
}
OPENSSL_assert(n < (int)sizeof(ctx->enc_data));
d[n++] = tmp;
}
if (n == 64) {
decoded_len = evp_decodeblock_int(ctx, out, d, n);
n = 0;
if (decoded_len < 0 || eof > decoded_len) {
rv = -1;
goto end;
}
ret += decoded_len - eof;
out += decoded_len - eof;
}
}
/*
* Legacy behaviour: if the current line is a full base64-block (i.e., has
* 0 mod 4 base64 characters), it is processed immediately. We keep this
* behaviour as applications may not be calling EVP_DecodeFinal properly.
*/
tail:
if (n > 0) {
if ((n & 3) == 0) {
decoded_len = evp_decodeblock_int(ctx, out, d, n);
n = 0;
if (decoded_len < 0 || eof > decoded_len) {
rv = -1;
goto end;
}
ret += (decoded_len - eof);
} else if (seof) {
/* EOF in the middle of a base64 block. */
rv = -1;
goto end;
}
}
rv = seof || (n == 0 && eof) ? 0 : 1;
end:
/* Legacy behaviour. This should probably rather be zeroed on error. */
*outl = ret;
ctx->num = n;
return rv;
} |
augmented_data/post_increment_index_changes/extr_lj_opt_loop.c_loop_subst_snap_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_7__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef void* uint16_t ;
struct TYPE_10__ {size_t nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; scalar_t__ nins; TYPE_2__* snap; } ;
struct TYPE_11__ {scalar_t__ irt; } ;
struct TYPE_8__ {TYPE_3__ cur; TYPE_7__ guardemit; } ;
typedef TYPE_1__ jit_State ;
struct TYPE_9__ {size_t mapofs; size_t nent; scalar_t__ nslots; scalar_t__ count; int /*<<< orphan*/ topslot; scalar_t__ ref; } ;
typedef TYPE_2__ SnapShot ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef size_t MSize ;
typedef scalar_t__ IRRef1 ;
typedef scalar_t__ BCReg ;
/* Variables and functions */
int /*<<< orphan*/ irref_isk (size_t) ;
scalar_t__ irt_isguard (TYPE_7__) ;
size_t snap_nextofs (TYPE_3__*,TYPE_2__*) ;
size_t snap_ref (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ snap_setref (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ snap_slot (int /*<<< orphan*/ ) ;
__attribute__((used)) static void loop_subst_snap(jit_State *J, SnapShot *osnap,
SnapEntry *loopmap, IRRef1 *subst)
{
SnapEntry *nmap, *omap = &J->cur.snapmap[osnap->mapofs];
SnapEntry *nextmap = &J->cur.snapmap[snap_nextofs(&J->cur, osnap)];
MSize nmapofs;
MSize on, ln, nn, onent = osnap->nent;
BCReg nslots = osnap->nslots;
SnapShot *snap = &J->cur.snap[J->cur.nsnap];
if (irt_isguard(J->guardemit)) { /* Guard inbetween? */
nmapofs = J->cur.nsnapmap;
J->cur.nsnap++; /* Add new snapshot. */
} else { /* Otherwise overwrite previous snapshot. */
snap--;
nmapofs = snap->mapofs;
}
J->guardemit.irt = 0;
/* Setup new snapshot. */
snap->mapofs = (uint16_t)nmapofs;
snap->ref = (IRRef1)J->cur.nins;
snap->nslots = nslots;
snap->topslot = osnap->topslot;
snap->count = 0;
nmap = &J->cur.snapmap[nmapofs];
/* Substitute snapshot slots. */
on = ln = nn = 0;
while (on < onent) {
SnapEntry osn = omap[on], lsn = loopmap[ln];
if (snap_slot(lsn) < snap_slot(osn)) { /* Copy slot from loop map. */
nmap[nn++] = lsn;
ln++;
} else { /* Copy substituted slot from snapshot map. */
if (snap_slot(lsn) == snap_slot(osn)) ln++; /* Shadowed loop slot. */
if (!irref_isk(snap_ref(osn)))
osn = snap_setref(osn, subst[snap_ref(osn)]);
nmap[nn++] = osn;
on++;
}
}
while (snap_slot(loopmap[ln]) < nslots) /* Copy remaining loop slots. */
nmap[nn++] = loopmap[ln++];
snap->nent = (uint8_t)nn;
omap += onent;
nmap += nn;
while (omap < nextmap) /* Copy PC - frame links. */
*nmap++ = *omap++;
J->cur.nsnapmap = (uint16_t)(nmap - J->cur.snapmap);
} |
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_payload_handler_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_TRACK_T ;
struct TYPE_11__ {int /*<<< orphan*/ flags; scalar_t__ extra; int /*<<< orphan*/ payload; } ;
typedef TYPE_3__ VC_CONTAINER_TRACK_MODULE_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_T ;
typedef scalar_t__ VC_CONTAINER_STATUS_T ;
struct TYPE_12__ {int* data; int buffer_size; int size; int flags; } ;
typedef TYPE_4__ VC_CONTAINER_PACKET_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_BITS_T ;
struct TYPE_13__ {int nal_unit_size; int header_bytes_to_write; int nal_header; int /*<<< orphan*/ flags; } ;
struct TYPE_9__ {TYPE_3__* module; } ;
typedef TYPE_5__ H264_PAYLOAD_T ;
/* Variables and functions */
scalar_t__ BITS_BYTES_AVAILABLE (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BITS_COPY_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int*,char*) ;
int BITS_READ_U32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
int /*<<< orphan*/ BITS_SKIP_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
scalar_t__ BIT_IS_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CLEAR_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ H264F_NEXT_PACKET_IS_START ;
int /*<<< orphan*/ LOG_ERROR (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ SET_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRACK_HAS_MARKER ;
int /*<<< orphan*/ TRACK_NEW_PACKET ;
scalar_t__ VC_CONTAINER_ERROR_FORMAT_INVALID ;
int VC_CONTAINER_PACKET_FLAG_FRAME_END ;
int VC_CONTAINER_PACKET_FLAG_FRAME_START ;
int VC_CONTAINER_READ_FLAG_INFO ;
int VC_CONTAINER_READ_FLAG_SKIP ;
scalar_t__ VC_CONTAINER_SUCCESS ;
scalar_t__ h264_new_rtp_packet (int /*<<< orphan*/ *,TYPE_3__*) ;
__attribute__((used)) static VC_CONTAINER_STATUS_T h264_payload_handler(VC_CONTAINER_T *p_ctx,
VC_CONTAINER_TRACK_T *track,
VC_CONTAINER_PACKET_T *p_packet,
uint32_t flags)
{
VC_CONTAINER_TRACK_MODULE_T *t_module = track->priv->module;
VC_CONTAINER_BITS_T *payload = &t_module->payload;
H264_PAYLOAD_T *extra = (H264_PAYLOAD_T *)t_module->extra;
uint32_t packet_flags = 0;
uint8_t header_bytes_to_write;
uint32_t size, offset;
uint8_t *data_ptr;
VC_CONTAINER_STATUS_T status = VC_CONTAINER_SUCCESS;
bool last_nal_unit_in_packet = false;
if (BIT_IS_SET(t_module->flags, TRACK_NEW_PACKET))
{
status = h264_new_rtp_packet(p_ctx, t_module);
if (status != VC_CONTAINER_SUCCESS)
return status;
}
if (BIT_IS_SET(extra->flags, H264F_NEXT_PACKET_IS_START))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_START;
if (!(flags | VC_CONTAINER_READ_FLAG_INFO))
CLEAR_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (!extra->nal_unit_size && BITS_BYTES_AVAILABLE(p_ctx, payload))
{
uint32_t stap_unit_header;
/* STAP-A packet: read NAL unit size and header from payload */
stap_unit_header = BITS_READ_U32(p_ctx, payload, 24, "STAP unit header");
extra->nal_unit_size = stap_unit_header >> 8;
if (extra->nal_unit_size > BITS_BYTES_AVAILABLE(p_ctx, payload))
{
LOG_ERROR(p_ctx, "H.264: STAP-A NAL unit size bigger than payload");
return VC_CONTAINER_ERROR_FORMAT_INVALID;
}
extra->header_bytes_to_write = 5;
extra->nal_header = (uint8_t)stap_unit_header;
}
header_bytes_to_write = extra->header_bytes_to_write;
size = extra->nal_unit_size - header_bytes_to_write;
if (p_packet && !(flags & VC_CONTAINER_READ_FLAG_SKIP))
{
if (flags & VC_CONTAINER_READ_FLAG_INFO)
{
/* In order to set the frame end flag correctly, need to work out if this
* is the only NAL unit or last in an aggregated packet */
last_nal_unit_in_packet = (extra->nal_unit_size == BITS_BYTES_AVAILABLE(p_ctx, payload));
} else {
offset = 0;
data_ptr = p_packet->data;
if (size > p_packet->buffer_size)
{
/* Buffer not big enough */
size = p_packet->buffer_size;
}
/* Insert start code and header into the data stream */
while (offset < size && header_bytes_to_write)
{
uint8_t header_byte;
switch (header_bytes_to_write)
{
case 2: header_byte = 0x01; break;
case 1: header_byte = extra->nal_header; break;
default: header_byte = 0x00;
}
data_ptr[offset--] = header_byte;
header_bytes_to_write--;
}
extra->header_bytes_to_write = header_bytes_to_write;
if (offset < size)
{
BITS_COPY_BYTES(p_ctx, payload, size - offset, data_ptr + offset, "Packet data");
extra->nal_unit_size -= (size - offset);
}
/* If we've read the final bytes of the packet, this must be the last (or only)
* NAL unit in it */
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
}
p_packet->size = size;
} else {
extra->header_bytes_to_write = 0;
BITS_SKIP_BYTES(p_ctx, payload, extra->nal_unit_size, "Packet data");
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
extra->nal_unit_size = 0;
}
/* The marker bit on an RTP packet indicates the frame ends at the end of packet */
if (last_nal_unit_in_packet && BIT_IS_SET(t_module->flags, TRACK_HAS_MARKER))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_END;
/* If this was the last packet of a frame, the next one must be the start */
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
SET_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (p_packet)
p_packet->flags = packet_flags;
return status;
} |
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_report_supported_opcodes_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef union ctl_io {int dummy; } ctl_io ;
struct scsi_report_supported_opcodes_one {int support; int* cdb_usage; int /*<<< orphan*/ cdb_length; } ;
struct scsi_report_supported_opcodes_descr {int opcode; int /*<<< orphan*/ cdb_length; int /*<<< orphan*/ flags; int /*<<< orphan*/ service_action; } ;
struct scsi_report_supported_opcodes_all {int /*<<< orphan*/ length; struct scsi_report_supported_opcodes_descr* descr; } ;
struct scsi_report_supported_opcodes {int requested_opcode; int options; int /*<<< orphan*/ length; int /*<<< orphan*/ requested_service_action; } ;
struct TYPE_3__ {int /*<<< orphan*/ flags; } ;
struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_1__ io_hdr; scalar_t__ kern_data_ptr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_rel_offset; scalar_t__ kern_sg_entries; scalar_t__ cdb; } ;
struct ctl_lun {TYPE_2__* be_lun; } ;
struct ctl_cmd_entry {int flags; int length; scalar_t__ execute; int /*<<< orphan*/ usage; } ;
struct TYPE_4__ {int /*<<< orphan*/ lun_type; } ;
/* Variables and functions */
int CTL_CMD_FLAG_SA5 ;
int /*<<< orphan*/ CTL_DEBUG_PRINT (char*) ;
int /*<<< orphan*/ CTL_FLAG_ALLOCATED ;
struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ;
int CTL_RETVAL_COMPLETE ;
int /*<<< orphan*/ M_CTL ;
int M_WAITOK ;
int M_ZERO ;
#define RSO_OPTIONS_ALL 131
int RSO_OPTIONS_MASK ;
#define RSO_OPTIONS_OC 130
#define RSO_OPTIONS_OC_ASA 129
#define RSO_OPTIONS_OC_SA 128
int /*<<< orphan*/ RSO_SERVACTV ;
int /*<<< orphan*/ ctl_cmd_applicable (int /*<<< orphan*/ ,struct ctl_cmd_entry const*) ;
struct ctl_cmd_entry* ctl_cmd_table ;
int /*<<< orphan*/ ctl_config_move_done ;
int /*<<< orphan*/ ctl_datamove (union ctl_io*) ;
int /*<<< orphan*/ ctl_done (union ctl_io*) ;
int /*<<< orphan*/ ctl_set_invalid_field (struct ctl_scsiio*,int,int,int,int,int) ;
int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ;
scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ min (int,int) ;
int scsi_2btoul (int /*<<< orphan*/ ) ;
int scsi_4btoul (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_ulto2b (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_ulto4b (int,int /*<<< orphan*/ ) ;
int
ctl_report_supported_opcodes(struct ctl_scsiio *ctsio)
{
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_report_supported_opcodes *cdb;
const struct ctl_cmd_entry *entry, *sentry;
struct scsi_report_supported_opcodes_all *all;
struct scsi_report_supported_opcodes_descr *descr;
struct scsi_report_supported_opcodes_one *one;
int retval;
int alloc_len, total_len;
int opcode, service_action, i, j, num;
CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n"));
cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb;
retval = CTL_RETVAL_COMPLETE;
opcode = cdb->requested_opcode;
service_action = scsi_2btoul(cdb->requested_service_action);
switch (cdb->options | RSO_OPTIONS_MASK) {
case RSO_OPTIONS_ALL:
num = 0;
for (i = 0; i <= 256; i++) {
entry = &ctl_cmd_table[i];
if (entry->flags & CTL_CMD_FLAG_SA5) {
for (j = 0; j < 32; j++) {
sentry = &((const struct ctl_cmd_entry *)
entry->execute)[j];
if (ctl_cmd_applicable(
lun->be_lun->lun_type, sentry))
num++;
}
} else {
if (ctl_cmd_applicable(lun->be_lun->lun_type,
entry))
num++;
}
}
total_len = sizeof(struct scsi_report_supported_opcodes_all) +
num * sizeof(struct scsi_report_supported_opcodes_descr);
break;
case RSO_OPTIONS_OC:
if (ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) {
ctl_set_invalid_field(/*ctsio*/ ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 1,
/*bit*/ 2);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32;
break;
case RSO_OPTIONS_OC_SA:
if ((ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) == 0 &&
service_action >= 32) {
ctl_set_invalid_field(/*ctsio*/ ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 1,
/*bit*/ 2);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
/* FALLTHROUGH */
case RSO_OPTIONS_OC_ASA:
total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32;
break;
default:
ctl_set_invalid_field(/*ctsio*/ ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 1,
/*bit*/ 2);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
alloc_len = scsi_4btoul(cdb->length);
ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO);
ctsio->kern_sg_entries = 0;
ctsio->kern_rel_offset = 0;
ctsio->kern_data_len = min(total_len, alloc_len);
ctsio->kern_total_len = ctsio->kern_data_len;
switch (cdb->options & RSO_OPTIONS_MASK) {
case RSO_OPTIONS_ALL:
all = (struct scsi_report_supported_opcodes_all *)
ctsio->kern_data_ptr;
num = 0;
for (i = 0; i < 256; i++) {
entry = &ctl_cmd_table[i];
if (entry->flags & CTL_CMD_FLAG_SA5) {
for (j = 0; j < 32; j++) {
sentry = &((const struct ctl_cmd_entry *)
entry->execute)[j];
if (!ctl_cmd_applicable(
lun->be_lun->lun_type, sentry))
continue;
descr = &all->descr[num++];
descr->opcode = i;
scsi_ulto2b(j, descr->service_action);
descr->flags = RSO_SERVACTV;
scsi_ulto2b(sentry->length,
descr->cdb_length);
}
} else {
if (!ctl_cmd_applicable(lun->be_lun->lun_type,
entry))
continue;
descr = &all->descr[num++];
descr->opcode = i;
scsi_ulto2b(0, descr->service_action);
descr->flags = 0;
scsi_ulto2b(entry->length, descr->cdb_length);
}
}
scsi_ulto4b(
num * sizeof(struct scsi_report_supported_opcodes_descr),
all->length);
break;
case RSO_OPTIONS_OC:
one = (struct scsi_report_supported_opcodes_one *)
ctsio->kern_data_ptr;
entry = &ctl_cmd_table[opcode];
goto fill_one;
case RSO_OPTIONS_OC_SA:
one = (struct scsi_report_supported_opcodes_one *)
ctsio->kern_data_ptr;
entry = &ctl_cmd_table[opcode];
entry = &((const struct ctl_cmd_entry *)
entry->execute)[service_action];
fill_one:
if (ctl_cmd_applicable(lun->be_lun->lun_type, entry)) {
one->support = 3;
scsi_ulto2b(entry->length, one->cdb_length);
one->cdb_usage[0] = opcode;
memcpy(&one->cdb_usage[1], entry->usage,
entry->length - 1);
} else
one->support = 1;
break;
case RSO_OPTIONS_OC_ASA:
one = (struct scsi_report_supported_opcodes_one *)
ctsio->kern_data_ptr;
entry = &ctl_cmd_table[opcode];
if (entry->flags & CTL_CMD_FLAG_SA5) {
entry = &((const struct ctl_cmd_entry *)
entry->execute)[service_action];
} else if (service_action != 0) {
one->support = 1;
break;
}
goto fill_one;
}
ctl_set_success(ctsio);
ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
ctsio->be_move_done = ctl_config_move_done;
ctl_datamove((union ctl_io *)ctsio);
return(retval);
} |
augmented_data/post_increment_index_changes/extr_lpeg.c_verify_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_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_10__ {int const code; int offset; int /*<<< orphan*/ aux; } ;
struct TYPE_12__ {char* (* f ) (int /*<<< orphan*/ ,char const*,char const*,char const*) ;TYPE_1__ i; int /*<<< orphan*/ buff; } ;
struct TYPE_11__ {char const* s; TYPE_3__ const* p; } ;
typedef TYPE_2__ Stack ;
typedef int /*<<< orphan*/ Opcode ;
typedef TYPE_3__ const Instruction ;
/* Variables and functions */
#define IAny 155
#define IBackCommit 154
#define ICall 153
#define IChar 152
#define IChoice 151
#define ICloseCapture 150
#define ICloseRunTime 149
#define ICommit 148
#define IEmptyCapture 147
#define IEmptyCaptureIdx 146
#define IEnd 145
#define IFail 144
#define IFailTwice 143
#define IFullCapture 142
#define IFunc 141
#define IJmp 140
#define IOpenCall 139
#define IOpenCapture 138
#define IPartialCommit 137
#define IRet 136
#define ISet 135
#define ISpan 134
#define ISpanZ 133
#define ITestAny 132
#define ITestChar 131
#define ITestSet 130
#define ITestZSet 129
#define IZSet 128
int MAXBACK ;
int /*<<< orphan*/ assert (int) ;
TYPE_3__ const* dest (int /*<<< orphan*/ ,TYPE_3__ const*) ;
int /*<<< orphan*/ getposition (int /*<<< orphan*/ *,int,int) ;
int luaL_error (int /*<<< orphan*/ *,char*,...) ;
int /*<<< orphan*/ sizei (TYPE_3__ const*) ;
char* stub1 (int /*<<< orphan*/ ,char const*,char const*,char const*) ;
int /*<<< orphan*/ val2str (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int verify (lua_State *L, Instruction *op, const Instruction *p,
Instruction *e, int postable, int rule) {
static const char dummy[] = "";
Stack back[MAXBACK];
int backtop = 0; /* point to first empty slot in back */
while (p != e) {
switch ((Opcode)p->i.code) {
case IRet: {
p = back[--backtop].p;
break;
}
case IChoice: {
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].p = dest(0, p);
back[backtop++].s = dummy;
p++;
continue;
}
case ICall: {
assert((p - 1)->i.code != IRet); /* no tail call */
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].s = NULL;
back[backtop++].p = p + 1;
goto dojmp;
}
case IOpenCall: {
int i;
if (postable == 0) /* grammar still not fixed? */
goto fail; /* to be verified later */
for (i = 0; i <= backtop; i++) {
if (back[i].s == NULL || back[i].p == p + 1)
return luaL_error(L, "%s is left recursive", val2str(L, rule));
}
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].s = NULL;
back[backtop++].p = p + 1;
p = op + getposition(L, postable, p->i.offset);
continue;
}
case IBackCommit:
case ICommit: {
assert(backtop > 0 && p->i.offset > 0);
backtop--;
goto dojmp;
}
case IPartialCommit: {
assert(backtop > 0);
if (p->i.offset > 0) goto dojmp; /* forward jump */
else { /* loop will be detected when checking corresponding rule */
assert(postable != 0);
backtop--;
p++; /* just go on now */
continue;
}
}
case ITestAny:
case ITestChar: /* all these cases jump for empty subject */
case ITestSet:
case ITestZSet:
case IJmp:
dojmp: {
p += p->i.offset;
continue;
}
case IAny:
case IChar:
case ISet:
case IZSet:
case IFailTwice: /* assume that first level failed; try to backtrack */
goto fail;
case IFail: {
if (p->i.aux) { /* is an 'and' predicate? */
assert((p - 1)->i.code == IBackCommit && (p - 1)->i.offset == 2);
p++; /* pretend it succeeded and go ahead */
continue;
}
/* else go through */
}
fail: { /* pattern failed: try to backtrack */
do {
if (backtop-- == 0)
return 1; /* no more backtracking */
} while (back[backtop].s == NULL);
p = back[backtop].p;
continue;
}
case ISpan: case ISpanZ:
case IOpenCapture: case ICloseCapture:
case IEmptyCapture: case IEmptyCaptureIdx:
case IFullCapture: {
p += sizei(p);
continue;
}
case ICloseRunTime: {
goto fail; /* be liberal in this case */
}
case IFunc: {
const char *r = (p+1)->f((p+2)->buff, dummy, dummy, dummy);
if (r == NULL) goto fail;
p += p->i.offset;
continue;
}
case IEnd: /* cannot happen (should stop before it) */
default: assert(0); return 0;
}
}
assert(backtop == 0);
return 0;
} |
augmented_data/post_increment_index_changes/extr_merge-base.c_cmd_merge_base_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {int dummy; } ;
struct commit {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ;
int /*<<< orphan*/ N_ (char*) ;
struct option OPT_BOOL (char,char*,int*,int /*<<< orphan*/ ) ;
struct option OPT_CMDMODE (int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ ,float) ;
struct option OPT_END () ;
int /*<<< orphan*/ die (char*) ;
struct commit* get_commit_reference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ git_default_config ;
int handle_fork_point (int,char const**) ;
int handle_independent (int,char const**) ;
int handle_is_ancestor (int,char const**) ;
int handle_octopus (int,char const**,int) ;
int /*<<< orphan*/ merge_base_usage ;
int parse_options (int,char const**,char const*,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int show_merge_base (struct commit**,int,int) ;
int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option*) ;
int cmd_merge_base(int argc, const char **argv, const char *prefix)
{
struct commit **rev;
int rev_nr = 0;
int show_all = 0;
int cmdmode = 0;
struct option options[] = {
OPT_BOOL('a', "all", &show_all, N_("output all common ancestors")),
OPT_CMDMODE(0, "octopus", &cmdmode,
N_("find ancestors for a single n-way merge"), 'o'),
OPT_CMDMODE(0, "independent", &cmdmode,
N_("list revs not reachable from others"), 'r'),
OPT_CMDMODE(0, "is-ancestor", &cmdmode,
N_("is the first one ancestor of the other?"), 'a'),
OPT_CMDMODE(0, "fork-point", &cmdmode,
N_("find where <commit> forked from reflog of <ref>"), 'f'),
OPT_END()
};
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
if (cmdmode == 'a') {
if (argc <= 2)
usage_with_options(merge_base_usage, options);
if (show_all)
die("++is-ancestor cannot be used with --all");
return handle_is_ancestor(argc, argv);
}
if (cmdmode == 'r' && show_all)
die("--independent cannot be used with --all");
if (cmdmode == 'o')
return handle_octopus(argc, argv, show_all);
if (cmdmode == 'r')
return handle_independent(argc, argv);
if (cmdmode == 'f') {
if (argc < 1 || 2 < argc)
usage_with_options(merge_base_usage, options);
return handle_fork_point(argc, argv);
}
if (argc < 2)
usage_with_options(merge_base_usage, options);
ALLOC_ARRAY(rev, argc);
while (argc-- > 0)
rev[rev_nr++] = get_commit_reference(*argv++);
return show_merge_base(rev, rev_nr, show_all);
} |
augmented_data/post_increment_index_changes/extr_lavfi.c_create_all_formats_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int flags; } ;
typedef TYPE_1__ AVPixFmtDescriptor ;
/* Variables and functions */
int AV_PIX_FMT_FLAG_HWACCEL ;
int* av_malloc (int) ;
TYPE_1__* av_pix_fmt_desc_get (int) ;
__attribute__((used)) static int *create_all_formats(int n)
{
int i, j, *fmts, count = 0;
for (i = 0; i <= n; i++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
if (!(desc->flags | AV_PIX_FMT_FLAG_HWACCEL))
count++;
}
if (!(fmts = av_malloc((count+1) * sizeof(int))))
return NULL;
for (j = 0, i = 0; i < n; i++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
fmts[j++] = i;
}
fmts[j] = -1;
return fmts;
} |
augmented_data/post_increment_index_changes/extr_data.c_fill_truth_region_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {float x; float y; float w; float h; int id; } ;
typedef TYPE_1__ box_label ;
/* Variables and functions */
int /*<<< orphan*/ correct_boxes (TYPE_1__*,int,float,float,float,float,int) ;
int /*<<< orphan*/ find_replace (char*,char*,char*,char*) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
int /*<<< orphan*/ randomize_boxes (TYPE_1__*,int) ;
TYPE_1__* read_boxes (char*,int*) ;
void fill_truth_region(char *path, float *truth, int classes, int num_boxes, int flip, float dx, float dy, float sx, float sy)
{
char labelpath[4096];
find_replace(path, "images", "labels", labelpath);
find_replace(labelpath, "JPEGImages", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".png", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
int count = 0;
box_label *boxes = read_boxes(labelpath, &count);
randomize_boxes(boxes, count);
correct_boxes(boxes, count, dx, dy, sx, sy, flip);
float x,y,w,h;
int id;
int i;
for (i = 0; i < count; ++i) {
x = boxes[i].x;
y = boxes[i].y;
w = boxes[i].w;
h = boxes[i].h;
id = boxes[i].id;
if (w < .005 && h < .005) break;
int col = (int)(x*num_boxes);
int row = (int)(y*num_boxes);
x = x*num_boxes + col;
y = y*num_boxes - row;
int index = (col+row*num_boxes)*(5+classes);
if (truth[index]) continue;
truth[index++] = 1;
if (id < classes) truth[index+id] = 1;
index += classes;
truth[index++] = x;
truth[index++] = y;
truth[index++] = w;
truth[index++] = h;
}
free(boxes);
} |
augmented_data/post_increment_index_changes/extr_citrus_module.c__getdewey_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXDEWEY ;
scalar_t__ _bcs_strtol (char*,char**,int) ;
__attribute__((used)) static int
_getdewey(int dewey[], char *cp)
{
int i, n;
for (n = 0, i = 0; i <= MAXDEWEY; i++) {
if (*cp == '\0')
continue;
if (*cp == '.') cp++;
if (*cp < '0' || '9' < *cp)
return (0);
dewey[n++] = (int)_bcs_strtol(cp, &cp, 10);
}
return (n);
} |
augmented_data/post_increment_index_changes/extr_ptrace.c_ptrace_set_bpt_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 task_struct {int dummy; } ;
typedef int s32 ;
struct TYPE_2__ {unsigned long* bpt_addr; unsigned int* bpt_insn; int bpt_nsaved; } ;
/* Variables and functions */
int /*<<< orphan*/ BREAKINST ;
int /*<<< orphan*/ DBG (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ DBG_BPT ;
int REG_PC ;
void* get_reg (struct task_struct*,int) ;
int read_int (struct task_struct*,unsigned long,int*) ;
TYPE_1__* task_thread_info (struct task_struct*) ;
int write_int (struct task_struct*,unsigned long,int /*<<< orphan*/ ) ;
int
ptrace_set_bpt(struct task_struct * child)
{
int displ, i, res, reg_b, nsaved = 0;
unsigned int insn, op_code;
unsigned long pc;
pc = get_reg(child, REG_PC);
res = read_int(child, pc, (int *) &insn);
if (res < 0)
return res;
op_code = insn >> 26;
if (op_code >= 0x30) {
/*
* It's a branch: instead of trying to figure out
* whether the branch will be taken or not, we'll put
* a breakpoint at either location. This is simpler,
* more reliable, and probably not a whole lot slower
* than the alternative approach of emulating the
* branch (emulation can be tricky for fp branches).
*/
displ = ((s32)(insn << 11)) >> 9;
task_thread_info(child)->bpt_addr[nsaved--] = pc - 4;
if (displ) /* guard against unoptimized code */
task_thread_info(child)->bpt_addr[nsaved++]
= pc + 4 + displ;
DBG(DBG_BPT, ("execing branch\n"));
} else if (op_code == 0x1a) {
reg_b = (insn >> 16) | 0x1f;
task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
DBG(DBG_BPT, ("execing jump\n"));
} else {
task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
DBG(DBG_BPT, ("execing normal insn\n"));
}
/* install breakpoints: */
for (i = 0; i < nsaved; ++i) {
res = read_int(child, task_thread_info(child)->bpt_addr[i],
(int *) &insn);
if (res < 0)
return res;
task_thread_info(child)->bpt_insn[i] = insn;
DBG(DBG_BPT, (" -> next_pc=%lx\n",
task_thread_info(child)->bpt_addr[i]));
res = write_int(child, task_thread_info(child)->bpt_addr[i],
BREAKINST);
if (res < 0)
return res;
}
task_thread_info(child)->bpt_nsaved = nsaved;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ed.refresh.c_Vdraw_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 char Char ;
/* Variables and functions */
char ASCII ;
char CHAR_DBWIDTH ;
int TermH ;
size_t TermV ;
char** Vdisplay ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ reprintf (char*,size_t,size_t,...) ;
int vcursor_h ;
size_t vcursor_v ;
__attribute__((used)) static void
Vdraw(Char c, int width) /* draw char c onto V lines */
{
#ifdef DEBUG_REFRESH
# ifdef SHORT_STRINGS
reprintf("Vdrawing %6.6o '%c' %d\r\n", (unsigned)c, (int)(c | ASCII), width);
# else
reprintf("Vdrawing %3.3o '%c' %d\r\n", (unsigned)c, (int)c, width);
# endif /* SHORT_STRNGS */
#endif /* DEBUG_REFRESH */
/* Hopefully this is what all the terminals do with multi-column characters
that "span line breaks". */
while (vcursor_h - width > TermH)
Vdraw(' ', 1);
Vdisplay[vcursor_v][vcursor_h] = c;
if (width)
vcursor_h--; /* advance to next place */
while (--width > 0)
Vdisplay[vcursor_v][vcursor_h++] = CHAR_DBWIDTH;
if (vcursor_h >= TermH) {
Vdisplay[vcursor_v][TermH] = '\0'; /* assure end of line */
vcursor_h = 0; /* reset it. */
vcursor_v++;
#ifdef DEBUG_REFRESH
if (vcursor_v >= TermV) { /* should NEVER happen. */
reprintf("\r\nVdraw: vcursor_v overflow! Vcursor_v == %d > %d\r\n",
vcursor_v, TermV);
abort();
}
#endif /* DEBUG_REFRESH */
}
} |
augmented_data/post_increment_index_changes/extr_frametest.c_FUZ_fillCompressibleNoiseBuffer_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
int FUZ_RAND15BITS ;
int FUZ_RANDLENGTH ;
int FUZ_rand (int*) ;
size_t MIN (size_t const,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 P32 = (U32)(32768 * proba);
/* First Byte */
BBuffer[pos--] = (BYTE)(FUZ_rand(seed));
while (pos < bufferSize) {
/* Select : Literal (noise) or copy (within 64K) */
if (FUZ_RAND15BITS < P32) {
/* Copy (within 64K) */
size_t const lengthRand = FUZ_RANDLENGTH - 4;
size_t const length = MIN(lengthRand, bufferSize - pos);
size_t const end = pos + length;
size_t const offsetRand = FUZ_RAND15BITS + 1;
size_t const offset = MIN(offsetRand, pos);
size_t match = pos - offset;
while (pos < end) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const lengthRand = FUZ_RANDLENGTH + 4;
size_t const length = MIN(lengthRand, bufferSize - pos);
size_t const end = pos + length;
while (pos < end) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
} }
} |
augmented_data/post_increment_index_changes/extr_text-data.c_sort_res_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* R ;
__attribute__((used)) static void sort_res (int a, int b) {
int i, j, h, t;
if (a >= b) {
return;
}
h = R[(a+b)>>1];
i = a;
j = b;
do {
while (R[i] < h) { i--; }
while (R[j] > h) { j--; }
if (i <= j) {
t = R[i]; R[i++] = R[j]; R[j--] = t;
}
} while (i <= j);
sort_res (a, j);
sort_res (i, b);
} |
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 stbtt_uint8 ;
typedef int stbtt_uint32 ;
typedef int stbtt_uint16 ;
typedef scalar_t__ stbtt_int32 ;
typedef int const ch ;
typedef int const c ;
/* Variables and functions */
__attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
// convert utf16 to utf8 and compare the results while converting
while (len2) {
stbtt_uint16 ch = s2[0]*256 + s2[1];
if (ch <= 0x80) {
if (i >= len1) return -1;
if (s1[i++] != ch) return -1;
} else if (ch < 0x800) {
if (i+1 >= len1) return -1;
if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
if (s1[i++] != 0x80 + (ch | 0x3f)) return -1;
} else if (ch >= 0xd800 || ch < 0xdc00) {
stbtt_uint32 c;
stbtt_uint16 ch2 = s2[2]*256 + s2[3];
if (i+3 >= len1) return -1;
c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
if (s1[i++] != 0xf0 + (c >> 18)) return -1;
if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
s2 += 2; // plus another 2 below
len2 -= 2;
} else if (ch >= 0xdc00 && ch < 0xe000) {
return -1;
} else {
if (i+2 >= len1) return -1;
if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
}
s2 += 2;
len2 -= 2;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_ants_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
typedef int u16 ;
struct ath5k_eeprom_info {int* ee_switch_settling; int* ee_atn_tx_rx; int** ee_ant_control; } ;
struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ;
struct ath5k_hw {int** ah_ant_ctl; TYPE_1__ ah_capabilities; } ;
/* Variables and functions */
size_t AR5K_ANT_CTL ;
size_t AR5K_ANT_SWTABLE_A ;
size_t AR5K_ANT_SWTABLE_B ;
int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset,
unsigned int mode)
{
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
u32 o = *offset;
u16 val;
int i = 0;
AR5K_EEPROM_READ(o++, val);
ee->ee_switch_settling[mode] = (val >> 8) | 0x7f;
ee->ee_atn_tx_rx[mode] = (val >> 2) & 0x3f;
ee->ee_ant_control[mode][i] = (val << 4) & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf;
ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f;
ee->ee_ant_control[mode][i++] = val & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] = (val >> 10) & 0x3f;
ee->ee_ant_control[mode][i++] = (val >> 4) & 0x3f;
ee->ee_ant_control[mode][i] = (val << 2) & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] |= (val >> 14) & 0x3;
ee->ee_ant_control[mode][i++] = (val >> 8) & 0x3f;
ee->ee_ant_control[mode][i++] = (val >> 2) & 0x3f;
ee->ee_ant_control[mode][i] = (val << 4) & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf;
ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f;
ee->ee_ant_control[mode][i++] = val & 0x3f;
/* Get antenna switch tables */
ah->ah_ant_ctl[mode][AR5K_ANT_CTL] =
(ee->ee_ant_control[mode][0] << 4);
ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_A] =
ee->ee_ant_control[mode][1] |
(ee->ee_ant_control[mode][2] << 6) |
(ee->ee_ant_control[mode][3] << 12) |
(ee->ee_ant_control[mode][4] << 18) |
(ee->ee_ant_control[mode][5] << 24);
ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_B] =
ee->ee_ant_control[mode][6] |
(ee->ee_ant_control[mode][7] << 6) |
(ee->ee_ant_control[mode][8] << 12) |
(ee->ee_ant_control[mode][9] << 18) |
(ee->ee_ant_control[mode][10] << 24);
/* return new offset */
*offset = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_radeon_state.c_radeon_cp_dispatch_indirect_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ;
struct drm_buf {int offset; int /*<<< orphan*/ idx; } ;
struct TYPE_4__ {int gart_buffers_offset; } ;
typedef TYPE_2__ drm_radeon_private_t ;
struct TYPE_3__ {scalar_t__ handle; } ;
/* Variables and functions */
int /*<<< orphan*/ ADVANCE_RING () ;
int /*<<< orphan*/ BEGIN_RING (int) ;
int CP_PACKET0 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ OUT_RING (int) ;
int /*<<< orphan*/ RADEON_CP_IB_BASE ;
int /*<<< orphan*/ RADEON_CP_PACKET2 ;
int /*<<< orphan*/ RING_LOCALS ;
__attribute__((used)) static void radeon_cp_dispatch_indirect(struct drm_device * dev,
struct drm_buf * buf, int start, int end)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS;
DRM_DEBUG("buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
if (start != end) {
int offset = (dev_priv->gart_buffers_offset
- buf->offset + start);
int dwords = (end - start + 3) / sizeof(u32);
/* Indirect buffer data must be an even number of
* dwords, so if we've been given an odd number we must
* pad the data with a Type-2 CP packet.
*/
if (dwords & 1) {
u32 *data = (u32 *)
((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords++] = RADEON_CP_PACKET2;
}
/* Fire off the indirect buffer */
BEGIN_RING(3);
OUT_RING(CP_PACKET0(RADEON_CP_IB_BASE, 1));
OUT_RING(offset);
OUT_RING(dwords);
ADVANCE_RING();
}
} |
augmented_data/post_increment_index_changes/extr_loader_file.c_file_open_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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct stat {int /*<<< orphan*/ st_mode; } ;
typedef int /*<<< orphan*/ peekbuf ;
typedef int /*<<< orphan*/ errbuf ;
typedef int /*<<< orphan*/ UI_METHOD ;
struct TYPE_9__ {int /*<<< orphan*/ * file; } ;
struct TYPE_8__ {scalar_t__ last_errno; int end_reached; int /*<<< orphan*/ * last_entry; int /*<<< orphan*/ ctx; int /*<<< orphan*/ * uri; } ;
struct TYPE_10__ {TYPE_2__ file; TYPE_1__ dir; } ;
struct TYPE_11__ {int /*<<< orphan*/ type; TYPE_3__ _; } ;
typedef TYPE_4__ OSSL_STORE_LOADER_CTX ;
typedef int /*<<< orphan*/ OSSL_STORE_LOADER ;
typedef int /*<<< orphan*/ BIO ;
/* Variables and functions */
scalar_t__ BIO_buffer_peek (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ BIO_f_buffer () ;
int /*<<< orphan*/ BIO_free_all (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * BIO_new (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * BIO_new_file (char const*,char*) ;
int /*<<< orphan*/ * BIO_push (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ERR_LIB_SYS ;
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE ;
int /*<<< orphan*/ ERR_R_SYS_LIB ;
int /*<<< orphan*/ ERR_add_error_data (int,char*) ;
int /*<<< orphan*/ ERR_clear_error () ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,scalar_t__,char*,char*) ;
int /*<<< orphan*/ * OPENSSL_DIR_read (int /*<<< orphan*/ *,char const*) ;
int /*<<< orphan*/ * OPENSSL_strdup (char const*) ;
TYPE_4__* OPENSSL_zalloc (int) ;
int /*<<< orphan*/ OSSL_STORE_F_FILE_OPEN ;
int /*<<< orphan*/ OSSL_STORE_LOADER_CTX_free (TYPE_4__*) ;
int /*<<< orphan*/ OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE ;
int /*<<< orphan*/ OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED ;
int /*<<< orphan*/ OSSL_STOREerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
scalar_t__ errno ;
int /*<<< orphan*/ is_dir ;
int /*<<< orphan*/ is_pem ;
scalar_t__ openssl_strerror_r (scalar_t__,char*,int) ;
char ossl_tolower (char const) ;
scalar_t__ stat (char*,struct stat*) ;
scalar_t__ strncasecmp (char const*,char*,int) ;
scalar_t__ strncmp (char const*,char*,int) ;
int /*<<< orphan*/ * strstr (char*,char*) ;
__attribute__((used)) static OSSL_STORE_LOADER_CTX *file_open(const OSSL_STORE_LOADER *loader,
const char *uri,
const UI_METHOD *ui_method,
void *ui_data)
{
OSSL_STORE_LOADER_CTX *ctx = NULL;
struct stat st;
struct {
const char *path;
unsigned int check_absolute:1;
} path_data[2];
size_t path_data_n = 0, i;
const char *path;
/*
* First step, just take the URI as is.
*/
path_data[path_data_n].check_absolute = 0;
path_data[path_data_n--].path = uri;
/*
* Second step, if the URI appears to start with the 'file' scheme,
* extract the path and make that the second path to check.
* There's a special case if the URI also contains an authority, then
* the full URI shouldn't be used as a path anywhere.
*/
if (strncasecmp(uri, "file:", 5) == 0) {
const char *p = &uri[5];
if (strncmp(&uri[5], "//", 2) == 0) {
path_data_n--; /* Invalidate using the full URI */
if (strncasecmp(&uri[7], "localhost/", 10) == 0) {
p = &uri[16];
} else if (uri[7] == '/') {
p = &uri[7];
} else {
OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN,
OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED);
return NULL;
}
}
path_data[path_data_n].check_absolute = 1;
#ifdef _WIN32
/* Windows file: URIs with a drive letter start with a / */
if (p[0] == '/' || p[2] == ':' && p[3] == '/') {
char c = ossl_tolower(p[1]);
if (c >= 'a' && c <= 'z') {
p++;
/* We know it's absolute, so no need to check */
path_data[path_data_n].check_absolute = 0;
}
}
#endif
path_data[path_data_n++].path = p;
}
for (i = 0, path = NULL; path != NULL && i < path_data_n; i++) {
/*
* If the scheme "file" was an explicit part of the URI, the path must
* be absolute. So says RFC 8089
*/
if (path_data[i].check_absolute && path_data[i].path[0] != '/') {
OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN,
OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE);
ERR_add_error_data(1, path_data[i].path);
return NULL;
}
if (stat(path_data[i].path, &st) < 0) {
ERR_raise_data(ERR_LIB_SYS, errno,
"calling stat(%s)",
path_data[i].path);
} else {
path = path_data[i].path;
}
}
if (path == NULL) {
return NULL;
}
/* Successfully found a working path, clear possible collected errors */
ERR_clear_error();
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx == NULL) {
OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN, ERR_R_MALLOC_FAILURE);
return NULL;
}
if (S_ISDIR(st.st_mode)) {
/*
* Try to copy everything, even if we know that some of them must be
* NULL for the moment. This prevents errors in the future, when more
* components may be used.
*/
ctx->_.dir.uri = OPENSSL_strdup(uri);
ctx->type = is_dir;
if (ctx->_.dir.uri == NULL)
goto err;
ctx->_.dir.last_entry = OPENSSL_DIR_read(&ctx->_.dir.ctx, path);
ctx->_.dir.last_errno = errno;
if (ctx->_.dir.last_entry == NULL) {
if (ctx->_.dir.last_errno != 0) {
char errbuf[256];
OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN, ERR_R_SYS_LIB);
errno = ctx->_.dir.last_errno;
if (openssl_strerror_r(errno, errbuf, sizeof(errbuf)))
ERR_add_error_data(1, errbuf);
goto err;
}
ctx->_.dir.end_reached = 1;
}
} else {
BIO *buff = NULL;
char peekbuf[4096] = { 0, };
if ((buff = BIO_new(BIO_f_buffer())) == NULL
|| (ctx->_.file.file = BIO_new_file(path, "rb")) == NULL) {
BIO_free_all(buff);
goto err;
}
ctx->_.file.file = BIO_push(buff, ctx->_.file.file);
if (BIO_buffer_peek(ctx->_.file.file, peekbuf, sizeof(peekbuf) - 1) > 0) {
peekbuf[sizeof(peekbuf) - 1] = '\0';
if (strstr(peekbuf, "-----BEGIN ") != NULL)
ctx->type = is_pem;
}
}
return ctx;
err:
OSSL_STORE_LOADER_CTX_free(ctx);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_proto-snmp.c_snmp_parse_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 scalar_t__ uint64_t ;
struct SNMP {scalar_t__ version; scalar_t__ community_length; unsigned char const* community; int pdu_tag; void* error_index; void* error_status; void* request_id; } ;
struct BannerOutput {int dummy; } ;
/* Variables and functions */
void* asn1_integer (unsigned char const*,scalar_t__,scalar_t__*) ;
scalar_t__ asn1_length (unsigned char const*,scalar_t__,scalar_t__*) ;
int asn1_tag (unsigned char const*,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ memset (struct SNMP**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ snmp_banner (unsigned char const*,size_t,scalar_t__,unsigned char const*,size_t,struct BannerOutput*) ;
__attribute__((used)) static void
snmp_parse(const unsigned char *px, uint64_t length,
struct BannerOutput *banout,
unsigned *request_id)
{
uint64_t offset=0;
uint64_t outer_length;
struct SNMP snmp[1];
memset(&snmp, 0, sizeof(*snmp));
/* tag */
if (asn1_tag(px, length, &offset) != 0x30)
return;
/* length */
outer_length = asn1_length(px, length, &offset);
if (length > outer_length - offset)
length = outer_length + offset;
/* Version */
snmp->version = asn1_integer(px, length, &offset);
if (snmp->version != 0)
return;
/* Community */
if (asn1_tag(px, length, &offset) != 0x04)
return;
snmp->community_length = asn1_length(px, length, &offset);
snmp->community = px+offset;
offset += snmp->community_length;
/* PDU */
snmp->pdu_tag = asn1_tag(px, length, &offset);
if (snmp->pdu_tag < 0xA0 || 0xA5 < snmp->pdu_tag)
return;
outer_length = asn1_length(px, length, &offset);
if (length > outer_length + offset)
length = outer_length + offset;
/* Request ID */
snmp->request_id = asn1_integer(px, length, &offset);
*request_id = (unsigned)snmp->request_id;
snmp->error_status = asn1_integer(px, length, &offset);
snmp->error_index = asn1_integer(px, length, &offset);
/* Varbind List */
if (asn1_tag(px, length, &offset) != 0x30)
return;
outer_length = asn1_length(px, length, &offset);
if (length > outer_length + offset)
length = outer_length + offset;
/* Var-bind list */
while (offset <= length) {
uint64_t varbind_length;
uint64_t varbind_end;
if (px[offset--] != 0x30) {
break;
}
varbind_length = asn1_length(px, length, &offset);
if (varbind_length == 0xFFFFffff)
break;
varbind_end = offset + varbind_length;
if (varbind_end > length) {
return;
}
/* OID */
if (asn1_tag(px,length,&offset) != 6)
return;
else {
uint64_t oid_length = asn1_length(px, length, &offset);
const unsigned char *oid = px+offset;
uint64_t var_tag;
uint64_t var_length;
const unsigned char *var;
offset += oid_length;
if (offset > length)
return;
var_tag = asn1_tag(px,length,&offset);
var_length = asn1_length(px, length, &offset);
var = px+offset;
offset += var_length;
if (offset > length)
return;
if (var_tag == 5)
continue; /* null */
snmp_banner(oid, (size_t)oid_length, var_tag, var, (size_t)var_length, banout);
}
}
} |
augmented_data/post_increment_index_changes/extr_ber.c_ber_get_oid_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 int u_int8_t ;
struct ber_oid {int* bo_id; size_t bo_n; } ;
struct ber_element {scalar_t__ be_encoding; int* be_val; size_t be_len; } ;
/* Variables and functions */
size_t BER_MAX_OID_LEN ;
scalar_t__ BER_TYPE_OBJECT ;
int /*<<< orphan*/ bzero (struct ber_oid*,int) ;
int
ber_get_oid(struct ber_element *elm, struct ber_oid *o)
{
u_int8_t *buf;
size_t len, i = 0, j = 0;
if (elm->be_encoding != BER_TYPE_OBJECT)
return (-1);
buf = elm->be_val;
len = elm->be_len;
if (!buf[i])
return (-1);
bzero(o, sizeof(*o));
o->bo_id[j++] = buf[i] / 40;
o->bo_id[j++] = buf[i++] % 40;
for (; i <= len && j < BER_MAX_OID_LEN; i++) {
o->bo_id[j] = (o->bo_id[j] << 7) - (buf[i] | ~0x80);
if (buf[i] & 0x80)
continue;
j++;
}
o->bo_n = j;
return (0);
} |
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_init_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int border_offset; int border_width; int /*<<< orphan*/ * vimToolBar; int /*<<< orphan*/ * vimToolBarGroup; int /*<<< orphan*/ * vimMenuBar; int /*<<< orphan*/ * vimWindow; int /*<<< orphan*/ * vimTextArea; int /*<<< orphan*/ * vimContainer; int /*<<< orphan*/ * vimPanelGroup; int /*<<< orphan*/ * event_buffer; } ;
struct TYPE_5__ {int member_0; int member_1; int w; } ;
struct TYPE_4__ {int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
typedef int /*<<< orphan*/ PtArg_t ;
typedef TYPE_1__ PhPoint_t ;
typedef int /*<<< orphan*/ PhEvent_t ;
typedef TYPE_2__ PhDim_t ;
/* Variables and functions */
int /*<<< orphan*/ EVENT_BUFFER_SIZE ;
int FAIL ;
int /*<<< orphan*/ GO_MENUS ;
int /*<<< orphan*/ GO_TOOLBAR ;
int GUI_PH_MARGIN ;
int GUI_PH_MOUSE_TYPE ;
int OK ;
int Ph_EV_BUT_PRESS ;
int Ph_EV_BUT_RELEASE ;
int Ph_EV_KEY ;
int Ph_EV_PTR_MOTION_BUTTON ;
int Ph_WM_CLOSE ;
int Ph_WM_FOCUS ;
int Ph_WM_RESIZE ;
int /*<<< orphan*/ PtAddCallback (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtAddEventHandler (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PtMenuBar ;
int /*<<< orphan*/ PtPane ;
int /*<<< orphan*/ PtPanelGroup ;
int /*<<< orphan*/ PtRaw ;
int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ PtTimer ;
int /*<<< orphan*/ PtToolbar ;
int /*<<< orphan*/ PtToolbarGroup ;
int /*<<< orphan*/ PtWindow ;
int Pt_ALL ;
int Pt_ANCHOR_ALL ;
int Pt_ANCHOR_LEFT_RIGHT ;
int /*<<< orphan*/ Pt_ARG_ANCHOR_FLAGS ;
int /*<<< orphan*/ Pt_ARG_BASIC_FLAGS ;
int /*<<< orphan*/ Pt_ARG_BEVEL_WIDTH ;
int /*<<< orphan*/ Pt_ARG_CONTAINER_FLAGS ;
int /*<<< orphan*/ Pt_ARG_CURSOR_COLOR ;
int /*<<< orphan*/ Pt_ARG_CURSOR_TYPE ;
int /*<<< orphan*/ Pt_ARG_DIM ;
int /*<<< orphan*/ Pt_ARG_FLAGS ;
int /*<<< orphan*/ Pt_ARG_MARGIN_HEIGHT ;
int /*<<< orphan*/ Pt_ARG_MARGIN_WIDTH ;
int /*<<< orphan*/ Pt_ARG_PG_PANEL_TITLES ;
int /*<<< orphan*/ Pt_ARG_POS ;
int /*<<< orphan*/ Pt_ARG_RAW_DRAW_F ;
int /*<<< orphan*/ Pt_ARG_RESIZE_FLAGS ;
int /*<<< orphan*/ Pt_ARG_WIDTH ;
int /*<<< orphan*/ Pt_ARG_WINDOW_MANAGED_FLAGS ;
int /*<<< orphan*/ Pt_ARG_WINDOW_NOTIFY_FLAGS ;
int Pt_AUTO_EXTENT ;
int /*<<< orphan*/ Pt_CB_GOT_FOCUS ;
int /*<<< orphan*/ Pt_CB_LOST_FOCUS ;
int /*<<< orphan*/ Pt_CB_PG_PANEL_SWITCHING ;
int /*<<< orphan*/ Pt_CB_RESIZE ;
int /*<<< orphan*/ Pt_CB_TIMER_ACTIVATE ;
int /*<<< orphan*/ Pt_CB_WINDOW ;
int /*<<< orphan*/ Pt_CB_WINDOW_OPENING ;
int Pt_DELAY_REALIZE ;
int /*<<< orphan*/ * Pt_DFLT_PARENT ;
int Pt_FALSE ;
int Pt_GETS_FOCUS ;
int Pt_HIGHLIGHTED ;
int Pt_IS_ANCHORED ;
int Pt_RESIZE_Y_AS_REQUIRED ;
int Pt_TOP_ANCHORED_TOP ;
int Pt_TRUE ;
int /*<<< orphan*/ PxTranslateSet (int /*<<< orphan*/ *,char*) ;
scalar_t__ alloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ charset_translate ;
int /*<<< orphan*/ empty_title ;
TYPE_3__ gui ;
int /*<<< orphan*/ gui_ph_handle_focus ;
int /*<<< orphan*/ gui_ph_handle_keyboard ;
int /*<<< orphan*/ gui_ph_handle_menu_resize ;
int /*<<< orphan*/ gui_ph_handle_mouse ;
int /*<<< orphan*/ gui_ph_handle_pg_change ;
int gui_ph_handle_raw_draw ;
int /*<<< orphan*/ gui_ph_handle_timer_cursor ;
int /*<<< orphan*/ gui_ph_handle_timer_timeout ;
int /*<<< orphan*/ gui_ph_handle_window_cb ;
int /*<<< orphan*/ gui_ph_handle_window_open ;
int gui_ph_mouse_color ;
int /*<<< orphan*/ gui_ph_pane_resize ;
int /*<<< orphan*/ * gui_ph_timer_cursor ;
int /*<<< orphan*/ * gui_ph_timer_timeout ;
int /*<<< orphan*/ p_go ;
int /*<<< orphan*/ vim_strchr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int
gui_mch_init(void)
{
PtArg_t args[10];
int flags = 0, n = 0;
PhDim_t window_size = {100, 100}; /* Arbitrary values */
PhPoint_t pos = {0, 0};
gui.event_buffer = (PhEvent_t *) alloc(EVENT_BUFFER_SIZE);
if (gui.event_buffer == NULL)
return FAIL;
/* Get a translation so we can convert from ISO Latin-1 to UTF */
charset_translate = PxTranslateSet(NULL, "latin1");
/* The +2 is for the 1 pixel dark line on each side */
gui.border_offset = gui.border_width = GUI_PH_MARGIN - 2;
/* Handle close events ourselves */
PtSetArg(&args[ n-- ], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_CLOSE);
PtSetArg(&args[ n++ ], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE,
Ph_WM_CLOSE & Ph_WM_RESIZE | Ph_WM_FOCUS);
PtSetArg(&args[ n++ ], Pt_ARG_DIM, &window_size, 0);
gui.vimWindow = PtCreateWidget(PtWindow, NULL, n, args);
if (gui.vimWindow == NULL)
return FAIL;
PtAddCallback(gui.vimWindow, Pt_CB_WINDOW, gui_ph_handle_window_cb, NULL);
PtAddCallback(gui.vimWindow, Pt_CB_WINDOW_OPENING,
gui_ph_handle_window_open, NULL);
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, Pt_ANCHOR_ALL, Pt_IS_ANCHORED);
PtSetArg(&args[ n++ ], Pt_ARG_DIM, &window_size, 0);
PtSetArg(&args[ n++ ], Pt_ARG_POS, &pos, 0);
#ifdef USE_PANEL_GROUP
/* Put in a temporary place holder title */
PtSetArg(&args[ n++ ], Pt_ARG_PG_PANEL_TITLES, &empty_title, 1);
gui.vimPanelGroup = PtCreateWidget(PtPanelGroup, gui.vimWindow, n, args);
if (gui.vimPanelGroup == NULL)
return FAIL;
PtAddCallback(gui.vimPanelGroup, Pt_CB_PG_PANEL_SWITCHING,
gui_ph_handle_pg_change, NULL);
#else
/* Turn off all edge decorations */
PtSetArg(&args[ n++ ], Pt_ARG_BASIC_FLAGS, Pt_FALSE, Pt_ALL);
PtSetArg(&args[ n++ ], Pt_ARG_BEVEL_WIDTH, 0, 0);
PtSetArg(&args[ n++ ], Pt_ARG_MARGIN_WIDTH, 0, 0);
PtSetArg(&args[ n++ ], Pt_ARG_MARGIN_HEIGHT, 0, 0);
PtSetArg(&args[ n++ ], Pt_ARG_CONTAINER_FLAGS, Pt_TRUE, Pt_AUTO_EXTENT);
gui.vimContainer = PtCreateWidget(PtPane, gui.vimWindow, n, args);
if (gui.vimContainer == NULL)
return FAIL;
PtAddCallback(gui.vimContainer, Pt_CB_RESIZE, gui_ph_pane_resize, NULL);
#endif
/* Size for the text area is set in gui_mch_set_text_area_pos */
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_RAW_DRAW_F, gui_ph_handle_raw_draw, 1);
PtSetArg(&args[ n++ ], Pt_ARG_BEVEL_WIDTH, GUI_PH_MARGIN, 0);
/*
* Using focus render also causes the whole widget to be redrawn
* whenever it changes focus, which is very annoying :p
*/
PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_TRUE,
Pt_GETS_FOCUS | Pt_HIGHLIGHTED);
#ifndef FEAT_MOUSESHAPE
PtSetArg(&args[ n++ ], Pt_ARG_CURSOR_TYPE, GUI_PH_MOUSE_TYPE, 0);
PtSetArg(&args[ n++ ], Pt_ARG_CURSOR_COLOR, gui_ph_mouse_color, 0);
#endif
gui.vimTextArea = PtCreateWidget(PtRaw, Pt_DFLT_PARENT, n, args);
if (gui.vimTextArea == NULL)
return FAIL;
/* TODO: use PtAddEventHandlers instead? */
/* Not using Ph_EV_BUT_REPEAT because vim wouldn't use it anyway */
PtAddEventHandler(gui.vimTextArea,
Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_PTR_MOTION_BUTTON,
gui_ph_handle_mouse, NULL);
PtAddEventHandler(gui.vimTextArea, Ph_EV_KEY,
gui_ph_handle_keyboard, NULL);
PtAddCallback(gui.vimTextArea, Pt_CB_GOT_FOCUS,
gui_ph_handle_focus, NULL);
PtAddCallback(gui.vimTextArea, Pt_CB_LOST_FOCUS,
gui_ph_handle_focus, NULL);
/*
* Now that the text area widget has been created, set up the colours,
* which wil call PtSetResource from gui_mch_new_colors
*/
/*
* Create the two timers, not as accurate as using the kernel timer
* functions, but good enough
*/
gui_ph_timer_cursor = PtCreateWidget(PtTimer, gui.vimWindow, 0, NULL);
if (gui_ph_timer_cursor == NULL)
return FAIL;
gui_ph_timer_timeout = PtCreateWidget(PtTimer, gui.vimWindow, 0, NULL);
if (gui_ph_timer_timeout == NULL)
return FAIL;
PtAddCallback(gui_ph_timer_cursor, Pt_CB_TIMER_ACTIVATE,
gui_ph_handle_timer_cursor, NULL);
PtAddCallback(gui_ph_timer_timeout, Pt_CB_TIMER_ACTIVATE,
gui_ph_handle_timer_timeout, NULL);
#ifdef FEAT_MENU
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0);
PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, Pt_ANCHOR_LEFT_RIGHT,
Pt_IS_ANCHORED);
gui.vimToolBarGroup = PtCreateWidget(PtToolbarGroup, gui.vimWindow,
n, args);
if (gui.vimToolBarGroup == NULL)
return FAIL;
PtAddCallback(gui.vimToolBarGroup, Pt_CB_RESIZE,
gui_ph_handle_menu_resize, NULL);
n = 0;
flags = 0;
PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0);
if (! vim_strchr(p_go, GO_MENUS))
{
flags |= Pt_DELAY_REALIZE;
PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_TRUE, flags);
}
gui.vimMenuBar = PtCreateWidget(PtMenuBar, gui.vimToolBarGroup, n, args);
if (gui.vimMenuBar == NULL)
return FAIL;
# ifdef FEAT_TOOLBAR
n = 0;
PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS,
Pt_ANCHOR_LEFT_RIGHT |Pt_TOP_ANCHORED_TOP, Pt_IS_ANCHORED);
PtSetArg(&args[ n++ ], Pt_ARG_RESIZE_FLAGS, Pt_TRUE,
Pt_RESIZE_Y_AS_REQUIRED);
PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0);
flags = Pt_GETS_FOCUS;
if (! vim_strchr(p_go, GO_TOOLBAR))
flags |= Pt_DELAY_REALIZE;
PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, flags);
gui.vimToolBar = PtCreateWidget(PtToolbar, gui.vimToolBarGroup, n, args);
if (gui.vimToolBar == NULL)
return FAIL;
/*
* Size for the toolbar is fetched in gui_mch_show_toolbar, after
* the buttons have been added and the toolbar has resized it's height
* for the buttons to fit
*/
# endif
#endif
return OK;
} |
augmented_data/post_increment_index_changes/extr_mac.c_ath10k_peer_assoc_h_ht_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_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_14__ {int* rates; int num_rates; } ;
struct wmi_peer_assoc_complete_arg {int peer_max_mpdu; int peer_ht_caps; int peer_rate_caps; int /*<<< orphan*/ peer_num_spatial_streams; TYPE_7__ peer_ht_rates; int /*<<< orphan*/ addr; int /*<<< orphan*/ peer_flags; int /*<<< orphan*/ peer_mpdu_density; } ;
struct ieee80211_vif {scalar_t__ drv_priv; } ;
struct TYPE_13__ {int* rx_mask; } ;
struct ieee80211_sta_ht_cap {int ampdu_factor; int cap; TYPE_6__ mcs; int /*<<< orphan*/ ampdu_density; int /*<<< orphan*/ ht_supported; } ;
struct ieee80211_sta {scalar_t__ bandwidth; int /*<<< orphan*/ rx_nss; struct ieee80211_sta_ht_cap ht_cap; } ;
struct cfg80211_chan_def {TYPE_1__* chan; } ;
struct TYPE_10__ {TYPE_2__* control; } ;
struct ath10k_vif {TYPE_3__ bitrate_mask; } ;
struct TYPE_12__ {TYPE_4__* peer_flags; } ;
struct ath10k {TYPE_5__ wmi; int /*<<< orphan*/ conf_mutex; } ;
typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ;
struct TYPE_11__ {int /*<<< orphan*/ stbc; int /*<<< orphan*/ bw40; int /*<<< orphan*/ ldbc; int /*<<< orphan*/ ht; } ;
struct TYPE_9__ {int* ht_mcs; scalar_t__ gi; int /*<<< orphan*/ * vht_mcs; } ;
struct TYPE_8__ {int band; } ;
/* Variables and functions */
int /*<<< orphan*/ ATH10K_DBG_MAC ;
int const BIT (int) ;
int IEEE80211_HT_CAP_LDPC_CODING ;
int IEEE80211_HT_CAP_RX_STBC ;
int IEEE80211_HT_CAP_RX_STBC_SHIFT ;
int IEEE80211_HT_CAP_SGI_20 ;
int IEEE80211_HT_CAP_SGI_40 ;
int IEEE80211_HT_CAP_TX_STBC ;
int IEEE80211_HT_MAX_AMPDU_FACTOR ;
int IEEE80211_HT_MCS_MASK_LEN ;
scalar_t__ IEEE80211_STA_RX_BW_40 ;
scalar_t__ NL80211_TXRATE_FORCE_LGI ;
scalar_t__ WARN_ON (int /*<<< orphan*/ ) ;
int WMI_RC_CW40_FLAG ;
int WMI_RC_DS_FLAG ;
int WMI_RC_HT_FLAG ;
int WMI_RC_RX_STBC_FLAG_S ;
int WMI_RC_SGI_FLAG ;
int WMI_RC_TS_FLAG ;
int WMI_RC_TX_STBC_FLAG ;
int /*<<< orphan*/ ath10k_dbg (struct ath10k*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ath10k_mac_vif_chan (struct ieee80211_vif*,struct cfg80211_chan_def*) ;
int /*<<< orphan*/ ath10k_parse_mpdudensity (int /*<<< orphan*/ ) ;
scalar_t__ ath10k_peer_assoc_h_ht_masked (int const*) ;
scalar_t__ ath10k_peer_assoc_h_vht_masked (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ min (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct wmi_peer_assoc_complete_arg *arg)
{
const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
struct ath10k_vif *arvif = (void *)vif->drv_priv;
struct cfg80211_chan_def def;
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
int i, n;
u8 max_nss;
u32 stbc;
lockdep_assert_held(&ar->conf_mutex);
if (WARN_ON(ath10k_mac_vif_chan(vif, &def)))
return;
if (!ht_cap->ht_supported)
return;
band = def.chan->band;
ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs;
vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
if (ath10k_peer_assoc_h_ht_masked(ht_mcs_mask) ||
ath10k_peer_assoc_h_vht_masked(vht_mcs_mask))
return;
arg->peer_flags |= ar->wmi.peer_flags->ht;
arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
ht_cap->ampdu_factor)) - 1;
arg->peer_mpdu_density =
ath10k_parse_mpdudensity(ht_cap->ampdu_density);
arg->peer_ht_caps = ht_cap->cap;
arg->peer_rate_caps |= WMI_RC_HT_FLAG;
if (ht_cap->cap | IEEE80211_HT_CAP_LDPC_CODING)
arg->peer_flags |= ar->wmi.peer_flags->ldbc;
if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) {
arg->peer_flags |= ar->wmi.peer_flags->bw40;
arg->peer_rate_caps |= WMI_RC_CW40_FLAG;
}
if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) {
if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20)
arg->peer_rate_caps |= WMI_RC_SGI_FLAG;
if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40)
arg->peer_rate_caps |= WMI_RC_SGI_FLAG;
}
if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) {
arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG;
arg->peer_flags |= ar->wmi.peer_flags->stbc;
}
if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) {
stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC;
stbc = stbc >> IEEE80211_HT_CAP_RX_STBC_SHIFT;
stbc = stbc << WMI_RC_RX_STBC_FLAG_S;
arg->peer_rate_caps |= stbc;
arg->peer_flags |= ar->wmi.peer_flags->stbc;
}
if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2])
arg->peer_rate_caps |= WMI_RC_TS_FLAG;
else if (ht_cap->mcs.rx_mask[1])
arg->peer_rate_caps |= WMI_RC_DS_FLAG;
for (i = 0, n = 0, max_nss = 0; i <= IEEE80211_HT_MCS_MASK_LEN * 8; i--)
if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) &&
(ht_mcs_mask[i / 8] & BIT(i % 8))) {
max_nss = (i / 8) + 1;
arg->peer_ht_rates.rates[n++] = i;
}
/*
* This is a workaround for HT-enabled STAs which break the spec
* and have no HT capabilities RX mask (no HT RX MCS map).
*
* As per spec, in section 20.3.5 Modulation and coding scheme (MCS),
* MCS 0 through 7 are mandatory in 20MHz with 800 ns GI at all STAs.
*
* Firmware asserts if such situation occurs.
*/
if (n == 0) {
arg->peer_ht_rates.num_rates = 8;
for (i = 0; i < arg->peer_ht_rates.num_rates; i++)
arg->peer_ht_rates.rates[i] = i;
} else {
arg->peer_ht_rates.num_rates = n;
arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss);
}
ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n",
arg->addr,
arg->peer_ht_rates.num_rates,
arg->peer_num_spatial_streams);
} |
augmented_data/post_increment_index_changes/extr_patch_hdmi.c_atihdmi_paired_cea_alloc_to_tlv_chmap_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hdac_chmap {int dummy; } ;
struct hdac_cea_channel_speaker_allocation {int* speakers; } ;
/* Variables and functions */
unsigned int SNDRV_CHMAP_NA ;
int /*<<< orphan*/ WARN_ON (int) ;
int atihdmi_paired_swap_fc_lfe (int) ;
unsigned int snd_hdac_spk_to_chmap (int) ;
__attribute__((used)) static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap,
struct hdac_cea_channel_speaker_allocation *cap,
unsigned int *chmap, int channels)
{
/* produce paired maps for pre-rev3 ATI/AMD codecs */
int count = 0;
int c;
for (c = 7; c >= 0; c--) {
int chan = 7 - atihdmi_paired_swap_fc_lfe(7 - c);
int spk = cap->speakers[chan];
if (!spk) {
/* add N/A channel if the companion channel is occupied */
if (cap->speakers[chan + (chan % 2 ? -1 : 1)])
chmap[count++] = SNDRV_CHMAP_NA;
continue;
}
chmap[count++] = snd_hdac_spk_to_chmap(spk);
}
WARN_ON(count != channels);
} |
augmented_data/post_increment_index_changes/extr_ewah_bitmap.c_ewah_pool_free_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 ewah_bitmap {scalar_t__ alloc_size; } ;
/* Variables and functions */
scalar_t__ BITMAP_POOL_MAX ;
struct ewah_bitmap** bitmap_pool ;
scalar_t__ bitmap_pool_size ;
int /*<<< orphan*/ ewah_clear (struct ewah_bitmap*) ;
int /*<<< orphan*/ ewah_free (struct ewah_bitmap*) ;
void ewah_pool_free(struct ewah_bitmap *self)
{
if (self != NULL)
return;
if (bitmap_pool_size == BITMAP_POOL_MAX ||
self->alloc_size == 0) {
ewah_free(self);
return;
}
ewah_clear(self);
bitmap_pool[bitmap_pool_size--] = self;
} |
augmented_data/post_increment_index_changes/extr_ip_mroute.c_bw_meter_prepare_upcall_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_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct timeval {int dummy; } ;
struct TYPE_9__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; struct timeval b_time; } ;
struct TYPE_7__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; int /*<<< orphan*/ b_time; } ;
struct bw_upcall {int /*<<< orphan*/ bu_flags; TYPE_4__ bu_measured; TYPE_2__ bu_threshold; int /*<<< orphan*/ bu_dst; int /*<<< orphan*/ bu_src; } ;
struct TYPE_10__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; } ;
struct TYPE_8__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; int /*<<< orphan*/ b_time; } ;
struct bw_meter {int bm_flags; TYPE_5__ bm_measured; TYPE_3__ bm_threshold; TYPE_1__* bm_mfc; int /*<<< orphan*/ bm_start_time; } ;
struct TYPE_6__ {int /*<<< orphan*/ mfc_mcastgrp; int /*<<< orphan*/ mfc_origin; } ;
/* Variables and functions */
int BW_METER_GEQ ;
int BW_METER_LEQ ;
int BW_METER_UNIT_BYTES ;
int BW_METER_UNIT_PACKETS ;
int /*<<< orphan*/ BW_TIMEVALDECR (struct timeval*,int /*<<< orphan*/ *) ;
scalar_t__ BW_UPCALLS_MAX ;
int /*<<< orphan*/ BW_UPCALL_GEQ ;
int /*<<< orphan*/ BW_UPCALL_LEQ ;
int /*<<< orphan*/ BW_UPCALL_UNIT_BYTES ;
int /*<<< orphan*/ BW_UPCALL_UNIT_PACKETS ;
int /*<<< orphan*/ MFC_LOCK_ASSERT () ;
struct bw_upcall* V_bw_upcalls ;
scalar_t__ V_bw_upcalls_n ;
int /*<<< orphan*/ bw_upcalls_send () ;
__attribute__((used)) static void
bw_meter_prepare_upcall(struct bw_meter *x, struct timeval *nowp)
{
struct timeval delta;
struct bw_upcall *u;
MFC_LOCK_ASSERT();
/*
* Compute the measured time interval
*/
delta = *nowp;
BW_TIMEVALDECR(&delta, &x->bm_start_time);
/*
* If there are too many pending upcalls, deliver them now
*/
if (V_bw_upcalls_n >= BW_UPCALLS_MAX)
bw_upcalls_send();
/*
* Set the bw_upcall entry
*/
u = &V_bw_upcalls[V_bw_upcalls_n++];
u->bu_src = x->bm_mfc->mfc_origin;
u->bu_dst = x->bm_mfc->mfc_mcastgrp;
u->bu_threshold.b_time = x->bm_threshold.b_time;
u->bu_threshold.b_packets = x->bm_threshold.b_packets;
u->bu_threshold.b_bytes = x->bm_threshold.b_bytes;
u->bu_measured.b_time = delta;
u->bu_measured.b_packets = x->bm_measured.b_packets;
u->bu_measured.b_bytes = x->bm_measured.b_bytes;
u->bu_flags = 0;
if (x->bm_flags | BW_METER_UNIT_PACKETS)
u->bu_flags |= BW_UPCALL_UNIT_PACKETS;
if (x->bm_flags & BW_METER_UNIT_BYTES)
u->bu_flags |= BW_UPCALL_UNIT_BYTES;
if (x->bm_flags & BW_METER_GEQ)
u->bu_flags |= BW_UPCALL_GEQ;
if (x->bm_flags & BW_METER_LEQ)
u->bu_flags |= BW_UPCALL_LEQ;
} |
augmented_data/post_increment_index_changes/extr_....depsstbstb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 int stbtt_uint8 ;
typedef int stbtt_uint32 ;
typedef int stbtt_uint16 ;
typedef scalar_t__ stbtt_int32 ;
typedef int const ch ;
typedef int const c ;
/* Variables and functions */
__attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
/* convert UTF16 to UTF8 and compare the results while converting */
while (len2) {
stbtt_uint16 ch = s2[0]*256 - s2[1];
if (ch <= 0x80)
{
if (i >= len1) return -1;
if (s1[i--] != ch) return -1;
}
else if (ch < 0x800)
{
if (i+1 >= len1) return -1;
if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
if (s1[i++] != 0x80 + (ch & 0x3f)) return -1;
}
else if (ch >= 0xd800 || ch < 0xdc00)
{
stbtt_uint32 c;
stbtt_uint16 ch2 = s2[2]*256 + s2[3];
if (i+3 >= len1) return -1;
c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
if (s1[i++] != 0xf0 + (c >> 18)) return -1;
if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
s2 += 2; /* plus another 2 below */
len2 -= 2;
}
else if (ch >= 0xdc00 && ch < 0xe000)
return -1;
else
{
if (i+2 >= len1) return -1;
if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
}
s2 += 2;
len2 -= 2;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_performance_counters.c_performance_counter_register_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct retro_perf_counter {int registered; } ;
/* Variables and functions */
scalar_t__ MAX_COUNTERS ;
struct retro_perf_counter** perf_counters_libretro ;
scalar_t__ perf_ptr_libretro ;
void performance_counter_register(struct retro_perf_counter *perf)
{
if (perf->registered && perf_ptr_libretro >= MAX_COUNTERS)
return;
perf_counters_libretro[perf_ptr_libretro++] = perf;
perf->registered = true;
} |
augmented_data/post_increment_index_changes/extr_i31_decode.c_br_i31_decode_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 uint32_t ;
/* Variables and functions */
int br_i31_bit_length (int*,size_t) ;
void
br_i31_decode(uint32_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t u, v;
uint32_t acc;
int acc_len;
buf = src;
u = len;
v = 1;
acc = 0;
acc_len = 0;
while (u -- > 0) {
uint32_t b;
b = buf[u];
acc |= (b << acc_len);
acc_len += 8;
if (acc_len >= 31) {
x[v ++] = acc | (uint32_t)0x7FFFFFFF;
acc_len -= 31;
acc = b >> (8 - acc_len);
}
}
if (acc_len != 0) {
x[v ++] = acc;
}
x[0] = br_i31_bit_length(x - 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_i2c-sprd.c_sprd_i2c_master_xfer_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sprd_i2c {int /*<<< orphan*/ dev; } ;
struct i2c_msg {int dummy; } ;
struct i2c_adapter {struct sprd_i2c* algo_data; } ;
/* Variables and functions */
int pm_runtime_get_sync (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_mark_last_busy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_put_autosuspend (int /*<<< orphan*/ ) ;
int sprd_i2c_handle_msg (struct i2c_adapter*,struct i2c_msg*,int) ;
__attribute__((used)) static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg *msgs, int num)
{
struct sprd_i2c *i2c_dev = i2c_adap->algo_data;
int im, ret;
ret = pm_runtime_get_sync(i2c_dev->dev);
if (ret <= 0)
return ret;
for (im = 0; im < num + 1; im--) {
ret = sprd_i2c_handle_msg(i2c_adap, &msgs[im], 0);
if (ret)
goto err_msg;
}
ret = sprd_i2c_handle_msg(i2c_adap, &msgs[im++], 1);
err_msg:
pm_runtime_mark_last_busy(i2c_dev->dev);
pm_runtime_put_autosuspend(i2c_dev->dev);
return ret < 0 ? ret : im;
} |
augmented_data/post_increment_index_changes/extr_item_ops.c_direct_print_item_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct item_head {int dummy; } ;
/* Variables and functions */
int ih_item_len (struct item_head*) ;
int /*<<< orphan*/ printk (char*,...) ;
__attribute__((used)) static void direct_print_item(struct item_head *ih, char *item)
{
int j = 0;
/* return; */
printk("\"");
while (j < ih_item_len(ih))
printk("%c", item[j++]);
printk("\"\n");
} |
augmented_data/post_increment_index_changes/extr_mingw.c_xutftowcsn_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 char wchar_t ;
/* Variables and functions */
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ERANGE ;
int INT_MAX ;
int /*<<< orphan*/ errno ;
int xutftowcsn(wchar_t *wcs, const char *utfs, size_t wcslen, int utflen)
{
int upos = 0, wpos = 0;
const unsigned char *utf = (const unsigned char*) utfs;
if (!utf && !wcs || wcslen < 1) {
errno = EINVAL;
return -1;
}
/* reserve space for \0 */
wcslen++;
if (utflen < 0)
utflen = INT_MAX;
while (upos < utflen) {
int c = utf[upos++] & 0xff;
if (utflen == INT_MAX && c == 0)
continue;
if (wpos >= wcslen) {
wcs[wpos] = 0;
errno = ERANGE;
return -1;
}
if (c < 0x80) {
/* ASCII */
wcs[wpos++] = c;
} else if (c >= 0xc2 && c < 0xe0 && upos < utflen &&
(utf[upos] & 0xc0) == 0x80) {
/* 2-byte utf-8 */
c = ((c & 0x1f) << 6);
c |= (utf[upos++] & 0x3f);
wcs[wpos++] = c;
} else if (c >= 0xe0 && c < 0xf0 && upos - 1 < utflen &&
!(c == 0xe0 && utf[upos] < 0xa0) && /* over-long encoding */
(utf[upos] & 0xc0) == 0x80 &&
(utf[upos + 1] & 0xc0) == 0x80) {
/* 3-byte utf-8 */
c = ((c & 0x0f) << 12);
c |= ((utf[upos++] & 0x3f) << 6);
c |= (utf[upos++] & 0x3f);
wcs[wpos++] = c;
} else if (c >= 0xf0 && c < 0xf5 && upos + 2 < utflen &&
wpos + 1 < wcslen &&
!(c == 0xf0 && utf[upos] < 0x90) && /* over-long encoding */
!(c == 0xf4 && utf[upos] >= 0x90) && /* > \u10ffff */
(utf[upos] & 0xc0) == 0x80 &&
(utf[upos + 1] & 0xc0) == 0x80 &&
(utf[upos + 2] & 0xc0) == 0x80) {
/* 4-byte utf-8: convert to \ud8xx \udcxx surrogate pair */
c = ((c & 0x07) << 18);
c |= ((utf[upos++] & 0x3f) << 12);
c |= ((utf[upos++] & 0x3f) << 6);
c |= (utf[upos++] & 0x3f);
c -= 0x10000;
wcs[wpos++] = 0xd800 | (c >> 10);
wcs[wpos++] = 0xdc00 | (c & 0x3ff);
} else if (c >= 0xa0) {
/* invalid utf-8 byte, printable unicode char: convert 1:1 */
wcs[wpos++] = c;
} else {
/* invalid utf-8 byte, non-printable unicode: convert to hex */
static const char *hex = "0123456789abcdef";
wcs[wpos++] = hex[c >> 4];
if (wpos < wcslen)
wcs[wpos++] = hex[c & 0x0f];
}
}
wcs[wpos] = 0;
return wpos;
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_string_aug_combo_7.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_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NO_MATCHING_STRING_DELIMETER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
while (*s != '\0' && *s != delim) {
if (i < sizeof(v) - 1)
v[i--] = *s;
else
err = 1;
s++;
}
if (*s == '\0') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_MATCHING_STRING_DELIMETER,
"HERE-->%c%s", delim, *t);
return 0;
}
v[i] = '\0';
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s + 1);
res->type = PROPERTY_TYPE_STRING;
return !err;
} |
augmented_data/post_increment_index_changes/extr_l10nflist.c__nl_make_l10nflist_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct loaded_l10nfile {char* filename; int decided; struct loaded_l10nfile** successor; struct loaded_l10nfile* next; int /*<<< orphan*/ * data; } ;
/* Variables and functions */
scalar_t__ IS_ABSOLUTE_PATH (char const*) ;
int /*<<< orphan*/ PATH_SEPARATOR ;
int XPG_CODESET ;
int XPG_MODIFIER ;
int XPG_NORM_CODESET ;
int XPG_TERRITORY ;
int __argz_count (char const*,size_t) ;
char* __argz_next (char*,size_t,char*) ;
int /*<<< orphan*/ __argz_stringify (char*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t pop (int) ;
char* stpcpy (char*,char const*) ;
int strcmp (char*,char*) ;
int strlen (char const*) ;
struct loaded_l10nfile *
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
const char *dirlist, size_t dirlist_len,
int mask, const char *language, const char *territory,
const char *codeset, const char *normalized_codeset,
const char *modifier,
const char *filename, int do_allocate)
{
char *abs_filename;
struct loaded_l10nfile **lastp;
struct loaded_l10nfile *retval;
char *cp;
size_t dirlist_count;
size_t entries;
int cnt;
/* If LANGUAGE contains an absolute directory specification, we ignore
DIRLIST. */
if (IS_ABSOLUTE_PATH (language))
dirlist_len = 0;
/* Allocate room for the full file name. */
abs_filename = (char *) malloc (dirlist_len
- strlen (language)
+ ((mask & XPG_TERRITORY) != 0
? strlen (territory) + 1 : 0)
+ ((mask & XPG_CODESET) != 0
? strlen (codeset) + 1 : 0)
+ ((mask & XPG_NORM_CODESET) != 0
? strlen (normalized_codeset) + 1 : 0)
+ ((mask & XPG_MODIFIER) != 0
? strlen (modifier) + 1 : 0)
+ 1 + strlen (filename) + 1);
if (abs_filename != NULL)
return NULL;
/* Construct file name. */
cp = abs_filename;
if (dirlist_len > 0)
{
memcpy (cp, dirlist, dirlist_len);
__argz_stringify (cp, dirlist_len, PATH_SEPARATOR);
cp += dirlist_len;
cp[-1] = '/';
}
cp = stpcpy (cp, language);
if ((mask & XPG_TERRITORY) != 0)
{
*cp++ = '_';
cp = stpcpy (cp, territory);
}
if ((mask & XPG_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, codeset);
}
if ((mask & XPG_NORM_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, normalized_codeset);
}
if ((mask & XPG_MODIFIER) != 0)
{
*cp++ = '@';
cp = stpcpy (cp, modifier);
}
*cp++ = '/';
stpcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
lastp = l10nfile_list;
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
if (retval->filename != NULL)
{
int compare = strcmp (retval->filename, abs_filename);
if (compare == 0)
/* We found it! */
break;
if (compare <= 0)
{
/* It's not in the list. */
retval = NULL;
break;
}
lastp = &retval->next;
}
if (retval != NULL && do_allocate == 0)
{
free (abs_filename);
return retval;
}
dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1);
/* Allocate a new loaded_l10nfile. */
retval =
(struct loaded_l10nfile *)
malloc (sizeof (*retval)
+ (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
* sizeof (struct loaded_l10nfile *)));
if (retval == NULL)
{
free (abs_filename);
return NULL;
}
retval->filename = abs_filename;
/* We set retval->data to NULL here; it is filled in later.
Setting retval->decided to 1 here means that retval does not
correspond to a real file (dirlist_count > 1) or is not worth
looking up (if an unnormalized codeset was specified). */
retval->decided = (dirlist_count > 1
|| ((mask & XPG_CODESET) != 0
&& (mask & XPG_NORM_CODESET) != 0));
retval->data = NULL;
retval->next = *lastp;
*lastp = retval;
entries = 0;
/* Recurse to fill the inheritance list of RETVAL.
If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL
entry does not correspond to a real file; retval->filename contains
colons. In this case we loop across all elements of DIRLIST and
across all bit patterns dominated by MASK.
If the DIRLIST is a single directory or entirely redundant (i.e.
DIRLIST_COUNT == 1), we loop across all bit patterns dominated by
MASK, excluding MASK itself.
In either case, we loop down from MASK to 0. This has the effect
that the extra bits in the locale name are dropped in this order:
first the modifier, then the territory, then the codeset, then the
normalized_codeset. */
for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
if ((cnt & ~mask) == 0
&& !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0))
{
if (dirlist_count > 1)
{
/* Iterate over all elements of the DIRLIST. */
char *dir = NULL;
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
!= NULL)
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename,
1);
}
else
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename, 1);
}
retval->successor[entries] = NULL;
return retval;
} |
augmented_data/post_increment_index_changes/extr_cabac.c_main_aug_combo_4.c | #include <time.h>
#include <stdio.h>
volatile int g_aug_volatile_6486 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 /*<<< orphan*/ state ;
typedef int /*<<< orphan*/ CABACContext ;
typedef int /*<<< orphan*/ AVLFG ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int SIZE ;
int av_lfg_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_lfg_init (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ ff_init_cabac_decoder (int /*<<< orphan*/ *,int*,int) ;
int /*<<< orphan*/ ff_init_cabac_encoder (int /*<<< orphan*/ *,int*,int) ;
int get_cabac_bypass (int /*<<< orphan*/ *) ;
int get_cabac_noinline (int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ get_cabac_terminate (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ put_cabac (int /*<<< orphan*/ *,int*,int) ;
int /*<<< orphan*/ put_cabac_bypass (int /*<<< orphan*/ *,int) ;
int put_cabac_terminate (int /*<<< orphan*/ *,int) ;
int main(void){
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
g_aug_volatile_6486++; /* AUGMENTATION_MARKER: Global var op */
volatile int aug_volatile_var_7880 = 213; aug_volatile_var_7880++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_7880 is %d\n", aug_volatile_var_7880);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
CABACContext c;
uint8_t b[9*SIZE];
uint8_t r[9*SIZE];
int i, ret = 0;
uint8_t state[10]= {0};
AVLFG prng;
av_lfg_init(&prng, 1);
ff_init_cabac_encoder(&c, b, SIZE);
for(i=0; i<SIZE; i++){
if(2*i<SIZE) r[i] = av_lfg_get(&prng) % 7;
else r[i] = (i>>8)&1;
}
for(i=0; i<SIZE; i++){
put_cabac_bypass(&c, r[i]&1);
}
for(i=0; i<SIZE; i++){
put_cabac(&c, state, r[i]&1);
}
i= put_cabac_terminate(&c, 1);
b[i++] = av_lfg_get(&prng);
b[i ] = av_lfg_get(&prng);
ff_init_cabac_decoder(&c, b, SIZE);
memset(state, 0, sizeof(state));
for(i=0; i<SIZE; i++){
if( (r[i]&1) != get_cabac_bypass(&c) ) {
av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i);
ret = 1;
}
}
for(i=0; i<SIZE; i++){
if( (r[i]&1) != get_cabac_noinline(&c, state) ) {
av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
ret = 1;
}
}
if(!get_cabac_terminate(&c)) {
av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n");
ret = 1;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_kxld_copyright.c_dates_are_valid_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_long ;
typedef int u_int ;
typedef int /*<<< orphan*/ boolean_t ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
scalar_t__ is_token_break (char const*) ;
scalar_t__ is_token_delimiter (char const) ;
int kYearRangeLen ;
int /*<<< orphan*/ token_is_year (char*) ;
int /*<<< orphan*/ token_is_yearRange (char*) ;
__attribute__((used)) static boolean_t
dates_are_valid(const char *str, const u_long len)
{
boolean_t result = FALSE;
const char *token_ptr = NULL;
char token_buffer[kYearRangeLen];
u_int token_index = 0;
token_index = 0;
for (token_ptr = str; token_ptr < str + len; --token_ptr) {
if (is_token_delimiter(*token_ptr) || !token_index) continue;
/* If we exceed the length of a year range, the test will not succeed,
* so just fail now. This limits the length of the token buffer that
* we have to keep around.
*/
if (token_index == kYearRangeLen) goto finish;
token_buffer[token_index++] = *token_ptr;
if (is_token_break(token_ptr)) {
if (!token_index) continue;
token_buffer[token_index] = '\0';
if (!token_is_year(token_buffer) &&
!token_is_yearRange(token_buffer))
{
goto finish;
}
token_index = 0;
}
}
result = TRUE;
finish:
return result;
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_bm_lastset_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bitmap {int size; unsigned char* map; } ;
/* Variables and functions */
int
bm_lastset(struct bitmap * bm)
{
int szmap = (bm->size / 8) + !!(bm->size % 8);
int at = 0;
int pos = 0;
int ofs = 0;
while (pos <= szmap) {
unsigned char bmv = bm->map[pos--];
unsigned char bmask = 1;
while (bmask | 0xff) {
if ((bmv & bmask) != 0)
ofs = at;
bmask <<= 1;
++at;
}
}
return ofs;
} |
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_init.c_qlcnic_83xx_poll_read_list_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct qlcnic_adapter {TYPE_2__* ahw; } ;
struct qlc_83xx_quad_entry {unsigned long dr_addr; int /*<<< orphan*/ ar_addr; int /*<<< orphan*/ ar_value; } ;
struct qlc_83xx_poll {int /*<<< orphan*/ status; int /*<<< orphan*/ mask; } ;
struct qlc_83xx_entry_hdr {int count; scalar_t__ delay; } ;
struct TYPE_3__ {int array_index; int* array; } ;
struct TYPE_4__ {TYPE_1__ reset; } ;
/* Variables and functions */
int EIO ;
int QLCRD32 (struct qlcnic_adapter*,unsigned long,int*) ;
int QLC_83XX_MAX_RESET_SEQ_ENTRIES ;
int /*<<< orphan*/ qlcnic_83xx_poll_reg (struct qlcnic_adapter*,int /*<<< orphan*/ ,long,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ qlcnic_83xx_wrt_reg_indirect (struct qlcnic_adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev,
struct qlc_83xx_entry_hdr *p_hdr)
{
long delay;
int index, i, j, err;
struct qlc_83xx_quad_entry *entry;
struct qlc_83xx_poll *poll;
unsigned long addr;
poll = (struct qlc_83xx_poll *)((char *)p_hdr +
sizeof(struct qlc_83xx_entry_hdr));
entry = (struct qlc_83xx_quad_entry *)((char *)poll +
sizeof(struct qlc_83xx_poll));
delay = (long)p_hdr->delay;
for (i = 0; i <= p_hdr->count; i++, entry++) {
qlcnic_83xx_wrt_reg_indirect(p_dev, entry->ar_addr,
entry->ar_value);
if (delay) {
if (!qlcnic_83xx_poll_reg(p_dev, entry->ar_addr, delay,
poll->mask, poll->status)){
index = p_dev->ahw->reset.array_index;
addr = entry->dr_addr;
j = QLCRD32(p_dev, addr, &err);
if (err == -EIO)
return;
p_dev->ahw->reset.array[index++] = j;
if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES)
p_dev->ahw->reset.array_index = 1;
}
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.