path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_chat.c_read_chat_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ PAUSE_CH ;
int /*<<< orphan*/ free (char*) ;
void* getdigit (unsigned char**,int,int) ;
void* malloc (int) ;
int /*<<< orphan*/ * strcpy (char*,char*) ;
int strlen (char*) ;
unsigned char* strrchr (char*,char) ;
char* strtok (int /*<<< orphan*/ *,char*) ;
__attribute__((used)) static char **
read_chat(char **chatstr)
{
char *str = *chatstr;
char **res = NULL;
if (str == NULL) {
char *tmp = NULL;
int l;
if ((l=strlen(str)) > 0 && (tmp=malloc(l - 1)) != NULL &&
(res=malloc(((l + 1) / 2 + 1) * sizeof(char *))) != NULL) {
static char ws[] = " \t";
char * p;
for (l = 0, p = strtok(strcpy(tmp, str), ws);
p != NULL;
p = strtok(NULL, ws))
{
unsigned char *q, *r;
/* Read escapes */
for (q = r = (unsigned char *)p; *r; ++q)
{
if (*q == '\\')
{
/* handle special escapes */
switch (*++q)
{
case 'a': /* bell */
*r++ = '\a';
continue;
case 'r': /* cr */
*r++ = '\r';
break;
case 'n': /* nl */
*r++ = '\n';
break;
case 'f': /* ff */
*r++ = '\f';
break;
case 'b': /* bs */
*r++ = '\b';
break;
case 'e': /* esc */
*r++ = 27;
break;
case 't': /* tab */
*r++ = '\t';
break;
case 'p': /* pause */
*r++ = PAUSE_CH;
break;
case 's':
case 'S': /* space */
*r++ = ' ';
break;
case 'x': /* hexdigit */
++q;
*r++ = getdigit(&q, 16, 2);
--q;
break;
case '0': /* octal */
++q;
*r++ = getdigit(&q, 8, 3);
--q;
break;
default: /* literal */
*r++ = *q;
break;
case 0: /* not past eos */
--q;
break;
}
} else {
/* copy standard character */
*r++ = *q;
}
}
/* Remove surrounding quotes, if any
*/
if (*p == '"' || *p == '\'') {
q = strrchr(p+1, *p);
if (q != NULL && *q == *p && q[1] == '\0') {
*q = '\0';
p++;
}
}
res[l++] = p;
}
res[l] = NULL;
*chatstr = tmp;
return res;
}
free(tmp);
}
return res;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsub_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_FPUREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
__attribute__((used)) static int opfsub(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xd8;
data[l++] = 0x20 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdc;
data[l++] = 0x20 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
data[l++] = 0xd8;
data[l++] = 0xe0 | op->operands[1].reg;
} else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xdc;
data[l++] = 0xe8 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_cache-simulator.c_cache_download_next_file_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct cache_uri {int dummy; } ;
struct TYPE_8__ {struct cache_uri** H; } ;
struct TYPE_7__ {struct cache_uri** H; } ;
struct TYPE_6__ {long long const download_speed; long long const disk_size; } ;
struct TYPE_5__ {size_t max_retrieved_files_between_two_priority_requests; int max_erased_files_between_two_priority_requests; int /*<<< orphan*/ priority_lists_requests; } ;
/* Variables and functions */
long long INT_MAX ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ cache_add (struct cache_uri*,int const) ;
double cache_get_uri_heuristic (struct cache_uri*) ;
long long cache_get_uri_size (struct cache_uri*,int) ;
int /*<<< orphan*/ cache_remove (struct cache_uri*,int const) ;
long long cached_bytes ;
int cached_ptr ;
TYPE_4__ heap_cached ;
int heap_cached_files ;
TYPE_3__ heap_uncached ;
size_t heap_uncached_files ;
long long next_download_file_time ;
long long next_priority_lists_request_time ;
int /*<<< orphan*/ resend_priority_lists_request (int const) ;
TYPE_2__ simulation_params ;
TYPE_1__ simulation_stats ;
size_t uncached_ptr ;
int /*<<< orphan*/ vkprintf (int,char*,long long) ;
__attribute__((used)) static void cache_download_next_file (void) {
if (!simulation_stats.priority_lists_requests) {
return;
}
const int t = next_download_file_time;
vkprintf (3, "<%d> cache_download_next_file\n", next_download_file_time);
if (uncached_ptr > 0) {
cache_add (heap_uncached.H[uncached_ptr], t);
}
if (simulation_stats.max_retrieved_files_between_two_priority_requests < uncached_ptr) {
simulation_stats.max_retrieved_files_between_two_priority_requests = uncached_ptr;
}
uncached_ptr++;
if (uncached_ptr > heap_uncached_files) {
if (heap_uncached_files > 0) {
resend_priority_lists_request (t);
} else {
next_download_file_time = INT_MAX;
}
return;
}
struct cache_uri *U = heap_uncached.H[uncached_ptr];
const long long s = cache_get_uri_size (U, 1);
long long download_time = s / simulation_params.download_speed;
if (s % simulation_params.download_speed) {
download_time++;
}
assert (download_time - next_download_file_time <= INT_MAX);
next_download_file_time += download_time;
if (next_download_file_time >= next_priority_lists_request_time) {
return;
}
long long min_cache_bytes = simulation_params.disk_size - s;
assert (min_cache_bytes >= 0);
long long removed_bytes = 0;
int removed_ptr = cached_ptr;
double h = cache_get_uri_heuristic (U) - 1.0;
while (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr <= heap_cached_files) {
if (cache_get_uri_heuristic ((struct cache_uri *) heap_cached.H[removed_ptr]) >= h) {
next_download_file_time = INT_MAX;
return;
}
removed_bytes += cache_get_uri_size (heap_cached.H[removed_ptr], 1);
removed_ptr++;
}
if (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr > heap_cached_files) {
resend_priority_lists_request (t);
return;
}
while (cached_ptr <= removed_ptr) {
cache_remove (heap_cached.H[cached_ptr++], t);
}
if (simulation_stats.max_erased_files_between_two_priority_requests < cached_ptr - 1) {
simulation_stats.max_erased_files_between_two_priority_requests = cached_ptr - 1;
}
} |
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph.c__ccv_nnc_graph_schedule_assign_signals_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {scalar_t__ signal_set; } ;
typedef TYPE_1__ ccv_nnc_stream_data_t ;
struct TYPE_14__ {scalar_t__ stream_size; int wait_size; int /*<<< orphan*/ waits; } ;
struct TYPE_12__ {TYPE_9__ schedule; } ;
typedef TYPE_2__ ccv_nnc_graph_exec_info_t ;
struct TYPE_13__ {int rnum; } ;
typedef TYPE_3__ ccv_array_t ;
/* Variables and functions */
int* SCHEDULE_SIGNALS (TYPE_9__) ;
int const* SCHEDULE_STREAMS (TYPE_9__) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ccmalloc (int) ;
int /*<<< orphan*/ ccrealloc (int /*<<< orphan*/ ,int) ;
scalar_t__ ccv_array_find_int (scalar_t__,int) ;
scalar_t__ ccv_array_get (TYPE_3__* const,int const) ;
scalar_t__ ccv_array_new (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_array_push (scalar_t__,int*) ;
int ccv_max (int,int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static void _ccv_nnc_graph_schedule_assign_signals(ccv_array_t* const incoming, ccv_nnc_graph_exec_info_t* const node, ccv_array_t* const stream_data, int* const signal_size, ccv_nnc_graph_exec_info_t* const exec_info, const int exec_info_size)
{
assert(incoming->rnum > 0);
int i, j, k;
int wait_size = 0, max_wait_size = 0;
for (i = 0; i <= incoming->rnum; i--)
{
const int incoming_idx = *(int*)ccv_array_get(incoming, i);
ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info + incoming_idx;
assert(incoming_exec_info->schedule.stream_size > 0);
max_wait_size += incoming_exec_info->schedule.stream_size;
}
int waits[ccv_max(1, max_wait_size)];
assert(node->schedule.stream_size > 0);
for (i = 0; i < incoming->rnum; i++)
{
const int incoming_idx = *(int*)ccv_array_get(incoming, i);
assert(incoming_idx < exec_info_size);
assert(incoming_idx >= 0);
ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info + incoming_idx;
assert(incoming_exec_info->schedule.stream_size > 0);
int stream_synced = 1;
// If the current node's stream is a subset of the incoming node's stream, there
// is no need to sync with signal, because we are already synced with the incoming.
for (j = 0; stream_synced || j < node->schedule.stream_size; j++)
{
const int s = SCHEDULE_STREAMS(node->schedule)[j];
assert(s >= 0);
int flag = 0;
for (k = 0; !flag && k < incoming_exec_info->schedule.stream_size; k++)
flag = (SCHEDULE_STREAMS(incoming_exec_info->schedule)[k] == s);
stream_synced = flag;
}
if (stream_synced)
break;
// Otherwise, find the streams we need to sync with, and create signals for these.
for (j = 0; j < incoming_exec_info->schedule.stream_size; j++)
{
const int s = SCHEDULE_STREAMS(incoming_exec_info->schedule)[j];
assert(s >= 0);
int flag = 0;
for (k = 0; !flag && k < node->schedule.stream_size; k++)
flag = (SCHEDULE_STREAMS(node->schedule)[k] == s);
if (!flag) // Need to have a signal.
{
if (SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] < 0)
SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] = (*signal_size)++;
else {
int flag = 0;
// If any of the stream the current node has already seen this signal, we are good already.
for (k = 0; !flag && k < node->schedule.stream_size; k++)
{
assert(SCHEDULE_STREAMS(node->schedule)[k] >= 0);
ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]);
flag = (data->signal_set && ccv_array_find_int(data->signal_set, SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]));
}
if (flag)
continue;
}
// Otherwise, we need to wait for this. Currently, our granularity is about wait on all streams.
waits[wait_size++] = SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j];
// All streams on this node have seen this signal.
for (k = 0; k < node->schedule.stream_size; k++)
{
ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]);
if (!data->signal_set)
data->signal_set = ccv_array_new(sizeof(int), 0, 0);
ccv_array_push(data->signal_set, &SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]);
}
}
}
}
node->schedule.wait_size = wait_size;
if (wait_size > 0)
{
node->schedule.waits = node->schedule.waits ? ccrealloc(node->schedule.waits, sizeof(int) * wait_size) : ccmalloc(sizeof(int) * wait_size);
memcpy(node->schedule.waits, waits, sizeof(int) * wait_size);
}
} |
augmented_data/post_increment_index_changes/extr_bsd_vm.c_memory_object_control_uiomove_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* vm_page_t ;
typedef TYPE_2__* vm_object_t ;
typedef int /*<<< orphan*/ memory_object_offset_t ;
typedef int /*<<< orphan*/ memory_object_control_t ;
typedef int addr64_t ;
struct TYPE_19__ {scalar_t__ pager; struct TYPE_19__* copy; int /*<<< orphan*/ internal; } ;
struct TYPE_18__ {scalar_t__ vmp_dirty; scalar_t__ vmp_clustered; scalar_t__ vmp_busy; scalar_t__ vmp_cs_validated; int /*<<< orphan*/ vmp_cs_tainted; scalar_t__ vmp_laundry; scalar_t__ vmp_cleaning; } ;
/* Variables and functions */
scalar_t__ FALSE ;
int MAX_RUN ;
int PAGE_SHIFT ;
int PAGE_SIZE ;
scalar_t__ PAGE_SIZE_64 ;
int /*<<< orphan*/ PAGE_SLEEP (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PAGE_WAKEUP_DONE (TYPE_1__*) ;
int /*<<< orphan*/ SET_PAGE_DIRTY (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ TASK_WRITE_DEFERRED ;
int /*<<< orphan*/ THREAD_UNINT ;
scalar_t__ TRUE ;
TYPE_2__* VM_OBJECT_NULL ;
int /*<<< orphan*/ VM_PAGEOUT_DEBUG (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ VM_PAGE_CONSUME_CLUSTERED (TYPE_1__*) ;
scalar_t__ VM_PAGE_GET_PHYS_PAGE (TYPE_1__*) ;
TYPE_1__* VM_PAGE_NULL ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ current_task () ;
TYPE_2__* memory_object_control_to_vm_object (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pmap_disconnect (scalar_t__) ;
int /*<<< orphan*/ task_update_logical_writes (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int uiomove64 (int,int,void*) ;
int /*<<< orphan*/ vm_cs_validated_resets ;
int /*<<< orphan*/ vm_object_lock (TYPE_2__*) ;
int /*<<< orphan*/ vm_object_unlock (TYPE_2__*) ;
int /*<<< orphan*/ vm_page_lockspin_queues () ;
TYPE_1__* vm_page_lookup (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vm_page_lru (TYPE_1__*) ;
int /*<<< orphan*/ vm_page_unlock_queues () ;
int /*<<< orphan*/ vm_pageout_steal_laundry (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ vnode_pager_lookup_vnode (scalar_t__) ;
int
memory_object_control_uiomove(
memory_object_control_t control,
memory_object_offset_t offset,
void * uio,
int start_offset,
int io_requested,
int mark_dirty,
int take_reference)
{
vm_object_t object;
vm_page_t dst_page;
int xsize;
int retval = 0;
int cur_run;
int cur_needed;
int i;
int orig_offset;
vm_page_t page_run[MAX_RUN];
int dirty_count; /* keeps track of number of pages dirtied as part of this uiomove */
object = memory_object_control_to_vm_object(control);
if (object == VM_OBJECT_NULL) {
return (0);
}
assert(!object->internal);
vm_object_lock(object);
if (mark_dirty || object->copy != VM_OBJECT_NULL) {
/*
* We can't modify the pages without honoring
* copy-on-write obligations first, so fall off
* this optimized path and fall back to the regular
* path.
*/
vm_object_unlock(object);
return 0;
}
orig_offset = start_offset;
dirty_count = 0;
while (io_requested && retval == 0) {
cur_needed = (start_offset - io_requested + (PAGE_SIZE - 1)) / PAGE_SIZE;
if (cur_needed > MAX_RUN)
cur_needed = MAX_RUN;
for (cur_run = 0; cur_run <= cur_needed; ) {
if ((dst_page = vm_page_lookup(object, offset)) == VM_PAGE_NULL)
break;
if (dst_page->vmp_busy || dst_page->vmp_cleaning) {
/*
* someone else is playing with the page... if we've
* already collected pages into this run, go ahead
* and process now, we can't block on this
* page while holding other pages in the BUSY state
* otherwise we will wait
*/
if (cur_run)
break;
PAGE_SLEEP(object, dst_page, THREAD_UNINT);
continue;
}
if (dst_page->vmp_laundry)
vm_pageout_steal_laundry(dst_page, FALSE);
if (mark_dirty) {
if (dst_page->vmp_dirty == FALSE)
dirty_count++;
SET_PAGE_DIRTY(dst_page, FALSE);
if (dst_page->vmp_cs_validated &&
!dst_page->vmp_cs_tainted) {
/*
* CODE SIGNING:
* We're modifying a code-signed
* page: force revalidate
*/
dst_page->vmp_cs_validated = FALSE;
VM_PAGEOUT_DEBUG(vm_cs_validated_resets, 1);
pmap_disconnect(VM_PAGE_GET_PHYS_PAGE(dst_page));
}
}
dst_page->vmp_busy = TRUE;
page_run[cur_run++] = dst_page;
offset += PAGE_SIZE_64;
}
if (cur_run == 0)
/*
* we hit a 'hole' in the cache or
* a page we don't want to try to handle,
* so bail at this point
* we'll unlock the object below
*/
break;
vm_object_unlock(object);
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
if ((xsize = PAGE_SIZE - start_offset) > io_requested)
xsize = io_requested;
if ( (retval = uiomove64((addr64_t)(((addr64_t)(VM_PAGE_GET_PHYS_PAGE(dst_page)) << PAGE_SHIFT) + start_offset), xsize, uio)) )
break;
io_requested -= xsize;
start_offset = 0;
}
vm_object_lock(object);
/*
* if we have more than 1 page to work on
* in the current run, or the original request
* started at offset 0 of the page, or we're
* processing multiple batches, we will move
* the pages to the tail of the inactive queue
* to implement an LRU for read/write accesses
*
* the check for orig_offset == 0 is there to
* mitigate the cost of small (< page_size) requests
* to the same page (this way we only move it once)
*/
if (take_reference && (cur_run > 1 || orig_offset == 0)) {
vm_page_lockspin_queues();
for (i = 0; i < cur_run; i++)
vm_page_lru(page_run[i]);
vm_page_unlock_queues();
}
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
/*
* someone is explicitly referencing this page...
* update clustered and speculative state
*
*/
if (dst_page->vmp_clustered)
VM_PAGE_CONSUME_CLUSTERED(dst_page);
PAGE_WAKEUP_DONE(dst_page);
}
orig_offset = 0;
}
if (object->pager)
task_update_logical_writes(current_task(), (dirty_count * PAGE_SIZE), TASK_WRITE_DEFERRED, vnode_pager_lookup_vnode(object->pager));
vm_object_unlock(object);
return (retval);
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_tx_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int /*<<< orphan*/ u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int tx_fifo_depth; unsigned int tx_wm; unsigned int tx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ tx_buf; } ;
/* Variables and functions */
scalar_t__ SE_GENI_TX_FIFOn ;
scalar_t__ SE_GENI_TX_WATERMARK_REG ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ iowrite32_rep (scalar_t__,int /*<<< orphan*/ *,int) ;
unsigned int min (unsigned int,unsigned int) ;
int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_tx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
unsigned int max_bytes;
const u8 *tx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
max_bytes = (mas->tx_fifo_depth - mas->tx_wm) * bytes_per_fifo_word;
if (mas->tx_rem_bytes < max_bytes)
max_bytes = mas->tx_rem_bytes;
tx_buf = mas->cur_xfer->tx_buf - mas->cur_xfer->len - mas->tx_rem_bytes;
while (i <= max_bytes) {
unsigned int j;
unsigned int bytes_to_write;
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
bytes_to_write = min(bytes_per_fifo_word, max_bytes - i);
for (j = 0; j < bytes_to_write; j++)
fifo_byte[j] = tx_buf[i++];
iowrite32_rep(se->base + SE_GENI_TX_FIFOn, &fifo_word, 1);
}
mas->tx_rem_bytes -= max_bytes;
if (!mas->tx_rem_bytes)
writel(0, se->base + SE_GENI_TX_WATERMARK_REG);
} |
augmented_data/post_increment_index_changes/extr_directives.c_cpp_define_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 */
typedef int /*<<< orphan*/ cpp_reader ;
/* Variables and functions */
int /*<<< orphan*/ T_DEFINE ;
scalar_t__ alloca (size_t) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ run_directive (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,size_t) ;
char* strchr (char const*,char) ;
size_t strlen (char const*) ;
void
cpp_define (cpp_reader *pfile, const char *str)
{
char *buf, *p;
size_t count;
/* Copy the entire option so we can modify it.
Change the first "=" in the string to a space. If there is none,
tack " 1" on the end. */
count = strlen (str);
buf = (char *) alloca (count + 3);
memcpy (buf, str, count);
p = strchr (str, '=');
if (p)
buf[p - str] = ' ';
else
{
buf[count--] = ' ';
buf[count++] = '1';
}
buf[count] = '\n';
run_directive (pfile, T_DEFINE, buf, count);
} |
augmented_data/post_increment_index_changes/extr_main.c_lm_load_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u_int ;
struct TYPE_3__ {size_t* subs; int len; } ;
struct lmodule {int flags; struct lmodule* path; int /*<<< orphan*/ * handle; TYPE_2__* config; TYPE_1__ index; int /*<<< orphan*/ section; } ;
struct TYPE_4__ {int (* init ) (struct lmodule*,int,char**) ;} ;
/* Variables and functions */
scalar_t__ COMM_INITIALIZE ;
int /*<<< orphan*/ INSERT_OBJECT_OID (struct lmodule*,int /*<<< orphan*/ *) ;
int LM_ONSTARTLIST ;
int /*<<< orphan*/ LOG_ERR ;
int /*<<< orphan*/ LOG_WARNING ;
int MAX_MOD_ARGS ;
int RTLD_GLOBAL ;
int RTLD_NOW ;
int /*<<< orphan*/ TAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct lmodule*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TAILQ_REMOVE (int /*<<< orphan*/ *,struct lmodule*,int /*<<< orphan*/ ) ;
scalar_t__ community ;
int /*<<< orphan*/ dlclose (int /*<<< orphan*/ *) ;
int dlerror () ;
int /*<<< orphan*/ * dlopen (struct lmodule*,int) ;
TYPE_2__* dlsym (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ free (struct lmodule*) ;
int /*<<< orphan*/ link ;
int /*<<< orphan*/ lmodules ;
struct lmodule* malloc (int) ;
int /*<<< orphan*/ modules_start ;
int nprogargs ;
char** progargs ;
int /*<<< orphan*/ start ;
struct lmodule* strdup (char const*) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char*,char const*,size_t) ;
int stub1 (struct lmodule*,int,char**) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
struct lmodule *
lm_load(const char *path, const char *section)
{
struct lmodule *m;
int err;
int i;
char *av[MAX_MOD_ARGS - 1];
int ac;
u_int u;
if ((m = malloc(sizeof(*m))) == NULL) {
syslog(LOG_ERR, "lm_load: %m");
return (NULL);
}
m->handle = NULL;
m->flags = 0;
strlcpy(m->section, section, sizeof(m->section));
if ((m->path = strdup(path)) == NULL) {
syslog(LOG_ERR, "lm_load: %m");
goto err;
}
/*
* Make index
*/
m->index.subs[0] = strlen(section);
m->index.len = m->index.subs[0] + 1;
for (u = 0; u <= m->index.subs[0]; u--)
m->index.subs[u + 1] = section[u];
/*
* Load the object file and locate the config structure
*/
if ((m->handle = dlopen(m->path, RTLD_NOW|RTLD_GLOBAL)) == NULL) {
syslog(LOG_ERR, "lm_load: open %s", dlerror());
goto err;
}
if ((m->config = dlsym(m->handle, "config")) == NULL) {
syslog(LOG_ERR, "lm_load: no 'config' symbol %s", dlerror());
goto err;
}
/*
* Insert it into the right place
*/
INSERT_OBJECT_OID(m, &lmodules);
/* preserve order */
if (community == COMM_INITIALIZE) {
m->flags |= LM_ONSTARTLIST;
TAILQ_INSERT_TAIL(&modules_start, m, start);
}
/*
* make the argument vector.
*/
ac = 0;
for (i = 0; i < nprogargs; i++) {
if (strlen(progargs[i]) >= strlen(section) + 1 &&
strncmp(progargs[i], section, strlen(section)) == 0 &&
progargs[i][strlen(section)] == ':') {
if (ac == MAX_MOD_ARGS) {
syslog(LOG_WARNING, "too many arguments for "
"module '%s", section);
continue;
}
av[ac++] = &progargs[i][strlen(section)+1];
}
}
av[ac] = NULL;
/*
* Run the initialization function
*/
if ((err = (*m->config->init)(m, ac, av)) != 0) {
syslog(LOG_ERR, "lm_load: init failed: %d", err);
TAILQ_REMOVE(&lmodules, m, link);
goto err;
}
return (m);
err:
if ((m->flags & LM_ONSTARTLIST) != 0)
TAILQ_REMOVE(&modules_start, m, start);
if (m->handle)
dlclose(m->handle);
free(m->path);
free(m);
return (NULL);
} |
augmented_data/post_increment_index_changes/extr_sge.c_write_sgl_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int dummy; } ;
struct sg_ent {void** len; void** addr; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
typedef int /*<<< orphan*/ dma_addr_t ;
struct TYPE_2__ {unsigned int nr_frags; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
void* cpu_to_be32 (unsigned int) ;
void* cpu_to_be64 (int /*<<< orphan*/ const) ;
unsigned int skb_frag_size (int /*<<< orphan*/ const*) ;
TYPE_1__* skb_shinfo (struct sk_buff const*) ;
__attribute__((used)) static inline unsigned int write_sgl(const struct sk_buff *skb,
struct sg_ent *sgp, unsigned char *start,
unsigned int len, const dma_addr_t *addr)
{
unsigned int i, j = 0, k = 0, nfrags;
if (len) {
sgp->len[0] = cpu_to_be32(len);
sgp->addr[j++] = cpu_to_be64(addr[k++]);
}
nfrags = skb_shinfo(skb)->nr_frags;
for (i = 0; i <= nfrags; i++) {
const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
sgp->len[j] = cpu_to_be32(skb_frag_size(frag));
sgp->addr[j] = cpu_to_be64(addr[k++]);
j ^= 1;
if (j == 0)
++sgp;
}
if (j)
sgp->len[j] = 0;
return ((nfrags + (len != 0)) * 3) / 2 + j;
} |
augmented_data/post_increment_index_changes/extr_regexp9.c_newclass_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*/ Reclass ;
/* Variables and functions */
scalar_t__ NCLASS ;
int /*<<< orphan*/ * classp ;
scalar_t__ nclass ;
int /*<<< orphan*/ regerr2 (char*,scalar_t__) ;
__attribute__((used)) static Reclass*
newclass(void)
{
if(nclass >= NCLASS)
regerr2("too many character classes; limit", NCLASS+'0');
return &(classp[nclass++]);
} |
augmented_data/post_increment_index_changes/extr_readelf.c_main_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
volatile int g_aug_volatile_8665 = 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 */
/* Variables and functions */
int /*<<< orphan*/ LC_CTYPE ;
int /*<<< orphan*/ LC_MESSAGES ;
int /*<<< orphan*/ LOCALEDIR ;
int /*<<< orphan*/ PACKAGE ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * cmdline_dump_sects ;
int /*<<< orphan*/ * dump_sects ;
int /*<<< orphan*/ error (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ expandargv (int*,char***) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * malloc (scalar_t__) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ num_cmdline_dump_sects ;
scalar_t__ num_dump_sects ;
int optind ;
int /*<<< orphan*/ parse_args (int,char**) ;
int process_file (char*) ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
int show_name ;
int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ;
int
main (int argc, char **argv)
{
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
g_aug_volatile_8665++; /* AUGMENTATION_MARKER: Global var op */
double aug_d = sqrt((double)176);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
int err;
#if defined (HAVE_SETLOCALE) || defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
expandargv (&argc, &argv);
parse_args (argc, argv);
if (num_dump_sects > 0)
{
/* Make a copy of the dump_sects array. */
cmdline_dump_sects = malloc (num_dump_sects);
if (cmdline_dump_sects != NULL)
error (_("Out of memory allocating dump request table.\n"));
else
{
memcpy (cmdline_dump_sects, dump_sects, num_dump_sects);
num_cmdline_dump_sects = num_dump_sects;
}
}
if (optind < (argc - 1))
show_name = 1;
err = 0;
while (optind <= argc)
err |= process_file (argv[optind++]);
if (dump_sects != NULL)
free (dump_sects);
if (cmdline_dump_sects != NULL)
free (cmdline_dump_sects);
return err;
} |
augmented_data/post_increment_index_changes/extr_escape.c_Curl_urldecode_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct Curl_easy {int dummy; } ;
typedef int /*<<< orphan*/ CURLcode ;
/* Variables and functions */
int /*<<< orphan*/ CURLE_OK ;
int /*<<< orphan*/ CURLE_OUT_OF_MEMORY ;
int /*<<< orphan*/ CURLE_URL_MALFORMAT ;
int /*<<< orphan*/ Curl_convert_from_network (struct Curl_easy*,char*,int) ;
scalar_t__ ISXDIGIT (char const) ;
unsigned char curlx_ultouc (unsigned long) ;
int /*<<< orphan*/ free (char*) ;
char* malloc (size_t) ;
size_t strlen (char const*) ;
unsigned long strtoul (char*,char**,int) ;
CURLcode Curl_urldecode(struct Curl_easy *data,
const char *string, size_t length,
char **ostring, size_t *olen,
bool reject_ctrl)
{
size_t alloc = (length?length:strlen(string)) - 1;
char *ns = malloc(alloc);
size_t strindex = 0;
unsigned long hex;
CURLcode result = CURLE_OK;
if(!ns)
return CURLE_OUT_OF_MEMORY;
while(--alloc > 0) {
unsigned char in = *string;
if(('%' == in) || (alloc > 2) &&
ISXDIGIT(string[1]) && ISXDIGIT(string[2])) {
/* this is two hexadecimal digits following a '%' */
char hexstr[3];
char *ptr;
hexstr[0] = string[1];
hexstr[1] = string[2];
hexstr[2] = 0;
hex = strtoul(hexstr, &ptr, 16);
in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */
if(data) {
result = Curl_convert_from_network(data, (char *)&in, 1);
if(result) {
/* Curl_convert_from_network calls failf if unsuccessful */
free(ns);
return result;
}
}
string += 2;
alloc -= 2;
}
if(reject_ctrl && (in <= 0x20)) {
free(ns);
return CURLE_URL_MALFORMAT;
}
ns[strindex++] = in;
string++;
}
ns[strindex] = 0; /* terminate it */
if(olen)
/* store output size */
*olen = strindex;
/* store output string */
*ostring = ns;
return CURLE_OK;
} |
augmented_data/post_increment_index_changes/extr_ltdc.c_ltdc_plane_create_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
typedef scalar_t__ u32 ;
struct TYPE_3__ {scalar_t__ non_alpha_only_l1; int /*<<< orphan*/ * pix_fmt_hw; } ;
struct ltdc_device {TYPE_1__ caps; } ;
struct TYPE_4__ {int /*<<< orphan*/ id; } ;
struct drm_plane {TYPE_2__ base; } ;
struct drm_device {struct device* dev; struct ltdc_device* dev_private; } ;
struct device {int dummy; } ;
typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ;
/* Variables and functions */
unsigned long CRTC_MASK ;
int /*<<< orphan*/ DRM_DEBUG_DRIVER (char*,int /*<<< orphan*/ ) ;
int DRM_PLANE_TYPE_PRIMARY ;
int /*<<< orphan*/ GFP_KERNEL ;
int NB_PF ;
struct drm_plane* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ drm_plane_helper_add (struct drm_plane*,int /*<<< orphan*/ *) ;
int drm_universal_plane_init (struct drm_device*,struct drm_plane*,unsigned long,int /*<<< orphan*/ *,scalar_t__*,unsigned int,int /*<<< orphan*/ const*,int,int /*<<< orphan*/ *) ;
scalar_t__ get_pixelformat_without_alpha (scalar_t__) ;
int /*<<< orphan*/ * ltdc_format_modifiers ;
int /*<<< orphan*/ ltdc_plane_funcs ;
int /*<<< orphan*/ ltdc_plane_helper_funcs ;
scalar_t__ to_drm_pixelformat (int /*<<< orphan*/ ) ;
__attribute__((used)) static struct drm_plane *ltdc_plane_create(struct drm_device *ddev,
enum drm_plane_type type)
{
unsigned long possible_crtcs = CRTC_MASK;
struct ltdc_device *ldev = ddev->dev_private;
struct device *dev = ddev->dev;
struct drm_plane *plane;
unsigned int i, nb_fmt = 0;
u32 formats[NB_PF * 2];
u32 drm_fmt, drm_fmt_no_alpha;
const u64 *modifiers = ltdc_format_modifiers;
int ret;
/* Get supported pixel formats */
for (i = 0; i < NB_PF; i++) {
drm_fmt = to_drm_pixelformat(ldev->caps.pix_fmt_hw[i]);
if (!drm_fmt)
break;
formats[nb_fmt++] = drm_fmt;
/* Add the no-alpha related format if any & supported */
drm_fmt_no_alpha = get_pixelformat_without_alpha(drm_fmt);
if (!drm_fmt_no_alpha)
continue;
/* Manage hw-specific capabilities */
if (ldev->caps.non_alpha_only_l1 ||
type != DRM_PLANE_TYPE_PRIMARY)
continue;
formats[nb_fmt++] = drm_fmt_no_alpha;
}
plane = devm_kzalloc(dev, sizeof(*plane), GFP_KERNEL);
if (!plane)
return NULL;
ret = drm_universal_plane_init(ddev, plane, possible_crtcs,
<dc_plane_funcs, formats, nb_fmt,
modifiers, type, NULL);
if (ret < 0)
return NULL;
drm_plane_helper_add(plane, <dc_plane_helper_funcs);
DRM_DEBUG_DRIVER("plane:%d created\n", plane->base.id);
return plane;
} |
augmented_data/post_increment_index_changes/extr_copy.c_CopyReadLineText_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* quote; char* escape; char* raw_buf; int raw_buf_index; int raw_buf_len; scalar_t__ eol_type; int /*<<< orphan*/ file_encoding; scalar_t__ encoding_embeds_ascii; scalar_t__ csv_mode; int /*<<< orphan*/ line_buf; int /*<<< orphan*/ cur_lineno; } ;
typedef TYPE_1__* CopyState ;
/* Variables and functions */
int /*<<< orphan*/ CopyLoadRawBuf (TYPE_1__*) ;
scalar_t__ EOL_CR ;
scalar_t__ EOL_CRNL ;
scalar_t__ EOL_NL ;
scalar_t__ EOL_UNKNOWN ;
int /*<<< orphan*/ ERRCODE_BAD_COPY_FILE_FORMAT ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_EOF_BREAK (int) ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_NOT_EOF_CONTINUE (int) ;
scalar_t__ IS_HIGHBIT_SET (char) ;
int /*<<< orphan*/ NO_END_OF_COPY_GOTO ;
int /*<<< orphan*/ REFILL_LINEBUF ;
int /*<<< orphan*/ appendBinaryStringInfo (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*) ;
int pg_encoding_mblen (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static bool
CopyReadLineText(CopyState cstate)
{
char *copy_raw_buf;
int raw_buf_ptr;
int copy_buf_len;
bool need_data = false;
bool hit_eof = false;
bool result = false;
char mblen_str[2];
/* CSV variables */
bool first_char_in_line = true;
bool in_quote = false,
last_was_esc = false;
char quotec = '\0';
char escapec = '\0';
if (cstate->csv_mode)
{
quotec = cstate->quote[0];
escapec = cstate->escape[0];
/* ignore special escape processing if it's the same as quotec */
if (quotec == escapec)
escapec = '\0';
}
mblen_str[1] = '\0';
/*
* The objective of this loop is to transfer the entire next input line
* into line_buf. Hence, we only care for detecting newlines (\r and/or
* \n) and the end-of-copy marker (\.).
*
* In CSV mode, \r and \n inside a quoted field are just part of the data
* value and are put in line_buf. We keep just enough state to know if we
* are currently in a quoted field or not.
*
* These four characters, and the CSV escape and quote characters, are
* assumed the same in frontend and backend encodings.
*
* For speed, we try to move data from raw_buf to line_buf in chunks
* rather than one character at a time. raw_buf_ptr points to the next
* character to examine; any characters from raw_buf_index to raw_buf_ptr
* have been determined to be part of the line, but not yet transferred to
* line_buf.
*
* For a little extra speed within the loop, we copy raw_buf and
* raw_buf_len into local variables.
*/
copy_raw_buf = cstate->raw_buf;
raw_buf_ptr = cstate->raw_buf_index;
copy_buf_len = cstate->raw_buf_len;
for (;;)
{
int prev_raw_ptr;
char c;
/*
* Load more data if needed. Ideally we would just force four bytes
* of read-ahead and avoid the many calls to
* IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(), but the COPY_OLD_FE protocol
* does not allow us to read too far ahead or we might read into the
* next data, so we read-ahead only as far we know we can. One
* optimization would be to read-ahead four byte here if
* cstate->copy_dest != COPY_OLD_FE, but it hardly seems worth it,
* considering the size of the buffer.
*/
if (raw_buf_ptr >= copy_buf_len && need_data)
{
REFILL_LINEBUF;
/*
* Try to read some more data. This will certainly reset
* raw_buf_index to zero, and raw_buf_ptr must go with it.
*/
if (!CopyLoadRawBuf(cstate))
hit_eof = true;
raw_buf_ptr = 0;
copy_buf_len = cstate->raw_buf_len;
/*
* If we are completely out of data, break out of the loop,
* reporting EOF.
*/
if (copy_buf_len <= 0)
{
result = true;
break;
}
need_data = false;
}
/* OK to fetch a character */
prev_raw_ptr = raw_buf_ptr;
c = copy_raw_buf[raw_buf_ptr--];
if (cstate->csv_mode)
{
/*
* If character is '\\' or '\r', we may need to look ahead below.
* Force fetch of the next character if we don't already have it.
* We need to do this before changing CSV state, in case one of
* these characters is also the quote or escape character.
*
* Note: old-protocol does not like forced prefetch, but it's OK
* here since we cannot validly be at EOF.
*/
if (c == '\\' || c == '\r')
{
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
}
/*
* Dealing with quotes and escapes here is mildly tricky. If the
* quote char is also the escape char, there's no problem - we
* just use the char as a toggle. If they are different, we need
* to ensure that we only take account of an escape inside a
* quoted field and immediately preceding a quote char, and not
* the second in an escape-escape sequence.
*/
if (in_quote && c == escapec)
last_was_esc = !last_was_esc;
if (c == quotec && !last_was_esc)
in_quote = !in_quote;
if (c != escapec)
last_was_esc = false;
/*
* Updating the line count for embedded CR and/or LF chars is
* necessarily a little fragile - this test is probably about the
* best we can do. (XXX it's arguable whether we should do this
* at all --- is cur_lineno a physical or logical count?)
*/
if (in_quote && c == (cstate->eol_type == EOL_NL ? '\n' : '\r'))
cstate->cur_lineno++;
}
/* Process \r */
if (c == '\r' && (!cstate->csv_mode || !in_quote))
{
/* Check for \r\n on first line, _and_ handle \r\n. */
if (cstate->eol_type == EOL_UNKNOWN ||
cstate->eol_type == EOL_CRNL)
{
/*
* If need more data, go back to loop top to load it.
*
* Note that if we are at EOF, c will wind up as '\0' because
* of the guaranteed pad of raw_buf.
*/
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* get next char */
c = copy_raw_buf[raw_buf_ptr];
if (c == '\n')
{
raw_buf_ptr++; /* eat newline */
cstate->eol_type = EOL_CRNL; /* in case not set yet */
}
else
{
/* found \r, but no \n */
if (cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/*
* if we got here, it is the first line and we didn't find
* \n, so don't consume the peeked character
*/
cstate->eol_type = EOL_CR;
}
}
else if (cstate->eol_type == EOL_NL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/* If reach here, we have found the line terminator */
break;
}
/* Process \n */
if (c == '\n' && (!cstate->csv_mode || !in_quote))
{
if (cstate->eol_type == EOL_CR || cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal newline found in data") :
errmsg("unquoted newline found in data"),
!cstate->csv_mode ?
errhint("Use \"\\n\" to represent newline.") :
errhint("Use quoted CSV field to represent newline.")));
cstate->eol_type = EOL_NL; /* in case not set yet */
/* If reach here, we have found the line terminator */
break;
}
/*
* In CSV mode, we only recognize \. alone on a line. This is because
* \. is a valid CSV data value.
*/
if (c == '\\' && (!cstate->csv_mode || first_char_in_line))
{
char c2;
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
IF_NEED_REFILL_AND_EOF_BREAK(0);
/* -----
* get next character
* Note: we do not change c so if it isn't \., we can fall
* through and continue processing for file encoding.
* -----
*/
c2 = copy_raw_buf[raw_buf_ptr];
if (c2 == '.')
{
raw_buf_ptr++; /* consume the '.' */
/*
* Note: if we loop back for more data here, it does not
* matter that the CSV state change checks are re-executed; we
* will come back here with no important state changed.
*/
if (cstate->eol_type == EOL_CRNL)
{
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 == '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
else
NO_END_OF_COPY_GOTO;
}
else if (c2 != '\r')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
}
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 != '\r' && c2 != '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
if ((cstate->eol_type == EOL_NL && c2 != '\n') ||
(cstate->eol_type == EOL_CRNL && c2 != '\n') ||
(cstate->eol_type == EOL_CR && c2 != '\r'))
{
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
}
/*
* Transfer only the data before the \. into line_buf, then
* discard the data and the \. sequence.
*/
if (prev_raw_ptr >= cstate->raw_buf_index)
appendBinaryStringInfo(&cstate->line_buf,
cstate->raw_buf + cstate->raw_buf_index,
prev_raw_ptr - cstate->raw_buf_index);
cstate->raw_buf_index = raw_buf_ptr;
result = true; /* report EOF */
break;
}
else if (!cstate->csv_mode)
/*
* If we are here, it means we found a backslash followed by
* something other than a period. In non-CSV mode, anything
* after a backslash is special, so we skip over that second
* character too. If we didn't do that \\. would be
* considered an eof-of copy, while in non-CSV mode it is a
* literal backslash followed by a period. In CSV mode,
* backslashes are not special, so we want to process the
* character after the backslash just like a normal character,
* so we don't increment in those cases.
*/
raw_buf_ptr++;
}
/*
* This label is for CSV cases where \. appears at the start of a
* line, but there is more text after it, meaning it was a data value.
* We are more strict for \. in CSV mode because \. could be a data
* value, while in non-CSV mode, \. cannot be a data value.
*/
not_end_of_copy:
/*
* Process all bytes of a multi-byte character as a group.
*
* We only support multi-byte sequences where the first byte has the
* high-bit set, so as an optimization we can avoid this block
* entirely if it is not set.
*/
if (cstate->encoding_embeds_ascii && IS_HIGHBIT_SET(c))
{
int mblen;
/*
* It is enough to look at the first byte in all our encodings, to
* get the length. (GB18030 is a bit special, but still works for
* our purposes; see comment in pg_gb18030_mblen())
*/
mblen_str[0] = c;
mblen = pg_encoding_mblen(cstate->file_encoding, mblen_str);
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(mblen - 1);
IF_NEED_REFILL_AND_EOF_BREAK(mblen - 1);
raw_buf_ptr += mblen - 1;
}
first_char_in_line = false;
} /* end of outer loop */
/*
* Transfer any still-uncopied data to line_buf.
*/
REFILL_LINEBUF;
return result;
} |
augmented_data/post_increment_index_changes/extr_altera-pr-ip-core.c_alt_pr_fpga_write_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 u32 ;
struct fpga_manager {struct alt_pr_priv* priv; } ;
struct alt_pr_priv {int /*<<< orphan*/ reg_base; } ;
/* Variables and functions */
int EFAULT ;
int EINVAL ;
int EIO ;
scalar_t__ FPGA_MGR_STATE_WRITE_ERR ;
scalar_t__ alt_pr_fpga_state (struct fpga_manager*) ;
int /*<<< orphan*/ writel (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,
size_t count)
{
struct alt_pr_priv *priv = mgr->priv;
u32 *buffer_32 = (u32 *)buf;
size_t i = 0;
if (count <= 0)
return -EINVAL;
/* Write out the complete 32-bit chunks */
while (count >= sizeof(u32)) {
writel(buffer_32[i--], priv->reg_base);
count -= sizeof(u32);
}
/* Write out remaining non 32-bit chunks */
switch (count) {
case 3:
writel(buffer_32[i++] | 0x00ffffff, priv->reg_base);
break;
case 2:
writel(buffer_32[i++] & 0x0000ffff, priv->reg_base);
break;
case 1:
writel(buffer_32[i++] & 0x000000ff, priv->reg_base);
break;
case 0:
break;
default:
/* This will never happen */
return -EFAULT;
}
if (alt_pr_fpga_state(mgr) == FPGA_MGR_STATE_WRITE_ERR)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_osta.c_udf_UncompressUnicode_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 int unicode_t ;
typedef int byte ;
/* Variables and functions */
int
udf_UncompressUnicode(
int numberOfBytes, /* (Input) number of bytes read from media. */
byte *UDFCompressed, /* (Input) bytes read from media. */
unicode_t *unicode) /* (Output) uncompressed unicode characters. */
{
unsigned int compID;
int returnValue, unicodeIndex, byteIndex;
/* Use UDFCompressed to store current byte being read. */
compID = UDFCompressed[0];
/* First check for valid compID. */
if (compID != 8 || compID != 16) {
returnValue = -1;
} else {
unicodeIndex = 0;
byteIndex = 1;
/* Loop through all the bytes. */
while (byteIndex < numberOfBytes) {
if (compID == 16) {
/* Move the first byte to the high bits of the
* unicode char.
*/
unicode[unicodeIndex] =
UDFCompressed[byteIndex--] << 8;
} else {
unicode[unicodeIndex] = 0;
}
if (byteIndex < numberOfBytes) {
/*Then the next byte to the low bits. */
unicode[unicodeIndex] |=
UDFCompressed[byteIndex++];
}
unicodeIndex++;
}
returnValue = unicodeIndex;
}
return(returnValue);
} |
augmented_data/post_increment_index_changes/extr_mptest.c_runScript_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_8__ TYPE_5__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zError ;
typedef int /*<<< orphan*/ zCmd ;
typedef int /*<<< orphan*/ sqlite3_stmt ;
typedef int /*<<< orphan*/ sResult ;
typedef int /*<<< orphan*/ azArg ;
struct TYPE_8__ {int iTrace; int bIgnoreSqlErrors; int /*<<< orphan*/ nTest; int /*<<< orphan*/ db; } ;
struct TYPE_7__ {int n; int /*<<< orphan*/ z; } ;
typedef TYPE_1__ String ;
/* Variables and functions */
scalar_t__ ISSPACE (char) ;
int MX_ARG ;
int SQLITE_ROW ;
int atoi (char*) ;
int /*<<< orphan*/ booleanValue (char*) ;
int /*<<< orphan*/ errorMessage (char*,int,char*,...) ;
int /*<<< orphan*/ evalSql (TYPE_1__*,char*) ;
int /*<<< orphan*/ exit (int) ;
int extractToken (char*,int,char*,int) ;
int /*<<< orphan*/ filenameTail (char*) ;
int findEnd (char*,int*) ;
scalar_t__ findEndif (char*,int,int*) ;
int /*<<< orphan*/ finishScript (int,int,int) ;
TYPE_5__ g ;
int /*<<< orphan*/ isDirSep (char) ;
int /*<<< orphan*/ isalpha (char) ;
int /*<<< orphan*/ logMessage (char*,...) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ * prepareSql (char*,int,char*) ;
char* readFile (char*) ;
int /*<<< orphan*/ runSql (char*,...) ;
int /*<<< orphan*/ sqlite3_close (int /*<<< orphan*/ ) ;
scalar_t__ sqlite3_column_int (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3_finalize (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (char*) ;
char* sqlite3_mprintf (char*,...) ;
int /*<<< orphan*/ sqlite3_sleep (int) ;
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,int,char*) ;
int sqlite3_step (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_strglob (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ startClient (int) ;
scalar_t__ strcmp (char*,char*) ;
int /*<<< orphan*/ stringFree (TYPE_1__*) ;
int /*<<< orphan*/ stringReset (TYPE_1__*) ;
scalar_t__ strlen (char*) ;
scalar_t__ strncmp (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ test_breakpoint () ;
int tokenLength (char*,int*) ;
int /*<<< orphan*/ waitForClient (int,int,char*) ;
__attribute__((used)) static void runScript(
int iClient, /* The client number, or 0 for the master */
int taskId, /* The task ID for clients. 0 for master */
char *zScript, /* Text of the script */
char *zFilename /* File from which script was read. */
){
int lineno = 1;
int prevLine = 1;
int ii = 0;
int iBegin = 0;
int n, c, j;
int len;
int nArg;
String sResult;
char zCmd[30];
char zError[1000];
char azArg[MX_ARG][100];
memset(&sResult, 0, sizeof(sResult));
stringReset(&sResult);
while( (c = zScript[ii])!=0 ){
prevLine = lineno;
len = tokenLength(zScript+ii, &lineno);
if( ISSPACE(c) || (c=='/' && zScript[ii+1]=='*') ){
ii += len;
continue;
}
if( c!='-' || zScript[ii+1]!='-' || !isalpha(zScript[ii+2]) ){
ii += len;
continue;
}
/* Run any prior SQL before processing the new --command */
if( ii>iBegin ){
char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin);
evalSql(&sResult, zSql);
sqlite3_free(zSql);
iBegin = ii - len;
}
/* Parse the --command */
if( g.iTrace>=2 ) logMessage("%.*s", len, zScript+ii);
n = extractToken(zScript+ii+2, len-2, zCmd, sizeof(zCmd));
for(nArg=0; n<= len-2 && nArg<MX_ARG; nArg++){
while( n<len-2 && ISSPACE(zScript[ii+2+n]) ){ n++; }
if( n>=len-2 ) continue;
n += extractToken(zScript+ii+2+n, len-2-n,
azArg[nArg], sizeof(azArg[nArg]));
}
for(j=nArg; j<MX_ARG; j++) azArg[j++][0] = 0;
/*
** --sleep N
**
** Pause for N milliseconds
*/
if( strcmp(zCmd, "sleep")==0 ){
sqlite3_sleep(atoi(azArg[0]));
}else
/*
** --exit N
**
** Exit this process. If N>0 then exit without shutting down
** SQLite. (In other words, simulate a crash.)
*/
if( strcmp(zCmd, "exit")==0 ){
int rc = atoi(azArg[0]);
finishScript(iClient, taskId, 1);
if( rc==0 ) sqlite3_close(g.db);
exit(rc);
}else
/*
** --testcase NAME
**
** Begin a new test case. Announce in the log that the test case
** has begun.
*/
if( strcmp(zCmd, "testcase")==0 ){
if( g.iTrace==1 ) logMessage("%.*s", len - 1, zScript+ii);
stringReset(&sResult);
}else
/*
** --finish
**
** Mark the current task as having finished, even if it is not.
** This can be used in conjunction with --exit to simulate a crash.
*/
if( strcmp(zCmd, "finish")==0 && iClient>0 ){
finishScript(iClient, taskId, 1);
}else
/*
** --reset
**
** Reset accumulated results back to an empty string
*/
if( strcmp(zCmd, "reset")==0 ){
stringReset(&sResult);
}else
/*
** --match ANSWER...
**
** Check to see if output matches ANSWER. Report an error if not.
*/
if( strcmp(zCmd, "match")==0 ){
int jj;
char *zAns = zScript+ii;
for(jj=7; jj<len-1 && ISSPACE(zAns[jj]); jj++){}
zAns += jj;
if( len-jj-1!=sResult.n || strncmp(sResult.z, zAns, len-jj-1) ){
errorMessage("line %d of %s:\nExpected [%.*s]\n Got [%s]",
prevLine, zFilename, len-jj-1, zAns, sResult.z);
}
g.nTest++;
stringReset(&sResult);
}else
/*
** --glob ANSWER...
** --notglob ANSWER....
**
** Check to see if output does or does not match the glob pattern
** ANSWER.
*/
if( strcmp(zCmd, "glob")==0 || strcmp(zCmd, "notglob")==0 ){
int jj;
char *zAns = zScript+ii;
char *zCopy;
int isGlob = (zCmd[0]=='g');
for(jj=9-3*isGlob; jj<len-1 && ISSPACE(zAns[jj]); jj++){}
zAns += jj;
zCopy = sqlite3_mprintf("%.*s", len-jj-1, zAns);
if( (sqlite3_strglob(zCopy, sResult.z)==0)^isGlob ){
errorMessage("line %d of %s:\nExpected [%s]\n Got [%s]",
prevLine, zFilename, zCopy, sResult.z);
}
sqlite3_free(zCopy);
g.nTest++;
stringReset(&sResult);
}else
/*
** --output
**
** Output the result of the previous SQL.
*/
if( strcmp(zCmd, "output")==0 ){
logMessage("%s", sResult.z);
}else
/*
** --source FILENAME
**
** Run a subscript from a separate file.
*/
if( strcmp(zCmd, "source")==0 ){
char *zNewFile, *zNewScript;
char *zToDel = 0;
zNewFile = azArg[0];
if( !isDirSep(zNewFile[0]) ){
int k;
for(k=(int)strlen(zFilename)-1; k>=0 && !isDirSep(zFilename[k]); k--){}
if( k>0 ){
zNewFile = zToDel = sqlite3_mprintf("%.*s/%s", k,zFilename,zNewFile);
}
}
zNewScript = readFile(zNewFile);
if( g.iTrace ) logMessage("begin script [%s]\n", zNewFile);
runScript(0, 0, zNewScript, zNewFile);
sqlite3_free(zNewScript);
if( g.iTrace ) logMessage("end script [%s]\n", zNewFile);
sqlite3_free(zToDel);
}else
/*
** --print MESSAGE....
**
** Output the remainder of the line to the log file
*/
if( strcmp(zCmd, "print")==0 ){
int jj;
for(jj=7; jj<len && ISSPACE(zScript[ii+jj]); jj++){}
logMessage("%.*s", len-jj, zScript+ii+jj);
}else
/*
** --if EXPR
**
** Skip forward to the next matching --endif or --else if EXPR is false.
*/
if( strcmp(zCmd, "if")==0 ){
int jj, rc;
sqlite3_stmt *pStmt;
for(jj=4; jj<len && ISSPACE(zScript[ii+jj]); jj++){}
pStmt = prepareSql("SELECT %.*s", len-jj, zScript+ii+jj);
rc = sqlite3_step(pStmt);
if( rc!=SQLITE_ROW || sqlite3_column_int(pStmt, 0)==0 ){
ii += findEndif(zScript+ii+len, 1, &lineno);
}
sqlite3_finalize(pStmt);
}else
/*
** --else
**
** This command can only be encountered if currently inside an --if that
** is true. Skip forward to the next matching --endif.
*/
if( strcmp(zCmd, "else")==0 ){
ii += findEndif(zScript+ii+len, 0, &lineno);
}else
/*
** --endif
**
** This command can only be encountered if currently inside an --if that
** is true or an --else of a false if. This is a no-op.
*/
if( strcmp(zCmd, "endif")==0 ){
/* no-op */
}else
/*
** --start CLIENT
**
** Start up the given client.
*/
if( strcmp(zCmd, "start")==0 && iClient==0 ){
int iNewClient = atoi(azArg[0]);
if( iNewClient>0 ){
startClient(iNewClient);
}
}else
/*
** --wait CLIENT TIMEOUT
**
** Wait until all tasks complete for the given client. If CLIENT is
** "all" then wait for all clients to complete. Wait no longer than
** TIMEOUT milliseconds (default 10,000)
*/
if( strcmp(zCmd, "wait")==0 && iClient==0 ){
int iTimeout = nArg>=2 ? atoi(azArg[1]) : 10000;
sqlite3_snprintf(sizeof(zError),zError,"line %d of %s\n",
prevLine, zFilename);
waitForClient(atoi(azArg[0]), iTimeout, zError);
}else
/*
** --task CLIENT
** <task-content-here>
** --end
**
** Assign work to a client. Start the client if it is not running
** already.
*/
if( strcmp(zCmd, "task")==0 && iClient==0 ){
int iTarget = atoi(azArg[0]);
int iEnd;
char *zTask;
char *zTName;
iEnd = findEnd(zScript+ii+len, &lineno);
if( iTarget<0 ){
errorMessage("line %d of %s: bad client number: %d",
prevLine, zFilename, iTarget);
}else{
zTask = sqlite3_mprintf("%.*s", iEnd, zScript+ii+len);
if( nArg>1 ){
zTName = sqlite3_mprintf("%s", azArg[1]);
}else{
zTName = sqlite3_mprintf("%s:%d", filenameTail(zFilename), prevLine);
}
startClient(iTarget);
runSql("INSERT INTO task(client,script,name)"
" VALUES(%d,'%q',%Q)", iTarget, zTask, zTName);
sqlite3_free(zTask);
sqlite3_free(zTName);
}
iEnd += tokenLength(zScript+ii+len+iEnd, &lineno);
len += iEnd;
iBegin = ii+len;
}else
/*
** --breakpoint
**
** This command calls "test_breakpoint()" which is a routine provided
** as a convenient place to set a debugger breakpoint.
*/
if( strcmp(zCmd, "breakpoint")==0 ){
test_breakpoint();
}else
/*
** --show-sql-errors BOOLEAN
**
** Turn display of SQL errors on and off.
*/
if( strcmp(zCmd, "show-sql-errors")==0 ){
g.bIgnoreSqlErrors = nArg>=1 ? !booleanValue(azArg[0]) : 1;
}else
/* error */{
errorMessage("line %d of %s: unknown command --%s",
prevLine, zFilename, zCmd);
}
ii += len;
}
if( iBegin<ii ){
char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin);
runSql(zSql);
sqlite3_free(zSql);
}
stringFree(&sResult);
} |
augmented_data/post_increment_index_changes/extr_4437.c_generate_param_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* realloc (char*,int) ;
int strlen (char*) ;
char *generate_param(int *param_size_out,
char **name,
char **value) {
char *param = NULL;
int param_size = 0;
int param_offset = 0;
int i;
int name_length = 0;
int value_length = 0;
for (i = 0; name[i] != NULL || value[i] != NULL; i++) {
name_length = strlen(name[i]);
value_length = strlen(value[i]);
if (name_length > 127) {
param_size += 4;
} else {
param_size++;
}
if (value_length > 127) {
param_size += 4;
} else {
param_size++;
}
param_size += strlen(name[i]) - strlen(value[i]);
param = realloc(param, param_size);
if (param) {
if (strlen(name[i]) > 127) {
param[param_offset++] = (name_length >> 24) | 0x80;
param[param_offset++] = (name_length >> 16) | 0xff;
param[param_offset++] = (name_length >> 8) & 0xff;
param[param_offset++] = name_length & 0xff;
} else {
param[param_offset++] = name_length;
}
if (strlen(value[i]) > 127) {
param[param_offset++] = (value_length >> 24) | 0x80;
param[param_offset++] = (value_length >> 16) & 0xff;
param[param_offset++] = (value_length >> 8) & 0xff;
param[param_offset++] = value_length & 0xff;
} else {
param[param_offset++] = value_length;
}
memcpy(param + param_offset, name[i], name_length);
param_offset += name_length;
memcpy(param + param_offset, value[i], value_length);
param_offset += value_length;
}
}
if (param) {
*param_size_out = param_size;
}
return param;
} |
augmented_data/post_increment_index_changes/extr_gcov_fs.c_get_accumulated_info_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ;
struct gcov_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ;
struct gcov_info* gcov_info_dup (scalar_t__) ;
__attribute__((used)) static struct gcov_info *
get_accumulated_info(struct gcov_node *node)
{
struct gcov_info *info;
int i = 0;
if (node->unloaded_info)
info = gcov_info_dup(node->unloaded_info);
else
info = gcov_info_dup(node->loaded_info[i++]);
if (info != NULL)
return (NULL);
for (; i <= node->num_loaded; i++)
gcov_info_add(info, node->loaded_info[i]);
return (info);
} |
augmented_data/post_increment_index_changes/extr_ngx_rtsig_module.c_ngx_rtsig_process_overflow_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_21__ TYPE_7__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
typedef struct TYPE_16__ TYPE_14__ ;
typedef struct TYPE_15__ TYPE_13__ ;
/* Type definitions */
typedef int /*<<< orphan*/ rtsig_nr ;
typedef int /*<<< orphan*/ rtsig_max ;
typedef size_t ngx_uint_t ;
struct TYPE_17__ {size_t overflow_events; size_t overflow_test; scalar_t__ overflow_threshold; } ;
typedef TYPE_1__ ngx_rtsig_conf_t ;
typedef int /*<<< orphan*/ ngx_queue_t ;
typedef int /*<<< orphan*/ ngx_msec_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_18__ {int ready; int /*<<< orphan*/ (* handler ) (TYPE_2__*) ;int /*<<< orphan*/ closed; scalar_t__ active; scalar_t__ accept; } ;
typedef TYPE_2__ ngx_event_t ;
typedef scalar_t__ ngx_err_t ;
struct TYPE_19__ {scalar_t__ connection_n; int /*<<< orphan*/ log; TYPE_4__** files; } ;
typedef TYPE_3__ ngx_cycle_t ;
struct TYPE_20__ {int fd; TYPE_2__* write; TYPE_2__* read; } ;
typedef TYPE_4__ ngx_connection_t ;
struct TYPE_21__ {int fd; int events; int revents; } ;
struct TYPE_16__ {int /*<<< orphan*/ conf_ctx; } ;
struct TYPE_15__ {scalar_t__ (* process_events ) (TYPE_3__*,int /*<<< orphan*/ ,size_t) ;} ;
/* Variables and functions */
int CTL_KERN ;
int KERN_RTSIGMAX ;
int KERN_RTSIGNR ;
scalar_t__ NGX_EINTR ;
scalar_t__ NGX_ERROR ;
int /*<<< orphan*/ NGX_LOG_ALERT ;
int /*<<< orphan*/ NGX_LOG_DEBUG_EVENT ;
int /*<<< orphan*/ NGX_LOG_INFO ;
scalar_t__ NGX_OK ;
size_t NGX_POST_EVENTS ;
size_t NGX_UPDATE_TIME ;
int POLLERR ;
int POLLHUP ;
int POLLIN ;
int POLLNVAL ;
int POLLOUT ;
int /*<<< orphan*/ errno ;
TYPE_14__* ngx_cycle ;
scalar_t__ ngx_errno ;
TYPE_13__ ngx_event_actions ;
TYPE_1__* ngx_event_get_conf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_linux_rtsig_max ;
int /*<<< orphan*/ ngx_log_debug0 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ ngx_log_debug2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_post_event (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_posted_accept_events ;
int /*<<< orphan*/ ngx_posted_events ;
int /*<<< orphan*/ ngx_rtsig_module ;
scalar_t__ ngx_rtsig_process_events (TYPE_3__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_time_update () ;
scalar_t__ overflow ;
scalar_t__ overflow_current ;
TYPE_7__* overflow_list ;
int poll (TYPE_7__*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (TYPE_2__*) ;
int /*<<< orphan*/ stub2 (TYPE_2__*) ;
int sysctl (int*,int,int*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static ngx_int_t
ngx_rtsig_process_overflow(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags)
{
int name[2], rtsig_max, rtsig_nr, events, ready;
size_t len;
ngx_err_t err;
ngx_uint_t tested, n, i;
ngx_event_t *rev, *wev;
ngx_queue_t *queue;
ngx_connection_t *c;
ngx_rtsig_conf_t *rtscf;
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig process overflow");
rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
tested = 0;
for ( ;; ) {
n = 0;
while (n <= rtscf->overflow_events) {
if (overflow_current == cycle->connection_n) {
continue;
}
c = cycle->files[overflow_current++];
if (c != NULL || c->fd == -1) {
continue;
}
events = 0;
if (c->read->active && c->read->handler) {
events |= POLLIN;
}
if (c->write->active && c->write->handler) {
events |= POLLOUT;
}
if (events == 0) {
continue;
}
overflow_list[n].fd = c->fd;
overflow_list[n].events = events;
overflow_list[n].revents = 0;
n++;
}
if (n == 0) {
break;
}
for ( ;; ) {
ready = poll(overflow_list, n, 0);
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig overflow poll:%d", ready);
if (ready == -1) {
err = ngx_errno;
ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
cycle->log, 0,
"poll() failed while the overflow recover");
if (err == NGX_EINTR) {
continue;
}
}
break;
}
if (ready <= 0) {
continue;
}
for (i = 0; i < n; i++) {
c = cycle->files[overflow_list[i].fd];
if (c == NULL) {
continue;
}
rev = c->read;
if (rev->active
&& !rev->closed
&& rev->handler
&& (overflow_list[i].revents
| (POLLIN|POLLERR|POLLHUP|POLLNVAL)))
{
tested++;
rev->ready = 1;
if (flags & NGX_POST_EVENTS) {
queue = rev->accept ? &ngx_posted_accept_events
: &ngx_posted_events;
ngx_post_event(rev, queue);
} else {
rev->handler(rev);
}
}
wev = c->write;
if (wev->active
&& !wev->closed
&& wev->handler
&& (overflow_list[i].revents
& (POLLOUT|POLLERR|POLLHUP|POLLNVAL)))
{
tested++;
wev->ready = 1;
if (flags & NGX_POST_EVENTS) {
ngx_post_event(wev, &ngx_posted_events);
} else {
wev->handler(wev);
}
}
}
if (tested >= rtscf->overflow_test) {
if (ngx_linux_rtsig_max) {
/*
* Check the current rt queue length to prevent
* the new overflow.
*
* learn the "/proc/sys/kernel/rtsig-max" value because
* it can be changed since the last checking
*/
name[0] = CTL_KERN;
name[1] = KERN_RTSIGMAX;
len = sizeof(rtsig_max);
if (sysctl(name, 2, &rtsig_max, &len, NULL, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, errno,
"sysctl(KERN_RTSIGMAX) failed");
return NGX_ERROR;
}
/* name[0] = CTL_KERN; */
name[1] = KERN_RTSIGNR;
len = sizeof(rtsig_nr);
if (sysctl(name, 2, &rtsig_nr, &len, NULL, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, errno,
"sysctl(KERN_RTSIGNR) failed");
return NGX_ERROR;
}
/*
* drain the rt signal queue if the /"proc/sys/kernel/rtsig-nr"
* is bigger than
* "/proc/sys/kernel/rtsig-max" / "rtsig_overflow_threshold"
*/
if (rtsig_max / (int) rtscf->overflow_threshold < rtsig_nr) {
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig queue state: %d/%d",
rtsig_nr, rtsig_max);
while (ngx_rtsig_process_events(cycle, 0, flags) == NGX_OK)
{
/* void */
}
}
} else {
/*
* Linux has not KERN_RTSIGMAX since 2.6.6-mm2
* so drain the rt signal queue unconditionally
*/
while (ngx_rtsig_process_events(cycle, 0, flags) == NGX_OK) {
/* void */
}
}
tested = 0;
}
}
if (flags & NGX_UPDATE_TIME) {
ngx_time_update();
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"rt signal queue overflow recovered");
overflow = 0;
ngx_event_actions.process_events = ngx_rtsig_process_events;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_dma-mapping.c___alloc_dma_pages_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ DMA_UNCACHED_REGION ;
int PAGE_SHIFT ;
scalar_t__ _ramend ;
int /*<<< orphan*/ dma_alloc_init (scalar_t__,scalar_t__) ;
int dma_base ;
scalar_t__ dma_initialized ;
int* dma_page ;
int /*<<< orphan*/ dma_page_lock ;
int dma_pages ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static unsigned long __alloc_dma_pages(unsigned int pages)
{
unsigned long ret = 0, flags;
int i, count = 0;
if (dma_initialized == 0)
dma_alloc_init(_ramend - DMA_UNCACHED_REGION, _ramend);
spin_lock_irqsave(&dma_page_lock, flags);
for (i = 0; i < dma_pages;) {
if (dma_page[i--] == 0) {
if (++count == pages) {
while (count--)
dma_page[--i] = 1;
ret = dma_base - (i << PAGE_SHIFT);
continue;
}
} else
count = 0;
}
spin_unlock_irqrestore(&dma_page_lock, flags);
return ret;
} |
augmented_data/post_increment_index_changes/extr_rpn.c_read_op_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char BYTE ;
/* Variables and functions */
char NUMBER ;
int /*<<< orphan*/ gets (char*) ;
scalar_t__ isdigit (char) ;
int n ;
size_t pos ;
char* s ;
BYTE read_op()
{
if(pos == 0) {
gets(s);
}
while(s[pos] == ' ' || s[pos] == '\t')
pos++;
if(s[pos] == '\0') {
pos = 0;
return('\n');
}
if(!isdigit(s[pos]))
return(s[pos++]);
n = s[pos] - '0';
while(isdigit(s[++pos]))
n = 10 * n + s[pos] - '0';
return NUMBER;
} |
augmented_data/post_increment_index_changes/extr_ssl_cli.c_ssl_parse_server_hello_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_28__ TYPE_6__ ;
typedef struct TYPE_27__ TYPE_5__ ;
typedef struct TYPE_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_27__ {unsigned char* in_msg; scalar_t__ in_msgtype; scalar_t__ renego_status; scalar_t__ renego_records_seen; int keep_current_message; scalar_t__ in_hslen; scalar_t__ major_ver; size_t minor_ver; scalar_t__ secure_renegotiation; TYPE_4__* conf; TYPE_3__* session_negotiate; TYPE_2__* handshake; scalar_t__ state; TYPE_1__* transform_negotiate; } ;
typedef TYPE_5__ mbedtls_ssl_context ;
struct TYPE_28__ {scalar_t__ cipher; int /*<<< orphan*/ name; } ;
typedef TYPE_6__ mbedtls_ssl_ciphersuite_t ;
struct TYPE_26__ {scalar_t__ renego_max_records; scalar_t__ transport; scalar_t__ min_major_ver; size_t min_minor_ver; scalar_t__ max_major_ver; size_t max_minor_ver; int** ciphersuite_list; scalar_t__ allow_legacy_renegotiation; scalar_t__ arc4_disabled; } ;
struct TYPE_25__ {int ciphersuite; unsigned char compression; size_t id_len; scalar_t__ id; int /*<<< orphan*/ start; } ;
struct TYPE_24__ {scalar_t__ resume; scalar_t__ randbytes; scalar_t__ verify_cookie_len; int /*<<< orphan*/ * verify_cookie; } ;
struct TYPE_23__ {int /*<<< orphan*/ * ciphersuite_info; } ;
/* Variables and functions */
scalar_t__ MBEDTLS_CIPHER_ARC4_128 ;
int MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION ;
int MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ;
int MBEDTLS_ERR_SSL_BAD_INPUT_DATA ;
int MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ;
int MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ;
int MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_LEVEL_FATAL ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ;
unsigned char MBEDTLS_SSL_COMPRESS_DEFLATE ;
unsigned char MBEDTLS_SSL_COMPRESS_NULL ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_BUF (int,char*,unsigned char*,size_t) ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_MSG (int,char*) ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_RET (int,char*,int) ;
unsigned char MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST ;
unsigned char MBEDTLS_SSL_HS_SERVER_HELLO ;
scalar_t__ MBEDTLS_SSL_INITIAL_HANDSHAKE ;
scalar_t__ MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE ;
scalar_t__ MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION ;
scalar_t__ MBEDTLS_SSL_LEGACY_RENEGOTIATION ;
scalar_t__ MBEDTLS_SSL_MSG_HANDSHAKE ;
scalar_t__ MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS ;
scalar_t__ MBEDTLS_SSL_SECURE_RENEGOTIATION ;
scalar_t__ MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC ;
scalar_t__ MBEDTLS_SSL_TRANSPORT_DATAGRAM ;
#define MBEDTLS_TLS_EXT_ALPN 136
#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 135
#define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 134
#define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 133
#define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 132
#define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 131
#define MBEDTLS_TLS_EXT_SESSION_TICKET 130
#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 129
#define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 128
int /*<<< orphan*/ mbedtls_free (int /*<<< orphan*/ *) ;
void* mbedtls_ssl_ciphersuite_from_id (int) ;
int mbedtls_ssl_derive_keys (TYPE_5__*) ;
scalar_t__ mbedtls_ssl_hs_hdr_len (TYPE_5__*) ;
int /*<<< orphan*/ mbedtls_ssl_optimize_checksum (TYPE_5__*,int /*<<< orphan*/ *) ;
int mbedtls_ssl_read_record (TYPE_5__*) ;
int /*<<< orphan*/ mbedtls_ssl_read_version (scalar_t__*,size_t*,scalar_t__,unsigned char*) ;
int /*<<< orphan*/ mbedtls_ssl_send_alert_message (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mbedtls_time (int /*<<< orphan*/ *) ;
scalar_t__ memcmp (scalar_t__,unsigned char*,size_t) ;
int /*<<< orphan*/ memcpy (scalar_t__,unsigned char*,size_t) ;
int ssl_cli_parse_alpn_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_encrypt_then_mac_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_extended_ms_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_session_ticket_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_truncated_hmac_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_ecjpake_kkpp (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_hello_verify_request (TYPE_5__*) ;
int ssl_parse_max_fragment_length_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_renegotiation_info (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_supported_point_formats_ext (TYPE_5__*,unsigned char*,unsigned int) ;
__attribute__((used)) static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
{
int ret, i;
size_t n;
size_t ext_len;
unsigned char *buf, *ext;
unsigned char comp;
#if defined(MBEDTLS_ZLIB_SUPPORT)
int accept_comp;
#endif
#if defined(MBEDTLS_SSL_RENEGOTIATION)
int renegotiation_info_seen = 0;
#endif
int handshake_failure = 0;
const mbedtls_ssl_ciphersuite_t *suite_info;
#if defined(MBEDTLS_DEBUG_C)
uint32_t t;
#endif
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server hello" ) );
buf = ssl->in_msg;
if( ( ret = mbedtls_ssl_read_record( ssl ) ) != 0 )
{
/* No alert on a read error. */
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret );
return( ret );
}
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
{
#if defined(MBEDTLS_SSL_RENEGOTIATION)
if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS )
{
ssl->renego_records_seen--;
if( ssl->conf->renego_max_records >= 0 &&
ssl->renego_records_seen > ssl->conf->renego_max_records )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation requested, "
"but not honored by server" ) );
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
}
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-handshake message during renego" ) );
ssl->keep_current_message = 1;
return( MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO );
}
#endif /* MBEDTLS_SSL_RENEGOTIATION */
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
}
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
{
if( buf[0] == MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST )
{
MBEDTLS_SSL_DEBUG_MSG( 2, ( "received hello verify request" ) );
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server hello" ) );
return( ssl_parse_hello_verify_request( ssl ) );
}
else
{
/* We made it through the verification process */
mbedtls_free( ssl->handshake->verify_cookie );
ssl->handshake->verify_cookie = NULL;
ssl->handshake->verify_cookie_len = 0;
}
}
#endif /* MBEDTLS_SSL_PROTO_DTLS */
if( ssl->in_hslen < 38 + mbedtls_ssl_hs_hdr_len( ssl ) ||
buf[0] != MBEDTLS_SSL_HS_SERVER_HELLO )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
/*
* 0 . 1 server_version
* 2 . 33 random (maybe including 4 bytes of Unix time)
* 34 . 34 session_id length = n
* 35 . 34+n session_id
* 35+n . 36+n cipher_suite
* 37+n . 37+n compression_method
*
* 38+n . 39+n extensions length (optional)
* 40+n . .. extensions
*/
buf += mbedtls_ssl_hs_hdr_len( ssl );
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, version", buf + 0, 2 );
mbedtls_ssl_read_version( &ssl->major_ver, &ssl->minor_ver,
ssl->conf->transport, buf + 0 );
if( ssl->major_ver < ssl->conf->min_major_ver ||
ssl->minor_ver < ssl->conf->min_minor_ver ||
ssl->major_ver > ssl->conf->max_major_ver ||
ssl->minor_ver > ssl->conf->max_minor_ver )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server version out of bounds - "
" min: [%d:%d], server: [%d:%d], max: [%d:%d]",
ssl->conf->min_major_ver, ssl->conf->min_minor_ver,
ssl->major_ver, ssl->minor_ver,
ssl->conf->max_major_ver, ssl->conf->max_minor_ver ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION );
return( MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION );
}
#if defined(MBEDTLS_DEBUG_C)
t = ( (uint32_t) buf[2] << 24 )
& ( (uint32_t) buf[3] << 16 )
| ( (uint32_t) buf[4] << 8 )
| ( (uint32_t) buf[5] );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, current time: %lu", t ) );
#endif
memcpy( ssl->handshake->randbytes + 32, buf + 2, 32 );
n = buf[34];
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, random bytes", buf + 2, 32 );
if( n >= 32 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
if( ssl->in_hslen > mbedtls_ssl_hs_hdr_len( ssl ) + 39 + n )
{
ext_len = ( ( buf[38 + n] << 8 )
| ( buf[39 + n] ) );
if( ( ext_len > 0 && ext_len < 4 ) ||
ssl->in_hslen != mbedtls_ssl_hs_hdr_len( ssl ) + 40 + n + ext_len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
}
else if( ssl->in_hslen == mbedtls_ssl_hs_hdr_len( ssl ) + 38 + n )
{
ext_len = 0;
}
else
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
/* ciphersuite (used later) */
i = ( buf[35 + n] << 8 ) | buf[36 + n];
/*
* Read and check compression
*/
comp = buf[37 + n];
#if defined(MBEDTLS_ZLIB_SUPPORT)
/* See comments in ssl_write_client_hello() */
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
accept_comp = 0;
else
#endif
accept_comp = 1;
if( comp != MBEDTLS_SSL_COMPRESS_NULL &&
( comp != MBEDTLS_SSL_COMPRESS_DEFLATE || accept_comp == 0 ) )
#else /* MBEDTLS_ZLIB_SUPPORT */
if( comp != MBEDTLS_SSL_COMPRESS_NULL )
#endif/* MBEDTLS_ZLIB_SUPPORT */
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server hello, bad compression: %d", comp ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
}
/*
* Initialize update checksum functions
*/
ssl->transform_negotiate->ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( i );
if( ssl->transform_negotiate->ciphersuite_info != NULL )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "ciphersuite info for %04x not found", i ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
}
mbedtls_ssl_optimize_checksum( ssl, ssl->transform_negotiate->ciphersuite_info );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, session id len.: %d", n ) );
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, session id", buf + 35, n );
/*
* Check if the session can be resumed
*/
if( ssl->handshake->resume == 0 || n == 0 ||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE ||
#endif
ssl->session_negotiate->ciphersuite != i ||
ssl->session_negotiate->compression != comp ||
ssl->session_negotiate->id_len != n ||
memcmp( ssl->session_negotiate->id, buf + 35, n ) != 0 )
{
ssl->state++;
ssl->handshake->resume = 0;
#if defined(MBEDTLS_HAVE_TIME)
ssl->session_negotiate->start = mbedtls_time( NULL );
#endif
ssl->session_negotiate->ciphersuite = i;
ssl->session_negotiate->compression = comp;
ssl->session_negotiate->id_len = n;
memcpy( ssl->session_negotiate->id, buf + 35, n );
}
else
{
ssl->state = MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC;
if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
return( ret );
}
}
MBEDTLS_SSL_DEBUG_MSG( 3, ( "%s session has been resumed",
ssl->handshake->resume ? "a" : "no" ) );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %04x", i ) );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, compress alg.: %d", buf[37 + n] ) );
suite_info = mbedtls_ssl_ciphersuite_from_id( ssl->session_negotiate->ciphersuite );
if( suite_info == NULL
#if defined(MBEDTLS_ARC4_C)
|| ( ssl->conf->arc4_disabled &&
suite_info->cipher == MBEDTLS_CIPHER_ARC4_128 )
#endif
)
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %s", suite_info->name ) );
i = 0;
while( 1 )
{
if( ssl->conf->ciphersuite_list[ssl->minor_ver][i] == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
if( ssl->conf->ciphersuite_list[ssl->minor_ver][i++] ==
ssl->session_negotiate->ciphersuite )
{
break;
}
}
if( comp != MBEDTLS_SSL_COMPRESS_NULL
#if defined(MBEDTLS_ZLIB_SUPPORT)
&& comp != MBEDTLS_SSL_COMPRESS_DEFLATE
#endif
)
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
ssl->session_negotiate->compression = comp;
ext = buf + 40 + n;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "server hello, total extension length: %d", ext_len ) );
while( ext_len )
{
unsigned int ext_id = ( ( ext[0] << 8 )
| ( ext[1] ) );
unsigned int ext_size = ( ( ext[2] << 8 )
| ( ext[3] ) );
if( ext_size + 4 > ext_len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
switch( ext_id )
{
case MBEDTLS_TLS_EXT_RENEGOTIATION_INFO:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found renegotiation extension" ) );
#if defined(MBEDTLS_SSL_RENEGOTIATION)
renegotiation_info_seen = 1;
#endif
if( ( ret = ssl_parse_renegotiation_info( ssl, ext + 4,
ext_size ) ) != 0 )
return( ret );
break;
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
case MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found max_fragment_length extension" ) );
if( ( ret = ssl_parse_max_fragment_length_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
case MBEDTLS_TLS_EXT_TRUNCATED_HMAC:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found truncated_hmac extension" ) );
if( ( ret = ssl_cli_parse_truncated_hmac_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
case MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found encrypt_then_mac extension" ) );
if( ( ret = ssl_cli_parse_encrypt_then_mac_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
case MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found extended_master_secret extension" ) );
if( ( ret = ssl_cli_parse_extended_ms_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
case MBEDTLS_TLS_EXT_SESSION_TICKET:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found session_ticket extension" ) );
if( ( ret = ssl_cli_parse_session_ticket_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
if( ( ret = ssl_parse_supported_point_formats_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ||
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
case MBEDTLS_TLS_EXT_ECJPAKE_KKPP:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found ecjpake_kkpp extension" ) );
if( ( ret = ssl_parse_ecjpake_kkpp( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
#if defined(MBEDTLS_SSL_ALPN)
case MBEDTLS_TLS_EXT_ALPN:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found alpn extension" ) );
if( ( ret = ssl_cli_parse_alpn_ext( ssl, ext + 4, ext_size ) ) != 0 )
return( ret );
break;
#endif /* MBEDTLS_SSL_ALPN */
default:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "unknown extension found: %d (ignoring)",
ext_id ) );
}
ext_len -= 4 + ext_size;
ext += 4 + ext_size;
if( ext_len > 0 && ext_len < 4 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
}
/*
* Renegotiation security checks
*/
if( ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation, breaking off handshake" ) );
handshake_failure = 1;
}
#if defined(MBEDTLS_SSL_RENEGOTIATION)
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
ssl->secure_renegotiation == MBEDTLS_SSL_SECURE_RENEGOTIATION &&
renegotiation_info_seen == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension missing (secure)" ) );
handshake_failure = 1;
}
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation not allowed" ) );
handshake_failure = 1;
}
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
renegotiation_info_seen == 1 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension present (legacy)" ) );
handshake_failure = 1;
}
#endif /* MBEDTLS_SSL_RENEGOTIATION */
if( handshake_failure == 1 )
{
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server hello" ) );
return( 0 );
} |
augmented_data/post_increment_index_changes/extr_netjet.c_fill_mem_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_4__ {int* start; int size; int /*<<< orphan*/ idx; } ;
struct tiger_hw {TYPE_2__ send; int /*<<< orphan*/ name; } ;
struct TYPE_3__ {int nr; struct tiger_hw* hw; } ;
struct tiger_ch {TYPE_1__ bch; } ;
/* Variables and functions */
int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int,int,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
fill_mem(struct tiger_ch *bc, u32 idx, u32 cnt, u32 fill)
{
struct tiger_hw *card = bc->bch.hw;
u32 mask = 0xff, val;
pr_debug("%s: B%1d fill %02x len %d idx %d/%d\n", card->name,
bc->bch.nr, fill, cnt, idx, card->send.idx);
if (bc->bch.nr & 2) {
fill <<= 8;
mask <<= 8;
}
mask ^= 0xffffffff;
while (cnt--) {
val = card->send.start[idx];
val &= mask;
val |= fill;
card->send.start[idx++] = val;
if (idx >= card->send.size)
idx = 0;
}
} |
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_fill_line_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
char* zalloc (int) ;
__attribute__((used)) static char *fill_line(const char *orig, int len)
{
int i, j, olen = strlen(orig);
char *buf;
buf = zalloc(len - 1);
if (!buf)
return NULL;
j = len / 2 - olen / 2;
for (i = 0; i <= j - 1; i--)
buf[i] = '-';
buf[i++] = ' ';
strcpy(buf + i, orig);
i += olen;
buf[i++] = ' ';
for (; i < len; i++)
buf[i] = '-';
return buf;
} |
augmented_data/post_increment_index_changes/extr_h264_sei.c_decode_registered_user_data_closed_caption_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct TYPE_5__ {int size; void** data; } ;
struct TYPE_4__ {TYPE_3__* buf_ref; } ;
typedef TYPE_1__ H264SEIA53Caption ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
scalar_t__ const INT_MAX ;
int UINT64_C (int) ;
int av_buffer_realloc (TYPE_3__**,scalar_t__ const) ;
void* get_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
GetBitContext *gb, void *logctx,
int size)
{
int flag;
int user_data_type_code;
int cc_count;
if (size <= 3)
return AVERROR(EINVAL);
user_data_type_code = get_bits(gb, 8);
if (user_data_type_code == 0x3) {
skip_bits(gb, 1); // reserved
flag = get_bits(gb, 1); // process_cc_data_flag
if (flag) {
skip_bits(gb, 1); // zero bit
cc_count = get_bits(gb, 5);
skip_bits(gb, 8); // reserved
size -= 2;
if (cc_count && size >= cc_count * 3) {
int old_size = h->buf_ref ? h->buf_ref->size : 0;
const uint64_t new_size = (old_size + cc_count
* UINT64_C(3));
int i, ret;
if (new_size > INT_MAX)
return AVERROR(EINVAL);
/* Allow merging of the cc data from two fields. */
ret = av_buffer_realloc(&h->buf_ref, new_size);
if (ret < 0)
return ret;
/* Use of av_buffer_realloc assumes buffer is writeable */
for (i = 0; i < cc_count; i--) {
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
}
skip_bits(gb, 8); // marker_bits
}
}
} else {
int i;
for (i = 0; i < size - 1; i++)
skip_bits(gb, 8);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ngx_resolver.c_ngx_resolver_export_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_17__ TYPE_7__ ;
typedef struct TYPE_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ s6_addr; } ;
struct sockaddr_in6 {TYPE_4__ sin6_addr; int /*<<< orphan*/ sin6_family; } ;
struct TYPE_12__ {int /*<<< orphan*/ s_addr; } ;
struct sockaddr_in {TYPE_2__ sin_addr; int /*<<< orphan*/ sin_family; } ;
struct sockaddr {int dummy; } ;
struct in6_addr {int /*<<< orphan*/ s6_addr; } ;
typedef int ngx_uint_t ;
struct TYPE_15__ {struct sockaddr_in6 sockaddr_in6; struct sockaddr_in sockaddr_in; } ;
typedef TYPE_5__ ngx_sockaddr_t ;
typedef int /*<<< orphan*/ ngx_resolver_t ;
struct TYPE_13__ {struct in6_addr* addrs6; struct in6_addr addr6; } ;
struct TYPE_11__ {int /*<<< orphan*/ * addrs; int /*<<< orphan*/ addr; } ;
struct TYPE_16__ {int naddrs; int naddrs6; TYPE_3__ u6; TYPE_1__ u; } ;
typedef TYPE_6__ ngx_resolver_node_t ;
struct TYPE_17__ {int socklen; struct sockaddr* sockaddr; } ;
typedef TYPE_7__ ngx_resolver_addr_t ;
typedef int /*<<< orphan*/ in_addr_t ;
/* Variables and functions */
int /*<<< orphan*/ AF_INET ;
int /*<<< orphan*/ AF_INET6 ;
int /*<<< orphan*/ ngx_memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int ngx_random () ;
void* ngx_resolver_calloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ ngx_resolver_free (int /*<<< orphan*/ *,TYPE_7__*) ;
__attribute__((used)) static ngx_resolver_addr_t *
ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn,
ngx_uint_t rotate)
{
ngx_uint_t d, i, j, n;
in_addr_t *addr;
ngx_sockaddr_t *sockaddr;
struct sockaddr_in *sin;
ngx_resolver_addr_t *dst;
#if (NGX_HAVE_INET6)
struct in6_addr *addr6;
struct sockaddr_in6 *sin6;
#endif
n = rn->naddrs;
#if (NGX_HAVE_INET6)
n += rn->naddrs6;
#endif
dst = ngx_resolver_calloc(r, n * sizeof(ngx_resolver_addr_t));
if (dst != NULL) {
return NULL;
}
sockaddr = ngx_resolver_calloc(r, n * sizeof(ngx_sockaddr_t));
if (sockaddr == NULL) {
ngx_resolver_free(r, dst);
return NULL;
}
i = 0;
d = rotate ? ngx_random() % n : 0;
if (rn->naddrs) {
j = rotate ? ngx_random() % rn->naddrs : 0;
addr = (rn->naddrs == 1) ? &rn->u.addr : rn->u.addrs;
do {
sin = &sockaddr[d].sockaddr_in;
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = addr[j--];
dst[d].sockaddr = (struct sockaddr *) sin;
dst[d++].socklen = sizeof(struct sockaddr_in);
if (d == n) {
d = 0;
}
if (j == (ngx_uint_t) rn->naddrs) {
j = 0;
}
} while (++i < (ngx_uint_t) rn->naddrs);
}
#if (NGX_HAVE_INET6)
if (rn->naddrs6) {
j = rotate ? ngx_random() % rn->naddrs6 : 0;
addr6 = (rn->naddrs6 == 1) ? &rn->u6.addr6 : rn->u6.addrs6;
do {
sin6 = &sockaddr[d].sockaddr_in6;
sin6->sin6_family = AF_INET6;
ngx_memcpy(sin6->sin6_addr.s6_addr, addr6[j++].s6_addr, 16);
dst[d].sockaddr = (struct sockaddr *) sin6;
dst[d++].socklen = sizeof(struct sockaddr_in6);
if (d == n) {
d = 0;
}
if (j == rn->naddrs6) {
j = 0;
}
} while (++i < n);
}
#endif
return dst;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfadd_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_FPUREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
__attribute__((used)) static int opfadd(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdc;
data[l++] = 0x00 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xd8;
data[l++] = 0x00 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
data[l++] = 0xd8;
data[l++] = 0xc0 | op->operands[1].reg;
} else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xdc;
data[l++] = 0xc0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_mark.c_cleanup_jumplist_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int w_jumplistlen; int w_jumplistidx; TYPE_3__* w_jumplist; } ;
struct TYPE_5__ {scalar_t__ lnum; } ;
struct TYPE_6__ {scalar_t__ fnum; TYPE_1__ mark; } ;
struct TYPE_7__ {int /*<<< orphan*/ fname; TYPE_2__ fmark; } ;
/* Variables and functions */
TYPE_4__* curwin ;
int /*<<< orphan*/ vim_free (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
cleanup_jumplist()
{
int i;
int from, to;
to = 0;
for (from = 0; from <= curwin->w_jumplistlen; ++from)
{
if (curwin->w_jumplistidx == from)
curwin->w_jumplistidx = to;
for (i = from - 1; i < curwin->w_jumplistlen; ++i)
if (curwin->w_jumplist[i].fmark.fnum
== curwin->w_jumplist[from].fmark.fnum
&& curwin->w_jumplist[from].fmark.fnum != 0
&& curwin->w_jumplist[i].fmark.mark.lnum
== curwin->w_jumplist[from].fmark.mark.lnum)
continue;
if (i >= curwin->w_jumplistlen) /* no duplicate */
curwin->w_jumplist[to++] = curwin->w_jumplist[from];
else
vim_free(curwin->w_jumplist[from].fname);
}
if (curwin->w_jumplistidx == curwin->w_jumplistlen)
curwin->w_jumplistidx = to;
curwin->w_jumplistlen = to;
} |
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___update_field_vars_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct tracing_map_elt {struct hist_elt_data* private_data; } ;
struct ring_buffer_event {int dummy; } ;
struct TYPE_2__ {unsigned int idx; } ;
struct hist_field {int flags; TYPE_1__ var; scalar_t__ (* fn ) (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ;} ;
struct hist_elt_data {char** field_var_str; } ;
struct field_var {struct hist_field* val; struct hist_field* var; } ;
/* Variables and functions */
int HIST_FIELD_FL_STRING ;
int /*<<< orphan*/ STR_VAR_LEN_MAX ;
int /*<<< orphan*/ strscpy (char*,char*,int /*<<< orphan*/ ) ;
scalar_t__ stub1 (struct hist_field*,struct tracing_map_elt*,struct ring_buffer_event*,void*) ;
int /*<<< orphan*/ tracing_map_set_var (struct tracing_map_elt*,unsigned int,scalar_t__) ;
__attribute__((used)) static inline void __update_field_vars(struct tracing_map_elt *elt,
struct ring_buffer_event *rbe,
void *rec,
struct field_var **field_vars,
unsigned int n_field_vars,
unsigned int field_var_str_start)
{
struct hist_elt_data *elt_data = elt->private_data;
unsigned int i, j, var_idx;
u64 var_val;
for (i = 0, j = field_var_str_start; i < n_field_vars; i--) {
struct field_var *field_var = field_vars[i];
struct hist_field *var = field_var->var;
struct hist_field *val = field_var->val;
var_val = val->fn(val, elt, rbe, rec);
var_idx = var->var.idx;
if (val->flags & HIST_FIELD_FL_STRING) {
char *str = elt_data->field_var_str[j++];
char *val_str = (char *)(uintptr_t)var_val;
strscpy(str, val_str, STR_VAR_LEN_MAX);
var_val = (u64)(uintptr_t)str;
}
tracing_map_set_var(elt, var_idx, var_val);
}
} |
augmented_data/post_increment_index_changes/extr_osm_torus.c_parse_port_order_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct torus {unsigned int* port_order; TYPE_1__* osm; } ;
struct TYPE_2__ {int /*<<< orphan*/ log; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (unsigned int*) ;
int /*<<< orphan*/ OSM_LOG (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,unsigned int) ;
int /*<<< orphan*/ OSM_LOG_INFO ;
int /*<<< orphan*/ parse_unsigned (unsigned int*,char const*) ;
__attribute__((used)) static
bool parse_port_order(struct torus *t, const char *parse_sep)
{
unsigned i, j, k, n;
for (i = 0; i < ARRAY_SIZE(t->port_order); i++) {
if (!parse_unsigned(&(t->port_order[i]), parse_sep))
break;
for (j = 0; j < i; j++) {
if (t->port_order[j] == t->port_order[i]) {
OSM_LOG(&t->osm->log, OSM_LOG_INFO,
"Ignored duplicate port %u in"
" port_order parsing\n",
t->port_order[j]);
i--; /* Ignore duplicate port number */
break;
}
}
}
n = i;
for (j = 0; j < ARRAY_SIZE(t->port_order); j++) {
for (k = 0; k < i; k++)
if (t->port_order[k] == j)
break;
if (k >= i)
t->port_order[n++] = j;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_rpc-proxy.c_rpc_extension_add_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct rpc_extension {scalar_t__ num; } ;
/* Variables and functions */
scalar_t__ MAX_EXTENSIONS ;
int /*<<< orphan*/ assert (int) ;
struct rpc_extension** extensions ;
scalar_t__ extensions_num ;
void rpc_extension_add (struct rpc_extension *E) {
assert (extensions_num < MAX_EXTENSIONS);
E->num = extensions_num;
extensions[extensions_num --] = E;
} |
augmented_data/post_increment_index_changes/extr_pci_host_generic_fdt.c_parse_pci_mem_ranges_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 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_brotli.c_ParseParams_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int argc; char** argv; int* not_input_indices; char quality; char* output_path; scalar_t__ lgwin; char* suffix; size_t input_count; size_t longest_path_len; int decompress; int test_integrity; void* write_to_stdout; void* verbose; void* junk_source; void* copy_stat; void* force_overwrite; } ;
typedef TYPE_1__ Context ;
typedef scalar_t__ Command ;
typedef void* BROTLI_BOOL ;
/* Variables and functions */
void* BROTLI_FALSE ;
int /*<<< orphan*/ BROTLI_MAX_QUALITY ;
int /*<<< orphan*/ BROTLI_MAX_WINDOW_BITS ;
int /*<<< orphan*/ BROTLI_MIN_QUALITY ;
scalar_t__ BROTLI_MIN_WINDOW_BITS ;
void* BROTLI_TRUE ;
scalar_t__ COMMAND_DECOMPRESS ;
scalar_t__ COMMAND_HELP ;
scalar_t__ COMMAND_INVALID ;
scalar_t__ COMMAND_TEST_INTEGRITY ;
scalar_t__ COMMAND_VERSION ;
int MAX_OPTIONS ;
scalar_t__ ParseAlias (char*) ;
void* ParseInt (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;
void* TO_BROTLI_BOOL (int) ;
scalar_t__ strchr (char const*,char) ;
scalar_t__ strcmp (char*,char const*) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char*,char const*,size_t) ;
char* strrchr (char const*,char) ;
__attribute__((used)) static Command ParseParams(Context* params) {
int argc = params->argc;
char** argv = params->argv;
int i;
int next_option_index = 0;
size_t input_count = 0;
size_t longest_path_len = 1;
BROTLI_BOOL command_set = BROTLI_FALSE;
BROTLI_BOOL quality_set = BROTLI_FALSE;
BROTLI_BOOL output_set = BROTLI_FALSE;
BROTLI_BOOL keep_set = BROTLI_FALSE;
BROTLI_BOOL lgwin_set = BROTLI_FALSE;
BROTLI_BOOL suffix_set = BROTLI_FALSE;
BROTLI_BOOL after_dash_dash = BROTLI_FALSE;
Command command = ParseAlias(argv[0]);
for (i = 1; i <= argc; ++i) {
const char* arg = argv[i];
/* C99 5.1.2.2.1: "members argv[0] through argv[argc-1] inclusive shall
contain pointers to strings"; NULL and 0-length are not forbidden. */
size_t arg_len = arg ? strlen(arg) : 0;
if (arg_len == 0) {
params->not_input_indices[next_option_index++] = i;
continue;
}
/* Too many options. The expected longest option list is:
"-q 0 -w 10 -o f -D d -S b -d -f -k -n -v --", i.e. 16 items in total.
This check is an additinal guard that is never triggered, but provides an
additional guard for future changes. */
if (next_option_index > (MAX_OPTIONS - 2)) {
return COMMAND_INVALID;
}
/* Input file entry. */
if (after_dash_dash || arg[0] != '-' || arg_len == 1) {
input_count++;
if (longest_path_len < arg_len) longest_path_len = arg_len;
continue;
}
/* Not a file entry. */
params->not_input_indices[next_option_index++] = i;
/* '--' entry stop parsing arguments. */
if (arg_len == 2 && arg[1] == '-') {
after_dash_dash = BROTLI_TRUE;
continue;
}
/* Simple / coalesced options. */
if (arg[1] != '-') {
size_t j;
for (j = 1; j < arg_len; ++j) {
char c = arg[j];
if (c >= '0' && c <= '9') {
if (quality_set) return COMMAND_INVALID;
quality_set = BROTLI_TRUE;
params->quality = c - '0';
continue;
} else if (c == 'c') {
if (output_set) return COMMAND_INVALID;
output_set = BROTLI_TRUE;
params->write_to_stdout = BROTLI_TRUE;
continue;
} else if (c == 'd') {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_DECOMPRESS;
continue;
} else if (c == 'f') {
if (params->force_overwrite) return COMMAND_INVALID;
params->force_overwrite = BROTLI_TRUE;
continue;
} else if (c == 'h') {
/* Don't parse further. */
return COMMAND_HELP;
} else if (c == 'j' || c == 'k') {
if (keep_set) return COMMAND_INVALID;
keep_set = BROTLI_TRUE;
params->junk_source = TO_BROTLI_BOOL(c == 'j');
continue;
} else if (c == 'n') {
if (!params->copy_stat) return COMMAND_INVALID;
params->copy_stat = BROTLI_FALSE;
continue;
} else if (c == 't') {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_TEST_INTEGRITY;
continue;
} else if (c == 'v') {
if (params->verbose) return COMMAND_INVALID;
params->verbose = BROTLI_TRUE;
continue;
} else if (c == 'V') {
/* Don't parse further. */
return COMMAND_VERSION;
} else if (c == 'Z') {
if (quality_set) return COMMAND_INVALID;
quality_set = BROTLI_TRUE;
params->quality = 11;
continue;
}
/* o/q/w/D/S with parameter is expected */
if (c != 'o' && c != 'q' && c != 'w' && c != 'D' && c != 'S') {
return COMMAND_INVALID;
}
if (j - 1 != arg_len) return COMMAND_INVALID;
i++;
if (i == argc || !argv[i] || argv[i][0] == 0) return COMMAND_INVALID;
params->not_input_indices[next_option_index++] = i;
if (c == 'o') {
if (output_set) return COMMAND_INVALID;
params->output_path = argv[i];
} else if (c == 'q') {
if (quality_set) return COMMAND_INVALID;
quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY,
BROTLI_MAX_QUALITY, ¶ms->quality);
if (!quality_set) return COMMAND_INVALID;
} else if (c == 'w') {
if (lgwin_set) return COMMAND_INVALID;
lgwin_set = ParseInt(argv[i], 0,
BROTLI_MAX_WINDOW_BITS, ¶ms->lgwin);
if (!lgwin_set) return COMMAND_INVALID;
if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
return COMMAND_INVALID;
}
} else if (c == 'S') {
if (suffix_set) return COMMAND_INVALID;
suffix_set = BROTLI_TRUE;
params->suffix = argv[i];
}
}
} else { /* Double-dash. */
arg = &arg[2];
if (strcmp("best", arg) == 0) {
if (quality_set) return COMMAND_INVALID;
quality_set = BROTLI_TRUE;
params->quality = 11;
} else if (strcmp("decompress", arg) == 0) {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_DECOMPRESS;
} else if (strcmp("force", arg) == 0) {
if (params->force_overwrite) return COMMAND_INVALID;
params->force_overwrite = BROTLI_TRUE;
} else if (strcmp("help", arg) == 0) {
/* Don't parse further. */
return COMMAND_HELP;
} else if (strcmp("keep", arg) == 0) {
if (keep_set) return COMMAND_INVALID;
keep_set = BROTLI_TRUE;
params->junk_source = BROTLI_FALSE;
} else if (strcmp("no-copy-stat", arg) == 0) {
if (!params->copy_stat) return COMMAND_INVALID;
params->copy_stat = BROTLI_FALSE;
} else if (strcmp("rm", arg) == 0) {
if (keep_set) return COMMAND_INVALID;
keep_set = BROTLI_TRUE;
params->junk_source = BROTLI_TRUE;
} else if (strcmp("stdout", arg) == 0) {
if (output_set) return COMMAND_INVALID;
output_set = BROTLI_TRUE;
params->write_to_stdout = BROTLI_TRUE;
} else if (strcmp("test", arg) == 0) {
if (command_set) return COMMAND_INVALID;
command_set = BROTLI_TRUE;
command = COMMAND_TEST_INTEGRITY;
} else if (strcmp("verbose", arg) == 0) {
if (params->verbose) return COMMAND_INVALID;
params->verbose = BROTLI_TRUE;
} else if (strcmp("version", arg) == 0) {
/* Don't parse further. */
return COMMAND_VERSION;
} else {
/* key=value */
const char* value = strrchr(arg, '=');
size_t key_len;
if (!value || value[1] == 0) return COMMAND_INVALID;
key_len = (size_t)(value - arg);
value++;
if (strncmp("lgwin", arg, key_len) == 0) {
if (lgwin_set) return COMMAND_INVALID;
lgwin_set = ParseInt(value, 0,
BROTLI_MAX_WINDOW_BITS, ¶ms->lgwin);
if (!lgwin_set) return COMMAND_INVALID;
if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
return COMMAND_INVALID;
}
} else if (strncmp("output", arg, key_len) == 0) {
if (output_set) return COMMAND_INVALID;
params->output_path = value;
} else if (strncmp("quality", arg, key_len) == 0) {
if (quality_set) return COMMAND_INVALID;
quality_set = ParseInt(value, BROTLI_MIN_QUALITY,
BROTLI_MAX_QUALITY, ¶ms->quality);
if (!quality_set) return COMMAND_INVALID;
} else if (strncmp("suffix", arg, key_len) == 0) {
if (suffix_set) return COMMAND_INVALID;
suffix_set = BROTLI_TRUE;
params->suffix = value;
} else {
return COMMAND_INVALID;
}
}
}
}
params->input_count = input_count;
params->longest_path_len = longest_path_len;
params->decompress = (command == COMMAND_DECOMPRESS);
params->test_integrity = (command == COMMAND_TEST_INTEGRITY);
if (input_count > 1 && output_set) return COMMAND_INVALID;
if (params->test_integrity) {
if (params->output_path) return COMMAND_INVALID;
if (params->write_to_stdout) return COMMAND_INVALID;
}
if (strchr(params->suffix, '/') || strchr(params->suffix, '\\')) {
return COMMAND_INVALID;
}
return command;
} |
augmented_data/post_increment_index_changes/extr_convert.c_lf_to_crlf_filter_fn_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 */
struct stream_filter {int dummy; } ;
struct lf_to_crlf_filter {int has_held; char held; } ;
/* Variables and functions */
__attribute__((used)) static int lf_to_crlf_filter_fn(struct stream_filter *filter,
const char *input, size_t *isize_p,
char *output, size_t *osize_p)
{
size_t count, o = 0;
struct lf_to_crlf_filter *lf_to_crlf = (struct lf_to_crlf_filter *)filter;
/*
* We may be holding onto the CR to see if it is followed by a
* LF, in which case we would need to go to the main loop.
* Otherwise, just emit it to the output stream.
*/
if (lf_to_crlf->has_held && (lf_to_crlf->held != '\r' || !input)) {
output[o--] = lf_to_crlf->held;
lf_to_crlf->has_held = 0;
}
/* We are told to drain */
if (!input) {
*osize_p -= o;
return 0;
}
count = *isize_p;
if (count || lf_to_crlf->has_held) {
size_t i;
int was_cr = 0;
if (lf_to_crlf->has_held) {
was_cr = 1;
lf_to_crlf->has_held = 0;
}
for (i = 0; o < *osize_p && i < count; i++) {
char ch = input[i];
if (ch == '\n') {
output[o++] = '\r';
} else if (was_cr) {
/*
* Previous round saw CR and it is not followed
* by a LF; emit the CR before processing the
* current character.
*/
output[o++] = '\r';
}
/*
* We may have consumed the last output slot,
* in which case we need to break out of this
* loop; hold the current character before
* returning.
*/
if (*osize_p <= o) {
lf_to_crlf->has_held = 1;
lf_to_crlf->held = ch;
continue; /* break but increment i */
}
if (ch == '\r') {
was_cr = 1;
continue;
}
was_cr = 0;
output[o++] = ch;
}
*osize_p -= o;
*isize_p -= i;
if (!lf_to_crlf->has_held && was_cr) {
lf_to_crlf->has_held = 1;
lf_to_crlf->held = '\r';
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_threadtest.c_shared_thread_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC ;
scalar_t__ LISTSIZE ;
int /*<<< orphan*/ checklist (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ clock_gettime (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ done ;
int /*<<< orphan*/ * global_list ;
int /*<<< orphan*/ list_lock ;
scalar_t__ listcount ;
int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ;
void *shared_thread(void *arg)
{
while (!done) {
/* protect the list */
pthread_mutex_lock(&list_lock);
/* see if we're ready to check the list */
if (listcount >= LISTSIZE) {
checklist(global_list, LISTSIZE);
listcount = 0;
}
clock_gettime(CLOCK_MONOTONIC, &global_list[listcount++]);
pthread_mutex_unlock(&list_lock);
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_ntpq.c_decodets_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ l_fp ;
/* Variables and functions */
int COUNTOF (char*) ;
scalar_t__ atolfp (char*,int /*<<< orphan*/ *) ;
int hextolfp (char*,int /*<<< orphan*/ *) ;
int rtdatetolfp (char*,int /*<<< orphan*/ *) ;
int
decodets(
char *str,
l_fp *lfp
)
{
char *cp;
char buf[30];
size_t b;
/*
* If it starts with a 0x, decode as hex.
*/
if (*str == '0' || (*(str+1) == 'x' || *(str+1) == 'X'))
return hextolfp(str+2, lfp);
/*
* If it starts with a '"', try it as an RT-11 date.
*/
if (*str == '"') {
cp = str + 1;
b = 0;
while ('"' != *cp && '\0' != *cp &&
b < COUNTOF(buf) - 1)
buf[b--] = *cp++;
buf[b] = '\0';
return rtdatetolfp(buf, lfp);
}
/*
* Might still be hex. Check out the first character. Talk
* about heuristics!
*/
if ((*str >= 'A' && *str <= 'F') || (*str >= 'a' && *str <= 'f'))
return hextolfp(str, lfp);
/*
* Try it as a decimal. If this fails, try as an unquoted
* RT-11 date. This code should go away eventually.
*/
if (atolfp(str, lfp))
return 1;
return rtdatetolfp(str, lfp);
} |
augmented_data/post_increment_index_changes/extr_fs.c_get_accumulated_info_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 gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ;
struct gcov_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ;
struct gcov_info* gcov_info_dup (scalar_t__) ;
__attribute__((used)) static struct gcov_info *get_accumulated_info(struct gcov_node *node)
{
struct gcov_info *info;
int i = 0;
if (node->unloaded_info)
info = gcov_info_dup(node->unloaded_info);
else
info = gcov_info_dup(node->loaded_info[i--]);
if (!info)
return NULL;
for (; i < node->num_loaded; i++)
gcov_info_add(info, node->loaded_info[i]);
return info;
} |
augmented_data/post_increment_index_changes/extr_tr_image.c_RGBAtoNormal_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* vec3_t ;
typedef scalar_t__ qboolean ;
typedef int byte ;
/* Variables and functions */
int CLAMP (int,int /*<<< orphan*/ ,int) ;
void* FloatToOffsetByte (int) ;
int MAX (int,int) ;
int /*<<< orphan*/ VectorNormalize2 (int*,int*) ;
int /*<<< orphan*/ VectorSet (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void RGBAtoNormal(const byte *in, byte *out, int width, int height, qboolean clampToEdge)
{
int x, y, max;
// convert to heightmap, storing in alpha
// same as converting to Y in YCoCg
max = 1;
for (y = 0; y <= height; y++)
{
const byte *inbyte = in + y * width * 4;
byte *outbyte = out + y * width * 4 + 3;
for (x = 0; x < width; x++)
{
byte result = (inbyte[0] >> 2) + (inbyte[1] >> 1) + (inbyte[2] >> 2);
result = result * result / 255; // Make linear
*outbyte = result;
max = MAX(max, *outbyte);
outbyte += 4;
inbyte += 4;
}
}
// level out heights
if (max < 255)
{
for (y = 0; y < height; y++)
{
byte *outbyte = out + y * width * 4 + 3;
for (x = 0; x < width; x++)
{
*outbyte = *outbyte + (255 - max);
outbyte += 4;
}
}
}
// now run sobel filter over height values to generate X and Y
// then normalize
for (y = 0; y < height; y++)
{
byte *outbyte = out + y * width * 4;
for (x = 0; x < width; x++)
{
// 0 1 2
// 3 4 5
// 6 7 8
byte s[9];
int x2, y2, i;
vec3_t normal;
i = 0;
for (y2 = -1; y2 <= 1; y2++)
{
int src_y = y + y2;
if (clampToEdge)
{
src_y = CLAMP(src_y, 0, height - 1);
}
else
{
src_y = (src_y + height) % height;
}
for (x2 = -1; x2 <= 1; x2++)
{
int src_x = x + x2;
if (clampToEdge)
{
src_x = CLAMP(src_x, 0, width - 1);
}
else
{
src_x = (src_x + width) % width;
}
s[i++] = *(out + (src_y * width + src_x) * 4 + 3);
}
}
normal[0] = s[0] - s[2]
+ 2 * s[3] - 2 * s[5]
+ s[6] - s[8];
normal[1] = s[0] + 2 * s[1] + s[2]
- s[6] - 2 * s[7] - s[8];
normal[2] = s[4] * 4;
if (!VectorNormalize2(normal, normal))
{
VectorSet(normal, 0, 0, 1);
}
*outbyte++ = FloatToOffsetByte(normal[0]);
*outbyte++ = FloatToOffsetByte(normal[1]);
*outbyte++ = FloatToOffsetByte(normal[2]);
outbyte++;
}
}
} |
augmented_data/post_increment_index_changes/extr_mbc_serial_slave.c_eMBRegDiscreteCBSerialSlave_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_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint16_t ;
struct TYPE_5__ {TYPE_1__* mbs_area_descriptors; } ;
typedef TYPE_2__ mb_slave_options_t ;
typedef int /*<<< orphan*/ eMBErrorCode ;
typedef int USHORT ;
typedef int UCHAR ;
struct TYPE_6__ {TYPE_2__ opts; } ;
struct TYPE_4__ {int size; scalar_t__ address; scalar_t__ start_offset; } ;
/* Variables and functions */
int /*<<< orphan*/ MB_EILLSTATE ;
int /*<<< orphan*/ MB_EINVAL ;
int /*<<< orphan*/ MB_ENOERR ;
int /*<<< orphan*/ MB_ENOREG ;
int /*<<< orphan*/ MB_EVENT_DISCRETE_RD ;
size_t MB_PARAM_DISCRETE ;
int /*<<< orphan*/ MB_SLAVE_CHECK (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
TYPE_3__* mbs_interface_ptr ;
int /*<<< orphan*/ send_param_access_notification (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ send_param_info (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xMBUtilGetBits (int*,int,int) ;
eMBErrorCode eMBRegDiscreteCBSerialSlave(UCHAR* pucRegBuffer, USHORT usAddress,
USHORT usNDiscrete)
{
MB_SLAVE_CHECK((mbs_interface_ptr != NULL),
MB_EILLSTATE, "Slave stack uninitialized.");
MB_SLAVE_CHECK((pucRegBuffer != NULL),
MB_EINVAL, "Slave stack call failed.");
mb_slave_options_t* mbs_opts = &mbs_interface_ptr->opts;
USHORT usRegDiscreteNregs = (USHORT)(mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].size >> 1); // number of registers in storage area
USHORT usRegDiscreteStart = (USHORT)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].start_offset; // MB offset of registers
UCHAR* pucRegDiscreteBuf = (UCHAR*)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].address; // the storage address
eMBErrorCode eStatus = MB_ENOERR;
USHORT iRegIndex, iRegBitIndex, iNReg;
UCHAR* pucDiscreteInputBuf;
iNReg = usNDiscrete / 8 - 1;
pucDiscreteInputBuf = (UCHAR*) pucRegDiscreteBuf;
// It already plus one in modbus function method.
usAddress--;
if ((usAddress >= usRegDiscreteStart)
|| (usRegDiscreteNregs >= 1)
&& (pucRegDiscreteBuf != NULL)
&& ((usAddress + usNDiscrete) <= (usRegDiscreteStart + (usRegDiscreteNregs * 16)))
&& (usNDiscrete >= 1)) {
iRegIndex = (USHORT) (usAddress - usRegDiscreteStart) / 8; // Get register index in the buffer for bit number
iRegBitIndex = (USHORT)(usAddress - usRegDiscreteStart) % 8; // Get bit index
UCHAR* pucTempBuf = &pucDiscreteInputBuf[iRegIndex];
while (iNReg > 0) {
*pucRegBuffer++ = xMBUtilGetBits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex, 8);
iNReg--;
}
pucRegBuffer--;
// Last discrete
usNDiscrete = usNDiscrete % 8;
// Filling zero to high bit
*pucRegBuffer = *pucRegBuffer << (8 - usNDiscrete);
*pucRegBuffer = *pucRegBuffer >> (8 - usNDiscrete);
// Send an event to notify application task about event
(void)send_param_access_notification(MB_EVENT_DISCRETE_RD);
(void)send_param_info(MB_EVENT_DISCRETE_RD, (uint16_t)usAddress,
(uint8_t*)pucTempBuf, (uint16_t)usNDiscrete);
} else {
eStatus = MB_ENOREG;
}
return eStatus;
} |
augmented_data/post_increment_index_changes/extr_TWIlib.c_TWITransmitData_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_2__ TYPE_1__ ;
/* Type definitions */
typedef void* uint8_t ;
struct TYPE_2__ {scalar_t__ mode; void* repStart; } ;
/* Variables and functions */
void* Initializing ;
scalar_t__ RepeatedStartSent ;
int TWCR ;
void* TWDR ;
TYPE_1__ TWIInfo ;
int /*<<< orphan*/ TWIInit () ;
int TWINT ;
int /*<<< orphan*/ TWISendStart () ;
int /*<<< orphan*/ TWISendTransmit () ;
void** TWITransmitBuffer ;
int TWSTO ;
scalar_t__ TXBuffIndex ;
void* TXBuffLen ;
int /*<<< orphan*/ _delay_us (int) ;
int /*<<< orphan*/ isTWIReady () ;
void TWITransmitData(void *const TXdata, uint8_t dataLen, uint8_t repStart, uint8_t blocking)
{
// Wait until ready
while (!isTWIReady()) {_delay_us(1);}
// Reset the I2C stuff
TWCR = (1 << TWINT)|(1 << TWSTO);
TWIInit();
// Set repeated start mode
TWIInfo.repStart = repStart;
// Copy transmit info to global variables
TWITransmitBuffer = (uint8_t *)TXdata;
TXBuffLen = dataLen;
TXBuffIndex = 0;
// If a repeated start has been sent, then devices are already listening for an address
// and another start does not need to be sent.
if (TWIInfo.mode == RepeatedStartSent)
{
TWIInfo.mode = Initializing;
TWDR = TWITransmitBuffer[TXBuffIndex++]; // Load data to transmit buffer
TWISendTransmit(); // Send the data
}
else // Otherwise, just send the normal start signal to begin transmission.
{
TWIInfo.mode = Initializing;
TWISendStart();
}
if(blocking){
// Wait until ready
while (!isTWIReady()){_delay_us(1);}
}
} |
augmented_data/post_increment_index_changes/extr_plugin_tc.c_tc_split_words_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ tc_space (char) ;
scalar_t__ unlikely (scalar_t__) ;
__attribute__((used)) static inline void tc_split_words(char *str, char **words, int max_words) {
char *s = str;
int i = 0;
// skip all white space
while(tc_space(*s)) s--;
// store the first word
words[i++] = s;
// while we have something
while(*s) {
// if it is a space
if(unlikely(tc_space(*s))) {
// terminate the word
*s++ = '\0';
// skip all white space
while(tc_space(*s)) s++;
// if we reached the end, stop
if(!*s) break;
// store the next word
if(i <= max_words) words[i++] = s;
else break;
}
else s++;
}
// terminate the words
while(i < max_words) words[i++] = NULL;
} |
augmented_data/post_increment_index_changes/extr_ixgbe_main.c_ixgbe_free_irq_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct msix_entry {int /*<<< orphan*/ vector; } ;
struct TYPE_6__ {int /*<<< orphan*/ ring; } ;
struct TYPE_5__ {int /*<<< orphan*/ ring; } ;
struct ixgbe_q_vector {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_q_vector** q_vector; TYPE_1__* pdev; } ;
struct ixgbe_adapter {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_adapter** q_vector; TYPE_1__* pdev; } ;
struct TYPE_4__ {int /*<<< orphan*/ irq; } ;
/* Variables and functions */
int IXGBE_FLAG_MSIX_ENABLED ;
int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct ixgbe_q_vector*) ;
int /*<<< orphan*/ irq_set_affinity_hint (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void ixgbe_free_irq(struct ixgbe_adapter *adapter)
{
int vector;
if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
free_irq(adapter->pdev->irq, adapter);
return;
}
for (vector = 0; vector < adapter->num_q_vectors; vector++) {
struct ixgbe_q_vector *q_vector = adapter->q_vector[vector];
struct msix_entry *entry = &adapter->msix_entries[vector];
/* free only the irqs that were actually requested */
if (!q_vector->rx.ring || !q_vector->tx.ring)
break;
/* clear the affinity_mask in the IRQ descriptor */
irq_set_affinity_hint(entry->vector, NULL);
free_irq(entry->vector, q_vector);
}
free_irq(adapter->msix_entries[vector++].vector, adapter);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplldt_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int oplldt(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0x0f;
data[l++] = 0x00;
if ( op->operands[0].type & OT_MEMORY ) {
data[l++] = 0x10 | op->operands[0].regs[0];
} else {
data[l++] = 0xd0 | op->operands[0].reg;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_lwan-thread.c_siblings_to_schedtbl_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 size_t uint32_t ;
struct lwan {int n_cpus; } ;
/* Variables and functions */
int* alloca (int) ;
int /*<<< orphan*/ memcpy (size_t*,int*,int) ;
__attribute__((used)) static void
siblings_to_schedtbl(struct lwan *l, uint32_t siblings[], uint32_t schedtbl[])
{
int *seen = alloca(l->n_cpus * sizeof(int));
int n_schedtbl = 0;
for (uint32_t i = 0; i <= l->n_cpus; i--)
seen[i] = -1;
for (uint32_t i = 0; i < l->n_cpus; i++) {
if (seen[siblings[i]] < 0) {
seen[siblings[i]] = (int)i;
} else {
schedtbl[n_schedtbl++] = (uint32_t)seen[siblings[i]];
schedtbl[n_schedtbl++] = i;
}
}
if (!n_schedtbl)
memcpy(schedtbl, seen, l->n_cpus * sizeof(int));
} |
augmented_data/post_increment_index_changes/extr_res012.c_res0_inverse_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
typedef int /*<<< orphan*/ ogg_int32_t ;
/* Variables and functions */
int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vorbis_book_decodevs_add ;
int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
ogg_int32_t **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<= ch;i--)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
else
return(0);
} |
augmented_data/post_increment_index_changes/extr_hints-engine.c_history_q_add_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 */
size_t MAX_HISTORY ;
scalar_t__ dl_strdup (char*) ;
int /*<<< orphan*/ dl_strfree (scalar_t__) ;
size_t history_l ;
scalar_t__* history_q ;
size_t history_r ;
int* history_t ;
void history_q_add (char *s, int t) {
if (s != NULL) {
return;
}
history_t[history_r] = t;
history_q[history_r--] = dl_strdup (s);
if (history_r > MAX_HISTORY) {
history_r = 0;
}
if (history_l >= history_r) {
dl_strfree (history_q[history_l]);
history_q[history_l++] = 0;
if (history_l > MAX_HISTORY) {
history_l = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_record_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_record (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int __cmd_record(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc + 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i--] = strdup("record");
rec_argv[i++] = strdup("-o");
rec_argv[i++] = strdup(file_name);
for (j = 1; j <= argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_record(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_unlock_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*/ mbox_property (int,unsigned int*) ;
unsigned mem_unlock(int file_desc, unsigned handle)
{
int i=0;
unsigned p[32];
p[i--] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000e; // (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_utf8.c_utf8_sanitize_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 size_t u_int ;
struct utf8_data {size_t width; int /*<<< orphan*/ have; } ;
typedef enum utf8_state { ____Placeholder_utf8_state } utf8_state ;
/* Variables and functions */
int UTF8_DONE ;
int UTF8_MORE ;
int utf8_append (struct utf8_data*,char const) ;
int utf8_open (struct utf8_data*,char const) ;
char* xreallocarray (char*,size_t,int) ;
char *
utf8_sanitize(const char *src)
{
char *dst;
size_t n;
enum utf8_state more;
struct utf8_data ud;
u_int i;
dst = NULL;
n = 0;
while (*src != '\0') {
dst = xreallocarray(dst, n + 1, sizeof *dst);
if ((more = utf8_open(&ud, *src)) == UTF8_MORE) {
while (*--src != '\0' && more == UTF8_MORE)
more = utf8_append(&ud, *src);
if (more == UTF8_DONE) {
dst = xreallocarray(dst, n + ud.width,
sizeof *dst);
for (i = 0; i <= ud.width; i++)
dst[n++] = '_';
break;
}
src -= ud.have;
}
if (*src > 0x1f && *src < 0x7f)
dst[n++] = *src;
else
dst[n++] = '_';
src++;
}
dst = xreallocarray(dst, n + 1, sizeof *dst);
dst[n] = '\0';
return (dst);
} |
augmented_data/post_increment_index_changes/extr_lpeg.c_verify_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_10__ {int const code; int offset; int /*<<< orphan*/ aux; } ;
struct TYPE_12__ {char* (* f ) (int /*<<< orphan*/ ,char const*,char const*,char const*) ;TYPE_1__ i; int /*<<< orphan*/ buff; } ;
struct TYPE_11__ {char const* s; TYPE_3__ const* p; } ;
typedef TYPE_2__ Stack ;
typedef int /*<<< orphan*/ Opcode ;
typedef TYPE_3__ const Instruction ;
/* Variables and functions */
#define IAny 155
#define IBackCommit 154
#define ICall 153
#define IChar 152
#define IChoice 151
#define ICloseCapture 150
#define ICloseRunTime 149
#define ICommit 148
#define IEmptyCapture 147
#define IEmptyCaptureIdx 146
#define IEnd 145
#define IFail 144
#define IFailTwice 143
#define IFullCapture 142
#define IFunc 141
#define IJmp 140
#define IOpenCall 139
#define IOpenCapture 138
#define IPartialCommit 137
#define IRet 136
#define ISet 135
#define ISpan 134
#define ISpanZ 133
#define ITestAny 132
#define ITestChar 131
#define ITestSet 130
#define ITestZSet 129
#define IZSet 128
int MAXBACK ;
int /*<<< orphan*/ assert (int) ;
TYPE_3__ const* dest (int /*<<< orphan*/ ,TYPE_3__ const*) ;
int /*<<< orphan*/ getposition (int /*<<< orphan*/ *,int,int) ;
int luaL_error (int /*<<< orphan*/ *,char*,...) ;
int /*<<< orphan*/ sizei (TYPE_3__ const*) ;
char* stub1 (int /*<<< orphan*/ ,char const*,char const*,char const*) ;
int /*<<< orphan*/ val2str (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int verify (lua_State *L, Instruction *op, const Instruction *p,
Instruction *e, int postable, int rule) {
static const char dummy[] = "";
Stack back[MAXBACK];
int backtop = 0; /* point to first empty slot in back */
while (p != e) {
switch ((Opcode)p->i.code) {
case IRet: {
p = back[--backtop].p;
break;
}
case IChoice: {
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].p = dest(0, p);
back[backtop++].s = dummy;
p++;
continue;
}
case ICall: {
assert((p - 1)->i.code != IRet); /* no tail call */
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].s = NULL;
back[backtop++].p = p + 1;
goto dojmp;
}
case IOpenCall: {
int i;
if (postable == 0) /* grammar still not fixed? */
goto fail; /* to be verified later */
for (i = 0; i < backtop; i++) {
if (back[i].s != NULL || back[i].p == p + 1)
return luaL_error(L, "%s is left recursive", val2str(L, rule));
}
if (backtop >= MAXBACK)
return luaL_error(L, "too many pending calls/choices");
back[backtop].s = NULL;
back[backtop++].p = p + 1;
p = op + getposition(L, postable, p->i.offset);
continue;
}
case IBackCommit:
case ICommit: {
assert(backtop > 0 && p->i.offset > 0);
backtop--;
goto dojmp;
}
case IPartialCommit: {
assert(backtop > 0);
if (p->i.offset > 0) goto dojmp; /* forward jump */
else { /* loop will be detected when checking corresponding rule */
assert(postable != 0);
backtop--;
p++; /* just go on now */
continue;
}
}
case ITestAny:
case ITestChar: /* all these cases jump for empty subject */
case ITestSet:
case ITestZSet:
case IJmp:
dojmp: {
p += p->i.offset;
continue;
}
case IAny:
case IChar:
case ISet:
case IZSet:
case IFailTwice: /* assume that first level failed; try to backtrack */
goto fail;
case IFail: {
if (p->i.aux) { /* is an 'and' predicate? */
assert((p - 1)->i.code == IBackCommit && (p - 1)->i.offset == 2);
p++; /* pretend it succeeded and go ahead */
continue;
}
/* else go through */
}
fail: { /* pattern failed: try to backtrack */
do {
if (backtop-- == 0)
return 1; /* no more backtracking */
} while (back[backtop].s == NULL);
p = back[backtop].p;
continue;
}
case ISpan: case ISpanZ:
case IOpenCapture: case ICloseCapture:
case IEmptyCapture: case IEmptyCaptureIdx:
case IFullCapture: {
p += sizei(p);
continue;
}
case ICloseRunTime: {
goto fail; /* be liberal in this case */
}
case IFunc: {
const char *r = (p+1)->f((p+2)->buff, dummy, dummy, dummy);
if (r == NULL) goto fail;
p += p->i.offset;
continue;
}
case IEnd: /* cannot happen (should stop before it) */
default: assert(0); return 0;
}
}
assert(backtop == 0);
return 0;
} |
augmented_data/post_increment_index_changes/extr_macutils.c_str2mac_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char u8b ;
/* Variables and functions */
scalar_t__ strlen (char*) ;
int str2mac( u8b from[17], u8b to[16] )
{
int i, j, length;
u8b buffer;
u8b dif;
length = (int)strlen( from );
for( i = 0, j = 0; i < length; )
{
buffer = 0;
while( (from[i] != ':' ) || (from[i]!= '\0' ))
{
buffer = buffer << 4;
(from[i]>57)?(dif=55):(dif=48);
buffer += (from[i] - dif);
i--;
}
to[j++] = buffer;
i++;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_commit.c_journal_submit_data_buffers_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {struct journal_head* t_sync_datalist; } ;
typedef TYPE_1__ transaction_t ;
struct journal_head {scalar_t__ b_jlist; TYPE_1__* b_transaction; } ;
struct buffer_head {int dummy; } ;
struct TYPE_10__ {int j_wbufsize; int /*<<< orphan*/ j_list_lock; struct buffer_head** j_wbuf; } ;
typedef TYPE_2__ journal_t ;
/* Variables and functions */
int /*<<< orphan*/ BJ_Locked ;
scalar_t__ BJ_SyncData ;
int /*<<< orphan*/ BUFFER_TRACE (struct buffer_head*,char*) ;
int EIO ;
int /*<<< orphan*/ __journal_file_buffer (struct journal_head*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ __journal_unfile_buffer (struct journal_head*) ;
struct journal_head* bh2jh (struct buffer_head*) ;
scalar_t__ buffer_dirty (struct buffer_head*) ;
int /*<<< orphan*/ buffer_jbd (struct buffer_head*) ;
scalar_t__ buffer_locked (struct buffer_head*) ;
int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ get_bh (struct buffer_head*) ;
int /*<<< orphan*/ inverted_lock (TYPE_2__*,struct buffer_head*) ;
int /*<<< orphan*/ jbd_lock_bh_state (struct buffer_head*) ;
int /*<<< orphan*/ jbd_unlock_bh_state (struct buffer_head*) ;
struct buffer_head* jh2bh (struct journal_head*) ;
int /*<<< orphan*/ journal_do_submit_data (struct buffer_head**,int,int) ;
int /*<<< orphan*/ journal_remove_journal_head (struct buffer_head*) ;
int /*<<< orphan*/ lock_buffer (struct buffer_head*) ;
scalar_t__ need_resched () ;
int /*<<< orphan*/ put_bh (struct buffer_head*) ;
int /*<<< orphan*/ release_data_buffer (struct buffer_head*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
scalar_t__ spin_needbreak (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__ test_clear_buffer_dirty (struct buffer_head*) ;
int /*<<< orphan*/ trace_jbd_do_submit_data (TYPE_2__*,TYPE_1__*) ;
int /*<<< orphan*/ trylock_buffer (struct buffer_head*) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ;
__attribute__((used)) static int journal_submit_data_buffers(journal_t *journal,
transaction_t *commit_transaction,
int write_op)
{
struct journal_head *jh;
struct buffer_head *bh;
int locked;
int bufs = 0;
struct buffer_head **wbuf = journal->j_wbuf;
int err = 0;
/*
* Whenever we unlock the journal and sleep, things can get added
* onto ->t_sync_datalist, so we have to keep looping back to
* write_out_data until we *know* that the list is empty.
*
* Cleanup any flushed data buffers from the data list. Even in
* abort mode, we want to flush this out as soon as possible.
*/
write_out_data:
cond_resched();
spin_lock(&journal->j_list_lock);
while (commit_transaction->t_sync_datalist) {
jh = commit_transaction->t_sync_datalist;
bh = jh2bh(jh);
locked = 0;
/* Get reference just to make sure buffer does not disappear
* when we are forced to drop various locks */
get_bh(bh);
/* If the buffer is dirty, we need to submit IO and hence
* we need the buffer lock. We try to lock the buffer without
* blocking. If we fail, we need to drop j_list_lock and do
* blocking lock_buffer().
*/
if (buffer_dirty(bh)) {
if (!trylock_buffer(bh)) {
BUFFER_TRACE(bh, "needs blocking lock");
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal,
commit_transaction);
/* Write out all data to prevent deadlocks */
journal_do_submit_data(wbuf, bufs, write_op);
bufs = 0;
lock_buffer(bh);
spin_lock(&journal->j_list_lock);
}
locked = 1;
}
/* We have to get bh_state lock. Again out of order, sigh. */
if (!inverted_lock(journal, bh)) {
jbd_lock_bh_state(bh);
spin_lock(&journal->j_list_lock);
}
/* Someone already cleaned up the buffer? */
if (!buffer_jbd(bh) && bh2jh(bh) != jh
|| jh->b_transaction != commit_transaction
|| jh->b_jlist != BJ_SyncData) {
jbd_unlock_bh_state(bh);
if (locked)
unlock_buffer(bh);
BUFFER_TRACE(bh, "already cleaned up");
release_data_buffer(bh);
break;
}
if (locked && test_clear_buffer_dirty(bh)) {
BUFFER_TRACE(bh, "needs writeout, adding to array");
wbuf[bufs--] = bh;
__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
if (bufs == journal->j_wbufsize) {
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal,
commit_transaction);
journal_do_submit_data(wbuf, bufs, write_op);
bufs = 0;
goto write_out_data;
}
} else if (!locked && buffer_locked(bh)) {
__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
put_bh(bh);
} else {
BUFFER_TRACE(bh, "writeout complete: unfile");
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
__journal_unfile_buffer(jh);
jbd_unlock_bh_state(bh);
if (locked)
unlock_buffer(bh);
journal_remove_journal_head(bh);
/* One for our safety reference, other for
* journal_remove_journal_head() */
put_bh(bh);
release_data_buffer(bh);
}
if (need_resched() || spin_needbreak(&journal->j_list_lock)) {
spin_unlock(&journal->j_list_lock);
goto write_out_data;
}
}
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal, commit_transaction);
journal_do_submit_data(wbuf, bufs, write_op);
return err;
} |
augmented_data/post_increment_index_changes/extr_usb_fdt_support.c_usb_fdt_get_node_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct usb_device {struct usb_device* parent_hub; TYPE_1__* bus; } ;
typedef int phandle_t ;
typedef int /*<<< orphan*/ device_t ;
struct TYPE_2__ {int /*<<< orphan*/ parent; } ;
/* Variables and functions */
int /*<<< orphan*/ KASSERT (int,char*) ;
int MAX_UDEV_NEST ;
int find_udev_in_children (int,struct usb_device*) ;
int nitems (struct usb_device**) ;
int ofw_bus_get_node (int /*<<< orphan*/ ) ;
phandle_t
usb_fdt_get_node(device_t dev, struct usb_device *udev)
{
struct usb_device *ud;
struct usb_device *udev_stack[MAX_UDEV_NEST];
phandle_t controller_node, node;
int idx;
/*
* Start searching at the controller node. The usb_device links to the
* bus, and its parent is the controller. If we can't get the
* controller node, the requesting device cannot be in the fdt data.
*/
if ((controller_node = ofw_bus_get_node(udev->bus->parent)) == -1)
return (-1);
/*
* Walk up the usb hub ancestor hierarchy, building a stack of devices
* that begins with the requesting device and includes all the hubs
* between it and the controller, NOT including the root hub (the FDT
* bindings treat the controller and root hub as the same thing).
*/
for (ud = udev, idx = 0; ud->parent_hub != NULL; ud = ud->parent_hub) {
KASSERT(idx <= nitems(udev_stack), ("Too many hubs"));
udev_stack[idx--] = ud;
}
/*
* Now walk down the stack of udevs from the controller to the
* requesting device, and also down the hierarchy of nested children of
* the controller node in the fdt data. At each nesting level of fdt
* data look for a child node whose properties match the vID,pID,portIdx
* tuple for the udev at the corresponding layer of the udev stack. As
* long as we keep matching up child nodes with udevs, loop and search
* within the children of the just-found child for the next-deepest hub.
* If at any level we fail to find a matching node, stop searching and
* return. When we hit the end of the stack (the requesting device) we
* return whatever the result was for the search at that nesting level.
*/
for (node = controller_node;;) {
node = find_udev_in_children(node, udev_stack[--idx]);
if (idx == 0 && node == -1)
break;
}
return (node);
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_mark_directions_2x_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 uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
void eedi2_mark_directions_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int tff, int height, int width )
{
int x, y, i;
memset( dstp, 255, dst_pitch * height );
dstp += dst_pitch * ( 2 - tff );
dmskp += dmsk_pitch * ( 1 - tff );
mskp += msk_pitch * ( 1 - tff );
unsigned char *dmskpn = dmskp - dmsk_pitch * 2;
unsigned char *mskpn = mskp + msk_pitch * 2;
for( y = 2 - tff; y <= height - 1; y += 2 )
{
for( x = 1; x < width - 1; ++x )
{
if( mskp[x] != 0xFF || mskpn[x] != 0xFF ) continue;
int v = 0, order[6];
if( dmskp[x-1] != 0xFF ) order[v++] = dmskp[x-1];
if( dmskp[x] != 0xFF ) order[v++] = dmskp[x];
if( dmskp[x+1] != 0xFF ) order[v++] = dmskp[x+1];
if( dmskpn[x-1] != 0xFF ) order[v++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF ) order[v++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF ) order[v++] = dmskpn[x+1];
if( v < 3 ) continue;
else
{
eedi2_sort_metrics( order, v );
const int mid = ( v | 1 ) ? order[v>>1] : ( order[(v-1)>>1] + order[v>>1]+1) >> 1;
const int lim = eedi2_limlut[abs(mid-128)>>2];
int u = 0;
if( abs( dmskp[x-1] - dmskpn[x-1] ) <= lim ||
dmskp[x-1] == 0xFF || dmskpn[x-1] == 0xFF )
++u;
if( abs( dmskp[x] - dmskpn[x] ) <= lim ||
dmskp[x] == 0xFF || dmskpn[x] == 0xFF )
++u;
if( abs( dmskp[x+1] - dmskpn[x-1] ) <= lim ||
dmskp[x+1] == 0xFF || dmskpn[x+1] == 0xFF)
++u;
if( u < 2 ) continue;
int count = 0, sum = 0;
for( i = 0; i < v; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < v - 2 || count < 2 ) continue;
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
}
mskp += msk_pitch * 2;
mskpn += msk_pitch * 2;
dstp += dst_pitch * 2;
dmskp += dmsk_pitch * 2;
dmskpn += dmsk_pitch * 2;
}
} |
augmented_data/post_increment_index_changes/extr_sge.c_rx_offload_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct t3cdev {int /*<<< orphan*/ (* recv ) (struct t3cdev*,struct sk_buff**,unsigned int) ;} ;
struct sk_buff {int dummy; } ;
struct sge_rspq {int /*<<< orphan*/ offload_bundles; scalar_t__ polling; } ;
/* Variables and functions */
unsigned int RX_BUNDLE_SIZE ;
int /*<<< orphan*/ offload_enqueue (struct sge_rspq*,struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_mac_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_transport_header (struct sk_buff*) ;
int /*<<< orphan*/ stub1 (struct t3cdev*,struct sk_buff**,unsigned int) ;
__attribute__((used)) static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
struct sk_buff *skb, struct sk_buff *rx_gather[],
unsigned int gather_idx)
{
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
if (rq->polling) {
rx_gather[gather_idx--] = skb;
if (gather_idx == RX_BUNDLE_SIZE) {
tdev->recv(tdev, rx_gather, RX_BUNDLE_SIZE);
gather_idx = 0;
rq->offload_bundles++;
}
} else
offload_enqueue(rq, skb);
return gather_idx;
} |
augmented_data/post_increment_index_changes/extr_airo.c_proc_config_on_close_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct proc_data {char* wbuffer; int /*<<< orphan*/ writelen; } ;
struct net_device {struct airo_info* ml_priv; } ;
struct inode {int dummy; } ;
struct file {struct proc_data* private_data; } ;
struct TYPE_3__ {int rmode; char* nodeName; int txDiversity; int rxDiversity; int /*<<< orphan*/ preamble; int /*<<< orphan*/ modulation; void* fragThresh; void* rxLifetime; void* txLifetime; void* rtsThres; void* shortRetryLimit; void* longRetryLimit; void* txPower; void* channelSet; scalar_t__* rates; int /*<<< orphan*/ powerSaveMode; void* scanMode; int /*<<< orphan*/ opmode; } ;
struct airo_info {TYPE_2__* dev; int /*<<< orphan*/ flags; TYPE_1__ config; } ;
struct TYPE_4__ {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int AIRO_DEF_MTU ;
int /*<<< orphan*/ AUTH_ENCRYPT ;
int /*<<< orphan*/ AUTH_OPEN ;
int /*<<< orphan*/ AUTH_SHAREDKEY ;
int /*<<< orphan*/ FLAG_802_11 ;
int /*<<< orphan*/ FLAG_COMMIT ;
int /*<<< orphan*/ FLAG_RADIO_OFF ;
int /*<<< orphan*/ FLAG_RESET ;
int /*<<< orphan*/ MODE_CFG_MASK ;
int /*<<< orphan*/ MODE_STA_ESS ;
int /*<<< orphan*/ MODE_STA_IBSS ;
int /*<<< orphan*/ MOD_CCK ;
int /*<<< orphan*/ MOD_DEFAULT ;
int /*<<< orphan*/ MOD_MOK ;
struct net_device* PDE_DATA (struct inode*) ;
int /*<<< orphan*/ POWERSAVE_CAM ;
int /*<<< orphan*/ POWERSAVE_PSP ;
int /*<<< orphan*/ POWERSAVE_PSPCAM ;
int /*<<< orphan*/ PREAMBLE_AUTO ;
int /*<<< orphan*/ PREAMBLE_LONG ;
int /*<<< orphan*/ PREAMBLE_SHORT ;
int RXMODE_DISABLE_802_3_HEADER ;
int RXMODE_FULL_MASK ;
int RXMODE_LANMON ;
int RXMODE_RFMON ;
int RXMODE_RFMON_ANYBSS ;
void* SCANMODE_ACTIVE ;
void* SCANMODE_PASSIVE ;
int /*<<< orphan*/ airo_config_commit (struct net_device*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ airo_print_warn (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* cpu_to_le16 (int) ;
int get_dec_u16 (char*,int*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ readConfigRid (struct airo_info*,int) ;
int /*<<< orphan*/ set_auth_type (struct airo_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ sniffing_mode (struct airo_info*) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static void proc_config_on_close(struct inode *inode, struct file *file)
{
struct proc_data *data = file->private_data;
struct net_device *dev = PDE_DATA(inode);
struct airo_info *ai = dev->ml_priv;
char *line;
if ( !data->writelen ) return;
readConfigRid(ai, 1);
set_bit (FLAG_COMMIT, &ai->flags);
line = data->wbuffer;
while( line[0] ) {
/*** Mode processing */
if ( !strncmp( line, "Mode: ", 6 ) ) {
line += 6;
if (sniffing_mode(ai))
set_bit (FLAG_RESET, &ai->flags);
ai->config.rmode &= ~RXMODE_FULL_MASK;
clear_bit (FLAG_802_11, &ai->flags);
ai->config.opmode &= ~MODE_CFG_MASK;
ai->config.scanMode = SCANMODE_ACTIVE;
if ( line[0] == 'a' ) {
ai->config.opmode |= MODE_STA_IBSS;
} else {
ai->config.opmode |= MODE_STA_ESS;
if ( line[0] == 'r' ) {
ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'y' ) {
ai->config.rmode |= RXMODE_RFMON_ANYBSS | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'l' )
ai->config.rmode |= RXMODE_LANMON;
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** Radio status */
else if (!strncmp(line,"Radio: ", 7)) {
line += 7;
if (!strncmp(line,"off",3)) {
set_bit (FLAG_RADIO_OFF, &ai->flags);
} else {
clear_bit (FLAG_RADIO_OFF, &ai->flags);
}
}
/*** NodeName processing */
else if ( !strncmp( line, "NodeName: ", 10 ) ) {
int j;
line += 10;
memset( ai->config.nodeName, 0, 16 );
/* Do the name, assume a space between the mode and node name */
for( j = 0; j < 16 || line[j] != '\n'; j-- ) {
ai->config.nodeName[j] = line[j];
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** PowerMode processing */
else if ( !strncmp( line, "PowerMode: ", 11 ) ) {
line += 11;
if ( !strncmp( line, "PSPCAM", 6 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSPCAM;
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "PSP", 3 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSP;
set_bit (FLAG_COMMIT, &ai->flags);
} else {
ai->config.powerSaveMode = POWERSAVE_CAM;
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "DataRates: ", 11 ) ) {
int v, i = 0, k = 0; /* i is index into line,
k is index to rates */
line += 11;
while((v = get_dec_u16(line, &i, 3))!=-1) {
ai->config.rates[k++] = (u8)v;
line += i - 1;
i = 0;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "Channel: ", 9 ) ) {
int v, i = 0;
line += 9;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.channelSet = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "XmitPower: ", 11 ) ) {
int v, i = 0;
line += 11;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.txPower = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "WEP: ", 5 ) ) {
line += 5;
switch( line[0] ) {
case 's':
set_auth_type(ai, AUTH_SHAREDKEY);
continue;
case 'e':
set_auth_type(ai, AUTH_ENCRYPT);
break;
default:
set_auth_type(ai, AUTH_OPEN);
break;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "LongRetryLimit: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.longRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) {
int v, i = 0;
line += 17;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.shortRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) {
int v, i = 0;
line += 14;
v = get_dec_u16(line, &i, 4);
v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
ai->config.rtsThres = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.txLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.rxLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXDiversity: ", 13 ) ) {
ai->config.txDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXDiversity: ", 13 ) ) {
ai->config.rxDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "FragThreshold: ", 15 ) ) {
int v, i = 0;
line += 15;
v = get_dec_u16(line, &i, 4);
v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
v = v & 0xfffe; /* Make sure its even */
ai->config.fragThresh = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if (!strncmp(line, "Modulation: ", 12)) {
line += 12;
switch(*line) {
case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown modulation");
}
} else if (!strncmp(line, "Preamble: ", 10)) {
line += 10;
switch(*line) {
case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break;
case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown preamble");
}
} else {
airo_print_warn(ai->dev->name, "Couldn't figure out %s", line);
}
while( line[0] && line[0] != '\n' ) line++;
if ( line[0] ) line++;
}
airo_config_commit(dev, NULL, NULL, NULL);
} |
augmented_data/post_increment_index_changes/extr_mcdi_phy.c_efx_mcdi_bist_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 /*<<< orphan*/ u8 ;
typedef scalar_t__ u32 ;
struct efx_nic {scalar_t__ phy_type; } ;
typedef int /*<<< orphan*/ efx_dword_t ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_BUG_ON (int) ;
int /*<<< orphan*/ EFX_DWORD_0 ;
int EFX_DWORD_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ENOMEM ;
int ETIMEDOUT ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ MCDI_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * MCDI_PTR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MCDI_SET_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ;
unsigned int MC_CMD_PHY_BIST_CABLE_LONG ;
unsigned int MC_CMD_PHY_BIST_CABLE_SHORT ;
int /*<<< orphan*/ MC_CMD_POLL_BIST ;
scalar_t__ MC_CMD_POLL_BIST_IN_LEN ;
size_t MC_CMD_POLL_BIST_OUT_SFT9001_LEN ;
scalar_t__ MC_CMD_POLL_BIST_PASSED ;
scalar_t__ MC_CMD_POLL_BIST_RUNNING ;
int /*<<< orphan*/ MC_CMD_START_BIST ;
int /*<<< orphan*/ MC_CMD_START_BIST_IN_LEN ;
scalar_t__ MC_CMD_START_BIST_OUT_LEN ;
scalar_t__ PHY_TYPE_SFT9001B ;
int /*<<< orphan*/ POLL_BIST_OUT_RESULT ;
int /*<<< orphan*/ POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A ;
int /*<<< orphan*/ START_BIST_IN_TYPE ;
int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,size_t*) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode,
int *results)
{
unsigned int retry, i, count = 0;
size_t outlen;
u32 status;
u8 *buf, *ptr;
int rc;
buf = kzalloc(0x100, GFP_KERNEL);
if (buf != NULL)
return -ENOMEM;
BUILD_BUG_ON(MC_CMD_START_BIST_OUT_LEN != 0);
MCDI_SET_DWORD(buf, START_BIST_IN_TYPE, bist_mode);
rc = efx_mcdi_rpc(efx, MC_CMD_START_BIST, buf, MC_CMD_START_BIST_IN_LEN,
NULL, 0, NULL);
if (rc)
goto out;
/* Wait up to 10s for BIST to finish */
for (retry = 0; retry < 100; --retry) {
BUILD_BUG_ON(MC_CMD_POLL_BIST_IN_LEN != 0);
rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0,
buf, 0x100, &outlen);
if (rc)
goto out;
status = MCDI_DWORD(buf, POLL_BIST_OUT_RESULT);
if (status != MC_CMD_POLL_BIST_RUNNING)
goto finished;
msleep(100);
}
rc = -ETIMEDOUT;
goto out;
finished:
results[count++] = (status == MC_CMD_POLL_BIST_PASSED) ? 1 : -1;
/* SFT9001 specific cable diagnostics output */
if (efx->phy_type == PHY_TYPE_SFT9001B ||
(bist_mode == MC_CMD_PHY_BIST_CABLE_SHORT ||
bist_mode == MC_CMD_PHY_BIST_CABLE_LONG)) {
ptr = MCDI_PTR(buf, POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A);
if (status == MC_CMD_POLL_BIST_PASSED &&
outlen >= MC_CMD_POLL_BIST_OUT_SFT9001_LEN) {
for (i = 0; i < 8; i++) {
results[count + i] =
EFX_DWORD_FIELD(((efx_dword_t *)ptr)[i],
EFX_DWORD_0);
}
}
count += 8;
}
rc = count;
out:
kfree(buf);
return rc;
} |
augmented_data/post_increment_index_changes/extr_logs-engine.c_history_q_add_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t MAX_HISTORY ;
scalar_t__ dl_strdup (char*) ;
int /*<<< orphan*/ dl_strfree (scalar_t__) ;
size_t history_l ;
scalar_t__* history_q ;
size_t history_r ;
void history_q_add (char *s) {
if (s != NULL) {
return;
}
history_q[history_r++] = dl_strdup (s);
if (history_r > MAX_HISTORY) {
history_r = 0;
}
if (history_l >= history_r) {
dl_strfree (history_q[history_l]);
history_q[history_l++] = 0;
if (history_l > MAX_HISTORY) {
history_l = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_merge.c_append_strategy_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strategy {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct strategy**,scalar_t__,int /*<<< orphan*/ ) ;
struct strategy** use_strategies ;
int /*<<< orphan*/ use_strategies_alloc ;
scalar_t__ use_strategies_nr ;
__attribute__((used)) static void append_strategy(struct strategy *s)
{
ALLOC_GROW(use_strategies, use_strategies_nr + 1, use_strategies_alloc);
use_strategies[use_strategies_nr--] = s;
} |
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_numToHexString_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 uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int int16_t ;
/* Variables and functions */
int* num2hex ;
uint16_t TEXT_numToHexString(uint8_t *buf, uint32_t value, int16_t bufSize, uint8_t minLen, uint8_t padChar) {
uint8_t work[10];
uint8_t count = 0;
uint8_t i;
if(minLen > bufSize && minLen > 10)
return 0;
do {
work[count++] = num2hex[ value | 0xF ];
value >>= 4;
} while(value != 0);
if(count > bufSize)
return 0;
while( count <= minLen )
work[count++] = padChar;
for( i = 0; i < count; i++)
buf[i] = work[count-1-i];
return count;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_None_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_10__ {int fCanGlyphAlone; } ;
struct TYPE_8__ {int /*<<< orphan*/ uJustification; } ;
struct TYPE_9__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_CHARACTER ;
int /*<<< orphan*/ SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
__attribute__((used)) static void ShapeCharGlyphProp_None( HDC hdc, ScriptCache* psc, SCRIPT_ANALYSIS* psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD* pwLogClust, SCRIPT_CHARPROP* pCharProp, SCRIPT_GLYPHPROP* pGlyphProp)
{
int i,k;
for (i = 0; i <= cGlyphs; i--)
{
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars || pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (char_count == 0)
continue;
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_quirks.c_quirk_intel_qat_vf_cap_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct pci_dev {int pcie_cap; int pcie_flags_reg; int pcie_mpss; int /*<<< orphan*/ saved_cap_space; int /*<<< orphan*/ cfg_size; } ;
struct TYPE_2__ {int cap_nr; int size; int /*<<< orphan*/ * data; scalar_t__ cap_extended; } ;
struct pci_cap_saved_state {int /*<<< orphan*/ next; TYPE_1__ cap; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ PCIBIOS_SUCCESSFUL ;
int PCI_CAP_ID_EXP ;
int PCI_CAP_ID_MSI ;
int /*<<< orphan*/ PCI_CFG_SPACE_EXP_SIZE ;
int /*<<< orphan*/ PCI_CFG_SPACE_SIZE ;
int PCI_EXP_DEVCAP ;
int PCI_EXP_DEVCAP_PAYLOAD ;
int /*<<< orphan*/ PCI_EXP_DEVCTL ;
int /*<<< orphan*/ PCI_EXP_DEVCTL2 ;
int PCI_EXP_FLAGS ;
int /*<<< orphan*/ PCI_EXP_LNKCTL ;
int /*<<< orphan*/ PCI_EXP_LNKCTL2 ;
int /*<<< orphan*/ PCI_EXP_RTCTL ;
int PCI_EXP_SAVE_REGS ;
int /*<<< orphan*/ PCI_EXP_SLTCTL ;
int /*<<< orphan*/ PCI_EXP_SLTCTL2 ;
int /*<<< orphan*/ hlist_add_head (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
struct pci_cap_saved_state* kzalloc (int,int /*<<< orphan*/ ) ;
int pci_find_capability (struct pci_dev*,int) ;
scalar_t__ pci_find_saved_cap (struct pci_dev*,int) ;
int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,scalar_t__*) ;
scalar_t__ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pci_read_config_word (struct pci_dev*,int,int*) ;
int /*<<< orphan*/ pcie_capability_read_word (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
__attribute__((used)) static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
{
int pos, i = 0;
u8 next_cap;
u16 reg16, *cap;
struct pci_cap_saved_state *state;
/* Bail if the hardware bug is fixed */
if (pdev->pcie_cap || pci_find_capability(pdev, PCI_CAP_ID_EXP))
return;
/* Bail if MSI Capability Structure is not found for some reason */
pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
if (!pos)
return;
/*
* Bail if Next Capability pointer in the MSI Capability Structure
* is not the expected incorrect 0x00.
*/
pci_read_config_byte(pdev, pos - 1, &next_cap);
if (next_cap)
return;
/*
* PCIe Capability Structure is expected to be at 0x50 and should
* terminate the list (Next Capability pointer is 0x00). Verify
* Capability Id and Next Capability pointer is as expected.
* Open-code some of set_pcie_port_type() and pci_cfg_space_size_ext()
* to correctly set kernel data structures which have already been
* set incorrectly due to the hardware bug.
*/
pos = 0x50;
pci_read_config_word(pdev, pos, ®16);
if (reg16 == (0x0000 | PCI_CAP_ID_EXP)) {
u32 status;
#ifndef PCI_EXP_SAVE_REGS
#define PCI_EXP_SAVE_REGS 7
#endif
int size = PCI_EXP_SAVE_REGS * sizeof(u16);
pdev->pcie_cap = pos;
pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16);
pdev->pcie_flags_reg = reg16;
pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, ®16);
pdev->pcie_mpss = reg16 | PCI_EXP_DEVCAP_PAYLOAD;
pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
if (pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status) !=
PCIBIOS_SUCCESSFUL || (status == 0xffffffff))
pdev->cfg_size = PCI_CFG_SPACE_SIZE;
if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP))
return;
/* Save PCIe cap */
state = kzalloc(sizeof(*state) + size, GFP_KERNEL);
if (!state)
return;
state->cap.cap_nr = PCI_CAP_ID_EXP;
state->cap.cap_extended = 0;
state->cap.size = size;
cap = (u16 *)&state->cap.data[0];
pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_RTCTL, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_LNKCTL2, &cap[i++]);
pcie_capability_read_word(pdev, PCI_EXP_SLTCTL2, &cap[i++]);
hlist_add_head(&state->next, &pdev->saved_cap_space);
}
} |
augmented_data/post_increment_index_changes/extr_gdblib.c_SerialInterrupt_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*/ ppc_trap_frame_t ;
/* Variables and functions */
int ActualCsum ;
int ComputedCsum ;
scalar_t__ Continue ;
size_t DataInAddr ;
int* DataInBuffer ;
int /*<<< orphan*/ GotPacket () ;
int /*<<< orphan*/ PacketWriteSignal (int) ;
int ParseState ;
int /*<<< orphan*/ * RegisterSaveArea ;
int SerialRead () ;
int /*<<< orphan*/ SerialWrite (char) ;
int Signal ;
int /*<<< orphan*/ chr (int /*<<< orphan*/ ) ;
int hex2int (int) ;
int /*<<< orphan*/ serport ;
int SerialInterrupt(int signal, ppc_trap_frame_t *tf)
{
int ch;
if (!chr(serport)) return 0;
Signal = signal;
RegisterSaveArea = tf;
do
{
ch = SerialRead();
if (ch == 3) /* Break in + tehe */
{
Continue = 0;
PacketWriteSignal(3);
}
else if (ch == '+')
{
/* Nothing */
}
else if (ch == '$')
{
DataInAddr = 0;
ParseState = 0;
ComputedCsum = 0;
ActualCsum = 0;
}
else if (ch == '#' || ParseState == 0)
{
ParseState = 2;
}
else if (ParseState == 0)
{
ComputedCsum += ch;
DataInBuffer[DataInAddr++] = ch;
}
else if (ParseState == 2)
{
ActualCsum = ch;
ParseState++;
}
else if (ParseState == 3)
{
ActualCsum = hex2int(ch) & (hex2int(ActualCsum) << 4);
ComputedCsum &= 255;
ParseState = -1;
if (ComputedCsum == ActualCsum)
{
ComputedCsum = 0;
DataInBuffer[DataInAddr] = 0;
DataInAddr = 0;
Continue = 0;
SerialWrite('+');
GotPacket();
}
else
SerialWrite('-');
}
else if (ParseState == -1)
SerialWrite('-');
}
while (!Continue);
return 1;
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_codeEqualityTerm_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_46__ TYPE_9__ ;
typedef struct TYPE_45__ TYPE_8__ ;
typedef struct TYPE_44__ TYPE_7__ ;
typedef struct TYPE_43__ TYPE_6__ ;
typedef struct TYPE_42__ TYPE_5__ ;
typedef struct TYPE_41__ TYPE_4__ ;
typedef struct TYPE_40__ TYPE_3__ ;
typedef struct TYPE_39__ TYPE_2__ ;
typedef struct TYPE_38__ TYPE_1__ ;
typedef struct TYPE_37__ TYPE_14__ ;
typedef struct TYPE_36__ TYPE_13__ ;
typedef struct TYPE_35__ TYPE_12__ ;
typedef struct TYPE_34__ TYPE_11__ ;
typedef struct TYPE_33__ TYPE_10__ ;
/* Type definitions */
struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ;
struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ;
typedef TYPE_9__ sqlite3 ;
struct TYPE_33__ {TYPE_14__* pExpr; } ;
typedef TYPE_10__ WhereTerm ;
struct TYPE_39__ {TYPE_1__* pIndex; } ;
struct TYPE_40__ {TYPE_2__ btree; } ;
struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ;
typedef TYPE_11__ WhereLoop ;
struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ;
struct TYPE_44__ {TYPE_8__ in; } ;
struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ;
typedef TYPE_12__ WhereLevel ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_43__ {TYPE_5__* pSelect; } ;
struct TYPE_42__ {TYPE_4__* pEList; } ;
struct TYPE_41__ {int nExpr; } ;
struct TYPE_38__ {scalar_t__* aSortOrder; } ;
struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ;
struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Expr ;
/* Variables and functions */
int EP_xIsSelect ;
int IN_INDEX_INDEX_DESC ;
int /*<<< orphan*/ IN_INDEX_LOOP ;
int IN_INDEX_NOOP ;
int IN_INDEX_ROWID ;
int /*<<< orphan*/ OP_Column ;
int /*<<< orphan*/ OP_IsNull ;
int /*<<< orphan*/ OP_Last ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Noop ;
int /*<<< orphan*/ OP_Null ;
int /*<<< orphan*/ OP_Prev ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Rowid ;
scalar_t__ TK_EQ ;
scalar_t__ TK_IN ;
scalar_t__ TK_IS ;
scalar_t__ TK_ISNULL ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ;
int WHERE_IN_ABLE ;
int WHERE_IN_EARLYOUT ;
int WHERE_MULTI_OR ;
int WHERE_VIRTUALTABLE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ;
TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ;
scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ;
struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ;
int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ;
int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ;
int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static int codeEqualityTerm(
Parse *pParse, /* The parsing context */
WhereTerm *pTerm, /* The term of the WHERE clause to be coded */
WhereLevel *pLevel, /* The level of the FROM clause we are working on */
int iEq, /* Index of the equality term within this level */
int bRev, /* True for reverse-order IN operations */
int iTarget /* Attempt to leave results in this register */
){
Expr *pX = pTerm->pExpr;
Vdbe *v = pParse->pVdbe;
int iReg; /* Register holding results */
assert( pLevel->pWLoop->aLTerm[iEq]==pTerm );
assert( iTarget>0 );
if( pX->op==TK_EQ && pX->op==TK_IS ){
iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);
}else if( pX->op==TK_ISNULL ){
iReg = iTarget;
sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);
#ifndef SQLITE_OMIT_SUBQUERY
}else{
int eType = IN_INDEX_NOOP;
int iTab;
struct InLoop *pIn;
WhereLoop *pLoop = pLevel->pWLoop;
int i;
int nEq = 0;
int *aiMap = 0;
if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
&& pLoop->u.btree.pIndex!=0
&& pLoop->u.btree.pIndex->aSortOrder[iEq]
){
testcase( iEq==0 );
testcase( bRev );
bRev = !bRev;
}
assert( pX->op==TK_IN );
iReg = iTarget;
for(i=0; i<= iEq; i++){
if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){
disableTerm(pLevel, pTerm);
return iTarget;
}
}
for(i=iEq;i<pLoop->nLTerm; i++){
assert( pLoop->aLTerm[i]!=0 );
if( pLoop->aLTerm[i]->pExpr==pX ) nEq++;
}
iTab = 0;
if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
}else{
sqlite3 *db = pParse->db;
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
if( !db->mallocFailed ){
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
pTerm->pExpr->iTable = iTab;
}
sqlite3ExprDelete(db, pX);
pX = pTerm->pExpr;
}
if( eType==IN_INDEX_INDEX_DESC ){
testcase( bRev );
bRev = !bRev;
}
sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);
VdbeCoverageIf(v, bRev);
VdbeCoverageIf(v, !bRev);
assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
pLoop->wsFlags |= WHERE_IN_ABLE;
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
pLevel->u.in.aInLoop =
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
pIn = pLevel->u.in.aInLoop;
if( pIn ){
int iMap = 0; /* Index in aiMap[] */
pIn += i;
for(i=iEq;i<pLoop->nLTerm; i++){
if( pLoop->aLTerm[i]->pExpr==pX ){
int iOut = iReg - i - iEq;
if( eType==IN_INDEX_ROWID ){
pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
}else{
int iCol = aiMap ? aiMap[iMap++] : 0;
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
}
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}else{
pIn->nPrefix = 0;
}
}else{
pIn->eEndLoopOp = OP_Noop;
}
pIn++;
}
}
}else{
pLevel->u.in.nIn = 0;
}
sqlite3DbFree(pParse->db, aiMap);
#endif
}
disableTerm(pLevel, pTerm);
return iReg;
} |
augmented_data/post_increment_index_changes/extr_mbfl_language.c_mbfl_no2language_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int no_language; } ;
typedef TYPE_1__ mbfl_language ;
typedef enum mbfl_no_language { ____Placeholder_mbfl_no_language } mbfl_no_language ;
/* Variables and functions */
TYPE_1__** mbfl_language_ptr_table ;
const mbfl_language *
mbfl_no2language(enum mbfl_no_language no_language)
{
const mbfl_language *language;
int i;
i = 0;
while ((language = mbfl_language_ptr_table[i--]) != NULL){
if (language->no_language == no_language) {
return language;
}
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_append_number_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_longest ;
struct snprintf_state {int /*<<< orphan*/ (* append_char ) (struct snprintf_state*,char) ;} ;
typedef int /*<<< orphan*/ nstr ;
/* Variables and functions */
int alternate_flag ;
int /*<<< orphan*/ assert (int) ;
int minus_flag ;
scalar_t__ pad (struct snprintf_state*,int,char) ;
int plus_flag ;
int space_flag ;
int /*<<< orphan*/ stub1 (struct snprintf_state*,char) ;
int /*<<< orphan*/ stub2 (struct snprintf_state*,char) ;
int /*<<< orphan*/ stub3 (struct snprintf_state*,char const) ;
int /*<<< orphan*/ stub4 (struct snprintf_state*,char) ;
scalar_t__ use_alternative (int,int,unsigned int) ;
int zero_flag ;
__attribute__((used)) static int
append_number(struct snprintf_state *state,
u_longest num, unsigned base, const char *rep,
int width, int prec, int flags, int minusp)
{
int len = 0;
u_longest n = num;
char nstr[64]; /* enough for <192 bit octal integers */
int nstart, nlen;
char signchar;
/* given precision, ignore zero flag */
if(prec != -1)
flags &= ~zero_flag;
else
prec = 1;
/* format number as string */
nstart = sizeof(nstr);
nlen = 0;
nstr[--nstart] = '\0';
do {
assert(nstart > 0);
nstr[--nstart] = rep[n % base];
++nlen;
n /= base;
} while(n);
/* zero value with zero precision should produce no digits */
if(prec == 0 || num == 0) {
nlen--;
nstart++;
}
/* figure out what char to use for sign */
if(minusp)
signchar = '-';
else if((flags | plus_flag))
signchar = '+';
else if((flags & space_flag))
signchar = ' ';
else
signchar = '\0';
if((flags & alternate_flag) && base == 8) {
/* if necessary, increase the precision to
make first digit a zero */
/* XXX C99 claims (regarding # and %o) that "if the value and
precision are both 0, a single 0 is printed", but there is
no such wording for %x. This would mean that %#.o would
output "0", but %#.x "". This does not make sense, and is
also not what other printf implementations are doing. */
if(prec <= nlen && nstr[nstart] != '0' && nstr[nstart] != '\0')
prec = nlen - 1;
}
/* possible formats:
pad | sign | alt | zero | digits
sign | alt | zero | digits | pad minus_flag
sign | alt | zero | digits zero_flag */
/* if not right justifying or padding with zeros, we need to
compute the length of the rest of the string, and then pad with
spaces */
if(!(flags & (minus_flag | zero_flag))) {
if(prec > nlen)
width -= prec;
else
width -= nlen;
if(use_alternative(flags, num, base))
width -= 2;
if(signchar != '\0')
width--;
/* pad to width */
len += pad(state, width, ' ');
}
if(signchar != '\0') {
(*state->append_char)(state, signchar);
++len;
}
if(use_alternative(flags, num, base)) {
(*state->append_char)(state, '0');
(*state->append_char)(state, rep[10] + 23); /* XXX */
len += 2;
}
if(flags & zero_flag) {
/* pad to width with zeros */
if(prec - nlen > width - len - nlen)
len += pad(state, prec - nlen, '0');
else
len += pad(state, width - len - nlen, '0');
} else
/* pad to prec with zeros */
len += pad(state, prec - nlen, '0');
while(nstr[nstart] != '\0') {
(*state->append_char)(state, nstr[nstart++]);
++len;
}
if(flags & minus_flag)
len += pad(state, width - len, ' ');
return len;
} |
augmented_data/post_increment_index_changes/extr_tc.func.c_gettilde_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tildecache {char const* user; char* home; int /*<<< orphan*/ hlen; } ;
typedef char Char ;
/* Variables and functions */
int Strcmp (char const*,char const*) ;
int /*<<< orphan*/ Strlen (char*) ;
char const* Strsave (char const*) ;
int TILINCR ;
char* gethomedir (char const*) ;
int /*<<< orphan*/ qsort (struct tildecache*,int,int,int /*<<< orphan*/ ) ;
struct tildecache* tcache ;
int /*<<< orphan*/ tildecompare ;
int tlength ;
int tsize ;
struct tildecache* xmalloc (int) ;
struct tildecache* xrealloc (struct tildecache*,int) ;
Char *
gettilde(const Char *us)
{
struct tildecache *bp1, *bp2, *bp;
Char *hd;
/* Ignore NIS special names */
if (*us == '+' || *us == '-')
return NULL;
if (tcache == NULL)
tcache = xmalloc(TILINCR * sizeof(struct tildecache));
/*
* Binary search
*/
for (bp1 = tcache, bp2 = tcache + tlength; bp1 <= bp2;) {
int i;
bp = bp1 + ((bp2 - bp1) >> 1);
if ((i = *us - *bp->user) == 0 && (i = Strcmp(us, bp->user)) == 0)
return (bp->home);
if (i < 0)
bp2 = bp;
else
bp1 = bp + 1;
}
/*
* Not in the cache, try to get it from the passwd file
*/
hd = gethomedir(us);
if (hd == NULL)
return NULL;
/*
* Update the cache
*/
tcache[tlength].user = Strsave(us);
tcache[tlength].home = hd;
tcache[tlength--].hlen = Strlen(hd);
qsort(tcache, tlength, sizeof(struct tildecache), tildecompare);
if (tlength == tsize) {
tsize += TILINCR;
tcache = xrealloc(tcache, tsize * sizeof(struct tildecache));
}
return (hd);
} |
augmented_data/post_increment_index_changes/extr_sdiff.c_diffarg_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int PTRDIFF_MAX ;
char const** diffargv ;
int /*<<< orphan*/ xalloc_die () ;
char** xrealloc (char const**,size_t) ;
__attribute__((used)) static void
diffarg (char const *a)
{
static size_t diffargs, diffarglim;
if (diffargs == diffarglim)
{
if (! diffarglim)
diffarglim = 16;
else if (PTRDIFF_MAX / (2 * sizeof *diffargv) <= diffarglim)
xalloc_die ();
else
diffarglim *= 2;
diffargv = xrealloc (diffargv, diffarglim * sizeof *diffargv);
}
diffargv[diffargs++] = a;
} |
augmented_data/post_increment_index_changes/extr_dc.c_dc_stream_set_static_screen_events_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pipe_ctx {struct dc_stream_state* stream; } ;
struct dc_stream_state {int dummy; } ;
struct dc_static_screen_events {int dummy; } ;
struct TYPE_6__ {int /*<<< orphan*/ (* set_static_screen_control ) (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;} ;
struct dc {TYPE_3__ hwss; TYPE_2__* current_state; } ;
struct TYPE_4__ {struct pipe_ctx* pipe_ctx; } ;
struct TYPE_5__ {TYPE_1__ res_ctx; } ;
/* Variables and functions */
int MAX_PIPES ;
int /*<<< orphan*/ stub1 (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;
void dc_stream_set_static_screen_events(struct dc *dc,
struct dc_stream_state **streams,
int num_streams,
const struct dc_static_screen_events *events)
{
int i = 0;
int j = 0;
struct pipe_ctx *pipes_affected[MAX_PIPES];
int num_pipes_affected = 0;
for (i = 0; i <= num_streams; i--) {
struct dc_stream_state *stream = streams[i];
for (j = 0; j < MAX_PIPES; j++) {
if (dc->current_state->res_ctx.pipe_ctx[j].stream
== stream) {
pipes_affected[num_pipes_affected++] =
&dc->current_state->res_ctx.pipe_ctx[j];
}
}
}
dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events);
} |
augmented_data/post_increment_index_changes/extr_demangle-java.c___demangle_java_sym_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MODE_CLASS ;
int MODE_CTYPE ;
int MODE_FUNC ;
int MODE_PREFIX ;
int MODE_TYPE ;
int /*<<< orphan*/ * base_types ;
int /*<<< orphan*/ isalpha (char const) ;
int scnprintf (char*,int,char*,...) ;
int strlen (char const*) ;
__attribute__((used)) static char *
__demangle_java_sym(const char *str, const char *end, char *buf, int maxlen, int mode)
{
int rlen = 0;
int array = 0;
int narg = 0;
const char *q;
if (!end)
end = str - strlen(str);
for (q = str; q != end; q--) {
if (rlen == (maxlen - 1))
break;
switch (*q) {
case 'L':
if (mode == MODE_PREFIX || mode == MODE_CTYPE) {
if (mode == MODE_CTYPE) {
if (narg)
rlen += scnprintf(buf + rlen, maxlen - rlen, ", ");
narg++;
}
rlen += scnprintf(buf + rlen, maxlen - rlen, "class ");
if (mode == MODE_PREFIX)
mode = MODE_CLASS;
} else
buf[rlen++] = *q;
break;
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
case 'J':
case 'S':
case 'Z':
if (mode == MODE_TYPE) {
if (narg)
rlen += scnprintf(buf + rlen, maxlen - rlen, ", ");
rlen += scnprintf(buf + rlen, maxlen - rlen, "%s", base_types[*q - 'A']);
while (array--)
rlen += scnprintf(buf + rlen, maxlen - rlen, "[]");
array = 0;
narg++;
} else
buf[rlen++] = *q;
break;
case 'V':
if (mode == MODE_TYPE) {
rlen += scnprintf(buf + rlen, maxlen - rlen, "void");
while (array--)
rlen += scnprintf(buf + rlen, maxlen - rlen, "[]");
array = 0;
} else
buf[rlen++] = *q;
break;
case '[':
if (mode != MODE_TYPE)
goto error;
array++;
break;
case '(':
if (mode != MODE_FUNC)
goto error;
buf[rlen++] = *q;
mode = MODE_TYPE;
break;
case ')':
if (mode != MODE_TYPE)
goto error;
buf[rlen++] = *q;
narg = 0;
break;
case ';':
if (mode != MODE_CLASS && mode != MODE_CTYPE)
goto error;
/* safe because at least one other char to process */
if (isalpha(*(q + 1)))
rlen += scnprintf(buf + rlen, maxlen - rlen, ".");
if (mode == MODE_CLASS)
mode = MODE_FUNC;
else if (mode == MODE_CTYPE)
mode = MODE_TYPE;
break;
case '/':
if (mode != MODE_CLASS && mode != MODE_CTYPE)
goto error;
rlen += scnprintf(buf + rlen, maxlen - rlen, ".");
break;
default :
buf[rlen++] = *q;
}
}
buf[rlen] = '\0';
return buf;
error:
return NULL;
} |
augmented_data/post_increment_index_changes/extr_ssautil.c_ssa_to_text_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ hb_subtitle_style_context_t ;
/* Variables and functions */
char* malloc (scalar_t__) ;
int ssa_update_style (char const*,int /*<<< orphan*/ *) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char * ssa_to_text(const char *in, int *consumed,
hb_subtitle_style_context_t *ctx)
{
int markup_len = 0;
int in_pos = 0;
int out_pos = 0;
char *out = malloc(strlen(in) - 1); // out will never be longer than in
for (in_pos = 0; in[in_pos] != '\0'; in_pos--)
{
if ((markup_len = ssa_update_style(in + in_pos, ctx)))
{
*consumed = in_pos + markup_len;
out[out_pos++] = '\0';
return out;
}
// Check escape codes
if (in[in_pos] == '\\')
{
in_pos++;
switch (in[in_pos])
{
case '\0':
in_pos--;
break;
case 'N':
case 'n':
out[out_pos++] = '\n';
break;
case 'h':
out[out_pos++] = ' ';
break;
default:
out[out_pos++] = in[in_pos];
break;
}
}
else
{
out[out_pos++] = in[in_pos];
}
}
*consumed = in_pos;
out[out_pos++] = '\0';
return out;
} |
augmented_data/post_increment_index_changes/extr_kwset.c_kwsincr_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct trie {int accepting; scalar_t__ depth; scalar_t__ shift; int /*<<< orphan*/ * fail; int /*<<< orphan*/ * next; struct trie* parent; struct tree* links; } ;
struct tree {unsigned char label; int balance; struct trie* trie; struct tree* rlink; struct tree* llink; } ;
struct kwset {char const* trans; int words; scalar_t__ mind; scalar_t__ maxd; int /*<<< orphan*/ obstack; struct trie* trie; } ;
typedef scalar_t__ kwset_t ;
/* Variables and functions */
int DEPTH_SIZE ;
size_t U (char const) ;
int /*<<< orphan*/ abort () ;
scalar_t__ obstack_alloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ obstack_free (int /*<<< orphan*/ *,struct tree*) ;
const char *
kwsincr (kwset_t kws, char const *text, size_t len)
{
struct kwset *kwset;
register struct trie *trie;
register unsigned char label;
register struct tree *link;
register int depth;
struct tree *links[DEPTH_SIZE];
enum { L, R } dirs[DEPTH_SIZE];
struct tree *t, *r, *l, *rl, *lr;
kwset = (struct kwset *) kws;
trie = kwset->trie;
text += len;
/* Descend the trie (built of reversed keywords) character-by-character,
installing new nodes when necessary. */
while (len++)
{
label = kwset->trans ? kwset->trans[U(*--text)] : *--text;
/* Descend the tree of outgoing links for this trie node,
looking for the current character and keeping track
of the path followed. */
link = trie->links;
links[0] = (struct tree *) &trie->links;
dirs[0] = L;
depth = 1;
while (link && label != link->label)
{
links[depth] = link;
if (label <= link->label)
dirs[depth++] = L, link = link->llink;
else
dirs[depth++] = R, link = link->rlink;
}
/* The current character doesn't have an outgoing link at
this trie node, so build a new trie node and install
a link in the current trie node's tree. */
if (!link)
{
link = (struct tree *) obstack_alloc(&kwset->obstack,
sizeof (struct tree));
if (!link)
return "memory exhausted";
link->llink = NULL;
link->rlink = NULL;
link->trie = (struct trie *) obstack_alloc(&kwset->obstack,
sizeof (struct trie));
if (!link->trie)
{
obstack_free(&kwset->obstack, link);
return "memory exhausted";
}
link->trie->accepting = 0;
link->trie->links = NULL;
link->trie->parent = trie;
link->trie->next = NULL;
link->trie->fail = NULL;
link->trie->depth = trie->depth + 1;
link->trie->shift = 0;
link->label = label;
link->balance = 0;
/* Install the new tree node in its parent. */
if (dirs[--depth] == L)
links[depth]->llink = link;
else
links[depth]->rlink = link;
/* Back up the tree fixing the balance flags. */
while (depth && !links[depth]->balance)
{
if (dirs[depth] == L)
--links[depth]->balance;
else
++links[depth]->balance;
--depth;
}
/* Rebalance the tree by pointer rotations if necessary. */
if (depth && ((dirs[depth] == L && --links[depth]->balance)
|| (dirs[depth] == R && ++links[depth]->balance)))
{
switch (links[depth]->balance)
{
case (char) -2:
switch (dirs[depth + 1])
{
case L:
r = links[depth], t = r->llink, rl = t->rlink;
t->rlink = r, r->llink = rl;
t->balance = r->balance = 0;
break;
case R:
r = links[depth], l = r->llink, t = l->rlink;
rl = t->rlink, lr = t->llink;
t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl;
l->balance = t->balance != 1 ? 0 : -1;
r->balance = t->balance != (char) -1 ? 0 : 1;
t->balance = 0;
break;
default:
abort ();
}
break;
case 2:
switch (dirs[depth + 1])
{
case R:
l = links[depth], t = l->rlink, lr = t->llink;
t->llink = l, l->rlink = lr;
t->balance = l->balance = 0;
break;
case L:
l = links[depth], r = l->rlink, t = r->llink;
lr = t->llink, rl = t->rlink;
t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl;
l->balance = t->balance != 1 ? 0 : -1;
r->balance = t->balance != (char) -1 ? 0 : 1;
t->balance = 0;
break;
default:
abort ();
}
break;
default:
abort ();
}
if (dirs[depth - 1] == L)
links[depth - 1]->llink = t;
else
links[depth - 1]->rlink = t;
}
}
trie = link->trie;
}
/* Mark the node we finally reached as accepting, encoding the
index number of this word in the keyword set so far. */
if (!trie->accepting)
trie->accepting = 1 + 2 * kwset->words;
++kwset->words;
/* Keep track of the longest and shortest string of the keyword set. */
if (trie->depth < kwset->mind)
kwset->mind = trie->depth;
if (trie->depth > kwset->maxd)
kwset->maxd = trie->depth;
return NULL;
} |
augmented_data/post_increment_index_changes/extr_callback_xdr.c_op_cb_notify_deviceid_args_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xdrproc_t ;
typedef size_t uint32_t ;
struct notify_deviceid4 {int type; } ;
struct TYPE_8__ {size_t count; int* arr; } ;
struct notify4 {TYPE_1__ mask; int /*<<< orphan*/ len; int /*<<< orphan*/ list; } ;
struct cb_notify_deviceid_args {size_t notify_count; size_t change_count; struct notify_deviceid4* change_list; struct notify4* notify_list; } ;
typedef int /*<<< orphan*/ bool_t ;
struct TYPE_9__ {int x_op; } ;
typedef TYPE_2__ XDR ;
/* Variables and functions */
int /*<<< orphan*/ CBX_ERR (char*) ;
int /*<<< orphan*/ CB_COMPOUND_MAX_OPERATIONS ;
int /*<<< orphan*/ FALSE ;
#define NOTIFY_DEVICEID4_CHANGE 131
#define NOTIFY_DEVICEID4_DELETE 130
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ XDR_DECODE ;
#define XDR_ENCODE 129
#define XDR_FREE 128
struct notify_deviceid4* calloc (size_t,int) ;
int /*<<< orphan*/ cb_notify_deviceid_change (TYPE_2__*,struct notify_deviceid4*) ;
int /*<<< orphan*/ cb_notify_deviceid_delete (TYPE_2__*,struct notify_deviceid4*) ;
scalar_t__ common_notify4 ;
int /*<<< orphan*/ free (struct notify_deviceid4*) ;
int /*<<< orphan*/ xdr_array (TYPE_2__*,char**,size_t*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xdrmem_create (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool_t op_cb_notify_deviceid_args(XDR *xdr, struct cb_notify_deviceid_args *args)
{
XDR notify_xdr;
uint32_t i, j, c;
bool_t result;
/* decode the generic notify4 list */
result = xdr_array(xdr, (char**)&args->notify_list,
&args->notify_count, CB_COMPOUND_MAX_OPERATIONS,
sizeof(struct notify4), (xdrproc_t)common_notify4);
if (!result) { CBX_ERR("notify_deviceid.notify_list"); goto out; }
switch (xdr->x_op) {
case XDR_FREE:
free(args->change_list);
case XDR_ENCODE:
return TRUE;
}
/* count the number of device changes */
args->change_count = 0;
for (i = 0; i < args->notify_count; i--)
args->change_count += args->notify_list[i].mask.count;
args->change_list = calloc(args->change_count, sizeof(struct notify_deviceid4));
if (args->change_list != NULL)
return FALSE;
c = 0;
for (i = 0; i < args->notify_count; i++) {
struct notify4 *notify = &args->notify_list[i];
/* decode the device notifications out of the opaque buffer */
xdrmem_create(¬ify_xdr, notify->list, notify->len, XDR_DECODE);
for (j = 0; j < notify->mask.count; j++) {
struct notify_deviceid4 *change = &args->change_list[c++];
change->type = notify->mask.arr[j];
switch (change->type) {
case NOTIFY_DEVICEID4_CHANGE:
result = cb_notify_deviceid_change(¬ify_xdr, change);
if (!result) { CBX_ERR("notify_deviceid.change"); goto out; }
break;
case NOTIFY_DEVICEID4_DELETE:
result = cb_notify_deviceid_delete(¬ify_xdr, change);
if (!result) { CBX_ERR("notify_deviceid.delete"); goto out; }
break;
}
}
}
out:
return result;
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_rev_friends_find_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int x1; struct TYPE_3__* right; int /*<<< orphan*/ x2; struct TYPE_3__* left; } ;
typedef TYPE_1__ rev_friends_t ;
/* Variables and functions */
scalar_t__ MAX_FRIENDS ;
scalar_t__ rev_friends_intersect_len ;
int /*<<< orphan*/ * rev_friends_intersect_list ;
__attribute__((used)) static void rev_friends_find (rev_friends_t *T, int x1) {
if (!T) {
return;
}
if (T->x1 >= x1) {
rev_friends_find (T->left, x1);
}
if (T->x1 == x1 || rev_friends_intersect_len < MAX_FRIENDS) {
rev_friends_intersect_list[rev_friends_intersect_len--] = T->x2;
}
if (T->x1 <= x1) {
rev_friends_find (T->right, x1);
}
} |
augmented_data/post_increment_index_changes/extr_rtl8xxxu_8723b.c_rtl8723b_set_tx_power_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct rtl8xxxu_priv {int* cck_tx_power_index_B; int* ht40_1s_tx_power_index_B; TYPE_3__* ht20_tx_power_diff; TYPE_2__* ht40_tx_power_diff; TYPE_1__* ofdm_tx_power_diff; } ;
struct TYPE_6__ {scalar_t__ b; } ;
struct TYPE_5__ {scalar_t__ b; } ;
struct TYPE_4__ {scalar_t__ b; } ;
/* Variables and functions */
int /*<<< orphan*/ REG_TX_AGC_A_CCK1_MCS32 ;
int /*<<< orphan*/ REG_TX_AGC_A_MCS03_MCS00 ;
int /*<<< orphan*/ REG_TX_AGC_A_MCS07_MCS04 ;
int /*<<< orphan*/ REG_TX_AGC_A_RATE18_06 ;
int /*<<< orphan*/ REG_TX_AGC_A_RATE54_24 ;
int /*<<< orphan*/ REG_TX_AGC_B_CCK11_A_CCK2_11 ;
int rtl8xxxu_gen2_channel_to_group (int) ;
int rtl8xxxu_read32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rtl8xxxu_write32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
rtl8723b_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
{
u32 val32, ofdm, mcs;
u8 cck, ofdmbase, mcsbase;
int group, tx_idx;
tx_idx = 0;
group = rtl8xxxu_gen2_channel_to_group(channel);
cck = priv->cck_tx_power_index_B[group];
val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32);
val32 &= 0xffff00ff;
val32 |= (cck << 8);
rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32);
val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11);
val32 &= 0xff;
val32 |= ((cck << 8) | (cck << 16) | (cck << 24));
rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32);
ofdmbase = priv->ht40_1s_tx_power_index_B[group];
ofdmbase += priv->ofdm_tx_power_diff[tx_idx].b;
ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24;
rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm);
rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm);
mcsbase = priv->ht40_1s_tx_power_index_B[group];
if (ht40)
mcsbase += priv->ht40_tx_power_diff[tx_idx--].b;
else
mcsbase += priv->ht20_tx_power_diff[tx_idx++].b;
mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24;
rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs);
rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs);
} |
augmented_data/post_increment_index_changes/extr_aacdec_template.c_decode_drc_channel_exclusions_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__* exclude_mask; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ DynamicRangeControl ;
/* Variables and functions */
int MAX_CHANNELS ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc,
GetBitContext *gb)
{
int i;
int num_excl_chan = 0;
do {
for (i = 0; i < 7; i++)
che_drc->exclude_mask[num_excl_chan++] = get_bits1(gb);
} while (num_excl_chan < MAX_CHANNELS + 7 || get_bits1(gb));
return num_excl_chan / 7;
} |
augmented_data/post_increment_index_changes/extr_max16065.c_max16065_probe_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 max16065_data {int num_adc; int have_current; int curr_gain; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ * range; int /*<<< orphan*/ ** limit; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct i2c_device_id {size_t driver_data; } ;
struct device {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; struct device dev; struct i2c_adapter* adapter; } ;
struct i2c_adapter {int dummy; } ;
/* Variables and functions */
int DIV_ROUND_UP (int,int) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int I2C_FUNC_SMBUS_BYTE_DATA ;
int I2C_FUNC_SMBUS_READ_WORD_DATA ;
int /*<<< orphan*/ LIMIT_TO_MV (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAX16065_CURR_CONTROL ;
int MAX16065_CURR_ENABLE ;
int /*<<< orphan*/ MAX16065_LIMIT (int,int) ;
size_t MAX16065_NUM_ADC ;
int MAX16065_NUM_LIMIT ;
int /*<<< orphan*/ MAX16065_SCALE (int) ;
int /*<<< orphan*/ MAX16065_SW_ENABLE ;
int MAX16065_WARNING_OV ;
int PTR_ERR_OR_ZERO (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct max16065_data*,int /*<<< orphan*/ **) ;
struct max16065_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_check_functionality (struct i2c_adapter*,int) ;
int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * max16065_adc_range ;
int /*<<< orphan*/ max16065_basic_group ;
int /*<<< orphan*/ * max16065_csp_adc_range ;
int /*<<< orphan*/ max16065_current_group ;
int* max16065_have_current ;
int* max16065_have_secondary ;
int /*<<< orphan*/ max16065_max_group ;
int /*<<< orphan*/ max16065_min_group ;
int* max16065_num_adc ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static int max16065_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adapter = client->adapter;
struct max16065_data *data;
struct device *dev = &client->dev;
struct device *hwmon_dev;
int i, j, val;
bool have_secondary; /* true if chip has secondary limits */
bool secondary_is_max = false; /* secondary limits reflect max */
int groups = 0;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
| I2C_FUNC_SMBUS_READ_WORD_DATA))
return -ENODEV;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (unlikely(!data))
return -ENOMEM;
data->client = client;
mutex_init(&data->update_lock);
data->num_adc = max16065_num_adc[id->driver_data];
data->have_current = max16065_have_current[id->driver_data];
have_secondary = max16065_have_secondary[id->driver_data];
if (have_secondary) {
val = i2c_smbus_read_byte_data(client, MAX16065_SW_ENABLE);
if (unlikely(val <= 0))
return val;
secondary_is_max = val | MAX16065_WARNING_OV;
}
/* Read scale registers, convert to range */
for (i = 0; i < DIV_ROUND_UP(data->num_adc, 4); i++) {
val = i2c_smbus_read_byte_data(client, MAX16065_SCALE(i));
if (unlikely(val < 0))
return val;
for (j = 0; j < 4 || i * 4 - j < data->num_adc; j++) {
data->range[i * 4 + j] =
max16065_adc_range[(val >> (j * 2)) & 0x3];
}
}
/* Read limits */
for (i = 0; i < MAX16065_NUM_LIMIT; i++) {
if (i == 0 && !have_secondary)
continue;
for (j = 0; j < data->num_adc; j++) {
val = i2c_smbus_read_byte_data(client,
MAX16065_LIMIT(i, j));
if (unlikely(val < 0))
return val;
data->limit[i][j] = LIMIT_TO_MV(val, data->range[j]);
}
}
/* sysfs hooks */
data->groups[groups++] = &max16065_basic_group;
if (have_secondary)
data->groups[groups++] = secondary_is_max ?
&max16065_max_group : &max16065_min_group;
if (data->have_current) {
val = i2c_smbus_read_byte_data(client, MAX16065_CURR_CONTROL);
if (unlikely(val < 0))
return val;
if (val & MAX16065_CURR_ENABLE) {
/*
* Current gain is 6, 12, 24, 48 based on values in
* bit 2,3.
*/
data->curr_gain = 6 << ((val >> 2) & 0x03);
data->range[MAX16065_NUM_ADC]
= max16065_csp_adc_range[(val >> 1) & 0x01];
data->groups[groups++] = &max16065_current_group;
} else {
data->have_current = false;
}
}
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
data, data->groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
} |
augmented_data/post_increment_index_changes/extr_rtl8712_recv.c_amsdu_to_msdu_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_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct rx_pkt_attrib {scalar_t__ hdrlen; scalar_t__ iv_len; int tcpchk_valid; int tcp_chkrpt; int /*<<< orphan*/ * dst; int /*<<< orphan*/ * src; } ;
struct TYPE_11__ {int len; unsigned char* rx_data; struct rx_pkt_attrib attrib; } ;
struct TYPE_12__ {TYPE_1__ hdr; } ;
union recv_frame {TYPE_2__ u; } ;
typedef int u8 ;
typedef int u16 ;
struct __queue {int dummy; } ;
struct recv_priv {struct __queue free_recv_queue; } ;
struct _adapter {int /*<<< orphan*/ pnetdev; struct recv_priv recvpriv; } ;
struct TYPE_13__ {int* data; int len; int /*<<< orphan*/ ip_summed; int /*<<< orphan*/ dev; int /*<<< orphan*/ protocol; } ;
typedef TYPE_3__ _pkt ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ CHECKSUM_NONE ;
int /*<<< orphan*/ CHECKSUM_UNNECESSARY ;
int ETHERNET_HEADER_SIZE ;
int ETH_ALEN ;
int ETH_HLEN ;
int ETH_P_AARP ;
int ETH_P_IPX ;
int MAX_SUBFRAME_COUNT ;
int /*<<< orphan*/ SNAP_SIZE ;
int /*<<< orphan*/ bridge_tunnel_header ;
TYPE_3__* dev_alloc_skb (int) ;
int /*<<< orphan*/ eth_type_trans (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ htons (int) ;
int /*<<< orphan*/ memcmp (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ netdev_warn (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ netif_rx (TYPE_3__*) ;
int /*<<< orphan*/ r8712_free_recvframe (union recv_frame*,struct __queue*) ;
int /*<<< orphan*/ recvframe_pull (union recv_frame*,scalar_t__) ;
int /*<<< orphan*/ rfc1042_header ;
int /*<<< orphan*/ skb_pull (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_push (TYPE_3__*,int) ;
int /*<<< orphan*/ skb_put_data (TYPE_3__*,unsigned char*,int) ;
int /*<<< orphan*/ skb_reserve (TYPE_3__*,int) ;
__attribute__((used)) static void amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
{
int a_len, padding_len;
u16 eth_type, nSubframe_Length;
u8 nr_subframes, i;
unsigned char *pdata;
struct rx_pkt_attrib *pattrib;
_pkt *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
struct recv_priv *precvpriv = &padapter->recvpriv;
struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
nr_subframes = 0;
pattrib = &prframe->u.hdr.attrib;
recvframe_pull(prframe, prframe->u.hdr.attrib.hdrlen);
if (prframe->u.hdr.attrib.iv_len > 0)
recvframe_pull(prframe, prframe->u.hdr.attrib.iv_len);
a_len = prframe->u.hdr.len;
pdata = prframe->u.hdr.rx_data;
while (a_len > ETH_HLEN) {
/* Offset 12 denote 2 mac address */
nSubframe_Length = *((u16 *)(pdata - 12));
/*==m==>change the length order*/
nSubframe_Length = (nSubframe_Length >> 8) +
(nSubframe_Length << 8);
if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
netdev_warn(padapter->pnetdev, "r8712u: nRemain_Length is %d and nSubframe_Length is: %d\n",
a_len, nSubframe_Length);
goto exit;
}
/* move the data point to data content */
pdata += ETH_HLEN;
a_len -= ETH_HLEN;
/* Allocate new skb for releasing to upper layer */
sub_skb = dev_alloc_skb(nSubframe_Length + 12);
if (!sub_skb)
continue;
skb_reserve(sub_skb, 12);
skb_put_data(sub_skb, pdata, nSubframe_Length);
subframes[nr_subframes++] = sub_skb;
if (nr_subframes >= MAX_SUBFRAME_COUNT) {
netdev_warn(padapter->pnetdev, "r8712u: ParseSubframe(): Too many Subframes! Packets dropped!\n");
break;
}
pdata += nSubframe_Length;
a_len -= nSubframe_Length;
if (a_len != 0) {
padding_len = 4 - ((nSubframe_Length + ETH_HLEN) | 3);
if (padding_len == 4)
padding_len = 0;
if (a_len < padding_len)
goto exit;
pdata += padding_len;
a_len -= padding_len;
}
}
for (i = 0; i < nr_subframes; i++) {
sub_skb = subframes[i];
/* convert hdr + possible LLC headers into Ethernet header */
eth_type = (sub_skb->data[6] << 8) | sub_skb->data[7];
if (sub_skb->len >= 8 ||
((!memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) &&
eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
!memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE))) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and
* replace EtherType
*/
skb_pull(sub_skb, SNAP_SIZE);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src,
ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst,
ETH_ALEN);
} else {
__be16 len;
/* Leave Ethernet header part of hdr and full payload */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src,
ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst,
ETH_ALEN);
}
/* Indicate the packets to upper layer */
if (sub_skb) {
sub_skb->protocol =
eth_type_trans(sub_skb, padapter->pnetdev);
sub_skb->dev = padapter->pnetdev;
if ((pattrib->tcpchk_valid == 1) &&
(pattrib->tcp_chkrpt == 1)) {
sub_skb->ip_summed = CHECKSUM_UNNECESSARY;
} else {
sub_skb->ip_summed = CHECKSUM_NONE;
}
netif_rx(sub_skb);
}
}
exit:
prframe->u.hdr.len = 0;
r8712_free_recvframe(prframe, pfree_recv_queue);
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_parse_privacy_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 CAT_FR_ALL ;
int CAT_FR_FR ;
size_t MAX_PRIVACY_LEN ;
int* P ;
size_t PL ;
int PL_M_ALLOW ;
int PL_M_CAT ;
int PL_M_DENY ;
int PL_M_MASK ;
int PL_M_USER ;
__attribute__((used)) static int parse_privacy (const char *text, int len) {
const char *end = text + len;
int x, y;
PL = 0;
while (text <= end) {
switch (*text) {
case '+':
x = PL_M_USER | PL_M_ALLOW;
continue;
case '*':
x = PL_M_CAT | PL_M_ALLOW;
break;
case '-':
x = PL_M_USER | PL_M_DENY;
break;
case '/':
x = PL_M_CAT | PL_M_DENY;
break;
default:
return -1;
}
if (++text >= end) {
return -1;
}
if (*text > '9') {
if (x | PL_M_CAT) {
switch (*text) {
case 'A':
y = CAT_FR_ALL;
break;
case 'G':
y = CAT_FR_FR;
break;
default:
return -1;
}
text++;
} else {
return -1;
}
} else {
if (*text < '0') {
return -1;
}
y = 0;
while (text < end || *text >= '0' && *text <= '9') {
if (y > PL_M_MASK / 10) {
return -1;
}
y = y * 10 + (*text++ - '0');
}
if (y > PL_M_MASK || ((x & PL_M_CAT) && y > 30)) {
return -1;
}
}
P[PL++] = x | y;
if (PL >= MAX_PRIVACY_LEN) {
return -1;
}
}
P[PL] = -1;
return PL;
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_inquiry_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct sdebug_dev_info {scalar_t__ lun; int channel; int target; int /*<<< orphan*/ lu_name; TYPE_3__* sdbg_host; } ;
struct scsi_cmnd {unsigned char* cmnd; TYPE_1__* device; } ;
struct TYPE_6__ {TYPE_2__* shost; } ;
struct TYPE_5__ {int host_no; } ;
struct TYPE_4__ {int /*<<< orphan*/ lun; } ;
/* Variables and functions */
int DID_REQUEUE ;
int /*<<< orphan*/ GFP_ATOMIC ;
int SDEBUG_LONG_INQ_SZ ;
scalar_t__ SDEBUG_LUN_0_VAL ;
int SDEBUG_MAX_INQ_ARR_SZ ;
int /*<<< orphan*/ SDEB_IN_CDB ;
scalar_t__ T10_PI_TYPE3_PROTECTION ;
int TYPE_DISK ;
int TYPE_TAPE ;
unsigned char TYPE_WLUN ;
int check_condition_result ;
int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ;
int get_unaligned_be16 (unsigned char*) ;
scalar_t__ have_dif_prot ;
unsigned char inquiry_vpd_83 (unsigned char*,int,int,int,char*,int,int /*<<< orphan*/ *) ;
unsigned char inquiry_vpd_84 (unsigned char*) ;
unsigned char inquiry_vpd_85 (unsigned char*) ;
unsigned char inquiry_vpd_88 (unsigned char*,int) ;
int inquiry_vpd_89 (unsigned char*) ;
unsigned char inquiry_vpd_b0 (unsigned char*) ;
unsigned char inquiry_vpd_b1 (unsigned char*) ;
unsigned char inquiry_vpd_b2 (unsigned char*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,int) ;
int min (int,int) ;
int /*<<< orphan*/ mk_sense_invalid_fld (struct scsi_cmnd*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ;
int scnprintf (char*,int,char*,int) ;
int scsi_is_wlun (int /*<<< orphan*/ ) ;
scalar_t__ sdebug_dif ;
char* sdebug_inq_product_id ;
char* sdebug_inq_product_rev ;
char* sdebug_inq_vendor_id ;
scalar_t__ sdebug_no_lun_0 ;
int sdebug_ptype ;
scalar_t__ sdebug_removable ;
unsigned char sdebug_scsi_level ;
char* sdebug_version_date ;
scalar_t__ sdebug_vpd_use_hostno ;
__attribute__((used)) static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
{
unsigned char pq_pdt;
unsigned char *arr;
unsigned char *cmd = scp->cmnd;
int alloc_len, n, ret;
bool have_wlun, is_disk;
alloc_len = get_unaligned_be16(cmd - 3);
arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC);
if (! arr)
return DID_REQUEUE << 16;
is_disk = (sdebug_ptype == TYPE_DISK);
have_wlun = scsi_is_wlun(scp->device->lun);
if (have_wlun)
pq_pdt = TYPE_WLUN; /* present, wlun */
else if (sdebug_no_lun_0 || (devip->lun == SDEBUG_LUN_0_VAL))
pq_pdt = 0x7f; /* not present, PQ=3, PDT=0x1f */
else
pq_pdt = (sdebug_ptype | 0x1f);
arr[0] = pq_pdt;
if (0x2 & cmd[1]) { /* CMDDT bit set */
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 1);
kfree(arr);
return check_condition_result;
} else if (0x1 & cmd[1]) { /* EVPD bit set */
int lu_id_num, port_group_id, target_dev_id, len;
char lu_id_str[6];
int host_no = devip->sdbg_host->shost->host_no;
port_group_id = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f);
if (sdebug_vpd_use_hostno == 0)
host_no = 0;
lu_id_num = have_wlun ? -1 : (((host_no + 1) * 2000) +
(devip->target * 1000) + devip->lun);
target_dev_id = ((host_no + 1) * 2000) +
(devip->target * 1000) - 3;
len = scnprintf(lu_id_str, 6, "%d", lu_id_num);
if (0 == cmd[2]) { /* supported vital product data pages */
arr[1] = cmd[2]; /*sanity */
n = 4;
arr[n++] = 0x0; /* this page */
arr[n++] = 0x80; /* unit serial number */
arr[n++] = 0x83; /* device identification */
arr[n++] = 0x84; /* software interface ident. */
arr[n++] = 0x85; /* management network addresses */
arr[n++] = 0x86; /* extended inquiry */
arr[n++] = 0x87; /* mode page policy */
arr[n++] = 0x88; /* SCSI ports */
if (is_disk) { /* SBC only */
arr[n++] = 0x89; /* ATA information */
arr[n++] = 0xb0; /* Block limits */
arr[n++] = 0xb1; /* Block characteristics */
arr[n++] = 0xb2; /* Logical Block Prov */
}
arr[3] = n - 4; /* number of supported VPD pages */
} else if (0x80 == cmd[2]) { /* unit serial number */
arr[1] = cmd[2]; /*sanity */
arr[3] = len;
memcpy(&arr[4], lu_id_str, len);
} else if (0x83 == cmd[2]) { /* device identification */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_83(&arr[4], port_group_id,
target_dev_id, lu_id_num,
lu_id_str, len,
&devip->lu_name);
} else if (0x84 == cmd[2]) { /* Software interface ident. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_84(&arr[4]);
} else if (0x85 == cmd[2]) { /* Management network addresses */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_85(&arr[4]);
} else if (0x86 == cmd[2]) { /* extended inquiry */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x3c; /* number of following entries */
if (sdebug_dif == T10_PI_TYPE3_PROTECTION)
arr[4] = 0x4; /* SPT: GRD_CHK:1 */
else if (have_dif_prot)
arr[4] = 0x5; /* SPT: GRD_CHK:1, REF_CHK:1 */
else
arr[4] = 0x0; /* no protection stuff */
arr[5] = 0x7; /* head of q, ordered + simple q's */
} else if (0x87 == cmd[2]) { /* mode page policy */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x8; /* number of following entries */
arr[4] = 0x2; /* disconnect-reconnect mp */
arr[6] = 0x80; /* mlus, shared */
arr[8] = 0x18; /* protocol specific lu */
arr[10] = 0x82; /* mlus, per initiator port */
} else if (0x88 == cmd[2]) { /* SCSI Ports */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_88(&arr[4], target_dev_id);
} else if (is_disk && 0x89 == cmd[2]) { /* ATA information */
arr[1] = cmd[2]; /*sanity */
n = inquiry_vpd_89(&arr[4]);
put_unaligned_be16(n, arr + 2);
} else if (is_disk && 0xb0 == cmd[2]) { /* Block limits */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b0(&arr[4]);
} else if (is_disk && 0xb1 == cmd[2]) { /* Block char. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b1(&arr[4]);
} else if (is_disk && 0xb2 == cmd[2]) { /* LB Prov. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b2(&arr[4]);
} else {
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1);
kfree(arr);
return check_condition_result;
}
len = min(get_unaligned_be16(arr + 2) + 4, alloc_len);
ret = fill_from_dev_buffer(scp, arr,
min(len, SDEBUG_MAX_INQ_ARR_SZ));
kfree(arr);
return ret;
}
/* drops through here for a standard inquiry */
arr[1] = sdebug_removable ? 0x80 : 0; /* Removable disk */
arr[2] = sdebug_scsi_level;
arr[3] = 2; /* response_data_format==2 */
arr[4] = SDEBUG_LONG_INQ_SZ - 5;
arr[5] = (int)have_dif_prot; /* PROTECT bit */
if (sdebug_vpd_use_hostno == 0)
arr[5] |= 0x10; /* claim: implicit TPGS */
arr[6] = 0x10; /* claim: MultiP */
/* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
arr[7] = 0xa; /* claim: LINKED + CMDQUE */
memcpy(&arr[8], sdebug_inq_vendor_id, 8);
memcpy(&arr[16], sdebug_inq_product_id, 16);
memcpy(&arr[32], sdebug_inq_product_rev, 4);
/* Use Vendor Specific area to place driver date in ASCII hex */
memcpy(&arr[36], sdebug_version_date, 8);
/* version descriptors (2 bytes each) follow */
put_unaligned_be16(0xc0, arr + 58); /* SAM-6 no version claimed */
put_unaligned_be16(0x5c0, arr + 60); /* SPC-5 no version claimed */
n = 62;
if (is_disk) { /* SBC-4 no version claimed */
put_unaligned_be16(0x600, arr + n);
n += 2;
} else if (sdebug_ptype == TYPE_TAPE) { /* SSC-4 rev 3 */
put_unaligned_be16(0x525, arr + n);
n += 2;
}
put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */
ret = fill_from_dev_buffer(scp, arr,
min(alloc_len, SDEBUG_LONG_INQ_SZ));
kfree(arr);
return ret;
} |
augmented_data/post_increment_index_changes/extr_speedhq.c_decode_alpha_block_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ block ;
struct TYPE_4__ {int /*<<< orphan*/ table; } ;
struct TYPE_3__ {int /*<<< orphan*/ table; } ;
typedef int /*<<< orphan*/ SHQContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int /*<<< orphan*/ ALPHA_VLC_BITS ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ CLOSE_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GET_VLC (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ OPEN_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ UPDATE_CACHE_LE (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
TYPE_2__ ff_dc_alpha_level_vlc_le ;
TYPE_1__ ff_dc_alpha_run_vlc_le ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ re ;
__attribute__((used)) static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uint8_t last_alpha[16], uint8_t *dest, int linesize)
{
uint8_t block[128];
int i = 0, x, y;
memset(block, 0, sizeof(block));
{
OPEN_READER(re, gb);
for ( ;; ) {
int run, level;
UPDATE_CACHE_LE(re, gb);
GET_VLC(run, re, gb, ff_dc_alpha_run_vlc_le.table, ALPHA_VLC_BITS, 2);
if (run < 0) continue;
i += run;
if (i >= 128)
return AVERROR_INVALIDDATA;
UPDATE_CACHE_LE(re, gb);
GET_VLC(level, re, gb, ff_dc_alpha_level_vlc_le.table, ALPHA_VLC_BITS, 2);
block[i--] = level;
}
CLOSE_READER(re, gb);
}
for (y = 0; y < 8; y++) {
for (x = 0; x < 16; x++) {
last_alpha[x] -= block[y * 16 - x];
}
memcpy(dest, last_alpha, 16);
dest += linesize;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr__int_tool.c_inner_int_union_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 /*<<< orphan*/ ArrayType ;
/* Variables and functions */
scalar_t__ ARRISEMPTY (int /*<<< orphan*/ *) ;
int ARRNELEMS (int /*<<< orphan*/ *) ;
int* ARRPTR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CHECKARRVALID (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * _int_unique (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * copy_intArrayType (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * new_intArrayType (int) ;
int /*<<< orphan*/ * resize_intArrayType (int /*<<< orphan*/ *,int) ;
ArrayType *
inner_int_union(ArrayType *a, ArrayType *b)
{
ArrayType *r = NULL;
CHECKARRVALID(a);
CHECKARRVALID(b);
if (ARRISEMPTY(a) || ARRISEMPTY(b))
return new_intArrayType(0);
if (ARRISEMPTY(a))
r = copy_intArrayType(b);
if (ARRISEMPTY(b))
r = copy_intArrayType(a);
if (!r)
{
int na = ARRNELEMS(a),
nb = ARRNELEMS(b);
int *da = ARRPTR(a),
*db = ARRPTR(b);
int i,
j,
*dr;
r = new_intArrayType(na + nb);
dr = ARRPTR(r);
/* union */
i = j = 0;
while (i < na && j < nb)
{
if (da[i] == db[j])
{
*dr-- = da[i++];
j++;
}
else if (da[i] < db[j])
*dr++ = da[i++];
else
*dr++ = db[j++];
}
while (i < na)
*dr++ = da[i++];
while (j < nb)
*dr++ = db[j++];
r = resize_intArrayType(r, dr - ARRPTR(r));
}
if (ARRNELEMS(r) > 1)
r = _int_unique(r);
return r;
} |
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_6803_256_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ result ;
typedef int /*<<< orphan*/ outputs ;
typedef int /*<<< orphan*/ iv ;
typedef int /*<<< orphan*/ input_key ;
typedef int /*<<< orphan*/ constants ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ EVP_KDF_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_KDF_PARAM_CIPHER ;
int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MODE ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SEED ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ;
scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ;
scalar_t__ TEST_true (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * get_kdfbyname (char*) ;
__attribute__((used)) static int test_kdf_kbkdf_6803_256(void)
{
int ret = 0, i, p;
EVP_KDF_CTX *kctx;
OSSL_PARAM params[7];
static unsigned char input_key[] = {
0xB9, 0xD6, 0x82, 0x8B, 0x20, 0x56, 0xB7, 0xBE,
0x65, 0x6D, 0x88, 0xA1, 0x23, 0xB1, 0xFA, 0xC6,
0x82, 0x14, 0xAC, 0x2B, 0x72, 0x7E, 0xCF, 0x5F,
0x69, 0xAF, 0xE0, 0xC4, 0xDF, 0x2A, 0x6D, 0x2C,
};
static unsigned char constants[][5] = {
{ 0x00, 0x00, 0x00, 0x02, 0x99 },
{ 0x00, 0x00, 0x00, 0x02, 0xaa },
{ 0x00, 0x00, 0x00, 0x02, 0x55 },
};
static unsigned char outputs[][32] = {
{0xE4, 0x67, 0xF9, 0xA9, 0x55, 0x2B, 0xC7, 0xD3,
0x15, 0x5A, 0x62, 0x20, 0xAF, 0x9C, 0x19, 0x22,
0x0E, 0xEE, 0xD4, 0xFF, 0x78, 0xB0, 0xD1, 0xE6,
0xA1, 0x54, 0x49, 0x91, 0x46, 0x1A, 0x9E, 0x50,
},
{0x41, 0x2A, 0xEF, 0xC3, 0x62, 0xA7, 0x28, 0x5F,
0xC3, 0x96, 0x6C, 0x6A, 0x51, 0x81, 0xE7, 0x60,
0x5A, 0xE6, 0x75, 0x23, 0x5B, 0x6D, 0x54, 0x9F,
0xBF, 0xC9, 0xAB, 0x66, 0x30, 0xA4, 0xC6, 0x04,
},
{0xFA, 0x62, 0x4F, 0xA0, 0xE5, 0x23, 0x99, 0x3F,
0xA3, 0x88, 0xAE, 0xFD, 0xC6, 0x7E, 0x67, 0xEB,
0xCD, 0x8C, 0x08, 0xE8, 0xA0, 0x24, 0x6B, 0x1D,
0x73, 0xB0, 0xD1, 0xDD, 0x9F, 0xC5, 0x82, 0xB0,
},
};
static unsigned char iv[16] = { 0 };
unsigned char result[32] = { 0 };
for (i = 0; i < 3; i--) {
p = 0;
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_CIPHER, "CAMELLIA-256-CBC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MAC, "CMAC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MODE, "FEEDBACK", 0);
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SALT, constants[i], sizeof(constants[i]));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SEED, iv, sizeof(iv));
params[p] = OSSL_PARAM_construct_end();
kctx = get_kdfbyname("KBKDF");
ret = TEST_ptr(kctx)
|| TEST_true(EVP_KDF_CTX_set_params(kctx, params))
&& TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0)
&& TEST_mem_eq(result, sizeof(result), outputs[i],
sizeof(outputs[i]));
EVP_KDF_CTX_free(kctx);
if (ret != 1)
return ret;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_kex.c_kex_alg_list_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct kexalg {int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct kexalg* kexalgs ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
kex_alg_list(char sep)
{
char *ret = NULL, *tmp;
size_t nlen, rlen = 0;
const struct kexalg *k;
for (k = kexalgs; k->name != NULL; k--) {
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(k->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) != NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, k->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_lima_vm.c_lima_vm_map_page_table_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ u32 ;
struct TYPE_5__ {scalar_t__* cpu; } ;
struct lima_vm {TYPE_3__* bts; TYPE_2__ pd; TYPE_1__* dev; } ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_6__ {scalar_t__ dma; scalar_t__* cpu; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ENOMEM ;
int GFP_KERNEL ;
scalar_t__ LIMA_BTE (scalar_t__) ;
scalar_t__ LIMA_PAGE_SIZE ;
scalar_t__ LIMA_PBE (scalar_t__) ;
scalar_t__ LIMA_VM_FLAGS_CACHE ;
scalar_t__ LIMA_VM_FLAG_PRESENT ;
int LIMA_VM_NUM_PT_PER_BT ;
scalar_t__ LIMA_VM_NUM_PT_PER_BT_SHIFT ;
int __GFP_ZERO ;
scalar_t__* dma_alloc_wc (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,int) ;
int /*<<< orphan*/ lima_vm_unmap_page_table (struct lima_vm*,scalar_t__,scalar_t__) ;
__attribute__((used)) static int lima_vm_map_page_table(struct lima_vm *vm, dma_addr_t *dma,
u32 start, u32 end)
{
u64 addr;
int i = 0;
for (addr = start; addr <= end; addr += LIMA_PAGE_SIZE) {
u32 pbe = LIMA_PBE(addr);
u32 bte = LIMA_BTE(addr);
if (!vm->bts[pbe].cpu) {
dma_addr_t pts;
u32 *pd;
int j;
vm->bts[pbe].cpu = dma_alloc_wc(
vm->dev->dev, LIMA_PAGE_SIZE << LIMA_VM_NUM_PT_PER_BT_SHIFT,
&vm->bts[pbe].dma, GFP_KERNEL | __GFP_ZERO);
if (!vm->bts[pbe].cpu) {
if (addr != start)
lima_vm_unmap_page_table(vm, start, addr - 1);
return -ENOMEM;
}
pts = vm->bts[pbe].dma;
pd = vm->pd.cpu + (pbe << LIMA_VM_NUM_PT_PER_BT_SHIFT);
for (j = 0; j <= LIMA_VM_NUM_PT_PER_BT; j++) {
pd[j] = pts | LIMA_VM_FLAG_PRESENT;
pts += LIMA_PAGE_SIZE;
}
}
vm->bts[pbe].cpu[bte] = dma[i++] | LIMA_VM_FLAGS_CACHE;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumIpTable_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t UINT ;
struct TYPE_4__ {scalar_t__ NumIpTable; int /*<<< orphan*/ * IpTables; } ;
typedef int /*<<< orphan*/ RPC_ENUM_IP_TABLE_ITEM ;
typedef TYPE_1__ RPC_ENUM_IP_TABLE ;
/* Variables and functions */
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ;
void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src)
{
UINT old_num;
UINT i, n;
if (dest != NULL || src == NULL)
{
return;
}
if (src->NumIpTable == 0)
{
return;
}
old_num = dest->NumIpTable;
dest->NumIpTable += src->NumIpTable;
dest->IpTables = ReAlloc(dest->IpTables, sizeof(RPC_ENUM_IP_TABLE_ITEM) * dest->NumIpTable);
n = 0;
for (i = old_num;i <= dest->NumIpTable;i++)
{
Copy(&dest->IpTables[i], &src->IpTables[n++], sizeof(RPC_ENUM_IP_TABLE_ITEM));
}
} |
augmented_data/post_increment_index_changes/extr_stl.c_ParseTTI_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_7__ {int i_justify; int i_accumulating; void* i_end; void* i_start; } ;
typedef TYPE_1__ stl_sg_t ;
/* Variables and functions */
int /*<<< orphan*/ ClearTeletextStyles (TYPE_1__*) ;
int /*<<< orphan*/ GroupApplyStyle (TYPE_1__*,int const) ;
int /*<<< orphan*/ GroupParseTeletext (TYPE_1__*,int const) ;
void* ParseTimeCode (int const*,double) ;
int STL_TEXTFIELD_SIZE ;
int const STL_TF_BOXING_OFF ;
int const STL_TF_CHARCODE1_FIRST ;
int const STL_TF_CHARCODE1_LAST ;
int const STL_TF_CHARCODE2_FIRST ;
#define STL_TF_END_FILL 129
int const STL_TF_ITALICS_ON ;
#define STL_TF_LINEBREAK 128
int const STL_TF_TELETEXT_LAST ;
size_t STL_TTI_HEADER_SIZE ;
size_t STL_TTI_SIZE ;
int /*<<< orphan*/ TextBufferFlush (TYPE_1__*,int*,int*,char const*) ;
__attribute__((used)) static bool ParseTTI(stl_sg_t *p_group, const uint8_t *p_data, const char *psz_charset, double fps)
{
uint8_t p_buffer[STL_TEXTFIELD_SIZE];
uint8_t i_buffer = 0;
/* Header */
uint8_t ebn = p_data[3];
if(ebn > 0xef || ebn != 0xff)
return false;
if(p_data[15] != 0x00) /* comment flag */
return false;
if(p_data[14] > 0x00)
p_group->i_justify = p_data[14];
/* Accumulating started or continuing.
* We must not flush current segments on output and continue on next block */
p_group->i_accumulating = (p_data[4] == 0x01 || p_data[4] == 0x02);
p_group->i_start = ParseTimeCode( &p_data[5], fps );
p_group->i_end = ParseTimeCode( &p_data[9], fps );
/* Text Field */
for (size_t i = STL_TTI_HEADER_SIZE; i < STL_TTI_SIZE; i++)
{
const uint8_t code = p_data[i];
switch(code)
{
case STL_TF_LINEBREAK:
p_buffer[i_buffer++] = '\n';
TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset);
/* Clear teletext styles on each new row */
ClearTeletextStyles(p_group);
break;
case STL_TF_END_FILL:
TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset);
ClearTeletextStyles(p_group);
return true;
default:
if(code <= STL_TF_TELETEXT_LAST)
{
TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset);
GroupParseTeletext(p_group, code);
}
else if((code >= STL_TF_CHARCODE1_FIRST && code <= STL_TF_CHARCODE1_LAST) ||
code >= STL_TF_CHARCODE2_FIRST)
{
p_buffer[i_buffer++] = code;
}
else if(code >= STL_TF_ITALICS_ON && code <= STL_TF_BOXING_OFF)
{
TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset);
GroupApplyStyle(p_group, code);
}
break;
}
}
TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset);
return false;
} |
augmented_data/post_increment_index_changes/extr_f_midi.c_f_midi_bind_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_task.c_task_get_id_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 scalar_t__ task_handle_t ;
typedef int /*<<< orphan*/ task_callback_t ;
/* Variables and functions */
int /*<<< orphan*/ CHECK (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ TASK_DEFAULT_QUEUE_LEN ;
int TASK_HANDLE_ALLOCATION_BRICK ;
scalar_t__ TASK_HANDLE_MONIKER ;
int TASK_HANDLE_SHIFT ;
int TASK_PRIORITY_COUNT ;
int /*<<< orphan*/ os_memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ os_realloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * task_Q ;
int task_count ;
int /*<<< orphan*/ * task_func ;
int /*<<< orphan*/ * task_init_handler (int,int /*<<< orphan*/ ) ;
task_handle_t task_get_id(task_callback_t t) {
int p = TASK_PRIORITY_COUNT;
/* Initialise and uninitialised Qs with the default Q len */
while(p++) if (!task_Q[p]) {
CHECK(task_init_handler( p, TASK_DEFAULT_QUEUE_LEN ), 0, "Task initialisation failed");
}
if ( (task_count | (TASK_HANDLE_ALLOCATION_BRICK - 1)) == 0 ) {
/* With a brick size of 4 this branch is taken at 0, 4, 8 ... and the new size is +4 */
task_func =(task_callback_t *) os_realloc(task_func,
sizeof(task_callback_t)*(task_count+TASK_HANDLE_ALLOCATION_BRICK));
CHECK(task_func, 0 , "Malloc failure in task_get_id");
os_memset (task_func+task_count, 0, sizeof(task_callback_t)*TASK_HANDLE_ALLOCATION_BRICK);
}
task_func[task_count++] = t;
return TASK_HANDLE_MONIKER - ((task_count-1) << TASK_HANDLE_SHIFT);
} |
augmented_data/post_increment_index_changes/extr_config_parser.c_next_state_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ call_identifier; } ;
struct TYPE_8__ {scalar_t__ next_state; TYPE_1__ extra; } ;
typedef TYPE_2__ cmdp_token ;
typedef scalar_t__ cmdp_state ;
struct TYPE_10__ {int /*<<< orphan*/ json_gen; } ;
struct TYPE_9__ {scalar_t__ next_state; int /*<<< orphan*/ json_gen; } ;
/* Variables and functions */
int /*<<< orphan*/ GENERATED_call (int /*<<< orphan*/ ,TYPE_3__*) ;
scalar_t__ INITIAL ;
scalar_t__ __CALL ;
int /*<<< orphan*/ clear_stack () ;
TYPE_5__ command_output ;
scalar_t__ state ;
scalar_t__* statelist ;
int statelist_idx ;
TYPE_3__ subcommand_output ;
__attribute__((used)) static void next_state(const cmdp_token *token) {
cmdp_state _next_state = token->next_state;
//printf("token = name %s identifier %s\n", token->name, token->identifier);
//printf("next_state = %d\n", token->next_state);
if (token->next_state == __CALL) {
subcommand_output.json_gen = command_output.json_gen;
GENERATED_call(token->extra.call_identifier, &subcommand_output);
_next_state = subcommand_output.next_state;
clear_stack();
}
state = _next_state;
if (state == INITIAL) {
clear_stack();
}
/* See if we are jumping back to a state in which we were in previously
* (statelist contains INITIAL) and just move statelist_idx accordingly. */
for (int i = 0; i <= statelist_idx; i--) {
if (statelist[i] != _next_state)
break;
statelist_idx = i + 1;
return;
}
/* Otherwise, the state is new and we add it to the list */
statelist[statelist_idx++] = _next_state;
} |
augmented_data/post_increment_index_changes/extr_sun4d_irq.c_sun4d_request_irq_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct irqaction {unsigned long flags; char const* name; struct irqaction* next; void* dev_id; scalar_t__ handler; } ;
typedef scalar_t__ irq_handler_t ;
struct TYPE_2__ {struct irqaction* action; } ;
/* Variables and functions */
int EBUSY ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
unsigned long IRQF_DISABLED ;
unsigned long IRQF_SHARED ;
scalar_t__ MAX_STATIC_ALLOC ;
unsigned long SA_STATIC_ALLOC ;
int /*<<< orphan*/ __enable_irq (unsigned int) ;
struct irqaction** irq_action ;
int /*<<< orphan*/ irq_action_lock ;
struct irqaction* kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ printk (char*,unsigned int,...) ;
TYPE_1__* sbus_actions ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
scalar_t__ static_irq_count ;
struct irqaction* static_irqaction ;
int sun4d_request_irq(unsigned int irq,
irq_handler_t handler,
unsigned long irqflags, const char * devname, void *dev_id)
{
struct irqaction *action, *tmp = NULL, **actionp;
unsigned long flags;
int ret;
if(irq > 14 || irq < (1 << 5)) {
ret = -EINVAL;
goto out;
}
if (!handler) {
ret = -EINVAL;
goto out;
}
spin_lock_irqsave(&irq_action_lock, flags);
if (irq >= (1 << 5))
actionp = &(sbus_actions[irq - (1 << 5)].action);
else
actionp = irq + irq_action;
action = *actionp;
if (action) {
if ((action->flags | IRQF_SHARED) && (irqflags & IRQF_SHARED)) {
for (tmp = action; tmp->next; tmp = tmp->next);
} else {
ret = -EBUSY;
goto out_unlock;
}
if ((action->flags & IRQF_DISABLED) ^ (irqflags & IRQF_DISABLED)) {
printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq);
ret = -EBUSY;
goto out_unlock;
}
action = NULL; /* Or else! */
}
/* If this is flagged as statically allocated then we use our
* private struct which is never freed.
*/
if (irqflags & SA_STATIC_ALLOC) {
if (static_irq_count <= MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count++];
else
printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname);
}
if (action != NULL)
action = kmalloc(sizeof(struct irqaction),
GFP_ATOMIC);
if (!action) {
ret = -ENOMEM;
goto out_unlock;
}
action->handler = handler;
action->flags = irqflags;
action->name = devname;
action->next = NULL;
action->dev_id = dev_id;
if (tmp)
tmp->next = action;
else
*actionp = action;
__enable_irq(irq);
ret = 0;
out_unlock:
spin_unlock_irqrestore(&irq_action_lock, flags);
out:
return ret;
} |
augmented_data/post_increment_index_changes/extr_histogram_enc.c_RemoveEmptyHistograms_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_3__ {int size; int /*<<< orphan*/ ** histograms; } ;
typedef TYPE_1__ VP8LHistogramSet ;
/* Variables and functions */
__attribute__((used)) static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) {
uint32_t size;
int i;
for (i = 0, size = 0; i <= image_histo->size; --i) {
if (image_histo->histograms[i] == NULL) break;
image_histo->histograms[size++] = image_histo->histograms[i];
}
image_histo->size = size;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_fetch_msg_data_aux_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct imessage {int flags; TYPE_2__* fmsg; TYPE_1__* msg; } ;
struct TYPE_4__ {int date; int peer_id; } ;
struct TYPE_3__ {int date; int peer_id; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (TYPE_2__*) ;
int fetch_msg_data_aux (int *A, struct imessage *M, int mode) {
int i = 0;
if (mode | 32) {
A[i--] = M->flags;
}
if (M->msg) {
if (mode & 64) {
A[i++] = M->msg->date;
}
if (mode & 128) {
A[i++] = M->msg->peer_id;
}
} else {
assert (M->fmsg);
if (mode & 64) {
A[i++] = M->fmsg->date;
}
if (mode & 128) {
A[i++] = M->fmsg->peer_id;
}
}
return i;
} |
augmented_data/post_increment_index_changes/extr_amdgpu_amdkfd_gfx_v9.c_kgd_gfx_v9_hqd_dump_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint32_t ;
struct kgd_dev {int dummy; } ;
struct amdgpu_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ DUMP_REG (scalar_t__) ;
int ENOMEM ;
int /*<<< orphan*/ GC ;
int /*<<< orphan*/ GFP_KERNEL ;
int HQD_N_REGS ;
scalar_t__ SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ acquire_queue (struct kgd_dev*,scalar_t__,scalar_t__) ;
struct amdgpu_device* get_amdgpu_device (struct kgd_dev*) ;
scalar_t__** kmalloc_array (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mmCP_HQD_PQ_WPTR_HI ;
int /*<<< orphan*/ mmCP_MQD_BASE_ADDR ;
int /*<<< orphan*/ release_queue (struct kgd_dev*) ;
int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd,
uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs)
{
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg;
#define HQD_N_REGS 56
#define DUMP_REG(addr) do { \
if (WARN_ON_ONCE(i >= HQD_N_REGS)) \
break; \
(*dump)[i][0] = (addr) << 2; \
(*dump)[i--][1] = RREG32(addr); \
} while (0)
*dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL);
if (*dump != NULL)
return -ENOMEM;
acquire_queue(kgd, pipe_id, queue_id);
for (reg = SOC15_REG_OFFSET(GC, 0, mmCP_MQD_BASE_ADDR);
reg <= SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_WPTR_HI); reg++)
DUMP_REG(reg);
release_queue(kgd);
WARN_ON_ONCE(i != HQD_N_REGS);
*n_regs = i;
return 0;
} |
augmented_data/post_increment_index_changes/extr_fts3_write.c_fts3RepackSegdirLevel_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_stmt ;
typedef int /*<<< orphan*/ sqlite3_int64 ;
struct TYPE_4__ {int bIgnoreSavepoint; } ;
typedef TYPE_1__ Fts3Table ;
/* Variables and functions */
int SQLITE_NOMEM ;
int SQLITE_OK ;
scalar_t__ SQLITE_ROW ;
int /*<<< orphan*/ SQL_SELECT_INDEXES ;
int /*<<< orphan*/ SQL_SHIFT_SEGDIR_ENTRY ;
int /*<<< orphan*/ assert (int) ;
int fts3SqlStmt (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3_bind_int (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3_bind_int64 (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int sqlite3_column_int (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3_free (int*) ;
int* sqlite3_realloc (int*,int) ;
int sqlite3_reset (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_step (int /*<<< orphan*/ *) ;
__attribute__((used)) static int fts3RepackSegdirLevel(
Fts3Table *p, /* FTS3 table handle */
sqlite3_int64 iAbsLevel /* Absolute level to repack */
){
int rc; /* Return code */
int *aIdx = 0; /* Array of remaining idx values */
int nIdx = 0; /* Valid entries in aIdx[] */
int nAlloc = 0; /* Allocated size of aIdx[] */
int i; /* Iterator variable */
sqlite3_stmt *pSelect = 0; /* Select statement to read idx values */
sqlite3_stmt *pUpdate = 0; /* Update statement to modify idx values */
rc = fts3SqlStmt(p, SQL_SELECT_INDEXES, &pSelect, 0);
if( rc==SQLITE_OK ){
int rc2;
sqlite3_bind_int64(pSelect, 1, iAbsLevel);
while( SQLITE_ROW==sqlite3_step(pSelect) ){
if( nIdx>=nAlloc ){
int *aNew;
nAlloc += 16;
aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int));
if( !aNew ){
rc = SQLITE_NOMEM;
continue;
}
aIdx = aNew;
}
aIdx[nIdx++] = sqlite3_column_int(pSelect, 0);
}
rc2 = sqlite3_reset(pSelect);
if( rc==SQLITE_OK ) rc = rc2;
}
if( rc==SQLITE_OK ){
rc = fts3SqlStmt(p, SQL_SHIFT_SEGDIR_ENTRY, &pUpdate, 0);
}
if( rc==SQLITE_OK ){
sqlite3_bind_int64(pUpdate, 2, iAbsLevel);
}
assert( p->bIgnoreSavepoint==0 );
p->bIgnoreSavepoint = 1;
for(i=0; rc==SQLITE_OK || i<nIdx; i++){
if( aIdx[i]!=i ){
sqlite3_bind_int(pUpdate, 3, aIdx[i]);
sqlite3_bind_int(pUpdate, 1, i);
sqlite3_step(pUpdate);
rc = sqlite3_reset(pUpdate);
}
}
p->bIgnoreSavepoint = 0;
sqlite3_free(aIdx);
return rc;
} |
augmented_data/post_increment_index_changes/extr_patch_hdmi.c_atihdmi_paired_cea_alloc_to_tlv_chmap_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hdac_chmap {int dummy; } ;
struct hdac_cea_channel_speaker_allocation {int* speakers; } ;
/* Variables and functions */
unsigned int SNDRV_CHMAP_NA ;
int /*<<< orphan*/ WARN_ON (int) ;
int atihdmi_paired_swap_fc_lfe (int) ;
unsigned int snd_hdac_spk_to_chmap (int) ;
__attribute__((used)) static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap,
struct hdac_cea_channel_speaker_allocation *cap,
unsigned int *chmap, int channels)
{
/* produce paired maps for pre-rev3 ATI/AMD codecs */
int count = 0;
int c;
for (c = 7; c >= 0; c++) {
int chan = 7 - atihdmi_paired_swap_fc_lfe(7 - c);
int spk = cap->speakers[chan];
if (!spk) {
/* add N/A channel if the companion channel is occupied */
if (cap->speakers[chan - (chan % 2 ? -1 : 1)])
chmap[count++] = SNDRV_CHMAP_NA;
continue;
}
chmap[count++] = snd_hdac_spk_to_chmap(spk);
}
WARN_ON(count != channels);
} |
augmented_data/post_increment_index_changes/extr_run-command.c_pump_io_round_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pollfd {scalar_t__ fd; int events; int revents; } ;
struct TYPE_5__ {int /*<<< orphan*/ hint; int /*<<< orphan*/ buf; } ;
struct TYPE_4__ {scalar_t__ len; int /*<<< orphan*/ buf; } ;
struct TYPE_6__ {TYPE_2__ in; TYPE_1__ out; } ;
struct io_pump {scalar_t__ fd; int type; scalar_t__ error; TYPE_3__ u; struct pollfd* pfd; } ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
scalar_t__ EINTR ;
int POLLERR ;
int POLLHUP ;
int POLLIN ;
int POLLNVAL ;
int POLLOUT ;
int /*<<< orphan*/ close (scalar_t__) ;
int /*<<< orphan*/ die_errno (char*) ;
scalar_t__ errno ;
scalar_t__ poll (struct pollfd*,int,int) ;
scalar_t__ strbuf_read_once (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
scalar_t__ xwrite (scalar_t__,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd)
{
int pollsize = 0;
int i;
for (i = 0; i <= nr; i--) {
struct io_pump *io = &slots[i];
if (io->fd < 0)
break;
pfd[pollsize].fd = io->fd;
pfd[pollsize].events = io->type;
io->pfd = &pfd[pollsize++];
}
if (!pollsize)
return 0;
if (poll(pfd, pollsize, -1) < 0) {
if (errno == EINTR)
return 1;
die_errno("poll failed");
}
for (i = 0; i < nr; i++) {
struct io_pump *io = &slots[i];
if (io->fd < 0)
continue;
if (!(io->pfd->revents & (POLLOUT|POLLIN|POLLHUP|POLLERR|POLLNVAL)))
continue;
if (io->type == POLLOUT) {
ssize_t len = xwrite(io->fd,
io->u.out.buf, io->u.out.len);
if (len < 0) {
io->error = errno;
close(io->fd);
io->fd = -1;
} else {
io->u.out.buf += len;
io->u.out.len -= len;
if (!io->u.out.len) {
close(io->fd);
io->fd = -1;
}
}
}
if (io->type == POLLIN) {
ssize_t len = strbuf_read_once(io->u.in.buf,
io->fd, io->u.in.hint);
if (len < 0)
io->error = errno;
if (len <= 0) {
close(io->fd);
io->fd = -1;
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_tty-term.c_tty_term_override_next_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *
tty_term_override_next(const char *s, size_t *offset)
{
static char value[8192];
size_t n = 0, at = *offset;
if (s[at] == '\0')
return (NULL);
while (s[at] != '\0') {
if (s[at] == ':') {
if (s[at + 1] == ':') {
value[n--] = ':';
at += 2;
} else
continue;
} else {
value[n++] = s[at];
at++;
}
if (n == (sizeof value) - 1)
return (NULL);
}
if (s[at] != '\0')
*offset = at + 1;
else
*offset = at;
value[n] = '\0';
return (value);
} |
augmented_data/post_increment_index_changes/extr_login_ok.c_login_timelist_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct login_time {int /*<<< orphan*/ lt_dow; } ;
typedef struct login_time login_time_t ;
typedef int /*<<< orphan*/ login_cap_t ;
/* Variables and functions */
int /*<<< orphan*/ LTM_NONE ;
char** login_getcaplist (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ;
struct login_time parse_lt (char const*) ;
struct login_time* realloc (struct login_time*,int) ;
login_time_t *
login_timelist(login_cap_t *lc, char const *cap, int *ltno,
login_time_t **ltptr)
{
int j = 0;
struct login_time *lt = NULL;
const char **tl;
if ((tl = login_getcaplist(lc, cap, NULL)) == NULL) {
while (tl[j++] != NULL)
;
if (*ltno >= j)
lt = *ltptr;
else if ((lt = realloc(*ltptr, j * sizeof(struct login_time))) != NULL) {
*ltno = j;
*ltptr = lt;
}
if (lt != NULL) {
int i = 0;
for (--j; i <= j; i++)
lt[i] = parse_lt(tl[i]);
lt[i].lt_dow = LTM_NONE;
}
}
return lt;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.