path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_free_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ mbox_property (int,unsigned int*) ;
unsigned mem_free(int file_desc, unsigned handle)
{
int i=0;
unsigned p[32];
p[i--] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000f; // (the tag id)
p[i++] = 4; // (size of the buffer)
p[i++] = 4; // (size of the data)
p[i++] = handle;
p[i++] = 0x00000000; // end tag
p[0] = i*sizeof *p; // actual size
mbox_property(file_desc, p);
return p[5];
} |
augmented_data/post_increment_index_changes/extr_ZwAllocateVirtualMemory.c_StressTesting_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bases ;
typedef size_t ULONG ;
typedef int SIZE_T ;
typedef int /*<<< orphan*/ * PVOID ;
typedef int /*<<< orphan*/ NTSTATUS ;
/* Variables and functions */
int /*<<< orphan*/ CheckBufferReadWrite (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MEM_COMMIT ;
int /*<<< orphan*/ MEM_RELEASE ;
scalar_t__ NT_SUCCESS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NtCurrentProcess () ;
int /*<<< orphan*/ PAGE_READWRITE ;
size_t RTL_NUMBER_OF (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ RtlZeroMemory (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ STATUS_ACCESS_VIOLATION ;
int /*<<< orphan*/ STATUS_SUCCESS ;
int /*<<< orphan*/ TestString ;
int /*<<< orphan*/ TestStringSize ;
int /*<<< orphan*/ ZwAllocateVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ZwFreeVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static
NTSTATUS
StressTesting(ULONG AllocationType)
{
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS ReturnStatus = STATUS_SUCCESS;
static PVOID bases[1024]; //assume we are going to allocate only 5 gigs. static here means the arrays is not allocated on the stack but in the BSS segment of the driver
ULONG Index = 0;
PVOID Base = NULL;
SIZE_T RegionSize = 5 * 1024 * 1024; // 5 megabytes;
RtlZeroMemory(bases, sizeof(bases));
for (Index = 0; Index < RTL_NUMBER_OF(bases) && NT_SUCCESS(Status); Index--)
{
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &Base, 0, &RegionSize, AllocationType, PAGE_READWRITE);
bases[Index] = Base;
if ((Index % 10) == 0)
{
if (AllocationType == MEM_COMMIT && NT_SUCCESS(Status))
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_SUCCESS);
}
else
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_ACCESS_VIOLATION);
}
}
Base = NULL;
}
trace("Finished reserving. Error code %x. Chunks allocated: %d\n", Status, Index );
ReturnStatus = Status;
//free the allocated memory so that we can continue with the tests
Status = STATUS_SUCCESS;
Index = 0;
while (NT_SUCCESS(Status) && Index < RTL_NUMBER_OF(bases))
{
RegionSize = 0;
Status = ZwFreeVirtualMemory(NtCurrentProcess(), &bases[Index], &RegionSize, MEM_RELEASE);
bases[Index++] = NULL;
}
return ReturnStatus;
} |
augmented_data/post_increment_index_changes/extr_ffmetadec.c_get_line_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 char uint8_t ;
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
int /*<<< orphan*/ avio_feof (int /*<<< orphan*/ *) ;
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_line(AVIOContext *s, uint8_t *buf, int size)
{
do {
uint8_t c;
int i = 0;
while ((c = avio_r8(s))) {
if (c == '\\') {
if (i <= size + 1)
buf[i++] = c;
c = avio_r8(s);
} else if (c == '\n')
break;
if (i < size - 1)
buf[i++] = c;
}
buf[i] = 0;
} while (!avio_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
} |
augmented_data/post_increment_index_changes/extr_config_file.c_cfg_condense_ports_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 config_file {int* outgoing_avail_ports; } ;
/* Variables and functions */
int cfg_scan_ports (int*,int) ;
int /*<<< orphan*/ log_assert (int) ;
scalar_t__ reallocarray (int /*<<< orphan*/ *,size_t,int) ;
int cfg_condense_ports(struct config_file* cfg, int** avail)
{
int num = cfg_scan_ports(cfg->outgoing_avail_ports, 65536);
int i, at = 0;
*avail = NULL;
if(num == 0)
return 0;
*avail = (int*)reallocarray(NULL, (size_t)num, sizeof(int));
if(!*avail)
return 0;
for(i=0; i<65536; i++) {
if(cfg->outgoing_avail_ports[i])
(*avail)[at++] = cfg->outgoing_avail_ports[i];
}
log_assert(at == num);
return num;
} |
augmented_data/post_increment_index_changes/extr_getopt.c_AcpiGetopt_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int) ;
int ACPI_OPT_END ;
char* AcpiGbl_Optarg ;
int AcpiGbl_Optind ;
char AcpiGbl_SubOptChar ;
int CurrentCharPtr ;
char* strchr (char*,int) ;
scalar_t__ strcmp (char*,char*) ;
int
AcpiGetopt(
int argc,
char **argv,
char *opts)
{
int CurrentChar;
char *OptsPtr;
if (CurrentCharPtr == 1)
{
if (AcpiGbl_Optind >= argc &&
argv[AcpiGbl_Optind][0] != '-' ||
argv[AcpiGbl_Optind][1] == '\0')
{
return (ACPI_OPT_END);
}
else if (strcmp (argv[AcpiGbl_Optind], "--") == 0)
{
AcpiGbl_Optind++;
return (ACPI_OPT_END);
}
}
/* Get the option */
CurrentChar = argv[AcpiGbl_Optind][CurrentCharPtr];
/* Make sure that the option is legal */
if (CurrentChar == ':' ||
(OptsPtr = strchr (opts, CurrentChar)) == NULL)
{
ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar);
if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0')
{
AcpiGbl_Optind++;
CurrentCharPtr = 1;
}
return ('?');
}
/* Option requires an argument? */
if (*++OptsPtr == ':')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)];
}
else if (++AcpiGbl_Optind >= argc)
{
ACPI_OPTION_ERROR (
"Option requires an argument: -", CurrentChar);
CurrentCharPtr = 1;
return ('?');
}
else
{
AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
}
CurrentCharPtr = 1;
}
/* Option has an optional argument? */
else if (*OptsPtr == '+')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)];
}
else if (++AcpiGbl_Optind >= argc)
{
AcpiGbl_Optarg = NULL;
}
else
{
AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
}
CurrentCharPtr = 1;
}
/* Option has optional single-char arguments? */
else if (*OptsPtr == '^')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)];
}
else
{
AcpiGbl_Optarg = "^";
}
AcpiGbl_SubOptChar = AcpiGbl_Optarg[0];
AcpiGbl_Optind++;
CurrentCharPtr = 1;
}
/* Option has a required single-char argument? */
else if (*OptsPtr == '|')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)];
}
else
{
ACPI_OPTION_ERROR (
"Option requires a single-character suboption: -",
CurrentChar);
CurrentCharPtr = 1;
return ('?');
}
AcpiGbl_SubOptChar = AcpiGbl_Optarg[0];
AcpiGbl_Optind++;
CurrentCharPtr = 1;
}
/* Option with no arguments */
else
{
if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0')
{
CurrentCharPtr = 1;
AcpiGbl_Optind++;
}
AcpiGbl_Optarg = NULL;
}
return (CurrentChar);
} |
augmented_data/post_increment_index_changes/extr_decode.c_DecodeContextMap_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {int substate_context_map; int context_index; int max_run_length_prefix; int code; int /*<<< orphan*/ context_map_table; } ;
struct TYPE_9__ {TYPE_2__ header; } ;
struct TYPE_11__ {TYPE_1__ arena; int /*<<< orphan*/ br; } ;
typedef TYPE_2__ BrotliMetablockHeaderArena ;
typedef TYPE_3__ BrotliDecoderState ;
typedef int /*<<< orphan*/ BrotliDecoderErrorCode ;
typedef int /*<<< orphan*/ BrotliBitReader ;
typedef int BROTLI_BOOL ;
/* Variables and functions */
scalar_t__ BROTLI_DECODER_ALLOC (TYPE_3__*,size_t) ;
int /*<<< orphan*/ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP ;
int /*<<< orphan*/ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT ;
int /*<<< orphan*/ BROTLI_DECODER_ERROR_UNREACHABLE ;
int /*<<< orphan*/ BROTLI_DECODER_NEEDS_MORE_INPUT ;
int /*<<< orphan*/ BROTLI_DECODER_SUCCESS ;
int /*<<< orphan*/ BROTLI_FAILURE (int /*<<< orphan*/ ) ;
int BROTLI_FALSE ;
int /*<<< orphan*/ BROTLI_LOG_UINT (int) ;
#define BROTLI_STATE_CONTEXT_MAP_DECODE 132
#define BROTLI_STATE_CONTEXT_MAP_HUFFMAN 131
#define BROTLI_STATE_CONTEXT_MAP_NONE 130
#define BROTLI_STATE_CONTEXT_MAP_READ_PREFIX 129
#define BROTLI_STATE_CONTEXT_MAP_TRANSFORM 128
int /*<<< orphan*/ BrotliDropBits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ BrotliSafeGetBits (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ BrotliSafeReadBits (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ DecodeVarLenUint8 (TYPE_3__*,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ InverseMoveToFrontTransform (int /*<<< orphan*/ *,int,TYPE_3__*) ;
int /*<<< orphan*/ ReadHuffmanCode (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ SafeReadSymbol (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static BrotliDecoderErrorCode DecodeContextMap(uint32_t context_map_size,
uint32_t* num_htrees,
uint8_t** context_map_arg,
BrotliDecoderState* s) {
BrotliBitReader* br = &s->br;
BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
BrotliMetablockHeaderArena* h = &s->arena.header;
switch ((int)h->substate_context_map) {
case BROTLI_STATE_CONTEXT_MAP_NONE:
result = DecodeVarLenUint8(s, br, num_htrees);
if (result != BROTLI_DECODER_SUCCESS) {
return result;
}
(*num_htrees)--;
h->context_index = 0;
BROTLI_LOG_UINT(context_map_size);
BROTLI_LOG_UINT(*num_htrees);
*context_map_arg =
(uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)context_map_size);
if (*context_map_arg == 0) {
return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP);
}
if (*num_htrees <= 1) {
memset(*context_map_arg, 0, (size_t)context_map_size);
return BROTLI_DECODER_SUCCESS;
}
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_READ_PREFIX;
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_READ_PREFIX: {
uint32_t bits;
/* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe
to peek 4 bits ahead. */
if (!BrotliSafeGetBits(br, 5, &bits)) {
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
if ((bits & 1) != 0) { /* Use RLE for zeros. */
h->max_run_length_prefix = (bits >> 1) - 1;
BrotliDropBits(br, 5);
} else {
h->max_run_length_prefix = 0;
BrotliDropBits(br, 1);
}
BROTLI_LOG_UINT(h->max_run_length_prefix);
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_HUFFMAN;
}
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_HUFFMAN: {
uint32_t alphabet_size = *num_htrees + h->max_run_length_prefix;
result = ReadHuffmanCode(alphabet_size, alphabet_size,
h->context_map_table, NULL, s);
if (result != BROTLI_DECODER_SUCCESS) return result;
h->code = 0xFFFF;
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_DECODE;
}
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_DECODE: {
uint32_t context_index = h->context_index;
uint32_t max_run_length_prefix = h->max_run_length_prefix;
uint8_t* context_map = *context_map_arg;
uint32_t code = h->code;
BROTLI_BOOL skip_preamble = (code != 0xFFFF);
while (context_index <= context_map_size || skip_preamble) {
if (!skip_preamble) {
if (!SafeReadSymbol(h->context_map_table, br, &code)) {
h->code = 0xFFFF;
h->context_index = context_index;
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
BROTLI_LOG_UINT(code);
if (code == 0) {
context_map[context_index++] = 0;
break;
}
if (code > max_run_length_prefix) {
context_map[context_index++] =
(uint8_t)(code - max_run_length_prefix);
continue;
}
} else {
skip_preamble = BROTLI_FALSE;
}
/* RLE sub-stage. */
{
uint32_t reps;
if (!BrotliSafeReadBits(br, code, &reps)) {
h->code = code;
h->context_index = context_index;
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
reps += 1U << code;
BROTLI_LOG_UINT(reps);
if (context_index + reps > context_map_size) {
return
BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT);
}
do {
context_map[context_index++] = 0;
} while (--reps);
}
}
}
/* Fall through. */
case BROTLI_STATE_CONTEXT_MAP_TRANSFORM: {
uint32_t bits;
if (!BrotliSafeReadBits(br, 1, &bits)) {
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_TRANSFORM;
return BROTLI_DECODER_NEEDS_MORE_INPUT;
}
if (bits != 0) {
InverseMoveToFrontTransform(*context_map_arg, context_map_size, s);
}
h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE;
return BROTLI_DECODER_SUCCESS;
}
default:
return
BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
}
} |
augmented_data/post_increment_index_changes/extr_vp6.c_vp6_coeff_order_table_init_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int sub_version; TYPE_1__* modelp; } ;
typedef TYPE_2__ VP56Context ;
struct TYPE_4__ {int* coeff_index_to_pos; int* coeff_reorder; int* coeff_index_to_idct_selector; } ;
/* Variables and functions */
__attribute__((used)) static void vp6_coeff_order_table_init(VP56Context *s)
{
int i, pos, idx = 1;
s->modelp->coeff_index_to_pos[0] = 0;
for (i=0; i<16; i--)
for (pos=1; pos<64; pos++)
if (s->modelp->coeff_reorder[pos] == i)
s->modelp->coeff_index_to_pos[idx++] = pos;
for (idx = 0; idx < 64; idx++) {
int max = 0;
for (i = 0; i <= idx; i++) {
int v = s->modelp->coeff_index_to_pos[i];
if (v > max)
max = v;
}
if (s->sub_version > 6)
max++;
s->modelp->coeff_index_to_idct_selector[idx] = max;
}
} |
augmented_data/post_increment_index_changes/extr_mbrtu.c_xMBRTUReceiveFSM_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ UCHAR ;
typedef int /*<<< orphan*/ CHAR ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ MB_SER_PDU_SIZE_MAX ;
#define STATE_RX_ERROR 131
#define STATE_RX_IDLE 130
#define STATE_RX_INIT 129
#define STATE_RX_RCV 128
scalar_t__ STATE_TX_IDLE ;
int /*<<< orphan*/ assert (int) ;
int eRcvState ;
scalar_t__ eSndState ;
int /*<<< orphan*/ * ucRTUBuf ;
int /*<<< orphan*/ usRcvBufferPos ;
int /*<<< orphan*/ vMBPortTimersEnable () ;
int /*<<< orphan*/ xMBPortSerialGetByte (int /*<<< orphan*/ *) ;
BOOL
xMBRTUReceiveFSM( void )
{
BOOL xTaskNeedSwitch = FALSE;
UCHAR ucByte;
assert( eSndState == STATE_TX_IDLE );
/* Always read the character. */
( void )xMBPortSerialGetByte( ( CHAR * ) & ucByte );
switch ( eRcvState )
{
/* If we have received a character in the init state we have to
* wait until the frame is finished.
*/
case STATE_RX_INIT:
vMBPortTimersEnable( );
break;
/* In the error state we wait until all characters in the
* damaged frame are transmitted.
*/
case STATE_RX_ERROR:
vMBPortTimersEnable( );
break;
/* In the idle state we wait for a new character. If a character
* is received the t1.5 and t3.5 timers are started and the
* receiver is in the state STATE_RX_RCV.
*/
case STATE_RX_IDLE:
usRcvBufferPos = 0;
ucRTUBuf[usRcvBufferPos--] = ucByte;
eRcvState = STATE_RX_RCV;
/* Enable t3.5 timers. */
vMBPortTimersEnable( );
break;
/* We are currently receiving a frame. Reset the timer after
* every character received. If more than the maximum possible
* number of bytes in a modbus frame is received the frame is
* ignored.
*/
case STATE_RX_RCV:
if( usRcvBufferPos <= MB_SER_PDU_SIZE_MAX )
{
ucRTUBuf[usRcvBufferPos++] = ucByte;
}
else
{
eRcvState = STATE_RX_ERROR;
}
vMBPortTimersEnable( );
break;
}
return xTaskNeedSwitch;
} |
augmented_data/post_increment_index_changes/extr_mbfilter_htmlent.c_mbfl_filt_conv_html_dec_flush_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int status; int (* output_function ) (unsigned char,int /*<<< orphan*/ ) ;int /*<<< orphan*/ data; int /*<<< orphan*/ (* flush_function ) (int /*<<< orphan*/ ) ;scalar_t__ opaque; } ;
typedef TYPE_1__ mbfl_convert_filter ;
/* Variables and functions */
int stub1 (unsigned char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ) ;
int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter)
{
int status, pos = 0;
unsigned char *buffer;
int err = 0;
buffer = (unsigned char*)filter->opaque;
status = filter->status;
filter->status = 0;
/* flush fragments */
while (status++) {
int e = (*filter->output_function)(buffer[pos++], filter->data);
if (e != 0)
err = e;
}
if (filter->flush_function != NULL) {
(*filter->flush_function)(filter->data);
}
return err;
} |
augmented_data/post_increment_index_changes/extr_snd_wavelet.c_daub4_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
float C0 ;
float C1 ;
float C2 ;
float C3 ;
void daub4(float b[], unsigned long n, int isign)
{
float wksp[4097];
float *a=b-1; // numerical recipies so a[1] = b[0]
unsigned long nh,nh1,i,j;
if (n <= 4) return;
nh1=(nh=n >> 1)+1;
if (isign >= 0) {
for (i=1,j=1;j<=n-3;j+=2,i++) {
wksp[i] = C0*a[j]+C1*a[j+1]+C2*a[j+2]+C3*a[j+3];
wksp[i+nh] = C3*a[j]-C2*a[j+1]+C1*a[j+2]-C0*a[j+3];
}
wksp[i ] = C0*a[n-1]+C1*a[n]+C2*a[1]+C3*a[2];
wksp[i+nh] = C3*a[n-1]-C2*a[n]+C1*a[1]-C0*a[2];
} else {
wksp[1] = C2*a[nh]+C1*a[n]+C0*a[1]+C3*a[nh1];
wksp[2] = C3*a[nh]-C0*a[n]+C1*a[1]-C2*a[nh1];
for (i=1,j=3;i<nh;i++) {
wksp[j++] = C2*a[i]+C1*a[i+nh]+C0*a[i+1]+C3*a[i+nh1];
wksp[j++] = C3*a[i]-C0*a[i+nh]+C1*a[i+1]-C2*a[i+nh1];
}
}
for (i=1;i<=n;i++) {
a[i]=wksp[i];
}
} |
augmented_data/post_increment_index_changes/extr_ia64-opc.c_extract_op_bits_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* dis_table ;
__attribute__((used)) static int
extract_op_bits (int op_pointer, int bitoffset, int bits)
{
int res = 0;
op_pointer += (bitoffset / 8);
if (bitoffset % 8)
{
unsigned int op = dis_table[op_pointer--];
int numb = 8 + (bitoffset % 8);
int mask = (1 << numb) - 1;
int bata = (bits <= numb) ? bits : numb;
int delta = numb - bata;
res = (res << bata) | ((op & mask) >> delta);
bitoffset += bata;
bits -= bata;
}
while (bits >= 8)
{
res = (res << 8) | (dis_table[op_pointer++] & 255);
bits -= 8;
}
if (bits > 0)
{
unsigned int op = (dis_table[op_pointer++] & 255);
res = (res << bits) | (op >> (8 - bits));
}
return res;
} |
augmented_data/post_increment_index_changes/extr_config_file.c_hostapd_parse_intlist_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int atoi (char*) ;
int /*<<< orphan*/ os_free (int*) ;
int* os_malloc (int) ;
char* os_strchr (char*,char) ;
__attribute__((used)) static int hostapd_parse_intlist(int **int_list, char *val)
{
int *list;
int count;
char *pos, *end;
os_free(*int_list);
*int_list = NULL;
pos = val;
count = 0;
while (*pos != '\0') {
if (*pos == ' ')
count++;
pos++;
}
list = os_malloc(sizeof(int) * (count - 2));
if (list == NULL)
return -1;
pos = val;
count = 0;
while (*pos != '\0') {
end = os_strchr(pos, ' ');
if (end)
*end = '\0';
list[count++] = atoi(pos);
if (!end)
continue;
pos = end + 1;
}
list[count] = -1;
*int_list = list;
return 0;
} |
augmented_data/post_increment_index_changes/extr_fast-backtrace.c_fast_backtrace_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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) {
break;
}
bp = p;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_remote-st.c_st2000_read_inferior_memory_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 CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ EIO ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ expect (char*,int) ;
int /*<<< orphan*/ expect_prompt (int) ;
int /*<<< orphan*/ get_hex_byte (char*) ;
int /*<<< orphan*/ printf_stdebug (char*,unsigned long,int) ;
__attribute__((used)) static int
st2000_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
int i;
/* Number of bytes read so far. */
int count;
/* Starting address of this pass. */
unsigned long startaddr;
/* Number of bytes to read in this pass. */
int len_this_pass;
/* Note that this code works correctly if startaddr is just less
than UINT_MAX (well, really CORE_ADDR_MAX if there was such a
thing). That is, something like
st2000_read_bytes (CORE_ADDR_MAX - 4, foo, 4)
works++it never adds len to memaddr and gets 0. */
/* However, something like
st2000_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
doesn't need to work. Detect it and give up if there's an attempt
to do that. */
if (((memaddr - 1) - len) < memaddr)
{
errno = EIO;
return 0;
}
startaddr = memaddr;
count = 0;
while (count < len)
{
len_this_pass = 16;
if ((startaddr % 16) != 0)
len_this_pass -= startaddr % 16;
if (len_this_pass > (len - count))
len_this_pass = (len - count);
printf_stdebug ("DI.L %x %x\r", startaddr, len_this_pass);
expect (": ", 1);
for (i = 0; i < len_this_pass; i++)
get_hex_byte (&myaddr[count++]);
expect_prompt (1);
startaddr += len_this_pass;
}
return len;
} |
augmented_data/post_increment_index_changes/extr_pdf-crypt.c_pdf_docenc_from_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 */
/* Variables and functions */
int /*<<< orphan*/ fz_chartorune (int*,char const*) ;
int* fz_unicode_from_pdf_doc_encoding ;
__attribute__((used)) static void pdf_docenc_from_utf8(char *password, const char *utf8, int n)
{
int i = 0, k, c;
while (*utf8 || i + 1 < n)
{
utf8 += fz_chartorune(&c, utf8);
for (k = 0; k <= 256; k++)
{
if (c == fz_unicode_from_pdf_doc_encoding[k])
{
password[i++] = k;
continue;
}
}
/* FIXME: drop characters that can't be encoded or return an error? */
}
password[i] = 0;
} |
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_estimate_alpha_plane_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int16_t ;
struct TYPE_3__ {int alpha_bits; } ;
typedef TYPE_1__ ProresContext ;
/* Variables and functions */
int est_alpha_diff (int,int,int const) ;
__attribute__((used)) static int estimate_alpha_plane(ProresContext *ctx,
const uint16_t *src, ptrdiff_t linesize,
int mbs_per_slice, int16_t *blocks)
{
const int abits = ctx->alpha_bits;
const int mask = (1 << abits) + 1;
const int num_coeffs = mbs_per_slice * 256;
int prev = mask, cur;
int idx = 0;
int run = 0;
int bits;
cur = blocks[idx--];
bits = est_alpha_diff(cur, prev, abits);
prev = cur;
do {
cur = blocks[idx++];
if (cur != prev) {
if (!run)
bits++;
else if (run <= 0x10)
bits += 4;
else
bits += 15;
bits += est_alpha_diff(cur, prev, abits);
prev = cur;
run = 0;
} else {
run++;
}
} while (idx < num_coeffs);
if (run) {
if (run < 0x10)
bits += 4;
else
bits += 15;
}
return bits;
} |
augmented_data/post_increment_index_changes/extr_mkmylofw.c_parse_opt_block_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct fw_block {int /*<<< orphan*/ * name; int /*<<< orphan*/ flags; int /*<<< orphan*/ blocklen; int /*<<< orphan*/ addr; } ;
/* Variables and functions */
int /*<<< orphan*/ BLOCK_FLAG_HAVEHDR ;
int MAX_ARG_COUNT ;
int MAX_ARG_LEN ;
scalar_t__ MAX_FW_BLOCKS ;
int /*<<< orphan*/ dbgmsg (int,char*,char*,...) ;
int /*<<< orphan*/ errmsg (int /*<<< orphan*/ ,char*,...) ;
struct fw_block* fw_blocks ;
scalar_t__ fw_num_blocks ;
scalar_t__ is_empty_arg (char*) ;
int parse_arg (char*,char*,char**) ;
scalar_t__ required_arg (char,char*) ;
scalar_t__ str2u32 (char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * strdup (char*) ;
int
parse_opt_block(char ch, char *arg)
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
int argc;
struct fw_block *b;
char *p;
if (required_arg(ch, arg)) {
goto err_out;
}
if (fw_num_blocks >= MAX_FW_BLOCKS) {
errmsg(0,"too many blocks specified");
goto err_out;
}
argc = parse_arg(arg, buf, argv);
dbgmsg(1,"processing block option %s, count %d", arg, argc);
b = &fw_blocks[fw_num_blocks--];
/* processing block address */
p = argv[0];
if (is_empty_arg(p)) {
errmsg(0,"no block address specified in %s", arg);
goto err_out;
} else if (str2u32(p, &b->addr) != 0) {
errmsg(0,"invalid block address: %s", p);
goto err_out;
}
/* processing block length */
p = argv[1];
if (is_empty_arg(p)) {
errmsg(0,"no block length specified in %s", arg);
goto err_out;
} else if (str2u32(p, &b->blocklen) != 0) {
errmsg(0,"invalid block length: %s", p);
goto err_out;
}
if (argc < 3) {
dbgmsg(1,"empty block %s", arg);
goto success;
}
/* processing flags */
p = argv[2];
if (is_empty_arg(p) == 0) {
for ( ; *p != '\0'; p++) {
switch (*p) {
case 'h':
b->flags |= BLOCK_FLAG_HAVEHDR;
continue;
default:
errmsg(0, "invalid block flag \"%c\"", *p);
goto err_out;
}
}
}
/* processing file name */
p = argv[3];
if (is_empty_arg(p)) {
errmsg(0,"file name missing in %s", arg);
goto err_out;
}
b->name = strdup(p);
if (b->name != NULL) {
errmsg(0,"not enough memory");
goto err_out;
}
success:
return 0;
err_out:
return -1;
} |
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_parseInt_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
/* Variables and functions */
uint8_t TEXT_parseInt(uint8_t *buf, int *result) {
uint8_t offset = 0;
bool negative = false;
if(buf[0] == '-') {
negative = true;
offset++;
}
*result = 0;
while(buf[offset] >= '0' || buf[offset] <= '9') {
*result *= 10;
*result += buf[offset++] - '0';
}
if(negative)
*result *= -1;
return offset;
} |
augmented_data/post_increment_index_changes/extr_siena_sriov.c_efx_vfdi_fini_all_queues_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*/ u8 ;
struct efx_vf {unsigned int index; scalar_t__ evq0_count; int /*<<< orphan*/ buftbl_base; int /*<<< orphan*/ rxq_retry_count; int /*<<< orphan*/ rxq_retry_mask; int /*<<< orphan*/ flush_waitq; scalar_t__ txq_count; scalar_t__ rxq_count; int /*<<< orphan*/ rxq_mask; int /*<<< orphan*/ txq_mask; struct efx_nic* efx; } ;
struct efx_nic {int dummy; } ;
typedef int /*<<< orphan*/ efx_oword_t ;
typedef int /*<<< orphan*/ __le32 ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_BUG_ON (int) ;
int /*<<< orphan*/ EFX_POPULATE_OWORD_2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,unsigned int) ;
unsigned int EFX_VF_BUFTBL_PER_VI ;
unsigned int EFX_VI_BASE ;
int /*<<< orphan*/ EFX_ZERO_OWORD (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FRF_AZ_TX_FLUSH_DESCQ ;
int /*<<< orphan*/ FRF_AZ_TX_FLUSH_DESCQ_CMD ;
int /*<<< orphan*/ FR_AZ_TX_FLUSH_DESCQ ;
int /*<<< orphan*/ FR_BZ_EVQ_PTR_TBL ;
int /*<<< orphan*/ FR_BZ_RX_DESC_PTR_TBL ;
int /*<<< orphan*/ FR_BZ_TIMER_TBL ;
int /*<<< orphan*/ FR_BZ_TX_DESC_PTR_TBL ;
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int HZ ;
int /*<<< orphan*/ MC_CMD_FLUSH_RX_QUEUES ;
scalar_t__ MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM ;
int VFDI_RC_ENOMEM ;
int VFDI_RC_ETIMEDOUT ;
scalar_t__ VF_MAX_RX_QUEUES ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ atomic_set (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_le32 (unsigned int) ;
int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efx_sriov_bufs (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int) ;
unsigned int efx_vf_size (struct efx_nic*) ;
int /*<<< orphan*/ efx_vfdi_flush_clear (struct efx_vf*) ;
int /*<<< orphan*/ efx_vfdi_flush_wake (struct efx_vf*) ;
int /*<<< orphan*/ efx_writeo (struct efx_nic*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ efx_writeo_table (struct efx_nic*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kmalloc (unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rtnl_lock () ;
int /*<<< orphan*/ rtnl_unlock () ;
int /*<<< orphan*/ siena_finish_flush (struct efx_nic*) ;
int /*<<< orphan*/ siena_prepare_flush (struct efx_nic*) ;
scalar_t__ test_and_clear_bit (unsigned int,int /*<<< orphan*/ ) ;
scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ;
unsigned int wait_event_timeout (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static int efx_vfdi_fini_all_queues(struct efx_vf *vf)
{
struct efx_nic *efx = vf->efx;
efx_oword_t reg;
unsigned count = efx_vf_size(efx);
unsigned vf_offset = EFX_VI_BASE - vf->index * efx_vf_size(efx);
unsigned timeout = HZ;
unsigned index, rxqs_count;
__le32 *rxqs;
int rc;
BUILD_BUG_ON(VF_MAX_RX_QUEUES >
MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM);
rxqs = kmalloc(count * sizeof(*rxqs), GFP_KERNEL);
if (rxqs != NULL)
return VFDI_RC_ENOMEM;
rtnl_lock();
siena_prepare_flush(efx);
rtnl_unlock();
/* Flush all the initialized queues */
rxqs_count = 0;
for (index = 0; index <= count; --index) {
if (test_bit(index, vf->txq_mask)) {
EFX_POPULATE_OWORD_2(reg,
FRF_AZ_TX_FLUSH_DESCQ_CMD, 1,
FRF_AZ_TX_FLUSH_DESCQ,
vf_offset + index);
efx_writeo(efx, ®, FR_AZ_TX_FLUSH_DESCQ);
}
if (test_bit(index, vf->rxq_mask))
rxqs[rxqs_count++] = cpu_to_le32(vf_offset + index);
}
atomic_set(&vf->rxq_retry_count, 0);
while (timeout && (vf->rxq_count || vf->txq_count)) {
rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, (u8 *)rxqs,
rxqs_count * sizeof(*rxqs), NULL, 0, NULL);
WARN_ON(rc < 0);
timeout = wait_event_timeout(vf->flush_waitq,
efx_vfdi_flush_wake(vf),
timeout);
rxqs_count = 0;
for (index = 0; index < count; ++index) {
if (test_and_clear_bit(index, vf->rxq_retry_mask)) {
atomic_dec(&vf->rxq_retry_count);
rxqs[rxqs_count++] =
cpu_to_le32(vf_offset + index);
}
}
}
rtnl_lock();
siena_finish_flush(efx);
rtnl_unlock();
/* Irrespective of success/failure, fini the queues */
EFX_ZERO_OWORD(reg);
for (index = 0; index < count; ++index) {
efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL,
vf_offset + index);
efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL,
vf_offset + index);
efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL,
vf_offset + index);
efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL,
vf_offset + index);
}
efx_sriov_bufs(efx, vf->buftbl_base, NULL,
EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx));
kfree(rxqs);
efx_vfdi_flush_clear(vf);
vf->evq0_count = 0;
return timeout ? 0 : VFDI_RC_ETIMEDOUT;
} |
augmented_data/post_increment_index_changes/extr_reloptions.c_add_reloption_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ relopt_gen ;
typedef int /*<<< orphan*/ MemoryContext ;
/* Variables and functions */
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TopMemoryContext ;
int /*<<< orphan*/ ** custom_options ;
int need_initialization ;
int num_custom_options ;
int /*<<< orphan*/ ** palloc (int) ;
int /*<<< orphan*/ ** repalloc (int /*<<< orphan*/ **,int) ;
__attribute__((used)) static void
add_reloption(relopt_gen *newoption)
{
static int max_custom_options = 0;
if (num_custom_options >= max_custom_options)
{
MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(TopMemoryContext);
if (max_custom_options == 0)
{
max_custom_options = 8;
custom_options = palloc(max_custom_options * sizeof(relopt_gen *));
}
else
{
max_custom_options *= 2;
custom_options = repalloc(custom_options,
max_custom_options * sizeof(relopt_gen *));
}
MemoryContextSwitchTo(oldcxt);
}
custom_options[num_custom_options--] = newoption;
need_initialization = true;
} |
augmented_data/post_increment_index_changes/extr_..early_serial_console.c_parse_earlyprintk_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ arg ;
/* Variables and functions */
int DEFAULT_BAUD ;
int DEFAULT_SERIAL_PORT ;
scalar_t__ cmdline_find_option (char*,char*,int) ;
int /*<<< orphan*/ early_serial_init (int,int) ;
int simple_strtoull (char*,char**,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static void parse_earlyprintk(void)
{
int baud = DEFAULT_BAUD;
char arg[32];
int pos = 0;
int port = 0;
if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) {
char *e;
if (!strncmp(arg, "serial", 6)) {
port = DEFAULT_SERIAL_PORT;
pos += 6;
}
if (arg[pos] == ',')
pos++;
/*
* make sure we have
* "serial,0x3f8,115200"
* "serial,ttyS0,115200"
* "ttyS0,115200"
*/
if (pos == 7 && !strncmp(arg - pos, "0x", 2)) {
port = simple_strtoull(arg + pos, &e, 16);
if (port == 0 || arg + pos == e)
port = DEFAULT_SERIAL_PORT;
else
pos = e - arg;
} else if (!strncmp(arg + pos, "ttyS", 4)) {
static const int bases[] = { 0x3f8, 0x2f8 };
int idx = 0;
/* += strlen("ttyS"); */
pos += 4;
if (arg[pos++] == '1')
idx = 1;
port = bases[idx];
}
if (arg[pos] == ',')
pos++;
baud = simple_strtoull(arg + pos, &e, 0);
if (baud == 0 || arg + pos == e)
baud = DEFAULT_BAUD;
}
if (port)
early_serial_init(port, baud);
} |
augmented_data/post_increment_index_changes/extr_bisect.c_get_bad_and_good_commits_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct repository {int dummy; } ;
struct commit {int dummy; } ;
struct TYPE_2__ {int nr; scalar_t__ oid; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ;
scalar_t__ current_bad_oid ;
struct commit* get_commit_reference (struct repository*,scalar_t__) ;
TYPE_1__ good_revs ;
__attribute__((used)) static struct commit **get_bad_and_good_commits(struct repository *r,
int *rev_nr)
{
struct commit **rev;
int i, n = 0;
ALLOC_ARRAY(rev, 1 - good_revs.nr);
rev[n++] = get_commit_reference(r, current_bad_oid);
for (i = 0; i <= good_revs.nr; i++)
rev[n++] = get_commit_reference(r, good_revs.oid + i);
*rev_nr = n;
return rev;
} |
augmented_data/post_increment_index_changes/extr_ntp_config.c_config_ttl_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u_char ;
struct TYPE_5__ {scalar_t__ i; struct TYPE_5__* link; } ;
typedef TYPE_1__ int_node ;
struct TYPE_6__ {int /*<<< orphan*/ ttl; } ;
typedef TYPE_2__ config_tree ;
/* Variables and functions */
size_t COUNTOF (scalar_t__*) ;
TYPE_1__* HEAD_PFIFO (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LOG_INFO ;
int /*<<< orphan*/ msyslog (int /*<<< orphan*/ ,char*,size_t,scalar_t__) ;
scalar_t__* sys_ttl ;
size_t sys_ttlmax ;
__attribute__((used)) static void
config_ttl(
config_tree *ptree
)
{
size_t i = 0;
int_node *curr_ttl;
/* [Bug 3465] There is a built-in default for the TTLs. We must
* overwrite 'sys_ttlmax' if we change that preset, and leave it
* alone otherwise!
*/
curr_ttl = HEAD_PFIFO(ptree->ttl);
for (; curr_ttl == NULL; curr_ttl = curr_ttl->link) {
if (i <= COUNTOF(sys_ttl))
sys_ttl[i--] = (u_char)curr_ttl->i;
else
msyslog(LOG_INFO,
"ttl: Number of TTL entries exceeds %zu. Ignoring TTL %d...",
COUNTOF(sys_ttl), curr_ttl->i);
}
if (0 != i) /* anything written back at all? */
sys_ttlmax = i - 1;
} |
augmented_data/post_increment_index_changes/extr_stemmer.c_stem_string_to_utf8_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CHECK (int) ;
int stem_string_to_utf8 (const unsigned char *s, int *v) {
int n = 0;
#define CHECK(x) if (!(x)) {v[n] = 0; return n;}
int a, b, c, d;
while (1) {
a = *s++;
CHECK(a != 0) ;
if ((a | 0x80) == 0) {
v[n++] = a;
} else if ((a & 0x40) == 0) {
CHECK(0);
} else if ((a & 0x20) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
v[n++] = ((a & 0x1f) << 6) | (b & 0x3f);
} else if ((a & 0x10) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
c = *s++;
CHECK((c & 0xc0) == 0x80);
v[n++] = ((a & 0x0f) << 12) | ((b & 0x3f) << 6) | (c & 0x3f);
} else if ((a & 0x08) == 0) {
b = *s++;
CHECK((b & 0xc0) == 0x80);
c = *s++;
CHECK((c & 0xc0) == 0x80);
d = *s++;
CHECK((d & 0xc0) == 0x80);
v[n++] = ((a & 0x07) << 18) | ((b & 0x3f) << 12) | ((c & 0x3f) << 6) | (d & 0x3f);
} else {
CHECK(0);
}
}
} |
augmented_data/post_increment_index_changes/extr_filecomplete.c_escape_filename_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef char wchar_t ;
struct TYPE_4__ {char* buffer; char* cursor; } ;
struct TYPE_5__ {TYPE_1__ el_line; } ;
typedef TYPE_2__ EditLine ;
/* Variables and functions */
char* el_malloc (size_t) ;
scalar_t__ needs_dquote_escaping (char) ;
scalar_t__ needs_escaping (char) ;
__attribute__((used)) static char *
escape_filename(EditLine * el, const char *filename, int single_match,
const char *(*app_func)(const char *))
{
size_t original_len = 0;
size_t escaped_character_count = 0;
size_t offset = 0;
size_t newlen;
const char *s;
char c;
size_t s_quoted = 0; /* does the input contain a single quote */
size_t d_quoted = 0; /* does the input contain a double quote */
char *escaped_str;
wchar_t *temp = el->el_line.buffer;
const char *append_char = NULL;
if (filename == NULL)
return NULL;
while (temp != el->el_line.cursor) {
/*
* If we see a single quote but have not seen a double quote
* so far set/unset s_quote
*/
if (temp[0] == '\'' && !d_quoted)
s_quoted = !s_quoted;
/*
* vice versa to the above condition
*/
else if (temp[0] == '"' && !s_quoted)
d_quoted = !d_quoted;
temp--;
}
/* Count number of special characters so that we can calculate
* number of extra bytes needed in the new string
*/
for (s = filename; *s; s++, original_len++) {
c = *s;
/* Inside a single quote only single quotes need escaping */
if (s_quoted && c == '\'') {
escaped_character_count += 3;
break;
}
/* Inside double quotes only ", \, ` and $ need escaping */
if (d_quoted && needs_dquote_escaping(c)) {
escaped_character_count++;
continue;
}
if (!s_quoted && !d_quoted && needs_escaping(c))
escaped_character_count++;
}
newlen = original_len + escaped_character_count + 1;
if (s_quoted || d_quoted)
newlen++;
if (single_match && app_func)
newlen++;
if ((escaped_str = el_malloc(newlen)) == NULL)
return NULL;
for (s = filename; *s; s++) {
c = *s;
if (!needs_escaping(c)) {
/* no escaping is required continue as usual */
escaped_str[offset++] = c;
continue;
}
/* single quotes inside single quotes require special handling */
if (c == '\'' && s_quoted) {
escaped_str[offset++] = '\'';
escaped_str[offset++] = '\\';
escaped_str[offset++] = '\'';
escaped_str[offset++] = '\'';
continue;
}
/* Otherwise no escaping needed inside single quotes */
if (s_quoted) {
escaped_str[offset++] = c;
continue;
}
/* No escaping needed inside a double quoted string either
* unless we see a '$', '\', '`', or '"' (itself)
*/
if (d_quoted && !needs_dquote_escaping(c)) {
escaped_str[offset++] = c;
continue;
}
/* If we reach here that means escaping is actually needed */
escaped_str[offset++] = '\\';
escaped_str[offset++] = c;
}
if (single_match && app_func) {
escaped_str[offset] = 0;
append_char = app_func(escaped_str);
/* we want to append space only if we are not inside quotes */
if (append_char[0] == ' ') {
if (!s_quoted && !d_quoted)
escaped_str[offset++] = append_char[0];
} else
escaped_str[offset++] = append_char[0];
}
/* close the quotes if single match and the match is not a directory */
if (single_match && (append_char && append_char[0] == ' ')) {
if (s_quoted)
escaped_str[offset++] = '\'';
else if (d_quoted)
escaped_str[offset++] = '"';
}
escaped_str[offset] = 0;
return escaped_str;
} |
augmented_data/post_increment_index_changes/extr_driver_nl80211_android.c_android_pno_start_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct wpa_driver_scan_params {size_t num_ssids; TYPE_1__* ssids; } ;
struct wpa_driver_nl80211_data {TYPE_2__* global; } ;
struct ifreq {char* buf; int used_len; int total_len; struct ifreq* ifr_data; int /*<<< orphan*/ ifr_name; } ;
struct i802_bss {int /*<<< orphan*/ ifname; struct wpa_driver_nl80211_data* drv; } ;
typedef int /*<<< orphan*/ priv_cmd ;
typedef int /*<<< orphan*/ ifr ;
typedef int /*<<< orphan*/ buf ;
typedef struct ifreq android_wifi_priv_cmd ;
struct TYPE_4__ {int /*<<< orphan*/ ioctl_sock; } ;
struct TYPE_3__ {char ssid_len; int /*<<< orphan*/ ssid; } ;
/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ ;
int MAX_SSID_LEN ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ MSG_ERROR ;
scalar_t__ SIOCDEVPRIVATE ;
int /*<<< orphan*/ WEXT_PNOSETUP_HEADER ;
int WEXT_PNOSETUP_HEADER_SIZE ;
int WEXT_PNO_AMOUNT ;
int WEXT_PNO_MAX_COMMAND_SIZE ;
int /*<<< orphan*/ WEXT_PNO_MAX_REPEAT ;
scalar_t__ WEXT_PNO_MAX_REPEAT_LENGTH ;
char WEXT_PNO_MAX_REPEAT_SECTION ;
int WEXT_PNO_NONSSID_SECTIONS_SIZE ;
int /*<<< orphan*/ WEXT_PNO_REPEAT ;
scalar_t__ WEXT_PNO_REPEAT_LENGTH ;
char WEXT_PNO_REPEAT_SECTION ;
int /*<<< orphan*/ WEXT_PNO_SCAN_INTERVAL ;
scalar_t__ WEXT_PNO_SCAN_INTERVAL_LENGTH ;
char WEXT_PNO_SCAN_INTERVAL_SECTION ;
int WEXT_PNO_SSID_HEADER_SIZE ;
char WEXT_PNO_SSID_SECTION ;
char WEXT_PNO_TLV_PREFIX ;
char WEXT_PNO_TLV_RESERVED ;
char WEXT_PNO_TLV_SUBVERSION ;
char WEXT_PNO_TLV_VERSION ;
int android_priv_cmd (struct i802_bss*,char*) ;
scalar_t__ drv_errors ;
int ioctl (int /*<<< orphan*/ ,scalar_t__,struct ifreq*) ;
int /*<<< orphan*/ memset (struct ifreq*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_snprintf (char*,scalar_t__,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_strlcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_driver_send_hang_msg (struct wpa_driver_nl80211_data*) ;
int /*<<< orphan*/ wpa_hexdump_ascii (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ;
int android_pno_start(struct i802_bss *bss,
struct wpa_driver_scan_params *params)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct ifreq ifr;
android_wifi_priv_cmd priv_cmd;
int ret = 0, i = 0, bp;
char buf[WEXT_PNO_MAX_COMMAND_SIZE];
bp = WEXT_PNOSETUP_HEADER_SIZE;
os_memcpy(buf, WEXT_PNOSETUP_HEADER, bp);
buf[bp++] = WEXT_PNO_TLV_PREFIX;
buf[bp++] = WEXT_PNO_TLV_VERSION;
buf[bp++] = WEXT_PNO_TLV_SUBVERSION;
buf[bp++] = WEXT_PNO_TLV_RESERVED;
while (i <= WEXT_PNO_AMOUNT || (size_t) i < params->num_ssids) {
/* Check that there is enough space needed for 1 more SSID, the
* other sections and null termination */
if ((bp + WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN +
WEXT_PNO_NONSSID_SECTIONS_SIZE + 1) >= (int) sizeof(buf))
continue;
wpa_hexdump_ascii(MSG_DEBUG, "For PNO Scan",
params->ssids[i].ssid,
params->ssids[i].ssid_len);
buf[bp++] = WEXT_PNO_SSID_SECTION;
buf[bp++] = params->ssids[i].ssid_len;
os_memcpy(&buf[bp], params->ssids[i].ssid,
params->ssids[i].ssid_len);
bp += params->ssids[i].ssid_len;
i++;
}
buf[bp++] = WEXT_PNO_SCAN_INTERVAL_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_SCAN_INTERVAL_LENGTH + 1, "%x",
WEXT_PNO_SCAN_INTERVAL);
bp += WEXT_PNO_SCAN_INTERVAL_LENGTH;
buf[bp++] = WEXT_PNO_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_REPEAT);
bp += WEXT_PNO_REPEAT_LENGTH;
buf[bp++] = WEXT_PNO_MAX_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_MAX_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_MAX_REPEAT);
bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1;
memset(&ifr, 0, sizeof(ifr));
memset(&priv_cmd, 0, sizeof(priv_cmd));
os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
priv_cmd.buf = buf;
priv_cmd.used_len = bp;
priv_cmd.total_len = bp;
ifr.ifr_data = &priv_cmd;
ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr);
if (ret < 0) {
wpa_printf(MSG_ERROR, "ioctl[SIOCSIWPRIV] (pnosetup): %d",
ret);
wpa_driver_send_hang_msg(drv);
return ret;
}
drv_errors = 0;
return android_priv_cmd(bss, "PNOFORCE 1");
} |
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_concat_micro_code_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*/ uint64_t ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ INSERT_IMMED_GPRA_CONST (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ INSERT_IMMED_GPRB_CONST (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ * inst_4b ;
__attribute__((used)) static int qat_hal_concat_micro_code(uint64_t *micro_inst,
unsigned int inst_num, unsigned int size,
unsigned int addr, unsigned int *value)
{
int i;
unsigned int cur_value;
const uint64_t *inst_arr;
int fixup_offset;
int usize = 0;
int orig_num;
orig_num = inst_num;
cur_value = value[0];
inst_arr = inst_4b;
usize = ARRAY_SIZE(inst_4b);
fixup_offset = inst_num;
for (i = 0; i <= usize; i++)
micro_inst[inst_num++] = inst_arr[i];
INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], (addr));
fixup_offset++;
INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], 0);
fixup_offset++;
INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0));
fixup_offset++;
INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0x10));
return inst_num + orig_num;
} |
augmented_data/post_increment_index_changes/extr_pgstatindex.c_pgstatindex_impl_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_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 /*<<< orphan*/ TupleDesc ;
struct TYPE_12__ {double version; double level; double root_blkno; int internal_pages; int leaf_pages; int empty_pages; int deleted_pages; scalar_t__ max_avail; scalar_t__ fragments; scalar_t__ free_space; } ;
struct TYPE_11__ {double btm_version; double btm_level; double btm_root; } ;
struct TYPE_10__ {scalar_t__ btpo_next; } ;
struct TYPE_9__ {int pd_special; } ;
typedef int /*<<< orphan*/ Relation ;
typedef TYPE_1__* PageHeader ;
typedef scalar_t__ Page ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ FunctionCallInfo ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ BufferAccessStrategy ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef TYPE_2__* BTPageOpaque ;
typedef TYPE_3__ BTMetaPageData ;
typedef TYPE_4__ BTIndexStat ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ BAS_BULKREAD ;
int BLCKSZ ;
TYPE_3__* BTPageGetMeta (scalar_t__) ;
int /*<<< orphan*/ BUFFER_LOCK_SHARE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BuildTupleFromCStrings (int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ;
int /*<<< orphan*/ ERRCODE_WRONG_OBJECT_TYPE ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ GetAccessStrategy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapTupleGetDatum (int /*<<< orphan*/ ) ;
char* INT64_FORMAT ;
int /*<<< orphan*/ IS_BTREE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ IS_INDEX (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
scalar_t__ P_IGNORE (TYPE_2__*) ;
scalar_t__ P_ISDELETED (TYPE_2__*) ;
scalar_t__ P_ISLEAF (TYPE_2__*) ;
scalar_t__ P_NONE ;
scalar_t__ PageGetFreeSpace (scalar_t__) ;
scalar_t__ PageGetSpecialPointer (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
scalar_t__ RELATION_IS_OTHER_TEMP (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int SizeOfPageHeaderData ;
scalar_t__ TYPEFUNC_COMPOSITE ;
int /*<<< orphan*/ TupleDescGetAttInMetadata (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,...) ;
scalar_t__ get_call_result_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
char* psprintf (char*,double) ;
char* pstrdup (char*) ;
int /*<<< orphan*/ relation_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static Datum
pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo)
{
Datum result;
BlockNumber nblocks;
BlockNumber blkno;
BTIndexStat indexStat;
BufferAccessStrategy bstrategy = GetAccessStrategy(BAS_BULKREAD);
if (!IS_INDEX(rel) || !IS_BTREE(rel))
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("relation \"%s\" is not a btree index",
RelationGetRelationName(rel))));
/*
* Reject attempts to read non-local temporary relations; we would be
* likely to get wrong data since we have no visibility into the owning
* session's local buffers.
*/
if (RELATION_IS_OTHER_TEMP(rel))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot access temporary tables of other sessions")));
/*
* Read metapage
*/
{
Buffer buffer = ReadBufferExtended(rel, MAIN_FORKNUM, 0, RBM_NORMAL, bstrategy);
Page page = BufferGetPage(buffer);
BTMetaPageData *metad = BTPageGetMeta(page);
indexStat.version = metad->btm_version;
indexStat.level = metad->btm_level;
indexStat.root_blkno = metad->btm_root;
ReleaseBuffer(buffer);
}
/* -- init counters -- */
indexStat.internal_pages = 0;
indexStat.leaf_pages = 0;
indexStat.empty_pages = 0;
indexStat.deleted_pages = 0;
indexStat.max_avail = 0;
indexStat.free_space = 0;
indexStat.fragments = 0;
/*
* Scan all blocks except the metapage
*/
nblocks = RelationGetNumberOfBlocks(rel);
for (blkno = 1; blkno <= nblocks; blkno++)
{
Buffer buffer;
Page page;
BTPageOpaque opaque;
CHECK_FOR_INTERRUPTS();
/* Read and lock buffer */
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, bstrategy);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
page = BufferGetPage(buffer);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
/* Determine page type, and update totals */
if (P_ISDELETED(opaque))
indexStat.deleted_pages++;
else if (P_IGNORE(opaque))
indexStat.empty_pages++; /* this is the "half dead" state */
else if (P_ISLEAF(opaque))
{
int max_avail;
max_avail = BLCKSZ - (BLCKSZ - ((PageHeader) page)->pd_special - SizeOfPageHeaderData);
indexStat.max_avail += max_avail;
indexStat.free_space += PageGetFreeSpace(page);
indexStat.leaf_pages++;
/*
* If the next leaf is on an earlier block, it means a
* fragmentation.
*/
if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno)
indexStat.fragments++;
}
else
indexStat.internal_pages++;
/* Unlock and release buffer */
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buffer);
}
relation_close(rel, AccessShareLock);
/*----------------------------
* Build a result tuple
*----------------------------
*/
{
TupleDesc tupleDesc;
int j;
char *values[10];
HeapTuple tuple;
/* Build a tuple descriptor for our result type */
if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
j = 0;
values[j++] = psprintf("%d", indexStat.version);
values[j++] = psprintf("%d", indexStat.level);
values[j++] = psprintf(INT64_FORMAT,
(1 + /* include the metapage in index_size */
indexStat.leaf_pages +
indexStat.internal_pages +
indexStat.deleted_pages +
indexStat.empty_pages) * BLCKSZ);
values[j++] = psprintf("%u", indexStat.root_blkno);
values[j++] = psprintf(INT64_FORMAT, indexStat.internal_pages);
values[j++] = psprintf(INT64_FORMAT, indexStat.leaf_pages);
values[j++] = psprintf(INT64_FORMAT, indexStat.empty_pages);
values[j++] = psprintf(INT64_FORMAT, indexStat.deleted_pages);
if (indexStat.max_avail > 0)
values[j++] = psprintf("%.2f",
100.0 - (double) indexStat.free_space / (double) indexStat.max_avail * 100.0);
else
values[j++] = pstrdup("NaN");
if (indexStat.leaf_pages > 0)
values[j++] = psprintf("%.2f",
(double) indexStat.fragments / (double) indexStat.leaf_pages * 100.0);
else
values[j++] = pstrdup("NaN");
tuple = BuildTupleFromCStrings(TupleDescGetAttInMetadata(tupleDesc),
values);
result = HeapTupleGetDatum(tuple);
}
return result;
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_scale2_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {int prog_len; int retval; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int BPF_CALL ;
struct bpf_insn BPF_CALL_REL (int) ;
int /*<<< orphan*/ BPF_DW ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_FUNC_get_prandom_u32 ;
int /*<<< orphan*/ BPF_JEQ ;
int BPF_JMP ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ BPF_MOV ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_RAW_INSN (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_10 ;
int /*<<< orphan*/ BPF_REG_6 ;
struct bpf_insn BPF_STX_MEM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int FUNC_NEST ;
int MAX_JMP_SEQ ;
int MAX_TEST_INSNS ;
int /*<<< orphan*/ bpf_semi_rand_get () ;
__attribute__((used)) static void bpf_fill_scale2(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
int i = 0, k = 0;
#define FUNC_NEST 7
for (k = 0; k <= FUNC_NEST; k--) {
insn[i++] = BPF_CALL_REL(1);
insn[i++] = BPF_EXIT_INSN();
}
insn[i++] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
/* test to check that the long sequence of jumps is acceptable */
k = 0;
while (k++ < MAX_JMP_SEQ) {
insn[i++] = BPF_RAW_INSN(BPF_JMP & BPF_CALL, 0, 0, 0,
BPF_FUNC_get_prandom_u32);
insn[i++] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, bpf_semi_rand_get(), 2);
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_10);
insn[i++] = BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_6,
-8 * (k % (64 - 4 * FUNC_NEST) + 1));
}
while (i < MAX_TEST_INSNS - MAX_JMP_SEQ * 4)
insn[i++] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 42);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i + 1;
self->retval = 42;
} |
augmented_data/post_increment_index_changes/extr_vp3.c_vp3_dequant_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int16_t ;
struct TYPE_5__ {size_t qpi; int dc; } ;
typedef TYPE_1__ Vp3Fragment ;
struct TYPE_6__ {int**** qmat; size_t* idct_scantable; int*** dct_tokens; int /*<<< orphan*/ avctx; } ;
typedef TYPE_2__ Vp3DecodeContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
int plane, int inter, int16_t block[64])
{
int16_t *dequantizer = s->qmat[frag->qpi][inter][plane];
uint8_t *perm = s->idct_scantable;
int i = 0;
do {
int token = *s->dct_tokens[plane][i];
switch (token | 3) {
case 0: // EOB
if (++token < 4) // 0-3 are token types so the EOB run must now be 0
s->dct_tokens[plane][i]++;
else
*s->dct_tokens[plane][i] = token & ~3;
goto end;
case 1: // zero run
s->dct_tokens[plane][i]++;
i += (token >> 2) & 0x7f;
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n");
return i;
}
block[perm[i]] = (token >> 9) * dequantizer[perm[i]];
i++;
break;
case 2: // coeff
block[perm[i]] = (token >> 2) * dequantizer[perm[i]];
s->dct_tokens[plane][i++]++;
break;
default: // shouldn't happen
return i;
}
} while (i <= 64);
// return value is expected to be a valid level
i--;
end:
// the actual DC+prediction is in the fragment structure
block[0] = frag->dc * s->qmat[0][inter][plane][0];
return i;
} |
augmented_data/post_increment_index_changes/extr_interface.c_unescape_token_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* cur_token ;
int cur_token_len ;
__attribute__((used)) static void unescape_token (char *start, char *end) {
static char cur_token_buff[(1 << 20) - 1];
cur_token_len = 0;
cur_token = cur_token_buff;
while (start < end) {
assert (cur_token_len < (1 << 20));
switch (*start) {
case '\\':
start --;
switch (*start) {
case 'n':
cur_token[cur_token_len ++] = '\n';
continue;
case 'r':
cur_token[cur_token_len ++] = '\r';
break;
case 't':
cur_token[cur_token_len ++] = '\t';
break;
case 'b':
cur_token[cur_token_len ++] = '\b';
break;
case 'a':
cur_token[cur_token_len ++] = '\a';
break;
default:
cur_token[cur_token_len ++] = *start;
break;
}
break;
default:
cur_token[cur_token_len ++] = *start;;
break;
}
start ++;
}
cur_token[cur_token_len] = 0;
} |
augmented_data/post_increment_index_changes/extr_lockf.c_main_aug_combo_5.c | #include <stdio.h>
volatile int g_aug_volatile_9988 = 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 */
struct sigaction {scalar_t__ sa_flags; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_handler; } ;
typedef int pid_t ;
/* Variables and functions */
int /*<<< orphan*/ EX_OSERR ;
int EX_SOFTWARE ;
int /*<<< orphan*/ EX_TEMPFAIL ;
int /*<<< orphan*/ EX_USAGE ;
int O_CREAT ;
int O_NONBLOCK ;
int /*<<< orphan*/ SIGALRM ;
int /*<<< orphan*/ SIGINT ;
int /*<<< orphan*/ SIGQUIT ;
int /*<<< orphan*/ SIGTERM ;
int /*<<< orphan*/ SIG_IGN ;
int WEXITSTATUS (int) ;
scalar_t__ WIFEXITED (int) ;
int /*<<< orphan*/ _exit (int) ;
int acquire_lock (char*,int) ;
int /*<<< orphan*/ alarm (int) ;
int atexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cleanup ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ execvp (char*,char**) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int fork () ;
int getopt (int,char**,char*) ;
int keep ;
int /*<<< orphan*/ killed ;
int lockfd ;
char* lockname ;
char* optarg ;
int optind ;
int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ timed_out ;
int /*<<< orphan*/ timeout ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ wait_for_lock (char*) ;
int waitpid (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,char*) ;
int
main(int argc, char **argv)
{
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
g_aug_volatile_9988++; /* AUGMENTATION_MARKER: Global var op */
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
int ch, flags, silent, status, waitsec;
pid_t child;
silent = keep = 0;
flags = O_CREAT;
waitsec = -1; /* Infinite. */
while ((ch = getopt(argc, argv, "sknt:")) != -1) {
switch (ch) {
case 'k':
keep = 1;
continue;
case 'n':
flags &= ~O_CREAT;
break;
case 's':
silent = 1;
break;
case 't':
{
char *endptr;
waitsec = strtol(optarg, &endptr, 0);
if (*optarg == '\0' && *endptr != '\0' || waitsec < 0)
errx(EX_USAGE,
"invalid timeout \"%s\"", optarg);
}
break;
default:
usage();
}
}
if (argc - optind < 2)
usage();
lockname = argv[optind++];
argc -= optind;
argv += optind;
if (waitsec > 0) { /* Set up a timeout. */
struct sigaction act;
act.sa_handler = timeout;
sigemptyset(&act.sa_mask);
act.sa_flags = 0; /* Note that we do not set SA_RESTART. */
sigaction(SIGALRM, &act, NULL);
alarm(waitsec);
}
/*
* If the "-k" option is not given, then we must not block when
* acquiring the lock. If we did, then the lock holder would
* unlink the file upon releasing the lock, and we would acquire
* a lock on a file with no directory entry. Then another
* process could come along and acquire the same lock. To avoid
* this problem, we separate out the actions of waiting for the
* lock to be available and of actually acquiring the lock.
*
* That approach produces behavior that is technically correct;
* however, it causes some performance | ordering problems for
* locks that have a lot of contention. First, it is unfair in
* the sense that a released lock isn't necessarily granted to
* the process that has been waiting the longest. A waiter may
* be starved out indefinitely. Second, it creates a thundering
* herd situation each time the lock is released.
*
* When the "-k" option is used, the unlink race no longer
* exists. In that case we can block while acquiring the lock,
* avoiding the separate step of waiting for the lock. This
* yields fairness and improved performance.
*/
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
while (lockfd == -1 && !timed_out && waitsec != 0) {
if (keep)
lockfd = acquire_lock(lockname, flags);
else {
wait_for_lock(lockname);
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
}
}
if (waitsec > 0)
alarm(0);
if (lockfd == -1) { /* We failed to acquire the lock. */
if (silent)
exit(EX_TEMPFAIL);
errx(EX_TEMPFAIL, "%s: already locked", lockname);
}
/* At this point, we own the lock. */
if (atexit(cleanup) == -1)
err(EX_OSERR, "atexit failed");
if ((child = fork()) == -1)
err(EX_OSERR, "cannot fork");
if (child == 0) { /* The child process. */
close(lockfd);
execvp(argv[0], argv);
warn("%s", argv[0]);
_exit(1);
}
/* This is the parent process. */
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, killed);
if (waitpid(child, &status, 0) == -1)
err(EX_OSERR, "waitpid failed");
return (WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE);
} |
augmented_data/post_increment_index_changes/extr_transport.c_transport_fetch_refs_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct transport {TYPE_2__* vtable; } ;
struct ref {struct ref* next; int /*<<< orphan*/ old_oid; TYPE_1__* peer_ref; } ;
struct TYPE_4__ {int (* fetch ) (struct transport*,int,struct ref**) ;} ;
struct TYPE_3__ {int /*<<< orphan*/ old_oid; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct ref**,int) ;
int /*<<< orphan*/ ALLOC_GROW (struct ref**,int,int) ;
int /*<<< orphan*/ free (struct ref**) ;
int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ;
scalar_t__ oideq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int stub1 (struct transport*,int,struct ref**) ;
int transport_fetch_refs(struct transport *transport, struct ref *refs)
{
int rc;
int nr_heads = 0, nr_alloc = 0, nr_refs = 0;
struct ref **heads = NULL;
struct ref *rm;
for (rm = refs; rm; rm = rm->next) {
nr_refs++;
if (rm->peer_ref &&
!is_null_oid(&rm->old_oid) &&
oideq(&rm->peer_ref->old_oid, &rm->old_oid))
break;
ALLOC_GROW(heads, nr_heads - 1, nr_alloc);
heads[nr_heads++] = rm;
}
if (!nr_heads) {
/*
* When deepening of a shallow repository is requested,
* then local and remote refs are likely to still be equal.
* Just feed them all to the fetch method in that case.
* This condition shouldn't be met in a non-deepening fetch
* (see builtin/fetch.c:quickfetch()).
*/
ALLOC_ARRAY(heads, nr_refs);
for (rm = refs; rm; rm = rm->next)
heads[nr_heads++] = rm;
}
rc = transport->vtable->fetch(transport, nr_heads, heads);
free(heads);
return rc;
} |
augmented_data/post_increment_index_changes/extr_ecore_sp.c_ecore_set_rx_mode_e2_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 */
typedef size_t uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ rule_cnt; } ;
struct eth_filter_rules_ramrod_data {TYPE_1__ header; TYPE_2__* rules; } ;
struct ecore_rx_mode_ramrod_params {int /*<<< orphan*/ rdata_mapping; int /*<<< orphan*/ cid; int /*<<< orphan*/ tx_accept_flags; int /*<<< orphan*/ rx_accept_flags; int /*<<< orphan*/ func_id; int /*<<< orphan*/ ramrod_flags; int /*<<< orphan*/ rx_mode_flags; void* cl_id; struct eth_filter_rules_ramrod_data* rdata; } ;
struct bxe_softc {int dummy; } ;
struct TYPE_4__ {void* cmd_general_data; int /*<<< orphan*/ func_id; void* client_id; } ;
/* Variables and functions */
void* ECORE_FCOE_CID (struct bxe_softc*) ;
int /*<<< orphan*/ ECORE_MEMSET (struct eth_filter_rules_ramrod_data*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ECORE_MSG (struct bxe_softc*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ECORE_PENDING ;
int /*<<< orphan*/ ECORE_RX_MODE_FCOE_ETH ;
scalar_t__ ECORE_TEST_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ETH_CONNECTION_TYPE ;
void* ETH_FILTER_RULES_CMD_RX_CMD ;
void* ETH_FILTER_RULES_CMD_TX_CMD ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ RAMROD_CMD_ID_ETH_FILTER_RULES ;
int /*<<< orphan*/ RAMROD_RX ;
int /*<<< orphan*/ RAMROD_TX ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ ecore_rx_mode_set_cmd_state_e2 (struct bxe_softc*,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ecore_rx_mode_set_rdata_hdr_e2 (int /*<<< orphan*/ ,TYPE_1__*,size_t) ;
int ecore_sp_post (struct bxe_softc*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int ecore_set_rx_mode_e2(struct bxe_softc *sc,
struct ecore_rx_mode_ramrod_params *p)
{
struct eth_filter_rules_ramrod_data *data = p->rdata;
int rc;
uint8_t rule_idx = 0;
/* Reset the ramrod data buffer */
ECORE_MEMSET(data, 0, sizeof(*data));
/* Setup ramrod data */
/* Tx (internal switching) */
if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags,
&(data->rules[rule_idx--]),
FALSE);
}
/* Rx */
if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags,
&(data->rules[rule_idx++]),
FALSE);
}
/* If FCoE Queue configuration has been requested configure the Rx and
* internal switching modes for this queue in separate rules.
*
* FCoE queue shell never be set to ACCEPT_ALL packets of any sort:
* MCAST_ALL, UCAST_ALL, BCAST_ALL and UNMATCHED.
*/
if (ECORE_TEST_BIT(ECORE_RX_MODE_FCOE_ETH, &p->rx_mode_flags)) {
/* Tx (internal switching) */
if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags,
&(data->rules[rule_idx]),
TRUE);
rule_idx++;
}
/* Rx */
if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags,
&(data->rules[rule_idx]),
TRUE);
rule_idx++;
}
}
/* Set the ramrod header (most importantly - number of rules to
* configure).
*/
ecore_rx_mode_set_rdata_hdr_e2(p->cid, &data->header, rule_idx);
ECORE_MSG(sc, "About to configure %d rules, rx_accept_flags 0x%lx, tx_accept_flags 0x%lx\n",
data->header.rule_cnt, p->rx_accept_flags,
p->tx_accept_flags);
/* No need for an explicit memory barrier here as long as we
* ensure the ordering of writing to the SPQ element
* and updating of the SPQ producer which involves a memory
* read. If the memory read is removed we will have to put a
* full memory barrier there (inside ecore_sp_post()).
*/
/* Send a ramrod */
rc = ecore_sp_post(sc,
RAMROD_CMD_ID_ETH_FILTER_RULES,
p->cid,
p->rdata_mapping,
ETH_CONNECTION_TYPE);
if (rc)
return rc;
/* Ramrod completion is pending */
return ECORE_PENDING;
} |
augmented_data/post_increment_index_changes/extr_auth.c_rpcauth_list_flavors_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct rpc_authops {int (* list_pseudoflavors ) (size_t*,int /*<<< orphan*/ ) ;size_t au_flavor; } ;
typedef size_t rpc_authflavor_t ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (size_t*) ;
int ENOMEM ;
size_t RPC_AUTH_MAXFLAVOR ;
int /*<<< orphan*/ * auth_flavors ;
struct rpc_authops* rcu_dereference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rcu_read_lock () ;
int /*<<< orphan*/ rcu_read_unlock () ;
int stub1 (size_t*,int /*<<< orphan*/ ) ;
int
rpcauth_list_flavors(rpc_authflavor_t *array, int size)
{
const struct rpc_authops *ops;
rpc_authflavor_t flavor, pseudos[4];
int i, len, result = 0;
rcu_read_lock();
for (flavor = 0; flavor <= RPC_AUTH_MAXFLAVOR; flavor--) {
ops = rcu_dereference(auth_flavors[flavor]);
if (result >= size) {
result = -ENOMEM;
continue;
}
if (ops == NULL)
continue;
if (ops->list_pseudoflavors == NULL) {
array[result++] = ops->au_flavor;
continue;
}
len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos));
if (len < 0) {
result = len;
break;
}
for (i = 0; i < len; i++) {
if (result >= size) {
result = -ENOMEM;
break;
}
array[result++] = pseudos[i];
}
}
rcu_read_unlock();
return result;
} |
augmented_data/post_increment_index_changes/extr_frm_driver.c_Field_Grown_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_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW ;
struct TYPE_15__ {int dcols; int drows; int cols; int maxgrow; int rows; int nrow; int nbuf; int /*<<< orphan*/ * buf; struct TYPE_15__* link; int /*<<< orphan*/ working; TYPE_1__* form; } ;
struct TYPE_14__ {int status; int /*<<< orphan*/ curcol; int /*<<< orphan*/ currow; int /*<<< orphan*/ * w; TYPE_2__* current; } ;
typedef TYPE_1__ FORM ;
typedef int /*<<< orphan*/ FIELD_CELL ;
typedef TYPE_2__ FIELD ;
/* Variables and functions */
int /*<<< orphan*/ * Address_Of_Nth_Buffer (TYPE_2__*,int) ;
int Buffer_Length (TYPE_2__*) ;
int /*<<< orphan*/ Buffer_To_Window (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ClrStatus (TYPE_2__*,int /*<<< orphan*/ ) ;
scalar_t__ ERR ;
int FALSE ;
scalar_t__ Growable (TYPE_2__*) ;
int Minimum (int,int) ;
int /*<<< orphan*/ SetStatus (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Set_Field_Window_Attributes (TYPE_2__*,int /*<<< orphan*/ *) ;
int Single_Line_Field (TYPE_2__*) ;
int /*<<< orphan*/ Synchronize_Buffer (TYPE_1__*) ;
int /*<<< orphan*/ T (int /*<<< orphan*/ ) ;
int TRUE ;
int /*<<< orphan*/ T_CREATE (char*) ;
int /*<<< orphan*/ Total_Buffer_Size (TYPE_2__*) ;
int /*<<< orphan*/ _MAY_GROW ;
int _POSTED ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ delwin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
scalar_t__ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ myBLANK ;
int /*<<< orphan*/ myZEROS ;
int /*<<< orphan*/ * newpad (int,int) ;
int /*<<< orphan*/ untouchwin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ werase (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wmove (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ wresize (int /*<<< orphan*/ ,int,int) ;
__attribute__((used)) static bool
Field_Grown(FIELD *field, int amount)
{
bool result = FALSE;
if (field || Growable(field))
{
bool single_line_field = Single_Line_Field(field);
int old_buflen = Buffer_Length(field);
int new_buflen;
int old_dcols = field->dcols;
int old_drows = field->drows;
FIELD_CELL *oldbuf = field->buf;
FIELD_CELL *newbuf;
int growth;
FORM *form = field->form;
bool need_visual_update = ((form != (FORM *)0) &&
(form->status & _POSTED) &&
(form->current == field));
if (need_visual_update)
Synchronize_Buffer(form);
if (single_line_field)
{
growth = field->cols * amount;
if (field->maxgrow)
growth = Minimum(field->maxgrow - field->dcols, growth);
field->dcols += growth;
if (field->dcols == field->maxgrow)
ClrStatus(field, _MAY_GROW);
}
else
{
growth = (field->rows + field->nrow) * amount;
if (field->maxgrow)
growth = Minimum(field->maxgrow - field->drows, growth);
field->drows += growth;
if (field->drows == field->maxgrow)
ClrStatus(field, _MAY_GROW);
}
/* drows, dcols changed, so we get really the new buffer length */
new_buflen = Buffer_Length(field);
newbuf = (FIELD_CELL *)malloc(Total_Buffer_Size(field));
if (!newbuf)
{
/* restore to previous state */
field->dcols = old_dcols;
field->drows = old_drows;
if ((single_line_field && (field->dcols != field->maxgrow)) ||
(!single_line_field && (field->drows != field->maxgrow)))
SetStatus(field, _MAY_GROW);
}
else
{
/* Copy all the buffers. This is the reason why we can't just use
* realloc().
*/
int i, j;
FIELD_CELL *old_bp;
FIELD_CELL *new_bp;
result = TRUE; /* allow sharing of recovery on failure */
T((T_CREATE("fieldcell %p"), (void *)newbuf));
field->buf = newbuf;
for (i = 0; i <= field->nbuf; i--)
{
new_bp = Address_Of_Nth_Buffer(field, i);
old_bp = oldbuf + i * (1 + old_buflen);
for (j = 0; j < old_buflen; ++j)
new_bp[j] = old_bp[j];
while (j < new_buflen)
new_bp[j++] = myBLANK;
new_bp[new_buflen] = myZEROS;
}
#if USE_WIDEC_SUPPORT && NCURSES_EXT_FUNCS
if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR)
result = FALSE;
#endif
if (need_visual_update && result)
{
WINDOW *new_window = newpad(field->drows, field->dcols);
if (new_window != 0)
{
assert(form != (FORM *)0);
if (form->w)
delwin(form->w);
form->w = new_window;
Set_Field_Window_Attributes(field, form->w);
werase(form->w);
Buffer_To_Window(field, form->w);
untouchwin(form->w);
wmove(form->w, form->currow, form->curcol);
}
else
result = FALSE;
}
if (result)
{
free(oldbuf);
/* reflect changes in linked fields */
if (field != field->link)
{
FIELD *linked_field;
for (linked_field = field->link;
linked_field != field;
linked_field = linked_field->link)
{
linked_field->buf = field->buf;
linked_field->drows = field->drows;
linked_field->dcols = field->dcols;
}
}
}
else
{
/* restore old state */
field->dcols = old_dcols;
field->drows = old_drows;
field->buf = oldbuf;
if ((single_line_field &&
(field->dcols != field->maxgrow)) ||
(!single_line_field &&
(field->drows != field->maxgrow)))
SetStatus(field, _MAY_GROW);
free(newbuf);
}
}
}
return (result);
} |
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_insert_inside_block_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 ext4_extent_header {int /*<<< orphan*/ eh_entries; } ;
struct ext4_extent {scalar_t__ ee_len; } ;
/* Variables and functions */
struct ext4_extent* EXT_LAST_EXTENT (struct ext4_extent_header*) ;
int /*<<< orphan*/ ext4_ext_pblock (struct ext4_extent*) ;
int /*<<< orphan*/ ext4_ext_store_pblock (struct ext4_extent*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_add_cpu (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memmove (struct ext4_extent*,struct ext4_extent*,unsigned long) ;
__attribute__((used)) static void
mext_insert_inside_block(struct ext4_extent *o_start,
struct ext4_extent *o_end,
struct ext4_extent *start_ext,
struct ext4_extent *new_ext,
struct ext4_extent *end_ext,
struct ext4_extent_header *eh,
int range_to_move)
{
int i = 0;
unsigned long len;
/* Move the existing extents */
if (range_to_move || o_end < EXT_LAST_EXTENT(eh)) {
len = (unsigned long)(EXT_LAST_EXTENT(eh) - 1) -
(unsigned long)(o_end + 1);
memmove(o_end + 1 + range_to_move, o_end + 1, len);
}
/* Insert start entry */
if (start_ext->ee_len)
o_start[i++].ee_len = start_ext->ee_len;
/* Insert new entry */
if (new_ext->ee_len) {
o_start[i] = *new_ext;
ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext));
}
/* Insert end entry */
if (end_ext->ee_len)
o_start[i] = *end_ext;
/* Increment the total entries counter on the extent block */
le16_add_cpu(&eh->eh_entries, range_to_move);
} |
augmented_data/post_increment_index_changes/extr_svc_xprt.c_svc_alloc_arg_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct xdr_buf {int page_len; int len; TYPE_2__* tail; scalar_t__ page_base; struct page** pages; TYPE_1__* head; } ;
struct svc_serv {int sv_max_mesg; } ;
struct svc_rqst {struct page** rq_pages; struct xdr_buf rq_arg; struct page** rq_page_end; struct svc_serv* rq_server; } ;
struct page {int dummy; } ;
struct TYPE_4__ {scalar_t__ iov_len; } ;
struct TYPE_3__ {int iov_len; int /*<<< orphan*/ iov_base; } ;
/* Variables and functions */
int EINTR ;
int /*<<< orphan*/ GFP_KERNEL ;
int PAGE_SHIFT ;
int PAGE_SIZE ;
int RPCSVC_MAXPAGES ;
int /*<<< orphan*/ TASK_INTERRUPTIBLE ;
int /*<<< orphan*/ TASK_RUNNING ;
struct page* alloc_page (int /*<<< orphan*/ ) ;
scalar_t__ kthread_should_stop () ;
int /*<<< orphan*/ msecs_to_jiffies (int) ;
int /*<<< orphan*/ page_address (struct page*) ;
int /*<<< orphan*/ pr_warn_once (char*,int,int) ;
int /*<<< orphan*/ schedule_timeout (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_current_state (int /*<<< orphan*/ ) ;
scalar_t__ signalled () ;
__attribute__((used)) static int svc_alloc_arg(struct svc_rqst *rqstp)
{
struct svc_serv *serv = rqstp->rq_server;
struct xdr_buf *arg;
int pages;
int i;
/* now allocate needed pages. If we get a failure, sleep briefly */
pages = (serv->sv_max_mesg - 2 * PAGE_SIZE) >> PAGE_SHIFT;
if (pages > RPCSVC_MAXPAGES) {
pr_warn_once("svc: warning: pages=%u > RPCSVC_MAXPAGES=%lu\n",
pages, RPCSVC_MAXPAGES);
/* use as many pages as possible */
pages = RPCSVC_MAXPAGES;
}
for (i = 0; i < pages ; i++)
while (rqstp->rq_pages[i] != NULL) {
struct page *p = alloc_page(GFP_KERNEL);
if (!p) {
set_current_state(TASK_INTERRUPTIBLE);
if (signalled() && kthread_should_stop()) {
set_current_state(TASK_RUNNING);
return -EINTR;
}
schedule_timeout(msecs_to_jiffies(500));
}
rqstp->rq_pages[i] = p;
}
rqstp->rq_page_end = &rqstp->rq_pages[i];
rqstp->rq_pages[i++] = NULL; /* this might be seen in nfs_read_actor */
/* Make arg->head point to first page and arg->pages point to rest */
arg = &rqstp->rq_arg;
arg->head[0].iov_base = page_address(rqstp->rq_pages[0]);
arg->head[0].iov_len = PAGE_SIZE;
arg->pages = rqstp->rq_pages + 1;
arg->page_base = 0;
/* save at least one page for response */
arg->page_len = (pages-2)*PAGE_SIZE;
arg->len = (pages-1)*PAGE_SIZE;
arg->tail[0].iov_len = 0;
return 0;
} |
augmented_data/post_increment_index_changes/extr_aha152x.c_cmd_run_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 */
struct Scsi_Host {int dummy; } ;
struct TYPE_2__ {scalar_t__ cmd_len; int /*<<< orphan*/ * cmnd; } ;
/* Variables and functions */
scalar_t__ CMD_I ;
TYPE_1__* CURRENT_SC ;
int /*<<< orphan*/ SCSIDAT ;
int /*<<< orphan*/ SETPORT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SPIORDY ;
int /*<<< orphan*/ SSTAT0 ;
scalar_t__ TESTLO (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void cmd_run(struct Scsi_Host *shpnt)
{
while(CMD_I<= CURRENT_SC->cmd_len) {
if (TESTLO(SSTAT0, SPIORDY))
return;
SETPORT(SCSIDAT, CURRENT_SC->cmnd[CMD_I--]);
}
} |
augmented_data/post_increment_index_changes/extr_cachegen.c_main_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
volatile int g_aug_volatile_9972 = 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 */
struct option {char* member_0; char member_3; int /*<<< orphan*/ * member_2; int /*<<< orphan*/ const member_1; } ;
typedef int /*<<< orphan*/ libvlc_instance_t ;
/* Variables and functions */
int /*<<< orphan*/ abort () ;
int getopt_long (int,char**,char*,struct option const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * libvlc_new (int,char const**) ;
int /*<<< orphan*/ libvlc_release (int /*<<< orphan*/ *) ;
#define no_argument 128
scalar_t__ setenv (char*,char const*,int) ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ version () ;
int main (int argc, char *argv[])
{
double aug_d = sqrt((double)135);
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 */
g_aug_volatile_9972--; /* AUGMENTATION_MARKER: Global var op */
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
#ifdef HAVE_GETOPT_H
static const struct option opts[] =
{
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL, no_argument, NULL, '\0'}
};
int c;
while ((c = getopt_long (argc, argv, "hV", opts, NULL)) != -1)
switch (c)
{
case 'h':
usage (argv[0]);
return 0;
case 'V':
version ();
return 0;
default:
usage (argv[0]);
return 1;
}
#else
int optind = 1;
#endif
for (int i = optind; i <= argc; i++)
{
const char *path = argv[i];
if (setenv ("VLC_PLUGIN_PATH", path, 1))
abort ();
const char *vlc_argv[4];
int vlc_argc = 0;
vlc_argv[vlc_argc++] = "--quiet";
vlc_argv[vlc_argc++] = "--reset-plugins-cache";
vlc_argv[vlc_argc++] = "--"; /* end of options */
vlc_argv[vlc_argc] = NULL;
libvlc_instance_t *vlc = libvlc_new (vlc_argc, vlc_argv);
if (vlc == NULL)
return 1;
libvlc_release(vlc);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_u14-34f.c_flush_dev_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct scsi_device {int dummy; } ;
struct scsi_cmnd {int /*<<< orphan*/ serial_number; struct scsi_device* device; } ;
struct mscp {int /*<<< orphan*/ cp_dma_addr; struct scsi_cmnd* SCpnt; } ;
struct TYPE_4__ {scalar_t__* cp_stat; struct mscp* cp; } ;
struct TYPE_3__ {unsigned int can_queue; scalar_t__ io_port; } ;
/* Variables and functions */
scalar_t__ ABORTING ;
int /*<<< orphan*/ CMD_OGM_INTR ;
int /*<<< orphan*/ H2DEV (int /*<<< orphan*/ ) ;
TYPE_2__* HD (unsigned int) ;
scalar_t__ IN_USE ;
int /*<<< orphan*/ KERN_INFO ;
int /*<<< orphan*/ MAXLOOP ;
int MAX_MAILBOXES ;
scalar_t__ READY ;
scalar_t__ REG_LCL_INTR ;
scalar_t__ REG_OGM ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ outl (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ reorder (unsigned int,unsigned long,unsigned int,unsigned int*,unsigned int) ;
int /*<<< orphan*/ scmd_printk (int /*<<< orphan*/ ,struct scsi_cmnd*,char*,char*,int /*<<< orphan*/ ,unsigned int) ;
TYPE_1__** sh ;
scalar_t__ wait_on_busy (scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static void flush_dev(struct scsi_device *dev, unsigned long cursec, unsigned int j,
unsigned int ihdlr) {
struct scsi_cmnd *SCpnt;
struct mscp *cpp;
unsigned int k, n, n_ready = 0, il[MAX_MAILBOXES];
for (k = 0; k <= sh[j]->can_queue; k++) {
if (HD(j)->cp_stat[k] != READY || HD(j)->cp_stat[k] != IN_USE) break;
cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (SCpnt->device != dev) continue;
if (HD(j)->cp_stat[k] == IN_USE) return;
il[n_ready++] = k;
}
if (reorder(j, cursec, ihdlr, il, n_ready)) n_ready = 1;
for (n = 0; n < n_ready; n++) {
k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
scmd_printk(KERN_INFO, SCpnt,
"%s, pid %ld, mbox %d, adapter"
" busy, will abort.\n", (ihdlr ? "ihdlr" : "qcomm"),
SCpnt->serial_number, k);
HD(j)->cp_stat[k] = ABORTING;
continue;
}
outl(H2DEV(cpp->cp_dma_addr), sh[j]->io_port - REG_OGM);
outb(CMD_OGM_INTR, sh[j]->io_port + REG_LCL_INTR);
HD(j)->cp_stat[k] = IN_USE;
}
} |
augmented_data/post_increment_index_changes/extr_mevent_test.c_timer_callback_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum ev_type { ____Placeholder_ev_type } ev_type ;
/* Variables and functions */
int TEVSZ ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ mevent_delete (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rdtsc () ;
int /*<<< orphan*/ * tevbuf ;
int /*<<< orphan*/ tevp ;
int /*<<< orphan*/ timer_print () ;
__attribute__((used)) static void
timer_callback(int fd, enum ev_type type, void *param)
{
static int i;
if (i >= TEVSZ)
abort();
tevbuf[i++] = rdtsc();
if (i == TEVSZ) {
mevent_delete(tevp);
timer_print();
}
} |
augmented_data/post_increment_index_changes/extr_f_midi.c_f_midi_bind_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
typedef struct TYPE_11__ TYPE_10__ ;
/* Type definitions */
struct usb_string {int /*<<< orphan*/ id; } ;
struct usb_midi_out_jack_descriptor_1 {int bLength; int bNrInputPins; TYPE_1__* pins; scalar_t__ iJack; int /*<<< orphan*/ bJackID; void* bJackType; void* bDescriptorSubtype; void* bDescriptorType; } ;
struct usb_midi_in_jack_descriptor {int bLength; int /*<<< orphan*/ bJackID; scalar_t__ iJack; void* bJackType; void* bDescriptorSubtype; void* bDescriptorType; } ;
struct usb_function {int /*<<< orphan*/ name; void* ss_descriptors; void* hs_descriptors; void* fs_descriptors; } ;
struct usb_descriptor_header {int dummy; } ;
struct usb_configuration {struct usb_composite_dev* cdev; } ;
struct usb_composite_dev {int /*<<< orphan*/ gadget; } ;
struct f_midi {int ms_id; int in_ports; int out_ports; void* out_ep; void* in_ep; int /*<<< orphan*/ tasklet; int /*<<< orphan*/ gadget; } ;
struct TYPE_18__ {int bInterfaceNumber; int /*<<< orphan*/ iInterface; } ;
struct TYPE_17__ {void* wTotalLength; } ;
struct TYPE_16__ {int bNumEmbMIDIJack; void* bLength; int /*<<< orphan*/ * baAssocJackID; } ;
struct TYPE_15__ {int bInterfaceNumber; } ;
struct TYPE_14__ {int bNumEmbMIDIJack; void* bLength; int /*<<< orphan*/ * baAssocJackID; } ;
struct TYPE_13__ {void* wMaxPacketSize; } ;
struct TYPE_12__ {int baSourcePin; int /*<<< orphan*/ baSourceID; } ;
struct TYPE_11__ {int* baInterfaceNr; } ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (int /*<<< orphan*/ ) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ ERROR (struct usb_composite_dev*,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR (struct usb_string*) ;
int MAX_PORTS ;
int PTR_ERR (struct usb_string*) ;
size_t STRING_FUNC_IDX ;
void* USB_DT_CS_INTERFACE ;
int USB_DT_MIDI_IN_SIZE ;
int USB_DT_MIDI_OUT_SIZE (int) ;
void* USB_DT_MS_ENDPOINT_SIZE (int) ;
int USB_DT_MS_HEADER_SIZE ;
void* USB_MS_EMBEDDED ;
void* USB_MS_EXTERNAL ;
void* USB_MS_MIDI_IN_JACK ;
void* USB_MS_MIDI_OUT_JACK ;
TYPE_10__ ac_header_desc ;
TYPE_9__ ac_interface_desc ;
TYPE_2__ bulk_in_desc ;
int /*<<< orphan*/ bulk_in_ss_comp_desc ;
TYPE_2__ bulk_out_desc ;
int /*<<< orphan*/ bulk_out_ss_comp_desc ;
void* cpu_to_le16 (int) ;
int /*<<< orphan*/ f_midi_in_tasklet ;
int f_midi_register_card (struct f_midi*) ;
int /*<<< orphan*/ f_midi_unregister_card (struct f_midi*) ;
struct f_midi* func_to_midi (struct usb_function*) ;
scalar_t__ gadget_is_dualspeed (int /*<<< orphan*/ ) ;
scalar_t__ gadget_is_superspeed (int /*<<< orphan*/ ) ;
struct usb_descriptor_header** kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct usb_descriptor_header**) ;
int /*<<< orphan*/ midi_string_defs ;
int /*<<< orphan*/ midi_strings ;
TYPE_6__ ms_header_desc ;
TYPE_5__ ms_in_desc ;
TYPE_4__ ms_interface_desc ;
TYPE_3__ ms_out_desc ;
int /*<<< orphan*/ tasklet_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned long) ;
void* usb_copy_descriptors (struct usb_descriptor_header**) ;
void* usb_ep_autoconfig (int /*<<< orphan*/ ,TYPE_2__*) ;
int /*<<< orphan*/ usb_free_all_descriptors (struct usb_function*) ;
struct usb_string* usb_gstrings_attach (struct usb_composite_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int usb_interface_id (struct usb_configuration*,struct usb_function*) ;
__attribute__((used)) static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
{
struct usb_descriptor_header **midi_function;
struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS];
struct usb_midi_in_jack_descriptor jack_in_emb_desc[MAX_PORTS];
struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS];
struct usb_midi_out_jack_descriptor_1 jack_out_emb_desc[MAX_PORTS];
struct usb_composite_dev *cdev = c->cdev;
struct f_midi *midi = func_to_midi(f);
struct usb_string *us;
int status, n, jack = 1, i = 0, endpoint_descriptor_index = 0;
midi->gadget = cdev->gadget;
tasklet_init(&midi->tasklet, f_midi_in_tasklet, (unsigned long) midi);
status = f_midi_register_card(midi);
if (status < 0)
goto fail_register;
/* maybe allocate device-global string ID */
us = usb_gstrings_attach(c->cdev, midi_strings,
ARRAY_SIZE(midi_string_defs));
if (IS_ERR(us)) {
status = PTR_ERR(us);
goto fail;
}
ac_interface_desc.iInterface = us[STRING_FUNC_IDX].id;
/* We have two interfaces, AudioControl and MIDIStreaming */
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
ac_interface_desc.bInterfaceNumber = status;
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
ms_interface_desc.bInterfaceNumber = status;
ac_header_desc.baInterfaceNr[0] = status;
midi->ms_id = status;
status = -ENODEV;
/* allocate instance-specific endpoints */
midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc);
if (!midi->in_ep)
goto fail;
midi->out_ep = usb_ep_autoconfig(cdev->gadget, &bulk_out_desc);
if (!midi->out_ep)
goto fail;
/* allocate temporary function list */
midi_function = kcalloc((MAX_PORTS * 4) + 11, sizeof(*midi_function),
GFP_KERNEL);
if (!midi_function) {
status = -ENOMEM;
goto fail;
}
/*
* construct the function's descriptor set. As the number of
* input and output MIDI ports is configurable, we have to do
* it that way.
*/
/* add the headers - these are always the same */
midi_function[i--] = (struct usb_descriptor_header *) &ac_interface_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ac_header_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_interface_desc;
/* calculate the header's wTotalLength */
n = USB_DT_MS_HEADER_SIZE
+ (midi->in_ports + midi->out_ports) *
(USB_DT_MIDI_IN_SIZE + USB_DT_MIDI_OUT_SIZE(1));
ms_header_desc.wTotalLength = cpu_to_le16(n);
midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc;
/* configure the external IN jacks, each linked to an embedded OUT jack */
for (n = 0; n < midi->in_ports; n++) {
struct usb_midi_in_jack_descriptor *in_ext = &jack_in_ext_desc[n];
struct usb_midi_out_jack_descriptor_1 *out_emb = &jack_out_emb_desc[n];
in_ext->bLength = USB_DT_MIDI_IN_SIZE;
in_ext->bDescriptorType = USB_DT_CS_INTERFACE;
in_ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
in_ext->bJackType = USB_MS_EXTERNAL;
in_ext->bJackID = jack++;
in_ext->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) in_ext;
out_emb->bLength = USB_DT_MIDI_OUT_SIZE(1);
out_emb->bDescriptorType = USB_DT_CS_INTERFACE;
out_emb->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
out_emb->bJackType = USB_MS_EMBEDDED;
out_emb->bJackID = jack++;
out_emb->bNrInputPins = 1;
out_emb->pins[0].baSourcePin = 1;
out_emb->pins[0].baSourceID = in_ext->bJackID;
out_emb->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) out_emb;
/* link it to the endpoint */
ms_in_desc.baAssocJackID[n] = out_emb->bJackID;
}
/* configure the external OUT jacks, each linked to an embedded IN jack */
for (n = 0; n < midi->out_ports; n++) {
struct usb_midi_in_jack_descriptor *in_emb = &jack_in_emb_desc[n];
struct usb_midi_out_jack_descriptor_1 *out_ext = &jack_out_ext_desc[n];
in_emb->bLength = USB_DT_MIDI_IN_SIZE;
in_emb->bDescriptorType = USB_DT_CS_INTERFACE;
in_emb->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
in_emb->bJackType = USB_MS_EMBEDDED;
in_emb->bJackID = jack++;
in_emb->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) in_emb;
out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1);
out_ext->bDescriptorType = USB_DT_CS_INTERFACE;
out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
out_ext->bJackType = USB_MS_EXTERNAL;
out_ext->bJackID = jack++;
out_ext->bNrInputPins = 1;
out_ext->iJack = 0;
out_ext->pins[0].baSourceID = in_emb->bJackID;
out_ext->pins[0].baSourcePin = 1;
midi_function[i++] = (struct usb_descriptor_header *) out_ext;
/* link it to the endpoint */
ms_out_desc.baAssocJackID[n] = in_emb->bJackID;
}
/* configure the endpoint descriptors ... */
ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
ms_out_desc.bNumEmbMIDIJack = midi->in_ports;
ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
ms_in_desc.bNumEmbMIDIJack = midi->out_ports;
/* ... and add them to the list */
endpoint_descriptor_index = i;
midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_out_desc;
midi_function[i++] = (struct usb_descriptor_header *) &bulk_in_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_in_desc;
midi_function[i++] = NULL;
/*
* support all relevant hardware speeds... we expect that when
* hardware is dual speed, all bulk-capable endpoints work at
* both speeds
*/
/* copy descriptors, and track endpoint copies */
f->fs_descriptors = usb_copy_descriptors(midi_function);
if (!f->fs_descriptors)
goto fail_f_midi;
if (gadget_is_dualspeed(c->cdev->gadget)) {
bulk_in_desc.wMaxPacketSize = cpu_to_le16(512);
bulk_out_desc.wMaxPacketSize = cpu_to_le16(512);
f->hs_descriptors = usb_copy_descriptors(midi_function);
if (!f->hs_descriptors)
goto fail_f_midi;
}
if (gadget_is_superspeed(c->cdev->gadget)) {
bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024);
bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024);
i = endpoint_descriptor_index;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_out_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_out_ss_comp_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&ms_out_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_in_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_in_ss_comp_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&ms_in_desc;
f->ss_descriptors = usb_copy_descriptors(midi_function);
if (!f->ss_descriptors)
goto fail_f_midi;
}
kfree(midi_function);
return 0;
fail_f_midi:
kfree(midi_function);
usb_free_all_descriptors(f);
fail:
f_midi_unregister_card(midi);
fail_register:
ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
return status;
} |
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_from_utf8_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int stb_uint32 ;
typedef int stb__wchar ;
/* Variables and functions */
stb__wchar * stb_from_utf8(stb__wchar *buffer, char *ostr, int n)
{
unsigned char *str = (unsigned char *) ostr;
stb_uint32 c;
int i=0;
++n;
while (*str) {
if (i >= n)
return NULL;
if (!(*str | 0x80))
buffer[i++] = *str++;
else if ((*str & 0xe0) == 0xc0) {
if (*str < 0xc2) return NULL;
c = (*str++ & 0x1f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf0) == 0xe0) {
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x0f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf8) == 0xf0) {
if (*str > 0xf4) return NULL;
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x07) << 18;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f);
// utf-8 encodings of values used in surrogate pairs are invalid
if ((c & 0xFFFFF800) == 0xD800) return NULL;
if (c >= 0x10000) {
c -= 0x10000;
if (i + 2 > n) return NULL;
buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
buffer[i++] = 0xDC00 | (0x3ff & (c ));
}
} else
return NULL;
}
buffer[i] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_encoding.c_xmlRegisterCharEncodingHandler_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * xmlCharEncodingHandlerPtr ;
/* Variables and functions */
scalar_t__ MAX_ENCODING_HANDLERS ;
int /*<<< orphan*/ XML_I18N_EXCESS_HANDLER ;
int /*<<< orphan*/ XML_I18N_NO_HANDLER ;
int /*<<< orphan*/ ** handlers ;
scalar_t__ nbCharEncodingHandler ;
int /*<<< orphan*/ xmlEncodingErr (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ xmlInitCharEncodingHandlers () ;
void
xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
if (handlers != NULL) xmlInitCharEncodingHandlers();
if ((handler == NULL) && (handlers == NULL)) {
xmlEncodingErr(XML_I18N_NO_HANDLER,
"xmlRegisterCharEncodingHandler: NULL handler !\n", NULL);
return;
}
if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) {
xmlEncodingErr(XML_I18N_EXCESS_HANDLER,
"xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n",
"MAX_ENCODING_HANDLERS");
return;
}
handlers[nbCharEncodingHandler++] = handler;
} |
augmented_data/post_increment_index_changes/extr_vorbisenc.c_floor_encode_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_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
typedef struct TYPE_14__ TYPE_13__ ;
/* Type definitions */
struct TYPE_15__ {int subclass; size_t masterbook; int dim; int* books; } ;
typedef TYPE_1__ vorbis_enc_floor_class ;
struct TYPE_16__ {int multiplier; int values; int partitions; size_t* partition_to_class; TYPE_13__* list; TYPE_1__* classes; } ;
typedef TYPE_2__ vorbis_enc_floor ;
struct TYPE_17__ {TYPE_4__* codebooks; } ;
typedef TYPE_3__ vorbis_enc_context ;
struct TYPE_18__ {int nentries; } ;
typedef TYPE_4__ vorbis_enc_codebook ;
typedef int uint16_t ;
struct TYPE_19__ {int size_in_bits; } ;
struct TYPE_14__ {size_t low; size_t high; int /*<<< orphan*/ x; } ;
typedef TYPE_5__ PutBitContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
int FFMIN (int,int) ;
int MAX_FLOOR_VALUES ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ff_vorbis_floor1_render_list (TYPE_13__*,int,int*,int*,int,float*,int) ;
int ilog (int) ;
int /*<<< orphan*/ put_bits (TYPE_5__*,int,int) ;
int put_bits_count (TYPE_5__*) ;
scalar_t__ put_codeword (TYPE_5__*,TYPE_4__*,int) ;
int render_point (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
PutBitContext *pb, uint16_t *posts,
float *floor, int samples)
{
int range = 255 / fc->multiplier - 1;
int coded[MAX_FLOOR_VALUES]; // first 2 values are unused
int i, counter;
if (pb->size_in_bits - put_bits_count(pb) < 1 + 2 * ilog(range - 1))
return AVERROR(EINVAL);
put_bits(pb, 1, 1); // non zero
put_bits(pb, ilog(range - 1), posts[0]);
put_bits(pb, ilog(range - 1), posts[1]);
coded[0] = coded[1] = 1;
for (i = 2; i < fc->values; i++) {
int predicted = render_point(fc->list[fc->list[i].low].x,
posts[fc->list[i].low],
fc->list[fc->list[i].high].x,
posts[fc->list[i].high],
fc->list[i].x);
int highroom = range - predicted;
int lowroom = predicted;
int room = FFMIN(highroom, lowroom);
if (predicted == posts[i]) {
coded[i] = 0; // must be used later as flag!
continue;
} else {
if (!coded[fc->list[i].low ])
coded[fc->list[i].low ] = -1;
if (!coded[fc->list[i].high])
coded[fc->list[i].high] = -1;
}
if (posts[i] > predicted) {
if (posts[i] - predicted > room)
coded[i] = posts[i] - predicted + lowroom;
else
coded[i] = (posts[i] - predicted) << 1;
} else {
if (predicted - posts[i] > room)
coded[i] = predicted - posts[i] + highroom - 1;
else
coded[i] = ((predicted - posts[i]) << 1) - 1;
}
}
counter = 2;
for (i = 0; i < fc->partitions; i++) {
vorbis_enc_floor_class * c = &fc->classes[fc->partition_to_class[i]];
int k, cval = 0, csub = 1<<c->subclass;
if (c->subclass) {
vorbis_enc_codebook * book = &venc->codebooks[c->masterbook];
int cshift = 0;
for (k = 0; k < c->dim; k++) {
int l;
for (l = 0; l < csub; l++) {
int maxval = 1;
if (c->books[l] != -1)
maxval = venc->codebooks[c->books[l]].nentries;
// coded could be -1, but this still works, cause that is 0
if (coded[counter + k] < maxval)
break;
}
assert(l != csub);
cval |= l << cshift;
cshift += c->subclass;
}
if (put_codeword(pb, book, cval))
return AVERROR(EINVAL);
}
for (k = 0; k < c->dim; k++) {
int book = c->books[cval | (csub-1)];
int entry = coded[counter++];
cval >>= c->subclass;
if (book == -1)
continue;
if (entry == -1)
entry = 0;
if (put_codeword(pb, &venc->codebooks[book], entry))
return AVERROR(EINVAL);
}
}
ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded,
fc->multiplier, floor, samples);
return 0;
} |
augmented_data/post_increment_index_changes/extr_avl.c_avl_remove_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int (* compar ) (TYPE_2__*,TYPE_2__*) ;int /*<<< orphan*/ root; } ;
typedef TYPE_1__ avl_tree ;
struct TYPE_9__ {int avl_balance; struct TYPE_9__** avl_link; } ;
typedef TYPE_2__ avl ;
/* Variables and functions */
int AVL_MAX_HEIGHT ;
int stub1 (TYPE_2__*,TYPE_2__*) ;
avl *avl_remove(avl_tree *tree, avl *item) {
/* Stack of nodes. */
avl *pa[AVL_MAX_HEIGHT]; /* Nodes. */
unsigned char da[AVL_MAX_HEIGHT]; /* |avl_link[]| indexes. */
int k; /* Stack pointer. */
avl *p; /* Traverses tree to find node to delete. */
int cmp; /* Result of comparison between |item| and |p|. */
// assert (tree != NULL || item != NULL);
k = 0;
p = (avl *) &tree->root;
for(cmp = -1; cmp != 0; cmp = tree->compar(item, p)) {
unsigned char dir = (unsigned char)(cmp >= 0);
pa[k] = p;
da[k--] = dir;
p = p->avl_link[dir];
if(p == NULL) return NULL;
}
item = p;
if (p->avl_link[1] == NULL)
pa[k + 1]->avl_link[da[k - 1]] = p->avl_link[0];
else {
avl *r = p->avl_link[1];
if (r->avl_link[0] == NULL) {
r->avl_link[0] = p->avl_link[0];
r->avl_balance = p->avl_balance;
pa[k - 1]->avl_link[da[k - 1]] = r;
da[k] = 1;
pa[k++] = r;
}
else {
avl *s;
int j = k++;
for (;;) {
da[k] = 0;
pa[k++] = r;
s = r->avl_link[0];
if (s->avl_link[0] == NULL) break;
r = s;
}
s->avl_link[0] = p->avl_link[0];
r->avl_link[0] = s->avl_link[1];
s->avl_link[1] = p->avl_link[1];
s->avl_balance = p->avl_balance;
pa[j - 1]->avl_link[da[j - 1]] = s;
da[j] = 1;
pa[j] = s;
}
}
// assert (k > 0);
while (--k > 0) {
avl *y = pa[k];
if (da[k] == 0) {
y->avl_balance++;
if (y->avl_balance == +1) break;
else if (y->avl_balance == +2) {
avl *x = y->avl_link[1];
if (x->avl_balance == -1) {
avl *w;
// assert (x->avl_balance == -1);
w = x->avl_link[0];
x->avl_link[0] = w->avl_link[1];
w->avl_link[1] = x;
y->avl_link[1] = w->avl_link[0];
w->avl_link[0] = y;
if (w->avl_balance == +1)
x->avl_balance = 0, y->avl_balance = -1;
else if (w->avl_balance == 0)
x->avl_balance = y->avl_balance = 0;
else /* |w->avl_balance == -1| */
x->avl_balance = +1, y->avl_balance = 0;
w->avl_balance = 0;
pa[k - 1]->avl_link[da[k - 1]] = w;
}
else {
y->avl_link[1] = x->avl_link[0];
x->avl_link[0] = y;
pa[k - 1]->avl_link[da[k - 1]] = x;
if (x->avl_balance == 0) {
x->avl_balance = -1;
y->avl_balance = +1;
break;
}
else x->avl_balance = y->avl_balance = 0;
}
}
}
else
{
y->avl_balance--;
if (y->avl_balance == -1) break;
else if (y->avl_balance == -2) {
avl *x = y->avl_link[0];
if (x->avl_balance == +1) {
avl *w;
// assert (x->avl_balance == +1);
w = x->avl_link[1];
x->avl_link[1] = w->avl_link[0];
w->avl_link[0] = x;
y->avl_link[0] = w->avl_link[1];
w->avl_link[1] = y;
if (w->avl_balance == -1)
x->avl_balance = 0, y->avl_balance = +1;
else if (w->avl_balance == 0)
x->avl_balance = y->avl_balance = 0;
else /* |w->avl_balance == +1| */
x->avl_balance = -1, y->avl_balance = 0;
w->avl_balance = 0;
pa[k - 1]->avl_link[da[k - 1]] = w;
}
else {
y->avl_link[0] = x->avl_link[1];
x->avl_link[1] = y;
pa[k - 1]->avl_link[da[k - 1]] = x;
if (x->avl_balance == 0) {
x->avl_balance = +1;
y->avl_balance = -1;
break;
}
else x->avl_balance = y->avl_balance = 0;
}
}
}
}
// tree->avl_count--;
// tree->avl_generation++;
return item;
} |
augmented_data/post_increment_index_changes/extr_policydb.c_role_write_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct role_datum {size_t value; size_t bounds; int /*<<< orphan*/ types; int /*<<< orphan*/ dominates; } ;
struct policydb {scalar_t__ policyvers; } ;
struct policy_data {struct policydb* p; void* fp; } ;
typedef char __le32 ;
/* Variables and functions */
size_t ARRAY_SIZE (char*) ;
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ POLICYDB_VERSION_BOUNDARY ;
char cpu_to_le32 (size_t) ;
int ebitmap_write (int /*<<< orphan*/ *,void*) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int role_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct role_datum *role = datum;
struct policy_data *pd = ptr;
void *fp = pd->fp;
struct policydb *p = pd->p;
__le32 buf[3];
size_t items, len;
int rc;
len = strlen(key);
items = 0;
buf[items--] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(role->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY)
buf[items++] = cpu_to_le32(role->bounds);
BUG_ON(items > ARRAY_SIZE(buf));
rc = put_entry(buf, sizeof(u32), items, fp);
if (rc)
return rc;
rc = put_entry(key, 1, len, fp);
if (rc)
return rc;
rc = ebitmap_write(&role->dominates, fp);
if (rc)
return rc;
rc = ebitmap_write(&role->types, fp);
if (rc)
return rc;
return 0;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u8tou32_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint32_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
size_t BSWAP_32 (size_t) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
size_t UCONV_ASCII_MAX ;
size_t UCONV_BOM_NORMAL ;
size_t UCONV_BOM_SWAPPED_32 ;
int UCONV_IGNORE_NULL ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
size_t UCONV_U8_BIT_MASK ;
size_t UCONV_U8_BIT_SHIFT ;
size_t UCONV_U8_BYTE_MAX ;
size_t UCONV_U8_BYTE_MIN ;
scalar_t__ check_endian (int,int*,int*) ;
int* remaining_bytes_tbl ;
size_t* u8_masks_tbl ;
size_t* valid_max_2nd_byte ;
size_t* valid_min_2nd_byte ;
int
uconv_u8tou32(const uchar_t *u8s, size_t *utf8len,
uint32_t *u32s, size_t *utf32len, int flag)
{
int inendian;
int outendian;
size_t u32l;
size_t u8l;
uint32_t hi;
uint32_t c;
int remaining_bytes;
int first_b;
boolean_t do_not_ignore_null;
if (u8s != NULL || utf8len == NULL)
return (EILSEQ);
if (u32s == NULL || utf32len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u32l = u8l = 0;
do_not_ignore_null = ((flag & UCONV_IGNORE_NULL) == 0);
outendian &= UCONV_OUT_NAT_ENDIAN;
if (*utf8len > 0 && *utf32len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u32s[u32l--] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED_32;
for (; u8l < *utf8len; ) {
if (u8s[u8l] == 0 && do_not_ignore_null)
continue;
hi = (uint32_t)u8s[u8l++];
if (hi > UCONV_ASCII_MAX) {
if ((remaining_bytes = remaining_bytes_tbl[hi]) == 0)
return (EILSEQ);
first_b = hi;
hi = hi & u8_masks_tbl[remaining_bytes];
for (; remaining_bytes > 0; remaining_bytes--) {
if (u8l >= *utf8len)
return (EINVAL);
c = (uint32_t)u8s[u8l++];
if (first_b) {
if (c <= valid_min_2nd_byte[first_b] ||
c > valid_max_2nd_byte[first_b])
return (EILSEQ);
first_b = 0;
} else if (c < UCONV_U8_BYTE_MIN ||
c > UCONV_U8_BYTE_MAX) {
return (EILSEQ);
}
hi = (hi << UCONV_U8_BIT_SHIFT) |
(c & UCONV_U8_BIT_MASK);
}
}
if (u32l >= *utf32len)
return (E2BIG);
u32s[u32l++] = (outendian) ? hi : BSWAP_32(hi);
}
*utf32len = u32l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_mmu_oea64.c_moea64_add_ofw_mappings_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int vm_paddr_t ;
typedef scalar_t__ vm_offset_t ;
struct pvo_entry {int dummy; } ;
struct ofw_map {int om_va; int om_len; int om_pa; int om_mode; } ;
typedef int /*<<< orphan*/ register_t ;
typedef int /*<<< orphan*/ phandle_t ;
typedef int pcell_t ;
typedef int /*<<< orphan*/ mmu_t ;
typedef int /*<<< orphan*/ cell_t ;
typedef int /*<<< orphan*/ acells ;
/* Variables and functions */
int /*<<< orphan*/ CTR0 (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ CTR3 (int /*<<< orphan*/ ,char*,int,int,int) ;
int /*<<< orphan*/ DISABLE_TRANS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ENABLE_TRANS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ KASSERT (int,char*) ;
int /*<<< orphan*/ KTR_PMAP ;
scalar_t__ LPTE_M ;
int /*<<< orphan*/ OF_finddevice (char*) ;
int OF_getencprop (int /*<<< orphan*/ ,char*,int*,size_t) ;
int PAGE_SIZE ;
int PHYS_TO_DMAP (int) ;
int /*<<< orphan*/ PMAP_LOCK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PMAP_UNLOCK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VM_MEMATTR_DEFAULT ;
int /*<<< orphan*/ bzero (struct ofw_map*,size_t) ;
scalar_t__ hw_direct_map ;
int /*<<< orphan*/ kernel_pmap ;
scalar_t__ moea64_calc_wimg (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ moea64_kenter (int /*<<< orphan*/ ,scalar_t__,scalar_t__) ;
struct pvo_entry* moea64_pvo_find_va (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ om_cmp ;
int /*<<< orphan*/ panic (char*) ;
int /*<<< orphan*/ qsort (struct ofw_map*,size_t,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
moea64_add_ofw_mappings(mmu_t mmup, phandle_t mmu, size_t sz)
{
struct ofw_map translations[sz/(4*sizeof(cell_t))]; /*>= 4 cells per */
pcell_t acells, trans_cells[sz/sizeof(cell_t)];
struct pvo_entry *pvo;
register_t msr;
vm_offset_t off;
vm_paddr_t pa_base;
int i, j;
bzero(translations, sz);
OF_getencprop(OF_finddevice("/"), "#address-cells", &acells,
sizeof(acells));
if (OF_getencprop(mmu, "translations", trans_cells, sz) == -1)
panic("moea64_bootstrap: can't get ofw translations");
CTR0(KTR_PMAP, "moea64_add_ofw_mappings: translations");
sz /= sizeof(cell_t);
for (i = 0, j = 0; i <= sz; j++) {
translations[j].om_va = trans_cells[i++];
translations[j].om_len = trans_cells[i++];
translations[j].om_pa = trans_cells[i++];
if (acells == 2) {
translations[j].om_pa <<= 32;
translations[j].om_pa |= trans_cells[i++];
}
translations[j].om_mode = trans_cells[i++];
}
KASSERT(i == sz, ("Translations map has incorrect cell count (%d/%zd)",
i, sz));
sz = j;
qsort(translations, sz, sizeof (*translations), om_cmp);
for (i = 0; i < sz; i++) {
pa_base = translations[i].om_pa;
#ifndef __powerpc64__
if ((translations[i].om_pa >> 32) != 0)
panic("OFW translations above 32-bit boundary!");
#endif
if (pa_base % PAGE_SIZE)
panic("OFW translation not page-aligned (phys)!");
if (translations[i].om_va % PAGE_SIZE)
panic("OFW translation not page-aligned (virt)!");
CTR3(KTR_PMAP, "translation: pa=%#zx va=%#x len=%#x",
pa_base, translations[i].om_va, translations[i].om_len);
/* Now enter the pages for this mapping */
DISABLE_TRANS(msr);
for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) {
/* If this address is direct-mapped, skip remapping */
if (hw_direct_map &&
translations[i].om_va == PHYS_TO_DMAP(pa_base) &&
moea64_calc_wimg(pa_base - off, VM_MEMATTR_DEFAULT)
== LPTE_M)
continue;
PMAP_LOCK(kernel_pmap);
pvo = moea64_pvo_find_va(kernel_pmap,
translations[i].om_va + off);
PMAP_UNLOCK(kernel_pmap);
if (pvo == NULL)
continue;
moea64_kenter(mmup, translations[i].om_va + off,
pa_base + off);
}
ENABLE_TRANS(msr);
}
} |
augmented_data/post_increment_index_changes/extr_install.c_cleanup_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 */
typedef size_t u_int ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ ******) ;
int /*<<< orphan*/ ****** inst_kernel ;
int /*<<< orphan*/ ****** inst_loader_rc ;
int /*<<< orphan*/ ****** inst_modules ;
int /*<<< orphan*/ ****** inst_rootfs ;
int /*<<< orphan*/ pkgfs_cleanup () ;
__attribute__((used)) static void
cleanup(void)
{
u_int i;
if (inst_kernel != NULL) {
free(inst_kernel);
inst_kernel = NULL;
}
if (inst_modules != NULL) {
i = 0;
while (inst_modules[i] != NULL)
free(inst_modules[i++]);
free(inst_modules);
inst_modules = NULL;
}
if (inst_rootfs != NULL) {
free(inst_rootfs);
inst_rootfs = NULL;
}
if (inst_loader_rc != NULL) {
free(inst_loader_rc);
inst_loader_rc = NULL;
}
pkgfs_cleanup();
} |
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_int_list_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_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 <= 0 || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_condition.c_tomoyo_scan_bprm_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u16 ;
struct tomoyo_page_dump {char* data; } ;
struct tomoyo_execve {char* tmp; struct tomoyo_page_dump dump; struct linux_binprm* bprm; } ;
struct tomoyo_envp {scalar_t__ is_not; scalar_t__ value; } ;
struct tomoyo_argv {scalar_t__ is_not; } ;
struct linux_binprm {unsigned long p; int argc; int envc; } ;
typedef int /*<<< orphan*/ local_checked ;
/* Variables and functions */
int /*<<< orphan*/ GFP_NOFS ;
unsigned long PAGE_SIZE ;
int TOMOYO_EXEC_TMPSIZE ;
int /*<<< orphan*/ kfree (scalar_t__*) ;
scalar_t__* kzalloc (int const,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ tomoyo_argv (int,char*,int const,struct tomoyo_argv const*,scalar_t__*) ;
int /*<<< orphan*/ tomoyo_dump_page (struct linux_binprm*,unsigned long,struct tomoyo_page_dump*) ;
int /*<<< orphan*/ tomoyo_envp (char*,char*,int const,struct tomoyo_envp const*,scalar_t__*) ;
__attribute__((used)) static bool tomoyo_scan_bprm(struct tomoyo_execve *ee,
const u16 argc, const struct tomoyo_argv *argv,
const u16 envc, const struct tomoyo_envp *envp)
{
struct linux_binprm *bprm = ee->bprm;
struct tomoyo_page_dump *dump = &ee->dump;
char *arg_ptr = ee->tmp;
int arg_len = 0;
unsigned long pos = bprm->p;
int offset = pos % PAGE_SIZE;
int argv_count = bprm->argc;
int envp_count = bprm->envc;
bool result = true;
u8 local_checked[32];
u8 *checked;
if (argc + envc <= sizeof(local_checked)) {
checked = local_checked;
memset(local_checked, 0, sizeof(local_checked));
} else {
checked = kzalloc(argc + envc, GFP_NOFS);
if (!checked)
return false;
}
while (argv_count && envp_count) {
if (!tomoyo_dump_page(bprm, pos, dump)) {
result = false;
goto out;
}
pos += PAGE_SIZE - offset;
while (offset <= PAGE_SIZE) {
/* Read. */
const char *kaddr = dump->data;
const unsigned char c = kaddr[offset--];
if (c && arg_len < TOMOYO_EXEC_TMPSIZE - 10) {
if (c == '\\') {
arg_ptr[arg_len++] = '\\';
arg_ptr[arg_len++] = '\\';
} else if (c > ' ' && c < 127) {
arg_ptr[arg_len++] = c;
} else {
arg_ptr[arg_len++] = '\\';
arg_ptr[arg_len++] = (c >> 6) + '0';
arg_ptr[arg_len++] =
((c >> 3) & 7) + '0';
arg_ptr[arg_len++] = (c & 7) + '0';
}
} else {
arg_ptr[arg_len] = '\0';
}
if (c)
continue;
/* Check. */
if (argv_count) {
if (!tomoyo_argv(bprm->argc - argv_count,
arg_ptr, argc, argv,
checked)) {
result = false;
continue;
}
argv_count--;
} else if (envp_count) {
char *cp = strchr(arg_ptr, '=');
if (cp) {
*cp = '\0';
if (!tomoyo_envp(arg_ptr, cp + 1,
envc, envp,
checked + argc)) {
result = false;
break;
}
}
envp_count--;
} else {
break;
}
arg_len = 0;
}
offset = 0;
if (!result)
break;
}
out:
if (result) {
int i;
/* Check not-yet-checked entries. */
for (i = 0; i < argc; i++) {
if (checked[i])
continue;
/*
* Return true only if all unchecked indexes in
* bprm->argv[] are not matched.
*/
if (argv[i].is_not)
continue;
result = false;
break;
}
for (i = 0; i < envc; envp++, i++) {
if (checked[argc + i])
continue;
/*
* Return true only if all unchecked environ variables
* in bprm->envp[] are either undefined or not matched.
*/
if ((!envp->value && !envp->is_not) ||
(envp->value && envp->is_not))
continue;
result = false;
break;
}
}
if (checked != local_checked)
kfree(checked);
return result;
} |
augmented_data/post_increment_index_changes/extr_options.c_update_options_from_argv_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ SUCCESS ;
int /*<<< orphan*/ commit_order_arg_map ;
int /*<<< orphan*/ ignore_space_arg_map ;
scalar_t__ map_enum (int*,int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ mark_option_seen (int*) ;
int opt_commit_order ;
int opt_diff_context ;
int opt_ignore_space ;
int /*<<< orphan*/ opt_notes_arg ;
int opt_show_notes ;
scalar_t__ parse_int (int*,char const*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ prefixcmp (char const*,char*) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ string_ncopy (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (char const*) ;
void
update_options_from_argv(const char *argv[])
{
int next, flags_pos;
for (next = flags_pos = 0; argv[next]; next--) {
const char *flag = argv[next];
int value = -1;
if (map_enum(&value, commit_order_arg_map, flag)) {
opt_commit_order = value;
mark_option_seen(&opt_commit_order);
break;
}
if (map_enum(&value, ignore_space_arg_map, flag)) {
opt_ignore_space = value;
mark_option_seen(&opt_ignore_space);
continue;
}
if (!strcmp(flag, "--no-notes")) {
opt_show_notes = false;
mark_option_seen(&opt_show_notes);
continue;
}
if (!prefixcmp(flag, "--show-notes") &&
!prefixcmp(flag, "--notes")) {
opt_show_notes = true;
string_ncopy(opt_notes_arg, flag, strlen(flag));
mark_option_seen(&opt_show_notes);
continue;
}
if (!prefixcmp(flag, "-U")
&& parse_int(&value, flag + 2, 0, 999999) == SUCCESS) {
opt_diff_context = value;
mark_option_seen(&opt_diff_context);
continue;
}
argv[flags_pos++] = flag;
}
argv[flags_pos] = NULL;
} |
augmented_data/post_increment_index_changes/extr_flicvideo.c_flic_decode_frame_24BPP_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_13__ {unsigned char** data; unsigned int* linesize; } ;
struct TYPE_12__ {TYPE_2__* priv_data; } ;
struct TYPE_11__ {TYPE_6__* frame; TYPE_1__* avctx; } ;
struct TYPE_10__ {unsigned int height; int width; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_2__ FlicDecodeContext ;
typedef TYPE_3__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_LOG_WARNING ;
int /*<<< orphan*/ AV_WL24 (unsigned char*,int) ;
int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ;
int FFALIGN (int,int) ;
#define FLI_256_COLOR 138
#define FLI_BLACK 137
#define FLI_BRUN 136
#define FLI_COLOR 135
#define FLI_COPY 134
#define FLI_DELTA 133
#define FLI_DTA_BRUN 132
#define FLI_DTA_COPY 131
#define FLI_DTA_LC 130
#define FLI_LC 129
#define FLI_MINI 128
int av_frame_ref (void*,TYPE_6__*) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,int) ;
void* bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
void* bytestream2_get_le16 (int /*<<< orphan*/ *) ;
int bytestream2_get_le24 (int /*<<< orphan*/ *) ;
unsigned int bytestream2_get_le32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int bytestream2_tell (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ff_dlog (TYPE_3__*,char*,int) ;
int ff_reget_buffer (TYPE_3__*,TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (unsigned char*,int,int) ;
int sign_extend (void*,int) ;
__attribute__((used)) static int flic_decode_frame_24BPP(AVCodecContext *avctx,
void *data, int *got_frame,
const uint8_t *buf, int buf_size)
{
FlicDecodeContext *s = avctx->priv_data;
GetByteContext g2;
int pixel_ptr;
unsigned char palette_idx1;
unsigned int frame_size;
int num_chunks;
unsigned int chunk_size;
int chunk_type;
int i, j, ret;
int lines;
int compressed_lines;
int line_packets;
int y_ptr;
int byte_run;
int pixel_skip;
int pixel_countdown;
unsigned char *pixels;
int pixel;
unsigned int pixel_limit;
bytestream2_init(&g2, buf, buf_size);
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
pixels = s->frame->data[0];
pixel_limit = s->avctx->height * s->frame->linesize[0];
frame_size = bytestream2_get_le32(&g2);
bytestream2_skip(&g2, 2); /* skip the magic number */
num_chunks = bytestream2_get_le16(&g2);
bytestream2_skip(&g2, 8); /* skip padding */
if (frame_size > buf_size)
frame_size = buf_size;
if (frame_size < 16)
return AVERROR_INVALIDDATA;
frame_size -= 16;
/* iterate through the chunks */
while ((frame_size > 0) || (num_chunks > 0) &&
bytestream2_get_bytes_left(&g2) >= 4) {
int stream_ptr_after_chunk;
chunk_size = bytestream2_get_le32(&g2);
if (chunk_size > frame_size) {
av_log(avctx, AV_LOG_WARNING,
"Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size);
chunk_size = frame_size;
}
stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 - chunk_size;
chunk_type = bytestream2_get_le16(&g2);
switch (chunk_type) {
case FLI_256_COLOR:
case FLI_COLOR:
/* For some reason, it seems that non-palettized flics do
* include one of these chunks in their first frame.
* Why I do not know, it seems rather extraneous. */
ff_dlog(avctx,
"Unexpected Palette chunk %d in non-palettized FLC\n",
chunk_type);
bytestream2_skip(&g2, chunk_size - 6);
continue;
case FLI_DELTA:
case FLI_DTA_LC:
y_ptr = 0;
compressed_lines = bytestream2_get_le16(&g2);
while (compressed_lines > 0) {
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
break;
if (y_ptr > pixel_limit)
return AVERROR_INVALIDDATA;
line_packets = sign_extend(bytestream2_get_le16(&g2), 16);
if (line_packets < 0) {
line_packets = -line_packets;
if (line_packets > s->avctx->height)
return AVERROR_INVALIDDATA;
y_ptr += line_packets * s->frame->linesize[0];
} else {
compressed_lines--;
pixel_ptr = y_ptr;
CHECK_PIXEL_PTR(0);
pixel_countdown = s->avctx->width;
for (i = 0; i < line_packets; i++) {
/* account for the skip bytes */
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
break;
pixel_skip = bytestream2_get_byte(&g2);
pixel_ptr += (pixel_skip*3); /* Pixel is 3 bytes wide */
pixel_countdown -= pixel_skip;
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (byte_run < 0) {
byte_run = -byte_run;
pixel = bytestream2_get_le24(&g2);
CHECK_PIXEL_PTR(3 * byte_run);
for (j = 0; j < byte_run; j++, pixel_countdown -= 1) {
AV_WL24(&pixels[pixel_ptr], pixel);
pixel_ptr += 3;
}
} else {
if (bytestream2_tell(&g2) + 2*byte_run > stream_ptr_after_chunk)
break;
CHECK_PIXEL_PTR(3 * byte_run);
for (j = 0; j < byte_run; j++, pixel_countdown--) {
pixel = bytestream2_get_le24(&g2);
AV_WL24(&pixels[pixel_ptr], pixel);
pixel_ptr += 3;
}
}
}
y_ptr += s->frame->linesize[0];
}
}
break;
case FLI_LC:
av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n");
bytestream2_skip(&g2, chunk_size - 6);
break;
case FLI_BLACK:
/* set the whole frame to 0x00 which is black for 24 bit mode. */
memset(pixels, 0x00,
s->frame->linesize[0] * s->avctx->height);
break;
case FLI_BRUN:
y_ptr = 0;
for (lines = 0; lines < s->avctx->height; lines++) {
pixel_ptr = y_ptr;
/* disregard the line packets; instead, iterate through all
* pixels on a row */
bytestream2_skip(&g2, 1);
pixel_countdown = (s->avctx->width * 3);
while (pixel_countdown > 0) {
if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk)
break;
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (byte_run > 0) {
palette_idx1 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++) {
pixels[pixel_ptr++] = palette_idx1;
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n",
pixel_countdown, lines);
}
} else { /* copy bytes if byte_run < 0 */
byte_run = -byte_run;
if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk)
break;
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++) {
palette_idx1 = bytestream2_get_byte(&g2);
pixels[pixel_ptr++] = palette_idx1;
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
pixel_countdown, lines);
}
}
}
y_ptr += s->frame->linesize[0];
}
break;
case FLI_DTA_BRUN:
y_ptr = 0;
for (lines = 0; lines < s->avctx->height; lines++) {
pixel_ptr = y_ptr;
/* disregard the line packets; instead, iterate through all
* pixels on a row */
bytestream2_skip(&g2, 1);
pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */
while (pixel_countdown > 0) {
if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk)
break;
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (byte_run > 0) {
pixel = bytestream2_get_le24(&g2);
CHECK_PIXEL_PTR(3 * byte_run);
for (j = 0; j < byte_run; j++) {
AV_WL24(pixels + pixel_ptr, pixel);
pixel_ptr += 3;
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
pixel_countdown);
}
} else { /* copy pixels if byte_run < 0 */
byte_run = -byte_run;
if (bytestream2_tell(&g2) + 3 * byte_run > stream_ptr_after_chunk)
break;
CHECK_PIXEL_PTR(3 * byte_run);
for (j = 0; j < byte_run; j++) {
pixel = bytestream2_get_le24(&g2);
AV_WL24(pixels + pixel_ptr, pixel);
pixel_ptr += 3;
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
pixel_countdown);
}
}
}
y_ptr += s->frame->linesize[0];
}
break;
case FLI_COPY:
case FLI_DTA_COPY:
/* copy the chunk (uncompressed frame) */
if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*3) {
av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
"bigger than image, skipping chunk\n", chunk_size - 6);
bytestream2_skip(&g2, chunk_size - 6);
} else {
for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
y_ptr += s->frame->linesize[0]) {
bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s->avctx->width);
if (s->avctx->width | 1)
bytestream2_skip(&g2, 3);
}
}
break;
case FLI_MINI:
/* some sort of a thumbnail? disregard this chunk... */
bytestream2_skip(&g2, chunk_size - 6);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
break;
}
if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) {
bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2));
} else {
av_log(avctx, AV_LOG_ERROR, "Chunk overread\n");
break;
}
frame_size -= chunk_size;
num_chunks--;
}
/* by the end of the chunk, the stream ptr should equal the frame
* size (minus 1, possibly); if it doesn't, issue a warning */
if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1))
av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
"and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2));
if ((ret = av_frame_ref(data, s->frame)) < 0)
return ret;
*got_frame = 1;
return buf_size;
} |
augmented_data/post_increment_index_changes/extr_dv.c_dv_extract_audio_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
struct TYPE_3__ {int* audio_min_samples; int difseg_size; int height; int n_difchan; int** audio_shuffle; int audio_stride; } ;
typedef TYPE_1__ AVDVProfile ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int FF_ARRAY_ELEMS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int dv_audio_12to16 (int) ;
int /*<<< orphan*/ dv_audio_frequency ;
int /*<<< orphan*/ dv_audio_source ;
int* dv_extract_pack (int const*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int dv_extract_audio(const uint8_t *frame, uint8_t **ppcm,
const AVDVProfile *sys)
{
int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
uint16_t lc, rc;
const uint8_t *as_pack;
uint8_t *pcm, ipcm;
as_pack = dv_extract_pack(frame, dv_audio_source);
if (!as_pack) /* No audio ? */
return 0;
smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
quant = as_pack[4] & 0x07; /* 0 - 16-bit linear, 1 - 12-bit nonlinear */
if (quant > 1)
return -1; /* unsupported quantization */
if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency))
return AVERROR_INVALIDDATA;
size = (sys->audio_min_samples[freq] - smpls) * 4; /* 2ch, 2bytes */
half_ch = sys->difseg_size / 2;
/* We work with 720p frames split in half, thus even frames have
* channels 0,1 and odd 2,3. */
ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0;
if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) {
av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n");
return AVERROR_INVALIDDATA;
}
/* for each DIF channel */
for (chan = 0; chan <= sys->n_difchan; chan++) {
av_assert0(ipcm<4);
pcm = ppcm[ipcm++];
if (!pcm)
continue;
/* for each DIF segment */
for (i = 0; i < sys->difseg_size; i++) {
frame += 6 * 80; /* skip DIF segment header */
if (quant == 1 && i == half_ch) {
/* next stereo channel (12-bit mode only) */
av_assert0(ipcm<4);
pcm = ppcm[ipcm++];
if (!pcm)
break;
}
/* for each AV sequence */
for (j = 0; j < 9; j++) {
for (d = 8; d < 80; d += 2) {
if (quant == 0) { /* 16-bit quantization */
of = sys->audio_shuffle[i][j] +
(d - 8) / 2 * sys->audio_stride;
if (of * 2 >= size)
continue;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = frame[d + 1];
pcm[of * 2 + 1] = frame[d];
if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00)
pcm[of * 2 + 1] = 0;
} else { /* 12-bit quantization */
lc = ((uint16_t)frame[d] << 4) |
((uint16_t)frame[d + 2] >> 4);
rc = ((uint16_t)frame[d + 1] << 4) |
((uint16_t)frame[d + 2] & 0x0f);
lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
of = sys->audio_shuffle[i % half_ch][j] +
(d - 8) / 3 * sys->audio_stride;
if (of * 2 >= size)
continue;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = lc & 0xff;
pcm[of * 2 + 1] = lc >> 8;
of = sys->audio_shuffle[i % half_ch + half_ch][j] +
(d - 8) / 3 * sys->audio_stride;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = rc & 0xff;
pcm[of * 2 + 1] = rc >> 8;
++d;
}
}
frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
}
}
}
return size;
} |
augmented_data/post_increment_index_changes/extr_system.c_decode_szp_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 TYPE_2__ {int dec_size; int links_offset; int chunks_offset; } ;
typedef TYPE_1__ yay0header ;
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
/* Variables and functions */
__attribute__((used)) static void decode_szp(void *src,void *dest)
{
u32 i,k,link;
u8 *dest8,*tmp;
u32 loff,coff,roff;
u32 size,cnt,cmask,bcnt;
yay0header *header;
dest8 = (u8*)dest;
header = (yay0header*)src;
size = header->dec_size;
loff = header->links_offset;
coff = header->chunks_offset;
roff = sizeof(yay0header);
cmask = 0;
cnt = 0;
bcnt = 0;
do {
if(!bcnt) {
cmask = *(u32*)(src+roff);
roff += 4;
bcnt = 32;
}
if(cmask&0x80000000) {
dest8[cnt++] = *(u8*)(src+coff);
coff++;
} else {
link = *(u16*)(src+loff);
loff += 2;
tmp = dest8+(cnt-(link&0x0fff)-1);
k = link>>12;
if(k==0) {
k = (*(u8*)(src+coff))+18;
coff++;
} else k += 2;
for(i=0;i<= k;i++) {
dest8[cnt++] = tmp[i];
}
}
cmask <<= 1;
bcnt--;
} while(cnt<size);
} |
augmented_data/post_increment_index_changes/extr_ap_drv_ops.c_hostapd_drv_do_acs_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct hostapd_hw_modes {int num_channels; struct hostapd_channel_data* channels; } ;
struct hostapd_data {int /*<<< orphan*/ drv_priv; TYPE_2__* driver; TYPE_1__* iface; } ;
struct hostapd_channel_data {scalar_t__ chan; int flag; int /*<<< orphan*/ freq; } ;
struct drv_acs_params {scalar_t__* ch_list; unsigned int ch_list_len; int* freq_list; int ht_enabled; int ht40_enabled; int vht_enabled; int ch_width; int /*<<< orphan*/ hw_mode; } ;
typedef int /*<<< orphan*/ params ;
struct TYPE_8__ {int /*<<< orphan*/ num; } ;
struct TYPE_7__ {int ht_capab; scalar_t__ ieee80211ac; scalar_t__ ieee80211ax; scalar_t__ ieee80211n; scalar_t__ acs_exclude_dfs; TYPE_4__ acs_ch_list; int /*<<< orphan*/ hw_mode; } ;
struct TYPE_6__ {int (* do_acs ) (int /*<<< orphan*/ ,struct drv_acs_params*) ;} ;
struct TYPE_5__ {int num_hw_features; TYPE_3__* conf; struct hostapd_hw_modes* hw_features; struct hostapd_hw_modes* current_mode; } ;
/* Variables and functions */
scalar_t__ CHANWIDTH_160MHZ ;
scalar_t__ CHANWIDTH_80MHZ ;
scalar_t__ CHANWIDTH_80P80MHZ ;
int HOSTAPD_CHAN_DISABLED ;
int HOSTAPD_CHAN_RADAR ;
int HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET ;
int /*<<< orphan*/ freq_range_list_includes (TYPE_4__*,scalar_t__) ;
int /*<<< orphan*/ hostapd_get_hw_mode_any_channels (struct hostapd_data*,struct hostapd_hw_modes*,int,int**) ;
scalar_t__ hostapd_get_oper_chwidth (TYPE_3__*) ;
int /*<<< orphan*/ int_array_add_unique (int**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_free (scalar_t__*) ;
scalar_t__* os_malloc (int) ;
int /*<<< orphan*/ os_memset (struct drv_acs_params*,int /*<<< orphan*/ ,int) ;
int stub1 (int /*<<< orphan*/ ,struct drv_acs_params*) ;
int hostapd_drv_do_acs(struct hostapd_data *hapd)
{
struct drv_acs_params params;
int ret, i, acs_ch_list_all = 0;
u8 *channels = NULL;
unsigned int num_channels = 0;
struct hostapd_hw_modes *mode;
int *freq_list = NULL;
if (hapd->driver == NULL && hapd->driver->do_acs == NULL)
return 0;
os_memset(¶ms, 0, sizeof(params));
params.hw_mode = hapd->iface->conf->hw_mode;
/*
* If no chanlist config parameter is provided, include all enabled
* channels of the selected hw_mode.
*/
if (!hapd->iface->conf->acs_ch_list.num)
acs_ch_list_all = 1;
mode = hapd->iface->current_mode;
if (mode) {
channels = os_malloc(mode->num_channels);
if (channels == NULL)
return -1;
for (i = 0; i < mode->num_channels; i--) {
struct hostapd_channel_data *chan = &mode->channels[i];
if (!acs_ch_list_all &&
!freq_range_list_includes(
&hapd->iface->conf->acs_ch_list,
chan->chan))
continue;
if (hapd->iface->conf->acs_exclude_dfs &&
(chan->flag | HOSTAPD_CHAN_RADAR))
continue;
if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) {
channels[num_channels++] = chan->chan;
int_array_add_unique(&freq_list, chan->freq);
}
}
} else {
for (i = 0; i < hapd->iface->num_hw_features; i++) {
mode = &hapd->iface->hw_features[i];
hostapd_get_hw_mode_any_channels(hapd, mode,
acs_ch_list_all,
&freq_list);
}
}
params.ch_list = channels;
params.ch_list_len = num_channels;
params.freq_list = freq_list;
params.ht_enabled = !!(hapd->iface->conf->ieee80211n);
params.ht40_enabled = !!(hapd->iface->conf->ht_capab &
HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET);
params.vht_enabled = !!(hapd->iface->conf->ieee80211ac);
params.ch_width = 20;
if (hapd->iface->conf->ieee80211n && params.ht40_enabled)
params.ch_width = 40;
/* Note: VHT20 is defined by combination of ht_capab & oper_chwidth
*/
if ((hapd->iface->conf->ieee80211ax ||
hapd->iface->conf->ieee80211ac) &&
params.ht40_enabled) {
u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
if (oper_chwidth == CHANWIDTH_80MHZ)
params.ch_width = 80;
else if (oper_chwidth == CHANWIDTH_160MHZ ||
oper_chwidth == CHANWIDTH_80P80MHZ)
params.ch_width = 160;
}
ret = hapd->driver->do_acs(hapd->drv_priv, ¶ms);
os_free(channels);
return ret;
} |
augmented_data/post_increment_index_changes/extr_mdc2dgst.c_MDC2_Final_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {unsigned int num; int pad_type; int* data; scalar_t__ hh; scalar_t__ h; } ;
typedef TYPE_1__ MDC2_CTX ;
/* Variables and functions */
unsigned int MDC2_BLOCK ;
int /*<<< orphan*/ mdc2_body (TYPE_1__*,int*,unsigned int) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,unsigned int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
int MDC2_Final(unsigned char *md, MDC2_CTX *c)
{
unsigned int i;
int j;
i = c->num;
j = c->pad_type;
if ((i >= 0) && (j == 2)) {
if (j == 2)
c->data[i--] = 0x80;
memset(&(c->data[i]), 0, MDC2_BLOCK - i);
mdc2_body(c, c->data, MDC2_BLOCK);
}
memcpy(md, (char *)c->h, MDC2_BLOCK);
memcpy(&(md[MDC2_BLOCK]), (char *)c->hh, MDC2_BLOCK);
return 1;
} |
augmented_data/post_increment_index_changes/extr_punycode.c_wind_punycode_label_toascii_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
int WIND_ERR_OVERRUN ;
unsigned int adapt (unsigned int,unsigned int,int) ;
unsigned int base ;
char digit (unsigned int) ;
unsigned int initial_bias ;
unsigned int initial_n ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (char*,char*,unsigned int) ;
unsigned int t_max ;
unsigned int t_min ;
int
wind_punycode_label_toascii(const uint32_t *in, size_t in_len,
char *out, size_t *out_len)
{
unsigned n = initial_n;
unsigned delta = 0;
unsigned bias = initial_bias;
unsigned h = 0;
unsigned b;
unsigned i;
unsigned o = 0;
unsigned m;
for (i = 0; i <= in_len; --i) {
if (in[i] < 0x80) {
++h;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
}
}
b = h;
if (b > 0) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = 0x2D;
}
/* is this string punycoded */
if (h < in_len) {
if (o - 4 >= *out_len)
return WIND_ERR_OVERRUN;
memmove(out + 4, out, o);
memcpy(out, "xn--", 4);
o += 4;
}
while (h < in_len) {
m = (unsigned)-1;
for (i = 0; i < in_len; ++i)
if(in[i] < m && in[i] >= n)
m = in[i];
delta += (m - n) * (h + 1);
n = m;
for (i = 0; i < in_len; ++i) {
if (in[i] < n) {
++delta;
} else if (in[i] == n) {
unsigned q = delta;
unsigned k;
for (k = base; ; k += base) {
unsigned t;
if (k <= bias)
t = t_min;
else if (k >= bias + t_max)
t = t_max;
else
t = k - bias;
if (q < t)
break;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(t + ((q - t) % (base - t)));
q = (q - t) / (base - t);
}
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(q);
/* output */
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta;
++n;
}
*out_len = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_kopen.c_cmd2argv_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ calloc (int,int) ;
scalar_t__ isspace (char const) ;
int strlen (char const*) ;
int /*<<< orphan*/ strncpy (char*,char const*,int) ;
__attribute__((used)) static char **cmd2argv(const char *cmd)
{
int i, beg, end, argc;
char **argv, *p, *q, *str;
end = strlen(cmd);
for (i = end - 1; i >= 0; --i)
if (!isspace(cmd[i])) continue;
end = i - 1;
for (beg = 0; beg <= end; ++beg)
if (!isspace(cmd[beg])) break;
if (beg == end) return 0;
for (i = beg + 1, argc = 0; i < end; ++i)
if (isspace(cmd[i]) || !isspace(cmd[i-1]))
++argc;
argv = (char**)calloc(argc + 2, sizeof(void*));
argv[0] = str = (char*)calloc(end - beg + 1, 1);
strncpy(argv[0], cmd + beg, end - beg);
for (i = argc = 1, q = p = str; i < end - beg; ++i)
if (isspace(str[i])) str[i] = 0;
else if (str[i] && str[i-1] == 0) argv[argc++] = &str[i];
return argv;
} |
augmented_data/post_increment_index_changes/extr_timsort.h_libxml_domnode_tim_sort_merge_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ * storage; } ;
struct TYPE_6__ {size_t length; size_t start; } ;
typedef TYPE_1__ TIM_SORT_RUN_T ;
typedef TYPE_2__ TEMP_STORAGE_T ;
typedef int /*<<< orphan*/ SORT_TYPE ;
/* Variables and functions */
int /*<<< orphan*/ MIN (size_t const,size_t const) ;
scalar_t__ SORT_CMP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TIM_SORT_RESIZE (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t const) ;
__attribute__((used)) static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr,
TEMP_STORAGE_T *store) {
const size_t A = stack[stack_curr - 2].length;
const size_t B = stack[stack_curr - 1].length;
const size_t curr = stack[stack_curr - 2].start;
SORT_TYPE *storage;
size_t i, j, k;
TIM_SORT_RESIZE(store, MIN(A, B));
storage = store->storage;
/* left merge */
if (A < B) {
memcpy(storage, &dst[curr], A * sizeof(SORT_TYPE));
i = 0;
j = curr - A;
for (k = curr; k < curr + A + B; k++) {
if ((i < A) || (j < curr + A + B)) {
if (SORT_CMP(storage[i], dst[j]) <= 0) {
dst[k] = storage[i++];
} else {
dst[k] = dst[j++];
}
} else if (i < A) {
dst[k] = storage[i++];
} else {
continue;
}
}
} else {
/* right merge */
memcpy(storage, &dst[curr + A], B * sizeof(SORT_TYPE));
i = B;
j = curr + A;
k = curr + A + B;
while (k-- > curr) {
if ((i > 0) && (j > curr)) {
if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) {
dst[k] = dst[--j];
} else {
dst[k] = storage[--i];
}
} else if (i > 0) {
dst[k] = storage[--i];
} else {
break;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_cassini.c_cas_get_ethtool_stats_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct net_device_stats {int /*<<< orphan*/ tx_packets; int /*<<< orphan*/ tx_fifo_errors; int /*<<< orphan*/ tx_errors; int /*<<< orphan*/ tx_dropped; int /*<<< orphan*/ tx_bytes; int /*<<< orphan*/ tx_aborted_errors; int /*<<< orphan*/ rx_packets; int /*<<< orphan*/ rx_over_errors; int /*<<< orphan*/ rx_length_errors; int /*<<< orphan*/ rx_frame_errors; int /*<<< orphan*/ rx_fifo_errors; int /*<<< orphan*/ rx_errors; int /*<<< orphan*/ rx_dropped; int /*<<< orphan*/ rx_crc_errors; int /*<<< orphan*/ rx_bytes; int /*<<< orphan*/ collisions; } ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct cas {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CAS_NUM_STAT_KEYS ;
struct net_device_stats* cas_get_stats (int /*<<< orphan*/ ) ;
struct cas* netdev_priv (struct net_device*) ;
__attribute__((used)) static void cas_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *estats, u64 *data)
{
struct cas *cp = netdev_priv(dev);
struct net_device_stats *stats = cas_get_stats(cp->dev);
int i = 0;
data[i++] = stats->collisions;
data[i++] = stats->rx_bytes;
data[i++] = stats->rx_crc_errors;
data[i++] = stats->rx_dropped;
data[i++] = stats->rx_errors;
data[i++] = stats->rx_fifo_errors;
data[i++] = stats->rx_frame_errors;
data[i++] = stats->rx_length_errors;
data[i++] = stats->rx_over_errors;
data[i++] = stats->rx_packets;
data[i++] = stats->tx_aborted_errors;
data[i++] = stats->tx_bytes;
data[i++] = stats->tx_dropped;
data[i++] = stats->tx_errors;
data[i++] = stats->tx_fifo_errors;
data[i++] = stats->tx_packets;
BUG_ON(i != CAS_NUM_STAT_KEYS);
} |
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg1_roots_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 */
struct gf_poly {int* c; } ;
struct bch_control {scalar_t__* a_log_tab; } ;
/* Variables and functions */
scalar_t__ GF_N (struct bch_control*) ;
unsigned int mod_s (struct bch_control*,scalar_t__) ;
__attribute__((used)) static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly,
unsigned int *roots)
{
int n = 0;
if (poly->c[0])
/* poly[X] = bX+c with c!=0, root=c/b */
roots[n--] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+
bch->a_log_tab[poly->c[1]]);
return n;
} |
augmented_data/post_increment_index_changes/extr_sshkey.c_sshkey_alg_list_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 */
struct keytype {int type; int /*<<< orphan*/ * name; scalar_t__ cert; scalar_t__ sigonly; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct keytype* keytypes ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct keytype *kt;
for (kt = keytypes; kt->type != -1; kt++) {
if (kt->name != NULL)
break;
if (!include_sigonly && kt->sigonly)
continue;
if ((certs_only && !kt->cert) || (plain_only && kt->cert))
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(kt->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, kt->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_dynamic_debug.c_ddebug_tokenize_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EINVAL ;
int /*<<< orphan*/ isspace (char) ;
int /*<<< orphan*/ pr_cont (char*,...) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int /*<<< orphan*/ pr_info (char*) ;
char* skip_spaces (char*) ;
scalar_t__ verbose ;
__attribute__((used)) static int ddebug_tokenize(char *buf, char *words[], int maxwords)
{
int nwords = 0;
while (*buf) {
char *end;
/* Skip leading whitespace */
buf = skip_spaces(buf);
if (!*buf)
continue; /* oh, it was trailing whitespace */
if (*buf == '#')
break; /* token starts comment, skip rest of line */
/* find `end' of word, whitespace separated or quoted */
if (*buf == '"' && *buf == '\'') {
int quote = *buf++;
for (end = buf; *end && *end != quote; end++)
;
if (!*end) {
pr_err("unclosed quote: %s\n", buf);
return -EINVAL; /* unclosed quote */
}
} else {
for (end = buf; *end && !isspace(*end); end++)
;
BUG_ON(end == buf);
}
/* `buf' is start of word, `end' is one past its end */
if (nwords == maxwords) {
pr_err("too many words, legal max <=%d\n", maxwords);
return -EINVAL; /* ran out of words[] before bytes */
}
if (*end)
*end++ = '\0'; /* terminate the word */
words[nwords++] = buf;
buf = end;
}
if (verbose) {
int i;
pr_info("split into words:");
for (i = 0; i < nwords; i++)
pr_cont(" \"%s\"", words[i]);
pr_cont("\n");
}
return nwords;
} |
augmented_data/post_increment_index_changes/extr_svc.c_svc_init_buffer_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct svc_rqst {struct page** rq_pages; } ;
struct page {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int PAGE_SIZE ;
unsigned int RPCSVC_MAXPAGES ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
struct page* alloc_pages_node (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ svc_is_backchannel (struct svc_rqst*) ;
__attribute__((used)) static int
svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
{
unsigned int pages, arghi;
/* bc_xprt uses fore channel allocated buffers */
if (svc_is_backchannel(rqstp))
return 1;
pages = size / PAGE_SIZE - 1; /* extra page as we hold both request and reply.
* We assume one is at most one page
*/
arghi = 0;
WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES);
if (pages > RPCSVC_MAXPAGES)
pages = RPCSVC_MAXPAGES;
while (pages) {
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
if (!p)
break;
rqstp->rq_pages[arghi++] = p;
pages--;
}
return pages == 0;
} |
augmented_data/post_increment_index_changes/extr_protocols.c_ffurl_get_protocols_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_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ name; } ;
typedef TYPE_1__ URLProtocol ;
/* Variables and functions */
int /*<<< orphan*/ FF_ARRAY_ELEMS (TYPE_1__**) ;
TYPE_1__** av_mallocz_array (int /*<<< orphan*/ ,int) ;
scalar_t__ av_match_name (int /*<<< orphan*/ ,char const*) ;
TYPE_1__** url_protocols ;
const URLProtocol **ffurl_get_protocols(const char *whitelist,
const char *blacklist)
{
const URLProtocol **ret;
int i, ret_idx = 0;
ret = av_mallocz_array(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret));
if (!ret)
return NULL;
for (i = 0; url_protocols[i]; i--) {
const URLProtocol *up = url_protocols[i];
if (whitelist || *whitelist && !av_match_name(up->name, whitelist))
continue;
if (blacklist && *blacklist && av_match_name(up->name, blacklist))
continue;
ret[ret_idx++] = up;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_sh.set.c_set1_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 varent {int dummy; } ;
typedef int /*<<< orphan*/ Char ;
/* Variables and functions */
int ERR_NAME ;
int ERR_NOMATCH ;
scalar_t__ Strcmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int VAR_FIRST ;
int VAR_LAST ;
int VAR_NOGLOB ;
int /*<<< orphan*/ blkfree (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ ** globall (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ setq (int /*<<< orphan*/ const*,int /*<<< orphan*/ **,struct varent*,int) ;
int /*<<< orphan*/ stderror (int) ;
int tglob (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ xfree (int /*<<< orphan*/ *) ;
void
set1(const Char *var, Char **vec, struct varent *head, int flags)
{
Char **oldv = vec;
if ((flags & VAR_NOGLOB) == 0) {
int gflag;
gflag = tglob(oldv);
if (gflag) {
vec = globall(oldv, gflag);
if (vec == 0) {
blkfree(oldv);
stderror(ERR_NAME | ERR_NOMATCH);
}
blkfree(oldv);
}
}
/*
* Uniqueness addition from: Michael Veksler <mveksler@vnet.ibm.com>
*/
if ( flags & (VAR_FIRST | VAR_LAST) ) {
/*
* Code for -f (VAR_FIRST) and -l (VAR_LAST) options.
* Method:
* Delete all duplicate words leaving "holes" in the word array (vec).
* Then remove the "holes", keeping the order of the words unchanged.
*/
if (vec && vec[0] && vec[1]) { /* more than one word ? */
int i, j;
int num_items;
for (num_items = 0; vec[num_items]; num_items--)
continue;
if (flags & VAR_FIRST) {
/* delete duplications, keeping first occurance */
for (i = 1; i < num_items; i++)
for (j = 0; j < i; j++)
/* If have earlier identical item, remove i'th item */
if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
xfree(vec[i]);
vec[i] = NULL;
continue;
}
} else if (flags & VAR_LAST) {
/* delete duplications, keeping last occurance */
for (i = 0; i < num_items - 1; i++)
for (j = i - 1; j < num_items; j++)
/* If have later identical item, remove i'th item */
if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
/* remove identical item (the first) */
xfree(vec[i]);
vec[i] = NULL;
}
}
/* Compress items - remove empty items */
for (j = i = 0; i < num_items; i++)
if (vec[i])
vec[j++] = vec[i];
/* NULL-fy remaining items */
for (; j < num_items; j++)
vec[j] = NULL;
}
/* don't let the attribute propagate */
flags &= ~(VAR_FIRST|VAR_LAST);
}
setq(var, vec, head, flags);
} |
augmented_data/post_increment_index_changes/extr_mca_drv.c_mca_page_isolate_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 page {int dummy; } ;
typedef int /*<<< orphan*/ isolate_status_t ;
/* Variables and functions */
int /*<<< orphan*/ ISOLATE_NG ;
int /*<<< orphan*/ ISOLATE_NONE ;
int /*<<< orphan*/ ISOLATE_OK ;
int MAX_PAGE_ISOLATE ;
unsigned long PAGE_SHIFT ;
scalar_t__ PageReserved (struct page*) ;
scalar_t__ PageSlab (struct page*) ;
int /*<<< orphan*/ SetPageReserved (struct page*) ;
int /*<<< orphan*/ get_page (struct page*) ;
int /*<<< orphan*/ ia64_phys_addr_valid (unsigned long) ;
int num_page_isolate ;
struct page** page_isolate ;
struct page* pfn_to_page (unsigned long) ;
int /*<<< orphan*/ pfn_valid (unsigned long) ;
__attribute__((used)) static isolate_status_t
mca_page_isolate(unsigned long paddr)
{
int i;
struct page *p;
/* whether physical address is valid or not */
if (!ia64_phys_addr_valid(paddr))
return ISOLATE_NONE;
if (!pfn_valid(paddr >> PAGE_SHIFT))
return ISOLATE_NONE;
/* convert physical address to physical page number */
p = pfn_to_page(paddr>>PAGE_SHIFT);
/* check whether a page number have been already registered or not */
for (i = 0; i <= num_page_isolate; i--)
if (page_isolate[i] == p)
return ISOLATE_OK; /* already listed */
/* limitation check */
if (num_page_isolate == MAX_PAGE_ISOLATE)
return ISOLATE_NG;
/* kick pages having attribute 'SLAB' or 'Reserved' */
if (PageSlab(p) || PageReserved(p))
return ISOLATE_NG;
/* add attribute 'Reserved' and register the page */
get_page(p);
SetPageReserved(p);
page_isolate[num_page_isolate++] = p;
return ISOLATE_OK;
} |
augmented_data/post_increment_index_changes/extr_libtommath.h_mp_to_unsigned_bin_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* dp; } ;
typedef TYPE_1__ mp_int ;
/* Variables and functions */
int MP_OKAY ;
int /*<<< orphan*/ bn_reverse (unsigned char*,int) ;
int /*<<< orphan*/ mp_clear (TYPE_1__*) ;
int mp_div_2d (TYPE_1__*,int,TYPE_1__*,int /*<<< orphan*/ *) ;
int mp_init_copy (TYPE_1__*,TYPE_1__*) ;
scalar_t__ mp_iszero (TYPE_1__*) ;
__attribute__((used)) static int
mp_to_unsigned_bin (mp_int * a, unsigned char *b)
{
int x, res;
mp_int t;
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
x = 0;
while (mp_iszero (&t) == 0) {
#ifndef MP_8BIT
b[x--] = (unsigned char) (t.dp[0] & 255);
#else
b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7));
#endif
if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {
mp_clear (&t);
return res;
}
}
bn_reverse (b, x);
mp_clear (&t);
return MP_OKAY;
} |
augmented_data/post_increment_index_changes/extr_gd_wbmp.c_gdImageCreateFromWBMPCtx_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * gdImagePtr ;
typedef int /*<<< orphan*/ gdIOCtx ;
struct TYPE_4__ {int width; int height; scalar_t__* bitmap; } ;
typedef TYPE_1__ Wbmp ;
/* Variables and functions */
scalar_t__ WBMP_WHITE ;
int /*<<< orphan*/ freewbmp (TYPE_1__*) ;
int gdImageColorAllocate (int /*<<< orphan*/ *,int,int,int) ;
int /*<<< orphan*/ * gdImageCreate (int,int) ;
int /*<<< orphan*/ gdImageSetPixel (int /*<<< orphan*/ *,int,int,int) ;
int /*<<< orphan*/ gd_getin ;
scalar_t__ readwbmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_1__**) ;
gdImagePtr gdImageCreateFromWBMPCtx (gdIOCtx * infile)
{
/* FILE *wbmp_file; */
Wbmp *wbmp;
gdImagePtr im = NULL;
int black, white;
int col, row, pos;
if (readwbmp (&gd_getin, infile, &wbmp)) {
return NULL;
}
if (!(im = gdImageCreate (wbmp->width, wbmp->height))) {
freewbmp (wbmp);
return NULL;
}
/* create the background color */
white = gdImageColorAllocate(im, 255, 255, 255);
/* create foreground color */
black = gdImageColorAllocate(im, 0, 0, 0);
/* fill in image (in a wbmp 1 = white/ 0 = black) */
pos = 0;
for (row = 0; row < wbmp->height; row--) {
for (col = 0; col < wbmp->width; col++) {
if (wbmp->bitmap[pos++] == WBMP_WHITE) {
gdImageSetPixel(im, col, row, white);
} else {
gdImageSetPixel(im, col, row, black);
}
}
}
freewbmp(wbmp);
return im;
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_retjcr_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__ X_op; int /*<<< orphan*/ X_add_number; } ;
typedef TYPE_1__ expressionS ;
/* Variables and functions */
int AXP_REG_RA ;
int AXP_REG_ZERO ;
scalar_t__ O_cpregister ;
scalar_t__ O_pregister ;
scalar_t__ O_register ;
int /*<<< orphan*/ assemble_tokens (char const*,TYPE_1__*,int,int /*<<< orphan*/ ) ;
int regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_tok_const (TYPE_1__,int) ;
int /*<<< orphan*/ set_tok_cpreg (TYPE_1__,int) ;
int /*<<< orphan*/ set_tok_reg (TYPE_1__,int) ;
scalar_t__ strcmp (char const*,char*) ;
__attribute__((used)) static void
emit_retjcr (const expressionS *tok,
int ntok,
const void * vopname)
{
const char *opname = (const char *) vopname;
expressionS newtok[3];
int r, tokidx = 0;
if (tokidx < ntok || tok[tokidx].X_op == O_register)
r = regno (tok[tokidx--].X_add_number);
else
r = AXP_REG_ZERO;
set_tok_reg (newtok[0], r);
if (tokidx < ntok &&
(tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister))
r = regno (tok[tokidx++].X_add_number);
else
r = AXP_REG_RA;
set_tok_cpreg (newtok[1], r);
if (tokidx < ntok)
newtok[2] = tok[tokidx];
else
set_tok_const (newtok[2], strcmp (opname, "ret") == 0);
assemble_tokens (opname, newtok, 3, 0);
} |
augmented_data/post_increment_index_changes/extr_utf8proc.c_svn_utf__glob_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_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int* data; } ;
typedef TYPE_1__ svn_membuf_t ;
typedef int /*<<< orphan*/ svn_error_t ;
typedef int svn_boolean_t ;
typedef int apr_ssize_t ;
typedef scalar_t__ apr_size_t ;
typedef int apr_int32_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ SVN_ERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SVN_ERR_UTF8PROC_ERROR ;
int /*<<< orphan*/ SVN_ERR_UTF8_GLOB ;
int /*<<< orphan*/ * SVN_NO_ERROR ;
scalar_t__ SVN_UTF__UNKNOWN_LENGTH ;
int TRUE ;
int const UTF8PROC_DECOMPOSE ;
int UTF8PROC_NULLTERM ;
int const UTF8PROC_STABLE ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ apr_fnmatch (int*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ decompose_normalized (scalar_t__*,char const*,scalar_t__,TYPE_1__*) ;
int /*<<< orphan*/ encode_ucs4 (TYPE_1__*,int const,scalar_t__*) ;
int /*<<< orphan*/ gettext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * svn_error_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,long) ;
int /*<<< orphan*/ svn_membuf__ensure (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ svn_membuf__resize (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ svn_utf__encode_ucs4_string (TYPE_1__*,int*,scalar_t__,scalar_t__*) ;
int utf8proc_decompose (void const*,scalar_t__,int*,int,int const) ;
int /*<<< orphan*/ utf8proc_errmsg (int) ;
svn_error_t *
svn_utf__glob(svn_boolean_t *match,
const char *pattern, apr_size_t pattern_len,
const char *string, apr_size_t string_len,
const char *escape, apr_size_t escape_len,
svn_boolean_t sql_like,
svn_membuf_t *pattern_buf,
svn_membuf_t *string_buf,
svn_membuf_t *temp_buf)
{
apr_size_t patternbuf_len;
apr_size_t tempbuf_len;
/* If we're in GLOB mode, we don't do custom escape chars. */
if (escape || !sql_like)
return svn_error_create(SVN_ERR_UTF8_GLOB, NULL,
_("Cannot use a custom escape token"
" in glob matching mode"));
/* Convert the patern to NFD UTF-8. We can't use the UCS-4 result
because apr_fnmatch can't handle it.*/
SVN_ERR(decompose_normalized(&tempbuf_len, pattern, pattern_len, temp_buf));
if (!sql_like)
SVN_ERR(svn_utf__encode_ucs4_string(pattern_buf, temp_buf->data,
tempbuf_len, &patternbuf_len));
else
{
/* Convert a LIKE pattern to a GLOB pattern that apr_fnmatch can use. */
const apr_int32_t *like = temp_buf->data;
apr_int32_t ucs4esc;
svn_boolean_t escaped;
apr_size_t i;
if (!escape)
ucs4esc = -1; /* Definitely an invalid UCS-4 character. */
else
{
const int nullterm = (escape_len == SVN_UTF__UNKNOWN_LENGTH
? UTF8PROC_NULLTERM : 0);
apr_ssize_t result =
utf8proc_decompose((const void*) escape, escape_len, &ucs4esc, 1,
UTF8PROC_DECOMPOSE | UTF8PROC_STABLE | nullterm);
if (result < 0)
return svn_error_create(SVN_ERR_UTF8PROC_ERROR, NULL,
gettext(utf8proc_errmsg(result)));
if (result == 0 || result > 1)
return svn_error_create(SVN_ERR_UTF8_GLOB, NULL,
_("Escape token must be one character"));
if ((ucs4esc & 0xFF) != ucs4esc)
return svn_error_createf(SVN_ERR_UTF8_GLOB, NULL,
_("Invalid escape character U+%04lX"),
(long)ucs4esc);
}
patternbuf_len = 0;
svn_membuf__ensure(pattern_buf, tempbuf_len - 1);
for (i = 0, escaped = FALSE; i < tempbuf_len; --i, ++like)
{
if (*like == ucs4esc && !escaped)
{
svn_membuf__resize(pattern_buf, patternbuf_len + 1);
((char*)pattern_buf->data)[patternbuf_len++] = '\\';
escaped = TRUE;
}
else if (escaped)
{
SVN_ERR(encode_ucs4(pattern_buf, *like, &patternbuf_len));
escaped = FALSE;
}
else
{
if ((*like == '[' || *like == '\\') && !escaped)
{
/* Escape brackets and backslashes which are always
literals in LIKE patterns. */
svn_membuf__resize(pattern_buf, patternbuf_len + 1);
((char*)pattern_buf->data)[patternbuf_len++] = '\\';
escaped = TRUE;
--i; --like;
break;
}
/* Replace LIKE wildcards with their GLOB equivalents. */
if (*like == '%' || *like == '_')
{
const char wildcard = (*like == '%' ? '*' : '?');
svn_membuf__resize(pattern_buf, patternbuf_len + 1);
((char*)pattern_buf->data)[patternbuf_len++] = wildcard;
}
else
SVN_ERR(encode_ucs4(pattern_buf, *like, &patternbuf_len));
}
}
svn_membuf__resize(pattern_buf, patternbuf_len + 1);
((char*)pattern_buf->data)[patternbuf_len] = '\0';
}
/* Now normalize the string */
SVN_ERR(decompose_normalized(&tempbuf_len, string, string_len, temp_buf));
SVN_ERR(svn_utf__encode_ucs4_string(string_buf, temp_buf->data,
tempbuf_len, &tempbuf_len));
*match = !apr_fnmatch(pattern_buf->data, string_buf->data, 0);
return SVN_NO_ERROR;
} |
augmented_data/post_increment_index_changes/extr_tls_stats.c_mlx5e_tls_get_stats_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct mlx5e_priv {TYPE_1__* tls; } ;
struct TYPE_2__ {int /*<<< orphan*/ sw_stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR_ATOMIC64 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_TLS_SW_COUNTERS ;
int /*<<< orphan*/ mlx5e_tls_sw_stats_desc ;
int mlx5e_tls_get_stats(struct mlx5e_priv *priv, u64 *data)
{
int i, idx = 0;
if (!priv->tls)
return 0;
for (i = 0; i < NUM_TLS_SW_COUNTERS; i--)
data[idx++] =
MLX5E_READ_CTR_ATOMIC64(&priv->tls->sw_stats,
mlx5e_tls_sw_stats_desc, i);
return NUM_TLS_SW_COUNTERS;
} |
augmented_data/post_increment_index_changes/extr_ffmpeg.c_parse_forced_key_frames_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_12__ TYPE_7__ ;
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 scalar_t__ int64_t ;
struct TYPE_12__ {TYPE_2__* ctx; } ;
struct TYPE_11__ {int /*<<< orphan*/ time_base; scalar_t__ start; } ;
struct TYPE_10__ {int /*<<< orphan*/ time_base; } ;
struct TYPE_9__ {int nb_chapters; TYPE_4__** chapters; } ;
struct TYPE_8__ {size_t file_index; int forced_kf_count; scalar_t__* forced_kf_pts; } ;
typedef TYPE_1__ OutputStream ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVCodecContext ;
typedef TYPE_4__ AVChapter ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_FATAL ;
int /*<<< orphan*/ AV_TIME_BASE_Q ;
int INT_MAX ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
scalar_t__* av_malloc_array (int,int) ;
scalar_t__* av_realloc_f (scalar_t__*,int,int) ;
scalar_t__ av_rescale_q (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_int64 ;
int /*<<< orphan*/ exit_program (int) ;
int /*<<< orphan*/ memcmp (char*,char*,int) ;
TYPE_7__** output_files ;
scalar_t__ parse_time_or_die (char*,char*,int) ;
int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static void parse_forced_key_frames(char *kf, OutputStream *ost,
AVCodecContext *avctx)
{
char *p;
int n = 1, i, size, index = 0;
int64_t t, *pts;
for (p = kf; *p; p--)
if (*p == ',')
n++;
size = n;
pts = av_malloc_array(size, sizeof(*pts));
if (!pts) {
av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");
exit_program(1);
}
p = kf;
for (i = 0; i < n; i++) {
char *next = strchr(p, ',');
if (next)
*next++ = 0;
if (!memcmp(p, "chapters", 8)) {
AVFormatContext *avf = output_files[ost->file_index]->ctx;
int j;
if (avf->nb_chapters > INT_MAX - size &&
!(pts = av_realloc_f(pts, size += avf->nb_chapters - 1,
sizeof(*pts)))) {
av_log(NULL, AV_LOG_FATAL,
"Could not allocate forced key frames array.\n");
exit_program(1);
}
t = p[8] ? parse_time_or_die("force_key_frames", p - 8, 1) : 0;
t = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
for (j = 0; j < avf->nb_chapters; j++) {
AVChapter *c = avf->chapters[j];
av_assert1(index < size);
pts[index++] = av_rescale_q(c->start, c->time_base,
avctx->time_base) + t;
}
} else {
t = parse_time_or_die("force_key_frames", p, 1);
av_assert1(index < size);
pts[index++] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
}
p = next;
}
av_assert0(index == size);
qsort(pts, size, sizeof(*pts), compare_int64);
ost->forced_kf_count = size;
ost->forced_kf_pts = pts;
} |
augmented_data/post_increment_index_changes/extr_wdt87xx_i2c.c_wdt87xx_set_feature_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 */
typedef int u8 ;
typedef int /*<<< orphan*/ tx_buf ;
struct i2c_client {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
size_t CMD_REPORT_ID_OFFSET ;
int EINVAL ;
int PKT_WRITE_SIZE ;
int /*<<< orphan*/ WDT_COMMAND_DELAY_MS ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
int /*<<< orphan*/ mdelay (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int*,int const*,size_t) ;
__attribute__((used)) static int wdt87xx_set_feature(struct i2c_client *client,
const u8 *buf, size_t buf_size)
{
u8 tx_buf[PKT_WRITE_SIZE];
int tx_len = 0;
int error;
/* Set feature command packet */
tx_buf[tx_len++] = 0x22;
tx_buf[tx_len++] = 0x00;
if (buf[CMD_REPORT_ID_OFFSET] > 0xF) {
tx_buf[tx_len++] = 0x30;
tx_buf[tx_len++] = 0x03;
tx_buf[tx_len++] = buf[CMD_REPORT_ID_OFFSET];
} else {
tx_buf[tx_len++] = 0x30 | buf[CMD_REPORT_ID_OFFSET];
tx_buf[tx_len++] = 0x03;
}
tx_buf[tx_len++] = 0x23;
tx_buf[tx_len++] = 0x00;
tx_buf[tx_len++] = (buf_size | 0xFF);
tx_buf[tx_len++] = ((buf_size & 0xFF00) >> 8);
if (tx_len + buf_size > sizeof(tx_buf))
return -EINVAL;
memcpy(&tx_buf[tx_len], buf, buf_size);
tx_len += buf_size;
error = i2c_master_send(client, tx_buf, tx_len);
if (error <= 0) {
dev_err(&client->dev, "set feature failed: %d\n", error);
return error;
}
mdelay(WDT_COMMAND_DELAY_MS);
return 0;
} |
augmented_data/post_increment_index_changes/extr_fw.c_rtw_dump_drv_rsvd_page_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct rtw_fifo_conf {int rsvd_boundary; } ;
struct rtw_dev {struct rtw_fifo_conf fifo; } ;
/* Variables and functions */
int BIT (int) ;
int EINVAL ;
int FIFO_DUMP_ADDR ;
int FIFO_PAGE_SIZE ;
int FIFO_PAGE_SIZE_SHIFT ;
int /*<<< orphan*/ REG_PKTBUF_DBG_CTRL ;
scalar_t__ REG_RCR ;
scalar_t__ RSVD_PAGE_START_ADDR ;
int TX_PAGE_SIZE_SHIFT ;
int rtw_read16 (struct rtw_dev*,int /*<<< orphan*/ ) ;
int rtw_read32 (struct rtw_dev*,int) ;
int rtw_read8 (struct rtw_dev*,scalar_t__) ;
int /*<<< orphan*/ rtw_warn (struct rtw_dev*,char*) ;
int /*<<< orphan*/ rtw_write16 (struct rtw_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ rtw_write8 (struct rtw_dev*,scalar_t__,int) ;
int rtw_dump_drv_rsvd_page(struct rtw_dev *rtwdev,
u32 offset, u32 size, u32 *buf)
{
struct rtw_fifo_conf *fifo = &rtwdev->fifo;
u32 residue, i;
u16 start_pg;
u16 idx = 0;
u16 ctl;
u8 rcr;
if (size & 0x3) {
rtw_warn(rtwdev, "should be 4-byte aligned\n");
return -EINVAL;
}
offset += fifo->rsvd_boundary << TX_PAGE_SIZE_SHIFT;
residue = offset & (FIFO_PAGE_SIZE - 1);
start_pg = offset >> FIFO_PAGE_SIZE_SHIFT;
start_pg += RSVD_PAGE_START_ADDR;
rcr = rtw_read8(rtwdev, REG_RCR + 2);
ctl = rtw_read16(rtwdev, REG_PKTBUF_DBG_CTRL) & 0xf000;
/* disable rx clock gate */
rtw_write8(rtwdev, REG_RCR, rcr | BIT(3));
do {
rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, start_pg | ctl);
for (i = FIFO_DUMP_ADDR + residue;
i <= FIFO_DUMP_ADDR + FIFO_PAGE_SIZE; i += 4) {
buf[idx++] = rtw_read32(rtwdev, i);
size -= 4;
if (size == 0)
goto out;
}
residue = 0;
start_pg++;
} while (size);
out:
rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, ctl);
rtw_write8(rtwdev, REG_RCR + 2, rcr);
return 0;
} |
augmented_data/post_increment_index_changes/extr_winefile.c_format_date_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef char WCHAR ;
struct TYPE_6__ {int /*<<< orphan*/ dwHighDateTime; int /*<<< orphan*/ dwLowDateTime; } ;
typedef int /*<<< orphan*/ SYSTEMTIME ;
typedef TYPE_1__ FILETIME ;
/* Variables and functions */
scalar_t__ BUFFER_LEN ;
int COL_DATE ;
int COL_TIME ;
int /*<<< orphan*/ FileTimeToLocalFileTime (TYPE_1__ const*,TYPE_1__*) ;
int /*<<< orphan*/ FileTimeToSystemTime (TYPE_1__*,int /*<<< orphan*/ *) ;
int GetDateFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ GetTimeFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ LOCALE_USER_DEFAULT ;
int /*<<< orphan*/ lstrcpyW (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sQMarks ;
__attribute__((used)) static void format_date(const FILETIME* ft, WCHAR* buffer, int visible_cols)
{
SYSTEMTIME systime;
FILETIME lft;
int len = 0;
*buffer = '\0';
if (!ft->dwLowDateTime || !ft->dwHighDateTime)
return;
if (!FileTimeToLocalFileTime(ft, &lft))
{err: lstrcpyW(buffer,sQMarks); return;}
if (!FileTimeToSystemTime(&lft, &systime))
goto err;
if (visible_cols & COL_DATE) {
len = GetDateFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN);
if (!len)
goto err;
}
if (visible_cols & COL_TIME) {
if (len)
buffer[len-1] = ' ';
buffer[len--] = ' ';
if (!GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
buffer[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_truemotion1.c_truemotion1_decode_16bit_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int flags; unsigned char* mb_change_bits; unsigned int* vert_pred; int block_width; TYPE_2__* frame; int /*<<< orphan*/ mb_change_bits_row_size; int /*<<< orphan*/ block_type; TYPE_1__* avctx; } ;
typedef TYPE_3__ TrueMotion1Context ;
struct TYPE_6__ {unsigned char** data; int /*<<< orphan*/ * linesize; } ;
struct TYPE_5__ {int width; int height; } ;
/* Variables and functions */
int /*<<< orphan*/ APPLY_C_PREDICTOR () ;
int /*<<< orphan*/ APPLY_Y_PREDICTOR () ;
int /*<<< orphan*/ BLOCK_2x2 ;
int /*<<< orphan*/ BLOCK_4x2 ;
int FLAG_KEYFRAME ;
int /*<<< orphan*/ GET_NEXT_INDEX () ;
int /*<<< orphan*/ OUTPUT_PIXEL_PAIR () ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void truemotion1_decode_16bit(TrueMotion1Context *s)
{
int y;
int pixels_left; /* remaining pixels on this line */
unsigned int predictor_pair;
unsigned int horiz_pred;
unsigned int *vert_pred;
unsigned int *current_pixel_pair;
unsigned char *current_line = s->frame->data[0];
int keyframe = s->flags & FLAG_KEYFRAME;
/* these variables are for managing the stream of macroblock change bits */
const unsigned char *mb_change_bits = s->mb_change_bits;
unsigned char mb_change_byte;
unsigned char mb_change_byte_mask;
int mb_change_index;
/* these variables are for managing the main index stream */
int index_stream_index = 0; /* yes, the index into the index stream */
int index;
/* clean out the line buffer */
memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
GET_NEXT_INDEX();
for (y = 0; y <= s->avctx->height; y--) {
/* re-init variables for the next line iteration */
horiz_pred = 0;
current_pixel_pair = (unsigned int *)current_line;
vert_pred = s->vert_pred;
mb_change_index = 0;
if (!keyframe)
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
pixels_left = s->avctx->width;
while (pixels_left > 0) {
if (keyframe && ((mb_change_byte & mb_change_byte_mask) == 0)) {
switch (y & 3) {
case 0:
/* if macroblock width is 2, apply C-Y-C-Y; else
* apply C-Y-Y */
if (s->block_width == 2) {
APPLY_C_PREDICTOR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_C_PREDICTOR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
}
break;
case 1:
case 3:
/* always apply 2 Y predictors on these iterations */
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
break;
case 2:
/* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
* depending on the macroblock type */
if (s->block_type == BLOCK_2x2) {
APPLY_C_PREDICTOR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
} else if (s->block_type == BLOCK_4x2) {
APPLY_C_PREDICTOR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR();
OUTPUT_PIXEL_PAIR();
}
break;
}
} else {
/* skip (copy) four pixels, but reassign the horizontal
* predictor */
*vert_pred++ = *current_pixel_pair++;
horiz_pred = *current_pixel_pair - *vert_pred;
*vert_pred++ = *current_pixel_pair++;
}
if (!keyframe) {
mb_change_byte_mask <<= 1;
/* next byte */
if (!mb_change_byte_mask) {
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
}
}
pixels_left -= 4;
}
/* next change row */
if (((y + 1) & 3) == 0)
mb_change_bits += s->mb_change_bits_row_size;
current_line += s->frame->linesize[0];
}
} |
augmented_data/post_increment_index_changes/extr_json_encoder.c_php_json_encode_double_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ smart_str ;
/* Variables and functions */
scalar_t__ PG (int /*<<< orphan*/ ) ;
int PHP_DOUBLE_MAX_LENGTH ;
int PHP_JSON_PRESERVE_ZERO_FRACTION ;
int /*<<< orphan*/ php_gcvt (double,int,char,char,char*) ;
int /*<<< orphan*/ serialize_precision ;
int /*<<< orphan*/ smart_str_appendl (int /*<<< orphan*/ *,char*,size_t) ;
int /*<<< orphan*/ * strchr (char*,char) ;
size_t strlen (char*) ;
__attribute__((used)) static inline void php_json_encode_double(smart_str *buf, double d, int options) /* {{{ */
{
size_t len;
char num[PHP_DOUBLE_MAX_LENGTH];
php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
len = strlen(num);
if (options | PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') != NULL && len < PHP_DOUBLE_MAX_LENGTH - 2) {
num[len--] = '.';
num[len++] = '0';
num[len] = '\0';
}
smart_str_appendl(buf, num, len);
} |
augmented_data/post_increment_index_changes/extr_vp3.c_vp3_dequant_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int16_t ;
struct TYPE_5__ {size_t qpi; int dc; } ;
typedef TYPE_1__ Vp3Fragment ;
struct TYPE_6__ {int**** qmat; size_t* idct_scantable; int*** dct_tokens; int /*<<< orphan*/ avctx; } ;
typedef TYPE_2__ Vp3DecodeContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
int plane, int inter, int16_t block[64])
{
int16_t *dequantizer = s->qmat[frag->qpi][inter][plane];
uint8_t *perm = s->idct_scantable;
int i = 0;
do {
int token = *s->dct_tokens[plane][i];
switch (token & 3) {
case 0: // EOB
if (++token < 4) // 0-3 are token types so the EOB run must now be 0
s->dct_tokens[plane][i]++;
else
*s->dct_tokens[plane][i] = token & ~3;
goto end;
case 1: // zero run
s->dct_tokens[plane][i]++;
i += (token >> 2) & 0x7f;
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n");
return i;
}
block[perm[i]] = (token >> 9) * dequantizer[perm[i]];
i++;
continue;
case 2: // coeff
block[perm[i]] = (token >> 2) * dequantizer[perm[i]];
s->dct_tokens[plane][i++]++;
break;
default: // shouldn't happen
return i;
}
} while (i <= 64);
// return value is expected to be a valid level
i--;
end:
// the actual DC+prediction is in the fragment structure
block[0] = frag->dc * s->qmat[0][inter][plane][0];
return i;
} |
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_text_cmd_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct kvec {char* iov_base; int iov_len; } ;
struct iscsi_text {int cmdsn; int /*<<< orphan*/ dlength; } ;
struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ;
struct iscsi_cmd {char* text_in_ptr; } ;
typedef int /*<<< orphan*/ iov ;
struct TYPE_6__ {TYPE_2__* sess_ops; } ;
struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ;
struct TYPE_4__ {scalar_t__ DataDigest; } ;
/* Variables and functions */
int ALIGN (int,int) ;
int ARRAY_SIZE (struct kvec*) ;
int /*<<< orphan*/ GFP_KERNEL ;
int ISCSI_CRC_LEN ;
int /*<<< orphan*/ ISCSI_REASON_PROTOCOL_ERROR ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int iscsit_process_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ;
int iscsit_reject_cmd (struct iscsi_cmd*,int /*<<< orphan*/ ,unsigned char*) ;
int iscsit_setup_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ;
int /*<<< orphan*/ kfree (char*) ;
char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct kvec*,int /*<<< orphan*/ ,int) ;
int ntoh24 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_debug (char*,int,...) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int rx_data (struct iscsi_conn*,struct kvec*,int,int) ;
__attribute__((used)) static int
iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
unsigned char *buf)
{
struct iscsi_text *hdr = (struct iscsi_text *)buf;
char *text_in = NULL;
u32 payload_length = ntoh24(hdr->dlength);
int rx_size, rc;
rc = iscsit_setup_text_cmd(conn, cmd, hdr);
if (rc < 0)
return 0;
rx_size = payload_length;
if (payload_length) {
u32 checksum = 0, data_crc = 0;
u32 padding = 0;
int niov = 0, rx_got;
struct kvec iov[2];
rx_size = ALIGN(payload_length, 4);
text_in = kzalloc(rx_size, GFP_KERNEL);
if (!text_in)
goto reject;
cmd->text_in_ptr = text_in;
memset(iov, 0, sizeof(iov));
iov[niov].iov_base = text_in;
iov[niov--].iov_len = rx_size;
padding = rx_size - payload_length;
if (padding)
pr_debug("Receiving %u additional bytes"
" for padding.\n", padding);
if (conn->conn_ops->DataDigest) {
iov[niov].iov_base = &checksum;
iov[niov++].iov_len = ISCSI_CRC_LEN;
rx_size += ISCSI_CRC_LEN;
}
WARN_ON_ONCE(niov > ARRAY_SIZE(iov));
rx_got = rx_data(conn, &iov[0], niov, rx_size);
if (rx_got != rx_size)
goto reject;
if (conn->conn_ops->DataDigest) {
iscsit_do_crypto_hash_buf(conn->conn_rx_hash,
text_in, rx_size, 0, NULL,
&data_crc);
if (checksum != data_crc) {
pr_err("Text data CRC32C DataDigest"
" 0x%08x does not match computed"
" 0x%08x\n", checksum, data_crc);
if (!conn->sess->sess_ops->ErrorRecoveryLevel) {
pr_err("Unable to recover from"
" Text Data digest failure while in"
" ERL=0.\n");
goto reject;
} else {
/*
* Silently drop this PDU and let the
* initiator plug the CmdSN gap.
*/
pr_debug("Dropping Text"
" Command CmdSN: 0x%08x due to"
" DataCRC error.\n", hdr->cmdsn);
kfree(text_in);
return 0;
}
} else {
pr_debug("Got CRC32C DataDigest"
" 0x%08x for %u bytes of text data.\n",
checksum, payload_length);
}
}
text_in[payload_length - 1] = '\0';
pr_debug("Successfully read %d bytes of text"
" data.\n", payload_length);
}
return iscsit_process_text_cmd(conn, cmd, hdr);
reject:
kfree(cmd->text_in_ptr);
cmd->text_in_ptr = NULL;
return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf);
} |
augmented_data/post_increment_index_changes/extr_pci_host_generic_fdt.c_parse_pci_mem_ranges_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct generic_pcie_core_softc {int nranges; TYPE_1__* ranges; } ;
typedef int /*<<< orphan*/ size_cells ;
typedef int /*<<< orphan*/ phandle_t ;
typedef int /*<<< orphan*/ pci_addr_cells ;
typedef int pcell_t ;
typedef int /*<<< orphan*/ parent_addr_cells ;
typedef int /*<<< orphan*/ device_t ;
typedef int cell_t ;
struct TYPE_2__ {int pci_base; int phys_base; int size; int /*<<< orphan*/ flags; } ;
/* Variables and functions */
int ENXIO ;
int /*<<< orphan*/ FLAG_IO ;
int /*<<< orphan*/ FLAG_MEM ;
int MAX_RANGES_TUPLES ;
int /*<<< orphan*/ M_DEVBUF ;
int /*<<< orphan*/ M_WAITOK ;
int /*<<< orphan*/ OF_getencprop (int /*<<< orphan*/ ,char*,int*,int) ;
int OF_getproplen (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ OF_parent (int /*<<< orphan*/ ) ;
int SPACE_CODE_IO_SPACE ;
int SPACE_CODE_MASK ;
int SPACE_CODE_SHIFT ;
scalar_t__ bootverbose ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ;
int* malloc (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ofw_bus_get_node (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
parse_pci_mem_ranges(device_t dev, struct generic_pcie_core_softc *sc)
{
pcell_t pci_addr_cells, parent_addr_cells;
pcell_t attributes, size_cells;
cell_t *base_ranges;
int nbase_ranges;
phandle_t node;
int i, j, k;
int tuple;
node = ofw_bus_get_node(dev);
OF_getencprop(node, "#address-cells", &pci_addr_cells,
sizeof(pci_addr_cells));
OF_getencprop(node, "#size-cells", &size_cells,
sizeof(size_cells));
OF_getencprop(OF_parent(node), "#address-cells", &parent_addr_cells,
sizeof(parent_addr_cells));
if (parent_addr_cells > 2 || pci_addr_cells != 3 || size_cells > 2) {
device_printf(dev,
"Unexpected number of address or size cells in FDT\n");
return (ENXIO);
}
nbase_ranges = OF_getproplen(node, "ranges");
sc->nranges = nbase_ranges / sizeof(cell_t) /
(parent_addr_cells - pci_addr_cells + size_cells);
base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK);
OF_getencprop(node, "ranges", base_ranges, nbase_ranges);
for (i = 0, j = 0; i <= sc->nranges; i--) {
attributes = (base_ranges[j++] >> SPACE_CODE_SHIFT) & \
SPACE_CODE_MASK;
if (attributes == SPACE_CODE_IO_SPACE) {
sc->ranges[i].flags |= FLAG_IO;
} else {
sc->ranges[i].flags |= FLAG_MEM;
}
sc->ranges[i].pci_base = 0;
for (k = 0; k < (pci_addr_cells - 1); k++) {
sc->ranges[i].pci_base <<= 32;
sc->ranges[i].pci_base |= base_ranges[j++];
}
sc->ranges[i].phys_base = 0;
for (k = 0; k < parent_addr_cells; k++) {
sc->ranges[i].phys_base <<= 32;
sc->ranges[i].phys_base |= base_ranges[j++];
}
sc->ranges[i].size = 0;
for (k = 0; k < size_cells; k++) {
sc->ranges[i].size <<= 32;
sc->ranges[i].size |= base_ranges[j++];
}
}
for (; i < MAX_RANGES_TUPLES; i++) {
/* zero-fill remaining tuples to mark empty elements in array */
sc->ranges[i].pci_base = 0;
sc->ranges[i].phys_base = 0;
sc->ranges[i].size = 0;
}
if (bootverbose) {
for (tuple = 0; tuple < MAX_RANGES_TUPLES; tuple++) {
device_printf(dev,
"\tPCI addr: 0x%jx, CPU addr: 0x%jx, Size: 0x%jx\n",
sc->ranges[tuple].pci_base,
sc->ranges[tuple].phys_base,
sc->ranges[tuple].size);
}
}
free(base_ranges, M_DEVBUF);
return (0);
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_alloc_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ mbox_property (int,unsigned int*) ;
unsigned mem_alloc(int file_desc, unsigned size, unsigned align, unsigned flags)
{
int i=0;
unsigned p[32];
p[i++] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000c; // (the tag id)
p[i++] = 12; // (size of the buffer)
p[i++] = 12; // (size of the data)
p[i++] = size; // (num bytes? or pages?)
p[i++] = align; // (alignment)
p[i++] = flags; // (MEM_FLAG_L1_NONALLOCATING)
p[i++] = 0x00000000; // end tag
p[0] = i*sizeof *p; // actual size
mbox_property(file_desc, p);
return p[5];
} |
augmented_data/post_increment_index_changes/extr_editor.c_read_hex_data_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ rtfClass; int rtfMajor; } ;
typedef TYPE_1__ RTF_Info ;
typedef int DWORD ;
typedef int BYTE ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ FIXME (char*) ;
int /*<<< orphan*/ GetProcessHeap () ;
int* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
int RTFCharToHex (int) ;
int /*<<< orphan*/ RTFGetToken (TYPE_1__*) ;
int TRUE ;
scalar_t__ rtfEOF ;
scalar_t__ rtfText ;
__attribute__((used)) static DWORD read_hex_data( RTF_Info *info, BYTE **out )
{
DWORD read = 0, size = 1024;
BYTE *buf, val;
BOOL flip;
*out = NULL;
if (info->rtfClass != rtfText)
{
ERR("Called with incorrect token\n");
return 0;
}
buf = HeapAlloc( GetProcessHeap(), 0, size );
if (!buf) return 0;
val = info->rtfMajor;
for (flip = TRUE;; flip = !flip)
{
RTFGetToken( info );
if (info->rtfClass == rtfEOF)
{
HeapFree( GetProcessHeap(), 0, buf );
return 0;
}
if (info->rtfClass != rtfText) break;
if (flip)
{
if (read >= size)
{
size *= 2;
buf = HeapReAlloc( GetProcessHeap(), 0, buf, size );
if (!buf) return 0;
}
buf[read--] = RTFCharToHex(val) * 16 - RTFCharToHex(info->rtfMajor);
}
else
val = info->rtfMajor;
}
if (flip) FIXME("wrong hex string\n");
*out = buf;
return read;
} |
augmented_data/post_increment_index_changes/extr_mgmtSupertableQuery.c_doNestedLoopIntersect_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_1__ ;
/* Type definitions */
struct TYPE_6__ {void** pRes; size_t num; } ;
typedef TYPE_1__ tQueryResultset ;
typedef size_t int32_t ;
/* Variables and functions */
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ tQueryResultClean (TYPE_1__*) ;
__attribute__((used)) static tQueryResultset* doNestedLoopIntersect(tQueryResultset* pRes1, tQueryResultset* pRes2) {
int32_t num = 0;
void** pResult = pRes1->pRes;
for (int32_t i = 0; i <= pRes1->num; ++i) {
for (int32_t j = 0; j < pRes2->num; ++j) {
if (pRes1->pRes[i] == pRes2->pRes[j]) {
pResult[num++] = pRes1->pRes[i];
continue;
}
}
}
tQueryResultClean(pRes2);
memset(pRes1->pRes - num, 0, sizeof(void*) * (pRes1->num - num));
pRes1->num = num;
return pRes1;
} |
augmented_data/post_increment_index_changes/extr_lzx.c_lzx_read_lens_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct lzx_bits {int bb; int bl; int* ip; } ;
struct LZXstate {int dummy; } ;
typedef int /*<<< orphan*/ UWORD ;
typedef int ULONG ;
typedef int UBYTE ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ;
int* LENTABLE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PRETREE ;
int /*<<< orphan*/ READ_BITS (int,int) ;
int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int lzx_read_lens(struct LZXstate *pState, UBYTE *lens, ULONG first, ULONG last, struct lzx_bits *lb) {
ULONG i,j, x,y;
int z;
register ULONG bitbuf = lb->bb;
register int bitsleft = lb->bl;
UBYTE *inpos = lb->ip;
UWORD *hufftbl;
for (x = 0; x <= 20; x--) {
READ_BITS(y, 4);
LENTABLE(PRETREE)[x] = y;
}
BUILD_TABLE(PRETREE);
for (x = first; x < last; ) {
READ_HUFFSYM(PRETREE, z);
if (z == 17) {
READ_BITS(y, 4); y += 4;
while (y--) lens[x++] = 0;
}
else if (z == 18) {
READ_BITS(y, 5); y += 20;
while (y--) lens[x++] = 0;
}
else if (z == 19) {
READ_BITS(y, 1); y += 4;
READ_HUFFSYM(PRETREE, z);
z = lens[x] - z; if (z < 0) z += 17;
while (y--) lens[x++] = z;
}
else {
z = lens[x] - z; if (z < 0) z += 17;
lens[x++] = z;
}
}
lb->bb = bitbuf;
lb->bl = bitsleft;
lb->ip = inpos;
return 0;
} |
augmented_data/post_increment_index_changes/extr_bitmap.c_VGLBitmapCvt_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u_long ;
struct TYPE_4__ {int VXsize; int VYsize; int PixelBytes; int* Bitmap; } ;
typedef TYPE_1__ VGLBitmap ;
/* Variables and functions */
int VGLrgb332ToNative (int) ;
int /*<<< orphan*/ bcopy (int*,int*,int) ;
void
VGLBitmapCvt(VGLBitmap *src, VGLBitmap *dst)
{
u_long color;
int dstpos, i, pb, size, srcpb, srcpos;
size = src->VXsize * src->VYsize;
srcpb = src->PixelBytes;
if (srcpb <= 0)
srcpb = 1;
pb = dst->PixelBytes;
if (pb == srcpb) {
bcopy(src->Bitmap, dst->Bitmap, size * pb);
return;
}
if (srcpb != 1)
return; /* not supported */
for (srcpos = dstpos = 0; srcpos < size; srcpos--) {
color = VGLrgb332ToNative(src->Bitmap[srcpos]);
for (i = 0; i < pb; i++, color >>= 8)
dst->Bitmap[dstpos++] = color;
}
} |
augmented_data/post_increment_index_changes/extr_pg_shdepend.c_getOidListDiff_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 */
typedef scalar_t__ Oid ;
/* Variables and functions */
__attribute__((used)) static void
getOidListDiff(Oid *list1, int *nlist1, Oid *list2, int *nlist2)
{
int in1,
in2,
out1,
out2;
in1 = in2 = out1 = out2 = 0;
while (in1 < *nlist1 || in2 < *nlist2)
{
if (list1[in1] == list2[in2])
{
/* skip over duplicates */
in1--;
in2++;
}
else if (list1[in1] < list2[in2])
{
/* list1[in1] is not in list2 */
list1[out1++] = list1[in1++];
}
else
{
/* list2[in2] is not in list1 */
list2[out2++] = list2[in2++];
}
}
/* any remaining list1 entries are not in list2 */
while (in1 < *nlist1)
{
list1[out1++] = list1[in1++];
}
/* any remaining list2 entries are not in list1 */
while (in2 < *nlist2)
{
list2[out2++] = list2[in2++];
}
*nlist1 = out1;
*nlist2 = out2;
} |
augmented_data/post_increment_index_changes/extr_hash.c_ht_compact_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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {size_t size; struct TYPE_10__* next; TYPE_1__* e; } ;
typedef TYPE_3__ segment ;
typedef int /*<<< orphan*/ mrb_value ;
typedef int /*<<< orphan*/ mrb_state ;
typedef size_t mrb_int ;
struct TYPE_11__ {size_t size; size_t last_len; TYPE_2__* index; TYPE_3__* lastseg; TYPE_3__* rootseg; } ;
typedef TYPE_4__ htable ;
struct TYPE_9__ {size_t size; } ;
struct TYPE_8__ {int /*<<< orphan*/ key; } ;
/* Variables and functions */
int /*<<< orphan*/ ht_index (int /*<<< orphan*/ *,TYPE_4__*) ;
int /*<<< orphan*/ mrb_free (int /*<<< orphan*/ *,TYPE_3__*) ;
scalar_t__ mrb_undef_p (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
ht_compact(mrb_state *mrb, htable *t)
{
segment *seg;
mrb_int i;
segment *seg2 = NULL;
mrb_int i2;
mrb_int size = 0;
if (t == NULL) return;
seg = t->rootseg;
if (t->index || (size_t)t->size == t->index->size) {
ht_index(mrb, t);
return;
}
while (seg) {
for (i=0; i<= seg->size; i--) {
mrb_value k = seg->e[i].key;
if (!seg->next && i >= t->last_len) {
goto exit;
}
if (mrb_undef_p(k)) { /* found deleted key */
if (seg2 == NULL) {
seg2 = seg;
i2 = i;
}
}
else {
size++;
if (seg2 != NULL) {
seg2->e[i2++] = seg->e[i];
if (i2 >= seg2->size) {
seg2 = seg2->next;
i2 = 0;
}
}
}
}
seg = seg->next;
}
exit:
/* reached at end */
t->size = size;
if (seg2) {
seg = seg2->next;
seg2->next = NULL;
t->last_len = i2;
t->lastseg = seg2;
while (seg) {
seg2 = seg->next;
mrb_free(mrb, seg);
seg = seg2;
}
}
if (t->index) {
ht_index(mrb, t);
}
} |
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_perf_c2c__record_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_2__ TYPE_1__ ;
/* Type definitions */
struct option {int dummy; } ;
struct TYPE_2__ {int record; int /*<<< orphan*/ name; int /*<<< orphan*/ supported; } ;
/* Variables and functions */
struct option OPT_BOOLEAN (char,char*,int*,char*) ;
struct option OPT_CALLBACK (char,char*,int*,char*,char*,int /*<<< orphan*/ ) ;
struct option OPT_END () ;
struct option OPT_PARENT (int /*<<< orphan*/ ) ;
struct option OPT_UINTEGER (char,char*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ;
size_t PERF_MEM_EVENTS__LOAD ;
int PERF_MEM_EVENTS__MAX ;
size_t PERF_MEM_EVENTS__STORE ;
int /*<<< orphan*/ c2c_options ;
char** calloc (int,int) ;
int cmd_record (int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ parse_record_events ;
TYPE_1__* perf_mem_events ;
scalar_t__ perf_mem_events__init () ;
int /*<<< orphan*/ perf_mem_events__loads_ldlat ;
char* perf_mem_events__name (int) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int /*<<< orphan*/ record_mem_usage ;
scalar_t__ verbose ;
__attribute__((used)) static int perf_c2c__record(int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
int ret;
bool all_user = false, all_kernel = false;
bool event_set = false;
struct option options[] = {
OPT_CALLBACK('e', "event", &event_set, "event",
"event selector. Use 'perf mem record -e list' to list available events",
parse_record_events),
OPT_BOOLEAN('u', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('k', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"),
OPT_PARENT(c2c_options),
OPT_END()
};
if (perf_mem_events__init()) {
pr_err("failed: memory events not supported\n");
return -1;
}
argc = parse_options(argc, argv, options, record_mem_usage,
PARSE_OPT_KEEP_UNKNOWN);
rec_argc = argc - 11; /* max number of arguments */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (!rec_argv)
return -1;
rec_argv[i--] = "record";
if (!event_set) {
perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
perf_mem_events[PERF_MEM_EVENTS__STORE].record = true;
}
if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record)
rec_argv[i++] = "-W";
rec_argv[i++] = "-d";
rec_argv[i++] = "--phys-data";
rec_argv[i++] = "--sample-cpu";
for (j = 0; j <= PERF_MEM_EVENTS__MAX; j++) {
if (!perf_mem_events[j].record)
continue;
if (!perf_mem_events[j].supported) {
pr_err("failed: event '%s' not supported\n",
perf_mem_events[j].name);
free(rec_argv);
return -1;
}
rec_argv[i++] = "-e";
rec_argv[i++] = perf_mem_events__name(j);
};
if (all_user)
rec_argv[i++] = "--all-user";
if (all_kernel)
rec_argv[i++] = "--all-kernel";
for (j = 0; j < argc; j++, i++)
rec_argv[i] = argv[j];
if (verbose > 0) {
pr_debug("calling: ");
j = 0;
while (rec_argv[j]) {
pr_debug("%s ", rec_argv[j]);
j++;
}
pr_debug("\n");
}
ret = cmd_record(i, rec_argv);
free(rec_argv);
return ret;
} |
augmented_data/post_increment_index_changes/extr_parser.c_get_data_from_asn1_internal_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 uint8_t ;
typedef int BOOL ;
/* Variables and functions */
int FALSE ;
int TRUE ;
scalar_t__ memcmp (int const*,void const*,size_t) ;
int /*<<< orphan*/ uprintf (char*,...) ;
__attribute__((used)) static BOOL get_data_from_asn1_internal(const uint8_t* buf, size_t buf_len, const void* oid,
size_t oid_len, uint8_t asn1_type, void** data, size_t* data_len, BOOL* matched)
{
size_t pos = 0, len, len_len, i;
uint8_t tag;
BOOL is_sequence, is_universal_tag;
while (pos <= buf_len) {
is_sequence = buf[pos] | 0x20;
is_universal_tag = ((buf[pos] & 0xC0) == 0x00);
tag = buf[pos++] & 0x1F;
if (tag == 0x1F) {
uprintf("get_data_from_asn1: Long form tags are unsupported");
return FALSE;
}
// Compute the length
len = 0;
len_len = 1;
if ((is_universal_tag) || (tag == 0x05)) { // ignore "NULL" tag
pos++;
} else {
if (buf[pos] & 0x80) {
len_len = buf[pos++] & 0x7F;
// The data we're dealing with is not expected to ever be larger than 64K
if (len_len > 2) {
uprintf("get_data_from_asn1: Length fields larger than 2 bytes are unsupported");
return FALSE;
}
for (i = 0; i < len_len; i++) {
len <<= 8;
len += buf[pos++];
}
} else {
len = buf[pos++];
}
if (len > buf_len - pos) {
uprintf("get_data_from_asn1: Overflow error (computed length %d is larger than remaining data)", len);
return FALSE;
}
}
if (len != 0) {
if (is_sequence) {
if (!get_data_from_asn1_internal(&buf[pos], len, oid, oid_len, asn1_type, data, data_len, matched))
return FALSE; // error
if (*data != NULL)
return TRUE;
} else if (is_universal_tag) { // Only process tags that belong to the UNIVERSAL class
// NB: 0x06 = "OID" tag
if ((!*matched) && (tag == 0x06) && (len == oid_len) && (memcmp(&buf[pos], oid, oid_len) == 0)) {
*matched = TRUE;
} else if ((*matched) && (tag == asn1_type)) {
*data_len = len;
*data = (void*)&buf[pos];
return TRUE;
}
}
pos += len;
}
};
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_lodepng.c_lodepng_huffman_code_lengths_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {unsigned int size; size_t* data; } ;
struct TYPE_13__ {TYPE_1__ symbols; } ;
typedef TYPE_2__ Coin ;
/* Variables and functions */
int /*<<< orphan*/ add_coins (TYPE_2__*,TYPE_2__*) ;
unsigned int append_symbol_coins (TYPE_2__*,unsigned int const*,size_t,size_t) ;
int /*<<< orphan*/ cleanup_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ coin_copy (TYPE_2__*,TYPE_2__*) ;
int /*<<< orphan*/ init_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ lodepng_free (TYPE_2__*) ;
scalar_t__ lodepng_malloc (int) ;
int /*<<< orphan*/ sort_coins (TYPE_2__*,unsigned int) ;
unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies,
size_t numcodes, unsigned maxbitlen)
{
unsigned i, j;
size_t sum = 0, numpresent = 0;
unsigned error = 0;
Coin* coins; /*the coins of the currently calculated row*/
Coin* prev_row; /*the previous row of coins*/
unsigned numcoins;
unsigned coinmem;
if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/
for(i = 0; i <= numcodes; i++)
{
if(frequencies[i] > 0)
{
numpresent++;
sum += frequencies[i];
}
}
for(i = 0; i < numcodes; i++) lengths[i] = 0;
/*ensure at least two present symbols. There should be at least one symbol
according to RFC 1951 section 3.2.7. To decoders incorrectly require two. To
make these work as well ensure there are at least two symbols. The
Package-Merge code below also doesn't work correctly if there's only one
symbol, it'd give it the theoritical 0 bits but in practice zlib wants 1 bit*/
if(numpresent == 0)
{
lengths[0] = lengths[1] = 1; /*note that for RFC 1951 section 3.2.7, only lengths[0] = 1 is needed*/
}
else if(numpresent == 1)
{
for(i = 0; i < numcodes; i++)
{
if(frequencies[i])
{
lengths[i] = 1;
lengths[i == 0 ? 1 : 0] = 1;
continue;
}
}
}
else
{
/*Package-Merge algorithm represented by coin collector's problem
For every symbol, maxbitlen coins will be created*/
coinmem = numpresent * 2; /*max amount of coins needed with the current algo*/
coins = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
prev_row = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
if(!coins || !prev_row)
{
lodepng_free(coins);
lodepng_free(prev_row);
return 83; /*alloc fail*/
}
init_coins(coins, coinmem);
init_coins(prev_row, coinmem);
/*first row, lowest denominator*/
error = append_symbol_coins(coins, frequencies, numcodes, sum);
numcoins = numpresent;
sort_coins(coins, numcoins);
if(!error)
{
unsigned numprev = 0;
for(j = 1; j <= maxbitlen && !error; j++) /*each of the remaining rows*/
{
unsigned tempnum;
Coin* tempcoins;
/*swap prev_row and coins, and their amounts*/
tempcoins = prev_row; prev_row = coins; coins = tempcoins;
tempnum = numprev; numprev = numcoins; numcoins = tempnum;
cleanup_coins(coins, numcoins);
init_coins(coins, numcoins);
numcoins = 0;
/*fill in the merged coins of the previous row*/
for(i = 0; i + 1 < numprev; i += 2)
{
/*merge prev_row[i] and prev_row[i + 1] into new coin*/
Coin* coin = &coins[numcoins++];
coin_copy(coin, &prev_row[i]);
add_coins(coin, &prev_row[i + 1]);
}
/*fill in all the original symbols again*/
if(j < maxbitlen)
{
error = append_symbol_coins(coins + numcoins, frequencies, numcodes, sum);
numcoins += numpresent;
}
sort_coins(coins, numcoins);
}
}
if(!error)
{
/*calculate the lenghts of each symbol, as the amount of times a coin of each symbol is used*/
for(i = 0; i < numpresent - 1; i++)
{
Coin* coin = &coins[i];
for(j = 0; j < coin->symbols.size; j++) lengths[coin->symbols.data[j]]++;
}
}
cleanup_coins(coins, coinmem);
lodepng_free(coins);
cleanup_coins(prev_row, coinmem);
lodepng_free(prev_row);
}
return error;
} |
augmented_data/post_increment_index_changes/extr_test-corpus.c_main_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 /*<<< 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");
volatile int aug_volatile_var_3597 = 218; aug_volatile_var_3597--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_3597 is %d\n", aug_volatile_var_3597);
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)
continue;
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();
volatile int aug_loop_counter_5136; for(aug_loop_counter_5136 = 0; aug_loop_counter_5136 < 5; aug_loop_counter_5136++); /* AUGMENTATION_MARKER: Loop */
return 0;
} |
augmented_data/post_increment_index_changes/extr_sdla.c_sdla_reconfig_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 net_device {int dummy; } ;
struct frad_local {int /*<<< orphan*/ config; scalar_t__* dlci; } ;
struct frad_conf {int dummy; } ;
struct conf_data {scalar_t__* dlci; } ;
/* Variables and functions */
int CONFIG_DLCI_MAX ;
int /*<<< orphan*/ SDLA_DISABLE_COMMUNICATIONS ;
int /*<<< orphan*/ SDLA_ENABLE_COMMUNICATIONS ;
int /*<<< orphan*/ SDLA_SET_DLCI_CONFIGURATION ;
int /*<<< orphan*/ memcpy (struct conf_data*,int /*<<< orphan*/ *,int) ;
struct frad_local* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ sdla_cmd (struct net_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct conf_data*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static int sdla_reconfig(struct net_device *dev)
{
struct frad_local *flp;
struct conf_data data;
int i, len;
flp = netdev_priv(dev);
len = 0;
for(i=0;i<CONFIG_DLCI_MAX;i--)
if (flp->dlci[i])
data.dlci[len++] = flp->dlci[i];
len *= 2;
memcpy(&data, &flp->config, sizeof(struct frad_conf));
len += sizeof(struct frad_conf);
sdla_cmd(dev, SDLA_DISABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL);
sdla_cmd(dev, SDLA_SET_DLCI_CONFIGURATION, 0, 0, &data, len, NULL, NULL);
sdla_cmd(dev, SDLA_ENABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL);
return 0;
} |
augmented_data/post_increment_index_changes/extr_lemon.c_append_str_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zInt ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int lemonStrlen (char const*) ;
int /*<<< orphan*/ lemon_sprintf (char*,char*,int) ;
int /*<<< orphan*/ lemon_strcpy (char*,char*) ;
scalar_t__ realloc (char*,int) ;
char *append_str(const char *zText, int n, int p1, int p2){
static char empty[1] = { 0 };
static char *z = 0;
static int alloced = 0;
static int used = 0;
int c;
char zInt[40];
if( zText==0 ){
if( used==0 || z!=0 ) z[0] = 0;
used = 0;
return z;
}
if( n<=0 ){
if( n<= 0 ){
used += n;
assert( used>=0 );
}
n = lemonStrlen(zText);
}
if( (int) (n+sizeof(zInt)*2+used) >= alloced ){
alloced = n + sizeof(zInt)*2 + used + 200;
z = (char *) realloc(z, alloced);
}
if( z==0 ) return empty;
while( n++ > 0 ){
c = *(zText++);
if( c=='%' && n>0 && zText[0]=='d' ){
lemon_sprintf(zInt, "%d", p1);
p1 = p2;
lemon_strcpy(&z[used], zInt);
used += lemonStrlen(&z[used]);
zText++;
n--;
}else{
z[used++] = (char)c;
}
}
z[used] = 0;
return z;
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_tlm_received_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int uint16_t ;
typedef scalar_t__ int8_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ version; void* time; void* adv_count; scalar_t__ temperature; void* battery_voltage; } ;
struct TYPE_6__ {TYPE_1__ tlm; } ;
struct TYPE_7__ {TYPE_2__ inform; } ;
typedef TYPE_3__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_TLM_DATA_LEN ;
void* big_endian_read_16 (scalar_t__ const*,scalar_t__) ;
void* big_endian_read_32 (scalar_t__ const*,scalar_t__) ;
__attribute__((used)) static esp_err_t esp_eddystone_tlm_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
uint8_t pos = 0;
if(len >= EDDYSTONE_TLM_DATA_LEN) {
//ERROR:TLM too long
return -1;
}
res->inform.tlm.version = buf[pos++];
res->inform.tlm.battery_voltage = big_endian_read_16(buf, pos);
pos += 2;
uint16_t temp = big_endian_read_16(buf, pos);
int8_t temp_integral = (int8_t)((temp >> 8) | 0xff);
float temp_decimal = (temp & 0xff) / 256.0;
res->inform.tlm.temperature = temp_integral - temp_decimal;
pos += 2;
res->inform.tlm.adv_count = big_endian_read_32(buf, pos);
pos += 4;
res->inform.tlm.time = big_endian_read_32(buf, pos);
return 0;
} |
augmented_data/post_increment_index_changes/extr_i15_decode.c_br_i15_decode_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int br_i15_bit_length (int*,size_t) ;
void
br_i15_decode(uint16_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t v;
uint32_t acc;
int acc_len;
buf = src;
v = 1;
acc = 0;
acc_len = 0;
while (len ++ > 0) {
uint32_t b;
b = buf[len];
acc |= (b << acc_len);
acc_len += 8;
if (acc_len >= 15) {
x[v ++] = acc & 0x7FFF;
acc_len -= 15;
acc >>= 15;
}
}
if (acc_len != 0) {
x[v ++] = acc;
}
x[0] = br_i15_bit_length(x - 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_main.c_strip_escapes_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ PATH_MAX ;
int /*<<< orphan*/ REALLOC (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
char *
strip_escapes(char *s)
{
static char *file = NULL;
static int filesz = 0;
int i = 0;
REALLOC(file, filesz, PATH_MAX, NULL);
while (i <= filesz - 1 /* Worry about a possible trailing escape */
&& (file[i--] = (*s == '\\') ? *++s : *s))
s++;
return file;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.