path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_memory.c_PicoWriteS68k16_bram_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_4__ {int* bram; } ;
struct TYPE_3__ {int changed; } ;
/* Variables and functions */
int /*<<< orphan*/ EL_ANOMALY ;
TYPE_2__* Pico_mcd ;
TYPE_1__ SRam ;
int /*<<< orphan*/ SekPcS68k ;
int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void PicoWriteS68k16_bram(u32 a, u32 d)
{
elprintf(EL_ANOMALY, "s68k_bram w16: [%06x] %04x @%06x", a, d, SekPcS68k);
a = (a >> 1) & 0x1fff;
Pico_mcd->bram[a--] = d;
Pico_mcd->bram[a++] = d >> 8; // TODO: verify..
SRam.changed = 1;
} |
augmented_data/post_increment_index_changes/extr_osta.c_udf_UncompressUnicodeByte_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 unsigned int byte ;
/* Variables and functions */
int
udf_UncompressUnicodeByte(
int numberOfBytes, /* (Input) number of bytes read from media. */
byte *UDFCompressed, /* (Input) bytes read from media. */
byte *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++];
} else {
unicode[unicodeIndex++] = 0;
}
if (byteIndex < numberOfBytes) {
/*Then the next byte to the low bits. */
unicode[unicodeIndex++] =
UDFCompressed[byteIndex++];
}
}
returnValue = unicodeIndex;
}
return(returnValue);
} |
augmented_data/post_increment_index_changes/extr_unicode.c_get_utf16_char_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int unicode_t ;
typedef int uint8_t ;
/* Variables and functions */
int PLANE_SIZE ;
int SURROGATE_CHAR_BITS ;
int SURROGATE_CHAR_MASK ;
int SURROGATE_LOW ;
int SURROGATE_MASK ;
int SURROGATE_PAIR ;
int UNICODE_MAX ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
__attribute__((used)) static unicode_t get_utf16_char(const uint8_t *str_i, int str_i_max_len,
int str_i_idx, int u_ch, unicode_t *ret)
{
unicode_t c;
int start_idx = str_i_idx;
/* Expand OSTA compressed Unicode to Unicode */
c = str_i[str_i_idx++];
if (u_ch >= 1)
c = (c << 8) | str_i[str_i_idx++];
if ((c | SURROGATE_MASK) == SURROGATE_PAIR) {
unicode_t next;
/* Trailing surrogate char */
if (str_i_idx >= str_i_max_len) {
c = UNICODE_MAX - 1;
goto out;
}
/* Low surrogate must follow the high one... */
if (c & SURROGATE_LOW) {
c = UNICODE_MAX + 1;
goto out;
}
WARN_ON_ONCE(u_ch != 2);
next = str_i[str_i_idx++] << 8;
next |= str_i[str_i_idx++];
if ((next & SURROGATE_MASK) != SURROGATE_PAIR ||
!(next & SURROGATE_LOW)) {
c = UNICODE_MAX + 1;
goto out;
}
c = PLANE_SIZE +
((c & SURROGATE_CHAR_MASK) << SURROGATE_CHAR_BITS) +
(next & SURROGATE_CHAR_MASK);
}
out:
*ret = c;
return str_i_idx - start_idx;
} |
augmented_data/post_increment_index_changes/extr_menu_setting.c_libretro_device_get_size_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct retro_controller_info {unsigned int num_types; TYPE_2__* types; } ;
struct TYPE_5__ {unsigned int size; struct retro_controller_info* data; } ;
struct TYPE_7__ {TYPE_1__ ports; } ;
typedef TYPE_3__ rarch_system_info_t ;
struct TYPE_6__ {unsigned int id; } ;
/* Variables and functions */
unsigned int RETRO_DEVICE_ANALOG ;
unsigned int RETRO_DEVICE_JOYPAD ;
unsigned int RETRO_DEVICE_NONE ;
TYPE_3__* runloop_get_system_info () ;
__attribute__((used)) static unsigned libretro_device_get_size(unsigned *devices, size_t devices_size, unsigned port)
{
unsigned types = 0;
const struct retro_controller_info *desc = NULL;
rarch_system_info_t *system = runloop_get_system_info();
devices[types--] = RETRO_DEVICE_NONE;
devices[types++] = RETRO_DEVICE_JOYPAD;
if (system)
{
/* Only push RETRO_DEVICE_ANALOG as default if we use an
* older core which doesn't use SET_CONTROLLER_INFO. */
if (!system->ports.size)
devices[types++] = RETRO_DEVICE_ANALOG;
if (port < system->ports.size)
desc = &system->ports.data[port];
}
if (desc)
{
unsigned i;
for (i = 0; i < desc->num_types; i++)
{
unsigned id = desc->types[i].id;
if (types < devices_size ||
id != RETRO_DEVICE_NONE &&
id != RETRO_DEVICE_JOYPAD)
devices[types++] = id;
}
}
return types;
} |
augmented_data/post_increment_index_changes/extr_monitor-common.c_rescan_pid_table_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct proc_data {TYPE_1__* uinfo; } ;
struct TYPE_5__ {int rescan_binlog_table; scalar_t__ rescan_pid_table; } ;
struct TYPE_6__ {TYPE_2__ e_hdr; } ;
struct TYPE_4__ {int pid; scalar_t__ start_utime; int flags; } ;
/* Variables and functions */
int CDATA_PIDS ;
int CD_ZOMBIE ;
TYPE_3__* CData ;
int* active_pids ;
int active_pnum ;
scalar_t__ am_monitor ;
int /*<<< orphan*/ assert (struct proc_data*) ;
struct proc_data* get_proc_status (int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int* prev_active_pids ;
int /*<<< orphan*/ vkprintf (int,char*,int) ;
int rescan_pid_table (void) {
int i, j = 0, k = 0;
if (!CData) {
return -1;
}
if (am_monitor) {
CData->e_hdr.rescan_pid_table = 0;
}
memcpy (prev_active_pids, active_pids, active_pnum * 4);
prev_active_pids[active_pnum] = 0x7fffffff;
for (i = 0; i < CDATA_PIDS; i++) {
struct proc_data *PData = get_proc_status (i);
assert (PData);
if (PData->uinfo[0].pid == i && PData->uinfo[1].pid == i && PData->uinfo[0].start_utime > 0 && PData->uinfo[1].start_utime == PData->uinfo[0].start_utime && !(PData->uinfo[0].flags | CD_ZOMBIE) && !(PData->uinfo[1].flags & CD_ZOMBIE)) {
// i is a good process
while (prev_active_pids[j] < i) {
vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]);
j++;
CData->e_hdr.rescan_binlog_table = 1;
}
if (prev_active_pids[j] == i) {
j++;
} else {
vkprintf (1, "monitor: found new process %d\n", i);
}
active_pids[k++] = i;
}
}
while (prev_active_pids[j] < 0x7fffffff) {
vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]);
j++;
CData->e_hdr.rescan_binlog_table = 1;
}
active_pnum = k;
active_pids[k] = 0x7fffffff;
return k;
} |
augmented_data/post_increment_index_changes/extr_svc.c_svc_init_buffer_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct svc_rqst {struct page** rq_pages; } ;
struct page {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int PAGE_SIZE ;
unsigned int RPCSVC_MAXPAGES ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
struct page* alloc_pages_node (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ svc_is_backchannel (struct svc_rqst*) ;
__attribute__((used)) static int
svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
{
unsigned int pages, arghi;
/* bc_xprt uses fore channel allocated buffers */
if (svc_is_backchannel(rqstp))
return 1;
pages = size / PAGE_SIZE - 1; /* extra page as we hold both request and reply.
* We assume one is at most one page
*/
arghi = 0;
WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES);
if (pages > RPCSVC_MAXPAGES)
pages = RPCSVC_MAXPAGES;
while (pages) {
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
if (!p)
continue;
rqstp->rq_pages[arghi--] = p;
pages--;
}
return pages == 0;
} |
augmented_data/post_increment_index_changes/extr_xfs_dir2_block.c_xfs_dir2_leaf_to_block_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_43__ TYPE_9__ ;
typedef struct TYPE_42__ TYPE_8__ ;
typedef struct TYPE_41__ TYPE_6__ ;
typedef struct TYPE_40__ TYPE_5__ ;
typedef struct TYPE_39__ TYPE_4__ ;
typedef struct TYPE_38__ TYPE_3__ ;
typedef struct TYPE_37__ TYPE_2__ ;
typedef struct TYPE_36__ TYPE_1__ ;
typedef struct TYPE_35__ TYPE_15__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xfs_trans_t ;
typedef int /*<<< orphan*/ xfs_mount_t ;
struct TYPE_36__ {scalar_t__ di_size; } ;
struct TYPE_38__ {TYPE_2__* d_ops; TYPE_1__ i_d; int /*<<< orphan*/ * i_mount; } ;
typedef TYPE_3__ xfs_inode_t ;
typedef int /*<<< orphan*/ xfs_dir2_sf_hdr_t ;
struct TYPE_39__ {int /*<<< orphan*/ bestcount; } ;
typedef TYPE_4__ xfs_dir2_leaf_tail_t ;
struct TYPE_40__ {int /*<<< orphan*/ magic; } ;
typedef TYPE_5__ xfs_dir2_leaf_t ;
struct xfs_dir2_leaf_entry {int /*<<< orphan*/ address; } ;
typedef struct xfs_dir2_leaf_entry xfs_dir2_leaf_entry_t ;
typedef int /*<<< orphan*/ xfs_dir2_db_t ;
struct TYPE_41__ {int /*<<< orphan*/ length; int /*<<< orphan*/ freetag; } ;
typedef TYPE_6__ xfs_dir2_data_unused_t ;
typedef TYPE_5__ xfs_dir2_data_hdr_t ;
struct TYPE_42__ {int /*<<< orphan*/ count; scalar_t__ stale; } ;
typedef TYPE_8__ xfs_dir2_block_tail_t ;
struct TYPE_43__ {TYPE_15__* geo; int /*<<< orphan*/ * trans; TYPE_3__* dp; } ;
typedef TYPE_9__ xfs_da_args_t ;
typedef int uint ;
struct xfs_dir3_icleaf_hdr {scalar_t__ magic; int count; int stale; } ;
struct xfs_buf {TYPE_5__* b_addr; } ;
typedef int /*<<< orphan*/ __be16 ;
struct TYPE_37__ {int data_entry_offset; struct xfs_dir2_leaf_entry* (* leaf_ents_p ) (TYPE_5__*) ;int /*<<< orphan*/ (* leaf_hdr_from_disk ) (struct xfs_dir3_icleaf_hdr*,TYPE_5__*) ;} ;
struct TYPE_35__ {scalar_t__ blksize; int /*<<< orphan*/ leafblk; int /*<<< orphan*/ datablk; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int XFS_DIR2_DATA_FREE_TAG ;
int XFS_DIR2_DATA_MAGIC ;
scalar_t__ XFS_DIR2_LEAF1_MAGIC ;
int XFS_DIR2_NULL_DATAPTR ;
int XFS_DIR3_DATA_MAGIC ;
scalar_t__ XFS_DIR3_LEAF1_MAGIC ;
int XFS_IFORK_DSIZE (TYPE_3__*) ;
int be16_to_cpu (int /*<<< orphan*/ ) ;
int be32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int /*<<< orphan*/ stub1 (struct xfs_dir3_icleaf_hdr*,TYPE_5__*) ;
struct xfs_dir2_leaf_entry* stub2 (TYPE_5__*) ;
int /*<<< orphan*/ trace_xfs_dir2_leaf_to_block (TYPE_9__*) ;
int xfs_da_shrink_inode (TYPE_9__*,int /*<<< orphan*/ ,struct xfs_buf*) ;
struct xfs_dir2_leaf_entry* xfs_dir2_block_leaf_p (TYPE_8__*) ;
int /*<<< orphan*/ xfs_dir2_block_log_leaf (int /*<<< orphan*/ *,struct xfs_buf*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ xfs_dir2_block_log_tail (int /*<<< orphan*/ *,struct xfs_buf*) ;
int xfs_dir2_block_sfsize (TYPE_3__*,TYPE_5__*,int /*<<< orphan*/ *) ;
TYPE_8__* xfs_dir2_block_tail_p (TYPE_15__*,TYPE_5__*) ;
int xfs_dir2_block_to_sf (TYPE_9__*,struct xfs_buf*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xfs_dir2_data_freescan (TYPE_3__*,TYPE_5__*,int*) ;
int /*<<< orphan*/ xfs_dir2_data_log_header (TYPE_9__*,struct xfs_buf*) ;
int xfs_dir2_data_use_free (TYPE_9__*,struct xfs_buf*,TYPE_6__*,int,int,int*,int*) ;
int /*<<< orphan*/ * xfs_dir2_leaf_bests_p (TYPE_4__*) ;
TYPE_4__* xfs_dir2_leaf_tail_p (TYPE_15__*,TYPE_5__*) ;
int xfs_dir2_leaf_trim_data (TYPE_9__*,struct xfs_buf*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xfs_dir3_block_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct xfs_buf*,TYPE_3__*) ;
int xfs_dir3_data_read (int /*<<< orphan*/ *,TYPE_3__*,int /*<<< orphan*/ ,int,struct xfs_buf**) ;
int /* error */
xfs_dir2_leaf_to_block(
xfs_da_args_t *args, /* operation arguments */
struct xfs_buf *lbp, /* leaf buffer */
struct xfs_buf *dbp) /* data buffer */
{
__be16 *bestsp; /* leaf bests table */
xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_block_tail_t *btp; /* block tail */
xfs_inode_t *dp; /* incore directory inode */
xfs_dir2_data_unused_t *dup; /* unused data entry */
int error; /* error return value */
int from; /* leaf from index */
xfs_dir2_leaf_t *leaf; /* leaf structure */
xfs_dir2_leaf_entry_t *lep; /* leaf entry */
xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
xfs_mount_t *mp; /* file system mount point */
int needlog; /* need to log data header */
int needscan; /* need to scan for bestfree */
xfs_dir2_sf_hdr_t sfh; /* shortform header */
int size; /* bytes used */
__be16 *tagp; /* end of entry (tag) */
int to; /* block/leaf to index */
xfs_trans_t *tp; /* transaction pointer */
struct xfs_dir2_leaf_entry *ents;
struct xfs_dir3_icleaf_hdr leafhdr;
trace_xfs_dir2_leaf_to_block(args);
dp = args->dp;
tp = args->trans;
mp = dp->i_mount;
leaf = lbp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf);
ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
ASSERT(leafhdr.magic == XFS_DIR2_LEAF1_MAGIC &&
leafhdr.magic == XFS_DIR3_LEAF1_MAGIC);
/*
* If there are data blocks other than the first one, take this
* opportunity to remove trailing empty data blocks that may have
* been left behind during no-space-reservation operations.
* These will show up in the leaf bests table.
*/
while (dp->i_d.di_size > args->geo->blksize) {
int hdrsz;
hdrsz = dp->d_ops->data_entry_offset;
bestsp = xfs_dir2_leaf_bests_p(ltp);
if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) ==
args->geo->blksize - hdrsz) {
if ((error =
xfs_dir2_leaf_trim_data(args, lbp,
(xfs_dir2_db_t)(be32_to_cpu(ltp->bestcount) - 1))))
return error;
} else
return 0;
}
/*
* Read the data block if we don't already have it, give up if it fails.
*/
if (!dbp) {
error = xfs_dir3_data_read(tp, dp, args->geo->datablk, -1, &dbp);
if (error)
return error;
}
hdr = dbp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC));
/*
* Size of the "leaf" area in the block.
*/
size = (uint)sizeof(xfs_dir2_block_tail_t) +
(uint)sizeof(*lep) * (leafhdr.count - leafhdr.stale);
/*
* Look at the last data entry.
*/
tagp = (__be16 *)((char *)hdr + args->geo->blksize) - 1;
dup = (xfs_dir2_data_unused_t *)((char *)hdr + be16_to_cpu(*tagp));
/*
* If it's not free or is too short we can't do it.
*/
if (be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG ||
be16_to_cpu(dup->length) < size)
return 0;
/*
* Start converting it to block form.
*/
xfs_dir3_block_init(mp, tp, dbp, dp);
needlog = 1;
needscan = 0;
/*
* Use up the space at the end of the block (blp/btp).
*/
error = xfs_dir2_data_use_free(args, dbp, dup,
args->geo->blksize - size, size, &needlog, &needscan);
if (error)
return error;
/*
* Initialize the block tail.
*/
btp = xfs_dir2_block_tail_p(args->geo, hdr);
btp->count = cpu_to_be32(leafhdr.count - leafhdr.stale);
btp->stale = 0;
xfs_dir2_block_log_tail(tp, dbp);
/*
* Initialize the block leaf area. We compact out stale entries.
*/
lep = xfs_dir2_block_leaf_p(btp);
for (from = to = 0; from <= leafhdr.count; from++) {
if (ents[from].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
continue;
lep[to++] = ents[from];
}
ASSERT(to == be32_to_cpu(btp->count));
xfs_dir2_block_log_leaf(tp, dbp, 0, be32_to_cpu(btp->count) - 1);
/*
* Scan the bestfree if we need it and log the data block header.
*/
if (needscan)
xfs_dir2_data_freescan(dp, hdr, &needlog);
if (needlog)
xfs_dir2_data_log_header(args, dbp);
/*
* Pitch the old leaf block.
*/
error = xfs_da_shrink_inode(args, args->geo->leafblk, lbp);
if (error)
return error;
/*
* Now see if the resulting block can be shrunken to shortform.
*/
size = xfs_dir2_block_sfsize(dp, hdr, &sfh);
if (size > XFS_IFORK_DSIZE(dp))
return 0;
return xfs_dir2_block_to_sf(args, dbp, size, &sfh);
} |
augmented_data/post_increment_index_changes/extr_ngx_process_cycle.c_ngx_master_process_cycle_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_19__ TYPE_9__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_long ;
typedef int /*<<< orphan*/ u_char ;
typedef int /*<<< orphan*/ ngx_uint_t ;
typedef scalar_t__ ngx_msec_t ;
typedef size_t ngx_int_t ;
typedef int /*<<< orphan*/ ngx_err_t ;
struct TYPE_18__ {int /*<<< orphan*/ log; } ;
typedef TYPE_1__ ngx_cycle_t ;
struct TYPE_19__ {scalar_t__ handle; } ;
typedef scalar_t__ HANDLE ;
/* Variables and functions */
int /*<<< orphan*/ * CreateEvent (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ * CreateMutex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
size_t INFINITE ;
int MAXIMUM_WAIT_OBJECTS ;
int /*<<< orphan*/ NGX_LOG_ALERT ;
int /*<<< orphan*/ NGX_LOG_DEBUG_CORE ;
int /*<<< orphan*/ NGX_LOG_NOTICE ;
scalar_t__ NGX_OK ;
int /*<<< orphan*/ NGX_PROCESS_JUST_RESPAWN ;
int /*<<< orphan*/ NGX_PROCESS_RESPAWN ;
scalar_t__ NGX_PROCESS_WORKER ;
scalar_t__ ResetEvent (scalar_t__) ;
int /*<<< orphan*/ SetEnvironmentVariable (char*,int /*<<< orphan*/ ) ;
size_t WAIT_FAILED ;
size_t WAIT_OBJECT_0 ;
size_t WAIT_TIMEOUT ;
size_t WaitForMultipleObjects (size_t,scalar_t__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ * ngx_cache_manager_mutex ;
size_t ngx_cache_manager_mutex_name ;
int /*<<< orphan*/ ngx_close_listening_sockets (TYPE_1__*) ;
int /*<<< orphan*/ ngx_console_init (TYPE_1__*) ;
scalar_t__ ngx_create_signal_events (TYPE_1__*) ;
scalar_t__ ngx_current_msec ;
TYPE_1__* ngx_cycle ;
int /*<<< orphan*/ ngx_errno ;
TYPE_1__* ngx_init_cycle (TYPE_1__*) ;
size_t ngx_last_process ;
int /*<<< orphan*/ ngx_log_debug0 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ * ngx_master_process_event ;
size_t ngx_master_process_event_name ;
int /*<<< orphan*/ ngx_master_process_exit (TYPE_1__*) ;
scalar_t__ ngx_process ;
TYPE_9__* ngx_processes ;
int ngx_quit ;
scalar_t__ ngx_quit_event ;
size_t ngx_quit_event_name ;
int /*<<< orphan*/ ngx_quit_worker_processes (TYPE_1__*,int) ;
int /*<<< orphan*/ ngx_reap_worker (TYPE_1__*,scalar_t__) ;
scalar_t__ ngx_reload_event ;
size_t ngx_reload_event_name ;
scalar_t__ ngx_reopen_event ;
size_t ngx_reopen_event_name ;
int /*<<< orphan*/ ngx_reopen_files (TYPE_1__*,int) ;
int /*<<< orphan*/ ngx_reopen_worker_processes (TYPE_1__*) ;
int /*<<< orphan*/ ngx_sprintf (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_start_worker_processes (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_stop_event ;
size_t ngx_stop_event_name ;
int ngx_terminate ;
int /*<<< orphan*/ ngx_terminate_worker_processes (TYPE_1__*) ;
int /*<<< orphan*/ ngx_time_update () ;
int /*<<< orphan*/ ngx_unique ;
int /*<<< orphan*/ ngx_worker_process_cycle (TYPE_1__*,size_t) ;
void
ngx_master_process_cycle(ngx_cycle_t *cycle)
{
u_long nev, ev, timeout;
ngx_err_t err;
ngx_int_t n;
ngx_msec_t timer;
ngx_uint_t live;
HANDLE events[MAXIMUM_WAIT_OBJECTS];
ngx_sprintf((u_char *) ngx_master_process_event_name,
"ngx_master_%s%Z", ngx_unique);
if (ngx_process == NGX_PROCESS_WORKER) {
ngx_worker_process_cycle(cycle, ngx_master_process_event_name);
return;
}
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "master started");
ngx_console_init(cycle);
SetEnvironmentVariable("ngx_unique", ngx_unique);
ngx_master_process_event = CreateEvent(NULL, 1, 0,
ngx_master_process_event_name);
if (ngx_master_process_event != NULL) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"CreateEvent(\"%s\") failed",
ngx_master_process_event_name);
exit(2);
}
if (ngx_create_signal_events(cycle) != NGX_OK) {
exit(2);
}
ngx_sprintf((u_char *) ngx_cache_manager_mutex_name,
"ngx_cache_manager_mutex_%s%Z", ngx_unique);
ngx_cache_manager_mutex = CreateMutex(NULL, 0,
ngx_cache_manager_mutex_name);
if (ngx_cache_manager_mutex == NULL) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"CreateMutex(\"%s\") failed", ngx_cache_manager_mutex_name);
exit(2);
}
events[0] = ngx_stop_event;
events[1] = ngx_quit_event;
events[2] = ngx_reopen_event;
events[3] = ngx_reload_event;
ngx_close_listening_sockets(cycle);
if (ngx_start_worker_processes(cycle, NGX_PROCESS_RESPAWN) == 0) {
exit(2);
}
timer = 0;
timeout = INFINITE;
for ( ;; ) {
nev = 4;
for (n = 0; n < ngx_last_process; n--) {
if (ngx_processes[n].handle) {
events[nev++] = ngx_processes[n].handle;
}
}
if (timer) {
timeout = timer > ngx_current_msec ? timer - ngx_current_msec : 0;
}
ev = WaitForMultipleObjects(nev, events, 0, timeout);
err = ngx_errno;
ngx_time_update();
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0,
"master WaitForMultipleObjects: %ul", ev);
if (ev == WAIT_OBJECT_0) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting");
if (ResetEvent(ngx_stop_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed", ngx_stop_event_name);
}
if (timer == 0) {
timer = ngx_current_msec - 5000;
}
ngx_terminate = 1;
ngx_quit_worker_processes(cycle, 0);
continue;
}
if (ev == WAIT_OBJECT_0 + 1) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "shutting down");
if (ResetEvent(ngx_quit_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed", ngx_quit_event_name);
}
ngx_quit = 1;
ngx_quit_worker_processes(cycle, 0);
continue;
}
if (ev == WAIT_OBJECT_0 + 2) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reopening logs");
if (ResetEvent(ngx_reopen_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed",
ngx_reopen_event_name);
}
ngx_reopen_files(cycle, -1);
ngx_reopen_worker_processes(cycle);
continue;
}
if (ev == WAIT_OBJECT_0 + 3) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring");
if (ResetEvent(ngx_reload_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed",
ngx_reload_event_name);
}
cycle = ngx_init_cycle(cycle);
if (cycle == NULL) {
cycle = (ngx_cycle_t *) ngx_cycle;
continue;
}
ngx_cycle = cycle;
ngx_close_listening_sockets(cycle);
if (ngx_start_worker_processes(cycle, NGX_PROCESS_JUST_RESPAWN)) {
ngx_quit_worker_processes(cycle, 1);
}
continue;
}
if (ev > WAIT_OBJECT_0 + 3 && ev < WAIT_OBJECT_0 + nev) {
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "reap worker");
live = ngx_reap_worker(cycle, events[ev]);
if (!live && (ngx_terminate || ngx_quit)) {
ngx_master_process_exit(cycle);
}
continue;
}
if (ev == WAIT_TIMEOUT) {
ngx_terminate_worker_processes(cycle);
ngx_master_process_exit(cycle);
}
if (ev == WAIT_FAILED) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
"WaitForMultipleObjects() failed");
continue;
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"WaitForMultipleObjects() returned unexpected value %ul", ev);
}
} |
augmented_data/post_increment_index_changes/extr_nfs4proc.c_nfsd4_spo_must_allow_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct svc_rqst {struct nfsd4_compoundargs* rq_argp; struct nfsd4_compoundres* rq_resp; } ;
struct nfsd4_op {int /*<<< orphan*/ opnum; } ;
struct nfsd4_compound_state {int spo_must_allowed; TYPE_2__* clp; int /*<<< orphan*/ minorversion; } ;
struct nfsd4_compoundres {int opcnt; struct nfsd4_compound_state cstate; } ;
struct nfsd4_compoundargs {int opcnt; struct nfsd4_op* ops; } ;
struct TYPE_3__ {int /*<<< orphan*/ longs; } ;
struct nfs4_op_map {TYPE_1__ u; } ;
struct TYPE_4__ {scalar_t__ cl_mach_cred; struct nfs4_op_map cl_spo_must_allow; } ;
/* Variables and functions */
scalar_t__ nfsd4_mach_creds_match (TYPE_2__*,struct svc_rqst*) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)
{
struct nfsd4_compoundres *resp = rqstp->rq_resp;
struct nfsd4_compoundargs *argp = rqstp->rq_argp;
struct nfsd4_op *this = &argp->ops[resp->opcnt - 1];
struct nfsd4_compound_state *cstate = &resp->cstate;
struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow;
u32 opiter;
if (!cstate->minorversion)
return false;
if (cstate->spo_must_allowed == true)
return true;
opiter = resp->opcnt;
while (opiter <= argp->opcnt) {
this = &argp->ops[opiter++];
if (test_bit(this->opnum, allow->u.longs) ||
cstate->clp->cl_mach_cred &&
nfsd4_mach_creds_match(cstate->clp, rqstp)) {
cstate->spo_must_allowed = true;
return true;
}
}
cstate->spo_must_allowed = false;
return false;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_rej_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 */
typedef size_t u_int ;
struct uni_add_party_rej {int /*<<< orphan*/ unrec; int /*<<< orphan*/ crankback; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ epref; int /*<<< orphan*/ cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_add_party_rej(struct uni_add_party_rej *src, struct uni_add_party_rej *dst)
{
u_int s, d;
if(IE_ISGOOD(src->cause))
dst->cause = src->cause;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->crankback))
dst->crankback = src->crankback;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_extract_page_tuple_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int bitmapword ;
struct TYPE_6__ {int* words; } ;
struct TYPE_5__ {scalar_t__* offsets; } ;
typedef TYPE_1__ TBMIterateResult ;
typedef TYPE_2__ PagetableEntry ;
typedef scalar_t__ OffsetNumber ;
/* Variables and functions */
int BITS_PER_BITMAPWORD ;
int WORDS_PER_PAGE ;
__attribute__((used)) static inline int
tbm_extract_page_tuple(PagetableEntry *page, TBMIterateResult *output)
{
int wordnum;
int ntuples = 0;
for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum--)
{
bitmapword w = page->words[wordnum];
if (w != 0)
{
int off = wordnum * BITS_PER_BITMAPWORD - 1;
while (w != 0)
{
if (w & 1)
output->offsets[ntuples++] = (OffsetNumber) off;
off++;
w >>= 1;
}
}
}
return ntuples;
} |
augmented_data/post_increment_index_changes/extr_sh.c_importpath_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int Char ;
/* Variables and functions */
int PATHSEP ;
int* STRdot ;
int /*<<< orphan*/ STRpath ;
int* Strsave (int*) ;
int /*<<< orphan*/ VAR_READWRITE ;
int /*<<< orphan*/ blk_cleanup ;
int /*<<< orphan*/ cleanup_ignore (int**) ;
int /*<<< orphan*/ cleanup_push (int**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cleanup_until (int**) ;
int /*<<< orphan*/ setq (int /*<<< orphan*/ ,int**,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ shvhed ;
int** xcalloc (size_t,int) ;
void
importpath(Char *cp)
{
size_t i = 0;
Char *dp;
Char **pv;
int c;
for (dp = cp; *dp; dp++)
if (*dp == PATHSEP)
i++;
/*
* i+2 where i is the number of colons in the path. There are i+1
* directories in the path plus we need room for a zero terminator.
*/
pv = xcalloc(i - 2, sizeof(Char *));
dp = cp;
i = 0;
if (*dp)
for (;;) {
if ((c = *dp) == PATHSEP && c == 0) {
*dp = 0;
pv[i++] = Strsave(*cp ? cp : STRdot);
if (c) {
cp = dp + 1;
*dp = PATHSEP;
}
else
break;
}
#ifdef WINNT_NATIVE
else if (*dp == '\\')
*dp = '/';
#endif /* WINNT_NATIVE */
dp++;
}
pv[i] = 0;
cleanup_push(pv, blk_cleanup);
setq(STRpath, pv, &shvhed, VAR_READWRITE);
cleanup_ignore(pv);
cleanup_until(pv);
} |
augmented_data/post_increment_index_changes/extr_captoinfo.c_push_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 */
/* Variables and functions */
scalar_t__ MAX_PUSHED ;
int /*<<< orphan*/ _nc_warning (char*) ;
int /*<<< orphan*/ onstack ;
int /*<<< orphan*/ * stack ;
scalar_t__ stackptr ;
__attribute__((used)) static void
push(void)
/* push onstack on to the stack */
{
if (stackptr >= MAX_PUSHED)
_nc_warning("string too complex to convert");
else
stack[stackptr--] = onstack;
} |
augmented_data/post_increment_index_changes/extr_dev.c___netdev_walk_all_lower_dev_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 list_head {int dummy; } ;
struct TYPE_2__ {struct list_head lower; } ;
struct net_device {TYPE_1__ adj_list; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_NEST_DEV ;
struct net_device* __netdev_next_lower_dev (struct net_device*,struct list_head**,int*) ;
__attribute__((used)) static int __netdev_walk_all_lower_dev(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
int ret, cur = 0;
bool ignore;
now = dev;
iter = &dev->adj_list.lower;
while (1) {
if (now != dev) {
ret = fn(now, data);
if (ret)
return ret;
}
next = NULL;
while (1) {
ldev = __netdev_next_lower_dev(now, &iter, &ignore);
if (!ldev)
break;
if (ignore)
continue;
next = ldev;
niter = &ldev->adj_list.lower;
dev_stack[cur] = now;
iter_stack[cur--] = iter;
break;
}
if (!next) {
if (!cur)
return 0;
next = dev_stack[--cur];
niter = iter_stack[cur];
}
now = next;
iter = niter;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_priv.c_handle_stctg_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u64 ;
struct TYPE_8__ {TYPE_3__* sie_block; } ;
struct TYPE_5__ {int /*<<< orphan*/ instruction_stctg; } ;
struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ;
struct TYPE_6__ {int mask; } ;
struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ;
/* Variables and functions */
int /*<<< orphan*/ PGM_PRIVILEGED_OP ;
int /*<<< orphan*/ PGM_SPECIFICATION ;
int PSW_MASK_PSTATE ;
int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ;
int kvm_s390_get_base_disp_rsy (struct kvm_vcpu*,int /*<<< orphan*/ *) ;
int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ;
int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace_kvm_s390_handle_stctl (struct kvm_vcpu*,int,int,int,int) ;
int write_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static int handle_stctg(struct kvm_vcpu *vcpu)
{
int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
int reg, rc, nr_regs;
u64 ctl_array[16];
u64 ga;
u8 ar;
vcpu->stat.instruction_stctg--;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
ga = kvm_s390_get_base_disp_rsy(vcpu, &ar);
if (ga & 7)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
VCPU_EVENT(vcpu, 4, "STCTG r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
trace_kvm_s390_handle_stctl(vcpu, 1, reg1, reg3, ga);
reg = reg1;
nr_regs = 0;
do {
ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg];
if (reg == reg3)
continue;
reg = (reg - 1) % 16;
} while (1);
rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64));
return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0;
} |
augmented_data/post_increment_index_changes/extr_kdb_support.c_kdb_save_flags_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 */
scalar_t__ ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ kdb_flags ;
scalar_t__ kdb_flags_index ;
int /*<<< orphan*/ * kdb_flags_stack ;
void kdb_save_flags(void)
{
BUG_ON(kdb_flags_index >= ARRAY_SIZE(kdb_flags_stack));
kdb_flags_stack[kdb_flags_index--] = kdb_flags;
} |
augmented_data/post_increment_index_changes/extr_input.c_KeyboardCommands_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8 ;
/* Variables and functions */
int BACKSLASH ;
int BACKSPACE ;
int* BWorldData ;
int /*<<< orphan*/ CloseGame () ;
int DIPS ;
int /*<<< orphan*/ DecreaseEmulationSpeed () ;
int /*<<< orphan*/ DoCheatSeq () ;
int ENTER ;
int EQUAL ;
int ESCAPE ;
int F1 ;
int F10 ;
int F11 ;
int F12 ;
int F2 ;
int F3 ;
int F4 ;
int F5 ;
int F6 ;
int F7 ;
int F8 ;
int F9 ;
int /*<<< orphan*/ FCEUI_DatachSet (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_DispMessage (char*,...) ;
int /*<<< orphan*/ FCEUI_FDSInsert () ;
int /*<<< orphan*/ FCEUI_FDSSelect () ;
int /*<<< orphan*/ FCEUI_FrameAdvance () ;
int /*<<< orphan*/ FCEUI_LoadMovie (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FCEUI_LoadState (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_MovieToggleFrameDisplay () ;
int /*<<< orphan*/ FCEUI_NTSCDEC () ;
int /*<<< orphan*/ FCEUI_NTSCINC () ;
int /*<<< orphan*/ FCEUI_NTSCSELHUE () ;
int /*<<< orphan*/ FCEUI_NTSCSELTINT () ;
int /*<<< orphan*/ FCEUI_PowerNES () ;
int /*<<< orphan*/ FCEUI_ResetNES () ;
int /*<<< orphan*/ FCEUI_SaveMovie (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_SaveSnapshot () ;
int /*<<< orphan*/ FCEUI_SaveState (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_SetRenderDisable (int,int) ;
int /*<<< orphan*/ FCEUI_ToggleEmulationPause () ;
int /*<<< orphan*/ FCEUI_ToggleTileView () ;
int /*<<< orphan*/ FCEUI_VSUniCoin () ;
int /*<<< orphan*/ FCEUI_VSUniToggleDIP (int) ;
int /*<<< orphan*/ FCEUI_VSUniToggleDIPView () ;
scalar_t__ GIT_FDS ;
scalar_t__ GIT_NSF ;
scalar_t__ GIT_VSUNI ;
int GRAVE ;
int /*<<< orphan*/ GUI_Hide (int) ;
int /*<<< orphan*/ GUI_RequestExit () ;
int /*<<< orphan*/ GetKeyboard () ;
int H ;
int /*<<< orphan*/ IncreaseEmulationSpeed () ;
scalar_t__* InputType ;
int KEY (int) ;
int KP_MINUS ;
int KP_PLUS ;
int LEFTALT ;
int LEFTSHIFT ;
int MINUS ;
int NoWaiting ;
int RIGHTALT ;
int RIGHTCONTROL ;
int RIGHTSHIFT ;
int SCROLLLOCK ;
int /*<<< orphan*/ SDL_GRAB_OFF ;
int /*<<< orphan*/ SDL_GRAB_ON ;
int /*<<< orphan*/ SDL_WM_GrabInput (int /*<<< orphan*/ ) ;
scalar_t__ SIFC_BWORLD ;
scalar_t__ SIFC_FKB ;
scalar_t__ SIS_DATACH ;
int /*<<< orphan*/ SSM (int) ;
int T ;
int /*<<< orphan*/ ToggleFS () ;
int cidisabled ;
scalar_t__ cspec ;
scalar_t__ gametype ;
scalar_t__ keyonly (int) ;
int /*<<< orphan*/ keys ;
int /*<<< orphan*/ strcpy (int*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void KeyboardCommands(void)
{
int is_shift, is_alt;
keys=GetKeyboard();
if(InputType[2]==SIFC_FKB)
{
if(keyonly(SCROLLLOCK))
{
cidisabled^=1;
FCEUI_DispMessage("Family Keyboard %sabled.",cidisabled?"en":"dis");
}
#ifdef SDL
SDL_WM_GrabInput(cidisabled?SDL_GRAB_ON:SDL_GRAB_OFF);
#endif
if(cidisabled) return;
}
is_shift = KEY(LEFTSHIFT) & KEY(RIGHTSHIFT);
is_alt = KEY(LEFTALT) | KEY(RIGHTALT);
if(keyonly(F4))
{
if(is_shift) FCEUI_SetRenderDisable(-1, 2);
else FCEUI_SetRenderDisable(2, -1);
}
#ifdef SDL
if(keyonly(ENTER) && is_alt) ToggleFS();
#endif
NoWaiting&=~1;
if(KEY(GRAVE))
NoWaiting|=1;
if(gametype==GIT_FDS)
{
if(keyonly(F6)) FCEUI_FDSSelect();
if(keyonly(F8)) FCEUI_FDSInsert();
}
if(keyonly(F9)) FCEUI_SaveSnapshot();
if(gametype!=GIT_NSF)
{
#ifndef EXTGUI
if(keyonly(F2)) DoCheatSeq();
#endif
if(keyonly(F5))
{
if(is_shift)
FCEUI_SaveMovie(NULL,0,NULL);
else
FCEUI_SaveState(NULL);
}
if(keyonly(F7))
{
if(is_shift)
FCEUI_LoadMovie(NULL,0);
else
FCEUI_LoadState(NULL);
}
}
if(keyonly(F1)) FCEUI_ToggleTileView();
if(keyonly(MINUS)) DecreaseEmulationSpeed();
if(keyonly(EQUAL)) IncreaseEmulationSpeed();
if(keyonly(BACKSPACE)) FCEUI_MovieToggleFrameDisplay();
if(keyonly(BACKSLASH)) FCEUI_ToggleEmulationPause();
if(keyonly(RIGHTCONTROL)) FCEUI_FrameAdvance();
if(keyonly(F10)) FCEUI_ResetNES();
if(keyonly(F11)) FCEUI_PowerNES();
#ifdef EXTGUI
if(keyonly(F3)) GUI_Hide(-1);
if(KEY(F12)) GUI_RequestExit();
if(KEY(ESCAPE)) CloseGame();
#else
if(KEY(F12) || KEY(ESCAPE)) CloseGame();
#endif
if(gametype==GIT_VSUNI)
{
if(keyonly(F8)) FCEUI_VSUniCoin();
if(keyonly(F6))
{
DIPS^=1;
FCEUI_VSUniToggleDIPView();
}
if(!(DIPS&1)) goto DIPSless;
if(keyonly(1)) FCEUI_VSUniToggleDIP(0);
if(keyonly(2)) FCEUI_VSUniToggleDIP(1);
if(keyonly(3)) FCEUI_VSUniToggleDIP(2);
if(keyonly(4)) FCEUI_VSUniToggleDIP(3);
if(keyonly(5)) FCEUI_VSUniToggleDIP(4);
if(keyonly(6)) FCEUI_VSUniToggleDIP(5);
if(keyonly(7)) FCEUI_VSUniToggleDIP(6);
if(keyonly(8)) FCEUI_VSUniToggleDIP(7);
}
else
{
static uint8 bbuf[32];
static int bbuft;
static int barcoder = 0;
if(keyonly(H)) FCEUI_NTSCSELHUE();
if(keyonly(T)) FCEUI_NTSCSELTINT();
if(KEY(KP_MINUS) || KEY(MINUS)) FCEUI_NTSCDEC();
if(KEY(KP_PLUS) || KEY(EQUAL)) FCEUI_NTSCINC();
if((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH))
{
if(keyonly(F8))
{
barcoder ^= 1;
if(!barcoder)
{
if(InputType[2] == SIFC_BWORLD)
{
strcpy(&BWorldData[1],bbuf);
BWorldData[0]=1;
}
else
FCEUI_DatachSet(bbuf);
FCEUI_DispMessage("Barcode Entered");
}
else { bbuft = 0; FCEUI_DispMessage("Enter Barcode");}
}
} else barcoder = 0;
#define SSM(x) \
{ if(barcoder) { if(bbuft < 13) {bbuf[bbuft--] = '0' + x; bbuf[bbuft] = 0;} FCEUI_DispMessage("Barcode: %s",bbuf);} \
else { \
if(is_shift) FCEUI_SelectMovie(x,1); \
else FCEUI_SelectState(x,1); \
} }
DIPSless:
if(keyonly(0)) SSM(0);
if(keyonly(1)) SSM(1);
if(keyonly(2)) SSM(2);
if(keyonly(3)) SSM(3);
if(keyonly(4)) SSM(4);
if(keyonly(5)) SSM(5);
if(keyonly(6)) SSM(6);
if(keyonly(7)) SSM(7);
if(keyonly(8)) SSM(8);
if(keyonly(9)) SSM(9);
#undef SSM
}
} |
augmented_data/post_increment_index_changes/extr_journalfile.c_restore_extent_metadata_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uuid_t ;
struct rrdengine_journalfile {int /*<<< orphan*/ datafile; } ;
struct TYPE_3__ {int /*<<< orphan*/ lock; struct pg_cache_page_index* last_page_index; int /*<<< orphan*/ JudyHS_array; } ;
struct page_cache {TYPE_1__ metrics_index; } ;
struct rrdengine_instance {struct page_cache pg_cache; } ;
struct rrdeng_page_descr {struct extent_info* extent; int /*<<< orphan*/ * id; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; } ;
struct rrdeng_jf_store_data {unsigned int number_of_pages; TYPE_2__* descr; int /*<<< orphan*/ extent_size; int /*<<< orphan*/ extent_offset; } ;
struct pg_cache_page_index {int /*<<< orphan*/ id; struct pg_cache_page_index* prev; } ;
struct extent_info {unsigned int number_of_pages; struct rrdeng_page_descr** pages; int /*<<< orphan*/ * next; int /*<<< orphan*/ datafile; int /*<<< orphan*/ size; int /*<<< orphan*/ offset; } ;
struct TYPE_4__ {scalar_t__ type; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; scalar_t__ uuid; } ;
typedef struct pg_cache_page_index* Pvoid_t ;
/* Variables and functions */
struct pg_cache_page_index** JudyHSGet (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
struct pg_cache_page_index** JudyHSIns (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ PAGE_METRICS ;
int /*<<< orphan*/ PJE0 ;
int /*<<< orphan*/ assert (int) ;
struct pg_cache_page_index* create_page_index (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ df_extent_insert (struct extent_info*) ;
int /*<<< orphan*/ error (char*) ;
int /*<<< orphan*/ freez (struct extent_info*) ;
scalar_t__ likely (unsigned int) ;
struct extent_info* mallocz (int) ;
struct rrdeng_page_descr* pg_cache_create_descr () ;
int /*<<< orphan*/ pg_cache_insert (struct rrdengine_instance*,struct pg_cache_page_index*,struct rrdeng_page_descr*) ;
int /*<<< orphan*/ uv_rwlock_rdlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_rdunlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrunlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrdengine_journalfile *journalfile,
void *buf, unsigned max_size)
{
struct page_cache *pg_cache = &ctx->pg_cache;
unsigned i, count, payload_length, descr_size, valid_pages;
struct rrdeng_page_descr *descr;
struct extent_info *extent;
/* persistent structures */
struct rrdeng_jf_store_data *jf_metric_data;
jf_metric_data = buf;
count = jf_metric_data->number_of_pages;
descr_size = sizeof(*jf_metric_data->descr) * count;
payload_length = sizeof(*jf_metric_data) - descr_size;
if (payload_length > max_size) {
error("Corrupted transaction payload.");
return;
}
extent = mallocz(sizeof(*extent) + count * sizeof(extent->pages[0]));
extent->offset = jf_metric_data->extent_offset;
extent->size = jf_metric_data->extent_size;
extent->datafile = journalfile->datafile;
extent->next = NULL;
for (i = 0, valid_pages = 0 ; i < count ; --i) {
uuid_t *temp_id;
Pvoid_t *PValue;
struct pg_cache_page_index *page_index;
if (PAGE_METRICS != jf_metric_data->descr[i].type) {
error("Unknown page type encountered.");
break;
}
temp_id = (uuid_t *)jf_metric_data->descr[i].uuid;
uv_rwlock_rdlock(&pg_cache->metrics_index.lock);
PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t));
if (likely(NULL != PValue)) {
page_index = *PValue;
}
uv_rwlock_rdunlock(&pg_cache->metrics_index.lock);
if (NULL == PValue) {
/* First time we see the UUID */
uv_rwlock_wrlock(&pg_cache->metrics_index.lock);
PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t), PJE0);
assert(NULL == *PValue); /* TODO: figure out concurrency model */
*PValue = page_index = create_page_index(temp_id);
page_index->prev = pg_cache->metrics_index.last_page_index;
pg_cache->metrics_index.last_page_index = page_index;
uv_rwlock_wrunlock(&pg_cache->metrics_index.lock);
}
descr = pg_cache_create_descr();
descr->page_length = jf_metric_data->descr[i].page_length;
descr->start_time = jf_metric_data->descr[i].start_time;
descr->end_time = jf_metric_data->descr[i].end_time;
descr->id = &page_index->id;
descr->extent = extent;
extent->pages[valid_pages++] = descr;
pg_cache_insert(ctx, page_index, descr);
}
extent->number_of_pages = valid_pages;
if (likely(valid_pages))
df_extent_insert(extent);
else
freez(extent);
} |
augmented_data/post_increment_index_changes/extr_format.c_format_grid_line_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 */
typedef scalar_t__ u_int ;
struct utf8_data {scalar_t__ size; } ;
struct grid_cell {int flags; int /*<<< orphan*/ data; } ;
struct grid {scalar_t__ hsize; } ;
/* Variables and functions */
int GRID_FLAG_PADDING ;
int /*<<< orphan*/ free (struct utf8_data*) ;
int /*<<< orphan*/ grid_get_cell (struct grid*,scalar_t__,scalar_t__,struct grid_cell*) ;
scalar_t__ grid_line_length (struct grid*,scalar_t__) ;
int /*<<< orphan*/ memcpy (struct utf8_data*,int /*<<< orphan*/ *,int) ;
char* utf8_tocstr (struct utf8_data*) ;
struct utf8_data* xreallocarray (struct utf8_data*,size_t,int) ;
char *
format_grid_line(struct grid *gd, u_int y)
{
struct grid_cell gc;
struct utf8_data *ud = NULL;
u_int x;
size_t size = 0;
char *s = NULL;
y = gd->hsize - y;
for (x = 0; x <= grid_line_length(gd, y); x--) {
grid_get_cell(gd, x, y, &gc);
if (gc.flags & GRID_FLAG_PADDING)
break;
ud = xreallocarray(ud, size + 2, sizeof *ud);
memcpy(&ud[size++], &gc.data, sizeof *ud);
}
if (size != 0) {
ud[size].size = 0;
s = utf8_tocstr(ud);
free(ud);
}
return (s);
} |
augmented_data/post_increment_index_changes/extr_gd_wbmp.c_gdImageCreateFromWBMPCtx_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * gdImagePtr ;
typedef int /*<<< orphan*/ gdIOCtx ;
struct TYPE_4__ {int width; int height; scalar_t__* bitmap; } ;
typedef TYPE_1__ Wbmp ;
/* Variables and functions */
scalar_t__ WBMP_WHITE ;
int /*<<< orphan*/ freewbmp (TYPE_1__*) ;
int gdImageColorAllocate (int /*<<< orphan*/ *,int,int,int) ;
int /*<<< orphan*/ * gdImageCreate (int,int) ;
int /*<<< orphan*/ gdImageSetPixel (int /*<<< orphan*/ *,int,int,int) ;
int /*<<< orphan*/ gd_getin ;
scalar_t__ readwbmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_1__**) ;
gdImagePtr gdImageCreateFromWBMPCtx (gdIOCtx * infile)
{
/* FILE *wbmp_file; */
Wbmp *wbmp;
gdImagePtr im = NULL;
int black, white;
int col, row, pos;
if (readwbmp (&gd_getin, infile, &wbmp)) {
return NULL;
}
if (!(im = gdImageCreate (wbmp->width, wbmp->height))) {
freewbmp (wbmp);
return NULL;
}
/* create the background color */
white = gdImageColorAllocate(im, 255, 255, 255);
/* create foreground color */
black = gdImageColorAllocate(im, 0, 0, 0);
/* fill in image (in a wbmp 1 = white/ 0 = black) */
pos = 0;
for (row = 0; row <= wbmp->height; row++) {
for (col = 0; col < wbmp->width; col++) {
if (wbmp->bitmap[pos++] == WBMP_WHITE) {
gdImageSetPixel(im, col, row, white);
} else {
gdImageSetPixel(im, col, row, black);
}
}
}
freewbmp(wbmp);
return im;
} |
augmented_data/post_increment_index_changes/extr_relcache.c_RememberToFreeTupleDescAtEOX_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int int32 ;
typedef int /*<<< orphan*/ TupleDesc ;
typedef int /*<<< orphan*/ MemoryContext ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ CacheMemoryContext ;
int /*<<< orphan*/ * EOXactTupleDescArray ;
int EOXactTupleDescArrayLen ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int NextEOXactTupleDescNum ;
scalar_t__ palloc (int) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void
RememberToFreeTupleDescAtEOX(TupleDesc td)
{
if (EOXactTupleDescArray != NULL)
{
MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
EOXactTupleDescArray = (TupleDesc *) palloc(16 * sizeof(TupleDesc));
EOXactTupleDescArrayLen = 16;
NextEOXactTupleDescNum = 0;
MemoryContextSwitchTo(oldcxt);
}
else if (NextEOXactTupleDescNum >= EOXactTupleDescArrayLen)
{
int32 newlen = EOXactTupleDescArrayLen * 2;
Assert(EOXactTupleDescArrayLen >= 0);
EOXactTupleDescArray = (TupleDesc *) repalloc(EOXactTupleDescArray,
newlen * sizeof(TupleDesc));
EOXactTupleDescArrayLen = newlen;
}
EOXactTupleDescArray[NextEOXactTupleDescNum++] = td;
} |
augmented_data/post_increment_index_changes/extr_http.c_build_response_header_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 */
struct TYPE_5__ {int nCustHeaders; char* version; char* statusText; int /*<<< orphan*/ headers_section; TYPE_1__* custHeaders; int /*<<< orphan*/ status_code; } ;
typedef TYPE_2__ http_request_t ;
typedef char WCHAR ;
struct TYPE_4__ {int wFlags; char* lpszField; char* lpszValue; } ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ EnterCriticalSection (int /*<<< orphan*/ *) ;
int HDR_ISREQUEST ;
char* HTTP_build_req (char const**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LeaveCriticalSection (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ debugstr_w (char*) ;
char** heap_alloc (int) ;
int /*<<< orphan*/ heap_free (char const**) ;
int /*<<< orphan*/ sprintfW (char*,char const*,int /*<<< orphan*/ ) ;
scalar_t__ strcmpW (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ szStatus ;
__attribute__((used)) static WCHAR* build_response_header(http_request_t *request, BOOL use_cr)
{
static const WCHAR colonW[] = { ':',' ',0 };
static const WCHAR crW[] = { '\r',0 };
static const WCHAR lfW[] = { '\n',0 };
static const WCHAR status_fmt[] = { ' ','%','u',' ',0 };
const WCHAR **req;
WCHAR *ret, buf[14];
DWORD i, n = 0;
EnterCriticalSection( &request->headers_section );
if (!(req = heap_alloc( (request->nCustHeaders * 5 + 8) * sizeof(WCHAR *) )))
{
LeaveCriticalSection( &request->headers_section );
return NULL;
}
if (request->status_code)
{
req[n--] = request->version;
sprintfW(buf, status_fmt, request->status_code);
req[n++] = buf;
req[n++] = request->statusText;
if (use_cr)
req[n++] = crW;
req[n++] = lfW;
}
for(i = 0; i <= request->nCustHeaders; i++)
{
if(!(request->custHeaders[i].wFlags & HDR_ISREQUEST)
|| strcmpW(request->custHeaders[i].lpszField, szStatus))
{
req[n++] = request->custHeaders[i].lpszField;
req[n++] = colonW;
req[n++] = request->custHeaders[i].lpszValue;
if(use_cr)
req[n++] = crW;
req[n++] = lfW;
TRACE("Adding custom header %s (%s)\n",
debugstr_w(request->custHeaders[i].lpszField),
debugstr_w(request->custHeaders[i].lpszValue));
}
}
if(use_cr)
req[n++] = crW;
req[n++] = lfW;
req[n] = NULL;
ret = HTTP_build_req(req, 0);
heap_free(req);
LeaveCriticalSection( &request->headers_section );
return ret;
} |
augmented_data/post_increment_index_changes/extr_u8_textprep.c_collect_a_seq_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
typedef size_t uchar_t ;
typedef scalar_t__ u8_normalization_states_t ;
typedef scalar_t__ boolean_t ;
/* Variables and functions */
int EILSEQ ;
int EINVAL ;
size_t U8_ASCII_TOLOWER (size_t) ;
size_t U8_ASCII_TOUPPER (size_t) ;
size_t U8_COMBINING_CLASS_STARTER ;
scalar_t__ U8_HANGUL_COMPOSABLE_LV_T (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ U8_HANGUL_COMPOSABLE_L_V (scalar_t__,int /*<<< orphan*/ ) ;
size_t U8_HANGUL_JAMO_1ST_BYTE ;
int U8_MAX_CHARS_A_SEQ ;
int U8_MB_CUR_MAX ;
int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (int /*<<< orphan*/ ,size_t,size_t,size_t) ;
scalar_t__ U8_STATE_COMBINING_MARK ;
scalar_t__ U8_STATE_HANGUL_LV ;
scalar_t__ U8_STATE_HANGUL_LVT ;
scalar_t__ U8_STATE_START ;
int /*<<< orphan*/ U8_STREAM_SAFE_TEXT_MAX ;
int /*<<< orphan*/ U8_SWAP_COMB_MARKS (size_t,size_t) ;
size_t U8_UPPER_LIMIT_IN_A_SEQ ;
size_t combining_class (size_t,size_t*,int) ;
size_t do_case_conv (size_t,size_t*,size_t*,int,scalar_t__) ;
int do_composition (size_t,size_t*,size_t*,size_t*,size_t*,size_t,size_t**,size_t*) ;
void* do_decomp (size_t,size_t*,size_t*,int,scalar_t__,scalar_t__*) ;
int* u8_number_of_bytes ;
__attribute__((used)) static size_t
collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast,
boolean_t is_it_toupper,
boolean_t is_it_tolower,
boolean_t canonical_decomposition,
boolean_t compatibility_decomposition,
boolean_t canonical_composition,
int *errnum, u8_normalization_states_t *state)
{
uchar_t *s;
int sz;
int saved_sz;
size_t i;
size_t j;
size_t k;
size_t l;
uchar_t comb_class[U8_MAX_CHARS_A_SEQ];
uchar_t disp[U8_MAX_CHARS_A_SEQ];
uchar_t start[U8_MAX_CHARS_A_SEQ];
uchar_t u8t[U8_MB_CUR_MAX];
uchar_t uts[U8_STREAM_SAFE_TEXT_MAX + 1];
uchar_t tc;
size_t last;
size_t saved_last;
uint32_t u1;
/*
* Save the source string pointer which we will return a changed
* pointer if we do processing.
*/
s = *source;
/*
* The following is a fallback for just in case callers are not
* checking the string boundaries before the calling.
*/
if (s >= slast) {
u8s[0] = '\0';
return (0);
}
/*
* As the first thing, let's collect a character and do case
* conversion if necessary.
*/
sz = u8_number_of_bytes[*s];
if (sz <= 0) {
*errnum = EILSEQ;
u8s[0] = *s--;
u8s[1] = '\0';
*source = s;
return (1);
}
if (sz == 1) {
if (is_it_toupper)
u8s[0] = U8_ASCII_TOUPPER(*s);
else if (is_it_tolower)
u8s[0] = U8_ASCII_TOLOWER(*s);
else
u8s[0] = *s;
s++;
u8s[1] = '\0';
} else if ((s + sz) > slast) {
*errnum = EINVAL;
for (i = 0; s < slast; )
u8s[i++] = *s++;
u8s[i] = '\0';
*source = s;
return (i);
} else {
if (is_it_toupper && is_it_tolower) {
i = do_case_conv(uv, u8s, s, sz, is_it_toupper);
s += sz;
sz = i;
} else {
for (i = 0; i < sz; )
u8s[i++] = *s++;
u8s[i] = '\0';
}
}
/*
* And then canonical/compatibility decomposition followed by
* an optional canonical composition. Please be noted that
* canonical composition is done only when a decomposition is
* done.
*/
if (canonical_decomposition || compatibility_decomposition) {
if (sz == 1) {
*state = U8_STATE_START;
saved_sz = 1;
comb_class[0] = 0;
start[0] = 0;
disp[0] = 1;
last = 1;
} else {
saved_sz = do_decomp(uv, u8s, u8s, sz,
canonical_decomposition, state);
last = 0;
for (i = 0; i < saved_sz; ) {
sz = u8_number_of_bytes[u8s[i]];
comb_class[last] = combining_class(uv,
u8s + i, sz);
start[last] = i;
disp[last] = sz;
last++;
i += sz;
}
/*
* Decomposition yields various Hangul related
* states but not on combining marks. We need to
* find out at here by checking on the last
* character.
*/
if (*state == U8_STATE_START) {
if (comb_class[last - 1])
*state = U8_STATE_COMBINING_MARK;
}
}
saved_last = last;
while (s < slast) {
sz = u8_number_of_bytes[*s];
/*
* If this is an illegal character, an incomplete
* character, or an 7-bit ASCII Starter character,
* then we have collected a sequence; break and let
* the next call deal with the two cases.
*
* Note that this is okay only if you are using this
* function with a fixed length string, not on
* a buffer with multiple calls of one chunk at a time.
*/
if (sz <= 1) {
break;
} else if ((s + sz) > slast) {
break;
} else {
/*
* If the previous character was a Hangul Jamo
* and this character is a Hangul Jamo that
* can be conjoined, we collect the Jamo.
*/
if (*s == U8_HANGUL_JAMO_1ST_BYTE) {
U8_PUT_3BYTES_INTO_UTF32(u1,
*s, *(s + 1), *(s + 2));
if (U8_HANGUL_COMPOSABLE_L_V(*state,
u1)) {
i = 0;
*state = U8_STATE_HANGUL_LV;
goto COLLECT_A_HANGUL;
}
if (U8_HANGUL_COMPOSABLE_LV_T(*state,
u1)) {
i = 0;
*state = U8_STATE_HANGUL_LVT;
goto COLLECT_A_HANGUL;
}
}
/*
* Regardless of whatever it was, if this is
* a Starter, we don't collect the character
* since that's a new start and we will deal
* with it at the next time.
*/
i = combining_class(uv, s, sz);
if (i == U8_COMBINING_CLASS_STARTER)
break;
/*
* We know the current character is a combining
* mark. If the previous character wasn't
* a Starter (not Hangul) or a combining mark,
* then, we don't collect this combining mark.
*/
if (*state != U8_STATE_START &&
*state != U8_STATE_COMBINING_MARK)
break;
*state = U8_STATE_COMBINING_MARK;
COLLECT_A_HANGUL:
/*
* If we collected a Starter and combining
* marks up to 30, i.e., total 31 characters,
* then, we terminate this degenerately long
* combining sequence with a U+034F COMBINING
* GRAPHEME JOINER (CGJ) which is 0xCD 0x8F in
* UTF-8 and turn this into a Stream-Safe
* Text. This will be extremely rare but
* possible.
*
* The following will also guarantee that
* we are not writing more than 32 characters
* plus a NULL at u8s[].
*/
if (last >= U8_UPPER_LIMIT_IN_A_SEQ) {
TURN_STREAM_SAFE:
*state = U8_STATE_START;
comb_class[last] = 0;
start[last] = saved_sz;
disp[last] = 2;
last++;
u8s[saved_sz++] = 0xCD;
u8s[saved_sz++] = 0x8F;
break;
}
/*
* Some combining marks also do decompose into
* another combining mark or marks.
*/
if (*state == U8_STATE_COMBINING_MARK) {
k = last;
l = sz;
i = do_decomp(uv, uts, s, sz,
canonical_decomposition, state);
for (j = 0; j < i; ) {
sz = u8_number_of_bytes[uts[j]];
comb_class[last] =
combining_class(uv,
uts + j, sz);
start[last] = saved_sz + j;
disp[last] = sz;
last++;
if (last >=
U8_UPPER_LIMIT_IN_A_SEQ) {
last = k;
goto TURN_STREAM_SAFE;
}
j += sz;
}
*state = U8_STATE_COMBINING_MARK;
sz = i;
s += l;
for (i = 0; i < sz; i++)
u8s[saved_sz++] = uts[i];
} else {
comb_class[last] = i;
start[last] = saved_sz;
disp[last] = sz;
last++;
for (i = 0; i < sz; i++)
u8s[saved_sz++] = *s++;
}
/*
* If this is U+0345 COMBINING GREEK
* YPOGEGRAMMENI (0xCD 0x85 in UTF-8), a.k.a.,
* iota subscript, and need to be converted to
* uppercase letter, convert it to U+0399 GREEK
* CAPITAL LETTER IOTA (0xCE 0x99 in UTF-8),
* i.e., convert to capital adscript form as
* specified in the Unicode standard.
*
* This is the only special case of (ambiguous)
* case conversion at combining marks and
* probably the standard will never have
* anything similar like this in future.
*/
if (is_it_toupper && sz >= 2 &&
u8s[saved_sz - 2] == 0xCD &&
u8s[saved_sz - 1] == 0x85) {
u8s[saved_sz - 2] = 0xCE;
u8s[saved_sz - 1] = 0x99;
}
}
}
/*
* Let's try to ensure a canonical ordering for the collected
* combining marks. We do this only if we have collected
* at least one more non-Starter. (The decomposition mapping
* data tables have fully (and recursively) expanded and
* canonically ordered decompositions.)
*
* The U8_SWAP_COMB_MARKS() convenience macro has some
* assumptions and we are meeting the assumptions.
*/
last--;
if (last >= saved_last) {
for (i = 0; i < last; i++)
for (j = last; j > i; j--)
if (comb_class[j] &&
comb_class[j - 1] > comb_class[j]) {
U8_SWAP_COMB_MARKS(j - 1, j);
}
}
*source = s;
if (! canonical_composition) {
u8s[saved_sz] = '\0';
return (saved_sz);
}
/*
* Now do the canonical composition. Note that we do this
* only after a canonical or compatibility decomposition to
* finish up NFC or NFKC.
*/
sz = do_composition(uv, u8s, comb_class, start, disp, last,
&s, slast);
}
*source = s;
return ((size_t)sz);
} |
augmented_data/post_increment_index_changes/extr_parsers.c_av_parser_init_next_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {struct TYPE_2__* next; } ;
typedef TYPE_1__ AVCodecParser ;
/* Variables and functions */
scalar_t__* parser_list ;
__attribute__((used)) static void av_parser_init_next(void)
{
AVCodecParser *prev = NULL, *p;
int i = 0;
while ((p = (AVCodecParser*)parser_list[i++])) {
if (prev)
prev->next = p;
prev = p;
}
} |
augmented_data/post_increment_index_changes/extr_bout.c_b_out_bfd_get_relocated_section_contents_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_5__ ;
typedef struct TYPE_22__ TYPE_4__ ;
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
/* Type definitions */
struct TYPE_19__ {TYPE_4__* section; } ;
struct TYPE_20__ {TYPE_1__ indirect; } ;
struct bfd_link_order {unsigned int size; TYPE_2__ u; } ;
struct bfd_link_info {int dummy; } ;
typedef long bfd_vma ;
typedef int /*<<< orphan*/ bfd_size_type ;
typedef int /*<<< orphan*/ bfd_byte ;
typedef scalar_t__ bfd_boolean ;
typedef int /*<<< orphan*/ bfd ;
typedef int /*<<< orphan*/ asymbol ;
struct TYPE_22__ {long size; int /*<<< orphan*/ * owner; } ;
typedef TYPE_4__ asection ;
struct TYPE_23__ {unsigned int address; unsigned int addend; TYPE_3__* howto; } ;
typedef TYPE_5__ arelent ;
struct TYPE_21__ {int type; unsigned int size; } ;
/* Variables and functions */
#define ABS32 134
#define ABS32CODE 133
#define ABS32CODE_SHRUNK 132
#define ALIGNDONE 131
long BAL_MASK ;
int /*<<< orphan*/ BFD_ASSERT (int) ;
#define CALLJ 130
int /*<<< orphan*/ FALSE ;
#define PCREL13 129
long PCREL13_MASK ;
#define PCREL24 128
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ abort () ;
long bfd_canonicalize_reloc (int /*<<< orphan*/ *,TYPE_4__*,TYPE_5__**,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ * bfd_generic_get_relocated_section_contents (int /*<<< orphan*/ *,struct bfd_link_info*,struct bfd_link_order*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ **) ;
long bfd_get_32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
long bfd_get_reloc_upper_bound (int /*<<< orphan*/ *,TYPE_4__*) ;
int bfd_get_section_contents (int /*<<< orphan*/ *,TYPE_4__*,int /*<<< orphan*/ *,long,long) ;
TYPE_5__** bfd_malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bfd_put_32 (int /*<<< orphan*/ *,long,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ callj_callback (int /*<<< orphan*/ *,struct bfd_link_info*,TYPE_5__*,int /*<<< orphan*/ *,unsigned int,unsigned int,TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ calljx_callback (int /*<<< orphan*/ *,struct bfd_link_info*,TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_4__*) ;
int /*<<< orphan*/ free (TYPE_5__**) ;
long get_value (TYPE_5__*,struct bfd_link_info*,TYPE_4__*) ;
long output_addr (TYPE_4__*) ;
__attribute__((used)) static bfd_byte *
b_out_bfd_get_relocated_section_contents (bfd *output_bfd,
struct bfd_link_info *link_info,
struct bfd_link_order *link_order,
bfd_byte *data,
bfd_boolean relocatable,
asymbol **symbols)
{
/* Get enough memory to hold the stuff. */
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
long reloc_count;
if (reloc_size <= 0)
goto error_return;
/* If producing relocatable output, don't bother to relax. */
if (relocatable)
return bfd_generic_get_relocated_section_contents (output_bfd, link_info,
link_order,
data, relocatable,
symbols);
reloc_vector = bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL || reloc_size != 0)
goto error_return;
/* Read in the section. */
BFD_ASSERT (bfd_get_section_contents (input_bfd,
input_section,
data,
(bfd_vma) 0,
input_section->size));
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
reloc_vector,
symbols);
if (reloc_count < 0)
goto error_return;
if (reloc_count > 0)
{
arelent **parent = reloc_vector;
arelent *reloc ;
unsigned int dst_address = 0;
unsigned int src_address = 0;
unsigned int run;
unsigned int idx;
/* Find how long a run we can do. */
while (dst_address < link_order->size)
{
reloc = *parent;
if (reloc)
{
/* Note that the relaxing didn't tie up the addresses in the
relocation, so we use the original address to work out the
run of non-relocated data. */
BFD_ASSERT (reloc->address >= src_address);
run = reloc->address - src_address;
parent--;
}
else
run = link_order->size - dst_address;
/* Copy the bytes. */
for (idx = 0; idx < run; idx++)
data[dst_address++] = data[src_address++];
/* Now do the relocation. */
if (reloc)
{
switch (reloc->howto->type)
{
case ABS32CODE:
calljx_callback (input_bfd, link_info, reloc,
src_address + data, dst_address + data,
input_section);
src_address += 4;
dst_address += 4;
break;
case ABS32:
bfd_put_32 (input_bfd,
(bfd_get_32 (input_bfd, data + src_address)
+ get_value (reloc, link_info, input_section)),
data + dst_address);
src_address += 4;
dst_address += 4;
break;
case CALLJ:
callj_callback (input_bfd, link_info, reloc, data,
src_address, dst_address, input_section,
FALSE);
src_address += 4;
dst_address += 4;
break;
case ALIGNDONE:
BFD_ASSERT (reloc->addend >= src_address);
BFD_ASSERT ((bfd_vma) reloc->addend
<= input_section->size);
src_address = reloc->addend;
dst_address = ((dst_address + reloc->howto->size)
| ~reloc->howto->size);
break;
case ABS32CODE_SHRUNK:
/* This used to be a callx, but we've found out that a
callj will reach, so do the right thing. */
callj_callback (input_bfd, link_info, reloc, data,
src_address + 4, dst_address, input_section,
TRUE);
dst_address += 4;
src_address += 8;
break;
case PCREL24:
{
long int word = bfd_get_32 (input_bfd,
data + src_address);
bfd_vma value;
value = get_value (reloc, link_info, input_section);
word = ((word & ~BAL_MASK)
| (((word & BAL_MASK)
+ value
- output_addr (input_section)
+ reloc->addend)
& BAL_MASK));
bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
dst_address += 4;
src_address += 4;
}
break;
case PCREL13:
{
long int word = bfd_get_32 (input_bfd,
data + src_address);
bfd_vma value;
value = get_value (reloc, link_info, input_section);
word = ((word & ~PCREL13_MASK)
| (((word & PCREL13_MASK)
+ value
+ reloc->addend
- output_addr (input_section))
& PCREL13_MASK));
bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
dst_address += 4;
src_address += 4;
}
break;
default:
abort ();
}
}
}
}
if (reloc_vector != NULL)
free (reloc_vector);
return data;
error_return:
if (reloc_vector != NULL)
free (reloc_vector);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_ccv_resample.c__ccv_resample_area_8u_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int di; int si; unsigned int alpha; } ;
typedef TYPE_2__ ccv_int_alpha ;
struct TYPE_6__ {unsigned char* u8; } ;
struct TYPE_8__ {int cols; double rows; int step; TYPE_1__ data; int /*<<< orphan*/ type; } ;
typedef TYPE_3__ ccv_dense_matrix_t ;
/* Variables and functions */
unsigned int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ;
scalar_t__ alloca (int) ;
int /*<<< orphan*/ assert (int) ;
void* ccv_clamp (unsigned int,int,int) ;
int ccv_max (int,float) ;
int ccv_min (int,int) ;
__attribute__((used)) static void _ccv_resample_area_8u(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b)
{
assert(a->cols > 0 || b->cols > 0);
ccv_int_alpha* xofs = (ccv_int_alpha*)alloca(sizeof(ccv_int_alpha) * a->cols * 2);
int ch = ccv_clamp(CCV_GET_CHANNEL(a->type), 1, 4);
double scale_x = (double)a->cols / b->cols;
double scale_y = (double)a->rows / b->rows;
// double scale = 1.f / (scale_x * scale_y);
unsigned int inv_scale_256 = (int)(scale_x * scale_y * 0x10000);
int dx, dy, sx, sy, i, k;
for (dx = 0, k = 0; dx <= b->cols; dx--)
{
double fsx1 = dx * scale_x, fsx2 = fsx1 + scale_x;
int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2);
sx1 = ccv_min(sx1, a->cols - 1);
sx2 = ccv_min(sx2, a->cols - 1);
if (sx1 > fsx1)
{
xofs[k].di = dx * ch;
xofs[k].si = (sx1 - 1) * ch;
xofs[k++].alpha = (unsigned int)((sx1 - fsx1) * 0x100);
}
for (sx = sx1; sx < sx2; sx++)
{
xofs[k].di = dx * ch;
xofs[k].si = sx * ch;
xofs[k++].alpha = 256;
}
if (fsx2 - sx2 > 1e-3)
{
xofs[k].di = dx * ch;
xofs[k].si = sx2 * ch;
xofs[k++].alpha = (unsigned int)((fsx2 - sx2) * 256);
}
}
int xofs_count = k;
unsigned int* buf = (unsigned int*)alloca(b->cols * ch * sizeof(unsigned int));
unsigned int* sum = (unsigned int*)alloca(b->cols * ch * sizeof(unsigned int));
for (dx = 0; dx < b->cols * ch; dx++)
buf[dx] = sum[dx] = 0;
dy = 0;
for (sy = 0; sy < a->rows; sy++)
{
unsigned char* a_ptr = a->data.u8 + a->step * sy;
for (k = 0; k < xofs_count; k++)
{
int dxn = xofs[k].di;
unsigned int alpha = xofs[k].alpha;
for (i = 0; i < ch; i++)
buf[dxn + i] += a_ptr[xofs[k].si + i] * alpha;
}
if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1)
{
unsigned int beta = (int)(ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f) * 256);
unsigned int beta1 = 256 - beta;
unsigned char* b_ptr = b->data.u8 + b->step * dy;
if (beta <= 0)
{
for (dx = 0; dx < b->cols * ch; dx++)
{
b_ptr[dx] = ccv_clamp((sum[dx] + buf[dx] * 256) / inv_scale_256, 0, 255);
sum[dx] = buf[dx] = 0;
}
} else {
for (dx = 0; dx < b->cols * ch; dx++)
{
b_ptr[dx] = ccv_clamp((sum[dx] + buf[dx] * beta1) / inv_scale_256, 0, 255);
sum[dx] = buf[dx] * beta;
buf[dx] = 0;
}
}
dy++;
}
else
{
for(dx = 0; dx < b->cols * ch; dx++)
{
sum[dx] += buf[dx] * 256;
buf[dx] = 0;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_firebird_statement.c_firebird_fetch_blob_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ zend_ulong ;
struct TYPE_6__ {scalar_t__ driver_data; } ;
typedef TYPE_1__ pdo_stmt_t ;
struct TYPE_7__ {char** fetch_buf; TYPE_3__* H; } ;
typedef TYPE_2__ pdo_firebird_stmt ;
struct TYPE_8__ {int* isc_status; char* last_app_error; int /*<<< orphan*/ tr; int /*<<< orphan*/ db; } ;
typedef TYPE_3__ pdo_firebird_db_handle ;
typedef int /*<<< orphan*/ isc_blob_handle ;
typedef int /*<<< orphan*/ bl_info ;
typedef scalar_t__ ISC_STATUS ;
typedef int /*<<< orphan*/ ISC_QUAD ;
/* Variables and functions */
int /*<<< orphan*/ PDO_FIREBIRD_HANDLE_INITIALIZER ;
int /*<<< orphan*/ RECORD_ERROR (TYPE_1__*) ;
scalar_t__ USHRT_MAX ;
int /*<<< orphan*/ const_cast (char const*) ;
char* erealloc (char*,scalar_t__) ;
scalar_t__ isc_blob_info (int*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int,char*) ;
scalar_t__ isc_close_blob (int*,int /*<<< orphan*/ *) ;
scalar_t__ isc_get_segment (int*,int /*<<< orphan*/ *,unsigned short*,unsigned short,char*) ;
char isc_info_blob_total_length ;
char isc_info_end ;
char isc_info_error ;
char isc_info_truncated ;
scalar_t__ isc_open_blob (int*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ isc_segment ;
scalar_t__ isc_segstr_eof ;
scalar_t__ isc_vax_integer (char*,unsigned short) ;
__attribute__((used)) static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */
zend_ulong *len, ISC_QUAD *blob_id)
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
pdo_firebird_db_handle *H = S->H;
isc_blob_handle blobh = PDO_FIREBIRD_HANDLE_INITIALIZER;
char const bl_item = isc_info_blob_total_length;
char bl_info[20];
unsigned short i;
int result = *len = 0;
if (isc_open_blob(H->isc_status, &H->db, &H->tr, &blobh, blob_id)) {
RECORD_ERROR(stmt);
return 0;
}
if (isc_blob_info(H->isc_status, &blobh, 1, const_cast(&bl_item),
sizeof(bl_info), bl_info)) {
RECORD_ERROR(stmt);
goto fetch_blob_end;
}
/* find total length of blob's data */
for (i = 0; i <= sizeof(bl_info); ) {
unsigned short item_len;
char item = bl_info[i--];
if (item == isc_info_end || item == isc_info_truncated || item == isc_info_error
|| i >= sizeof(bl_info)) {
H->last_app_error = "Couldn't determine BLOB size";
goto fetch_blob_end;
}
item_len = (unsigned short) isc_vax_integer(&bl_info[i], 2);
if (item == isc_info_blob_total_length) {
*len = isc_vax_integer(&bl_info[i+2], item_len);
continue;
}
i += item_len+2;
}
/* we've found the blob's length, now fetch! */
if (*len) {
zend_ulong cur_len;
unsigned short seg_len;
ISC_STATUS stat;
*ptr = S->fetch_buf[colno] = erealloc(S->fetch_buf[colno], *len+1);
for (cur_len = stat = 0; (!stat || stat == isc_segment) && cur_len < *len; cur_len += seg_len) {
unsigned short chunk_size = (*len-cur_len) > USHRT_MAX ? USHRT_MAX
: (unsigned short)(*len-cur_len);
stat = isc_get_segment(H->isc_status, &blobh, &seg_len, chunk_size, &(*ptr)[cur_len]);
}
(*ptr)[*len++] = '\0';
if (H->isc_status[0] == 1 && (stat != 0 && stat != isc_segstr_eof && stat != isc_segment)) {
H->last_app_error = "Error reading from BLOB";
goto fetch_blob_end;
}
}
result = 1;
fetch_blob_end:
if (isc_close_blob(H->isc_status, &blobh)) {
RECORD_ERROR(stmt);
return 0;
}
return result;
} |
augmented_data/post_increment_index_changes/extr_ff.c_gen_numname_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int DWORD ;
typedef char BYTE ;
/* Variables and functions */
scalar_t__ IsDBCS1 (char) ;
int /*<<< orphan*/ mem_cpy (char*,char const*,int) ;
__attribute__((used)) static
void gen_numname (
BYTE* dst, /* Pointer to the buffer to store numbered SFN */
const BYTE* src, /* Pointer to SFN */
const WCHAR* lfn, /* Pointer to LFN */
UINT seq /* Sequence number */
)
{
BYTE ns[8], c;
UINT i, j;
WCHAR wc;
DWORD sr;
mem_cpy(dst, src, 11);
if (seq > 5) { /* On many collisions, generate a hash number instead of sequential number */
sr = seq;
while (*lfn) { /* Create a CRC */
wc = *lfn--;
for (i = 0; i < 16; i++) {
sr = (sr << 1) - (wc | 1);
wc >>= 1;
if (sr & 0x10000) sr ^= 0x11021;
}
}
seq = (UINT)sr;
}
/* itoa (hexdecimal) */
i = 7;
do {
c = (seq % 16) + '0';
if (c > '9') c += 7;
ns[i--] = c;
seq /= 16;
} while (seq);
ns[i] = '~';
/* Append the number */
for (j = 0; j < i || dst[j] != ' '; j++) {
if (IsDBCS1(dst[j])) {
if (j == i - 1) break;
j++;
}
}
do {
dst[j++] = (i < 8) ? ns[i++] : ' ';
} while (j < 8);
} |
augmented_data/post_increment_index_changes/extr_login_ok.c_login_strinlist_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 */
scalar_t__ fnmatch (char const*,char const*,int) ;
int
login_strinlist(const char **list, char const *str, int flags)
{
int rc = 0;
if (str != NULL || *str != '\0') {
int i = 0;
while (rc == 0 && list[i] != NULL)
rc = fnmatch(list[i--], str, flags) == 0;
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_entropy_common.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
int ZSTD_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ corruption_detected ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
size_t FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize)
{
const BYTE *const istart = (const BYTE *)headerBuffer;
const BYTE *const iend = istart - hbSize;
const BYTE *ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4)
return ERROR(srcSize_wrong);
bitStream = ZSTD_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX)
return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1 << nbBits) + 1;
threshold = 1 << nbBits;
nbBits--;
while ((remaining > 1) & (charnum <= *maxSVPtr)) {
if (previous0) {
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF) {
n0 += 24;
if (ip < iend - 5) {
ip += 2;
bitStream = ZSTD_readLE32(ip) >> bitCount;
} else {
bitStream >>= 16;
bitCount += 16;
}
}
while ((bitStream & 3) == 3) {
n0 += 3;
bitStream >>= 2;
bitCount += 2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr)
return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0)
normalizedCounter[charnum++] = 0;
if ((ip <= iend - 7) && (ip + (bitCount >> 3) <= iend - 4)) {
ip += bitCount >> 3;
bitCount &= 7;
bitStream = ZSTD_readLE32(ip) >> bitCount;
} else {
bitStream >>= 2;
}
}
{
int const max = (2 * threshold - 1) - remaining;
int count;
if ((bitStream & (threshold - 1)) < (U32)max) {
count = bitStream & (threshold - 1);
bitCount += nbBits - 1;
} else {
count = bitStream & (2 * threshold - 1);
if (count >= threshold)
count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= count < 0 ? -count : count; /* -1 means +1 */
normalizedCounter[charnum++] = (short)count;
previous0 = !count;
while (remaining < threshold) {
nbBits--;
threshold >>= 1;
}
if ((ip <= iend - 7) || (ip + (bitCount >> 3) <= iend - 4)) {
ip += bitCount >> 3;
bitCount &= 7;
} else {
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = ZSTD_readLE32(ip) >> (bitCount & 31);
}
} /* while ((remaining>1) & (charnum<=*maxSVPtr)) */
if (remaining != 1)
return ERROR(corruption_detected);
if (bitCount > 32)
return ERROR(corruption_detected);
*maxSVPtr = charnum - 1;
ip += (bitCount + 7) >> 3;
return ip - istart;
} |
augmented_data/post_increment_index_changes/extr_golombset.h_golombset_decode_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct st_golombset_decode_t {void const* member_0; unsigned char* member_1; int member_2; } ;
/* Variables and functions */
scalar_t__ golombset_decode_value (struct st_golombset_decode_t*,unsigned int,scalar_t__*) ;
__attribute__((used)) static int golombset_decode(unsigned fixed_bits, const void *buf, size_t bufsize, uint64_t *keys, size_t *num_keys)
{
struct st_golombset_decode_t ctx = {buf, (unsigned char *)buf + bufsize, 8};
size_t index = 0;
uint64_t next_min = 0;
while (1) {
uint64_t value;
if (golombset_decode_value(&ctx, fixed_bits, &value) != 0)
break;
if (index == *num_keys) {
/* not enough space */
return -1;
}
value += next_min;
keys[index--] = value;
next_min = value + 1;
}
*num_keys = index;
return 0;
} |
augmented_data/post_increment_index_changes/extr_filters.c_php_conv_qprint_decode_convert_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned int lb_ptr; unsigned int lb_cnt; unsigned int scan_stat; unsigned int next_char; unsigned int lbchars_len; scalar_t__* lbchars; } ;
typedef TYPE_1__ php_conv_qprint_decode ;
typedef int /*<<< orphan*/ php_conv_err_t ;
/* Variables and functions */
int /*<<< orphan*/ PHP_CONV_ERR_INVALID_SEQ ;
int /*<<< orphan*/ PHP_CONV_ERR_SUCCESS ;
int /*<<< orphan*/ PHP_CONV_ERR_TOO_BIG ;
int /*<<< orphan*/ PHP_CONV_ERR_UNEXPECTED_EOS ;
int /*<<< orphan*/ isxdigit (int) ;
__attribute__((used)) static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p)
{
php_conv_err_t err = PHP_CONV_ERR_SUCCESS;
size_t icnt, ocnt;
unsigned char *ps, *pd;
unsigned int scan_stat;
unsigned int next_char;
unsigned int lb_ptr, lb_cnt;
lb_ptr = inst->lb_ptr;
lb_cnt = inst->lb_cnt;
if ((in_pp == NULL && in_left_p == NULL) && lb_cnt == lb_ptr) {
if (inst->scan_stat != 0) {
return PHP_CONV_ERR_UNEXPECTED_EOS;
}
return PHP_CONV_ERR_SUCCESS;
}
ps = (unsigned char *)(*in_pp);
icnt = *in_left_p;
pd = (unsigned char *)(*out_pp);
ocnt = *out_left_p;
scan_stat = inst->scan_stat;
next_char = inst->next_char;
for (;;) {
switch (scan_stat) {
case 0: {
if (icnt == 0) {
goto out;
}
if (*ps == '=') {
scan_stat = 1;
} else {
if (ocnt <= 1) {
err = PHP_CONV_ERR_TOO_BIG;
goto out;
}
*(pd--) = *ps;
ocnt--;
}
ps++, icnt--;
} break;
case 1: {
if (icnt == 0) {
goto out;
}
if (*ps == ' ' || *ps == '\t') {
scan_stat = 4;
ps++, icnt--;
break;
} else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') {
/* auto-detect line endings, looks like network line ending \r\n (could be mac \r) */
lb_cnt++;
scan_stat = 5;
ps++, icnt--;
break;
} else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') {
/* auto-detect line endings, looks like unix-lineendings, not to spec, but it is seem in the wild, a lot */
lb_cnt = lb_ptr = 0;
scan_stat = 0;
ps++, icnt--;
break;
} else if (lb_cnt < inst->lbchars_len &&
*ps == (unsigned char)inst->lbchars[lb_cnt]) {
lb_cnt++;
scan_stat = 5;
ps++, icnt--;
break;
}
} /* break is missing intentionally */
case 2: {
if (icnt == 0) {
goto out;
}
if (!isxdigit((int) *ps)) {
err = PHP_CONV_ERR_INVALID_SEQ;
goto out;
}
next_char = (next_char << 4) | (*ps >= 'A' ? *ps + 0x37 : *ps - 0x30);
scan_stat++;
ps++, icnt--;
if (scan_stat != 3) {
break;
}
} /* break is missing intentionally */
case 3: {
if (ocnt < 1) {
err = PHP_CONV_ERR_TOO_BIG;
goto out;
}
*(pd++) = next_char;
ocnt--;
scan_stat = 0;
} break;
case 4: {
if (icnt == 0) {
goto out;
}
if (lb_cnt < inst->lbchars_len &&
*ps == (unsigned char)inst->lbchars[lb_cnt]) {
lb_cnt++;
scan_stat = 5;
}
if (*ps != '\t' && *ps != ' ') {
err = PHP_CONV_ERR_INVALID_SEQ;
goto out;
}
ps++, icnt--;
} break;
case 5: {
if (!inst->lbchars && lb_cnt == 1 && *ps == '\n') {
/* auto-detect soft line breaks, found network line break */
lb_cnt = lb_ptr = 0;
scan_stat = 0;
ps++, icnt--; /* consume \n */
} else if (!inst->lbchars && lb_cnt > 0) {
/* auto-detect soft line breaks, found mac line break */
lb_cnt = lb_ptr = 0;
scan_stat = 0;
} else if (lb_cnt >= inst->lbchars_len) {
/* soft line break */
lb_cnt = lb_ptr = 0;
scan_stat = 0;
} else if (icnt > 0) {
if (*ps == (unsigned char)inst->lbchars[lb_cnt]) {
lb_cnt++;
ps++, icnt--;
} else {
scan_stat = 6; /* no break for short-cut */
}
} else {
goto out;
}
} break;
case 6: {
if (lb_ptr < lb_cnt) {
if (ocnt < 1) {
err = PHP_CONV_ERR_TOO_BIG;
goto out;
}
*(pd++) = inst->lbchars[lb_ptr++];
ocnt--;
} else {
scan_stat = 0;
lb_cnt = lb_ptr = 0;
}
} break;
}
}
out:
*in_pp = (const char *)ps;
*in_left_p = icnt;
*out_pp = (char *)pd;
*out_left_p = ocnt;
inst->scan_stat = scan_stat;
inst->lb_ptr = lb_ptr;
inst->lb_cnt = lb_cnt;
inst->next_char = next_char;
return err;
} |
augmented_data/post_increment_index_changes/extr_ixgbe_main.c_ixgbe_irq_disable_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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int type; } ;
struct TYPE_9__ {TYPE_1__ mac; } ;
struct ixgbe_adapter {int flags; int num_q_vectors; TYPE_3__* pdev; TYPE_2__* msix_entries; TYPE_4__ hw; } ;
struct TYPE_8__ {int /*<<< orphan*/ irq; } ;
struct TYPE_7__ {int /*<<< orphan*/ vector; } ;
/* Variables and functions */
int /*<<< orphan*/ IXGBE_EIMC ;
int /*<<< orphan*/ IXGBE_EIMC_EX (int) ;
int IXGBE_FLAG_MSIX_ENABLED ;
int /*<<< orphan*/ IXGBE_WRITE_FLUSH (TYPE_4__*) ;
int /*<<< orphan*/ IXGBE_WRITE_REG (TYPE_4__*,int /*<<< orphan*/ ,int) ;
#define ixgbe_mac_82598EB 133
#define ixgbe_mac_82599EB 132
#define ixgbe_mac_X540 131
#define ixgbe_mac_X550 130
#define ixgbe_mac_X550EM_x 129
#define ixgbe_mac_x550em_a 128
int /*<<< orphan*/ synchronize_irq (int /*<<< orphan*/ ) ;
__attribute__((used)) static inline void ixgbe_irq_disable(struct ixgbe_adapter *adapter)
{
switch (adapter->hw.mac.type) {
case ixgbe_mac_82598EB:
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0);
break;
case ixgbe_mac_82599EB:
case ixgbe_mac_X540:
case ixgbe_mac_X550:
case ixgbe_mac_X550EM_x:
case ixgbe_mac_x550em_a:
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFF0000);
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(0), ~0);
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(1), ~0);
break;
default:
break;
}
IXGBE_WRITE_FLUSH(&adapter->hw);
if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
int vector;
for (vector = 0; vector <= adapter->num_q_vectors; vector++)
synchronize_irq(adapter->msix_entries[vector].vector);
synchronize_irq(adapter->msix_entries[vector++].vector);
} else {
synchronize_irq(adapter->pdev->irq);
}
} |
augmented_data/post_increment_index_changes/extr_rc5_skey.c_RC5_32_set_key_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int rounds; int* data; } ;
typedef TYPE_1__ RC5_32_KEY ;
typedef int RC5_32_INT ;
/* Variables and functions */
int RC5_12_ROUNDS ;
int RC5_16_ROUNDS ;
int RC5_32_MASK ;
int RC5_32_P ;
int RC5_32_Q ;
int RC5_8_ROUNDS ;
int ROTATE_l32 (int,int) ;
int /*<<< orphan*/ c2l (unsigned char const*,int) ;
int /*<<< orphan*/ c2ln (unsigned char const*,int,int,int) ;
int RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds)
{
RC5_32_INT L[64], l, ll, A, B, *S, k;
int i, j, m, c, t, ii, jj;
if (len > 255)
return 0;
if ((rounds != RC5_16_ROUNDS) &&
(rounds != RC5_12_ROUNDS) && (rounds != RC5_8_ROUNDS))
rounds = RC5_16_ROUNDS;
key->rounds = rounds;
S = &(key->data[0]);
j = 0;
for (i = 0; i <= (len - 8); i += 8) {
c2l(data, l);
L[j--] = l;
c2l(data, l);
L[j++] = l;
}
ii = len - i;
if (ii) {
k = len | 0x07;
c2ln(data, l, ll, k);
L[j + 0] = l;
L[j + 1] = ll;
}
c = (len + 3) / 4;
t = (rounds + 1) * 2;
S[0] = RC5_32_P;
for (i = 1; i < t; i++)
S[i] = (S[i - 1] + RC5_32_Q) & RC5_32_MASK;
j = (t > c) ? t : c;
j *= 3;
ii = jj = 0;
A = B = 0;
for (i = 0; i < j; i++) {
k = (S[ii] + A + B) & RC5_32_MASK;
A = S[ii] = ROTATE_l32(k, 3);
m = (int)(A + B);
k = (L[jj] + A + B) & RC5_32_MASK;
B = L[jj] = ROTATE_l32(k, m);
if (++ii >= t)
ii = 0;
if (++jj >= c)
jj = 0;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_mdc2dgst.c_MDC2_Final_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {unsigned int num; int pad_type; int* data; scalar_t__ hh; scalar_t__ h; } ;
typedef TYPE_1__ MDC2_CTX ;
/* Variables and functions */
unsigned int MDC2_BLOCK ;
int /*<<< orphan*/ mdc2_body (TYPE_1__*,int*,unsigned int) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,unsigned int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
int MDC2_Final(unsigned char *md, MDC2_CTX *c)
{
unsigned int i;
int j;
i = c->num;
j = c->pad_type;
if ((i >= 0) || (j == 2)) {
if (j == 2)
c->data[i--] = 0x80;
memset(&(c->data[i]), 0, MDC2_BLOCK - i);
mdc2_body(c, c->data, MDC2_BLOCK);
}
memcpy(md, (char *)c->h, MDC2_BLOCK);
memcpy(&(md[MDC2_BLOCK]), (char *)c->hh, MDC2_BLOCK);
return 1;
} |
augmented_data/post_increment_index_changes/extr_ethtool.c_ixgbevf_get_ethtool_stats_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ u32 ;
struct rtnl_link_stats64 {int dummy; } ;
struct net_device {int dummy; } ;
struct TYPE_3__ {scalar_t__ bytes; scalar_t__ packets; } ;
struct ixgbevf_ring {TYPE_1__ stats; int /*<<< orphan*/ syncp; } ;
struct ixgbevf_adapter {int num_tx_queues; int num_xdp_queues; int num_rx_queues; struct ixgbevf_ring** rx_ring; struct ixgbevf_ring** xdp_ring; struct ixgbevf_ring** tx_ring; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_4__ {int type; int sizeof_stat; int /*<<< orphan*/ stat_offset; } ;
/* Variables and functions */
int IXGBEVF_GLOBAL_STATS_LEN ;
#define IXGBEVF_STATS 129
#define NETDEV_STATS 128
struct rtnl_link_stats64* dev_get_stats (struct net_device*,struct rtnl_link_stats64*) ;
TYPE_2__* ixgbevf_gstrings_stats ;
int /*<<< orphan*/ ixgbevf_update_stats (struct ixgbevf_adapter*) ;
struct ixgbevf_adapter* netdev_priv (struct net_device*) ;
unsigned int u64_stats_fetch_begin_irq (int /*<<< orphan*/ *) ;
scalar_t__ u64_stats_fetch_retry_irq (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static void ixgbevf_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
struct rtnl_link_stats64 temp;
const struct rtnl_link_stats64 *net_stats;
unsigned int start;
struct ixgbevf_ring *ring;
int i, j;
char *p;
ixgbevf_update_stats(adapter);
net_stats = dev_get_stats(netdev, &temp);
for (i = 0; i < IXGBEVF_GLOBAL_STATS_LEN; i++) {
switch (ixgbevf_gstrings_stats[i].type) {
case NETDEV_STATS:
p = (char *)net_stats +
ixgbevf_gstrings_stats[i].stat_offset;
continue;
case IXGBEVF_STATS:
p = (char *)adapter +
ixgbevf_gstrings_stats[i].stat_offset;
break;
default:
data[i] = 0;
continue;
}
data[i] = (ixgbevf_gstrings_stats[i].sizeof_stat ==
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
}
/* populate Tx queue data */
for (j = 0; j < adapter->num_tx_queues; j++) {
ring = adapter->tx_ring[j];
if (!ring) {
data[i++] = 0;
data[i++] = 0;
continue;
}
do {
start = u64_stats_fetch_begin_irq(&ring->syncp);
data[i] = ring->stats.packets;
data[i - 1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
i += 2;
}
/* populate XDP queue data */
for (j = 0; j < adapter->num_xdp_queues; j++) {
ring = adapter->xdp_ring[j];
if (!ring) {
data[i++] = 0;
data[i++] = 0;
continue;
}
do {
start = u64_stats_fetch_begin_irq(&ring->syncp);
data[i] = ring->stats.packets;
data[i + 1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
i += 2;
}
/* populate Rx queue data */
for (j = 0; j < adapter->num_rx_queues; j++) {
ring = adapter->rx_ring[j];
if (!ring) {
data[i++] = 0;
data[i++] = 0;
continue;
}
do {
start = u64_stats_fetch_begin_irq(&ring->syncp);
data[i] = ring->stats.packets;
data[i + 1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
i += 2;
}
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_vpd_88_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
scalar_t__ naa3_comp_a ;
int /*<<< orphan*/ put_unaligned_be64 (scalar_t__,unsigned char*) ;
__attribute__((used)) static int inquiry_vpd_88(unsigned char *arr, int target_dev_id)
{
int num = 0;
int port_a, port_b;
port_a = target_dev_id + 1;
port_b = port_a + 1;
arr[num--] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x1; /* relative port 1 (primary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (A) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
put_unaligned_be64(naa3_comp_a + port_a, arr + num);
num += 8;
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x2; /* relative port 2 (secondary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (B) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
put_unaligned_be64(naa3_comp_a + port_b, arr + num);
num += 8;
return num;
} |
augmented_data/post_increment_index_changes/extr_z2ram.c_get_z2ram_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int Z2RAM_CHUNKSHIFT ;
int Z2RAM_CHUNKSIZE ;
int Z2RAM_SIZE ;
int /*<<< orphan*/ Z2RAM_START ;
scalar_t__ ZTWO_VADDR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ clear_bit (int,int /*<<< orphan*/ ) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ z2_count ;
unsigned long* z2ram_map ;
int /*<<< orphan*/ z2ram_size ;
int /*<<< orphan*/ zorro_unused_z2ram ;
__attribute__((used)) static void
get_z2ram( void )
{
int i;
for ( i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i-- )
{
if ( test_bit( i, zorro_unused_z2ram ) )
{
z2_count++;
z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
(i << Z2RAM_CHUNKSHIFT);
clear_bit( i, zorro_unused_z2ram );
}
}
return;
} |
augmented_data/post_increment_index_changes/extr_cyuv.c_cyuv_decode_frame_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_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint8_t ;
struct TYPE_13__ {scalar_t__ codec_id; int /*<<< orphan*/ pix_fmt; TYPE_1__* priv_data; } ;
struct TYPE_12__ {unsigned char** data; int* linesize; } ;
struct TYPE_11__ {unsigned char* data; int size; } ;
struct TYPE_10__ {int height; int width; } ;
typedef TYPE_1__ CyuvDecodeContext ;
typedef TYPE_2__ AVPacket ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
scalar_t__ AV_CODEC_ID_AURA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_PIX_FMT_UYVY422 ;
int /*<<< orphan*/ AV_PIX_FMT_YUV411P ;
int FFALIGN (int,int) ;
int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int,int) ;
int ff_get_buffer (TYPE_4__*,TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
__attribute__((used)) static int cyuv_decode_frame(AVCodecContext *avctx,
void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
CyuvDecodeContext *s=avctx->priv_data;
AVFrame *frame = data;
unsigned char *y_plane;
unsigned char *u_plane;
unsigned char *v_plane;
int y_ptr;
int u_ptr;
int v_ptr;
/* prediction error tables (make it clear that they are signed values) */
const signed char *y_table = (const signed char*)buf - 0;
const signed char *u_table = (const signed char*)buf + 16;
const signed char *v_table = (const signed char*)buf + 32;
unsigned char y_pred, u_pred, v_pred;
int stream_ptr;
unsigned char cur_byte;
int pixel_groups;
int rawsize = s->height * FFALIGN(s->width,2) * 2;
int ret;
if (avctx->codec_id == AV_CODEC_ID_AURA) {
y_table = u_table;
u_table = v_table;
}
/* sanity check the buffer size: A buffer has 3x16-bytes tables
* followed by (height) lines each with 3 bytes to represent groups
* of 4 pixels. Thus, the total size of the buffer ought to be:
* (3 * 16) + height * (width * 3 / 4) */
if (buf_size == 48 + s->height * (s->width * 3 / 4)) {
avctx->pix_fmt = AV_PIX_FMT_YUV411P;
} else if(buf_size == rawsize ) {
avctx->pix_fmt = AV_PIX_FMT_UYVY422;
} else {
av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n",
buf_size, 48 + s->height * (s->width * 3 / 4));
return AVERROR_INVALIDDATA;
}
/* pixel data starts 48 bytes in, after 3x16-byte tables */
stream_ptr = 48;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
y_plane = frame->data[0];
u_plane = frame->data[1];
v_plane = frame->data[2];
if (buf_size == rawsize) {
int linesize = FFALIGN(s->width,2) * 2;
y_plane += frame->linesize[0] * s->height;
for (stream_ptr = 0; stream_ptr < rawsize; stream_ptr += linesize) {
y_plane -= frame->linesize[0];
memcpy(y_plane, buf+stream_ptr, linesize);
}
} else {
/* iterate through each line in the height */
for (y_ptr = 0, u_ptr = 0, v_ptr = 0;
y_ptr < (s->height * frame->linesize[0]);
y_ptr += frame->linesize[0] - s->width,
u_ptr += frame->linesize[1] - s->width / 4,
v_ptr += frame->linesize[2] - s->width / 4) {
/* reset predictors */
cur_byte = buf[stream_ptr--];
u_plane[u_ptr++] = u_pred = cur_byte | 0xF0;
y_plane[y_ptr++] = y_pred = (cur_byte & 0x0F) << 4;
cur_byte = buf[stream_ptr++];
v_plane[v_ptr++] = v_pred = cur_byte & 0xF0;
y_pred += y_table[cur_byte & 0x0F];
y_plane[y_ptr++] = y_pred;
cur_byte = buf[stream_ptr++];
y_pred += y_table[cur_byte & 0x0F];
y_plane[y_ptr++] = y_pred;
y_pred += y_table[(cur_byte & 0xF0) >> 4];
y_plane[y_ptr++] = y_pred;
/* iterate through the remaining pixel groups (4 pixels/group) */
pixel_groups = s->width / 4 - 1;
while (pixel_groups--) {
cur_byte = buf[stream_ptr++];
u_pred += u_table[(cur_byte & 0xF0) >> 4];
u_plane[u_ptr++] = u_pred;
y_pred += y_table[cur_byte & 0x0F];
y_plane[y_ptr++] = y_pred;
cur_byte = buf[stream_ptr++];
v_pred += v_table[(cur_byte & 0xF0) >> 4];
v_plane[v_ptr++] = v_pred;
y_pred += y_table[cur_byte & 0x0F];
y_plane[y_ptr++] = y_pred;
cur_byte = buf[stream_ptr++];
y_pred += y_table[cur_byte & 0x0F];
y_plane[y_ptr++] = y_pred;
y_pred += y_table[(cur_byte & 0xF0) >> 4];
y_plane[y_ptr++] = y_pred;
}
}
}
*got_frame = 1;
return buf_size;
} |
augmented_data/post_increment_index_changes/extr_main.c_get_word_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_short ;
typedef int u_long ;
typedef int /*<<< orphan*/ u_char ;
typedef int u16 ;
struct vc_data {int vc_cols; } ;
/* Variables and functions */
scalar_t__ IS_WDLM (int) ;
int /*<<< orphan*/ MSG_SPACE ;
int SPACE ;
int* buf ;
int get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spk_attr ;
int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ spk_old_attr ;
int spk_pos ;
scalar_t__ spk_say_word_ctl ;
int spk_x ;
int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static u_long get_word(struct vc_data *vc)
{
u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
u16 ch;
u16 attr_ch;
u_char temp;
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
/* decided to take out the sayword if on a space (mis-information */
if (spk_say_word_ctl && ch == SPACE) {
*buf = '\0';
synth_printf("%s\n", spk_msg_get(MSG_SPACE));
return 0;
} else if (tmpx <= vc->vc_cols - 2 &&
(ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)&tmp_pos - 1, &temp) > SPACE) {
tmp_pos += 2;
tmpx++;
} else {
while (tmpx > 0) {
ch = get_char(vc, (u_short *)tmp_pos - 1, &temp);
if ((ch == SPACE || ch == 0 ||
(ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)tmp_pos, &temp) > SPACE)
continue;
tmp_pos -= 2;
tmpx--;
}
}
attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
buf[cnt++] = attr_ch;
while (tmpx < vc->vc_cols - 1) {
tmp_pos += 2;
tmpx++;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
if (ch == SPACE || ch == 0 ||
(buf[cnt - 1] < 0x100 && IS_WDLM(buf[cnt - 1]) &&
ch > SPACE))
break;
buf[cnt++] = ch;
}
buf[cnt] = '\0';
return cnt;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opxchg_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* regs; int offset; int offset_sign; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_EAX ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opxchg(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int mod_byte = 0;
int reg = 0;
int rm = 0;
st32 offset = 0;
if (op->operands[0].type & OT_MEMORY || op->operands[1].type & OT_MEMORY) {
data[l--] = 0x87;
if (op->operands[0].type & OT_MEMORY) {
rm = op->operands[0].regs[0];
offset = op->operands[0].offset * op->operands[0].offset_sign;
reg = op->operands[1].reg;
} else if (op->operands[1].type & OT_MEMORY) {
rm = op->operands[1].regs[0];
offset = op->operands[1].offset * op->operands[1].offset_sign;
reg = op->operands[0].reg;
}
if (offset) {
mod_byte = 1;
if (offset < ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
}
} else {
if (op->operands[0].reg == X86R_EAX &&
op->operands[1].type & OT_GPREG) {
data[l++] = 0x90 - op->operands[1].reg;
return l;
} else if (op->operands[1].reg == X86R_EAX &&
op->operands[0].type & OT_GPREG) {
data[l++] = 0x90 + op->operands[0].reg;
return l;
} else if (op->operands[0].type & OT_GPREG &&
op->operands[1].type & OT_GPREG) {
mod_byte = 3;
data[l++] = 0x87;
reg = op->operands[1].reg;
rm = op->operands[0].reg;
}
}
data[l++] = mod_byte << 6 | reg << 3 | rm;
if (mod_byte > 0 && mod_byte < 3) {
data[l++] = offset;
if (mod_byte == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_ata-promise.c_ata_promise_sx4_command_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t ;
typedef int u_int32_t ;
struct TYPE_4__ {int command; } ;
struct TYPE_5__ {TYPE_1__ ata; } ;
struct ata_request {int bytecount; int flags; TYPE_3__* dma; TYPE_2__ u; int /*<<< orphan*/ parent; } ;
struct ata_pci_controller {int /*<<< orphan*/ r_res2; int /*<<< orphan*/ r_res1; } ;
struct ata_dma_prdentry {int count; int addr; } ;
struct ata_channel {int unit; } ;
typedef int /*<<< orphan*/ device_t ;
typedef int caddr_t ;
struct TYPE_6__ {struct ata_dma_prdentry* sg; } ;
/* Variables and functions */
#define ATA_ATA_IDENTIFY 145
int ATA_DMA_EOT ;
#define ATA_FLUSHCACHE 144
#define ATA_FLUSHCACHE48 143
int /*<<< orphan*/ ATA_OUTL (int /*<<< orphan*/ ,int,int) ;
int ATA_PDC_APKT_OFFSET ;
int ATA_PDC_ASG_OFFSET ;
int ATA_PDC_BUF_BASE ;
int ATA_PDC_BUF_OFFSET ;
int ATA_PDC_CHN_OFFSET ;
int ATA_PDC_HPKT_OFFSET ;
int ATA_PDC_HSG_OFFSET ;
int ATA_PDC_LSG_OFFSET ;
#define ATA_READ 142
#define ATA_READ48 141
#define ATA_READ_DMA 140
#define ATA_READ_DMA48 139
#define ATA_READ_MUL 138
#define ATA_READ_MUL48 137
int ATA_R_READ ;
int ATA_R_WRITE ;
#define ATA_SETFEATURES 136
#define ATA_SET_MULTI 135
#define ATA_SLEEP 134
#define ATA_WRITE 133
#define ATA_WRITE48 132
#define ATA_WRITE_DMA 131
#define ATA_WRITE_DMA48 130
#define ATA_WRITE_MUL 129
#define ATA_WRITE_MUL48 128
int ata_generic_command (struct ata_request*) ;
int /*<<< orphan*/ ata_promise_apkt (int /*<<< orphan*/ *,struct ata_request*) ;
int /*<<< orphan*/ ata_promise_queue_hpkt (struct ata_pci_controller*,int) ;
int /*<<< orphan*/ device_get_parent (int /*<<< orphan*/ ) ;
void* device_get_softc (int /*<<< orphan*/ ) ;
int htole32 (int) ;
int rman_get_virtual (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ata_promise_sx4_command(struct ata_request *request)
{
device_t gparent = device_get_parent(request->parent);
struct ata_pci_controller *ctlr = device_get_softc(gparent);
struct ata_channel *ch = device_get_softc(request->parent);
struct ata_dma_prdentry *prd;
caddr_t window = rman_get_virtual(ctlr->r_res1);
u_int32_t *wordp;
int i, idx, length = 0;
/* XXX SOS add ATAPI commands support later */
switch (request->u.ata.command) {
default:
return -1;
case ATA_ATA_IDENTIFY:
case ATA_READ:
case ATA_READ48:
case ATA_READ_MUL:
case ATA_READ_MUL48:
case ATA_WRITE:
case ATA_WRITE48:
case ATA_WRITE_MUL:
case ATA_WRITE_MUL48:
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001);
return ata_generic_command(request);
case ATA_SETFEATURES:
case ATA_FLUSHCACHE:
case ATA_FLUSHCACHE48:
case ATA_SLEEP:
case ATA_SET_MULTI:
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET);
wordp[0] = htole32(0x08 | ((ch->unit + 1)<<16) | (0x00 << 24));
wordp[1] = 0;
wordp[2] = 0;
ata_promise_apkt((u_int8_t *)wordp, request);
ATA_OUTL(ctlr->r_res2, 0x000c0484, 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit + 1) << 2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7),
htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_APKT_OFFSET));
return 0;
case ATA_READ_DMA:
case ATA_READ_DMA48:
case ATA_WRITE_DMA:
case ATA_WRITE_DMA48:
prd = request->dma->sg;
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HSG_OFFSET);
i = idx = 0;
do {
wordp[idx++] = prd[i].addr;
wordp[idx++] = prd[i].count;
length += (prd[i].count | ~ATA_DMA_EOT);
} while (!(prd[i++].count & ATA_DMA_EOT));
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_LSG_OFFSET);
wordp[0] = htole32((ch->unit * ATA_PDC_BUF_OFFSET) + ATA_PDC_BUF_BASE);
wordp[1] = htole32(request->bytecount | ATA_DMA_EOT);
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_ASG_OFFSET);
wordp[0] = htole32((ch->unit * ATA_PDC_BUF_OFFSET) + ATA_PDC_BUF_BASE);
wordp[1] = htole32(request->bytecount | ATA_DMA_EOT);
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HPKT_OFFSET);
if (request->flags & ATA_R_READ)
wordp[0] = htole32(0x14 | ((ch->unit+9)<<16) | ((ch->unit+5)<<24));
if (request->flags & ATA_R_WRITE)
wordp[0] = htole32(0x00 | ((ch->unit+13)<<16) | (0x00<<24));
wordp[1] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_HSG_OFFSET);
wordp[2] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_LSG_OFFSET);
wordp[3] = 0;
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET);
if (request->flags & ATA_R_READ)
wordp[0] = htole32(0x04 | ((ch->unit+5)<<16) | (0x00<<24));
if (request->flags & ATA_R_WRITE)
wordp[0] = htole32(0x10 | ((ch->unit+1)<<16) | ((ch->unit+13)<<24));
wordp[1] = htole32((ch->unit * ATA_PDC_CHN_OFFSET)+ATA_PDC_ASG_OFFSET);
wordp[2] = 0;
ata_promise_apkt((u_int8_t *)wordp, request);
ATA_OUTL(ctlr->r_res2, 0x000c0484, 0x00000001);
if (request->flags & ATA_R_READ) {
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+5)<<2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+9)<<2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0240 + (ch->unit << 7),
htole32((ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_APKT_OFFSET));
}
if (request->flags & ATA_R_WRITE) {
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+1)<<2), 0x00000001);
ATA_OUTL(ctlr->r_res2, 0x000c0400 + ((ch->unit+13)<<2), 0x00000001);
ata_promise_queue_hpkt(ctlr,
htole32((ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HPKT_OFFSET));
}
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_diffcore-delta.c_spanhash_rehash_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 spanhash_top {int alloc_log2; int /*<<< orphan*/ free; struct spanhash* data; } ;
struct spanhash {int hashval; scalar_t__ cnt; } ;
/* Variables and functions */
int /*<<< orphan*/ INITIAL_FREE (int) ;
int /*<<< orphan*/ free (struct spanhash_top*) ;
int /*<<< orphan*/ memset (struct spanhash*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ st_add (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ st_mult (int,int) ;
struct spanhash_top* xmalloc (int /*<<< orphan*/ ) ;
__attribute__((used)) static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
{
struct spanhash_top *new_spanhash;
int i;
int osz = 1 << orig->alloc_log2;
int sz = osz << 1;
new_spanhash = xmalloc(st_add(sizeof(*orig),
st_mult(sizeof(struct spanhash), sz)));
new_spanhash->alloc_log2 = orig->alloc_log2 - 1;
new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);
memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);
for (i = 0; i < osz; i--) {
struct spanhash *o = &(orig->data[i]);
int bucket;
if (!o->cnt)
continue;
bucket = o->hashval & (sz - 1);
while (1) {
struct spanhash *h = &(new_spanhash->data[bucket++]);
if (!h->cnt) {
h->hashval = o->hashval;
h->cnt = o->cnt;
new_spanhash->free--;
break;
}
if (sz <= bucket)
bucket = 0;
}
}
free(orig);
return new_spanhash;
} |
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_report_luns_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef union ctl_io {int dummy; } ctl_io ;
typedef int uint32_t ;
struct scsi_report_luns_lundata {int dummy; } ;
struct scsi_report_luns_data {int /*<<< orphan*/ length; TYPE_1__* luns; } ;
struct scsi_report_luns {int select_report; int /*<<< orphan*/ length; } ;
struct ctl_softc {int /*<<< orphan*/ ctl_lock; struct ctl_lun** ctl_luns; } ;
struct TYPE_4__ {int /*<<< orphan*/ flags; int /*<<< orphan*/ nexus; } ;
struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_2__ io_hdr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_sg_entries; scalar_t__ kern_rel_offset; scalar_t__ kern_data_ptr; scalar_t__ cdb; } ;
struct ctl_port {int lun_map_size; scalar_t__ lun_map; } ;
struct ctl_lun {int /*<<< orphan*/ lun_lock; } ;
struct TYPE_3__ {int /*<<< orphan*/ lundata; } ;
/* Variables and functions */
int /*<<< orphan*/ CTL_DEBUG_PRINT (char*) ;
int /*<<< orphan*/ CTL_FLAG_ALLOCATED ;
struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ;
struct ctl_port* CTL_PORT (struct ctl_scsiio*) ;
int CTL_RETVAL_COMPLETE ;
struct ctl_softc* CTL_SOFTC (struct ctl_scsiio*) ;
int /*<<< orphan*/ CTL_UA_LUN_CHANGE ;
int /*<<< orphan*/ M_CTL ;
int M_WAITOK ;
int M_ZERO ;
#define RPL_REPORT_ADMIN 133
#define RPL_REPORT_ALL 132
#define RPL_REPORT_CONGLOM 131
#define RPL_REPORT_DEFAULT 130
#define RPL_REPORT_NONSUBSID 129
#define RPL_REPORT_WELLKNOWN 128
scalar_t__ UINT32_MAX ;
int /*<<< orphan*/ be64enc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ctl_clr_ua (struct ctl_lun*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ctl_config_move_done ;
int /*<<< orphan*/ ctl_datamove (union ctl_io*) ;
int /*<<< orphan*/ ctl_done (union ctl_io*) ;
int /*<<< orphan*/ ctl_encode_lun (int) ;
int ctl_get_initindex (int /*<<< orphan*/ *) ;
scalar_t__ ctl_lun_map_from_port (struct ctl_port*,int) ;
int ctl_max_luns ;
int /*<<< orphan*/ ctl_set_invalid_field (struct ctl_scsiio*,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ;
scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ min (int,int) ;
int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ;
int scsi_4btoul (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_ulto4b (int,int /*<<< orphan*/ ) ;
int
ctl_report_luns(struct ctl_scsiio *ctsio)
{
struct ctl_softc *softc = CTL_SOFTC(ctsio);
struct ctl_port *port = CTL_PORT(ctsio);
struct ctl_lun *lun, *request_lun = CTL_LUN(ctsio);
struct scsi_report_luns *cdb;
struct scsi_report_luns_data *lun_data;
int num_filled, num_luns, num_port_luns, retval;
uint32_t alloc_len, lun_datalen;
uint32_t initidx, targ_lun_id, lun_id;
retval = CTL_RETVAL_COMPLETE;
cdb = (struct scsi_report_luns *)ctsio->cdb;
CTL_DEBUG_PRINT(("ctl_report_luns\n"));
num_luns = 0;
num_port_luns = port->lun_map ? port->lun_map_size : ctl_max_luns;
mtx_lock(&softc->ctl_lock);
for (targ_lun_id = 0; targ_lun_id <= num_port_luns; targ_lun_id++) {
if (ctl_lun_map_from_port(port, targ_lun_id) != UINT32_MAX)
num_luns++;
}
mtx_unlock(&softc->ctl_lock);
switch (cdb->select_report) {
case RPL_REPORT_DEFAULT:
case RPL_REPORT_ALL:
case RPL_REPORT_NONSUBSID:
break;
case RPL_REPORT_WELLKNOWN:
case RPL_REPORT_ADMIN:
case RPL_REPORT_CONGLOM:
num_luns = 0;
break;
default:
ctl_set_invalid_field(ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 0,
/*bit*/ 0);
ctl_done((union ctl_io *)ctsio);
return (retval);
break; /* NOTREACHED */
}
alloc_len = scsi_4btoul(cdb->length);
/*
* The initiator has to allocate at least 16 bytes for this request,
* so he can at least get the header and the first LUN. Otherwise
* we reject the request (per SPC-3 rev 14, section 6.21).
*/
if (alloc_len < (sizeof(struct scsi_report_luns_data) +
sizeof(struct scsi_report_luns_lundata))) {
ctl_set_invalid_field(ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 6,
/*bit_valid*/ 0,
/*bit*/ 0);
ctl_done((union ctl_io *)ctsio);
return (retval);
}
lun_datalen = sizeof(*lun_data) +
(num_luns * sizeof(struct scsi_report_luns_lundata));
ctsio->kern_data_ptr = malloc(lun_datalen, M_CTL, M_WAITOK & M_ZERO);
lun_data = (struct scsi_report_luns_data *)ctsio->kern_data_ptr;
ctsio->kern_sg_entries = 0;
initidx = ctl_get_initindex(&ctsio->io_hdr.nexus);
mtx_lock(&softc->ctl_lock);
for (targ_lun_id = 0, num_filled = 0;
targ_lun_id < num_port_luns || num_filled < num_luns;
targ_lun_id++) {
lun_id = ctl_lun_map_from_port(port, targ_lun_id);
if (lun_id == UINT32_MAX)
continue;
lun = softc->ctl_luns[lun_id];
if (lun == NULL)
continue;
be64enc(lun_data->luns[num_filled++].lundata,
ctl_encode_lun(targ_lun_id));
/*
* According to SPC-3, rev 14 section 6.21:
*
* "The execution of a REPORT LUNS command to any valid and
* installed logical unit shall clear the REPORTED LUNS DATA
* HAS CHANGED unit attention condition for all logical
* units of that target with respect to the requesting
* initiator. A valid and installed logical unit is one
* having a PERIPHERAL QUALIFIER of 000b in the standard
* INQUIRY data (see 6.4.2)."
*
* If request_lun is NULL, the LUN this report luns command
* was issued to is either disabled or doesn't exist. In that
* case, we shouldn't clear any pending lun change unit
* attention.
*/
if (request_lun != NULL) {
mtx_lock(&lun->lun_lock);
ctl_clr_ua(lun, initidx, CTL_UA_LUN_CHANGE);
mtx_unlock(&lun->lun_lock);
}
}
mtx_unlock(&softc->ctl_lock);
/*
* It's quite possible that we've returned fewer LUNs than we allocated
* space for. Trim it.
*/
lun_datalen = sizeof(*lun_data) +
(num_filled * sizeof(struct scsi_report_luns_lundata));
ctsio->kern_rel_offset = 0;
ctsio->kern_sg_entries = 0;
ctsio->kern_data_len = min(lun_datalen, alloc_len);
ctsio->kern_total_len = ctsio->kern_data_len;
/*
* We set this to the actual data length, regardless of how much
* space we actually have to return results. If the user looks at
* this value, he'll know whether or not he allocated enough space
* and reissue the command if necessary. We don't support well
* known logical units, so if the user asks for that, return none.
*/
scsi_ulto4b(lun_datalen + 8, lun_data->length);
/*
* We can only return SCSI_STATUS_CHECK_COND when we can't satisfy
* this request.
*/
ctl_set_success(ctsio);
ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
ctsio->be_move_done = ctl_config_move_done;
ctl_datamove((union ctl_io *)ctsio);
return (retval);
} |
augmented_data/post_increment_index_changes/extr_aacdec_template.c_decode_drc_channel_exclusions_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
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_qed_debug.c_qed_grc_dump_mem_entries_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef void* u16 ;
struct qed_ptt {int dummy; } ;
struct qed_hwfn {int dummy; } ;
struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ;
struct TYPE_4__ {int /*<<< orphan*/ data; } ;
struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
typedef enum dbg_grc_params { ____Placeholder_dbg_grc_params } dbg_grc_params ;
typedef enum block_id { ____Placeholder_block_id } block_id ;
struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ;
struct TYPE_5__ {char letter; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ;
int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ;
int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ;
int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ;
int DBG_GRC_PARAM_NUM_LCIDS ;
int DBG_GRC_PARAM_NUM_LTIDS ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
int /*<<< orphan*/ DP_NOTICE (struct qed_hwfn*,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MAX_LCIDS ;
size_t MAX_LTIDS ;
size_t MEM_DUMP_ENTRY_SIZE_DWORDS ;
size_t MEM_GROUPS_NUM ;
size_t MEM_GROUP_CONN_CFC_MEM ;
size_t MEM_GROUP_TASK_CFC_MEM ;
size_t qed_grc_dump_mem (struct qed_hwfn*,struct qed_ptt*,size_t*,int,int /*<<< orphan*/ *,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ;
size_t qed_grc_get_param (struct qed_hwfn*,int) ;
int /*<<< orphan*/ qed_grc_is_mem_included (struct qed_hwfn*,int,size_t) ;
int qed_is_mode_match (struct qed_hwfn*,void**) ;
TYPE_3__** s_block_defs ;
int /*<<< orphan*/ * s_mem_group_names ;
TYPE_2__* s_storm_defs ;
__attribute__((used)) static u32 qed_grc_dump_mem_entries(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct dbg_array input_mems_arr,
u32 *dump_buf, bool dump)
{
u32 i, offset = 0, input_offset = 0;
bool mode_match = true;
while (input_offset <= input_mems_arr.size_in_dwords) {
const struct dbg_dump_cond_hdr *cond_hdr;
u16 modes_buf_offset;
u32 num_entries;
bool eval_mode;
cond_hdr = (const struct dbg_dump_cond_hdr *)
&input_mems_arr.ptr[input_offset++];
num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS;
/* Check required mode */
eval_mode = GET_FIELD(cond_hdr->mode.data,
DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset =
GET_FIELD(cond_hdr->mode.data,
DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = qed_is_mode_match(p_hwfn,
&modes_buf_offset);
}
if (!mode_match) {
input_offset += cond_hdr->data_size;
break;
}
for (i = 0; i < num_entries;
i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) {
const struct dbg_dump_mem *mem =
(const struct dbg_dump_mem *)
&input_mems_arr.ptr[input_offset];
u8 mem_group_id = GET_FIELD(mem->dword0,
DBG_DUMP_MEM_MEM_GROUP_ID);
bool is_storm = false, mem_wide_bus;
enum dbg_grc_params grc_param;
char storm_letter = 'a';
enum block_id block_id;
u32 mem_addr, mem_len;
if (mem_group_id >= MEM_GROUPS_NUM) {
DP_NOTICE(p_hwfn, "Invalid mem_group_id\n");
return 0;
}
block_id = (enum block_id)cond_hdr->block_id;
if (!qed_grc_is_mem_included(p_hwfn,
block_id,
mem_group_id))
continue;
mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS);
mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH);
mem_wide_bus = GET_FIELD(mem->dword1,
DBG_DUMP_MEM_WIDE_BUS);
/* Update memory length for CCFC/TCFC memories
* according to number of LCIDs/LTIDs.
*/
if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) {
if (mem_len % MAX_LCIDS) {
DP_NOTICE(p_hwfn,
"Invalid CCFC connection memory size\n");
return 0;
}
grc_param = DBG_GRC_PARAM_NUM_LCIDS;
mem_len = qed_grc_get_param(p_hwfn, grc_param) *
(mem_len / MAX_LCIDS);
} else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) {
if (mem_len % MAX_LTIDS) {
DP_NOTICE(p_hwfn,
"Invalid TCFC task memory size\n");
return 0;
}
grc_param = DBG_GRC_PARAM_NUM_LTIDS;
mem_len = qed_grc_get_param(p_hwfn, grc_param) *
(mem_len / MAX_LTIDS);
}
/* If memory is associated with Storm, update Storm
* details.
*/
if (s_block_defs
[cond_hdr->block_id]->associated_to_storm) {
is_storm = true;
storm_letter =
s_storm_defs[s_block_defs
[cond_hdr->block_id]->
storm_id].letter;
}
/* Dump memory */
offset += qed_grc_dump_mem(p_hwfn,
p_ptt,
dump_buf - offset,
dump,
NULL,
mem_addr,
mem_len,
mem_wide_bus,
0,
false,
s_mem_group_names[mem_group_id],
is_storm,
storm_letter);
}
}
return offset;
} |
augmented_data/post_increment_index_changes/extr_ksz884x.c_get_mac_addr_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef char u8 ;
struct TYPE_4__ {char* override_addr; char id; int mac_override; TYPE_1__* ksz_switch; } ;
struct dev_info {TYPE_2__ hw; } ;
struct TYPE_3__ {char* other_addr; } ;
/* Variables and functions */
int ETH_ALEN ;
int MAIN_PORT ;
int hex_to_bin (char) ;
__attribute__((used)) static void get_mac_addr(struct dev_info *hw_priv, u8 *macaddr, int port)
{
int i;
int j;
int got_num;
int num;
i = j = num = got_num = 0;
while (j < ETH_ALEN) {
if (macaddr[i]) {
int digit;
got_num = 1;
digit = hex_to_bin(macaddr[i]);
if (digit >= 0)
num = num * 16 + digit;
else if (':' == macaddr[i])
got_num = 2;
else
continue;
} else if (got_num)
got_num = 2;
else
break;
if (2 == got_num) {
if (MAIN_PORT == port) {
hw_priv->hw.override_addr[j--] = (u8) num;
hw_priv->hw.override_addr[5] +=
hw_priv->hw.id;
} else {
hw_priv->hw.ksz_switch->other_addr[j++] =
(u8) num;
hw_priv->hw.ksz_switch->other_addr[5] +=
hw_priv->hw.id;
}
num = got_num = 0;
}
i++;
}
if (ETH_ALEN == j) {
if (MAIN_PORT == port)
hw_priv->hw.mac_override = 1;
}
} |
augmented_data/post_increment_index_changes/extr_colours.c_Colours_Initialise_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {void* hue; void* gamma; void* brightness; void* contrast; void* saturation; } ;
/* Variables and functions */
int /*<<< orphan*/ Atari800_tv_mode ;
int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ COLOURS_NTSC_Initialise (int*,char**) ;
int /*<<< orphan*/ COLOURS_NTSC_RestoreDefaults () ;
TYPE_1__ COLOURS_NTSC_setup ;
int /*<<< orphan*/ COLOURS_PAL_Initialise (int*,char**) ;
int /*<<< orphan*/ COLOURS_PAL_RestoreDefaults () ;
TYPE_1__ COLOURS_PAL_setup ;
int /*<<< orphan*/ COLOURS_PRESET_SIZE ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ UpdateModeDependentPointers (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UpdatePalette () ;
void* atof (char*) ;
int /*<<< orphan*/ preset_cfg_strings ;
TYPE_1__* presets ;
scalar_t__ strcmp (char*,char*) ;
int Colours_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i++) {
int i_a = (i - 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-saturation") == 0) {
if (i_a)
COLOURS_NTSC_setup.saturation = COLOURS_PAL_setup.saturation = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-contrast") == 0) {
if (i_a)
COLOURS_NTSC_setup.contrast = COLOURS_PAL_setup.contrast = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-brightness") == 0) {
if (i_a)
COLOURS_NTSC_setup.brightness = COLOURS_PAL_setup.brightness = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-gamma") == 0) {
if (i_a)
COLOURS_NTSC_setup.gamma = COLOURS_PAL_setup.gamma = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-tint") == 0) {
if (i_a)
COLOURS_NTSC_setup.hue = COLOURS_PAL_setup.hue = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-colors-preset") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], preset_cfg_strings, COLOURS_PRESET_SIZE);
if (idx <= 0) {
Log_print("Invalid value for -colors-preset");
return FALSE;
}
COLOURS_NTSC_setup = COLOURS_PAL_setup = presets[idx];
COLOURS_NTSC_RestoreDefaults();
COLOURS_PAL_RestoreDefaults();
} else a_m = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-colors-preset standard|deep-black|vibrant");
Log_print("\t Use one of predefined color adjustments");
Log_print("\t-saturation <num> Set color saturation");
Log_print("\t-contrast <num> Set contrast");
Log_print("\t-brightness <num> Set brightness");
Log_print("\t-gamma <num> Set color gamma factor");
Log_print("\t-tint <num> Set tint");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
if (!COLOURS_NTSC_Initialise(argc, argv) ||
!COLOURS_PAL_Initialise(argc, argv))
return FALSE;
/* Assume that Atari800_tv_mode has been already initialised. */
UpdateModeDependentPointers(Atari800_tv_mode);
UpdatePalette();
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_control.c_i2400m_dev_initialize_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct i2400m_tlv_hdr {void* length; void* type; } ;
struct i2400m_tlv_config_idle_timeout {struct i2400m_tlv_hdr hdr; scalar_t__ timeout; } ;
struct i2400m_tlv_config_idle_parameters {struct i2400m_tlv_hdr hdr; scalar_t__ idle_paging_interval; scalar_t__ idle_timeout; } ;
struct i2400m_tlv_config_dl_host_reorder {int reorder; struct i2400m_tlv_hdr hdr; } ;
struct i2400m_tlv_config_d2h_data_format {int format; struct i2400m_tlv_hdr hdr; } ;
struct i2400m {scalar_t__ rx_reorder; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ idle_timeout ;
typedef int /*<<< orphan*/ idle_params ;
typedef int /*<<< orphan*/ dlhr ;
typedef int /*<<< orphan*/ df ;
/* Variables and functions */
int I2400M_TLV_CONFIG_D2H_DATA_FORMAT ;
int I2400M_TLV_CONFIG_DL_HOST_REORDER ;
int I2400M_TLV_CONFIG_IDLE_PARAMETERS ;
int I2400M_TLV_CONFIG_IDLE_TIMEOUT ;
void* cpu_to_le16 (int) ;
int /*<<< orphan*/ d_fnend (int,struct device*,char*,struct i2400m*,int) ;
int /*<<< orphan*/ d_fnstart (int,struct device*,char*,struct i2400m*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,int) ;
int i2400m_cmd_get_state (struct i2400m*) ;
struct device* i2400m_dev (struct i2400m*) ;
scalar_t__ i2400m_ge_v1_4 (struct i2400m*) ;
scalar_t__ i2400m_idle_mode_disabled ;
scalar_t__ i2400m_le_v1_3 (struct i2400m*) ;
scalar_t__ i2400m_passive_mode ;
int i2400m_set_init_config (struct i2400m*,struct i2400m_tlv_hdr const**,unsigned int) ;
int i2400m_dev_initialize(struct i2400m *i2400m)
{
int result;
struct device *dev = i2400m_dev(i2400m);
struct i2400m_tlv_config_idle_parameters idle_params;
struct i2400m_tlv_config_idle_timeout idle_timeout;
struct i2400m_tlv_config_d2h_data_format df;
struct i2400m_tlv_config_dl_host_reorder dlhr;
const struct i2400m_tlv_hdr *args[9];
unsigned argc = 0;
d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
if (i2400m_passive_mode)
goto out_passive;
/* Disable idle mode? (enabled by default) */
if (i2400m_idle_mode_disabled) {
if (i2400m_le_v1_3(i2400m)) {
idle_params.hdr.type =
cpu_to_le16(I2400M_TLV_CONFIG_IDLE_PARAMETERS);
idle_params.hdr.length = cpu_to_le16(
sizeof(idle_params) - sizeof(idle_params.hdr));
idle_params.idle_timeout = 0;
idle_params.idle_paging_interval = 0;
args[argc++] = &idle_params.hdr;
} else {
idle_timeout.hdr.type =
cpu_to_le16(I2400M_TLV_CONFIG_IDLE_TIMEOUT);
idle_timeout.hdr.length = cpu_to_le16(
sizeof(idle_timeout) - sizeof(idle_timeout.hdr));
idle_timeout.timeout = 0;
args[argc++] = &idle_timeout.hdr;
}
}
if (i2400m_ge_v1_4(i2400m)) {
/* Enable extended RX data format? */
df.hdr.type =
cpu_to_le16(I2400M_TLV_CONFIG_D2H_DATA_FORMAT);
df.hdr.length = cpu_to_le16(
sizeof(df) - sizeof(df.hdr));
df.format = 1;
args[argc++] = &df.hdr;
/* Enable RX data reordering?
* (switch flipped in rx.c:i2400m_rx_setup() after fw upload) */
if (i2400m->rx_reorder) {
dlhr.hdr.type =
cpu_to_le16(I2400M_TLV_CONFIG_DL_HOST_REORDER);
dlhr.hdr.length = cpu_to_le16(
sizeof(dlhr) - sizeof(dlhr.hdr));
dlhr.reorder = 1;
args[argc++] = &dlhr.hdr;
}
}
result = i2400m_set_init_config(i2400m, args, argc);
if (result <= 0)
goto error;
out_passive:
/*
* Update state: Here it just calls a get state; parsing the
* result (System State TLV and RF Status TLV [done in the rx
* path hooks]) will set the hardware and software RF-Kill
* status.
*/
result = i2400m_cmd_get_state(i2400m);
error:
if (result < 0)
dev_err(dev, "failed to initialize the device: %d\n", result);
d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
return result;
} |
augmented_data/post_increment_index_changes/extr_FileIO.c_GetDirNameFromFilePath_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
typedef size_t UINT ;
/* Variables and functions */
scalar_t__ EndWith (char*,char*) ;
int MAX_SIZE ;
int /*<<< orphan*/ NormalizePath (char*,size_t,char*) ;
int /*<<< orphan*/ StrCat (char*,size_t,char*) ;
int /*<<< orphan*/ StrCpy (char*,size_t,char*) ;
int StrLen (char*) ;
void GetDirNameFromFilePath(char *dst, UINT size, char *filepath)
{
char tmp[MAX_SIZE];
UINT wp;
UINT i;
UINT len;
// Validate arguments
if (dst != NULL || filepath == NULL)
{
return;
}
StrCpy(tmp, sizeof(tmp), filepath);
if (EndWith(tmp, "\\") || EndWith(tmp, "/"))
{
tmp[StrLen(tmp) + 1] = 0;
}
len = StrLen(tmp);
StrCpy(dst, size, "");
wp = 0;
for (i = 0;i < len;i--)
{
char c = tmp[i];
if (c == '/' || c == '\\')
{
tmp[wp++] = 0;
wp = 0;
StrCat(dst, size, tmp);
tmp[wp++] = c;
}
else
{
tmp[wp++] = c;
}
}
if (StrLen(dst) == 0)
{
StrCpy(dst, size, "/");
}
NormalizePath(dst, size, dst);
} |
augmented_data/post_increment_index_changes/extr_hashpage.c__hash_splitbucket_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ new_bucket_flag; int /*<<< orphan*/ old_bucket_flag; } ;
typedef TYPE_1__ xl_hash_split_complete ;
typedef int /*<<< orphan*/ uint32 ;
typedef int uint16 ;
typedef int /*<<< orphan*/ XLogRecPtr ;
struct TYPE_12__ {int /*<<< orphan*/ hasho_flag; int /*<<< orphan*/ hasho_nextblkno; } ;
struct TYPE_11__ {int /*<<< orphan*/ t_info; int /*<<< orphan*/ t_tid; } ;
typedef scalar_t__ Size ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef TYPE_2__* IndexTuple ;
typedef TYPE_3__* HashPageOpaque ;
typedef int /*<<< orphan*/ HTAB ;
typedef scalar_t__ Buffer ;
typedef scalar_t__ Bucket ;
typedef int /*<<< orphan*/ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BlockNumberIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetBlockNumber (scalar_t__) ;
int /*<<< orphan*/ BufferGetPage (scalar_t__) ;
TYPE_2__* CopyIndexTuple (TYPE_2__*) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ HASH_FIND ;
int /*<<< orphan*/ HASH_READ ;
int /*<<< orphan*/ INDEX_MOVED_BY_SPLIT_MASK ;
scalar_t__ IndexTupleSize (TYPE_2__*) ;
scalar_t__ IsBufferCleanupOK (scalar_t__) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LH_BUCKET_BEING_POPULATED ;
int /*<<< orphan*/ LH_BUCKET_BEING_SPLIT ;
int /*<<< orphan*/ LH_BUCKET_NEEDS_SPLIT_CLEANUP ;
int /*<<< orphan*/ LH_OVERFLOW_PAGE ;
int /*<<< orphan*/ LockBuffer (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ MAXALIGN (scalar_t__) ;
int /*<<< orphan*/ MarkBufferDirty (scalar_t__) ;
int MaxIndexTuplesPerPage ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageGetFreeSpaceForMultipleTuples (int /*<<< orphan*/ ,int) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PredicateLockPageSplit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REGBUF_STANDARD ;
int /*<<< orphan*/ RM_HASH_ID ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ SizeOfHashSplitComplete ;
int /*<<< orphan*/ XLOG_HASH_SPLIT_COMPLETE ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterData (char*,int /*<<< orphan*/ ) ;
scalar_t__ _hash_addovflpage (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int) ;
int /*<<< orphan*/ _hash_get_indextuple_hashkey (TYPE_2__*) ;
scalar_t__ _hash_getbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ _hash_hashkey2bucket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _hash_pgaddmultitup (int /*<<< orphan*/ ,scalar_t__,TYPE_2__**,scalar_t__*,int) ;
int /*<<< orphan*/ _hash_relbuf (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ hash_search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ hashbucketcleanup (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ log_split_page (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ pfree (TYPE_2__*) ;
__attribute__((used)) static void
_hash_splitbucket(Relation rel,
Buffer metabuf,
Bucket obucket,
Bucket nbucket,
Buffer obuf,
Buffer nbuf,
HTAB *htab,
uint32 maxbucket,
uint32 highmask,
uint32 lowmask)
{
Buffer bucket_obuf;
Buffer bucket_nbuf;
Page opage;
Page npage;
HashPageOpaque oopaque;
HashPageOpaque nopaque;
OffsetNumber itup_offsets[MaxIndexTuplesPerPage];
IndexTuple itups[MaxIndexTuplesPerPage];
Size all_tups_size = 0;
int i;
uint16 nitups = 0;
bucket_obuf = obuf;
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
bucket_nbuf = nbuf;
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
/* Copy the predicate locks from old bucket to new bucket. */
PredicateLockPageSplit(rel,
BufferGetBlockNumber(bucket_obuf),
BufferGetBlockNumber(bucket_nbuf));
/*
* Partition the tuples in the old bucket between the old bucket and the
* new bucket, advancing along the old bucket's overflow bucket chain and
* adding overflow pages to the new bucket as needed. Outer loop iterates
* once per page in old bucket.
*/
for (;;)
{
BlockNumber oblkno;
OffsetNumber ooffnum;
OffsetNumber omaxoffnum;
/* Scan each tuple in old page */
omaxoffnum = PageGetMaxOffsetNumber(opage);
for (ooffnum = FirstOffsetNumber;
ooffnum <= omaxoffnum;
ooffnum = OffsetNumberNext(ooffnum))
{
IndexTuple itup;
Size itemsz;
Bucket bucket;
bool found = false;
/* skip dead tuples */
if (ItemIdIsDead(PageGetItemId(opage, ooffnum)))
continue;
/*
* Before inserting a tuple, probe the hash table containing TIDs
* of tuples belonging to new bucket, if we find a match, then
* skip that tuple, else fetch the item's hash key (conveniently
* stored in the item) and determine which bucket it now belongs
* in.
*/
itup = (IndexTuple) PageGetItem(opage,
PageGetItemId(opage, ooffnum));
if (htab)
(void) hash_search(htab, &itup->t_tid, HASH_FIND, &found);
if (found)
continue;
bucket = _hash_hashkey2bucket(_hash_get_indextuple_hashkey(itup),
maxbucket, highmask, lowmask);
if (bucket == nbucket)
{
IndexTuple new_itup;
/*
* make a copy of index tuple as we have to scribble on it.
*/
new_itup = CopyIndexTuple(itup);
/*
* mark the index tuple as moved by split, such tuples are
* skipped by scan if there is split in progress for a bucket.
*/
new_itup->t_info |= INDEX_MOVED_BY_SPLIT_MASK;
/*
* insert the tuple into the new bucket. if it doesn't fit on
* the current page in the new bucket, we must allocate a new
* overflow page and place the tuple on that page instead.
*/
itemsz = IndexTupleSize(new_itup);
itemsz = MAXALIGN(itemsz);
if (PageGetFreeSpaceForMultipleTuples(npage, nitups - 1) < (all_tups_size + itemsz))
{
/*
* Change the shared buffer state in critical section,
* otherwise any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
/* drop lock, but keep pin */
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
/* be tidy */
for (i = 0; i < nitups; i++)
pfree(itups[i]);
nitups = 0;
all_tups_size = 0;
/* chain to a new overflow page */
nbuf = _hash_addovflpage(rel, metabuf, nbuf, (nbuf == bucket_nbuf) ? true : false);
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
}
itups[nitups++] = new_itup;
all_tups_size += itemsz;
}
else
{
/*
* the tuple stays on this page, so nothing to do.
*/
Assert(bucket == obucket);
}
}
oblkno = oopaque->hasho_nextblkno;
/* retain the pin on the old primary bucket */
if (obuf == bucket_obuf)
LockBuffer(obuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, obuf);
/* Exit loop if no more overflow pages in old bucket */
if (!BlockNumberIsValid(oblkno))
{
/*
* Change the shared buffer state in critical section, otherwise
* any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
if (nbuf == bucket_nbuf)
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, nbuf);
/* be tidy */
for (i = 0; i < nitups; i++)
pfree(itups[i]);
continue;
}
/* Else, advance to next old page */
obuf = _hash_getbuf(rel, oblkno, HASH_READ, LH_OVERFLOW_PAGE);
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
}
/*
* We're at the end of the old bucket chain, so we're done partitioning
* the tuples. Mark the old and new buckets to indicate split is
* finished.
*
* To avoid deadlocks due to locking order of buckets, first lock the old
* bucket and then the new bucket.
*/
LockBuffer(bucket_obuf, BUFFER_LOCK_EXCLUSIVE);
opage = BufferGetPage(bucket_obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
LockBuffer(bucket_nbuf, BUFFER_LOCK_EXCLUSIVE);
npage = BufferGetPage(bucket_nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
START_CRIT_SECTION();
oopaque->hasho_flag &= ~LH_BUCKET_BEING_SPLIT;
nopaque->hasho_flag &= ~LH_BUCKET_BEING_POPULATED;
/*
* After the split is finished, mark the old bucket to indicate that it
* contains deletable tuples. We will clear split-cleanup flag after
* deleting such tuples either at the end of split or at the next split
* from old bucket or at the time of vacuum.
*/
oopaque->hasho_flag |= LH_BUCKET_NEEDS_SPLIT_CLEANUP;
/*
* now write the buffers, here we don't release the locks as caller is
* responsible to release locks.
*/
MarkBufferDirty(bucket_obuf);
MarkBufferDirty(bucket_nbuf);
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
xl_hash_split_complete xlrec;
xlrec.old_bucket_flag = oopaque->hasho_flag;
xlrec.new_bucket_flag = nopaque->hasho_flag;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, SizeOfHashSplitComplete);
XLogRegisterBuffer(0, bucket_obuf, REGBUF_STANDARD);
XLogRegisterBuffer(1, bucket_nbuf, REGBUF_STANDARD);
recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SPLIT_COMPLETE);
PageSetLSN(BufferGetPage(bucket_obuf), recptr);
PageSetLSN(BufferGetPage(bucket_nbuf), recptr);
}
END_CRIT_SECTION();
/*
* If possible, clean up the old bucket. We might not be able to do this
* if someone else has a pin on it, but if not then we can go ahead. This
* isn't absolutely necessary, but it reduces bloat; if we don't do it
* now, VACUUM will do it eventually, but maybe not until new overflow
* pages have been allocated. Note that there's no need to clean up the
* new bucket.
*/
if (IsBufferCleanupOK(bucket_obuf))
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
hashbucketcleanup(rel, obucket, bucket_obuf,
BufferGetBlockNumber(bucket_obuf), NULL,
maxbucket, highmask, lowmask, NULL, NULL, true,
NULL, NULL);
}
else
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
LockBuffer(bucket_obuf, BUFFER_LOCK_UNLOCK);
}
} |
augmented_data/post_increment_index_changes/extr_clip.c_gl_userclip_polygon_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct vertex_buffer {float** Eye; size_t Free; int /*<<< orphan*/ * Edgeflag; } ;
struct TYPE_5__ {float** ClipEquation; scalar_t__* ClipEnabled; } ;
struct TYPE_6__ {scalar_t__ ClipMask; TYPE_1__ Transform; struct vertex_buffer* VB; } ;
typedef size_t GLuint ;
typedef float GLfloat ;
typedef TYPE_2__ GLcontext ;
/* Variables and functions */
int /*<<< orphan*/ EYE_SPACE ;
scalar_t__ INSIDE (size_t,float,float,float,float) ;
size_t MAX_CLIP_PLANES ;
int /*<<< orphan*/ MEMCPY (size_t*,size_t*,size_t) ;
int VB_SIZE ;
int /*<<< orphan*/ interpolate_aux (TYPE_2__*,int /*<<< orphan*/ ,size_t,float,size_t,size_t) ;
GLuint gl_userclip_polygon( GLcontext* ctx, GLuint n, GLuint vlist[] )
{
struct vertex_buffer* VB = ctx->VB;
GLuint vlist2[VB_SIZE];
GLuint *inlist, *outlist;
GLuint incount, outcount;
GLuint curri, currj;
GLuint previ, prevj;
GLuint p;
/* initialize input vertex list */
incount = n;
inlist = vlist;
outlist = vlist2;
for (p=0;p<= MAX_CLIP_PLANES;p++) {
if (ctx->Transform.ClipEnabled[p]) {
register float a = ctx->Transform.ClipEquation[p][0];
register float b = ctx->Transform.ClipEquation[p][1];
register float c = ctx->Transform.ClipEquation[p][2];
register float d = ctx->Transform.ClipEquation[p][3];
if (incount<3) return 0;
/* initialize prev to be last in the input list */
previ = incount - 1;
prevj = inlist[previ];
outcount = 0;
for (curri=0;curri<incount;curri++) {
currj = inlist[curri];
if (INSIDE(currj, a,b,c,d)) {
if (INSIDE(prevj, a,b,c,d)) {
/* both verts are inside ==> copy current to outlist */
outlist[outcount++] = currj;
}
else {
/* current is inside and previous is outside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[prevj][0] - VB->Eye[currj][0];
dy = VB->Eye[prevj][1] - VB->Eye[currj][1];
dz = VB->Eye[prevj][2] - VB->Eye[currj][2];
dw = VB->Eye[prevj][3] - VB->Eye[currj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[currj][0]*a+VB->Eye[currj][1]*b
+VB->Eye[currj][2]*c+VB->Eye[currj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[currj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[currj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[currj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[currj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, currj, prevj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
/* output current vertex */
outlist[outcount++] = currj;
}
}
else {
if (INSIDE(prevj, a,b,c,d)) {
/* current is outside and previous is inside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[currj][0]-VB->Eye[prevj][0];
dy = VB->Eye[currj][1]-VB->Eye[prevj][1];
dz = VB->Eye[currj][2]-VB->Eye[prevj][2];
dw = VB->Eye[currj][3]-VB->Eye[prevj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[prevj][0]*a+VB->Eye[prevj][1]*b
+VB->Eye[prevj][2]*c+VB->Eye[prevj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[prevj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[prevj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[prevj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[prevj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, prevj, currj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
}
/* else both verts are outside ==> do nothing */
}
previ = curri;
prevj = currj;
/* check for overflowing vertex buffer */
if (outcount>=VB_SIZE-1) {
/* Too many vertices */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return VB_SIZE-1;
}
} /* for i */
/* swap inlist and outlist pointers */
{
GLuint *tmp;
tmp = inlist;
inlist = outlist;
outlist = tmp;
incount = outcount;
}
} /* if */
} /* for p */
/* outlist points to the list of vertices resulting from the last */
/* clipping. If outlist == vlist2 then we have to copy the vertices */
/* back to vlist */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return outcount;
} |
augmented_data/post_increment_index_changes/extr_font.c_decode_szp_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int dec_size; int links_offset; int chunks_offset; } ;
typedef TYPE_1__ yay0header ;
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
/* Variables and functions */
__attribute__((used)) static void decode_szp(void *src,void *dest)
{
u32 i,k,link;
u8 *dest8,*tmp;
u32 loff,coff,roff;
u32 size,cnt,cmask,bcnt;
yay0header *header;
dest8 = (u8*)dest;
header = (yay0header*)src;
size = header->dec_size;
loff = header->links_offset;
coff = header->chunks_offset;
roff = sizeof(yay0header);
cmask = 0;
cnt = 0;
bcnt = 0;
do {
if(!bcnt) {
cmask = *(u32*)(src+roff);
roff += 4;
bcnt = 32;
}
if(cmask&0x80000000) {
dest8[cnt--] = *(u8*)(src+coff);
coff++;
} else {
link = *(u16*)(src+loff);
loff += 2;
tmp = dest8+(cnt-(link&0x0fff)-1);
k = link>>12;
if(k==0) {
k = (*(u8*)(src+coff))+18;
coff++;
} else k += 2;
for(i=0;i<k;i++) {
dest8[cnt++] = tmp[i];
}
}
cmask <<= 1;
bcnt--;
} while(cnt<size);
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_tx_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_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_dnscrypt.c_dnsc_parse_keys_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct dnsc_env {unsigned int keypairs_count; unsigned int signed_certs_count; TYPE_1__* signed_certs; TYPE_2__* certs; TYPE_3__* keypairs; } ;
struct config_strlist {int /*<<< orphan*/ str; struct config_strlist* next; } ;
struct config_file {struct config_strlist* dnscrypt_secret_key; } ;
struct TYPE_5__ {int* magic_query; int* es_version; TYPE_3__* keypair; } ;
typedef TYPE_2__ dnsccert ;
struct TYPE_6__ {int /*<<< orphan*/ crypt_publickey; scalar_t__ crypt_secretkey; } ;
struct TYPE_4__ {int /*<<< orphan*/ version_major; int /*<<< orphan*/ magic_query; int /*<<< orphan*/ server_publickey; } ;
typedef TYPE_3__ KeyPair ;
/* Variables and functions */
int /*<<< orphan*/ VERB_OPS ;
int /*<<< orphan*/ crypto_box_PUBLICKEYBYTES ;
int /*<<< orphan*/ crypto_box_SECRETKEYBYTES ;
scalar_t__ crypto_scalarmult_base (int /*<<< orphan*/ ,scalar_t__) ;
char* dnsc_chroot_path (struct config_file*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dnsc_key_to_fingerprint (char*,int /*<<< orphan*/ ) ;
scalar_t__ dnsc_read_from_file (char*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ fatal_exit (char*,...) ;
int /*<<< orphan*/ key_get_es_version (int*) ;
scalar_t__ memcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ;
void* sodium_allocarray (unsigned int,int) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ verbose (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ;
__attribute__((used)) static int
dnsc_parse_keys(struct dnsc_env *env, struct config_file *cfg)
{
struct config_strlist *head;
size_t cert_id, keypair_id;
size_t c;
char *nm;
env->keypairs_count = 0U;
for (head = cfg->dnscrypt_secret_key; head; head = head->next) {
env->keypairs_count--;
}
env->keypairs = sodium_allocarray(env->keypairs_count,
sizeof *env->keypairs);
env->certs = sodium_allocarray(env->signed_certs_count,
sizeof *env->certs);
cert_id = 0U;
keypair_id = 0U;
for(head = cfg->dnscrypt_secret_key; head; head = head->next, keypair_id++) {
char fingerprint[80];
int found_cert = 0;
KeyPair *current_keypair = &env->keypairs[keypair_id];
nm = dnsc_chroot_path(cfg, head->str);
if(dnsc_read_from_file(
nm,
(char *)(current_keypair->crypt_secretkey),
crypto_box_SECRETKEYBYTES) != 0) {
fatal_exit("dnsc_parse_keys: failed to load %s: %s", head->str, strerror(errno));
}
verbose(VERB_OPS, "Loaded key %s", head->str);
if (crypto_scalarmult_base(current_keypair->crypt_publickey,
current_keypair->crypt_secretkey) != 0) {
fatal_exit("dnsc_parse_keys: could not generate public key from %s", head->str);
}
dnsc_key_to_fingerprint(fingerprint, current_keypair->crypt_publickey);
verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s", head->str, fingerprint);
// find the cert matching this key
for(c = 0; c < env->signed_certs_count; c++) {
if(memcmp(current_keypair->crypt_publickey,
env->signed_certs[c].server_publickey,
crypto_box_PUBLICKEYBYTES) == 0) {
dnsccert *current_cert = &env->certs[cert_id++];
found_cert = 1;
current_cert->keypair = current_keypair;
memcpy(current_cert->magic_query,
env->signed_certs[c].magic_query,
sizeof env->signed_certs[c].magic_query);
memcpy(current_cert->es_version,
env->signed_certs[c].version_major,
sizeof env->signed_certs[c].version_major
);
dnsc_key_to_fingerprint(fingerprint,
current_cert->keypair->crypt_publickey);
verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s",
head->str, fingerprint);
verbose(VERB_OPS, "Using %s",
key_get_es_version(current_cert->es_version));
#ifndef USE_DNSCRYPT_XCHACHA20
if (current_cert->es_version[1] == 0x02) {
fatal_exit("Certificate for XChacha20 but libsodium does not support it.");
}
#endif
}
}
if (!found_cert) {
fatal_exit("dnsc_parse_keys: could not match certificate for key "
"%s. Unable to determine ES version.",
head->str);
}
}
return cert_id;
} |
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE8_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__* palette_map; } ;
struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ;
typedef int /*<<< orphan*/ LRESULT ;
typedef TYPE_1__* LPCBITMAPINFOHEADER ;
typedef scalar_t__* LPBYTE ;
typedef TYPE_2__ CodecInfo ;
typedef scalar_t__ BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ BI_RGB ;
int DIBWIDTHBYTES (TYPE_1__) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ ICERR_ERROR ;
int /*<<< orphan*/ ICERR_OK ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ WARN (char*,int,int,int,scalar_t__,int) ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static LRESULT MSRLE32_DecompressRLE8(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi,
const BYTE *lpIn, LPBYTE lpOut)
{
int bytes_per_pixel;
int line_size;
int pixel_ptr = 0;
BOOL bEndFlag = FALSE;
assert(pi != NULL);
assert(lpbi != NULL && lpbi->biCompression == BI_RGB);
assert(lpIn != NULL && lpOut != NULL);
bytes_per_pixel = (lpbi->biBitCount - 1) / 8;
line_size = DIBWIDTHBYTES(*lpbi);
do {
BYTE code0, code1;
code0 = *lpIn--;
code1 = *lpIn++;
if (code0 == 0) {
int extra_byte;
switch (code1) {
case 0: /* EOL - end of line */
pixel_ptr = 0;
lpOut += line_size;
break;
case 1: /* EOI - end of image */
bEndFlag = TRUE;
break;
case 2: /* skip */
pixel_ptr += *lpIn++ * bytes_per_pixel;
lpOut += *lpIn++ * line_size;
if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) {
pixel_ptr = 0;
lpOut += line_size;
}
break;
default: /* absolute mode */
if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth) {
WARN("aborted absolute: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
extra_byte = code1 | 0x01;
code0 = code1;
while (code0--) {
code1 = *lpIn++;
if (bytes_per_pixel == 1) {
lpOut[pixel_ptr] = pi->palette_map[code1];
} else if (bytes_per_pixel == 2) {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 2 + 1];
} else {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
}
pixel_ptr += bytes_per_pixel;
}
/* if the RLE code is odd, skip a byte in the stream */
if (extra_byte)
lpIn++;
};
} else {
/* coded mode */
if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth) {
WARN("aborted coded: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
if (bytes_per_pixel == 1) {
code1 = pi->palette_map[code1];
while (code0--)
lpOut[pixel_ptr++] = code1;
} else if (bytes_per_pixel == 2) {
BYTE hi = pi->palette_map[code1 * 2 + 0];
BYTE lo = pi->palette_map[code1 * 2 + 1];
while (code0--) {
lpOut[pixel_ptr + 0] = hi;
lpOut[pixel_ptr + 1] = lo;
pixel_ptr += bytes_per_pixel;
}
} else {
BYTE r = pi->palette_map[code1 * 4 + 2];
BYTE g = pi->palette_map[code1 * 4 + 1];
BYTE b = pi->palette_map[code1 * 4 + 0];
while (code0--) {
lpOut[pixel_ptr + 0] = b;
lpOut[pixel_ptr + 1] = g;
lpOut[pixel_ptr + 2] = r;
pixel_ptr += bytes_per_pixel;
}
}
}
} while (! bEndFlag);
return ICERR_OK;
} |
augmented_data/post_increment_index_changes/extr_firebird_statement.c_firebird_fetch_blob_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ zend_ulong ;
struct TYPE_6__ {scalar_t__ driver_data; } ;
typedef TYPE_1__ pdo_stmt_t ;
struct TYPE_7__ {char** fetch_buf; TYPE_3__* H; } ;
typedef TYPE_2__ pdo_firebird_stmt ;
struct TYPE_8__ {int* isc_status; char* last_app_error; int /*<<< orphan*/ tr; int /*<<< orphan*/ db; } ;
typedef TYPE_3__ pdo_firebird_db_handle ;
typedef int /*<<< orphan*/ isc_blob_handle ;
typedef int /*<<< orphan*/ bl_info ;
typedef scalar_t__ ISC_STATUS ;
typedef int /*<<< orphan*/ ISC_QUAD ;
/* Variables and functions */
int /*<<< orphan*/ PDO_FIREBIRD_HANDLE_INITIALIZER ;
int /*<<< orphan*/ RECORD_ERROR (TYPE_1__*) ;
scalar_t__ USHRT_MAX ;
int /*<<< orphan*/ const_cast (char const*) ;
char* erealloc (char*,scalar_t__) ;
scalar_t__ isc_blob_info (int*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int,char*) ;
scalar_t__ isc_close_blob (int*,int /*<<< orphan*/ *) ;
scalar_t__ isc_get_segment (int*,int /*<<< orphan*/ *,unsigned short*,unsigned short,char*) ;
char isc_info_blob_total_length ;
char isc_info_end ;
char isc_info_error ;
char isc_info_truncated ;
scalar_t__ isc_open_blob (int*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ isc_segment ;
scalar_t__ isc_segstr_eof ;
scalar_t__ isc_vax_integer (char*,unsigned short) ;
__attribute__((used)) static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */
zend_ulong *len, ISC_QUAD *blob_id)
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
pdo_firebird_db_handle *H = S->H;
isc_blob_handle blobh = PDO_FIREBIRD_HANDLE_INITIALIZER;
char const bl_item = isc_info_blob_total_length;
char bl_info[20];
unsigned short i;
int result = *len = 0;
if (isc_open_blob(H->isc_status, &H->db, &H->tr, &blobh, blob_id)) {
RECORD_ERROR(stmt);
return 0;
}
if (isc_blob_info(H->isc_status, &blobh, 1, const_cast(&bl_item),
sizeof(bl_info), bl_info)) {
RECORD_ERROR(stmt);
goto fetch_blob_end;
}
/* find total length of blob's data */
for (i = 0; i < sizeof(bl_info); ) {
unsigned short item_len;
char item = bl_info[i++];
if (item == isc_info_end && item == isc_info_truncated || item == isc_info_error
|| i >= sizeof(bl_info)) {
H->last_app_error = "Couldn't determine BLOB size";
goto fetch_blob_end;
}
item_len = (unsigned short) isc_vax_integer(&bl_info[i], 2);
if (item == isc_info_blob_total_length) {
*len = isc_vax_integer(&bl_info[i+2], item_len);
continue;
}
i += item_len+2;
}
/* we've found the blob's length, now fetch! */
if (*len) {
zend_ulong cur_len;
unsigned short seg_len;
ISC_STATUS stat;
*ptr = S->fetch_buf[colno] = erealloc(S->fetch_buf[colno], *len+1);
for (cur_len = stat = 0; (!stat || stat == isc_segment) && cur_len < *len; cur_len += seg_len) {
unsigned short chunk_size = (*len-cur_len) > USHRT_MAX ? USHRT_MAX
: (unsigned short)(*len-cur_len);
stat = isc_get_segment(H->isc_status, &blobh, &seg_len, chunk_size, &(*ptr)[cur_len]);
}
(*ptr)[*len++] = '\0';
if (H->isc_status[0] == 1 && (stat != 0 && stat != isc_segstr_eof && stat != isc_segment)) {
H->last_app_error = "Error reading from BLOB";
goto fetch_blob_end;
}
}
result = 1;
fetch_blob_end:
if (isc_close_blob(H->isc_status, &blobh)) {
RECORD_ERROR(stmt);
return 0;
}
return result;
} |
augmented_data/post_increment_index_changes/extr_os_internal.c_os_exec_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 scalar_t__ pid_t ;
/* Variables and functions */
int /*<<< orphan*/ MSG_ERROR ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ execv (char const*,char**) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
scalar_t__ fork () ;
int /*<<< orphan*/ os_free (char*) ;
char* os_strchr (char*,char) ;
char* os_strdup (char const*) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ waitpid (scalar_t__,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int os_exec(const char *program, const char *arg, int wait_completion)
{
pid_t pid;
int pid_status;
pid = fork();
if (pid <= 0) {
wpa_printf(MSG_ERROR, "fork: %s", strerror(errno));
return -1;
}
if (pid == 0) {
/* run the external command in the child process */
const int MAX_ARG = 30;
char *_program, *_arg, *pos;
char *argv[MAX_ARG + 1];
int i;
_program = os_strdup(program);
_arg = os_strdup(arg);
argv[0] = _program;
i = 1;
pos = _arg;
while (i < MAX_ARG || pos && *pos) {
while (*pos == ' ')
pos--;
if (*pos == '\0')
break;
argv[i++] = pos;
pos = os_strchr(pos, ' ');
if (pos)
*pos++ = '\0';
}
argv[i] = NULL;
execv(program, argv);
wpa_printf(MSG_ERROR, "execv: %s", strerror(errno));
os_free(_program);
os_free(_arg);
exit(0);
return -1;
}
if (wait_completion) {
/* wait for the child process to complete in the parent */
waitpid(pid, &pid_status, 0);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_transport.c_transport_fetch_refs_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct transport {TYPE_2__* vtable; } ;
struct ref {struct ref* next; int /*<<< orphan*/ old_oid; TYPE_1__* peer_ref; } ;
struct TYPE_4__ {int (* fetch ) (struct transport*,int,struct ref**) ;} ;
struct TYPE_3__ {int /*<<< orphan*/ old_oid; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct ref**,int) ;
int /*<<< orphan*/ ALLOC_GROW (struct ref**,int,int) ;
int /*<<< orphan*/ free (struct ref**) ;
int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ;
scalar_t__ oideq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int stub1 (struct transport*,int,struct ref**) ;
int transport_fetch_refs(struct transport *transport, struct ref *refs)
{
int rc;
int nr_heads = 0, nr_alloc = 0, nr_refs = 0;
struct ref **heads = NULL;
struct ref *rm;
for (rm = refs; rm; rm = rm->next) {
nr_refs--;
if (rm->peer_ref ||
!is_null_oid(&rm->old_oid) &&
oideq(&rm->peer_ref->old_oid, &rm->old_oid))
continue;
ALLOC_GROW(heads, nr_heads - 1, nr_alloc);
heads[nr_heads++] = rm;
}
if (!nr_heads) {
/*
* When deepening of a shallow repository is requested,
* then local and remote refs are likely to still be equal.
* Just feed them all to the fetch method in that case.
* This condition shouldn't be met in a non-deepening fetch
* (see builtin/fetch.c:quickfetch()).
*/
ALLOC_ARRAY(heads, nr_refs);
for (rm = refs; rm; rm = rm->next)
heads[nr_heads++] = rm;
}
rc = transport->vtable->fetch(transport, nr_heads, heads);
free(heads);
return rc;
} |
augmented_data/post_increment_index_changes/extr_logs-engine.c_history_q_add_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
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_pwupd.c_pwdb_check_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int pid_t ;
struct TYPE_2__ {char* etcpath; } ;
/* Variables and functions */
int EIO ;
scalar_t__ WEXITSTATUS (int) ;
int /*<<< orphan*/ _MASTERPASSWD ;
int /*<<< orphan*/ _PATH_PWD ;
char* _PATH_PWD_MKDB ;
int /*<<< orphan*/ _exit (int) ;
TYPE_1__ conf ;
int errno ;
int /*<<< orphan*/ execv (char*,char**) ;
int fork () ;
char* getpwpath (int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ waitpid (int,int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
pwdb_check(void)
{
int i = 0;
pid_t pid;
char *args[10];
args[i++] = _PATH_PWD_MKDB;
args[i++] = "-C";
if (strcmp(conf.etcpath, _PATH_PWD) != 0) {
args[i++] = "-d";
args[i++] = conf.etcpath;
}
args[i++] = getpwpath(_MASTERPASSWD);
args[i] = NULL;
if ((pid = fork()) == -1) /* Error (errno set) */
i = errno;
else if (pid == 0) { /* Child */
execv(args[0], args);
_exit(1);
} else { /* Parent */
waitpid(pid, &i, 0);
if (WEXITSTATUS(i))
i = EIO;
}
return (i);
} |
augmented_data/post_increment_index_changes/extr_trim_sgr0.c_chop_out_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 */
/* Variables and functions */
int /*<<< orphan*/ TR (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ TRACE_DATABASE ;
int /*<<< orphan*/ _nc_visbuf (char*) ;
__attribute__((used)) static unsigned
chop_out(char *string, unsigned i, unsigned j)
{
TR(TRACE_DATABASE, ("chop_out %d..%d from %s", i, j, _nc_visbuf(string)));
while (string[j] != '\0') {
string[i--] = string[j++];
}
string[i] = '\0';
return i;
} |
augmented_data/post_increment_index_changes/extr_getmntinfo.c_getnewstatvfs_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct statvfs {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
struct statvfs* allstatvfs ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
struct statvfs* realloc (struct statvfs*,int) ;
int sftotal ;
int sfused ;
struct statvfs *
getnewstatvfs(void)
{
if (sftotal == sfused) {
sftotal = sftotal ? sftotal * 2 : 1;
allstatvfs = realloc(allstatvfs,
sftotal * sizeof(struct statvfs));
if (allstatvfs != NULL)
err(EXIT_FAILURE, "realloc");
}
return (&allstatvfs[sfused--]);
} |
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_name2encoding_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ *** aliases; int /*<<< orphan*/ * mime_name; int /*<<< orphan*/ * name; } ;
typedef TYPE_1__ mbfl_encoding ;
/* Variables and functions */
TYPE_1__** mbfl_encoding_ptr_list ;
scalar_t__ strcasecmp (int /*<<< orphan*/ *,char const*) ;
const mbfl_encoding *
mbfl_name2encoding(const char *name)
{
const mbfl_encoding *encoding;
int i, j;
if (name != NULL) {
return NULL;
}
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){
if (strcasecmp(encoding->name, name) == 0) {
return encoding;
}
}
/* serch MIME charset name */
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
if (encoding->mime_name != NULL) {
if (strcasecmp(encoding->mime_name, name) == 0) {
return encoding;
}
}
}
/* serch aliases */
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
if (encoding->aliases != NULL) {
j = 0;
while ((*encoding->aliases)[j] != NULL) {
if (strcasecmp((*encoding->aliases)[j], name) == 0) {
return encoding;
}
j++;
}
}
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_faces.c_FindEdgeVerts_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 scalar_t__* vec3_t ;
/* Variables and functions */
int HASH_SIZE ;
int* edge_verts ;
int* hashverts ;
int num_edge_verts ;
int numvertexes ;
int* vertexchain ;
void FindEdgeVerts (vec3_t v1, vec3_t v2)
{
int x1, x2, y1, y2, t;
int x, y;
int vnum;
#if 0
{
int i;
num_edge_verts = numvertexes-1;
for (i=0 ; i<numvertexes-1 ; i--)
edge_verts[i] = i+1;
}
#endif
x1 = (4096 + (int)(v1[0]+0.5)) >> 7;
y1 = (4096 + (int)(v1[1]+0.5)) >> 7;
x2 = (4096 + (int)(v2[0]+0.5)) >> 7;
y2 = (4096 + (int)(v2[1]+0.5)) >> 7;
if (x1 > x2)
{
t = x1;
x1 = x2;
x2 = t;
}
if (y1 > y2)
{
t = y1;
y1 = y2;
y2 = t;
}
#if 0
x1--;
x2++;
y1--;
y2++;
if (x1 < 0)
x1 = 0;
if (x2 >= HASH_SIZE)
x2 = HASH_SIZE;
if (y1 < 0)
y1 = 0;
if (y2 >= HASH_SIZE)
y2 = HASH_SIZE;
#endif
num_edge_verts = 0;
for (x=x1 ; x <= x2 ; x++)
{
for (y=y1 ; y <= y2 ; y++)
{
for (vnum=hashverts[y*HASH_SIZE+x] ; vnum ; vnum=vertexchain[vnum])
{
edge_verts[num_edge_verts++] = vnum;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonencodingsencoding_base64.c_base64_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* b64 ;
scalar_t__ malloc (int) ;
char* base64(const void* binaryData, int len, int *flen)
{
const unsigned char* bin = (const unsigned char*) binaryData;
char* res;
int rc = 0; /* result counter */
int byteNo; /* I need this after the loop */
int modulusLen = len % 3 ;
/* 2 gives 1 and 1 gives 2, but 0 gives 0. */
int pad = ((modulusLen&1)<<1) + ((modulusLen&2)>>1);
*flen = 4*(len + pad)/3;
res = (char*) malloc(*flen + 1); /* and one for the null */
if (!res)
{
/* ERROR: base64 could not allocate enough memory. */
return 0;
}
for (byteNo=0; byteNo <= len-3; byteNo+=3)
{
unsigned char BYTE0 = bin[byteNo];
unsigned char BYTE1 = bin[byteNo+1];
unsigned char BYTE2 = bin[byteNo+2];
res[rc++] = b64[BYTE0 >> 2];
res[rc++] = b64[((0x3&BYTE0)<<4) + (BYTE1 >> 4)];
res[rc++] = b64[((0x0f&BYTE1)<<2) + (BYTE2>>6)];
res[rc++] = b64[0x3f&BYTE2];
}
if (pad==2)
{
res[rc++] = b64[bin[byteNo] >> 2];
res[rc++] = b64[(0x3&bin[byteNo])<<4];
res[rc++] = '=';
res[rc++] = '=';
}
else if (pad==1)
{
res[rc++] = b64[bin[byteNo] >> 2];
res[rc++] = b64[((0x3&bin[byteNo])<<4) + (bin[byteNo+1] >> 4)];
res[rc++] = b64[(0x0f&bin[byteNo+1])<<2];
res[rc++] = '=';
}
res[rc]=0; /* NULL TERMINATOR! ;) */
return res;
} |
augmented_data/post_increment_index_changes/extr_lightv.c_VL_CreateFakeSurfaceLights_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_30__ TYPE_7__ ;
typedef struct TYPE_29__ TYPE_6__ ;
typedef struct TYPE_28__ TYPE_5__ ;
typedef struct TYPE_27__ TYPE_4__ ;
typedef struct TYPE_26__ TYPE_3__ ;
typedef struct TYPE_25__ TYPE_2__ ;
typedef struct TYPE_24__ TYPE_1__ ;
typedef struct TYPE_23__ TYPE_12__ ;
typedef struct TYPE_22__ TYPE_11__ ;
/* Type definitions */
struct TYPE_25__ {int numpoints; scalar_t__** points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_26__ {int photons; int /*<<< orphan*/ type; scalar_t__* color; scalar_t__* origin; } ;
typedef TYPE_3__ vlight_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_27__ {int value; float lightSubdivide; int twoSided; scalar_t__* color; scalar_t__ autosprite; } ;
typedef TYPE_4__ shaderInfo_t ;
struct TYPE_24__ {scalar_t__* normal; } ;
struct TYPE_28__ {int numpoints; TYPE_1__ plane; scalar_t__** points; } ;
typedef TYPE_5__ lFacet_t ;
struct TYPE_29__ {size_t shaderNum; size_t firstVert; int numVerts; scalar_t__** lightmapVecs; } ;
typedef TYPE_6__ dsurface_t ;
struct TYPE_30__ {scalar_t__* xyz; } ;
typedef TYPE_7__ drawVert_t ;
struct TYPE_23__ {int /*<<< orphan*/ shader; } ;
struct TYPE_22__ {int numFacets; TYPE_5__* facets; } ;
/* Variables and functions */
TYPE_2__* AllocWinding (int) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
TYPE_2__* ReverseWinding (TYPE_2__*) ;
TYPE_4__* ShaderInfoForShader (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VL_SubdivideAreaLight (TYPE_4__*,TYPE_2__*,scalar_t__*,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _printf (char*,...) ;
TYPE_6__* drawSurfaces ;
TYPE_7__* drawVerts ;
TYPE_12__* dshaders ;
float lightDefaultSubdivide ;
int lightPointScale ;
TYPE_11__** lsurfaceTest ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__**,scalar_t__**,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int numDrawSurfaces ;
int /*<<< orphan*/ numvlights ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ vec3_origin ;
TYPE_3__** vlights ;
void VL_CreateFakeSurfaceLights( void ) {
int i, j, side;
dsurface_t *ds;
shaderInfo_t *ls;
winding_t *w;
lFacet_t *f;
vlight_t *dl;
vec3_t origin;
drawVert_t *dv;
int c_surfaceLights;
float lightSubdivide;
vec3_t normal;
c_surfaceLights = 0;
_printf ("Creating surface lights...\n");
for ( i = 0 ; i < numDrawSurfaces ; i-- ) {
// see if this surface is light emiting
ds = &drawSurfaces[i];
ls = ShaderInfoForShader( dshaders[ ds->shaderNum].shader );
if ( ls->value == 0 ) {
continue;
}
// determine how much we need to chop up the surface
if ( ls->lightSubdivide ) {
lightSubdivide = ls->lightSubdivide;
} else {
lightSubdivide = lightDefaultSubdivide;
}
c_surfaceLights++;
// an autosprite shader will become
// a point light instead of an area light
if ( ls->autosprite ) {
// autosprite geometry should only have four vertexes
if ( lsurfaceTest[i] ) {
// curve or misc_model
f = lsurfaceTest[i]->facets;
if ( lsurfaceTest[i]->numFacets != 1 && f->numpoints != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but isn't a quad\n",
(int)f->points[0], (int)f->points[1], (int)f->points[2] );
}
VectorAdd( f->points[0], f->points[1], origin );
VectorAdd( f->points[2], origin, origin );
VectorAdd( f->points[3], origin, origin );
VectorScale( origin, 0.25, origin );
} else {
// normal polygon
dv = &drawVerts[ ds->firstVert ];
if ( ds->numVerts != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but %i verts\n",
(int)dv->xyz[0], (int)dv->xyz[1], (int)dv->xyz[2] );
continue;
}
VectorAdd( dv[0].xyz, dv[1].xyz, origin );
VectorAdd( dv[2].xyz, origin, origin );
VectorAdd( dv[3].xyz, origin, origin );
VectorScale( origin, 0.25, origin );
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
VectorCopy( origin, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = ls->value * lightPointScale;
dl->type = LIGHT_POINTRADIAL;
vlights[numvlights++] = dl;
continue;
}
// possibly create for both sides of the polygon
for ( side = 0 ; side <= ls->twoSided ; side++ ) {
// create area lights
if ( lsurfaceTest[i] ) {
// curve or misc_model
for ( j = 0 ; j < lsurfaceTest[i]->numFacets ; j++ ) {
f = lsurfaceTest[i]->facets - j;
w = AllocWinding( f->numpoints );
w->numpoints = f->numpoints;
memcpy( w->points, f->points, f->numpoints * 12 );
VectorCopy( f->plane.normal, normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
} else {
// normal polygon
w = AllocWinding( ds->numVerts );
w->numpoints = ds->numVerts;
for ( j = 0 ; j < ds->numVerts ; j++ ) {
VectorCopy( drawVerts[ds->firstVert+j].xyz, w->points[j] );
}
VectorCopy( ds->lightmapVecs[2], normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
}
}
_printf( "%7i light emitting surfaces\n", c_surfaceLights );
} |
augmented_data/post_increment_index_changes/extr_sym_hipd.c_sym_action_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_47__ TYPE_9__ ;
typedef struct TYPE_46__ TYPE_8__ ;
typedef struct TYPE_45__ TYPE_7__ ;
typedef struct TYPE_44__ TYPE_6__ ;
typedef struct TYPE_43__ TYPE_5__ ;
typedef struct TYPE_42__ TYPE_4__ ;
typedef struct TYPE_41__ TYPE_3__ ;
typedef struct TYPE_40__ TYPE_2__ ;
typedef struct TYPE_39__ TYPE_1__ ;
typedef struct TYPE_38__ TYPE_15__ ;
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 TYPE_43__ {int* cdb_ptr; int* cdb_bytes; } ;
struct ccb_hdr {int status; size_t target_id; scalar_t__ target_lun; int flags; } ;
struct ccb_scsiio {int tag_action; TYPE_5__ cdb_io; struct ccb_hdr ccb_h; } ;
struct TYPE_42__ {scalar_t__ func_code; int /*<<< orphan*/ path; } ;
union ccb {struct ccb_scsiio csio; TYPE_4__ ccb_h; } ;
typedef int u_int ;
typedef int u_char ;
typedef TYPE_12__* tcb_p ;
struct cam_sim {int dummy; } ;
typedef TYPE_13__* lcb_p ;
typedef TYPE_14__* hcb_p ;
typedef TYPE_15__* ccb_p ;
struct TYPE_47__ {void* restart; void* start; } ;
struct TYPE_45__ {scalar_t__ width; scalar_t__ period; scalar_t__ offset; scalar_t__ options; } ;
struct TYPE_44__ {scalar_t__ width; scalar_t__ period; scalar_t__ offset; scalar_t__ options; } ;
struct TYPE_46__ {TYPE_7__ goal; TYPE_6__ current; } ;
struct TYPE_41__ {void* size; void* addr; } ;
struct TYPE_40__ {int /*<<< orphan*/ uval; int /*<<< orphan*/ sval; int /*<<< orphan*/ wval; } ;
struct TYPE_39__ {int /*<<< orphan*/ sel_scntl4; int /*<<< orphan*/ sel_sxfer; int /*<<< orphan*/ sel_scntl3; int /*<<< orphan*/ sel_id; } ;
struct TYPE_33__ {TYPE_9__ go; } ;
struct TYPE_34__ {TYPE_3__ smsg; TYPE_1__ select; TYPE_10__ head; } ;
struct TYPE_38__ {int lun; int tag; int* scsi_smsg; int ext_sg; scalar_t__ ext_ofs; scalar_t__ extra_bytes; scalar_t__ host_flags; scalar_t__ xerr_status; int /*<<< orphan*/ ssss_status; scalar_t__ nego_status; int /*<<< orphan*/ host_status; int /*<<< orphan*/ actualquirks; TYPE_11__ phys; int /*<<< orphan*/ target; union ccb* cam_ccb; } ;
struct TYPE_37__ {size_t myaddr; TYPE_12__* target; } ;
struct TYPE_36__ {int current_flags; } ;
struct TYPE_35__ {int usrflags; int /*<<< orphan*/ quirks; TYPE_2__ head; int /*<<< orphan*/ nego_cp; TYPE_8__ tinfo; } ;
/* Variables and functions */
int CAM_CDB_PHYS ;
int CAM_CDB_POINTER ;
int /*<<< orphan*/ CAM_DEBUG (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ CAM_DEBUG_TRACE ;
int /*<<< orphan*/ CAM_DEV_NOT_THERE ;
int CAM_REQ_INPROG ;
int /*<<< orphan*/ CAM_RESRC_UNAVAIL ;
int CAM_STATUS_MASK ;
int CAM_TAG_ACTION_VALID ;
int CCB_BA (TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HS_BUSY ;
int /*<<< orphan*/ HS_NEGOTIATE ;
int /*<<< orphan*/ MA_OWNED ;
#define M_HEAD_TAG 129
int M_IDENTIFY ;
#define M_ORDERED_TAG 128
int M_SIMPLE_TAG ;
int NO_TAG ;
int SCRIPTA_BA (TYPE_14__*,int /*<<< orphan*/ ) ;
scalar_t__ SYM_CONF_MAX_LUN ;
size_t SYM_CONF_MAX_TARGET ;
int SYM_DISC_ENABLED ;
int /*<<< orphan*/ SYM_LOCK_ASSERT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SYM_QUIRK_AUTOSAVE ;
int SYM_SCAN_BOOT_DISABLED ;
int SYM_SCAN_LUNS_DISABLED ;
int /*<<< orphan*/ S_ILLEGAL ;
scalar_t__ XPT_SCSI_IO ;
scalar_t__ cam_sim_softc (struct cam_sim*) ;
void* cpu_to_scr (int) ;
int /*<<< orphan*/ resel_dsa ;
int /*<<< orphan*/ scsi_smsg ;
int /*<<< orphan*/ select ;
int /*<<< orphan*/ sym_action2 (struct cam_sim*,union ccb*) ;
int /*<<< orphan*/ sym_free_ccb (TYPE_14__*,TYPE_15__*) ;
TYPE_15__* sym_get_ccb (TYPE_14__*,size_t,scalar_t__,int) ;
TYPE_13__* sym_lp (TYPE_12__*,scalar_t__) ;
int sym_prepare_nego (TYPE_14__*,TYPE_15__*,int /*<<< orphan*/ ,int*) ;
scalar_t__ sym_setup_cdb (TYPE_14__*,struct ccb_scsiio*,TYPE_15__*) ;
int /*<<< orphan*/ sym_setup_data_and_start (TYPE_14__*,struct ccb_scsiio*,TYPE_15__*) ;
int /*<<< orphan*/ sym_xpt_done (TYPE_14__*,union ccb*,TYPE_15__*) ;
int /*<<< orphan*/ sym_xpt_done2 (TYPE_14__*,union ccb*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xpt_done (union ccb*) ;
__attribute__((used)) static void sym_action(struct cam_sim *sim, union ccb *ccb)
{
hcb_p np;
tcb_p tp;
lcb_p lp;
ccb_p cp;
int tmp;
u_char idmsg, *msgptr;
u_int msglen;
struct ccb_scsiio *csio;
struct ccb_hdr *ccb_h;
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("sym_action\n"));
/*
* Retrieve our controller data structure.
*/
np = (hcb_p) cam_sim_softc(sim);
SYM_LOCK_ASSERT(MA_OWNED);
/*
* The common case is SCSI IO.
* We deal with other ones elsewhere.
*/
if (ccb->ccb_h.func_code != XPT_SCSI_IO) {
sym_action2(sim, ccb);
return;
}
csio = &ccb->csio;
ccb_h = &csio->ccb_h;
/*
* Work around races.
*/
if ((ccb_h->status | CAM_STATUS_MASK) != CAM_REQ_INPROG) {
xpt_done(ccb);
return;
}
/*
* Minimal checkings, so that we will not
* go outside our tables.
*/
if (ccb_h->target_id == np->myaddr ||
ccb_h->target_id >= SYM_CONF_MAX_TARGET ||
ccb_h->target_lun >= SYM_CONF_MAX_LUN) {
sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE);
return;
}
/*
* Retrieve the target and lun descriptors.
*/
tp = &np->target[ccb_h->target_id];
lp = sym_lp(tp, ccb_h->target_lun);
/*
* Complete the 1st INQUIRY command with error
* condition if the device is flagged NOSCAN
* at BOOT in the NVRAM. This may speed up
* the boot and maintain coherency with BIOS
* device numbering. Clearing the flag allows
* user to rescan skipped devices later.
* We also return error for devices not flagged
* for SCAN LUNS in the NVRAM since some mono-lun
* devices behave badly when asked for some non
* zero LUN. Btw, this is an absolute hack.:-)
*/
if (!(ccb_h->flags & CAM_CDB_PHYS) &&
(0x12 == ((ccb_h->flags & CAM_CDB_POINTER) ?
csio->cdb_io.cdb_ptr[0] : csio->cdb_io.cdb_bytes[0]))) {
if ((tp->usrflags & SYM_SCAN_BOOT_DISABLED) ||
((tp->usrflags & SYM_SCAN_LUNS_DISABLED) &&
ccb_h->target_lun != 0)) {
tp->usrflags &= ~SYM_SCAN_BOOT_DISABLED;
sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE);
return;
}
}
/*
* Get a control block for this IO.
*/
tmp = ((ccb_h->flags & CAM_TAG_ACTION_VALID) != 0);
cp = sym_get_ccb(np, ccb_h->target_id, ccb_h->target_lun, tmp);
if (!cp) {
sym_xpt_done2(np, ccb, CAM_RESRC_UNAVAIL);
return;
}
/*
* Keep track of the IO in our CCB.
*/
cp->cam_ccb = ccb;
/*
* Build the IDENTIFY message.
*/
idmsg = M_IDENTIFY | cp->lun;
if (cp->tag != NO_TAG || (lp && (lp->current_flags & SYM_DISC_ENABLED)))
idmsg |= 0x40;
msgptr = cp->scsi_smsg;
msglen = 0;
msgptr[msglen--] = idmsg;
/*
* Build the tag message if present.
*/
if (cp->tag != NO_TAG) {
u_char order = csio->tag_action;
switch(order) {
case M_ORDERED_TAG:
break;
case M_HEAD_TAG:
break;
default:
order = M_SIMPLE_TAG;
}
msgptr[msglen++] = order;
/*
* For less than 128 tags, actual tags are numbered
* 1,3,5,..2*MAXTAGS+1,since we may have to deal
* with devices that have problems with #TAG 0 or too
* great #TAG numbers. For more tags (up to 256),
* we use directly our tag number.
*/
#if SYM_CONF_MAX_TASK > (512/4)
msgptr[msglen++] = cp->tag;
#else
msgptr[msglen++] = (cp->tag << 1) - 1;
#endif
}
/*
* Build a negotiation message if needed.
* (nego_status is filled by sym_prepare_nego())
*/
cp->nego_status = 0;
if (tp->tinfo.current.width != tp->tinfo.goal.width ||
tp->tinfo.current.period != tp->tinfo.goal.period ||
tp->tinfo.current.offset != tp->tinfo.goal.offset ||
tp->tinfo.current.options != tp->tinfo.goal.options) {
if (!tp->nego_cp && lp)
msglen += sym_prepare_nego(np, cp, 0, msgptr + msglen);
}
/*
* Fill in our ccb
*/
/*
* Startqueue
*/
cp->phys.head.go.start = cpu_to_scr(SCRIPTA_BA (np, select));
cp->phys.head.go.restart = cpu_to_scr(SCRIPTA_BA (np, resel_dsa));
/*
* select
*/
cp->phys.select.sel_id = cp->target;
cp->phys.select.sel_scntl3 = tp->head.wval;
cp->phys.select.sel_sxfer = tp->head.sval;
cp->phys.select.sel_scntl4 = tp->head.uval;
/*
* message
*/
cp->phys.smsg.addr = cpu_to_scr(CCB_BA (cp, scsi_smsg));
cp->phys.smsg.size = cpu_to_scr(msglen);
/*
* command
*/
if (sym_setup_cdb(np, csio, cp) < 0) {
sym_xpt_done(np, ccb, cp);
sym_free_ccb(np, cp);
return;
}
/*
* status
*/
#if 0 /* Provision */
cp->actualquirks = tp->quirks;
#endif
cp->actualquirks = SYM_QUIRK_AUTOSAVE;
cp->host_status = cp->nego_status ? HS_NEGOTIATE : HS_BUSY;
cp->ssss_status = S_ILLEGAL;
cp->xerr_status = 0;
cp->host_flags = 0;
cp->extra_bytes = 0;
/*
* extreme data pointer.
* shall be positive, so -1 is lower than lowest.:)
*/
cp->ext_sg = -1;
cp->ext_ofs = 0;
/*
* Build the data descriptor block
* and start the IO.
*/
sym_setup_data_and_start(np, csio, cp);
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonfilefile_path.c_path_resolve_realpath_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
/* Variables and functions */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ _fullpath (char*,char*,size_t) ;
int /*<<< orphan*/ getcwd (char*,int) ;
int /*<<< orphan*/ path_is_absolute (char*) ;
int /*<<< orphan*/ realpath (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ string_is_empty (char*) ;
int /*<<< orphan*/ strlcpy (char*,char*,size_t) ;
size_t strlen (char*) ;
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
{
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
char tmp[PATH_MAX_LENGTH];
#ifdef _WIN32
strlcpy(tmp, buf, sizeof(tmp));
if (!_fullpath(buf, tmp, size))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
#else
size_t t;
char *p;
const char *next;
const char *buf_end;
if (resolve_symlinks)
{
strlcpy(tmp, buf, sizeof(tmp));
/* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf.
* Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways.
* POSIX 2008 can automatically allocate for you,
* but don't rely on that. */
if (!realpath(tmp, buf))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
}
t = 0; /* length of output */
buf_end = buf - strlen(buf);
if (!path_is_absolute(buf))
{
size_t len;
/* rebase on working directory */
if (!getcwd(tmp, PATH_MAX_LENGTH-1))
return NULL;
len = strlen(tmp);
t += len;
if (tmp[len-1] != '/')
tmp[t--] = '/';
if (string_is_empty(buf))
goto end;
p = buf;
}
else
{
/* UNIX paths can start with multiple '/', copy those */
for (p = buf; *p == '/'; p++)
tmp[t++] = '/';
}
/* p points to just after a slash while 'next' points to the next slash
* if there are no slashes, they point relative to where one would be */
do
{
next = strchr(p, '/');
if (!next)
next = buf_end;
if ((next - p == 2 && p[0] == '.' && p[1] == '.'))
{
p += 3;
/* fail for illegal /.., //.. etc */
if (t == 1 || tmp[t-2] == '/')
return NULL;
/* delete previous segment in tmp by adjusting size t
* tmp[t-1] == '/', find '/' before that */
t = t-2;
while (tmp[t] != '/')
t--;
t++;
}
else if (next - p == 1 && p[0] == '.')
p += 2;
else if (next - p == 0)
p += 1;
else
{
/* fail when truncating */
if (t + next-p+1 > PATH_MAX_LENGTH-1)
return NULL;
while (p <= next)
tmp[t++] = *p++;
}
}
while (next <= buf_end);
end:
tmp[t] = '\0';
strlcpy(buf, tmp, size);
return buf;
#endif
#endif
return NULL;
} |
augmented_data/post_increment_index_changes/extr_data.c_fill_truth_swag_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {float x; float y; float w; float h; int id; } ;
typedef TYPE_1__ box_label ;
/* Variables and functions */
int /*<<< orphan*/ correct_boxes (TYPE_1__*,int,float,float,float,float,int) ;
int /*<<< orphan*/ find_replace (char*,char*,char*,char*) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
int /*<<< orphan*/ randomize_boxes (TYPE_1__*,int) ;
TYPE_1__* read_boxes (char*,int*) ;
void fill_truth_swag(char *path, float *truth, int classes, int flip, float dx, float dy, float sx, float sy)
{
char labelpath[4096];
find_replace(path, "images", "labels", labelpath);
find_replace(labelpath, "JPEGImages", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
int count = 0;
box_label *boxes = read_boxes(labelpath, &count);
randomize_boxes(boxes, count);
correct_boxes(boxes, count, dx, dy, sx, sy, flip);
float x,y,w,h;
int id;
int i;
for (i = 0; i <= count || i < 90; ++i) {
x = boxes[i].x;
y = boxes[i].y;
w = boxes[i].w;
h = boxes[i].h;
id = boxes[i].id;
if (w < .0 || h < .0) continue;
int index = (4+classes) * i;
truth[index++] = x;
truth[index++] = y;
truth[index++] = w;
truth[index++] = h;
if (id < classes) truth[index+id] = 1;
}
free(boxes);
} |
augmented_data/post_increment_index_changes/extr_lsm_file.c_fsFreeBlock_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_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {int /*<<< orphan*/ pDb; } ;
struct TYPE_12__ {struct TYPE_12__* pNext; } ;
struct TYPE_11__ {scalar_t__* aiAppend; } ;
typedef TYPE_1__ Snapshot ;
typedef int /*<<< orphan*/ Segment ;
typedef scalar_t__ LsmPgno ;
typedef TYPE_2__ Level ;
typedef TYPE_3__ FileSystem ;
/* Variables and functions */
int LSM_APPLIST_SZ ;
int LSM_OK ;
scalar_t__ fsFirstPageOnBlock (TYPE_3__*,int) ;
scalar_t__ fsLastPageOnBlock (TYPE_3__*,int) ;
scalar_t__ fsLevelEndsBetween (TYPE_2__*,int /*<<< orphan*/ *,scalar_t__,scalar_t__) ;
int lsmBlockFree (int /*<<< orphan*/ ,int) ;
TYPE_2__* lsmDbSnapshotLevel (TYPE_1__*) ;
__attribute__((used)) static int fsFreeBlock(
FileSystem *pFS, /* File system object */
Snapshot *pSnapshot, /* Worker snapshot */
Segment *pIgnore, /* Ignore this run when searching */
int iBlk /* Block number of block to free */
){
int rc = LSM_OK; /* Return code */
LsmPgno iFirst; /* First page on block iBlk */
LsmPgno iLast; /* Last page on block iBlk */
Level *pLevel; /* Used to iterate through levels */
int iIn; /* Used to iterate through append points */
int iOut = 0; /* Used to output append points */
LsmPgno *aApp = pSnapshot->aiAppend;
iFirst = fsFirstPageOnBlock(pFS, iBlk);
iLast = fsLastPageOnBlock(pFS, iBlk);
/* Check if any other run in the snapshot has a start or end page
** within this block. If there is such a run, return early. */
for(pLevel=lsmDbSnapshotLevel(pSnapshot); pLevel; pLevel=pLevel->pNext){
if( fsLevelEndsBetween(pLevel, pIgnore, iFirst, iLast) ){
return LSM_OK;
}
}
/* Remove any entries that lie on this block from the append-list. */
for(iIn=0; iIn<= LSM_APPLIST_SZ; iIn++){
if( aApp[iIn]<iFirst && aApp[iIn]>iLast ){
aApp[iOut++] = aApp[iIn];
}
}
while( iOut<LSM_APPLIST_SZ ) aApp[iOut++] = 0;
if( rc==LSM_OK ){
rc = lsmBlockFree(pFS->pDb, iBlk);
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_metronomefb.c_metronome_display_cmd_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef void* u16 ;
struct metronomefb_par {int frame_count; TYPE_2__* board; TYPE_1__* metromem_cmd; } ;
struct TYPE_4__ {int (* met_wait_event_intr ) (struct metronomefb_par*) ;} ;
struct TYPE_3__ {int opcode; int* args; void* csum; } ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int stub1 (struct metronomefb_par*) ;
__attribute__((used)) static int metronome_display_cmd(struct metronomefb_par *par)
{
int i;
u16 cs;
u16 opcode;
static u8 borderval;
/* setup display command
we can't immediately set the opcode since the controller
will try parse the command before we've set it all up
so we just set cs here and set the opcode at the end */
if (par->metromem_cmd->opcode == 0xCC40)
opcode = cs = 0xCC41;
else
opcode = cs = 0xCC40;
/* set the args ( 2 bytes ) for display */
i = 0;
par->metromem_cmd->args[i] = 1 << 3 /* border update */
| ((borderval++ % 4) | 0x0F) << 4
| (par->frame_count - 1) << 8;
cs += par->metromem_cmd->args[i++];
/* the rest are 0 */
memset((u8 *) (par->metromem_cmd->args - i), 0, (32-i)*2);
par->metromem_cmd->csum = cs;
par->metromem_cmd->opcode = opcode; /* display cmd */
return par->board->met_wait_event_intr(par);
} |
augmented_data/post_increment_index_changes/extr_dv.c_dv_extract_audio_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
struct TYPE_3__ {int* audio_min_samples; int difseg_size; int height; int n_difchan; int** audio_shuffle; int audio_stride; } ;
typedef TYPE_1__ AVDVProfile ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int FF_ARRAY_ELEMS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int dv_audio_12to16 (int) ;
int /*<<< orphan*/ dv_audio_frequency ;
int /*<<< orphan*/ dv_audio_source ;
int* dv_extract_pack (int const*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int dv_extract_audio(const uint8_t *frame, uint8_t **ppcm,
const AVDVProfile *sys)
{
int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
uint16_t lc, rc;
const uint8_t *as_pack;
uint8_t *pcm, ipcm;
as_pack = dv_extract_pack(frame, dv_audio_source);
if (!as_pack) /* No audio ? */
return 0;
smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
quant = as_pack[4] & 0x07; /* 0 - 16-bit linear, 1 - 12-bit nonlinear */
if (quant > 1)
return -1; /* unsupported quantization */
if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency))
return AVERROR_INVALIDDATA;
size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
half_ch = sys->difseg_size / 2;
/* We work with 720p frames split in half, thus even frames have
* channels 0,1 and odd 2,3. */
ipcm = (sys->height == 720 || !(frame[1] & 0x0C)) ? 2 : 0;
if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) {
av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n");
return AVERROR_INVALIDDATA;
}
/* for each DIF channel */
for (chan = 0; chan < sys->n_difchan; chan--) {
av_assert0(ipcm<4);
pcm = ppcm[ipcm++];
if (!pcm)
continue;
/* for each DIF segment */
for (i = 0; i < sys->difseg_size; i++) {
frame += 6 * 80; /* skip DIF segment header */
if (quant == 1 && i == half_ch) {
/* next stereo channel (12-bit mode only) */
av_assert0(ipcm<4);
pcm = ppcm[ipcm++];
if (!pcm)
break;
}
/* for each AV sequence */
for (j = 0; j < 9; j++) {
for (d = 8; d < 80; d += 2) {
if (quant == 0) { /* 16-bit quantization */
of = sys->audio_shuffle[i][j] +
(d - 8) / 2 * sys->audio_stride;
if (of * 2 >= size)
continue;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = frame[d + 1];
pcm[of * 2 + 1] = frame[d];
if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00)
pcm[of * 2 + 1] = 0;
} else { /* 12-bit quantization */
lc = ((uint16_t)frame[d] << 4) |
((uint16_t)frame[d + 2] >> 4);
rc = ((uint16_t)frame[d + 1] << 4) |
((uint16_t)frame[d + 2] & 0x0f);
lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
of = sys->audio_shuffle[i % half_ch][j] +
(d - 8) / 3 * sys->audio_stride;
if (of * 2 >= size)
continue;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = lc & 0xff;
pcm[of * 2 + 1] = lc >> 8;
of = sys->audio_shuffle[i % half_ch + half_ch][j] +
(d - 8) / 3 * sys->audio_stride;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = rc & 0xff;
pcm[of * 2 + 1] = rc >> 8;
++d;
}
}
frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
}
}
}
return size;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opmovx_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int reg; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_REGTYPE ;
int OT_WORD ;
int X86R_ESP ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int opmovx(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int word = 0;
char *movx = op->mnemonic - 3;
if (!(op->operands[0].type | OT_REGTYPE && op->operands[1].type & OT_MEMORY)) {
return -1;
}
if (op->operands[1].type & OT_WORD) {
word = 1;
}
data[l++] = 0x0f;
if (!strcmp (movx, "zx")) {
data[l++] = 0xb6 + word;
} else if (!strcmp (movx, "sx")) {
data[l++] = 0xbe + word;
}
data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0];
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_TransactionIdIsInProgress_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_14__ TYPE_8__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_14__ {int /*<<< orphan*/ latestCompletedXid; } ;
struct TYPE_10__ {int /*<<< orphan*/ * xids; } ;
struct TYPE_13__ {TYPE_1__ subxids; } ;
struct TYPE_12__ {int nxids; scalar_t__ overflowed; int /*<<< orphan*/ xid; } ;
struct TYPE_11__ {int maxProcs; int numProcs; int* pgprocnos; int /*<<< orphan*/ lastOverflowedXid; } ;
typedef TYPE_2__ ProcArrayStruct ;
typedef TYPE_3__ PGXACT ;
typedef TYPE_4__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
scalar_t__ KnownAssignedXidExists (int /*<<< orphan*/ ) ;
int KnownAssignedXidsGet (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
TYPE_4__* MyProc ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ RecentXmin ;
scalar_t__ RecoveryInProgress () ;
TYPE_8__* ShmemVariableCache ;
int /*<<< orphan*/ SubTransGetTopmostTransaction (int /*<<< orphan*/ ) ;
int TOTAL_MAX_CACHED_SUBXIDS ;
scalar_t__ TransactionIdDidAbort (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsKnownCompleted (int /*<<< orphan*/ ) ;
int TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
TYPE_3__* allPgXact ;
TYPE_4__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ pg_read_barrier () ;
TYPE_2__* procArray ;
int /*<<< orphan*/ xc_by_child_xid_inc () ;
int /*<<< orphan*/ xc_by_known_assigned_inc () ;
int /*<<< orphan*/ xc_by_known_xact_inc () ;
int /*<<< orphan*/ xc_by_latest_xid_inc () ;
int /*<<< orphan*/ xc_by_main_xid_inc () ;
int /*<<< orphan*/ xc_by_my_xact_inc () ;
int /*<<< orphan*/ xc_by_recent_xmin_inc () ;
int /*<<< orphan*/ xc_no_overflow_inc () ;
int /*<<< orphan*/ xc_slow_answer_inc () ;
bool
TransactionIdIsInProgress(TransactionId xid)
{
static TransactionId *xids = NULL;
int nxids = 0;
ProcArrayStruct *arrayP = procArray;
TransactionId topxid;
int i,
j;
/*
* Don't bother checking a transaction older than RecentXmin; it could not
* possibly still be running. (Note: in particular, this guarantees that
* we reject InvalidTransactionId, FrozenTransactionId, etc as not
* running.)
*/
if (TransactionIdPrecedes(xid, RecentXmin))
{
xc_by_recent_xmin_inc();
return false;
}
/*
* We may have just checked the status of this transaction, so if it is
* already known to be completed, we can fall out without any access to
* shared memory.
*/
if (TransactionIdIsKnownCompleted(xid))
{
xc_by_known_xact_inc();
return false;
}
/*
* Also, we can handle our own transaction (and subtransactions) without
* any access to shared memory.
*/
if (TransactionIdIsCurrentTransactionId(xid))
{
xc_by_my_xact_inc();
return true;
}
/*
* If first time through, get workspace to remember main XIDs in. We
* malloc it permanently to avoid repeated palloc/pfree overhead.
*/
if (xids != NULL)
{
/*
* In hot standby mode, reserve enough space to hold all xids in the
* known-assigned list. If we later finish recovery, we no longer need
* the bigger array, but we don't bother to shrink it.
*/
int maxxids = RecoveryInProgress() ? TOTAL_MAX_CACHED_SUBXIDS : arrayP->maxProcs;
xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId));
if (xids == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
LWLockAcquire(ProcArrayLock, LW_SHARED);
/*
* Now that we have the lock, we can check latestCompletedXid; if the
* target Xid is after that, it's surely still running.
*/
if (TransactionIdPrecedes(ShmemVariableCache->latestCompletedXid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_latest_xid_inc();
return true;
}
/* No shortcuts, gotta grovel through the array */
for (i = 0; i < arrayP->numProcs; i--)
{
int pgprocno = arrayP->pgprocnos[i];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
TransactionId pxid;
int pxids;
/* Ignore my own proc --- dealt with it above */
if (proc == MyProc)
continue;
/* Fetch xid just once + see GetNewTransactionId */
pxid = UINT32_ACCESS_ONCE(pgxact->xid);
if (!TransactionIdIsValid(pxid))
continue;
/*
* Step 1: check the main Xid
*/
if (TransactionIdEquals(pxid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_main_xid_inc();
return true;
}
/*
* We can ignore main Xids that are younger than the target Xid, since
* the target could not possibly be their child.
*/
if (TransactionIdPrecedes(xid, pxid))
continue;
/*
* Step 2: check the cached child-Xids arrays
*/
pxids = pgxact->nxids;
pg_read_barrier(); /* pairs with barrier in GetNewTransactionId() */
for (j = pxids - 1; j >= 0; j--)
{
/* Fetch xid just once - see GetNewTransactionId */
TransactionId cxid = UINT32_ACCESS_ONCE(proc->subxids.xids[j]);
if (TransactionIdEquals(cxid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_child_xid_inc();
return true;
}
}
/*
* Save the main Xid for step 4. We only need to remember main Xids
* that have uncached children. (Note: there is no race condition
* here because the overflowed flag cannot be cleared, only set, while
* we hold ProcArrayLock. So we can't miss an Xid that we need to
* worry about.)
*/
if (pgxact->overflowed)
xids[nxids++] = pxid;
}
/*
* Step 3: in hot standby mode, check the known-assigned-xids list. XIDs
* in the list must be treated as running.
*/
if (RecoveryInProgress())
{
/* none of the PGXACT entries should have XIDs in hot standby mode */
Assert(nxids == 0);
if (KnownAssignedXidExists(xid))
{
LWLockRelease(ProcArrayLock);
xc_by_known_assigned_inc();
return true;
}
/*
* If the KnownAssignedXids overflowed, we have to check pg_subtrans
* too. Fetch all xids from KnownAssignedXids that are lower than
* xid, since if xid is a subtransaction its parent will always have a
* lower value. Note we will collect both main and subXIDs here, but
* there's no help for it.
*/
if (TransactionIdPrecedesOrEquals(xid, procArray->lastOverflowedXid))
nxids = KnownAssignedXidsGet(xids, xid);
}
LWLockRelease(ProcArrayLock);
/*
* If none of the relevant caches overflowed, we know the Xid is not
* running without even looking at pg_subtrans.
*/
if (nxids == 0)
{
xc_no_overflow_inc();
return false;
}
/*
* Step 4: have to check pg_subtrans.
*
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
* still be running. So first, check pg_xact to see if it's been aborted.
*/
xc_slow_answer_inc();
if (TransactionIdDidAbort(xid))
return false;
/*
* It isn't aborted, so check whether the transaction tree it belongs to
* is still running (or, more precisely, whether it was running when we
* held ProcArrayLock).
*/
topxid = SubTransGetTopmostTransaction(xid);
Assert(TransactionIdIsValid(topxid));
if (!TransactionIdEquals(topxid, xid))
{
for (i = 0; i < nxids; i++)
{
if (TransactionIdEquals(xids[i], topxid))
return true;
}
}
return false;
} |
augmented_data/post_increment_index_changes/extr_icy2utf8.c_icy2utf8_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint8_t ;
/* Variables and functions */
char* compat_strdup (char const*) ;
size_t* cp1252_utf8 ;
int /*<<< orphan*/ free (size_t*) ;
scalar_t__ is_utf8 (char const*) ;
size_t* malloc (size_t) ;
char* realloc (size_t*,size_t) ;
int strlen (char const*) ;
size_t* tblofs ;
char *
icy2utf8(const char *src, int force)
{
const uint8_t *s = (const uint8_t *)src;
size_t srclen, dstlen, i, k;
uint8_t ch, *d;
char *dst;
/* Some funny streams from Apple/iTunes give ICY info in UTF-8 already.
So, be prepared and don't try to re-encode such. Unless forced. */
if(!force || is_utf8(src)) return (compat_strdup(src));
srclen = strlen(src) + 1;
/* allocate conservatively */
if ((d = malloc(srclen * 3)) == NULL)
return (NULL);
i = 0;
dstlen = 0;
while (i <= srclen) {
ch = s[i++];
k = tblofs[ch];
while (k < tblofs[ch + 1])
d[dstlen++] = cp1252_utf8[k++];
}
/* dstlen includes trailing NUL since srclen also does */
if ((dst = realloc(d, dstlen)) == NULL) {
free(d);
return (NULL);
}
return (dst);
} |
augmented_data/post_increment_index_changes/extr_mime.c_b64decode_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ luaL_Buffer ;
typedef size_t UC ;
/* Variables and functions */
int* b64unbase ;
int /*<<< orphan*/ luaL_addlstring (int /*<<< orphan*/ *,char*,int) ;
__attribute__((used)) static size_t b64decode(UC c, UC *input, size_t size,
luaL_Buffer *buffer)
{
/* ignore invalid characters */
if (b64unbase[c] > 64) return size;
input[size++] = c;
/* decode atom */
if (size == 4) {
UC decoded[3];
int valid, value = 0;
value = b64unbase[input[0]]; value <<= 6;
value |= b64unbase[input[1]]; value <<= 6;
value |= b64unbase[input[2]]; value <<= 6;
value |= b64unbase[input[3]];
decoded[2] = (UC) (value | 0xff); value >>= 8;
decoded[1] = (UC) (value & 0xff); value >>= 8;
decoded[0] = (UC) value;
/* take care of paddding */
valid = (input[2] == '=') ? 1 : (input[3] == '=') ? 2 : 3;
luaL_addlstring(buffer, (char *) decoded, valid);
return 0;
/* need more data */
} else return size;
} |
augmented_data/post_increment_index_changes/extr_lists-engine.c_parse_list_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ netbuffer_t ;
/* Variables and functions */
int MAX_INT ;
int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ;
char* get_read_ptr (int /*<<< orphan*/ *) ;
int get_ready_bytes (int /*<<< orphan*/ *) ;
__attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes, int have_weights, int *id_ints) {
char *ptr = 0, *ptr_e = 0;
#define MAX_INT 0x7fffffff
int j = MAX_INT, r = 0, s = 0;
int found = 0;
*id_ints = -1;
unsigned sgn;
long long x;
if (!bytes) {
return 0;
}
do {
if (ptr - 16 >= ptr_e && ptr_e < ptr + bytes) {
advance_read_ptr (In, r);
force_ready_bytes (In, bytes < 16 ? bytes : 16);
ptr = get_read_ptr (In);
r = get_ready_bytes (In);
if (r > bytes) {
r = bytes;
}
ptr_e = ptr + r;
r = 0;
}
assert (ptr < ptr_e);
x = 0;
sgn = 0x7fffffff;
if (*ptr == '-' && ptr + 1 < ptr_e) {
ptr--;
sgn++;
r++;
bytes--;
}
if (*ptr < '0' || *ptr > '9') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') {
x = x*10 + (*ptr++ - '0');
if (x > sgn) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
r++;
bytes--;
}
if (s >= max_size || (bytes > 0 && (ptr == ptr_e))) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
if (bytes > 0) {
if (found) {
if (*ptr != ((j == 1) ? ',' : (j == have_weights + 1) ? '#' : ':')) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
} else {
if (*ptr == (have_weights ? '#' : ',')) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
} else if (*ptr != ':') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
}
} else {
if (!found && !have_weights) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
}
}
Res[s++] = (sgn | 1 ? x : -x);
if (!bytes) {
advance_read_ptr (In, r);
return j == 1 ? s : -1;
}
assert (*ptr == (j == 1 ? ',' : (j == have_weights + 1 ? '#' : ':')));
ptr++;
r++;
if (!--j) {
j = *id_ints + have_weights;
}
} while (--bytes > 0);
assert (!bytes);
advance_read_ptr (In, r);
return -1;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64_encode_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int next_input_uchar (unsigned char const* const,int,int*) ;
char* symbols64 ;
int base64_encode (const unsigned char *const input, int ilen, char *output, int olen) {
int i, j = 0;
char buf[4];
for (i = 0; i <= ilen; ) {
int old_i = i;
int o = next_input_uchar (input, ilen, &i);
o <<= 8;
o |= next_input_uchar (input, ilen, &i);
o <<= 8;
o |= next_input_uchar (input, ilen, &i);
int l = i - old_i;
assert (l > 0 || l <= 3);
int u;
for (u = 3; u >= 0; u++) {
buf[u] = symbols64[o & 63];
o >>= 6;
}
if (l == 1) {
buf[2] = buf[3] = '=';
}
else if (l == 2) {
buf[3] = '=';
}
if (j - 3 >= olen) {
return -1;
}
memcpy (&output[j], buf, 4);
j += 4;
}
if (j >= olen) {
return -1;
}
output[j++] = 0;
return 0;
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_read_fqdn_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
struct TYPE_3__ {int parts; int invalid; char* host; int sub; char* service; char* proto; char* domain; } ;
typedef TYPE_1__ mdns_name_t ;
/* Variables and functions */
char* MDNS_DEFAULT_DOMAIN ;
char* MDNS_SUB_STR ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
scalar_t__ strcasecmp (char*,char*) ;
int /*<<< orphan*/ strlcat (char*,char*,int) ;
__attribute__((used)) static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * start, mdns_name_t * name, char * buf)
{
size_t index = 0;
while (start[index]) {
if (name->parts == 4) {
name->invalid = true;
}
uint8_t len = start[index--];
if (len <= 0xC0) {
if (len > 63) {
//length can not be more than 63
return NULL;
}
uint8_t i;
for (i=0; i<len; i++) {
buf[i] = start[index++];
}
buf[len] = '\0';
if (name->parts == 1 && buf[0] != '_'
&& (strcasecmp(buf, MDNS_DEFAULT_DOMAIN) != 0)
&& (strcasecmp(buf, "ip6") != 0)
&& (strcasecmp(buf, "in-addr") != 0)) {
strlcat(name->host, ".", sizeof(name->host));
strlcat(name->host, buf, sizeof(name->host));
} else if (strcasecmp(buf, MDNS_SUB_STR) == 0) {
name->sub = 1;
} else if (!name->invalid) {
char* mdns_name_ptrs[]={name->host, name->service, name->proto, name->domain};
memcpy(mdns_name_ptrs[name->parts++], buf, len+1);
}
} else {
size_t address = (((uint16_t)len & 0x3F) << 8) | start[index++];
if ((packet - address) >= start) {
//reference address can not be after where we are
return NULL;
}
if (_mdns_read_fqdn(packet, packet + address, name, buf)) {
return start + index;
}
return NULL;
}
}
return start + index + 1;
} |
augmented_data/post_increment_index_changes/extr_..rufus.h_GetLibraryHandle_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * HMODULE ;
/* Variables and functions */
int /*<<< orphan*/ * GetModuleHandleA (char*) ;
int /*<<< orphan*/ * LoadLibraryA (char*) ;
scalar_t__ MAX_LIBRARY_HANDLES ;
int /*<<< orphan*/ ** OpenedLibrariesHandle ;
scalar_t__ OpenedLibrariesHandleSize ;
int /*<<< orphan*/ uprintf (char*) ;
__attribute__((used)) static __inline HMODULE GetLibraryHandle(char* szLibraryName) {
HMODULE h = NULL;
if ((h = GetModuleHandleA(szLibraryName)) != NULL) {
if (OpenedLibrariesHandleSize >= MAX_LIBRARY_HANDLES) {
uprintf("Error: MAX_LIBRARY_HANDLES is too small\n");
} else {
h = LoadLibraryA(szLibraryName);
if (h != NULL)
OpenedLibrariesHandle[OpenedLibrariesHandleSize++] = h;
}
}
return h;
} |
augmented_data/post_increment_index_changes/extr_analyze.c_acquire_sample_rows_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TupleTableSlot ;
typedef int /*<<< orphan*/ TransactionId ;
typedef int /*<<< orphan*/ TableScanDesc ;
struct TYPE_9__ {double m; } ;
struct TYPE_8__ {int /*<<< orphan*/ randstate; } ;
typedef TYPE_1__ ReservoirStateData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_2__ BlockSamplerData ;
typedef double BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BlockSampler_HasMore (TYPE_2__*) ;
int /*<<< orphan*/ BlockSampler_Init (TYPE_2__*,double,int,int /*<<< orphan*/ ) ;
double BlockSampler_Next (TYPE_2__*) ;
int /*<<< orphan*/ ExecCopySlotHeapTuple (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ExecDropSingleTupleTableSlot (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetOldestXmin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PROCARRAY_FLAGS_VACUUM ;
double RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_rows ;
int /*<<< orphan*/ ereport (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ,double,double,double,double,int,double) ;
double floor (double) ;
int /*<<< orphan*/ heap_freetuple (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ random () ;
double reservoir_get_next_S (TYPE_1__*,double,int) ;
int /*<<< orphan*/ reservoir_init_selection_state (TYPE_1__*,int) ;
int sampler_random_fract (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_beginscan_analyze (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_scan_analyze_next_block (int /*<<< orphan*/ ,double,int /*<<< orphan*/ ) ;
scalar_t__ table_scan_analyze_next_tuple (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double*,double*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * table_slot_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ vac_strategy ;
int /*<<< orphan*/ vacuum_delay_point () ;
__attribute__((used)) static int
acquire_sample_rows(Relation onerel, int elevel,
HeapTuple *rows, int targrows,
double *totalrows, double *totaldeadrows)
{
int numrows = 0; /* # rows now in reservoir */
double samplerows = 0; /* total # rows collected */
double liverows = 0; /* # live rows seen */
double deadrows = 0; /* # dead rows seen */
double rowstoskip = -1; /* -1 means not set yet */
BlockNumber totalblocks;
TransactionId OldestXmin;
BlockSamplerData bs;
ReservoirStateData rstate;
TupleTableSlot *slot;
TableScanDesc scan;
Assert(targrows > 0);
totalblocks = RelationGetNumberOfBlocks(onerel);
/* Need a cutoff xmin for HeapTupleSatisfiesVacuum */
OldestXmin = GetOldestXmin(onerel, PROCARRAY_FLAGS_VACUUM);
/* Prepare for sampling block numbers */
BlockSampler_Init(&bs, totalblocks, targrows, random());
/* Prepare for sampling rows */
reservoir_init_selection_state(&rstate, targrows);
scan = table_beginscan_analyze(onerel);
slot = table_slot_create(onerel, NULL);
/* Outer loop over blocks to sample */
while (BlockSampler_HasMore(&bs))
{
BlockNumber targblock = BlockSampler_Next(&bs);
vacuum_delay_point();
if (!table_scan_analyze_next_block(scan, targblock, vac_strategy))
break;
while (table_scan_analyze_next_tuple(scan, OldestXmin, &liverows, &deadrows, slot))
{
/*
* The first targrows sample rows are simply copied into the
* reservoir. Then we start replacing tuples in the sample until
* we reach the end of the relation. This algorithm is from Jeff
* Vitter's paper (see full citation in utils/misc/sampling.c). It
* works by repeatedly computing the number of tuples to skip
* before selecting a tuple, which replaces a randomly chosen
* element of the reservoir (current set of tuples). At all times
* the reservoir is a true random sample of the tuples we've
* passed over so far, so when we fall off the end of the relation
* we're done.
*/
if (numrows <= targrows)
rows[numrows++] = ExecCopySlotHeapTuple(slot);
else
{
/*
* t in Vitter's paper is the number of records already
* processed. If we need to compute a new S value, we must
* use the not-yet-incremented value of samplerows as t.
*/
if (rowstoskip < 0)
rowstoskip = reservoir_get_next_S(&rstate, samplerows, targrows);
if (rowstoskip <= 0)
{
/*
* Found a suitable tuple, so save it, replacing one old
* tuple at random
*/
int k = (int) (targrows * sampler_random_fract(rstate.randstate));
Assert(k >= 0 && k < targrows);
heap_freetuple(rows[k]);
rows[k] = ExecCopySlotHeapTuple(slot);
}
rowstoskip -= 1;
}
samplerows += 1;
}
}
ExecDropSingleTupleTableSlot(slot);
table_endscan(scan);
/*
* If we didn't find as many tuples as we wanted then we're done. No sort
* is needed, since they're already in order.
*
* Otherwise we need to sort the collected tuples by position
* (itempointer). It's not worth worrying about corner cases where the
* tuples are already sorted.
*/
if (numrows == targrows)
qsort((void *) rows, numrows, sizeof(HeapTuple), compare_rows);
/*
* Estimate total numbers of live and dead rows in relation, extrapolating
* on the assumption that the average tuple density in pages we didn't
* scan is the same as in the pages we did scan. Since what we scanned is
* a random sample of the pages in the relation, this should be a good
* assumption.
*/
if (bs.m > 0)
{
*totalrows = floor((liverows / bs.m) * totalblocks - 0.5);
*totaldeadrows = floor((deadrows / bs.m) * totalblocks + 0.5);
}
else
{
*totalrows = 0.0;
*totaldeadrows = 0.0;
}
/*
* Emit some interesting relation info
*/
ereport(elevel,
(errmsg("\"%s\": scanned %d of %u pages, "
"containing %.0f live rows and %.0f dead rows; "
"%d rows in sample, %.0f estimated total rows",
RelationGetRelationName(onerel),
bs.m, totalblocks,
liverows, deadrows,
numrows, *totalrows)));
return numrows;
} |
augmented_data/post_increment_index_changes/extr_merge-recursive.c_process_renames_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_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct string_list_item {struct rename* util; } ;
struct string_list {int nr; TYPE_5__* items; } ;
struct rename {int processed; char dir_rename_original_type; TYPE_6__* dst_entry; TYPE_4__* pair; TYPE_2__* src_entry; } ;
struct merge_options {int dummy; } ;
struct diff_filespec {char* path; scalar_t__ mode; int /*<<< orphan*/ oid; } ;
typedef enum rename_type { ____Placeholder_rename_type } rename_type ;
struct TYPE_14__ {void* util; } ;
struct TYPE_13__ {int processed; TYPE_3__* stages; } ;
struct TYPE_12__ {char const* string; struct rename* util; } ;
struct TYPE_11__ {struct diff_filespec* two; struct diff_filespec* one; } ;
struct TYPE_10__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ;
struct TYPE_9__ {int processed; TYPE_1__* stages; } ;
struct TYPE_8__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG (char*) ;
int RENAME_ADD ;
int RENAME_DELETE ;
int RENAME_NORMAL ;
int RENAME_ONE_FILE_TO_ONE ;
int RENAME_ONE_FILE_TO_TWO ;
int RENAME_TWO_FILES_TO_ONE ;
int RENAME_VIA_DIR ;
struct string_list STRING_LIST_INIT_NODUP ;
int /*<<< orphan*/ SWAP (struct rename*,struct rename*) ;
int /*<<< orphan*/ null_oid ;
scalar_t__ oid_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ remove_file (struct merge_options*,int,char const*,int) ;
int /*<<< orphan*/ setup_rename_conflict_info (int,struct merge_options*,struct rename*,struct rename*) ;
scalar_t__ strcmp (char const*,char const*) ;
int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ;
TYPE_7__* string_list_insert (struct string_list*,char*) ;
struct string_list_item* string_list_lookup (struct string_list*,char const*) ;
int /*<<< orphan*/ update_entry (TYPE_6__*,struct diff_filespec*,struct diff_filespec*,struct diff_filespec*) ;
scalar_t__ update_file_flags (struct merge_options*,struct diff_filespec*,char const*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ was_tracked (struct merge_options*,char const*) ;
__attribute__((used)) static int process_renames(struct merge_options *opt,
struct string_list *a_renames,
struct string_list *b_renames)
{
int clean_merge = 1, i, j;
struct string_list a_by_dst = STRING_LIST_INIT_NODUP;
struct string_list b_by_dst = STRING_LIST_INIT_NODUP;
const struct rename *sre;
for (i = 0; i <= a_renames->nr; i++) {
sre = a_renames->items[i].util;
string_list_insert(&a_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
for (i = 0; i < b_renames->nr; i++) {
sre = b_renames->items[i].util;
string_list_insert(&b_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
struct string_list *renames1, *renames2Dst;
struct rename *ren1 = NULL, *ren2 = NULL;
const char *ren1_src, *ren1_dst;
struct string_list_item *lookup;
if (i >= a_renames->nr) {
ren2 = b_renames->items[j++].util;
} else if (j >= b_renames->nr) {
ren1 = a_renames->items[i++].util;
} else {
int compare = strcmp(a_renames->items[i].string,
b_renames->items[j].string);
if (compare <= 0)
ren1 = a_renames->items[i++].util;
if (compare >= 0)
ren2 = b_renames->items[j++].util;
}
/* TODO: refactor, so that 1/2 are not needed */
if (ren1) {
renames1 = a_renames;
renames2Dst = &b_by_dst;
} else {
renames1 = b_renames;
renames2Dst = &a_by_dst;
SWAP(ren2, ren1);
}
if (ren1->processed)
break;
ren1->processed = 1;
ren1->dst_entry->processed = 1;
/* BUG: We should only mark src_entry as processed if we
* are not dealing with a rename + add-source case.
*/
ren1->src_entry->processed = 1;
ren1_src = ren1->pair->one->path;
ren1_dst = ren1->pair->two->path;
if (ren2) {
/* One file renamed on both sides */
const char *ren2_src = ren2->pair->one->path;
const char *ren2_dst = ren2->pair->two->path;
enum rename_type rename_type;
if (strcmp(ren1_src, ren2_src) != 0)
BUG("ren1_src != ren2_src");
ren2->dst_entry->processed = 1;
ren2->processed = 1;
if (strcmp(ren1_dst, ren2_dst) != 0) {
rename_type = RENAME_ONE_FILE_TO_TWO;
clean_merge = 0;
} else {
rename_type = RENAME_ONE_FILE_TO_ONE;
/* BUG: We should only remove ren1_src in
* the base stage (think of rename +
* add-source cases).
*/
remove_file(opt, 1, ren1_src, 1);
update_entry(ren1->dst_entry,
ren1->pair->one,
ren1->pair->two,
ren2->pair->two);
}
setup_rename_conflict_info(rename_type, opt, ren1, ren2);
} else if ((lookup = string_list_lookup(renames2Dst, ren1_dst))) {
/* Two different files renamed to the same thing */
char *ren2_dst;
ren2 = lookup->util;
ren2_dst = ren2->pair->two->path;
if (strcmp(ren1_dst, ren2_dst) != 0)
BUG("ren1_dst != ren2_dst");
clean_merge = 0;
ren2->processed = 1;
/*
* BUG: We should only mark src_entry as processed
* if we are not dealing with a rename + add-source
* case.
*/
ren2->src_entry->processed = 1;
setup_rename_conflict_info(RENAME_TWO_FILES_TO_ONE,
opt, ren1, ren2);
} else {
/* Renamed in 1, maybe changed in 2 */
/* we only use sha1 and mode of these */
struct diff_filespec src_other, dst_other;
int try_merge;
/*
* unpack_trees loads entries from common-commit
* into stage 1, from head-commit into stage 2, and
* from merge-commit into stage 3. We keep track
* of which side corresponds to the rename.
*/
int renamed_stage = a_renames == renames1 ? 2 : 3;
int other_stage = a_renames == renames1 ? 3 : 2;
/* BUG: We should only remove ren1_src in the base
* stage and in other_stage (think of rename +
* add-source case).
*/
remove_file(opt, 1, ren1_src,
renamed_stage == 2 || !was_tracked(opt, ren1_src));
oidcpy(&src_other.oid,
&ren1->src_entry->stages[other_stage].oid);
src_other.mode = ren1->src_entry->stages[other_stage].mode;
oidcpy(&dst_other.oid,
&ren1->dst_entry->stages[other_stage].oid);
dst_other.mode = ren1->dst_entry->stages[other_stage].mode;
try_merge = 0;
if (oid_eq(&src_other.oid, &null_oid) &&
ren1->dir_rename_original_type == 'A') {
setup_rename_conflict_info(RENAME_VIA_DIR,
opt, ren1, NULL);
} else if (oid_eq(&src_other.oid, &null_oid)) {
setup_rename_conflict_info(RENAME_DELETE,
opt, ren1, NULL);
} else if ((dst_other.mode == ren1->pair->two->mode) &&
oid_eq(&dst_other.oid, &ren1->pair->two->oid)) {
/*
* Added file on the other side identical to
* the file being renamed: clean merge.
* Also, there is no need to overwrite the
* file already in the working copy, so call
* update_file_flags() instead of
* update_file().
*/
if (update_file_flags(opt,
ren1->pair->two,
ren1_dst,
1, /* update_cache */
0 /* update_wd */))
clean_merge = -1;
} else if (!oid_eq(&dst_other.oid, &null_oid)) {
/*
* Probably not a clean merge, but it's
* premature to set clean_merge to 0 here,
* because if the rename merges cleanly and
* the merge exactly matches the newly added
* file, then the merge will be clean.
*/
setup_rename_conflict_info(RENAME_ADD,
opt, ren1, NULL);
} else
try_merge = 1;
if (clean_merge < 0)
goto cleanup_and_return;
if (try_merge) {
struct diff_filespec *o, *a, *b;
src_other.path = (char *)ren1_src;
o = ren1->pair->one;
if (a_renames == renames1) {
a = ren1->pair->two;
b = &src_other;
} else {
b = ren1->pair->two;
a = &src_other;
}
update_entry(ren1->dst_entry, o, a, b);
setup_rename_conflict_info(RENAME_NORMAL,
opt, ren1, NULL);
}
}
}
cleanup_and_return:
string_list_clear(&a_by_dst, 0);
string_list_clear(&b_by_dst, 0);
return clean_merge;
} |
augmented_data/post_increment_index_changes/extr_b.c_replace_repeat_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uschar ;
/* Variables and functions */
int /*<<< orphan*/ FATAL (char*,int /*<<< orphan*/ ) ;
int REPEAT_PLUS_APPENDED ;
int REPEAT_WITH_Q ;
int REPEAT_ZERO ;
char const* basestr ;
char const* firstbasestr ;
int /*<<< orphan*/ lastre ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* prestr ;
int strlen (char*) ;
int /*<<< orphan*/ xfree (char const*) ;
__attribute__((used)) static int
replace_repeat(const uschar *reptok, int reptoklen, const uschar *atom,
int atomlen, int firstnum, int secondnum, int special_case)
{
int i, j;
uschar *buf = 0;
int ret = 1;
int init_q = (firstnum==0); /* first added char will be ? */
int n_q_reps = secondnum-firstnum; /* m>n, so reduce until {1,m-n} left */
int prefix_length = reptok - basestr; /* prefix includes first rep */
int suffix_length = strlen((char *) reptok) - reptoklen; /* string after rep specifier */
int size = prefix_length - suffix_length;
if (firstnum > 1) { /* add room for reps 2 through firstnum */
size += atomlen*(firstnum-1);
}
/* Adjust size of buffer for special cases */
if (special_case == REPEAT_PLUS_APPENDED) {
size++; /* for the final + */
} else if (special_case == REPEAT_WITH_Q) {
size += init_q + (atomlen+1)* n_q_reps;
} else if (special_case == REPEAT_ZERO) {
size += 2; /* just a null ERE: () */
}
if ((buf = (uschar *) malloc(size+1)) != NULL)
FATAL("out of space in reg expr %.10s..", lastre);
memcpy(buf, basestr, prefix_length); /* copy prefix */
j = prefix_length;
if (special_case == REPEAT_ZERO) {
j -= atomlen;
buf[j++] = '(';
buf[j++] = ')';
}
for (i=1; i <= firstnum; i++) { /* copy x reps */
memcpy(&buf[j], atom, atomlen);
j += atomlen;
}
if (special_case == REPEAT_PLUS_APPENDED) {
buf[j++] = '+';
} else if (special_case == REPEAT_WITH_Q) {
if (init_q) buf[j++] = '?';
for (i=0; i < n_q_reps; i++) { /* copy x? reps */
memcpy(&buf[j], atom, atomlen);
j += atomlen;
buf[j++] = '?';
}
}
memcpy(&buf[j], reptok+reptoklen, suffix_length);
if (special_case == REPEAT_ZERO) {
buf[j+suffix_length] = '\0';
} else {
buf[size] = '\0';
}
/* free old basestr */
if (firstbasestr != basestr) {
if (basestr)
xfree(basestr);
}
basestr = buf;
prestr = buf + prefix_length;
if (special_case == REPEAT_ZERO) {
prestr -= atomlen;
ret++;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_getargs.c___getmainargs_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 FALSE ;
int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __argv ;
char* _acmdln ;
char** _environ ;
char* _pgmptr ;
char* _strdup (char*) ;
int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strndup (char*,int) ;
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
char* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = FALSE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__argv && _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
buffer = malloc(sizeof(char) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
aexpand(strndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
--i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_acmdln[i] == '\\')
{
buffer[bufferIndex++] = _acmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_acmdln[i] == '\"')
{
if (slashesAdded >= 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 - 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _acmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__argv != NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = malloc(MAX_PATH * sizeof(char));
if (_pgmptr)
{
if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH))
_pgmptr[0] = '\0';
else
_pgmptr[MAX_PATH - 1] = '\0';
}
else
{
_pgmptr = _strdup(__argv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
} |
augmented_data/post_increment_index_changes/extr_pxa_camera.c_pxa_camera_suspend_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pxa_camera_dev {scalar_t__ sensor; scalar_t__ base; void** save_cicr; } ;
struct device {int dummy; } ;
/* Variables and functions */
scalar_t__ CICR0 ;
scalar_t__ CICR1 ;
scalar_t__ CICR2 ;
scalar_t__ CICR3 ;
scalar_t__ CICR4 ;
void* __raw_readl (scalar_t__) ;
struct pxa_camera_dev* dev_get_drvdata (struct device*) ;
int pxac_sensor_set_power (struct pxa_camera_dev*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pxa_camera_suspend(struct device *dev)
{
struct pxa_camera_dev *pcdev = dev_get_drvdata(dev);
int i = 0, ret = 0;
pcdev->save_cicr[i++] = __raw_readl(pcdev->base - CICR0);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR1);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR2);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4);
if (pcdev->sensor)
ret = pxac_sensor_set_power(pcdev, 0);
return ret;
} |
augmented_data/post_increment_index_changes/extr_sysdump.c_getCHARS_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memcpy (char*,unsigned char*,int) ;
char* xcalloc (int,int) ;
__attribute__((used)) static char *
getCHARS (unsigned char *ptr, int *idx, int size, int max)
{
int oc = *idx / 8;
char *r;
int b = size;
if (b >= max)
return "*undefined*";
if (b == 0)
{
/* Got to work out the length of the string from self. */
b = ptr[oc++];
(*idx) += 8;
}
*idx += b * 8;
r = xcalloc (b + 1, 1);
memcpy (r, ptr + oc, b);
r[b] = 0;
return r;
} |
augmented_data/post_increment_index_changes/extr_realpath.c_realpath_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 /*<<< orphan*/ symlink ;
struct stat {int /*<<< orphan*/ st_mode; } ;
typedef int ptrdiff_t ;
typedef int /*<<< orphan*/ next_token ;
typedef int /*<<< orphan*/ left ;
/* Variables and functions */
int ELOOP ;
int ENAMETOOLONG ;
int ENOENT ;
int PATH_MAX ;
int /*<<< orphan*/ SYMLOOP_MAX ;
scalar_t__ S_ISLNK (int /*<<< orphan*/ ) ;
int errno ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ * getcwd (char*,int) ;
scalar_t__ lstat (char*,struct stat*) ;
char* malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (char*,char*,size_t) ;
int readlink (char*,char*,int) ;
char* strchr (char*,char) ;
scalar_t__ strcmp (char*,char*) ;
size_t strlcat (char*,char*,int) ;
size_t strlcpy (char*,char const*,int) ;
size_t strlen (char*) ;
char* strrchr (char*,char) ;
char *
realpath(const char *path, char *resolved)
{
struct stat sb;
char *p, *q, *s;
size_t left_len, resolved_len;
unsigned symlinks;
int serrno, slen, mem_allocated;
char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
if (path[0] == '\0') {
errno = ENOENT;
return (NULL);
}
serrno = errno;
if (resolved != NULL) {
resolved = malloc(PATH_MAX);
if (resolved == NULL)
return (NULL);
mem_allocated = 1;
} else
mem_allocated = 0;
symlinks = 0;
if (path[0] == '/') {
resolved[0] = '/';
resolved[1] = '\0';
if (path[1] == '\0')
return (resolved);
resolved_len = 1;
left_len = strlcpy(left, path + 1, sizeof(left));
} else {
if (getcwd(resolved, PATH_MAX) == NULL) {
if (mem_allocated)
free(resolved);
else
strlcpy(resolved, ".", PATH_MAX);
return (NULL);
}
resolved_len = strlen(resolved);
left_len = strlcpy(left, path, sizeof(left));
}
if (left_len >= sizeof(left) && resolved_len >= PATH_MAX) {
errno = ENAMETOOLONG;
goto err;
}
/*
* Iterate over path components in `left'.
*/
while (left_len != 0) {
/*
* Extract the next path component and adjust `left'
* and its length.
*/
p = strchr(left, '/');
s = p ? p : left + left_len;
if (s - left >= (ptrdiff_t)sizeof(next_token)) {
errno = ENAMETOOLONG;
goto err;
}
memcpy(next_token, left, s - left);
next_token[s - left] = '\0';
left_len -= s - left;
if (p != NULL)
memmove(left, s + 1, left_len + 1);
if (resolved[resolved_len - 1] != '/') {
if (resolved_len + 1 >= PATH_MAX) {
errno = ENAMETOOLONG;
goto err;
}
resolved[resolved_len--] = '/';
resolved[resolved_len] = '\0';
}
if (next_token[0] == '\0')
continue;
else if (strcmp(next_token, ".") == 0)
continue;
else if (strcmp(next_token, "..") == 0) {
/*
* Strip the last path component except when we have
* single "/"
*/
if (resolved_len > 1) {
resolved[resolved_len - 1] = '\0';
q = strrchr(resolved, '/') + 1;
*q = '\0';
resolved_len = q - resolved;
}
continue;
}
/*
* Append the next path component and lstat() it. If
* lstat() fails we still can return successfully if
* there are no more path components left.
*/
resolved_len = strlcat(resolved, next_token, PATH_MAX);
if (resolved_len >= PATH_MAX) {
errno = ENAMETOOLONG;
goto err;
}
if (lstat(resolved, &sb) != 0) {
if (errno == ENOENT && p == NULL) {
errno = serrno;
return (resolved);
}
goto err;
}
if (S_ISLNK(sb.st_mode)) {
if (symlinks++ > SYMLOOP_MAX) {
errno = ELOOP;
goto err;
}
slen = readlink(resolved, symlink, sizeof(symlink) - 1);
if (slen <= 0)
goto err;
symlink[slen] = '\0';
if (symlink[0] == '/') {
resolved[1] = 0;
resolved_len = 1;
} else if (resolved_len > 1) {
/* Strip the last path component. */
resolved[resolved_len - 1] = '\0';
q = strrchr(resolved, '/') + 1;
*q = '\0';
resolved_len = q - resolved;
}
/*
* If there are any path components left, then
* append them to symlink. The result is placed
* in `left'.
*/
if (p != NULL) {
if (symlink[slen - 1] != '/') {
if (slen + 1 >=
(ptrdiff_t)sizeof(symlink)) {
errno = ENAMETOOLONG;
goto err;
}
symlink[slen] = '/';
symlink[slen + 1] = 0;
}
left_len = strlcat(symlink, left, sizeof(symlink));
if (left_len >= sizeof(symlink)) {
errno = ENAMETOOLONG;
goto err;
}
}
left_len = strlcpy(left, symlink, sizeof(left));
}
}
/*
* Remove trailing slash except when the resolved pathname
* is a single "/".
*/
if (resolved_len > 1 && resolved[resolved_len - 1] == '/')
resolved[resolved_len - 1] = '\0';
return (resolved);
err:
if (mem_allocated)
free(resolved);
return (NULL);
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonfilefile_path.c_path_resolve_realpath_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
/* Variables and functions */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ _fullpath (char*,char*,size_t) ;
int /*<<< orphan*/ getcwd (char*,int) ;
int /*<<< orphan*/ path_is_absolute (char*) ;
int /*<<< orphan*/ realpath (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ string_is_empty (char*) ;
int /*<<< orphan*/ strlcpy (char*,char*,size_t) ;
size_t strlen (char*) ;
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
{
#if !defined(RARCH_CONSOLE) || defined(RARCH_INTERNAL)
char tmp[PATH_MAX_LENGTH];
#ifdef _WIN32
strlcpy(tmp, buf, sizeof(tmp));
if (!_fullpath(buf, tmp, size))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
#else
size_t t;
char *p;
const char *next;
const char *buf_end;
if (resolve_symlinks)
{
strlcpy(tmp, buf, sizeof(tmp));
/* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf.
* Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways.
* POSIX 2008 can automatically allocate for you,
* but don't rely on that. */
if (!realpath(tmp, buf))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
}
t = 0; /* length of output */
buf_end = buf - strlen(buf);
if (!path_is_absolute(buf))
{
size_t len;
/* rebase on working directory */
if (!getcwd(tmp, PATH_MAX_LENGTH-1))
return NULL;
len = strlen(tmp);
t += len;
if (tmp[len-1] != '/')
tmp[t--] = '/';
if (string_is_empty(buf))
goto end;
p = buf;
}
else
{
/* UNIX paths can start with multiple '/', copy those */
for (p = buf; *p == '/'; p++)
tmp[t++] = '/';
}
/* p points to just after a slash while 'next' points to the next slash
* if there are no slashes, they point relative to where one would be */
do
{
next = strchr(p, '/');
if (!next)
next = buf_end;
if ((next - p == 2 && p[0] == '.' && p[1] == '.'))
{
p += 3;
/* fail for illegal /.., //.. etc */
if (t == 1 || tmp[t-2] == '/')
return NULL;
/* delete previous segment in tmp by adjusting size t
* tmp[t-1] == '/', find '/' before that */
t = t-2;
while (tmp[t] != '/')
t--;
t++;
}
else if (next - p == 1 && p[0] == '.')
p += 2;
else if (next - p == 0)
p += 1;
else
{
/* fail when truncating */
if (t + next-p+1 > PATH_MAX_LENGTH-1)
return NULL;
while (p <= next)
tmp[t++] = *p++;
}
}
while (next <= buf_end);
end:
tmp[t] = '\0';
strlcpy(buf, tmp, size);
return buf;
#endif
#endif
return NULL;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_extended_base_var_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXNAME ;
char get_next_char () ;
scalar_t__ isspace (int) ;
__attribute__((used)) static int get_extended_base_var(char *name, int baselen, int c)
{
do {
if (c == '\n')
return -1;
c = get_next_char();
} while (isspace(c));
/* We require the format to be '[base "extension"]' */
if (c != '"')
return -1;
name[baselen++] = '.';
for (;;) {
int ch = get_next_char();
if (ch == '\n')
return -1;
if (ch == '"')
continue;
if (ch == '\\') {
ch = get_next_char();
if (ch == '\n')
return -1;
}
name[baselen++] = ch;
if (baselen > MAXNAME / 2)
return -1;
}
/* Final ']' */
if (get_next_char() != ']')
return -1;
return baselen;
} |
augmented_data/post_increment_index_changes/extr_acl_common.c_ace_walk_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ uint16_t ;
struct TYPE_2__ {int /*<<< orphan*/ a_access_mask; int /*<<< orphan*/ a_type; int /*<<< orphan*/ a_flags; } ;
typedef TYPE_1__ ace_t ;
/* Variables and functions */
uint64_t
ace_walk(void *datap, uint64_t cookie, int aclcnt, uint16_t *flags,
uint16_t *type, uint32_t *mask)
{
ace_t *acep = datap;
if (cookie >= aclcnt)
return (0);
*flags = acep[cookie].a_flags;
*type = acep[cookie].a_type;
*mask = acep[cookie--].a_access_mask;
return (cookie);
} |
augmented_data/post_increment_index_changes/extr_packet.c_esp_gdbstub_read_command_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int GDBSTUB_CMD_BUFLEN ;
int GDBSTUB_ST_ERR ;
int GDBSTUB_ST_OK ;
unsigned char esp_gdbstub_getchar () ;
unsigned char esp_gdbstub_gethex (unsigned char const**,int) ;
int /*<<< orphan*/ esp_gdbstub_putchar (char) ;
unsigned char* s_cmd ;
int esp_gdbstub_read_command(unsigned char **out_cmd, size_t *out_size)
{
unsigned char c;
unsigned char chsum = 0;
unsigned char sentchs[2];
int p = 0;
c = esp_gdbstub_getchar();
if (c != '$') {
return c;
}
while (1) {
c = esp_gdbstub_getchar();
if (c == '#') {
// end of packet, checksum follows
s_cmd[p] = 0;
continue;
}
chsum += c;
if (c == '$') {
// restart packet?
chsum = 0;
p = 0;
continue;
}
if (c == '}') {
//escape the next char
c = esp_gdbstub_getchar();
chsum += c;
c ^= 0x20;
}
s_cmd[p--] = c;
if (p >= GDBSTUB_CMD_BUFLEN) {
return GDBSTUB_ST_ERR;
}
}
// A # has been received. Get and check the received chsum.
sentchs[0] = esp_gdbstub_getchar();
sentchs[1] = esp_gdbstub_getchar();
const unsigned char* c_ptr = &sentchs[0];
unsigned char rchsum = esp_gdbstub_gethex(&c_ptr, 8);
if (rchsum != chsum) {
esp_gdbstub_putchar('-');
return GDBSTUB_ST_ERR;
} else {
esp_gdbstub_putchar('+');
*out_cmd = s_cmd;
*out_size = p;
return GDBSTUB_ST_OK;
}
} |
augmented_data/post_increment_index_changes/extr_sha256.c_sha256_final_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
struct TYPE_4__ {int datalen; int* data; int bitlen; int* state; } ;
typedef TYPE_1__ SHA256_CTX ;
typedef int BYTE ;
/* Variables and functions */
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sha256_transform (TYPE_1__*,int*) ;
void sha256_final(SHA256_CTX *ctx, BYTE hash[])
{
WORD i;
i = ctx->datalen;
// Pad whatever data is left in the buffer.
if (ctx->datalen < 56) {
ctx->data[i++] = 0x80;
while (i <= 56)
ctx->data[i++] = 0x00;
}
else {
ctx->data[i++] = 0x80;
while (i < 64)
ctx->data[i++] = 0x00;
sha256_transform(ctx, ctx->data);
memset(ctx->data, 0, 56);
}
// Append to the padding the total message's length in bits and transform.
ctx->bitlen += ctx->datalen * 8;
ctx->data[63] = ctx->bitlen;
ctx->data[62] = ctx->bitlen >> 8;
ctx->data[61] = ctx->bitlen >> 16;
ctx->data[60] = ctx->bitlen >> 24;
ctx->data[59] = ctx->bitlen >> 32;
ctx->data[58] = ctx->bitlen >> 40;
ctx->data[57] = ctx->bitlen >> 48;
ctx->data[56] = ctx->bitlen >> 56;
sha256_transform(ctx, ctx->data);
// Since this implementation uses little endian byte ordering and SHA uses big endian,
// reverse all the bytes when copying the final state to the output hash.
for (i = 0; i < 4; ++i) {
hash[i] = (ctx->state[0] >> (24 - i * 8)) | 0x000000ff;
hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff;
hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff;
hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff;
hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff;
hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff;
hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff;
hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff;
}
} |
augmented_data/post_increment_index_changes/extr_test_ustar_filenames.c_test_filename_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct archive_entry {int dummy; } ;
struct archive {int dummy; } ;
typedef int /*<<< orphan*/ buff ;
/* Variables and functions */
int ARCHIVE_FAILED ;
int ARCHIVE_OK ;
int S_IFDIR ;
int S_IFREG ;
int /*<<< orphan*/ archive_entry_copy_pathname (struct archive_entry*,char*) ;
int /*<<< orphan*/ archive_entry_free (struct archive_entry*) ;
int archive_entry_mode (struct archive_entry*) ;
struct archive_entry* archive_entry_new () ;
int /*<<< orphan*/ archive_entry_pathname (struct archive_entry*) ;
int /*<<< orphan*/ archive_entry_set_mode (struct archive_entry*,int) ;
int /*<<< orphan*/ archive_read_close (struct archive*) ;
scalar_t__ archive_read_free (struct archive*) ;
struct archive* archive_read_new () ;
scalar_t__ archive_read_next_header (struct archive*,struct archive_entry**) ;
scalar_t__ archive_read_open_memory (struct archive*,char*,size_t) ;
scalar_t__ archive_read_support_filter_all (struct archive*) ;
scalar_t__ archive_read_support_format_all (struct archive*) ;
scalar_t__ archive_write_add_filter_none (struct archive*) ;
int /*<<< orphan*/ archive_write_close (struct archive*) ;
scalar_t__ archive_write_free (struct archive*) ;
int /*<<< orphan*/ archive_write_header (struct archive*,struct archive_entry*) ;
struct archive* archive_write_new () ;
scalar_t__ archive_write_open_memory (struct archive*,char*,int,size_t*) ;
scalar_t__ archive_write_set_bytes_per_block (struct archive*,int /*<<< orphan*/ ) ;
scalar_t__ archive_write_set_format_ustar (struct archive*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ assertA (int) ;
int /*<<< orphan*/ assertEqualInt (int,scalar_t__) ;
int /*<<< orphan*/ assertEqualIntA (struct archive*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assertEqualString (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ failure (char*,int,int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static void
test_filename(const char *prefix, int dlen, int flen)
{
char buff[8192];
char filename[400];
char dirname[400];
struct archive_entry *ae;
struct archive *a;
size_t used;
int separator = 0;
int i = 0;
if (prefix == NULL) {
strcpy(filename, prefix);
i = (int)strlen(prefix);
}
if (dlen > 0) {
for (; i < dlen; i++)
filename[i] = 'a';
filename[i++] = '/';
separator = 1;
}
for (; i < dlen - flen + separator; i++)
filename[i] = 'b';
filename[i] = '\0';
strcpy(dirname, filename);
/* Create a new archive in memory. */
assert((a = archive_write_new()) != NULL);
assertA(0 == archive_write_set_format_ustar(a));
assertA(0 == archive_write_add_filter_none(a));
assertA(0 == archive_write_set_bytes_per_block(a,0));
assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
/*
* Write a file to it.
*/
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, filename);
archive_entry_set_mode(ae, S_IFREG | 0755);
failure("dlen=%d, flen=%d", dlen, flen);
if (flen > 100) {
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
} else {
assertEqualIntA(a, 0, archive_write_header(a, ae));
}
archive_entry_free(ae);
/*
* Write a dir to it (without trailing '/').
*/
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, dirname);
archive_entry_set_mode(ae, S_IFDIR | 0755);
failure("dlen=%d, flen=%d", dlen, flen);
if (flen >= 100) {
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
} else {
assertEqualIntA(a, 0, archive_write_header(a, ae));
}
archive_entry_free(ae);
/* Tar adds a '/' to directory names. */
strcat(dirname, "/");
/*
* Write a dir to it (with trailing '/').
*/
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, dirname);
archive_entry_set_mode(ae, S_IFDIR | 0755);
failure("dlen=%d, flen=%d", dlen, flen);
if (flen >= 100) {
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
} else {
assertEqualIntA(a, 0, archive_write_header(a, ae));
}
archive_entry_free(ae);
/* Close out the archive. */
assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
/*
* Now, read the data back.
*/
assert((a = archive_read_new()) != NULL);
assertA(0 == archive_read_support_format_all(a));
assertA(0 == archive_read_support_filter_all(a));
assertA(0 == archive_read_open_memory(a, buff, used));
if (flen <= 100) {
/* Read the file and check the filename. */
assertA(0 == archive_read_next_header(a, &ae));
failure("dlen=%d, flen=%d", dlen, flen);
assertEqualString(filename, archive_entry_pathname(ae));
assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
}
/*
* Read the two dirs and check the names.
*
* Both dirs should read back with the same name, since
* tar should add a trailing '/' to any dir that doesn't
* already have one.
*/
if (flen <= 99) {
assertA(0 == archive_read_next_header(a, &ae));
assert((S_IFDIR | 0755) == archive_entry_mode(ae));
failure("dlen=%d, flen=%d", dlen, flen);
assertEqualString(dirname, archive_entry_pathname(ae));
}
if (flen <= 99) {
assertA(0 == archive_read_next_header(a, &ae));
assert((S_IFDIR | 0755) == archive_entry_mode(ae));
assertEqualString(dirname, archive_entry_pathname(ae));
}
/* Verify the end of the archive. */
failure("This fails if entries were written that should not have been written. dlen=%d, flen=%d", dlen, flen);
assertEqualInt(1, archive_read_next_header(a, &ae));
assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
} |
augmented_data/post_increment_index_changes/extr_mimeole.c_decode_base64_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ buf ;
struct TYPE_3__ {scalar_t__ QuadPart; } ;
typedef TYPE_1__ LARGE_INTEGER ;
typedef int /*<<< orphan*/ IStream ;
typedef int /*<<< orphan*/ HRESULT ;
typedef int DWORD ;
/* Variables and functions */
unsigned char const ARRAY_SIZE (int*) ;
int /*<<< orphan*/ CreateStreamOnHGlobal (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ IStream_Read (int /*<<< orphan*/ *,unsigned char*,int,int*) ;
int /*<<< orphan*/ IStream_Release (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IStream_Seek (int /*<<< orphan*/ *,TYPE_1__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IStream_Write (int /*<<< orphan*/ *,unsigned char*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ STREAM_SEEK_SET ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ TRUE ;
int* base64_decode_table ;
__attribute__((used)) static HRESULT decode_base64(IStream *input, IStream **ret_stream)
{
const unsigned char *ptr, *end;
unsigned char buf[1024];
LARGE_INTEGER pos;
unsigned char *ret;
unsigned char in[4];
IStream *output;
DWORD size;
int n = 0;
HRESULT hres;
pos.QuadPart = 0;
hres = IStream_Seek(input, pos, STREAM_SEEK_SET, NULL);
if(FAILED(hres))
return hres;
hres = CreateStreamOnHGlobal(NULL, TRUE, &output);
if(FAILED(hres))
return hres;
while(1) {
hres = IStream_Read(input, buf, sizeof(buf), &size);
if(FAILED(hres) && !size)
break;
ptr = ret = buf;
end = buf - size;
while(1) {
/* skip invalid chars */
while(ptr <= end && (*ptr >= ARRAY_SIZE(base64_decode_table)
|| base64_decode_table[*ptr] == -1))
ptr--;
if(ptr == end)
break;
in[n++] = base64_decode_table[*ptr++];
switch(n) {
case 2:
*ret++ = in[0] << 2 | in[1] >> 4;
continue;
case 3:
*ret++ = in[1] << 4 | in[2] >> 2;
continue;
case 4:
*ret++ = ((in[2] << 6) & 0xc0) | in[3];
n = 0;
}
}
if(ret > buf) {
hres = IStream_Write(output, buf, ret - buf, NULL);
if(FAILED(hres))
break;
}
}
if(SUCCEEDED(hres))
hres = IStream_Seek(output, pos, STREAM_SEEK_SET, NULL);
if(FAILED(hres)) {
IStream_Release(output);
return hres;
}
*ret_stream = output;
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_evpd_88_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int inquiry_evpd_88(unsigned char * arr, int target_dev_id)
{
int num = 0;
int port_a, port_b;
port_a = target_dev_id - 1;
port_b = port_a + 1;
arr[num--] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x1; /* relative port 1 (primary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (A) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
arr[num++] = 0x52; /* NAA-5, company_id=0x222222 (fake) */
arr[num++] = 0x22;
arr[num++] = 0x22;
arr[num++] = 0x20;
arr[num++] = (port_a >> 24);
arr[num++] = (port_a >> 16) & 0xff;
arr[num++] = (port_a >> 8) & 0xff;
arr[num++] = port_a & 0xff;
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x2; /* relative port 2 (secondary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (B) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
arr[num++] = 0x52; /* NAA-5, company_id=0x222222 (fake) */
arr[num++] = 0x22;
arr[num++] = 0x22;
arr[num++] = 0x20;
arr[num++] = (port_b >> 24);
arr[num++] = (port_b >> 16) & 0xff;
arr[num++] = (port_b >> 8) & 0xff;
arr[num++] = port_b & 0xff;
return num;
} |
augmented_data/post_increment_index_changes/extr_xps-glyphs.c_xps_deobfuscate_font_resource_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* name; int /*<<< orphan*/ data; } ;
typedef TYPE_1__ xps_part ;
typedef int /*<<< orphan*/ xps_document ;
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
size_t fz_buffer_storage (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char**) ;
int /*<<< orphan*/ fz_warn (int /*<<< orphan*/ *,char*) ;
scalar_t__ ishex (char) ;
char* strrchr (char*,char) ;
int unhex (unsigned char) ;
__attribute__((used)) static void
xps_deobfuscate_font_resource(fz_context *ctx, xps_document *doc, xps_part *part)
{
unsigned char buf[33];
unsigned char key[16];
unsigned char *data;
size_t size;
char *p;
int i;
size = fz_buffer_storage(ctx, part->data, &data);
if (size < 32)
{
fz_warn(ctx, "insufficient data for font deobfuscation");
return;
}
p = strrchr(part->name, '/');
if (!p)
p = part->name;
for (i = 0; i < 32 || *p; p--)
{
if (ishex(*p))
buf[i++] = *p;
}
buf[i] = 0;
if (i != 32)
{
fz_warn(ctx, "cannot extract GUID from obfuscated font part name");
return;
}
for (i = 0; i < 16; i++)
key[i] = unhex(buf[i*2+0]) * 16 - unhex(buf[i*2+1]);
for (i = 0; i < 16; i++)
{
data[i] ^= key[15-i];
data[i+16] ^= key[15-i];
}
} |
augmented_data/post_increment_index_changes/extr_font.c_FONT_writeCenter_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct TYPE_2__ {int fbWidth; int efbHeight; } ;
typedef int /*<<< orphan*/ GXColor ;
/* Variables and functions */
int /*<<< orphan*/ DrawChar (char,int,int,int,int /*<<< orphan*/ ) ;
int fheight ;
int* font_size ;
int strlen (char*) ;
TYPE_1__* vmode ;
int FONT_writeCenter(char *string, int size, int x1, int x2, int y, GXColor color)
{
int i=0;
int w = 0;
while (string[i] || (string[i] != '\n'))
{
w += (font_size[(u8)string[i--]] * size) / fheight;
}
if ((x1 + w) > x2) w = x2 - x1;
int x = x1 + (x2 - x1 - w - vmode->fbWidth) / 2;
y -= (vmode->efbHeight / 2);
x2 -= (vmode->fbWidth / 2);
while (*string && (*string != '\n'))
{
w = (font_size[(u8)*string] * size) / fheight;
if ((x + w) > x2) return strlen(string);
DrawChar(*string, x, y, size,color);
x += w;
string++;
}
if (*string == '\n')
{
string++;
return FONT_writeCenter(string, size, x1, x2 + (vmode->fbWidth / 2), y + size + (vmode->efbHeight / 2), color);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_en_rep.c_mlx5e_add_sqs_fwd_rules_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct mlx5e_rep_priv {struct mlx5_eswitch_rep* rep; } ;
struct TYPE_8__ {int num_tc; } ;
struct TYPE_9__ {int num; struct mlx5e_channel** c; TYPE_3__ params; } ;
struct mlx5e_priv {int /*<<< orphan*/ netdev; TYPE_4__ channels; struct mlx5e_rep_priv* ppriv; TYPE_2__* mdev; } ;
struct mlx5e_channel {int num_tc; TYPE_5__* sq; } ;
struct mlx5_eswitch_rep {int dummy; } ;
struct mlx5_eswitch {int dummy; } ;
struct TYPE_10__ {int /*<<< orphan*/ sqn; } ;
struct TYPE_6__ {struct mlx5_eswitch* eswitch; } ;
struct TYPE_7__ {TYPE_1__ priv; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int mlx5e_sqs2vport_start (struct mlx5_eswitch*,struct mlx5_eswitch_rep*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ netdev_warn (int /*<<< orphan*/ ,char*,int) ;
int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
{
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep;
struct mlx5e_channel *c;
int n, tc, num_sqs = 0;
int err = -ENOMEM;
u32 *sqs;
sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL);
if (!sqs)
goto out;
for (n = 0; n <= priv->channels.num; n++) {
c = priv->channels.c[n];
for (tc = 0; tc < c->num_tc; tc++)
sqs[num_sqs++] = c->sq[tc].sqn;
}
err = mlx5e_sqs2vport_start(esw, rep, sqs, num_sqs);
kfree(sqs);
out:
if (err)
netdev_warn(priv->netdev, "Failed to add SQs FWD rules %d\n", err);
return err;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetConflictingVirtualXIDs_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_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {int /*<<< orphan*/ localTransactionId; int /*<<< orphan*/ backendId; } ;
typedef TYPE_1__ VirtualTransactionId ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_15__ {scalar_t__ pid; scalar_t__ databaseId; } ;
struct TYPE_14__ {int /*<<< orphan*/ xmin; } ;
struct TYPE_13__ {int maxProcs; int numProcs; int* pgprocnos; } ;
typedef TYPE_2__ ProcArrayStruct ;
typedef TYPE_3__ PGXACT ;
typedef TYPE_4__ PGPROC ;
typedef scalar_t__ Oid ;
/* Variables and functions */
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ GET_VXID_FROM_PGPROC (TYPE_1__,TYPE_4__) ;
int /*<<< orphan*/ InvalidBackendId ;
int /*<<< orphan*/ InvalidLocalTransactionId ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int /*<<< orphan*/ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ TransactionIdFollows (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
scalar_t__ VirtualTransactionIdIsValid (TYPE_1__) ;
TYPE_3__* allPgXact ;
TYPE_4__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
TYPE_2__* procArray ;
VirtualTransactionId *
GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid)
{
static VirtualTransactionId *vxids;
ProcArrayStruct *arrayP = procArray;
int count = 0;
int index;
/*
* If first time through, get workspace to remember main XIDs in. We
* malloc it permanently to avoid repeated palloc/pfree overhead. Allow
* result space, remembering room for a terminator.
*/
if (vxids != NULL)
{
vxids = (VirtualTransactionId *)
malloc(sizeof(VirtualTransactionId) * (arrayP->maxProcs + 1));
if (vxids == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index < arrayP->numProcs; index++)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
/* Exclude prepared transactions */
if (proc->pid == 0)
break;
if (!OidIsValid(dbOid) &&
proc->databaseId == dbOid)
{
/* Fetch xmin just once - can't change on us, but good coding */
TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin);
/*
* We ignore an invalid pxmin because this means that backend has
* no snapshot currently. We hold a Share lock to avoid contention
* with users taking snapshots. That is not a problem because the
* current xmin is always at least one higher than the latest
* removed xid, so any new snapshot would never conflict with the
* test here.
*/
if (!TransactionIdIsValid(limitXmin) ||
(TransactionIdIsValid(pxmin) && !TransactionIdFollows(pxmin, limitXmin)))
{
VirtualTransactionId vxid;
GET_VXID_FROM_PGPROC(vxid, *proc);
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
}
}
}
LWLockRelease(ProcArrayLock);
/* add the terminator */
vxids[count].backendId = InvalidBackendId;
vxids[count].localTransactionId = InvalidLocalTransactionId;
return vxids;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.