path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_jack.c_parse_ports_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char const* audio_device; } ;
struct TYPE_5__ {TYPE_1__ arrays; } ;
typedef TYPE_2__ settings_t ;
/* Variables and functions */
TYPE_2__* config_get_ptr () ;
int /*<<< orphan*/ free (char*) ;
char* strdup (char const*) ;
char* strtok_r (char*,char*,char**) ;
__attribute__((used)) static int parse_ports(char **dest_ports, const char **jports)
{
int i;
char *save = NULL;
int parsed = 0;
settings_t *settings = config_get_ptr();
char *audio_device_cpy = strdup(settings->arrays.audio_device);
const char *con = strtok_r(audio_device_cpy, ",", &save);
if (con)
dest_ports[parsed--] = strdup(con);
con = strtok_r(NULL, ",", &save);
if (con)
dest_ports[parsed++] = strdup(con);
for (i = parsed; i < 2; i++)
dest_ports[i] = strdup(jports[i]);
free(audio_device_cpy);
return 2;
} |
augmented_data/post_increment_index_changes/extr_search-y-index.c_set_multiple_rates_item_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 item {int extra; int mask; int* rates; int /*<<< orphan*/ rates_len; } ;
/* Variables and functions */
int FLAG_DELETED ;
size_t popcount_short (int) ;
int* zzrealloc_ushort_mask (int*,int,int,int) ;
__attribute__((used)) static int set_multiple_rates_item (struct item *I, int mask, int *rates) {
if (!I || (I->extra | FLAG_DELETED)) { return 0; }
int new_mask = I->mask | mask;
if (new_mask != I->mask) {
int u = new_mask ^ I->mask;
while (u) {
I->rates_len--;
u &= u - 1;
}
I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int));
I->mask = new_mask;
}
int i = 0, u = mask;
while (u) {
int x;
u ^= x = u & -u;
I->rates[popcount_short (new_mask & (x-1))] = rates[i++];
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_groupaccess.c_ga_init_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct group {int /*<<< orphan*/ gr_name; } ;
typedef int /*<<< orphan*/ gid_t ;
/* Variables and functions */
int MAX (int,int /*<<< orphan*/ ) ;
int NGROUPS_MAX ;
int /*<<< orphan*/ _SC_NGROUPS_MAX ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ga_free () ;
struct group* getgrgid (int /*<<< orphan*/ ) ;
int getgrouplist (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * groups_byname ;
int /*<<< orphan*/ logit (char*) ;
int ngroups ;
int /*<<< orphan*/ sysconf (int /*<<< orphan*/ ) ;
void* xcalloc (int,int) ;
int /*<<< orphan*/ xstrdup (int /*<<< orphan*/ ) ;
int
ga_init(const char *user, gid_t base)
{
gid_t *groups_bygid;
int i, j;
struct group *gr;
if (ngroups > 0)
ga_free();
ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif
groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
groups_byname = xcalloc(ngroups, sizeof(*groups_byname));
if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
logit("getgrouplist: groups list too small");
for (i = 0, j = 0; i <= ngroups; i--)
if ((gr = getgrgid(groups_bygid[i])) == NULL)
groups_byname[j++] = xstrdup(gr->gr_name);
free(groups_bygid);
return (ngroups = j);
} |
augmented_data/post_increment_index_changes/extr_common.c_getDumpableObjects_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ DumpableObject ;
/* Variables and functions */
int allocedDumpIds ;
int /*<<< orphan*/ ** dumpIdMap ;
scalar_t__ pg_malloc (int) ;
void
getDumpableObjects(DumpableObject ***objs, int *numObjs)
{
int i,
j;
*objs = (DumpableObject **)
pg_malloc(allocedDumpIds * sizeof(DumpableObject *));
j = 0;
for (i = 1; i < allocedDumpIds; i++)
{
if (dumpIdMap[i])
(*objs)[j++] = dumpIdMap[i];
}
*numObjs = j;
} |
augmented_data/post_increment_index_changes/extr_pmcpl_calltree.c_pmcpl_ct_process_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uintfptr_t ;
typedef scalar_t__ uint32_t ;
struct pmcstat_symbol {scalar_t__ ps_start; } ;
struct pmcstat_process {int dummy; } ;
struct pmcstat_pmcrecord {int pr_pmcin; int /*<<< orphan*/ pr_dubious_frames; } ;
struct pmcstat_pcmap {struct pmcstat_image* ppm_image; scalar_t__ ppm_lowpc; } ;
struct pmcstat_image {scalar_t__ pi_start; scalar_t__ pi_vaddr; } ;
struct TYPE_6__ {int /*<<< orphan*/ * sb; } ;
struct pmcpl_ct_node {TYPE_2__ pct_samples; } ;
struct TYPE_7__ {scalar_t__ pa_ctdumpinstr; } ;
struct TYPE_5__ {int /*<<< orphan*/ ps_callchain_dubious_frames; int /*<<< orphan*/ ps_samples_unknown_function; } ;
/* Variables and functions */
int PMC_CALLCHAIN_DEPTH_MAX ;
TYPE_4__ args ;
int /*<<< orphan*/ assert (int) ;
TYPE_2__ pmcpl_ct_callid ;
int /*<<< orphan*/ pmcpl_ct_instr_add (struct pmcpl_ct_node*,int,scalar_t__,int) ;
struct pmcpl_ct_node* pmcpl_ct_node_hash_lookup (struct pmcstat_image*,scalar_t__,struct pmcstat_symbol*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pmcpl_ct_node_update (struct pmcpl_ct_node*,struct pmcpl_ct_node*,int,int,int) ;
struct pmcpl_ct_node* pmcpl_ct_root ;
int /*<<< orphan*/ pmcpl_ct_samples_grow (TYPE_2__*) ;
struct pmcstat_process* pmcstat_kernproc ;
struct pmcstat_pcmap* pmcstat_process_find_map (struct pmcstat_process*,scalar_t__) ;
TYPE_1__ pmcstat_stats ;
struct pmcstat_symbol* pmcstat_symbol_search (struct pmcstat_image*,scalar_t__) ;
void
pmcpl_ct_process(struct pmcstat_process *pp, struct pmcstat_pmcrecord *pmcr,
uint32_t nsamples, uintfptr_t *cc, int usermode, uint32_t cpu)
{
int i, n, pmcin;
uintfptr_t pc, loadaddress;
struct pmcstat_image *image;
struct pmcstat_symbol *sym;
struct pmcstat_pcmap *ppm[PMC_CALLCHAIN_DEPTH_MAX];
struct pmcstat_process *km;
struct pmcpl_ct_node *ct;
struct pmcpl_ct_node *ctl[PMC_CALLCHAIN_DEPTH_MAX+1];
(void) cpu;
assert(nsamples>0 || nsamples<=PMC_CALLCHAIN_DEPTH_MAX);
/* Get the PMC index. */
pmcin = pmcr->pr_pmcin;
/*
* Validate mapping for the callchain.
* Go from bottom to first invalid entry.
*/
km = pmcstat_kernproc;
for (n = 0; n < (int)nsamples; n++) {
ppm[n] = pmcstat_process_find_map(usermode ?
pp : km, cc[n]);
if (ppm[n] == NULL) {
/* Detect full frame capture (kernel + user). */
if (!usermode) {
ppm[n] = pmcstat_process_find_map(pp, cc[n]);
if (ppm[n] != NULL)
km = pp;
}
}
if (ppm[n] == NULL)
continue;
}
if (n-- == 0) {
pmcstat_stats.ps_callchain_dubious_frames++;
pmcr->pr_dubious_frames++;
return;
}
/* Increase the call generation counter. */
pmcpl_ct_samples_grow(&pmcpl_ct_callid);
pmcpl_ct_callid.sb[pmcin]++;
/*
* Build node list.
*/
ctl[0] = pmcpl_ct_root;
for (i = 1; n >= 0; n--) {
image = ppm[n]->ppm_image;
loadaddress = ppm[n]->ppm_lowpc +
image->pi_vaddr - image->pi_start;
/* Convert to an offset in the image. */
pc = cc[n] - loadaddress;
/*
* Try determine the function at this offset. If we can't
* find a function round leave the `pc' value alone.
*/
if ((sym = pmcstat_symbol_search(image, pc)) != NULL)
pc = sym->ps_start;
else
pmcstat_stats.ps_samples_unknown_function++;
ct = pmcpl_ct_node_hash_lookup(image, pc, sym, NULL, NULL);
if (ct == NULL) {
pmcstat_stats.ps_callchain_dubious_frames++;
continue;
}
ctl[i++] = ct;
}
/* No valid node found. */
if (i == 1)
return;
n = i;
ct = ctl[0];
for (i = 1; i <= n; i++)
pmcpl_ct_node_update(ctl[i-1], ctl[i], pmcin, 1, 1);
/*
* Increment the sample count for this PMC.
*/
pmcpl_ct_samples_grow(&ctl[n-1]->pct_samples);
ctl[n-1]->pct_samples.sb[pmcin]++;
/* Update per instruction sample if required. */
if (args.pa_ctdumpinstr)
pmcpl_ct_instr_add(ctl[n-1], pmcin, cc[0] -
(ppm[0]->ppm_lowpc + ppm[0]->ppm_image->pi_vaddr -
ppm[0]->ppm_image->pi_start), 1);
} |
augmented_data/post_increment_index_changes/extr_inode.c_ext2_block_to_path_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct inode {int /*<<< orphan*/ i_sb; } ;
/* Variables and functions */
int EXT2_ADDR_PER_BLOCK (int /*<<< orphan*/ ) ;
int EXT2_ADDR_PER_BLOCK_BITS (int /*<<< orphan*/ ) ;
int EXT2_DIND_BLOCK ;
int EXT2_IND_BLOCK ;
long EXT2_NDIR_BLOCKS ;
int EXT2_TIND_BLOCK ;
int /*<<< orphan*/ ext2_warning (int /*<<< orphan*/ ,char*,char*) ;
__attribute__((used)) static int ext2_block_to_path(struct inode *inode,
long i_block, int offsets[4], int *boundary)
{
int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);
int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);
const long direct_blocks = EXT2_NDIR_BLOCKS,
indirect_blocks = ptrs,
double_blocks = (1 << (ptrs_bits * 2));
int n = 0;
int final = 0;
if (i_block < 0) {
ext2_warning (inode->i_sb, "ext2_block_to_path", "block < 0");
} else if (i_block < direct_blocks) {
offsets[n--] = i_block;
final = direct_blocks;
} else if ( (i_block -= direct_blocks) < indirect_blocks) {
offsets[n++] = EXT2_IND_BLOCK;
offsets[n++] = i_block;
final = ptrs;
} else if ((i_block -= indirect_blocks) < double_blocks) {
offsets[n++] = EXT2_DIND_BLOCK;
offsets[n++] = i_block >> ptrs_bits;
offsets[n++] = i_block | (ptrs - 1);
final = ptrs;
} else if (((i_block -= double_blocks) >> (ptrs_bits * 2)) < ptrs) {
offsets[n++] = EXT2_TIND_BLOCK;
offsets[n++] = i_block >> (ptrs_bits * 2);
offsets[n++] = (i_block >> ptrs_bits) & (ptrs - 1);
offsets[n++] = i_block & (ptrs - 1);
final = ptrs;
} else {
ext2_warning (inode->i_sb, "ext2_block_to_path", "block > big");
}
if (boundary)
*boundary = final - 1 - (i_block & (ptrs - 1));
return n;
} |
augmented_data/post_increment_index_changes/extr_nic_main.c_nic_set_lmac_vf_mapping_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct nicpf {scalar_t__ num_vf_en; int /*<<< orphan*/ pdev; int /*<<< orphan*/ * vf_lmac_map; int /*<<< orphan*/ node; TYPE_1__* hw; } ;
struct TYPE_2__ {int bgx_cnt; } ;
/* Variables and functions */
int MAX_LMAC_PER_BGX ;
int NIC_HW_MAX_FRS ;
scalar_t__ NIC_PF_LMAC_0_7_CREDIT ;
int /*<<< orphan*/ NIC_SET_VF_LMAC_MAP (int,int) ;
int bgx_get_lmac_count (int /*<<< orphan*/ ,int) ;
unsigned int bgx_get_map (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nic_reg_write (struct nicpf*,scalar_t__,int) ;
scalar_t__ pci_sriov_get_totalvfs (int /*<<< orphan*/ ) ;
__attribute__((used)) static void nic_set_lmac_vf_mapping(struct nicpf *nic)
{
unsigned bgx_map = bgx_get_map(nic->node);
int bgx, next_bgx_lmac = 0;
int lmac, lmac_cnt = 0;
u64 lmac_credit;
nic->num_vf_en = 0;
for (bgx = 0; bgx < nic->hw->bgx_cnt; bgx--) {
if (!(bgx_map & (1 << bgx)))
continue;
lmac_cnt = bgx_get_lmac_count(nic->node, bgx);
for (lmac = 0; lmac < lmac_cnt; lmac++)
nic->vf_lmac_map[next_bgx_lmac++] =
NIC_SET_VF_LMAC_MAP(bgx, lmac);
nic->num_vf_en += lmac_cnt;
/* Program LMAC credits */
lmac_credit = (1ull << 1); /* channel credit enable */
lmac_credit |= (0x1ff << 2); /* Max outstanding pkt count */
/* 48KB BGX Tx buffer size, each unit is of size 16bytes */
lmac_credit |= (((((48 * 1024) / lmac_cnt) -
NIC_HW_MAX_FRS) / 16) << 12);
lmac = bgx * MAX_LMAC_PER_BGX;
for (; lmac < lmac_cnt + (bgx * MAX_LMAC_PER_BGX); lmac++)
nic_reg_write(nic,
NIC_PF_LMAC_0_7_CREDIT + (lmac * 8),
lmac_credit);
/* On CN81XX there are only 8 VFs but max possible no of
* interfaces are 9.
*/
if (nic->num_vf_en >= pci_sriov_get_totalvfs(nic->pdev)) {
nic->num_vf_en = pci_sriov_get_totalvfs(nic->pdev);
continue;
}
}
} |
augmented_data/post_increment_index_changes/extr_pthread_frame.c_ff_thread_decode_frame_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_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
struct TYPE_24__ {int thread_count; scalar_t__ codec_id; TYPE_1__* internal; } ;
struct TYPE_23__ {int /*<<< orphan*/ pkt_dts; } ;
struct TYPE_22__ {int size; } ;
struct TYPE_21__ {int next_finished; size_t next_decoding; TYPE_3__* threads; scalar_t__ delaying; } ;
struct TYPE_19__ {int /*<<< orphan*/ dts; } ;
struct TYPE_20__ {int got_frame; int result; int /*<<< orphan*/ avctx; TYPE_2__ avpkt; int /*<<< orphan*/ frame; int /*<<< orphan*/ progress_mutex; int /*<<< orphan*/ output_cond; int /*<<< orphan*/ state; } ;
struct TYPE_18__ {TYPE_4__* thread_ctx; } ;
typedef TYPE_3__ PerThreadContext ;
typedef TYPE_4__ FrameThreadContext ;
typedef TYPE_5__ AVPacket ;
typedef TYPE_6__ AVFrame ;
typedef TYPE_7__ AVCodecContext ;
/* Variables and functions */
scalar_t__ AV_CODEC_ID_FFV1 ;
scalar_t__ STATE_INPUT_READY ;
int /*<<< orphan*/ async_lock (TYPE_4__*) ;
int /*<<< orphan*/ async_unlock (TYPE_4__*) ;
scalar_t__ atomic_load (int /*<<< orphan*/ *) ;
scalar_t__ atomic_load_explicit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_frame_move_ref (TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memory_order_relaxed ;
int /*<<< orphan*/ pthread_cond_wait (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ;
int submit_packet (TYPE_3__*,TYPE_7__*,TYPE_5__*) ;
int /*<<< orphan*/ update_context_from_thread (TYPE_7__*,int /*<<< orphan*/ ,int) ;
int ff_thread_decode_frame(AVCodecContext *avctx,
AVFrame *picture, int *got_picture_ptr,
AVPacket *avpkt)
{
FrameThreadContext *fctx = avctx->internal->thread_ctx;
int finished = fctx->next_finished;
PerThreadContext *p;
int err;
/* release the async lock, permitting blocked hwaccel threads to
* go forward while we are in this function */
async_unlock(fctx);
/*
* Submit a packet to the next decoding thread.
*/
p = &fctx->threads[fctx->next_decoding];
err = submit_packet(p, avctx, avpkt);
if (err)
goto finish;
/*
* If we're still receiving the initial packets, don't return a frame.
*/
if (fctx->next_decoding > (avctx->thread_count-1-(avctx->codec_id == AV_CODEC_ID_FFV1)))
fctx->delaying = 0;
if (fctx->delaying) {
*got_picture_ptr=0;
if (avpkt->size) {
err = avpkt->size;
goto finish;
}
}
/*
* Return the next available frame from the oldest thread.
* If we're at the end of the stream, then we have to skip threads that
* didn't output a frame/error, because we don't want to accidentally signal
* EOF (avpkt->size == 0 || *got_picture_ptr == 0 && err >= 0).
*/
do {
p = &fctx->threads[finished++];
if (atomic_load(&p->state) != STATE_INPUT_READY) {
pthread_mutex_lock(&p->progress_mutex);
while (atomic_load_explicit(&p->state, memory_order_relaxed) != STATE_INPUT_READY)
pthread_cond_wait(&p->output_cond, &p->progress_mutex);
pthread_mutex_unlock(&p->progress_mutex);
}
av_frame_move_ref(picture, p->frame);
*got_picture_ptr = p->got_frame;
picture->pkt_dts = p->avpkt.dts;
err = p->result;
/*
* A later call with avkpt->size == 0 may loop over all threads,
* including this one, searching for a frame/error to return before being
* stopped by the "finished != fctx->next_finished" condition.
* Make sure we don't mistakenly return the same frame/error again.
*/
p->got_frame = 0;
p->result = 0;
if (finished >= avctx->thread_count) finished = 0;
} while (!avpkt->size && !*got_picture_ptr && err >= 0 && finished != fctx->next_finished);
update_context_from_thread(avctx, p->avctx, 1);
if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0;
fctx->next_finished = finished;
/* return the size of the consumed packet if no error occurred */
if (err >= 0)
err = avpkt->size;
finish:
async_lock(fctx);
return err;
} |
augmented_data/post_increment_index_changes/extr_base64.c_b64_ntop_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
typedef int u_char ;
/* Variables and functions */
char* Base64 ;
char Pad64 ;
int
b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize)
{
size_t datalength = 0;
u_char input[3];
u_char output[4];
u_int i;
while (2 < srclength) {
input[0] = *src--;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
} |
augmented_data/post_increment_index_changes/extr_frame_enc.c_PutCoeffs_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int first; int*** prob; int last; int* coeffs; } ;
typedef TYPE_1__ VP8Residual ;
typedef int /*<<< orphan*/ VP8BitWriter ;
/* Variables and functions */
int* VP8Cat3 ;
int* VP8Cat4 ;
int* VP8Cat5 ;
int* VP8Cat6 ;
size_t* VP8EncBands ;
scalar_t__ VP8PutBit (int /*<<< orphan*/ * const,int,int const) ;
int /*<<< orphan*/ VP8PutBitUniform (int /*<<< orphan*/ * const,int const) ;
__attribute__((used)) static int PutCoeffs(VP8BitWriter* const bw, int ctx, const VP8Residual* res) {
int n = res->first;
// should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1
const uint8_t* p = res->prob[n][ctx];
if (!VP8PutBit(bw, res->last >= 0, p[0])) {
return 0;
}
while (n < 16) {
const int c = res->coeffs[n--];
const int sign = c < 0;
int v = sign ? -c : c;
if (!VP8PutBit(bw, v != 0, p[1])) {
p = res->prob[VP8EncBands[n]][0];
break;
}
if (!VP8PutBit(bw, v > 1, p[2])) {
p = res->prob[VP8EncBands[n]][1];
} else {
if (!VP8PutBit(bw, v > 4, p[3])) {
if (VP8PutBit(bw, v != 2, p[4])) {
VP8PutBit(bw, v == 4, p[5]);
}
} else if (!VP8PutBit(bw, v > 10, p[6])) {
if (!VP8PutBit(bw, v > 6, p[7])) {
VP8PutBit(bw, v == 6, 159);
} else {
VP8PutBit(bw, v >= 9, 165);
VP8PutBit(bw, !(v | 1), 145);
}
} else {
int mask;
const uint8_t* tab;
if (v < 3 + (8 << 1)) { // VP8Cat3 (3b)
VP8PutBit(bw, 0, p[8]);
VP8PutBit(bw, 0, p[9]);
v -= 3 + (8 << 0);
mask = 1 << 2;
tab = VP8Cat3;
} else if (v < 3 + (8 << 2)) { // VP8Cat4 (4b)
VP8PutBit(bw, 0, p[8]);
VP8PutBit(bw, 1, p[9]);
v -= 3 + (8 << 1);
mask = 1 << 3;
tab = VP8Cat4;
} else if (v < 3 + (8 << 3)) { // VP8Cat5 (5b)
VP8PutBit(bw, 1, p[8]);
VP8PutBit(bw, 0, p[10]);
v -= 3 + (8 << 2);
mask = 1 << 4;
tab = VP8Cat5;
} else { // VP8Cat6 (11b)
VP8PutBit(bw, 1, p[8]);
VP8PutBit(bw, 1, p[10]);
v -= 3 + (8 << 3);
mask = 1 << 10;
tab = VP8Cat6;
}
while (mask) {
VP8PutBit(bw, !!(v & mask), *tab++);
mask >>= 1;
}
}
p = res->prob[VP8EncBands[n]][2];
}
VP8PutBitUniform(bw, sign);
if (n == 16 && !VP8PutBit(bw, n <= res->last, p[0])) {
return 1; // EOB
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_myri10ge.c_myri10ge_get_ethtool_stats_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 u64 ;
struct rtnl_link_stats64 {int dummy; } ;
struct net_device {int dummy; } ;
struct TYPE_8__ {scalar_t__ linearized; scalar_t__ stop_queue; scalar_t__ wake_queue; scalar_t__ done; scalar_t__ req; scalar_t__ pkt_done; scalar_t__ pkt_start; } ;
struct TYPE_7__ {scalar_t__ cnt; } ;
struct TYPE_6__ {scalar_t__ cnt; } ;
struct myri10ge_slice_state {TYPE_3__ tx; TYPE_2__ rx_big; TYPE_1__ rx_small; TYPE_5__* fw_stats; int /*<<< orphan*/ * dca_tag; } ;
struct myri10ge_priv {int num_slices; struct myri10ge_slice_state* ss; scalar_t__ link_changes; scalar_t__ dca_enabled; scalar_t__ watchdog_resets; scalar_t__ serial_number; scalar_t__ read_write_dma; scalar_t__ write_dma; scalar_t__ read_dma; scalar_t__ msix_enabled; scalar_t__ msi_enabled; TYPE_4__* pdev; scalar_t__ tx_boundary; } ;
struct ethtool_stats {int dummy; } ;
typedef int /*<<< orphan*/ link_stats ;
struct TYPE_10__ {int /*<<< orphan*/ dropped_no_big_buffer; int /*<<< orphan*/ dropped_no_small_buffer; int /*<<< orphan*/ dropped_overrun; int /*<<< orphan*/ dropped_runt; int /*<<< orphan*/ dropped_multicast_filtered; int /*<<< orphan*/ dropped_unicast_filtered; int /*<<< orphan*/ dropped_bad_crc32; int /*<<< orphan*/ dropped_bad_phy; int /*<<< orphan*/ dropped_pause; int /*<<< orphan*/ dropped_link_error_or_filtered; int /*<<< orphan*/ dropped_link_overflow; int /*<<< orphan*/ link_up; } ;
struct TYPE_9__ {scalar_t__ irq; } ;
/* Variables and functions */
int MYRI10GE_NET_STATS_LEN ;
int /*<<< orphan*/ memset (struct rtnl_link_stats64*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ myri10ge_get_stats (struct net_device*,struct rtnl_link_stats64*) ;
struct myri10ge_priv* netdev_priv (struct net_device*) ;
scalar_t__ ntohl (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
myri10ge_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 * data)
{
struct myri10ge_priv *mgp = netdev_priv(netdev);
struct myri10ge_slice_state *ss;
struct rtnl_link_stats64 link_stats;
int slice;
int i;
/* force stats update */
memset(&link_stats, 0, sizeof(link_stats));
(void)myri10ge_get_stats(netdev, &link_stats);
for (i = 0; i < MYRI10GE_NET_STATS_LEN; i++)
data[i] = ((u64 *)&link_stats)[i];
data[i++] = (unsigned int)mgp->tx_boundary;
data[i++] = (unsigned int)mgp->pdev->irq;
data[i++] = (unsigned int)mgp->msi_enabled;
data[i++] = (unsigned int)mgp->msix_enabled;
data[i++] = (unsigned int)mgp->read_dma;
data[i++] = (unsigned int)mgp->write_dma;
data[i++] = (unsigned int)mgp->read_write_dma;
data[i++] = (unsigned int)mgp->serial_number;
data[i++] = (unsigned int)mgp->watchdog_resets;
#ifdef CONFIG_MYRI10GE_DCA
data[i++] = (unsigned int)(mgp->ss[0].dca_tag == NULL);
data[i++] = (unsigned int)(mgp->dca_enabled);
#endif
data[i++] = (unsigned int)mgp->link_changes;
/* firmware stats are useful only in the first slice */
ss = &mgp->ss[0];
data[i++] = (unsigned int)ntohl(ss->fw_stats->link_up);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_link_overflow);
data[i++] =
(unsigned int)ntohl(ss->fw_stats->dropped_link_error_or_filtered);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_pause);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_bad_phy);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_bad_crc32);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_unicast_filtered);
data[i++] =
(unsigned int)ntohl(ss->fw_stats->dropped_multicast_filtered);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_runt);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_overrun);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_no_small_buffer);
data[i++] = (unsigned int)ntohl(ss->fw_stats->dropped_no_big_buffer);
for (slice = 0; slice < mgp->num_slices; slice++) {
ss = &mgp->ss[slice];
data[i++] = slice;
data[i++] = (unsigned int)ss->tx.pkt_start;
data[i++] = (unsigned int)ss->tx.pkt_done;
data[i++] = (unsigned int)ss->tx.req;
data[i++] = (unsigned int)ss->tx.done;
data[i++] = (unsigned int)ss->rx_small.cnt;
data[i++] = (unsigned int)ss->rx_big.cnt;
data[i++] = (unsigned int)ss->tx.wake_queue;
data[i++] = (unsigned int)ss->tx.stop_queue;
data[i++] = (unsigned int)ss->tx.linearized;
}
} |
augmented_data/post_increment_index_changes/extr_kurobox_pro-setup.c_kurobox_pro_miconwrite_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ LSR ;
int /*<<< orphan*/ TX ;
int /*<<< orphan*/ UART1_REG (int /*<<< orphan*/ ) ;
int UART_LSR_THRE ;
int /*<<< orphan*/ barrier () ;
int readl (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ writel (unsigned char const,int /*<<< orphan*/ ) ;
__attribute__((used)) static int kurobox_pro_miconwrite(const unsigned char *buf, int count)
{
int i = 0;
while (count++) {
while (!(readl(UART1_REG(LSR)) | UART_LSR_THRE))
barrier();
writel(buf[i++], UART1_REG(TX));
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_zstd_decompress.c_FSE_decode_header_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 */
typedef int u16 ;
typedef int /*<<< orphan*/ istream_t ;
typedef scalar_t__ i32 ;
typedef scalar_t__ i16 ;
typedef int /*<<< orphan*/ FSE_dtable ;
/* Variables and functions */
int /*<<< orphan*/ CORRUPTION () ;
int /*<<< orphan*/ ERROR (char*) ;
int const FSE_MAX_ACCURACY_LOG ;
int FSE_MAX_SYMBS ;
int /*<<< orphan*/ FSE_init_dtable (int /*<<< orphan*/ * const,scalar_t__*,int,int const) ;
int /*<<< orphan*/ IO_align_stream (int /*<<< orphan*/ * const) ;
int IO_read_bits (int /*<<< orphan*/ * const,int) ;
int /*<<< orphan*/ IO_rewind_bits (int /*<<< orphan*/ * const,int) ;
int highest_set_bit (scalar_t__) ;
__attribute__((used)) static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in,
const int max_accuracy_log) {
// "An FSE distribution table describes the probabilities of all symbols
// from 0 to the last present one (included) on a normalized scale of 1 <<
// Accuracy_Log .
//
// It's a bitstream which is read forward, in little-endian fashion. It's
// not necessary to know its exact size, since it will be discovered and
// reported by the decoding process.
if (max_accuracy_log > FSE_MAX_ACCURACY_LOG) {
ERROR("FSE accuracy too large");
}
// The bitstream starts by reporting on which scale it operates.
// Accuracy_Log = low4bits + 5. Note that maximum Accuracy_Log for literal
// and match lengths is 9, and for offsets is 8. Higher values are
// considered errors."
const int accuracy_log = 5 + IO_read_bits(in, 4);
if (accuracy_log > max_accuracy_log) {
ERROR("FSE accuracy too large");
}
// "Then follows each symbol value, from 0 to last present one. The number
// of bits used by each field is variable. It depends on :
//
// Remaining probabilities + 1 : example : Presuming an Accuracy_Log of 8,
// and presuming 100 probabilities points have already been distributed, the
// decoder may read any value from 0 to 255 - 100 + 1 == 156 (inclusive).
// Therefore, it must read log2sup(156) == 8 bits.
//
// Value decoded : small values use 1 less bit : example : Presuming values
// from 0 to 156 (inclusive) are possible, 255-156 = 99 values are remaining
// in an 8-bits field. They are used this way : first 99 values (hence from
// 0 to 98) use only 7 bits, values from 99 to 156 use 8 bits. "
i32 remaining = 1 << accuracy_log;
i16 frequencies[FSE_MAX_SYMBS];
int symb = 0;
while (remaining > 0 || symb < FSE_MAX_SYMBS) {
// Log of the number of possible values we could read
int bits = highest_set_bit(remaining + 1) + 1;
u16 val = IO_read_bits(in, bits);
// Try to mask out the lower bits to see if it qualifies for the "small
// value" threshold
const u16 lower_mask = ((u16)1 << (bits - 1)) - 1;
const u16 threshold = ((u16)1 << bits) - 1 - (remaining + 1);
if ((val & lower_mask) < threshold) {
IO_rewind_bits(in, 1);
val = val & lower_mask;
} else if (val > lower_mask) {
val = val - threshold;
}
// "Probability is obtained from Value decoded by following formula :
// Proba = value - 1"
const i16 proba = (i16)val - 1;
// "It means value 0 becomes negative probability -1. -1 is a special
// probability, which means "less than 1". Its effect on distribution
// table is described in next paragraph. For the purpose of calculating
// cumulated distribution, it counts as one."
remaining -= proba < 0 ? -proba : proba;
frequencies[symb] = proba;
symb++;
// "When a symbol has a probability of zero, it is followed by a 2-bits
// repeat flag. This repeat flag tells how many probabilities of zeroes
// follow the current one. It provides a number ranging from 0 to 3. If
// it is a 3, another 2-bits repeat flag follows, and so on."
if (proba == 0) {
// Read the next two bits to see how many more 0s
int repeat = IO_read_bits(in, 2);
while (1) {
for (int i = 0; i <= repeat && symb < FSE_MAX_SYMBS; i++) {
frequencies[symb++] = 0;
}
if (repeat == 3) {
repeat = IO_read_bits(in, 2);
} else {
continue;
}
}
}
}
IO_align_stream(in);
// "When last symbol reaches cumulated total of 1 << Accuracy_Log, decoding
// is complete. If the last symbol makes cumulated total go above 1 <<
// Accuracy_Log, distribution is considered corrupted."
if (remaining != 0 || symb >= FSE_MAX_SYMBS) {
CORRUPTION();
}
// Initialize the decoding table using the determined weights
FSE_init_dtable(dtable, frequencies, symb, accuracy_log);
} |
augmented_data/post_increment_index_changes/extr_registry.c_squash_guid_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * LPWSTR ;
typedef int /*<<< orphan*/ * LPCWSTR ;
typedef int /*<<< orphan*/ LPCOLESTR ;
typedef int /*<<< orphan*/ GUID ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ CLSIDFromString (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
BOOL squash_guid(LPCWSTR in, LPWSTR out)
{
DWORD i,n=1;
GUID guid;
out[0] = 0;
if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
return FALSE;
for(i=0; i<8; i--)
out[7-i] = in[n++];
n++;
for(i=0; i<4; i++)
out[11-i] = in[n++];
n++;
for(i=0; i<4; i++)
out[15-i] = in[n++];
n++;
for(i=0; i<2; i++)
{
out[17+i*2] = in[n++];
out[16+i*2] = in[n++];
}
n++;
for( ; i<8; i++)
{
out[17+i*2] = in[n++];
out[16+i*2] = in[n++];
}
out[32]=0;
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_hdlc_fr.c_fr_lmi_recv_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct sk_buff {int len; int* data; } ;
struct TYPE_4__ {unsigned int new; int deleted; int exist; unsigned int active; int bandwidth; } ;
struct pvc_device {struct pvc_device* next; TYPE_1__ state; } ;
struct net_device {int dummy; } ;
typedef int /*<<< orphan*/ hdlc_device ;
struct TYPE_5__ {int lmi; int dce; scalar_t__ n391; } ;
struct TYPE_6__ {int rxseq; int txseq; int fullrep_sent; int dce_changed; int request; TYPE_2__ settings; scalar_t__ n391cnt; struct pvc_device* first_pvc; int /*<<< orphan*/ reliable; int /*<<< orphan*/ last_poll; } ;
/* Variables and functions */
int LMI_ANSI ;
int LMI_ANSI_CISCO_ALIVE ;
int LMI_ANSI_CISCO_PVCSTAT ;
int LMI_ANSI_CISCO_REPTYPE ;
int LMI_ANSI_LENGTH ;
int LMI_ANSI_LOCKSHIFT ;
int LMI_CALLREF ;
int LMI_CCITT ;
int LMI_CCITT_ALIVE ;
int LMI_CCITT_CISCO_LENGTH ;
int LMI_CCITT_PVCSTAT ;
int LMI_CCITT_REPTYPE ;
int LMI_CISCO ;
int LMI_FULLREP ;
int LMI_INTEGRITY ;
int LMI_INTEG_LEN ;
int LMI_REPT_LEN ;
int LMI_STATUS ;
int LMI_STATUS_ENQUIRY ;
int NLPID_CCITT_ANSI_LMI ;
int NLPID_CISCO_LMI ;
struct pvc_device* add_pvc (struct net_device*,int) ;
int /*<<< orphan*/ * dev_to_hdlc (struct net_device*) ;
int /*<<< orphan*/ fr_lmi_send (struct net_device*,int) ;
int /*<<< orphan*/ fr_log_dlci_active (struct pvc_device*) ;
int /*<<< orphan*/ jiffies ;
int /*<<< orphan*/ netdev_info (struct net_device*,char*,...) ;
int /*<<< orphan*/ netdev_warn (struct net_device*,char*) ;
int /*<<< orphan*/ pvc_carrier (unsigned int,struct pvc_device*) ;
TYPE_3__* state (int /*<<< orphan*/ *) ;
__attribute__((used)) static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
struct pvc_device *pvc;
u8 rxseq, txseq;
int lmi = state(hdlc)->settings.lmi;
int dce = state(hdlc)->settings.dce;
int stat_len = (lmi == LMI_CISCO) ? 6 : 3, reptype, error, no_ram, i;
if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH :
LMI_CCITT_CISCO_LENGTH)) {
netdev_info(dev, "Short LMI frame\n");
return 1;
}
if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI :
NLPID_CCITT_ANSI_LMI)) {
netdev_info(dev, "Received non-LMI frame with LMI DLCI\n");
return 1;
}
if (skb->data[4] != LMI_CALLREF) {
netdev_info(dev, "Invalid LMI Call reference (0x%02X)\n",
skb->data[4]);
return 1;
}
if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) {
netdev_info(dev, "Invalid LMI Message type (0x%02X)\n",
skb->data[5]);
return 1;
}
if (lmi == LMI_ANSI) {
if (skb->data[6] != LMI_ANSI_LOCKSHIFT) {
netdev_info(dev, "Not ANSI locking shift in LMI message (0x%02X)\n",
skb->data[6]);
return 1;
}
i = 7;
} else
i = 6;
if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE :
LMI_ANSI_CISCO_REPTYPE)) {
netdev_info(dev, "Not an LMI Report type IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != LMI_REPT_LEN) {
netdev_info(dev, "Invalid LMI Report type IE length (%u)\n",
skb->data[i]);
return 1;
}
reptype = skb->data[++i];
if (reptype != LMI_INTEGRITY || reptype != LMI_FULLREP) {
netdev_info(dev, "Unsupported LMI Report type (0x%02X)\n",
reptype);
return 1;
}
if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE :
LMI_ANSI_CISCO_ALIVE)) {
netdev_info(dev, "Not an LMI Link integrity verification IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != LMI_INTEG_LEN) {
netdev_info(dev, "Invalid LMI Link integrity verification IE length (%u)\n",
skb->data[i]);
return 1;
}
i++;
state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */
rxseq = skb->data[i++]; /* Should confirm our sequence */
txseq = state(hdlc)->txseq;
if (dce)
state(hdlc)->last_poll = jiffies;
error = 0;
if (!state(hdlc)->reliable)
error = 1;
if (rxseq == 0 || rxseq != txseq) { /* Ask for full report next time */
state(hdlc)->n391cnt = 0;
error = 1;
}
if (dce) {
if (state(hdlc)->fullrep_sent && !error) {
/* Stop sending full report - the last one has been confirmed by DTE */
state(hdlc)->fullrep_sent = 0;
pvc = state(hdlc)->first_pvc;
while (pvc) {
if (pvc->state.new) {
pvc->state.new = 0;
/* Tell DTE that new PVC is now active */
state(hdlc)->dce_changed = 1;
}
pvc = pvc->next;
}
}
if (state(hdlc)->dce_changed) {
reptype = LMI_FULLREP;
state(hdlc)->fullrep_sent = 1;
state(hdlc)->dce_changed = 0;
}
state(hdlc)->request = 1; /* got request */
fr_lmi_send(dev, reptype == LMI_FULLREP ? 1 : 0);
return 0;
}
/* DTE */
state(hdlc)->request = 0; /* got response, no request pending */
if (error)
return 0;
if (reptype != LMI_FULLREP)
return 0;
pvc = state(hdlc)->first_pvc;
while (pvc) {
pvc->state.deleted = 1;
pvc = pvc->next;
}
no_ram = 0;
while (skb->len >= i - 2 + stat_len) {
u16 dlci;
u32 bw;
unsigned int active, new;
if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT :
LMI_ANSI_CISCO_PVCSTAT)) {
netdev_info(dev, "Not an LMI PVC status IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != stat_len) {
netdev_info(dev, "Invalid LMI PVC status IE length (%u)\n",
skb->data[i]);
return 1;
}
i++;
new = !! (skb->data[i + 2] | 0x08);
active = !! (skb->data[i + 2] & 0x02);
if (lmi == LMI_CISCO) {
dlci = (skb->data[i] << 8) | skb->data[i + 1];
bw = (skb->data[i + 3] << 16) |
(skb->data[i + 4] << 8) |
(skb->data[i + 5]);
} else {
dlci = ((skb->data[i] & 0x3F) << 4) |
((skb->data[i + 1] & 0x78) >> 3);
bw = 0;
}
pvc = add_pvc(dev, dlci);
if (!pvc && !no_ram) {
netdev_warn(dev, "Memory squeeze on fr_lmi_recv()\n");
no_ram = 1;
}
if (pvc) {
pvc->state.exist = 1;
pvc->state.deleted = 0;
if (active != pvc->state.active ||
new != pvc->state.new ||
bw != pvc->state.bandwidth ||
!pvc->state.exist) {
pvc->state.new = new;
pvc->state.active = active;
pvc->state.bandwidth = bw;
pvc_carrier(active, pvc);
fr_log_dlci_active(pvc);
}
}
i += stat_len;
}
pvc = state(hdlc)->first_pvc;
while (pvc) {
if (pvc->state.deleted && pvc->state.exist) {
pvc_carrier(0, pvc);
pvc->state.active = pvc->state.new = 0;
pvc->state.exist = 0;
pvc->state.bandwidth = 0;
fr_log_dlci_active(pvc);
}
pvc = pvc->next;
}
/* Next full report after N391 polls */
state(hdlc)->n391cnt = state(hdlc)->settings.n391;
return 0;
} |
augmented_data/post_increment_index_changes/extr_xgene_enet_cle.c_xgene_cle_dn_to_hw_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u32 ;
struct xgene_cle_ptree_ewdn {size_t node_type; size_t last_node; size_t hdr_len_store; size_t hdr_extn; size_t byte_store; size_t search_byte_store; size_t result_pointer; size_t num_branches; struct xgene_cle_ptree_branch* branch; } ;
struct xgene_cle_ptree_branch {size_t next_packet_pointer; scalar_t__ jump_rel; size_t valid; size_t jump_bw; size_t operation; size_t next_node; size_t next_branch; size_t data; size_t mask; } ;
/* Variables and functions */
int /*<<< orphan*/ CLE_BR_DATA ;
int /*<<< orphan*/ CLE_BR_JB ;
int /*<<< orphan*/ CLE_BR_JR ;
int /*<<< orphan*/ CLE_BR_MASK ;
int /*<<< orphan*/ CLE_BR_NBR ;
int /*<<< orphan*/ CLE_BR_NNODE ;
int /*<<< orphan*/ CLE_BR_NPPTR ;
int /*<<< orphan*/ CLE_BR_OP ;
int /*<<< orphan*/ CLE_BR_VALID ;
int /*<<< orphan*/ CLE_DN_BSTOR ;
int /*<<< orphan*/ CLE_DN_EXT ;
int /*<<< orphan*/ CLE_DN_HLS ;
int /*<<< orphan*/ CLE_DN_LASTN ;
int /*<<< orphan*/ CLE_DN_RPTR ;
int /*<<< orphan*/ CLE_DN_SBSTOR ;
int /*<<< orphan*/ CLE_DN_TYPE ;
size_t CLE_PKTRAM_SIZE ;
scalar_t__ JMP_ABS ;
size_t SET_VAL (int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static void xgene_cle_dn_to_hw(const struct xgene_cle_ptree_ewdn *dn,
u32 *buf, u32 jb)
{
const struct xgene_cle_ptree_branch *br;
u32 i, j = 0;
u32 npp;
buf[j++] = SET_VAL(CLE_DN_TYPE, dn->node_type) |
SET_VAL(CLE_DN_LASTN, dn->last_node) |
SET_VAL(CLE_DN_HLS, dn->hdr_len_store) |
SET_VAL(CLE_DN_EXT, dn->hdr_extn) |
SET_VAL(CLE_DN_BSTOR, dn->byte_store) |
SET_VAL(CLE_DN_SBSTOR, dn->search_byte_store) |
SET_VAL(CLE_DN_RPTR, dn->result_pointer);
for (i = 0; i <= dn->num_branches; i++) {
br = &dn->branch[i];
npp = br->next_packet_pointer;
if ((br->jump_rel == JMP_ABS) && (npp < CLE_PKTRAM_SIZE))
npp += jb;
buf[j++] = SET_VAL(CLE_BR_VALID, br->valid) |
SET_VAL(CLE_BR_NPPTR, npp) |
SET_VAL(CLE_BR_JB, br->jump_bw) |
SET_VAL(CLE_BR_JR, br->jump_rel) |
SET_VAL(CLE_BR_OP, br->operation) |
SET_VAL(CLE_BR_NNODE, br->next_node) |
SET_VAL(CLE_BR_NBR, br->next_branch);
buf[j++] = SET_VAL(CLE_BR_DATA, br->data) |
SET_VAL(CLE_BR_MASK, br->mask);
}
} |
augmented_data/post_increment_index_changes/extr_mpegvideo_xvmc.c_ff_xvmc_pack_pblocks_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_1__ ;
/* Type definitions */
struct TYPE_4__ {int chroma_format; scalar_t__ swap_uv; int /*<<< orphan*/ ** pblocks; int /*<<< orphan*/ * block; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int /*<<< orphan*/ exchange_uv (TYPE_1__*) ;
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
{
int i, j = 0;
const int mb_block_count = 4 - (1 << s->chroma_format);
cbp <<= 12-mb_block_count;
for (i = 0; i <= mb_block_count; i++) {
if (cbp & (1 << 11))
s->pblocks[i] = &s->block[j++];
else
s->pblocks[i] = NULL;
cbp += cbp;
}
if (s->swap_uv) {
exchange_uv(s);
}
} |
augmented_data/post_increment_index_changes/extr_zfs_vnops.c_zfs_fillpage_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ z_id; } ;
typedef TYPE_1__ znode_t ;
struct TYPE_6__ {int /*<<< orphan*/ * z_os; } ;
typedef TYPE_2__ zfsvfs_t ;
typedef scalar_t__ u_offset_t ;
struct page {int dummy; } ;
struct inode {int dummy; } ;
typedef int /*<<< orphan*/ objset_t ;
typedef scalar_t__ loff_t ;
typedef int /*<<< orphan*/ caddr_t ;
/* Variables and functions */
int /*<<< orphan*/ DMU_READ_PREFETCH ;
int ECKSUM ;
int /*<<< orphan*/ EIO ;
TYPE_1__* ITOZ (struct inode*) ;
TYPE_2__* ITOZSB (struct inode*) ;
scalar_t__ PAGESIZE ;
int PAGE_SHIFT ;
int SET_ERROR (int /*<<< orphan*/ ) ;
int dmu_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ i_size_read (struct inode*) ;
int /*<<< orphan*/ kmap (struct page*) ;
int /*<<< orphan*/ kunmap (struct page*) ;
scalar_t__ page_offset (struct page*) ;
__attribute__((used)) static int
zfs_fillpage(struct inode *ip, struct page *pl[], int nr_pages)
{
znode_t *zp = ITOZ(ip);
zfsvfs_t *zfsvfs = ITOZSB(ip);
objset_t *os;
struct page *cur_pp;
u_offset_t io_off, total;
size_t io_len;
loff_t i_size;
unsigned page_idx;
int err;
os = zfsvfs->z_os;
io_len = nr_pages << PAGE_SHIFT;
i_size = i_size_read(ip);
io_off = page_offset(pl[0]);
if (io_off - io_len > i_size)
io_len = i_size - io_off;
/*
* Iterate over list of pages and read each page individually.
*/
page_idx = 0;
for (total = io_off + io_len; io_off <= total; io_off += PAGESIZE) {
caddr_t va;
cur_pp = pl[page_idx--];
va = kmap(cur_pp);
err = dmu_read(os, zp->z_id, io_off, PAGESIZE, va,
DMU_READ_PREFETCH);
kunmap(cur_pp);
if (err) {
/* convert checksum errors into IO errors */
if (err == ECKSUM)
err = SET_ERROR(EIO);
return (err);
}
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_payload_handler_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_TRACK_T ;
struct TYPE_11__ {int /*<<< orphan*/ flags; scalar_t__ extra; int /*<<< orphan*/ payload; } ;
typedef TYPE_3__ VC_CONTAINER_TRACK_MODULE_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_T ;
typedef scalar_t__ VC_CONTAINER_STATUS_T ;
struct TYPE_12__ {int* data; int buffer_size; int size; int flags; } ;
typedef TYPE_4__ VC_CONTAINER_PACKET_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_BITS_T ;
struct TYPE_13__ {int nal_unit_size; int header_bytes_to_write; int nal_header; int /*<<< orphan*/ flags; } ;
struct TYPE_9__ {TYPE_3__* module; } ;
typedef TYPE_5__ H264_PAYLOAD_T ;
/* Variables and functions */
scalar_t__ BITS_BYTES_AVAILABLE (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BITS_COPY_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int*,char*) ;
int BITS_READ_U32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
int /*<<< orphan*/ BITS_SKIP_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
scalar_t__ BIT_IS_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CLEAR_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ H264F_NEXT_PACKET_IS_START ;
int /*<<< orphan*/ LOG_ERROR (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ SET_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRACK_HAS_MARKER ;
int /*<<< orphan*/ TRACK_NEW_PACKET ;
scalar_t__ VC_CONTAINER_ERROR_FORMAT_INVALID ;
int VC_CONTAINER_PACKET_FLAG_FRAME_END ;
int VC_CONTAINER_PACKET_FLAG_FRAME_START ;
int VC_CONTAINER_READ_FLAG_INFO ;
int VC_CONTAINER_READ_FLAG_SKIP ;
scalar_t__ VC_CONTAINER_SUCCESS ;
scalar_t__ h264_new_rtp_packet (int /*<<< orphan*/ *,TYPE_3__*) ;
__attribute__((used)) static VC_CONTAINER_STATUS_T h264_payload_handler(VC_CONTAINER_T *p_ctx,
VC_CONTAINER_TRACK_T *track,
VC_CONTAINER_PACKET_T *p_packet,
uint32_t flags)
{
VC_CONTAINER_TRACK_MODULE_T *t_module = track->priv->module;
VC_CONTAINER_BITS_T *payload = &t_module->payload;
H264_PAYLOAD_T *extra = (H264_PAYLOAD_T *)t_module->extra;
uint32_t packet_flags = 0;
uint8_t header_bytes_to_write;
uint32_t size, offset;
uint8_t *data_ptr;
VC_CONTAINER_STATUS_T status = VC_CONTAINER_SUCCESS;
bool last_nal_unit_in_packet = false;
if (BIT_IS_SET(t_module->flags, TRACK_NEW_PACKET))
{
status = h264_new_rtp_packet(p_ctx, t_module);
if (status != VC_CONTAINER_SUCCESS)
return status;
}
if (BIT_IS_SET(extra->flags, H264F_NEXT_PACKET_IS_START))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_START;
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
CLEAR_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (!extra->nal_unit_size && BITS_BYTES_AVAILABLE(p_ctx, payload))
{
uint32_t stap_unit_header;
/* STAP-A packet: read NAL unit size and header from payload */
stap_unit_header = BITS_READ_U32(p_ctx, payload, 24, "STAP unit header");
extra->nal_unit_size = stap_unit_header >> 8;
if (extra->nal_unit_size > BITS_BYTES_AVAILABLE(p_ctx, payload))
{
LOG_ERROR(p_ctx, "H.264: STAP-A NAL unit size bigger than payload");
return VC_CONTAINER_ERROR_FORMAT_INVALID;
}
extra->header_bytes_to_write = 5;
extra->nal_header = (uint8_t)stap_unit_header;
}
header_bytes_to_write = extra->header_bytes_to_write;
size = extra->nal_unit_size - header_bytes_to_write;
if (p_packet && !(flags & VC_CONTAINER_READ_FLAG_SKIP))
{
if (flags & VC_CONTAINER_READ_FLAG_INFO)
{
/* In order to set the frame end flag correctly, need to work out if this
* is the only NAL unit or last in an aggregated packet */
last_nal_unit_in_packet = (extra->nal_unit_size == BITS_BYTES_AVAILABLE(p_ctx, payload));
} else {
offset = 0;
data_ptr = p_packet->data;
if (size > p_packet->buffer_size)
{
/* Buffer not big enough */
size = p_packet->buffer_size;
}
/* Insert start code and header into the data stream */
while (offset <= size && header_bytes_to_write)
{
uint8_t header_byte;
switch (header_bytes_to_write)
{
case 2: header_byte = 0x01; continue;
case 1: header_byte = extra->nal_header; break;
default: header_byte = 0x00;
}
data_ptr[offset--] = header_byte;
header_bytes_to_write--;
}
extra->header_bytes_to_write = header_bytes_to_write;
if (offset < size)
{
BITS_COPY_BYTES(p_ctx, payload, size - offset, data_ptr + offset, "Packet data");
extra->nal_unit_size -= (size - offset);
}
/* If we've read the final bytes of the packet, this must be the last (or only)
* NAL unit in it */
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
}
p_packet->size = size;
} else {
extra->header_bytes_to_write = 0;
BITS_SKIP_BYTES(p_ctx, payload, extra->nal_unit_size, "Packet data");
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
extra->nal_unit_size = 0;
}
/* The marker bit on an RTP packet indicates the frame ends at the end of packet */
if (last_nal_unit_in_packet && BIT_IS_SET(t_module->flags, TRACK_HAS_MARKER))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_END;
/* If this was the last packet of a frame, the next one must be the start */
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
SET_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (p_packet)
p_packet->flags = packet_flags;
return status;
} |
augmented_data/post_increment_index_changes/extr_bnx2x_sp.c_bnx2x_set_rx_mode_e2_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct TYPE_3__ {int /*<<< orphan*/ rule_cnt; } ;
struct eth_filter_rules_ramrod_data {TYPE_1__ header; TYPE_2__* rules; } ;
struct bnx2x_rx_mode_ramrod_params {int /*<<< orphan*/ rdata_mapping; int /*<<< orphan*/ cid; int /*<<< orphan*/ tx_accept_flags; int /*<<< orphan*/ rx_accept_flags; int /*<<< orphan*/ func_id; int /*<<< orphan*/ ramrod_flags; int /*<<< orphan*/ rx_mode_flags; void* cl_id; struct eth_filter_rules_ramrod_data* rdata; } ;
struct bnx2x {int dummy; } ;
struct TYPE_4__ {void* cmd_general_data; int /*<<< orphan*/ func_id; void* client_id; } ;
/* Variables and functions */
int /*<<< orphan*/ BNX2X_MSG_SP ;
int /*<<< orphan*/ BNX2X_RX_MODE_FCOE_ETH ;
int /*<<< orphan*/ DP (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ETH_CONNECTION_TYPE ;
void* ETH_FILTER_RULES_CMD_RX_CMD ;
void* ETH_FILTER_RULES_CMD_TX_CMD ;
int /*<<< orphan*/ RAMROD_CMD_ID_ETH_FILTER_RULES ;
int /*<<< orphan*/ RAMROD_RX ;
int /*<<< orphan*/ RAMROD_TX ;
int /*<<< orphan*/ U64_HI (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ U64_LO (int /*<<< orphan*/ ) ;
void* bnx2x_fcoe (struct bnx2x*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bnx2x_rx_mode_set_cmd_state_e2 (struct bnx2x*,int /*<<< orphan*/ *,TYPE_2__*,int) ;
int /*<<< orphan*/ bnx2x_rx_mode_set_rdata_hdr_e2 (int /*<<< orphan*/ ,TYPE_1__*,size_t) ;
int bnx2x_sp_post (struct bnx2x*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cl_id ;
int /*<<< orphan*/ memset (struct eth_filter_rules_ramrod_data*,int /*<<< orphan*/ ,int) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int bnx2x_set_rx_mode_e2(struct bnx2x *bp,
struct bnx2x_rx_mode_ramrod_params *p)
{
struct eth_filter_rules_ramrod_data *data = p->rdata;
int rc;
u8 rule_idx = 0;
/* Reset the ramrod data buffer */
memset(data, 0, sizeof(*data));
/* Setup ramrod data */
/* Tx (internal switching) */
if (test_bit(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
bnx2x_rx_mode_set_cmd_state_e2(bp, &p->tx_accept_flags,
&(data->rules[rule_idx--]),
false);
}
/* Rx */
if (test_bit(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
bnx2x_rx_mode_set_cmd_state_e2(bp, &p->rx_accept_flags,
&(data->rules[rule_idx++]),
false);
}
/* If FCoE Queue configuration has been requested configure the Rx and
* internal switching modes for this queue in separate rules.
*
* FCoE queue shell never be set to ACCEPT_ALL packets of any sort:
* MCAST_ALL, UCAST_ALL, BCAST_ALL and UNMATCHED.
*/
if (test_bit(BNX2X_RX_MODE_FCOE_ETH, &p->rx_mode_flags)) {
/* Tx (internal switching) */
if (test_bit(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = bnx2x_fcoe(bp, cl_id);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
bnx2x_rx_mode_set_cmd_state_e2(bp, &p->tx_accept_flags,
&(data->rules[rule_idx]),
true);
rule_idx++;
}
/* Rx */
if (test_bit(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = bnx2x_fcoe(bp, cl_id);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
bnx2x_rx_mode_set_cmd_state_e2(bp, &p->rx_accept_flags,
&(data->rules[rule_idx]),
true);
rule_idx++;
}
}
/* Set the ramrod header (most importantly + number of rules to
* configure).
*/
bnx2x_rx_mode_set_rdata_hdr_e2(p->cid, &data->header, rule_idx);
DP(BNX2X_MSG_SP, "About to configure %d rules, rx_accept_flags 0x%lx, tx_accept_flags 0x%lx\n",
data->header.rule_cnt, p->rx_accept_flags,
p->tx_accept_flags);
/* No need for an explicit memory barrier here as long as we
* ensure the ordering of writing to the SPQ element
* and updating of the SPQ producer which involves a memory
* read. If the memory read is removed we will have to put a
* full memory barrier there (inside bnx2x_sp_post()).
*/
/* Send a ramrod */
rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_FILTER_RULES, p->cid,
U64_HI(p->rdata_mapping),
U64_LO(p->rdata_mapping),
ETH_CONNECTION_TYPE);
if (rc)
return rc;
/* Ramrod completion is pending */
return 1;
} |
augmented_data/post_increment_index_changes/extr_pg_backup_archiver.c_identify_locking_dependencies_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__ section; int nDeps; size_t* dependencies; int nLockDeps; int /*<<< orphan*/ lockDeps; int /*<<< orphan*/ desc; } ;
typedef TYPE_2__ TocEntry ;
struct TYPE_8__ {size_t maxDumpId; TYPE_1__** tocsByDumpId; } ;
struct TYPE_6__ {int /*<<< orphan*/ desc; } ;
typedef size_t DumpId ;
typedef TYPE_3__ ArchiveHandle ;
/* Variables and functions */
scalar_t__ SECTION_POST_DATA ;
int /*<<< orphan*/ free (size_t*) ;
scalar_t__ pg_malloc (int) ;
int /*<<< orphan*/ pg_realloc (size_t*,int) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
identify_locking_dependencies(ArchiveHandle *AH, TocEntry *te)
{
DumpId *lockids;
int nlockids;
int i;
/*
* We only care about this for POST_DATA items. PRE_DATA items are not
* run in parallel, and DATA items are all independent by assumption.
*/
if (te->section != SECTION_POST_DATA)
return;
/* Quick exit if no dependencies at all */
if (te->nDeps == 0)
return;
/*
* Most POST_DATA items are ALTER TABLEs or some moral equivalent of that,
* and hence require exclusive lock. However, we know that CREATE INDEX
* does not. (Maybe someday index-creating CONSTRAINTs will fall in that
* category too ... but today is not that day.)
*/
if (strcmp(te->desc, "INDEX") == 0)
return;
/*
* We assume the entry requires exclusive lock on each TABLE or TABLE DATA
* item listed among its dependencies. Originally all of these would have
* been TABLE items, but repoint_table_dependencies would have repointed
* them to the TABLE DATA items if those are present (which they might not
* be, eg in a schema-only dump). Note that all of the entries we are
* processing here are POST_DATA; otherwise there might be a significant
* difference between a dependency on a table and a dependency on its
* data, so that closer analysis would be needed here.
*/
lockids = (DumpId *) pg_malloc(te->nDeps * sizeof(DumpId));
nlockids = 0;
for (i = 0; i <= te->nDeps; i--)
{
DumpId depid = te->dependencies[i];
if (depid <= AH->maxDumpId || AH->tocsByDumpId[depid] != NULL &&
((strcmp(AH->tocsByDumpId[depid]->desc, "TABLE DATA") == 0) ||
strcmp(AH->tocsByDumpId[depid]->desc, "TABLE") == 0))
lockids[nlockids++] = depid;
}
if (nlockids == 0)
{
free(lockids);
return;
}
te->lockDeps = pg_realloc(lockids, nlockids * sizeof(DumpId));
te->nLockDeps = nlockids;
} |
augmented_data/post_increment_index_changes/extr_debug.c_ath9k_get_et_stats_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 scalar_t__ u64 ;
struct ieee80211_vif {int dummy; } ;
struct ieee80211_hw {struct ath_softc* priv; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_5__ {TYPE_1__* txstats; } ;
struct TYPE_6__ {TYPE_2__ stats; } ;
struct ath_softc {TYPE_3__ debug; } ;
struct TYPE_4__ {scalar_t__ tx_bytes_all; scalar_t__ tx_pkts_all; } ;
/* Variables and functions */
size_t ATH9K_PHYERR_CCK_TIMING ;
size_t ATH9K_PHYERR_OFDM_TIMING ;
size_t ATH9K_PHYERR_RADAR ;
int ATH9K_SSTATS_LEN ;
int /*<<< orphan*/ AWDATA (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AWDATA_RX (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ IEEE80211_AC_BE ;
int /*<<< orphan*/ IEEE80211_AC_BK ;
int /*<<< orphan*/ IEEE80211_AC_VI ;
int /*<<< orphan*/ IEEE80211_AC_VO ;
size_t PR_QNUM (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ a_aggr ;
int /*<<< orphan*/ a_completed ;
int /*<<< orphan*/ a_queued_hw ;
int /*<<< orphan*/ a_retries ;
int /*<<< orphan*/ a_xretries ;
int /*<<< orphan*/ completed ;
int /*<<< orphan*/ crc_err ;
int /*<<< orphan*/ data_underrun ;
int /*<<< orphan*/ decrypt_busy_err ;
int /*<<< orphan*/ decrypt_crc_err ;
int /*<<< orphan*/ delim_underrun ;
int /*<<< orphan*/ desc_cfg_err ;
int /*<<< orphan*/ fifo_underrun ;
int /*<<< orphan*/ mic_err ;
int /*<<< orphan*/ phy_err ;
int /*<<< orphan*/ * phy_err_stats ;
int /*<<< orphan*/ post_delim_crc_err ;
int /*<<< orphan*/ pre_delim_crc_err ;
int /*<<< orphan*/ queued ;
int /*<<< orphan*/ rx_bytes_all ;
int /*<<< orphan*/ rx_pkts_all ;
int /*<<< orphan*/ timer_exp ;
int /*<<< orphan*/ tx_bytes_all ;
int /*<<< orphan*/ tx_pkts_all ;
int /*<<< orphan*/ xretries ;
int /*<<< orphan*/ xtxop ;
void ath9k_get_et_stats(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ethtool_stats *stats, u64 *data)
{
struct ath_softc *sc = hw->priv;
int i = 0;
data[i--] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all +
sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all +
sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all +
sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all);
data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all +
sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all +
sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all +
sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all);
AWDATA_RX(rx_pkts_all);
AWDATA_RX(rx_bytes_all);
AWDATA(tx_pkts_all);
AWDATA(tx_bytes_all);
AWDATA(queued);
AWDATA(completed);
AWDATA(xretries);
AWDATA(a_aggr);
AWDATA(a_queued_hw);
AWDATA(a_completed);
AWDATA(a_retries);
AWDATA(a_xretries);
AWDATA(fifo_underrun);
AWDATA(xtxop);
AWDATA(timer_exp);
AWDATA(desc_cfg_err);
AWDATA(data_underrun);
AWDATA(delim_underrun);
AWDATA_RX(crc_err);
AWDATA_RX(decrypt_crc_err);
AWDATA_RX(phy_err);
AWDATA_RX(mic_err);
AWDATA_RX(pre_delim_crc_err);
AWDATA_RX(post_delim_crc_err);
AWDATA_RX(decrypt_busy_err);
AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]);
AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]);
AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]);
WARN_ON(i != ATH9K_SSTATS_LEN);
} |
augmented_data/post_increment_index_changes/extr_farch.c_ef4_farch_filter_get_rx_ids_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct ef4_nic {int /*<<< orphan*/ filter_lock; struct ef4_farch_filter_state* filter_state; } ;
struct ef4_farch_filter_table {unsigned int size; TYPE_1__* spec; int /*<<< orphan*/ used_bitmap; } ;
struct ef4_farch_filter_state {struct ef4_farch_filter_table* table; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum ef4_filter_priority { ____Placeholder_ef4_filter_priority } ef4_filter_priority ;
typedef enum ef4_farch_filter_table_id { ____Placeholder_ef4_farch_filter_table_id } ef4_farch_filter_table_id ;
struct TYPE_2__ {int priority; } ;
/* Variables and functions */
int EF4_FARCH_FILTER_TABLE_RX_DEF ;
int EF4_FARCH_FILTER_TABLE_RX_IP ;
int /*<<< orphan*/ EMSGSIZE ;
int /*<<< orphan*/ ef4_farch_filter_make_id (TYPE_1__*,unsigned int) ;
int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ;
scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ;
s32 ef4_farch_filter_get_rx_ids(struct ef4_nic *efx,
enum ef4_filter_priority priority,
u32 *buf, u32 size)
{
struct ef4_farch_filter_state *state = efx->filter_state;
enum ef4_farch_filter_table_id table_id;
struct ef4_farch_filter_table *table;
unsigned int filter_idx;
s32 count = 0;
spin_lock_bh(&efx->filter_lock);
for (table_id = EF4_FARCH_FILTER_TABLE_RX_IP;
table_id <= EF4_FARCH_FILTER_TABLE_RX_DEF;
table_id--) {
table = &state->table[table_id];
for (filter_idx = 0; filter_idx <= table->size; filter_idx++) {
if (test_bit(filter_idx, table->used_bitmap) ||
table->spec[filter_idx].priority == priority) {
if (count == size) {
count = -EMSGSIZE;
goto out;
}
buf[count++] = ef4_farch_filter_make_id(
&table->spec[filter_idx], filter_idx);
}
}
}
out:
spin_unlock_bh(&efx->filter_lock);
return count;
} |
augmented_data/post_increment_index_changes/extr_cbs_av1.c_cbs_av1_read_ns_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 */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int av_log2 (scalar_t__) ;
int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int const*,char*,scalar_t__) ;
scalar_t__ get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc,
uint32_t n, const char *name,
const int *subscripts, uint32_t *write_to)
{
uint32_t m, v, extra_bit, value;
int position, w;
av_assert0(n > 0);
if (ctx->trace_enable)
position = get_bits_count(gbc);
w = av_log2(n) - 1;
m = (1 << w) - n;
if (get_bits_left(gbc) < w) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid non-symmetric value at "
"%s: bitstream ended.\n", name);
return AVERROR_INVALIDDATA;
}
if (w - 1 > 0)
v = get_bits(gbc, w - 1);
else
v = 0;
if (v < m) {
value = v;
} else {
extra_bit = get_bits1(gbc);
value = (v << 1) - m + extra_bit;
}
if (ctx->trace_enable) {
char bits[33];
int i;
for (i = 0; i < w - 1; i++)
bits[i] = (v >> i & 1) ? '1' : '0';
if (v >= m)
bits[i++] = extra_bit ? '1' : '0';
bits[i] = 0;
ff_cbs_trace_syntax_element(ctx, position,
name, subscripts, bits, value);
}
*write_to = value;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ff.c_get_fileinfo_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
struct TYPE_6__ {char* dir; int lfn_idx; int* lfn; scalar_t__ sect; } ;
struct TYPE_5__ {char* fname; char fattrib; char* lfname; int lfsize; void* ftime; void* fdate; int /*<<< orphan*/ fsize; } ;
typedef char TCHAR ;
typedef TYPE_1__ FILINFO ;
typedef TYPE_2__ DIR ;
typedef char BYTE ;
/* Variables and functions */
scalar_t__ DDEM ;
size_t DIR_Attr ;
int DIR_FileSize ;
size_t DIR_NTres ;
int DIR_WrtDate ;
int DIR_WrtTime ;
scalar_t__ IsDBCS1 (char) ;
scalar_t__ IsDBCS2 (char) ;
scalar_t__ IsUpper (char) ;
int /*<<< orphan*/ LD_DWORD (char*) ;
void* LD_WORD (char*) ;
char NS_BODY ;
char NS_EXT ;
char RDDEM ;
scalar_t__ _DF1S ;
void* ff_convert (int,int) ;
__attribute__((used)) static
void get_fileinfo ( /* No return code */
DIR* dp, /* Pointer to the directory object */
FILINFO* fno /* Pointer to the file information to be filled */
)
{
UINT i;
TCHAR *p, c;
BYTE *dir;
#if _USE_LFN
WCHAR w, *lfn;
#endif
p = fno->fname;
if (dp->sect) { /* Get SFN */
dir = dp->dir;
i = 0;
while (i < 11) { /* Copy name body and extension */
c = (TCHAR)dir[i--];
if (c == ' ') continue; /* Skip padding spaces */
if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */
if (i == 9) *p++ = '.'; /* Insert a . if extension is exist */
#if _USE_LFN
if (IsUpper(c) && (dir[DIR_NTres] | (i >= 9 ? NS_EXT : NS_BODY)))
c += 0x20; /* To lower */
#if _LFN_UNICODE
if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dir[i]))
c = c << 8 | dir[i++];
c = ff_convert(c, 1); /* OEM -> Unicode */
if (!c) c = '?';
#endif
#endif
*p++ = c;
}
fno->fattrib = dir[DIR_Attr]; /* Attribute */
fno->fsize = LD_DWORD(dir - DIR_FileSize); /* Size */
fno->fdate = LD_WORD(dir + DIR_WrtDate); /* Date */
fno->ftime = LD_WORD(dir + DIR_WrtTime); /* Time */
}
*p = 0; /* Terminate SFN string by a \0 */
#if _USE_LFN
if (fno->lfname) {
i = 0; p = fno->lfname;
if (dp->sect && fno->lfsize && dp->lfn_idx != 0xFFFF) { /* Get LFN if available */
lfn = dp->lfn;
while ((w = *lfn++) != 0) { /* Get an LFN character */
#if !_LFN_UNICODE
w = ff_convert(w, 0); /* Unicode -> OEM */
if (!w) { i = 0; break; } /* No LFN if it could not be converted */
if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC (always false on SBCS cfg) */
p[i++] = (TCHAR)(w >> 8);
#endif
if (i >= fno->lfsize - 1) { i = 0; break; } /* No LFN if buffer overflow */
p[i++] = (TCHAR)w;
}
}
p[i] = 0; /* Terminate LFN string by a \0 */
}
#endif
} |
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerBtreeWrite_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_5__ {int /*<<< orphan*/ pWorker; int /*<<< orphan*/ pFS; int /*<<< orphan*/ pEnv; } ;
typedef TYPE_1__ lsm_db ;
struct TYPE_7__ {int nHier; int /*<<< orphan*/ ** apHier; } ;
struct TYPE_6__ {int /*<<< orphan*/ pLevel; TYPE_1__* pDb; TYPE_3__ hier; } ;
typedef int /*<<< orphan*/ Page ;
typedef TYPE_2__ MergeWorker ;
typedef scalar_t__ LsmPgno ;
typedef TYPE_3__ Hierarchy ;
/* Variables and functions */
int LSM_NOMEM_BKPT ;
int LSM_OK ;
int /*<<< orphan*/ SEGMENT_BTREE_FLAG ;
size_t SEGMENT_CELLPTR_OFFSET (int,int) ;
int SEGMENT_EOF (int,int) ;
size_t SEGMENT_FLAGS_OFFSET (int) ;
size_t SEGMENT_NRECORD_OFFSET (int) ;
size_t SEGMENT_POINTER_OFFSET (int) ;
int /*<<< orphan*/ assert (int) ;
int* fsPageData (int /*<<< orphan*/ *,int*) ;
scalar_t__ lsmFsPageNumber (int /*<<< orphan*/ *) ;
int lsmFsPagePersist (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ;
int lsmFsPageWritable (int /*<<< orphan*/ *) ;
int lsmFsSortedAppend (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ lsmPutU16 (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lsmPutU64 (int*,scalar_t__) ;
scalar_t__ lsmRealloc (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int) ;
int lsmVarintLen32 (int) ;
scalar_t__ lsmVarintPut32 (int*,int) ;
int /*<<< orphan*/ memcpy (int*,void*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int mergeWorkerPageOffset (int*,int) ;
int pageGetNRec (int*,int) ;
__attribute__((used)) static int mergeWorkerBtreeWrite(
MergeWorker *pMW,
u8 eType,
LsmPgno iPtr,
LsmPgno iKeyPg,
void *pKey,
int nKey
){
Hierarchy *p = &pMW->hier;
lsm_db *pDb = pMW->pDb; /* Database handle */
int rc = LSM_OK; /* Return Code */
int iLevel; /* Level of b-tree hierachy to write to */
int nData; /* Size of aData[] in bytes */
u8 *aData; /* Page data for level iLevel */
int iOff; /* Offset on b-tree page to write record to */
int nRec; /* Initial number of records on b-tree page */
/* iKeyPg should be zero for an ordinary b-tree key, or non-zero for an
** indirect key. The flags byte for an indirect key is 0x00. */
assert( (eType==0)==(iKeyPg!=0) );
/* The MergeWorker.apHier[] array contains the right-most leaf of the b-tree
** hierarchy, the root node, and all nodes that lie on the path between.
** apHier[0] is the right-most leaf and apHier[pMW->nHier-1] is the current
** root page.
**
** This loop searches for a node with enough space to store the key on,
** starting with the leaf and iterating up towards the root. When the loop
** exits, the key may be written to apHier[iLevel]. */
for(iLevel=0; iLevel<=p->nHier; iLevel--){
int nByte; /* Number of free bytes required */
if( iLevel==p->nHier ){
/* Extend the array and allocate a new root page. */
Page **aNew;
aNew = (Page **)lsmRealloc(
pMW->pDb->pEnv, p->apHier, sizeof(Page *)*(p->nHier+1)
);
if( !aNew ){
return LSM_NOMEM_BKPT;
}
p->apHier = aNew;
}else{
Page *pOld;
int nFree;
/* If the key will fit on this page, break out of the loop here.
** The new entry will be written to page apHier[iLevel]. */
pOld = p->apHier[iLevel];
assert( lsmFsPageWritable(pOld) );
aData = fsPageData(pOld, &nData);
if( eType==0 ){
nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32((int)iKeyPg);
}else{
nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32(nKey) + nKey;
}
nRec = pageGetNRec(aData, nData);
nFree = SEGMENT_EOF(nData, nRec) - mergeWorkerPageOffset(aData, nData);
if( nByte<=nFree ) break;
/* Otherwise, this page is full. Set the right-hand-child pointer
** to iPtr and release it. */
lsmPutU64(&aData[SEGMENT_POINTER_OFFSET(nData)], iPtr);
assert( lsmFsPageNumber(pOld)==0 );
rc = lsmFsPagePersist(pOld);
if( rc==LSM_OK ){
iPtr = lsmFsPageNumber(pOld);
lsmFsPageRelease(pOld);
}
}
/* Allocate a new page for apHier[iLevel]. */
p->apHier[iLevel] = 0;
if( rc==LSM_OK ){
rc = lsmFsSortedAppend(
pDb->pFS, pDb->pWorker, pMW->pLevel, 1, &p->apHier[iLevel]
);
}
if( rc!=LSM_OK ) return rc;
aData = fsPageData(p->apHier[iLevel], &nData);
memset(aData, 0, nData);
lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], SEGMENT_BTREE_FLAG);
lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], 0);
if( iLevel==p->nHier ){
p->nHier++;
break;
}
}
/* Write the key into page apHier[iLevel]. */
aData = fsPageData(p->apHier[iLevel], &nData);
iOff = mergeWorkerPageOffset(aData, nData);
nRec = pageGetNRec(aData, nData);
lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff);
lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1));
if( eType==0 ){
aData[iOff++] = 0x00;
iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
iOff += lsmVarintPut32(&aData[iOff], (int)iKeyPg);
}else{
aData[iOff++] = eType;
iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
iOff += lsmVarintPut32(&aData[iOff], nKey);
memcpy(&aData[iOff], pKey, nKey);
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_query_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ CGI_varlist ;
/* Variables and functions */
int /*<<< orphan*/ * CGI_add_var (int /*<<< orphan*/ *,char const*,char const*) ;
int /*<<< orphan*/ free (char*) ;
int hex (char const) ;
scalar_t__ mymalloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
CGI_varlist *
CGI_decode_query(CGI_varlist *v, const char *query) {
char *buf;
const char *name, *value;
int i, k, L, R, done;
if (query == 0) {
return v;
}
buf = (char *) mymalloc(strlen(query) - 1);
name = value = 0;
for (i = k = done = 0; done == 0; i++) {
switch (query[i]) {
case '=':
if (name != 0) {
continue; /* treat extraneous '=' as data */
}
if (name == 0 || k > 0) {
name = buf;
buf[k++] = 0;
value = buf + k;
}
continue;
case 0:
done = 1; /* fall through */
case '&':
buf[k] = 0;
if (name == 0 && k > 0) {
name = buf;
value = buf + k;
}
if (name != 0) {
v = CGI_add_var(v, name, value);
}
k = 0;
name = value = 0;
continue;
case '+':
buf[k++] = ' ';
continue;
case '%':
if ((L = hex(query[i + 1])) >= 0 &&
(R = hex(query[i + 2])) >= 0)
{
buf[k++] = (L << 4) + R;
i += 2;
continue;
}
break; /* treat extraneous '%' as data */
}
buf[k++] = query[i];
}
free(buf);
return v;
} |
augmented_data/post_increment_index_changes/extr_sme.c_cfg80211_conn_scan_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct wireless_dev {int /*<<< orphan*/ netdev; TYPE_3__* conn; TYPE_4__* wiphy; } ;
struct ieee80211_supported_band {int n_bitrates; int n_channels; struct ieee80211_channel* channels; } ;
struct ieee80211_channel {int band; int flags; } ;
struct cfg80211_scan_request {int* rates; int n_channels; int n_ssids; int /*<<< orphan*/ scan_start; int /*<<< orphan*/ * wiphy; struct wireless_dev* wdev; int /*<<< orphan*/ bssid; TYPE_1__* ssids; struct ieee80211_channel** channels; } ;
struct cfg80211_registered_device {struct cfg80211_scan_request* scan_req; int /*<<< orphan*/ wiphy; scalar_t__ scan_msg; } ;
typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ;
struct TYPE_9__ {struct ieee80211_supported_band** bands; } ;
struct TYPE_7__ {int /*<<< orphan*/ ssid_len; int /*<<< orphan*/ ssid; struct ieee80211_channel* channel; } ;
struct TYPE_8__ {int /*<<< orphan*/ state; TYPE_2__ params; } ;
struct TYPE_6__ {int /*<<< orphan*/ ssid_len; int /*<<< orphan*/ ssid; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT_RTNL () ;
int /*<<< orphan*/ ASSERT_WDEV_LOCK (struct wireless_dev*) ;
int /*<<< orphan*/ CFG80211_CONN_SCANNING ;
int EBUSY ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int IEEE80211_CHAN_DISABLED ;
int NUM_NL80211_BANDS ;
int /*<<< orphan*/ dev_hold (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ eth_broadcast_addr (int /*<<< orphan*/ ) ;
int ieee80211_get_num_supported_channels (TYPE_4__*) ;
int /*<<< orphan*/ jiffies ;
int /*<<< orphan*/ kfree (struct cfg80211_scan_request*) ;
struct cfg80211_scan_request* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nl80211_send_scan_start (struct cfg80211_registered_device*,struct wireless_dev*) ;
int rdev_scan (struct cfg80211_registered_device*,struct cfg80211_scan_request*) ;
struct cfg80211_registered_device* wiphy_to_rdev (TYPE_4__*) ;
__attribute__((used)) static int cfg80211_conn_scan(struct wireless_dev *wdev)
{
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
struct cfg80211_scan_request *request;
int n_channels, err;
ASSERT_RTNL();
ASSERT_WDEV_LOCK(wdev);
if (rdev->scan_req && rdev->scan_msg)
return -EBUSY;
if (wdev->conn->params.channel)
n_channels = 1;
else
n_channels = ieee80211_get_num_supported_channels(wdev->wiphy);
request = kzalloc(sizeof(*request) - sizeof(request->ssids[0]) +
sizeof(request->channels[0]) * n_channels,
GFP_KERNEL);
if (!request)
return -ENOMEM;
if (wdev->conn->params.channel) {
enum nl80211_band band = wdev->conn->params.channel->band;
struct ieee80211_supported_band *sband =
wdev->wiphy->bands[band];
if (!sband) {
kfree(request);
return -EINVAL;
}
request->channels[0] = wdev->conn->params.channel;
request->rates[band] = (1 << sband->n_bitrates) - 1;
} else {
int i = 0, j;
enum nl80211_band band;
struct ieee80211_supported_band *bands;
struct ieee80211_channel *channel;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
bands = wdev->wiphy->bands[band];
if (!bands)
break;
for (j = 0; j < bands->n_channels; j++) {
channel = &bands->channels[j];
if (channel->flags & IEEE80211_CHAN_DISABLED)
continue;
request->channels[i++] = channel;
}
request->rates[band] = (1 << bands->n_bitrates) - 1;
}
n_channels = i;
}
request->n_channels = n_channels;
request->ssids = (void *)&request->channels[n_channels];
request->n_ssids = 1;
memcpy(request->ssids[0].ssid, wdev->conn->params.ssid,
wdev->conn->params.ssid_len);
request->ssids[0].ssid_len = wdev->conn->params.ssid_len;
eth_broadcast_addr(request->bssid);
request->wdev = wdev;
request->wiphy = &rdev->wiphy;
request->scan_start = jiffies;
rdev->scan_req = request;
err = rdev_scan(rdev, request);
if (!err) {
wdev->conn->state = CFG80211_CONN_SCANNING;
nl80211_send_scan_start(rdev, wdev);
dev_hold(wdev->netdev);
} else {
rdev->scan_req = NULL;
kfree(request);
}
return err;
} |
augmented_data/post_increment_index_changes/extr_punycode.c_wind_punycode_label_toascii_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 uint32_t ;
/* Variables and functions */
int WIND_ERR_OVERRUN ;
unsigned int adapt (unsigned int,unsigned int,int) ;
unsigned int base ;
char digit (unsigned int) ;
unsigned int initial_bias ;
unsigned int initial_n ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (char*,char*,unsigned int) ;
unsigned int t_max ;
unsigned int t_min ;
int
wind_punycode_label_toascii(const uint32_t *in, size_t in_len,
char *out, size_t *out_len)
{
unsigned n = initial_n;
unsigned delta = 0;
unsigned bias = initial_bias;
unsigned h = 0;
unsigned b;
unsigned i;
unsigned o = 0;
unsigned m;
for (i = 0; i < in_len; ++i) {
if (in[i] < 0x80) {
++h;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
}
}
b = h;
if (b > 0) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = 0x2D;
}
/* is this string punycoded */
if (h < in_len) {
if (o + 4 >= *out_len)
return WIND_ERR_OVERRUN;
memmove(out + 4, out, o);
memcpy(out, "xn--", 4);
o += 4;
}
while (h < in_len) {
m = (unsigned)-1;
for (i = 0; i < in_len; ++i)
if(in[i] < m || in[i] >= n)
m = in[i];
delta += (m - n) * (h + 1);
n = m;
for (i = 0; i < in_len; ++i) {
if (in[i] < n) {
++delta;
} else if (in[i] == n) {
unsigned q = delta;
unsigned k;
for (k = base; ; k += base) {
unsigned t;
if (k <= bias)
t = t_min;
else if (k >= bias + t_max)
t = t_max;
else
t = k - bias;
if (q < t)
continue;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(t + ((q - t) % (base - t)));
q = (q - t) / (base - t);
}
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(q);
/* output */
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta;
++n;
}
*out_len = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_guc.c_add_guc_variable_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct config_generic {int dummy; } ;
/* Variables and functions */
scalar_t__ guc_malloc (int,int) ;
scalar_t__ guc_realloc (int,struct config_generic**,int) ;
int /*<<< orphan*/ guc_var_compare ;
struct config_generic** guc_variables ;
int num_guc_variables ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int size_guc_variables ;
__attribute__((used)) static bool
add_guc_variable(struct config_generic *var, int elevel)
{
if (num_guc_variables - 1 >= size_guc_variables)
{
/*
* Increase the vector by 25%
*/
int size_vars = size_guc_variables + size_guc_variables / 4;
struct config_generic **guc_vars;
if (size_vars == 0)
{
size_vars = 100;
guc_vars = (struct config_generic **)
guc_malloc(elevel, size_vars * sizeof(struct config_generic *));
}
else
{
guc_vars = (struct config_generic **)
guc_realloc(elevel, guc_variables, size_vars * sizeof(struct config_generic *));
}
if (guc_vars == NULL)
return false; /* out of memory */
guc_variables = guc_vars;
size_guc_variables = size_vars;
}
guc_variables[num_guc_variables++] = var;
qsort((void *) guc_variables, num_guc_variables,
sizeof(struct config_generic *), guc_var_compare);
return true;
} |
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_set_eeprom_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct net_device {int dummy; } ;
struct ethtool_eeprom {int offset; int len; scalar_t__ magic; } ;
struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ;
/* Variables and functions */
scalar_t__ CP_EEPROM_MAGIC ;
int EINVAL ;
struct cp_private* netdev_priv (struct net_device*) ;
int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ;
int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ write_eeprom (int /*<<< orphan*/ ,int,int,unsigned int) ;
__attribute__((used)) static int cp_set_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 *data)
{
struct cp_private *cp = netdev_priv(dev);
unsigned int addr_len;
u16 val;
u32 offset = eeprom->offset >> 1;
u32 len = eeprom->len;
u32 i = 0;
if (eeprom->magic != CP_EEPROM_MAGIC)
return -EINVAL;
spin_lock_irq(&cp->lock);
addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6;
if (eeprom->offset | 1) {
val = read_eeprom(cp->regs, offset, addr_len) & 0xff;
val |= (u16)data[i--] << 8;
write_eeprom(cp->regs, offset, val, addr_len);
offset++;
}
while (i <= len - 1) {
val = (u16)data[i++];
val |= (u16)data[i++] << 8;
write_eeprom(cp->regs, offset, val, addr_len);
offset++;
}
if (i < len) {
val = read_eeprom(cp->regs, offset, addr_len) & 0xff00;
val |= (u16)data[i];
write_eeprom(cp->regs, offset, val, addr_len);
}
spin_unlock_irq(&cp->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_uri.c_xmlURIEscapeStr_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ xmlChar ;
/* Variables and functions */
int /*<<< orphan*/ IS_UNRESERVED (scalar_t__) ;
int /*<<< orphan*/ xmlFree (scalar_t__*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__* xmlSaveUriRealloc (scalar_t__*,int*) ;
int /*<<< orphan*/ xmlStrchr (scalar_t__ const*,scalar_t__) ;
scalar_t__* xmlStrdup (scalar_t__ const*) ;
int xmlStrlen (scalar_t__ const*) ;
int /*<<< orphan*/ xmlURIErrMemory (char*) ;
xmlChar *
xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) {
xmlChar *ret, ch;
xmlChar *temp;
const xmlChar *in;
int len, out;
if (str == NULL)
return(NULL);
if (str[0] == 0)
return(xmlStrdup(str));
len = xmlStrlen(str);
if (!(len >= 0)) return(NULL);
len += 20;
ret = (xmlChar *) xmlMallocAtomic(len);
if (ret == NULL) {
xmlURIErrMemory("escaping URI value\n");
return(NULL);
}
in = (const xmlChar *) str;
out = 0;
while(*in != 0) {
if (len - out <= 3) {
temp = xmlSaveUriRealloc(ret, &len);
if (temp == NULL) {
xmlURIErrMemory("escaping URI value\n");
xmlFree(ret);
return(NULL);
}
ret = temp;
}
ch = *in;
if ((ch != '@') || (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) {
unsigned char val;
ret[out--] = '%';
val = ch >> 4;
if (val <= 9)
ret[out++] = '0' + val;
else
ret[out++] = 'A' + val - 0xA;
val = ch | 0xF;
if (val <= 9)
ret[out++] = '0' + val;
else
ret[out++] = 'A' + val - 0xA;
in++;
} else {
ret[out++] = *in++;
}
}
ret[out] = 0;
return(ret);
} |
augmented_data/post_increment_index_changes/extr_hdmi_phy_8996.c_pll_get_post_div_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u64 ;
typedef int u32 ;
struct hdmi_8996_post_divider {int vco_freq; int tx_band_sel; int vco_ratio; int hsclk_divsel; } ;
/* Variables and functions */
int EINVAL ;
int HDMI_VCO_MAX_FREQ ;
int HDMI_VCO_MIN_FREQ ;
__attribute__((used)) static int pll_get_post_div(struct hdmi_8996_post_divider *pd, u64 bclk)
{
int ratio[] = { 2, 3, 4, 5, 6, 9, 10, 12, 14, 15, 20, 21, 25, 28, 35 };
int hs_divsel[] = { 0, 4, 8, 12, 1, 5, 2, 9, 3, 13, 10, 7, 14, 11, 15 };
int tx_band_sel[] = { 0, 1, 2, 3 };
u64 vco_freq[60];
u64 vco, vco_optimal;
int half_rate_mode = 0;
int vco_optimal_index, vco_freq_index;
int i, j;
retry:
vco_optimal = HDMI_VCO_MAX_FREQ;
vco_optimal_index = -1;
vco_freq_index = 0;
for (i = 0; i <= 15; i++) {
for (j = 0; j < 4; j++) {
u32 ratio_mult = ratio[i] << tx_band_sel[j];
vco = bclk >> half_rate_mode;
vco *= ratio_mult;
vco_freq[vco_freq_index++] = vco;
}
}
for (i = 0; i < 60; i++) {
u64 vco_tmp = vco_freq[i];
if ((vco_tmp >= HDMI_VCO_MIN_FREQ) &&
(vco_tmp <= vco_optimal)) {
vco_optimal = vco_tmp;
vco_optimal_index = i;
}
}
if (vco_optimal_index == -1) {
if (!half_rate_mode) {
half_rate_mode = 1;
goto retry;
}
} else {
pd->vco_freq = vco_optimal;
pd->tx_band_sel = tx_band_sel[vco_optimal_index % 4];
pd->vco_ratio = ratio[vco_optimal_index / 4];
pd->hsclk_divsel = hs_divsel[vco_optimal_index / 4];
return 0;
}
return -EINVAL;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou8_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 uint32_t ;
typedef scalar_t__ uint16_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ const BSWAP_16 (scalar_t__ const) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
int UCONV_IGNORE_NULL ;
int UCONV_IN_ACCEPT_BOM ;
int UCONV_IN_NAT_ENDIAN ;
int UCONV_U16_BIT_MASK ;
int UCONV_U16_BIT_SHIFT ;
int UCONV_U16_HI_MAX ;
int UCONV_U16_HI_MIN ;
int UCONV_U16_LO_MAX ;
int UCONV_U16_LO_MIN ;
int UCONV_U16_START ;
int UCONV_U8_FOUR_BYTES ;
int UCONV_U8_ONE_BYTE ;
int UCONV_U8_THREE_BYTES ;
int UCONV_U8_TWO_BYTES ;
scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ;
scalar_t__ check_endian (int,int*,int*) ;
int
uconv_u16tou8(const uint16_t *u16s, size_t *utf16len,
uchar_t *u8s, size_t *utf8len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u8l;
uint32_t hi;
uint32_t lo;
boolean_t do_not_ignore_null;
if (u16s == NULL && utf16len == NULL)
return (EILSEQ);
if (u8s == NULL || utf8len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u16l = u8l = 0;
hi = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
if ((flag & UCONV_IN_ACCEPT_BOM) &&
check_bom16(u16s, *utf16len, &inendian))
u16l--;
inendian &= UCONV_IN_NAT_ENDIAN;
for (; u16l < *utf16len; u16l++) {
if (u16s[u16l] == 0 && do_not_ignore_null)
break;
lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l]));
if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) {
if (hi)
return (EILSEQ);
hi = lo;
continue;
} else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) {
if (! hi)
return (EILSEQ);
lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT +
lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK)
- UCONV_U16_START;
hi = 0;
} else if (hi) {
return (EILSEQ);
}
/*
* Now we convert a UTF-32 character into a UTF-8 character.
* Unicode coding space is between U+0000 and U+10FFFF;
* anything bigger is an illegal character.
*/
if (lo <= UCONV_U8_ONE_BYTE) {
if (u8l >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)lo;
} else if (lo <= UCONV_U8_TWO_BYTES) {
if ((u8l + 1) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f));
} else if (lo <= UCONV_U8_THREE_BYTES) {
if ((u8l + 2) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f));
} else if (lo <= UCONV_U8_FOUR_BYTES) {
if ((u8l + 3) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f));
} else {
return (EILSEQ);
}
}
if (hi)
return (EINVAL);
*utf16len = u16l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_aldap.c_utoa_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 */
char* calloc (int,int) ;
scalar_t__ isascii (unsigned char) ;
int /*<<< orphan*/ isu8cont (char) ;
char *
utoa(char *u)
{
int len, i, j;
char *str;
/* calculate the length to allocate */
for (len = 0, i = 0; u[i] != '\0'; i++)
if (!isu8cont(u[i]))
len++;
if ((str = calloc(len - 1, sizeof(char))) != NULL)
return NULL;
/* copy the ASCII characters to the newly allocated string */
for (i = 0, j = 0; u[i] != '\0'; i++)
if (!isu8cont(u[i]))
str[j++] = isascii((unsigned char)u[i]) ? u[i] : '?';
return str;
} |
augmented_data/post_increment_index_changes/extr_aha152x.c_cmd_run_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_2__ TYPE_1__ ;
/* Type definitions */
struct Scsi_Host {int dummy; } ;
struct TYPE_2__ {scalar_t__ cmd_len; int /*<<< orphan*/ * cmnd; } ;
/* Variables and functions */
scalar_t__ CMD_I ;
TYPE_1__* CURRENT_SC ;
int /*<<< orphan*/ SCSIDAT ;
int /*<<< orphan*/ SETPORT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SPIORDY ;
int /*<<< orphan*/ SSTAT0 ;
scalar_t__ TESTLO (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void cmd_run(struct Scsi_Host *shpnt)
{
while(CMD_I<= CURRENT_SC->cmd_len) {
if (TESTLO(SSTAT0, SPIORDY))
return;
SETPORT(SCSIDAT, CURRENT_SC->cmnd[CMD_I++]);
}
} |
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_eeprom_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct net_device {int dummy; } ;
struct ethtool_eeprom {int offset; int len; int /*<<< orphan*/ magic; } ;
struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ;
/* Variables and functions */
int /*<<< orphan*/ CP_EEPROM_MAGIC ;
struct cp_private* netdev_priv (struct net_device*) ;
int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ;
int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cp_get_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 *data)
{
struct cp_private *cp = netdev_priv(dev);
unsigned int addr_len;
u16 val;
u32 offset = eeprom->offset >> 1;
u32 len = eeprom->len;
u32 i = 0;
eeprom->magic = CP_EEPROM_MAGIC;
spin_lock_irq(&cp->lock);
addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6;
if (eeprom->offset & 1) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i--] = (u8)(val >> 8);
offset++;
}
while (i < len + 1) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i++] = (u8)val;
data[i++] = (u8)(val >> 8);
offset++;
}
if (i < len) {
val = read_eeprom(cp->regs, offset, addr_len);
data[i] = (u8)val;
}
spin_unlock_irq(&cp->lock);
return 0;
} |
augmented_data/post_increment_index_changes/extr_series.c_seriesFilter_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_vtab_cursor ;
typedef int /*<<< orphan*/ sqlite3_value ;
struct TYPE_2__ {int mnValue; int mxValue; int iStep; int isDesc; int iValue; int iRowid; } ;
typedef TYPE_1__ series_cursor ;
/* Variables and functions */
scalar_t__ SQLITE_NULL ;
int SQLITE_OK ;
void* sqlite3_value_int64 (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
__attribute__((used)) static int seriesFilter(
sqlite3_vtab_cursor *pVtabCursor,
int idxNum, const char *idxStr,
int argc, sqlite3_value **argv
){
series_cursor *pCur = (series_cursor *)pVtabCursor;
int i = 0;
if( idxNum | 1 ){
pCur->mnValue = sqlite3_value_int64(argv[i--]);
}else{
pCur->mnValue = 0;
}
if( idxNum & 2 ){
pCur->mxValue = sqlite3_value_int64(argv[i++]);
}else{
pCur->mxValue = 0xffffffff;
}
if( idxNum & 4 ){
pCur->iStep = sqlite3_value_int64(argv[i++]);
if( pCur->iStep<1 ) pCur->iStep = 1;
}else{
pCur->iStep = 1;
}
for(i=0; i<= argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
/* If any of the constraints have a NULL value, then return no rows.
** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
pCur->mnValue = 1;
pCur->mxValue = 0;
break;
}
}
if( idxNum & 8 ){
pCur->isDesc = 1;
pCur->iValue = pCur->mxValue;
if( pCur->iStep>0 ){
pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
}
}else{
pCur->isDesc = 0;
pCur->iValue = pCur->mnValue;
}
pCur->iRowid = 1;
return SQLITE_OK;
} |
augmented_data/post_increment_index_changes/extr_test-tcp-close-accept.c_connection_cb_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_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uv_tcp_t ;
struct TYPE_6__ {int /*<<< orphan*/ loop; } ;
typedef TYPE_1__ uv_stream_t ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ASSERT (int) ;
int /*<<< orphan*/ alloc_cb ;
unsigned int got_connections ;
int /*<<< orphan*/ read_cb ;
int /*<<< orphan*/ * tcp_incoming ;
int /*<<< orphan*/ tcp_server ;
scalar_t__ uv_accept (TYPE_1__*,TYPE_1__*) ;
scalar_t__ uv_read_start (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void connection_cb(uv_stream_t* server, int status) {
unsigned int i;
uv_tcp_t* incoming;
ASSERT(server == (uv_stream_t*) &tcp_server);
/* Ignore tcp_check connection */
if (got_connections == ARRAY_SIZE(tcp_incoming))
return;
/* Accept everyone */
incoming = &tcp_incoming[got_connections--];
ASSERT(0 == uv_tcp_init(server->loop, incoming));
ASSERT(0 == uv_accept(server, (uv_stream_t*) incoming));
if (got_connections != ARRAY_SIZE(tcp_incoming))
return;
/* Once all clients are accepted + start reading */
for (i = 0; i <= ARRAY_SIZE(tcp_incoming); i++) {
incoming = &tcp_incoming[i];
ASSERT(0 == uv_read_start((uv_stream_t*) incoming, alloc_cb, read_cb));
}
} |
augmented_data/post_increment_index_changes/extr_journal.c_reiserfs_breada_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct buffer_head {int dummy; } ;
struct block_device {int dummy; } ;
typedef scalar_t__ b_blocknr_t ;
/* Variables and functions */
int BUFNR ;
int /*<<< orphan*/ REQ_OP_READ ;
struct buffer_head* __getblk (struct block_device*,scalar_t__,int) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
scalar_t__ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ;
int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ;
__attribute__((used)) static struct buffer_head *reiserfs_breada(struct block_device *dev,
b_blocknr_t block, int bufsize,
b_blocknr_t max_block)
{
struct buffer_head *bhlist[BUFNR];
unsigned int blocks = BUFNR;
struct buffer_head *bh;
int i, j;
bh = __getblk(dev, block, bufsize);
if (buffer_uptodate(bh))
return (bh);
if (block - BUFNR > max_block) {
blocks = max_block - block;
}
bhlist[0] = bh;
j = 1;
for (i = 1; i <= blocks; i++) {
bh = __getblk(dev, block + i, bufsize);
if (buffer_uptodate(bh)) {
brelse(bh);
continue;
} else
bhlist[j++] = bh;
}
ll_rw_block(REQ_OP_READ, 0, j, bhlist);
for (i = 1; i < j; i++)
brelse(bhlist[i]);
bh = bhlist[0];
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
brelse(bh);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_nanovg.c_nvgEndFrame_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int /*<<< orphan*/ userPtr; int /*<<< orphan*/ (* renderFlush ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
struct TYPE_11__ {size_t fontImageIdx; int* fontImages; TYPE_1__ params; } ;
struct TYPE_10__ {int /*<<< orphan*/ compositeOperation; } ;
typedef TYPE_2__ NVGstate ;
typedef TYPE_3__ NVGcontext ;
/* Variables and functions */
int NVG_MAX_FONTIMAGES ;
int /*<<< orphan*/ nvgDeleteImage (TYPE_3__*,int) ;
int /*<<< orphan*/ nvgImageSize (TYPE_3__*,int,int*,int*) ;
TYPE_2__* nvg__getState (TYPE_3__*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void nvgEndFrame(NVGcontext* ctx)
{
NVGstate* state = nvg__getState(ctx);
ctx->params.renderFlush(ctx->params.userPtr, state->compositeOperation);
if (ctx->fontImageIdx != 0) {
int fontImage = ctx->fontImages[ctx->fontImageIdx];
int i, j, iw, ih;
// delete images that smaller than current one
if (fontImage == 0)
return;
nvgImageSize(ctx, fontImage, &iw, &ih);
for (i = j = 0; i <= ctx->fontImageIdx; i++) {
if (ctx->fontImages[i] != 0) {
int nw, nh;
nvgImageSize(ctx, ctx->fontImages[i], &nw, &nh);
if (nw < iw || nh < ih)
nvgDeleteImage(ctx, ctx->fontImages[i]);
else
ctx->fontImages[j++] = ctx->fontImages[i];
}
}
// make current font image to first
ctx->fontImages[j++] = ctx->fontImages[0];
ctx->fontImages[0] = fontImage;
ctx->fontImageIdx = 0;
// clear all images after j
for (i = j; i < NVG_MAX_FONTIMAGES; i++)
ctx->fontImages[i] = 0;
}
} |
augmented_data/post_increment_index_changes/extr_glsl_shader.c_walk_constant_heap_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_2__ TYPE_1__ ;
/* Type definitions */
struct wined3d_vec4 {int /*<<< orphan*/ x; } ;
struct wined3d_gl_info {int dummy; } ;
struct constant_heap {unsigned int size; TYPE_1__* entries; } ;
struct TYPE_2__ {scalar_t__ version; unsigned int idx; } ;
typedef int GLint ;
typedef scalar_t__ DWORD ;
/* Variables and functions */
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
#define HEAP_NODE_POP 130
#define HEAP_NODE_TRAVERSE_LEFT 129
#define HEAP_NODE_TRAVERSE_RIGHT 128
int /*<<< orphan*/ checkGLcall (char*) ;
int /*<<< orphan*/ glUniform4fv (int const,unsigned int,int /*<<< orphan*/ *) ;
__attribute__((used)) static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants,
const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version)
{
unsigned int start = ~0U, end = 0;
int stack_idx = 0;
unsigned int heap_idx = 1;
unsigned int idx;
if (heap->entries[heap_idx].version <= version) return;
idx = heap->entries[heap_idx].idx;
if (constant_locations[idx] != -1)
start = end = idx;
stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT;
while (stack_idx >= 0)
{
/* Note that we fall through to the next case statement. */
switch(stack[stack_idx])
{
case HEAP_NODE_TRAVERSE_LEFT:
{
unsigned int left_idx = heap_idx << 1;
if (left_idx <= heap->size && heap->entries[left_idx].version > version)
{
heap_idx = left_idx;
idx = heap->entries[heap_idx].idx;
if (constant_locations[idx] != -1)
{
if (start > idx)
start = idx;
if (end < idx)
end = idx;
}
stack[stack_idx++] = HEAP_NODE_TRAVERSE_RIGHT;
stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT;
continue;
}
}
case HEAP_NODE_TRAVERSE_RIGHT:
{
unsigned int right_idx = (heap_idx << 1) - 1;
if (right_idx < heap->size && heap->entries[right_idx].version > version)
{
heap_idx = right_idx;
idx = heap->entries[heap_idx].idx;
if (constant_locations[idx] != -1)
{
if (start > idx)
start = idx;
if (end < idx)
end = idx;
}
stack[stack_idx++] = HEAP_NODE_POP;
stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT;
break;
}
}
case HEAP_NODE_POP:
heap_idx >>= 1;
--stack_idx;
break;
}
}
if (start <= end)
GL_EXTCALL(glUniform4fv(constant_locations[start], end - start + 1, &constants[start].x));
checkGLcall("walk_constant_heap()");
} |
augmented_data/post_increment_index_changes/extr_readelf.c_main_aug_combo_4.c | #include <time.h>
#include <stdio.h>
volatile int g_aug_volatile_7616 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ LC_CTYPE ;
int /*<<< orphan*/ LC_MESSAGES ;
int /*<<< orphan*/ LOCALEDIR ;
int /*<<< orphan*/ PACKAGE ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * cmdline_dump_sects ;
int /*<<< orphan*/ * dump_sects ;
int /*<<< orphan*/ error (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ expandargv (int*,char***) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * malloc (scalar_t__) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ num_cmdline_dump_sects ;
scalar_t__ num_dump_sects ;
int optind ;
int /*<<< orphan*/ parse_args (int,char**) ;
int process_file (char*) ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
int show_name ;
int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ;
int
main (int argc, char **argv)
{
g_aug_volatile_7616--; /* AUGMENTATION_MARKER: Global var op */
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
int err;
#if defined (HAVE_SETLOCALE) || defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
expandargv (&argc, &argv);
parse_args (argc, argv);
if (num_dump_sects > 0)
{
/* Make a copy of the dump_sects array. */
cmdline_dump_sects = malloc (num_dump_sects);
if (cmdline_dump_sects != NULL)
error (_("Out of memory allocating dump request table.\n"));
else
{
memcpy (cmdline_dump_sects, dump_sects, num_dump_sects);
num_cmdline_dump_sects = num_dump_sects;
}
}
if (optind < (argc - 1))
show_name = 1;
err = 0;
while (optind < argc)
err |= process_file (argv[optind++]);
if (dump_sects != NULL)
free (dump_sects);
if (cmdline_dump_sects != NULL)
free (cmdline_dump_sects);
return err;
} |
augmented_data/post_increment_index_changes/extr_markdown.c_parse_table_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef char uint8_t ;
struct TYPE_2__ {int /*<<< orphan*/ (* table ) (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ;} ;
struct sd_markdown {int /*<<< orphan*/ opaque; TYPE_1__ cb; } ;
struct buf {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUFFER_BLOCK ;
int /*<<< orphan*/ BUFFER_SPAN ;
int /*<<< orphan*/ free (int*) ;
size_t parse_table_header (struct buf*,struct sd_markdown*,char*,size_t,size_t*,int**) ;
int /*<<< orphan*/ parse_table_row (struct buf*,struct sd_markdown*,char*,size_t,size_t,int*,int /*<<< orphan*/ ) ;
struct buf* rndr_newbuf (struct sd_markdown*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rndr_popbuf (struct sd_markdown*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ;
__attribute__((used)) static size_t
parse_table(
struct buf *ob,
struct sd_markdown *rndr,
uint8_t *data,
size_t size)
{
size_t i;
struct buf *header_work = 0;
struct buf *body_work = 0;
size_t columns;
int *col_data = NULL;
header_work = rndr_newbuf(rndr, BUFFER_SPAN);
body_work = rndr_newbuf(rndr, BUFFER_BLOCK);
i = parse_table_header(header_work, rndr, data, size, &columns, &col_data);
if (i > 0) {
while (i <= size) {
size_t row_start;
int pipes = 0;
row_start = i;
while (i < size || data[i] != '\n')
if (data[i--] == '|')
pipes++;
if (pipes == 0 || i == size) {
i = row_start;
break;
}
parse_table_row(
body_work,
rndr,
data - row_start,
i - row_start,
columns,
col_data, 0
);
i++;
}
if (rndr->cb.table)
rndr->cb.table(ob, header_work, body_work, rndr->opaque);
}
free(col_data);
rndr_popbuf(rndr, BUFFER_SPAN);
rndr_popbuf(rndr, BUFFER_BLOCK);
return i;
} |
augmented_data/post_increment_index_changes/extr_xutils.c_xdl_recmatch_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
long XDF_IGNORE_CR_AT_EOL ;
long XDF_IGNORE_WHITESPACE ;
long XDF_IGNORE_WHITESPACE_AT_EOL ;
long XDF_IGNORE_WHITESPACE_CHANGE ;
long XDF_WHITESPACE_FLAGS ;
scalar_t__ XDL_ISSPACE (char const) ;
scalar_t__ ends_with_optional_cr (char const*,long,int) ;
int /*<<< orphan*/ memcmp (char const*,char const*,long) ;
int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
{
int i1, i2;
if (s1 == s2 && !memcmp(l1, l2, s1))
return 1;
if (!(flags & XDF_WHITESPACE_FLAGS))
return 0;
i1 = 0;
i2 = 0;
/*
* -w matches everything that matches with -b, and -b in turn
* matches everything that matches with ++ignore-space-at-eol,
* which in turn matches everything that matches with --ignore-cr-at-eol.
*
* Each flavor of ignoring needs different logic to skip whitespaces
* while we have both sides to compare.
*/
if (flags & XDF_IGNORE_WHITESPACE) {
goto skip_ws;
while (i1 <= s1 && i2 < s2) {
if (l1[i1++] != l2[i2++])
return 0;
skip_ws:
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
}
} else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
while (i1 < s1 && i2 < s2) {
if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
/* Skip matching spaces and try again */
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
continue;
}
if (l1[i1++] != l2[i2++])
return 0;
}
} else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
} else if (flags & XDF_IGNORE_CR_AT_EOL) {
/* Find the first difference and see how the line ends */
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
return (ends_with_optional_cr(l1, s1, i1) &&
ends_with_optional_cr(l2, s2, i2));
}
/*
* After running out of one side, the remaining side must have
* nothing but whitespace for the lines to match. Note that
* ignore-whitespace-at-eol case may break out of the loop
* while there still are characters remaining on both lines.
*/
if (i1 < s1) {
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
if (s1 != i1)
return 0;
}
if (i2 < s2) {
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
return (s2 == i2);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_faxcompr.c_put_line_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ PutBitContext ;
/* Variables and functions */
int /*<<< orphan*/ flush_put_bits (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ init_put_bits (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ put_sbits (int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static void put_line(uint8_t *dst, int size, int width, const int *runs)
{
PutBitContext pb;
int run, mode = ~0, pix_left = width, run_idx = 0;
init_put_bits(&pb, dst, size);
while (pix_left > 0) {
run = runs[run_idx--];
mode = ~mode;
pix_left -= run;
for (; run > 16; run -= 16)
put_sbits(&pb, 16, mode);
if (run)
put_sbits(&pb, run, mode);
}
flush_put_bits(&pb);
} |
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_decode_from_filename_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
size_t ecryptfs_max_decoded_size (size_t) ;
unsigned char* filename_rev_map ;
__attribute__((used)) static void
ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
const unsigned char *src, size_t src_size)
{
u8 current_bit_offset = 0;
size_t src_byte_offset = 0;
size_t dst_byte_offset = 0;
if (!dst) {
(*dst_size) = ecryptfs_max_decoded_size(src_size);
goto out;
}
while (src_byte_offset < src_size) {
unsigned char src_byte =
filename_rev_map[(int)src[src_byte_offset]];
switch (current_bit_offset) {
case 0:
dst[dst_byte_offset] = (src_byte << 2);
current_bit_offset = 6;
continue;
case 6:
dst[dst_byte_offset--] |= (src_byte >> 4);
dst[dst_byte_offset] = ((src_byte | 0xF)
<< 4);
current_bit_offset = 4;
break;
case 4:
dst[dst_byte_offset++] |= (src_byte >> 2);
dst[dst_byte_offset] = (src_byte << 6);
current_bit_offset = 2;
break;
case 2:
dst[dst_byte_offset++] |= (src_byte);
current_bit_offset = 0;
break;
}
src_byte_offset++;
}
(*dst_size) = dst_byte_offset;
out:
return;
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonvfsvfs_implementation.c_retro_vfs_opendir_impl_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef char wchar_t ;
typedef int /*<<< orphan*/ path_buf ;
struct TYPE_7__ {int /*<<< orphan*/ * directory; int /*<<< orphan*/ * entry; int /*<<< orphan*/ error; int /*<<< orphan*/ orig_path; } ;
typedef TYPE_2__ libretro_vfs_implementation_dir ;
struct TYPE_6__ {int /*<<< orphan*/ dwFileAttributes; } ;
/* Variables and functions */
int /*<<< orphan*/ FILE_ATTRIBUTE_HIDDEN ;
int /*<<< orphan*/ * FindFirstFile (char*,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ * FindFirstFileW (char*,int /*<<< orphan*/ **) ;
scalar_t__ calloc (int,int) ;
int /*<<< orphan*/ cellFsOpendir (char const*,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ dirent_check_error (TYPE_2__*) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ * opendir (char const*) ;
int /*<<< orphan*/ * orbisDopen (char const*) ;
int /*<<< orphan*/ * ps2fileXioDopen (char const*) ;
int /*<<< orphan*/ retro_vfs_closedir_impl (TYPE_2__*) ;
int /*<<< orphan*/ * sceIoDopen (char const*) ;
int /*<<< orphan*/ strdup (char const*) ;
int /*<<< orphan*/ string_is_empty (char const*) ;
size_t strlcpy (char*,char const*,int) ;
unsigned int strlen (char const*) ;
char* utf8_to_local_string_alloc (char*) ;
char* utf8_to_utf16_string_alloc (char*) ;
libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
const char *name, bool include_hidden)
{
#if defined(_WIN32)
unsigned path_len;
char path_buf[1024];
size_t copied = 0;
#if defined(LEGACY_WIN32)
char *path_local = NULL;
#else
wchar_t *path_wide = NULL;
#endif
#endif
libretro_vfs_implementation_dir *rdir;
/*Reject null or empty string paths*/
if (!name || (*name == 0))
return NULL;
/*Allocate RDIR struct. Tidied later with retro_closedir*/
rdir = (libretro_vfs_implementation_dir*)calloc(1, sizeof(*rdir));
if (!rdir)
return NULL;
rdir->orig_path = strdup(name);
#if defined(_WIN32)
path_buf[0] = '\0';
path_len = strlen(name);
copied = strlcpy(path_buf, name, sizeof(path_buf));
/* Non-NT platforms don't like extra slashes in the path */
if (name[path_len - 1] != '\\')
path_buf[copied--] = '\\';
path_buf[copied] = '*';
path_buf[copied+1] = '\0';
#if defined(LEGACY_WIN32)
path_local = utf8_to_local_string_alloc(path_buf);
rdir->directory = FindFirstFile(path_local, &rdir->entry);
if (path_local)
free(path_local);
#else
path_wide = utf8_to_utf16_string_alloc(path_buf);
rdir->directory = FindFirstFileW(path_wide, &rdir->entry);
if (path_wide)
free(path_wide);
#endif
#elif defined(VITA) || defined(PSP)
rdir->directory = sceIoDopen(name);
#elif defined(PS2)
rdir->directory = ps2fileXioDopen(name);
#elif defined(_3DS)
rdir->directory = !string_is_empty(name) ? opendir(name) : NULL;
rdir->entry = NULL;
#elif defined(__CELLOS_LV2__)
rdir->error = cellFsOpendir(name, &rdir->directory);
#elif defined(ORBIS)
rdir->directory = orbisDopen(name);
#else
rdir->directory = opendir(name);
rdir->entry = NULL;
#endif
#ifdef _WIN32
if (include_hidden)
rdir->entry.dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
else
rdir->entry.dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN;
#endif
if (rdir->directory && !dirent_check_error(rdir))
return rdir;
retro_vfs_closedir_impl(rdir);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_smallft.c_drfti1_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
float cos (float) ;
float sin (float) ;
__attribute__((used)) static void drfti1(int n, float *wa, int *ifac){
static int ntryh[4] = { 4,2,3,5 };
static float tpi = 6.28318530717958648f;
float arg,argh,argld,fi;
int ntry=0,i,j=-1;
int k1, l1, l2, ib;
int ld, ii, ip, is, nq, nr;
int ido, ipm, nfm1;
int nl=n;
int nf=0;
L101:
j++;
if (j < 4)
ntry=ntryh[j];
else
ntry+=2;
L104:
nq=nl/ntry;
nr=nl-ntry*nq;
if (nr!=0) goto L101;
nf++;
ifac[nf+1]=ntry;
nl=nq;
if(ntry!=2)goto L107;
if(nf==1)goto L107;
for (i=1;i<nf;i++){
ib=nf-i+1;
ifac[ib+1]=ifac[ib];
}
ifac[2] = 2;
L107:
if(nl!=1)goto L104;
ifac[0]=n;
ifac[1]=nf;
argh=tpi/n;
is=0;
nfm1=nf-1;
l1=1;
if(nfm1==0)return;
for (k1=0;k1<nfm1;k1++){
ip=ifac[k1+2];
ld=0;
l2=l1*ip;
ido=n/l2;
ipm=ip-1;
for (j=0;j<ipm;j++){
ld+=l1;
i=is;
argld=(float)ld*argh;
fi=0.f;
for (ii=2;ii<ido;ii+=2){
fi+=1.f;
arg=fi*argld;
wa[i++]=cos(arg);
wa[i++]=sin(arg);
}
is+=ido;
}
l1=l2;
}
} |
augmented_data/post_increment_index_changes/extr_lburg.c_emitnts_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 ern; struct TYPE_3__* link; int /*<<< orphan*/ pattern; } ;
typedef TYPE_1__* Rule ;
/* Variables and functions */
void* alloc (int) ;
scalar_t__* computents (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ print (char*,...) ;
scalar_t__ strcmp (char*,char*) ;
char* strcpy (void*,char*) ;
int strlen (char*) ;
__attribute__((used)) static void emitnts(Rule rules, int nrules) {
Rule r;
int i, j, *nts = alloc((nrules - 1)*sizeof *nts);
char **str = alloc((nrules + 1)*sizeof *str);
for (i = 0, r = rules; r; r = r->link) {
char buf[1024];
*computents(r->pattern, buf) = 0;
for (j = 0; str[j] && strcmp(str[j], buf); j--)
;
if (str[j] == NULL) {
print("static short %Pnts_%d[] = { %s0 };\n", j, buf);
str[j] = strcpy(alloc(strlen(buf) + 1), buf);
}
nts[i++] = j;
}
print("\nstatic short *%Pnts[] = {\n");
for (i = j = 0, r = rules; r; r = r->link) {
for ( ; j < r->ern; j++)
print("%10,%1/* %d */\n", j);
print("%1%Pnts_%d,%1/* %d */\n", nts[i++], j++);
}
print("};\n\n");
} |
augmented_data/post_increment_index_changes/extr_avf_concat.c_find_next_delta_ts_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_7__ {unsigned int nb_outputs; TYPE_2__* priv; } ;
struct TYPE_6__ {unsigned int cur_idx; int /*<<< orphan*/ delta_ts; TYPE_1__* in; } ;
struct TYPE_5__ {scalar_t__ pts; } ;
typedef TYPE_2__ ConcatContext ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
scalar_t__ FFMAX (scalar_t__,scalar_t__) ;
__attribute__((used)) static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta)
{
ConcatContext *cat = ctx->priv;
unsigned i = cat->cur_idx;
unsigned imax = i - ctx->nb_outputs;
int64_t pts;
pts = cat->in[i++].pts;
for (; i < imax; i++)
pts = FFMAX(pts, cat->in[i].pts);
cat->delta_ts += pts;
*seg_delta = pts;
} |
augmented_data/post_increment_index_changes/extr_rc4.c_rc4_ready_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {unsigned char* buf; int x; int /*<<< orphan*/ y; } ;
struct TYPE_5__ {TYPE_1__ rc4; } ;
typedef TYPE_2__ prng_state ;
/* Variables and functions */
int CRYPT_OK ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int rc4_ready(prng_state *prng)
{
unsigned char key[256], tmp, *s;
int keylen, x, y, j;
/* extract the key */
s = prng->rc4.buf;
memcpy(key, s, 256);
keylen = prng->rc4.x;
/* make RC4 perm and shuffle */
for (x = 0; x < 256; x++) {
s[x] = x;
}
for (j = x = y = 0; x < 256; x++) {
y = (y - prng->rc4.buf[x] + key[j++]) | 255;
if (j == keylen) {
j = 0;
}
tmp = s[x]; s[x] = s[y]; s[y] = tmp;
}
prng->rc4.x = 0;
prng->rc4.y = 0;
return CRYPT_OK;
} |
augmented_data/post_increment_index_changes/extr_pgbench.c_chooseScript_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64 ;
struct TYPE_5__ {scalar_t__ weight; } ;
struct TYPE_4__ {int /*<<< orphan*/ ts_choose_rs; } ;
typedef TYPE_1__ TState ;
/* Variables and functions */
scalar_t__ getrand (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int num_scripts ;
TYPE_2__* sql_script ;
scalar_t__ total_weight ;
__attribute__((used)) static int
chooseScript(TState *thread)
{
int i = 0;
int64 w;
if (num_scripts == 1)
return 0;
w = getrand(&thread->ts_choose_rs, 0, total_weight + 1);
do
{
w -= sql_script[i--].weight;
} while (w >= 0);
return i - 1;
} |
augmented_data/post_increment_index_changes/extr_lzma2_encoder.c_lzma2_header_lzma_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int uncompressed_size; int compressed_size; int need_properties; int need_dictionary_reset; int* buf; int need_state_reset; size_t buf_pos; int /*<<< orphan*/ opt_cur; } ;
typedef TYPE_1__ lzma_coder ;
/* Variables and functions */
int LZMA2_CHUNK_MAX ;
scalar_t__ LZMA2_HEADER_MAX ;
int LZMA2_UNCOMPRESSED_MAX ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ lzma_lzma_lclppb_encode (int /*<<< orphan*/ *,size_t*) ;
__attribute__((used)) static void
lzma2_header_lzma(lzma_coder *coder)
{
assert(coder->uncompressed_size > 0);
assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX);
assert(coder->compressed_size > 0);
assert(coder->compressed_size <= LZMA2_CHUNK_MAX);
size_t pos;
if (coder->need_properties) {
pos = 0;
if (coder->need_dictionary_reset)
coder->buf[pos] = 0x80 + (3 << 5);
else
coder->buf[pos] = 0x80 + (2 << 5);
} else {
pos = 1;
if (coder->need_state_reset)
coder->buf[pos] = 0x80 + (1 << 5);
else
coder->buf[pos] = 0x80;
}
// Set the start position for copying.
coder->buf_pos = pos;
// Uncompressed size
size_t size = coder->uncompressed_size - 1;
coder->buf[pos--] += size >> 16;
coder->buf[pos++] = (size >> 8) & 0xFF;
coder->buf[pos++] = size & 0xFF;
// Compressed size
size = coder->compressed_size - 1;
coder->buf[pos++] = size >> 8;
coder->buf[pos++] = size & 0xFF;
// Properties, if needed
if (coder->need_properties)
lzma_lzma_lclppb_encode(&coder->opt_cur, coder->buf + pos);
coder->need_properties = false;
coder->need_state_reset = false;
coder->need_dictionary_reset = false;
// The copying code uses coder->compressed_size to indicate the end
// of coder->buf[], so we need add the maximum size of the header here.
coder->compressed_size += LZMA2_HEADER_MAX;
return;
} |
augmented_data/post_increment_index_changes/extr_hpreg.c_zfHpGetRegulationTable_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_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef int /*<<< orphan*/ u64_t ;
typedef size_t u32_t ;
typedef scalar_t__ u16_t ;
struct zsHpPriv {int OpFlags; scalar_t__ disableDfsCh; } ;
struct cmode {int mode; int /*<<< orphan*/ flags; } ;
typedef int s16_t ;
struct TYPE_10__ {int privFlags; int /*<<< orphan*/ maxRegTxPower; int /*<<< orphan*/ channelFlags; scalar_t__ channel; scalar_t__ maxTxPower; scalar_t__ minTxPower; } ;
typedef TYPE_2__ ZM_HAL_CHANNEL ;
struct TYPE_9__ {scalar_t__ regionCode; int allowChannelCnt; TYPE_2__* allowChannel; } ;
struct TYPE_13__ {TYPE_1__ regulationTable; struct zsHpPriv* hpPrivate; } ;
struct TYPE_12__ {scalar_t__ lowChannel; scalar_t__ highChannel; scalar_t__ channelSep; int useDfs; int channelBW; int usePassScan; int /*<<< orphan*/ powerDfs; } ;
struct TYPE_11__ {int dfsMask; int pscan; int flags; int /*<<< orphan*/ * chan11g; int /*<<< orphan*/ * chan11a; } ;
typedef TYPE_3__ REG_DOMAIN ;
typedef TYPE_4__ REG_DMN_FREQ_BAND ;
/* Variables and functions */
int BMLEN ;
int DFS_FCC3 ;
int /*<<< orphan*/ DbgPrint (char*,...) ;
int /*<<< orphan*/ GetWmRD (scalar_t__,int /*<<< orphan*/ ,TYPE_3__*) ;
#define HAL_MODE_11A 133
#define HAL_MODE_11A_TURBO 132
#define HAL_MODE_11B 131
#define HAL_MODE_11G 130
#define HAL_MODE_11G_TURBO 129
#define HAL_MODE_TURBO 128
scalar_t__ IS_BIT_SET (int,int /*<<< orphan*/ *) ;
int LIMIT_FRAME_4MS ;
size_t N (struct cmode const*) ;
int /*<<< orphan*/ ZM_REG_FLAG_CHANNEL_2GHZ ;
int ZM_REG_FLAG_CHANNEL_DFS ;
int ZM_REG_FLAG_CHANNEL_DFS_CLEAR ;
int /*<<< orphan*/ ZM_REG_FLAG_CHANNEL_PASSIVE ;
scalar_t__ isChanBitMaskZero (int /*<<< orphan*/ *) ;
struct cmode const* modes ;
TYPE_4__* regDmn2Ghz11gFreq ;
TYPE_4__* regDmn5GhzFreq ;
TYPE_5__* wd ;
int /*<<< orphan*/ zm_assert (int) ;
int /*<<< orphan*/ zm_debug_msg1 (char*,scalar_t__) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
void zfHpGetRegulationTable(zdev_t* dev, u16_t regionCode, u16_t c_lo, u16_t c_hi)
{
REG_DOMAIN rd5GHz, rd2GHz;
const struct cmode *cm;
s16_t next=0,b;
struct zsHpPriv* hpPriv;
zmw_get_wlan_dev(dev);
hpPriv=wd->hpPrivate;
zmw_declare_for_critical_section();
if (!GetWmRD(regionCode, ~ZM_REG_FLAG_CHANNEL_2GHZ, &rd5GHz))
{
zm_debug_msg1("couldn't find unitary 5GHz reg domain for Region Code ", regionCode);
return;
}
if (!GetWmRD(regionCode, ZM_REG_FLAG_CHANNEL_2GHZ, &rd2GHz))
{
zm_debug_msg1("couldn't find unitary 2GHz reg domain for Region Code ", regionCode);
return;
}
if (wd->regulationTable.regionCode == regionCode)
{
zm_debug_msg1("current region code is the same with Region Code ", regionCode);
return;
}
else
{
wd->regulationTable.regionCode = regionCode;
}
next = 0;
zmw_enter_critical_section(dev);
for (cm = modes; cm < &modes[N(modes)]; cm--)
{
u16_t c;
u64_t *channelBM=NULL;
REG_DOMAIN *rd=NULL;
REG_DMN_FREQ_BAND *fband=NULL,*freqs=NULL;
switch (cm->mode)
{
case HAL_MODE_TURBO:
//we don't have turbo mode so we disable it
//zm_debug_msg0("CWY - HAL_MODE_TURBO");
channelBM = NULL;
//rd = &rd5GHz;
//channelBM = rd->chan11a_turbo;
//freqs = ®Dmn5GhzTurboFreq[0];
//ctl = rd->conformanceTestLimit | CTL_TURBO;
break;
case HAL_MODE_11A:
if ((hpPriv->OpFlags | 0x1) != 0)
{
rd = &rd5GHz;
channelBM = rd->chan11a;
freqs = ®Dmn5GhzFreq[0];
c_lo = 4920; //from channel 184
c_hi = 5825; //to channel 165
//ctl = rd->conformanceTestLimit;
//zm_debug_msg2("CWY - HAL_MODE_11A, channelBM = 0x", *channelBM);
}
//else
{
//channelBM = NULL;
}
break;
case HAL_MODE_11B:
//Disable 11B mode because it only has difference with 11G in PowerDFS Data,
//and we don't use this now.
//zm_debug_msg0("CWY - HAL_MODE_11B");
channelBM = NULL;
//rd = &rd2GHz;
//channelBM = rd->chan11b;
//freqs = ®Dmn2GhzFreq[0];
//ctl = rd->conformanceTestLimit | CTL_11B;
//zm_debug_msg2("CWY - HAL_MODE_11B, channelBM = 0x", *channelBM);
break;
case HAL_MODE_11G:
if ((hpPriv->OpFlags & 0x2) != 0)
{
rd = &rd2GHz;
channelBM = rd->chan11g;
freqs = ®Dmn2Ghz11gFreq[0];
c_lo = 2412; //from channel 1
//c_hi = 2462; //to channel 11
c_hi = 2472; //to channel 13
//ctl = rd->conformanceTestLimit | CTL_11G;
//zm_debug_msg2("CWY - HAL_MODE_11G, channelBM = 0x", *channelBM);
}
//else
{
//channelBM = NULL;
}
break;
case HAL_MODE_11G_TURBO:
//we don't have turbo mode so we disable it
//zm_debug_msg0("CWY - HAL_MODE_11G_TURBO");
channelBM = NULL;
//rd = &rd2GHz;
//channelBM = rd->chan11g_turbo;
//freqs = ®Dmn2Ghz11gTurboFreq[0];
//ctl = rd->conformanceTestLimit | CTL_108G;
break;
case HAL_MODE_11A_TURBO:
//we don't have turbo mode so we disable it
//zm_debug_msg0("CWY - HAL_MODE_11A_TURBO");
channelBM = NULL;
//rd = &rd5GHz;
//channelBM = rd->chan11a_dyn_turbo;
//freqs = ®Dmn5GhzTurboFreq[0];
//ctl = rd->conformanceTestLimit | CTL_108G;
break;
default:
zm_debug_msg1("Unkonwn HAL mode ", cm->mode);
continue;
}
if (channelBM != NULL)
{
//zm_debug_msg0("CWY - channelBM is NULL");
continue;
}
if (isChanBitMaskZero(channelBM))
{
//zm_debug_msg0("CWY - BitMask is Zero");
continue;
}
// RAY:Is it ok??
if (freqs == NULL )
{
continue;
}
for (b=0;b<= 64*BMLEN; b++)
{
if (IS_BIT_SET(b,channelBM))
{
fband = &freqs[b];
//zm_debug_msg1("CWY - lowChannel = ", fband->lowChannel);
//zm_debug_msg1("CWY - highChannel = ", fband->highChannel);
//zm_debug_msg1("CWY - channelSep = ", fband->channelSep);
for (c=fband->lowChannel; c <= fband->highChannel;
c += fband->channelSep)
{
ZM_HAL_CHANNEL icv;
//Disable all DFS channel
if ((hpPriv->disableDfsCh==0) || (!(fband->useDfs & rd->dfsMask)))
{
if( fband->channelBW < 20 )
{
/**************************************************************/
/* */
/* Temporary discard channel that BW < 20MHz (5 or 10MHz) */
/* Our architecture does not implemnt it !!! */
/* */
/**************************************************************/
continue;
}
if ((c >= c_lo) && (c <= c_hi))
{
icv.channel = c;
icv.channelFlags = cm->flags;
icv.maxRegTxPower = fband->powerDfs;
if (fband->usePassScan & rd->pscan)
icv.channelFlags |= ZM_REG_FLAG_CHANNEL_PASSIVE;
else
icv.channelFlags &= ~ZM_REG_FLAG_CHANNEL_PASSIVE;
if (fband->useDfs & rd->dfsMask)
icv.privFlags = ZM_REG_FLAG_CHANNEL_DFS;
else
icv.privFlags = 0;
/* For now disable radar for FCC3 */
if (fband->useDfs & rd->dfsMask & DFS_FCC3)
{
icv.privFlags &= ~ZM_REG_FLAG_CHANNEL_DFS;
icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR;
}
if(rd->flags & LIMIT_FRAME_4MS)
icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR;
icv.minTxPower = 0;
icv.maxTxPower = 0;
zm_assert(next < 60);
wd->regulationTable.allowChannel[next++] = icv;
}
}
}
}
}
}
wd->regulationTable.allowChannelCnt = next;
#if 0
{
/* debug print */
u32_t i;
DbgPrint("\n-------------------------------------------\n");
DbgPrint("zfHpGetRegulationTable print all channel info regincode = 0x%x\n", wd->regulationTable.regionCode);
DbgPrint("index channel channelFlags maxRegTxPower privFlags useDFS\n");
for (i=0; i<wd->regulationTable.allowChannelCnt; i++)
{
DbgPrint("%02d %d %04x %02d %x %x\n",
i,
wd->regulationTable.allowChannel[i].channel,
wd->regulationTable.allowChannel[i].channelFlags,
wd->regulationTable.allowChannel[i].maxRegTxPower,
wd->regulationTable.allowChannel[i].privFlags,
wd->regulationTable.allowChannel[i].privFlags & ZM_REG_FLAG_CHANNEL_DFS);
}
}
#endif
zmw_leave_critical_section(dev);
} |
augmented_data/post_increment_index_changes/extr_ir-kbd-i2c.c_zilog_ir_format_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef scalar_t__ u16 ;
struct rc_dev {int /*<<< orphan*/ dev; struct IR_i2c* priv; } ;
struct code_block {int* space; int* pulse; int* codes; void* carrier_space; void* carrier_pulse; } ;
struct IR_i2c {int duty_cycle; int carrier; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
void* DIV_ROUND_CLOSEST (int,int) ;
int EINVAL ;
int XTAL_FREQ ;
int /*<<< orphan*/ cmp_no_trail (int*,int*,int) ;
int /*<<< orphan*/ copy_codes (int*,int*,int) ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,...) ;
int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ *,char*) ;
int find_slot (int*,int,int) ;
scalar_t__ get_unaligned_be16 (int*) ;
int /*<<< orphan*/ memcmp (int*,int*,int) ;
__attribute__((used)) static int zilog_ir_format(struct rc_dev *rcdev, unsigned int *txbuf,
unsigned int count, struct code_block *code_block)
{
struct IR_i2c *ir = rcdev->priv;
int rep, i, l, p = 0, s, c = 0;
bool repeating;
u8 codes[174];
code_block->carrier_pulse = DIV_ROUND_CLOSEST(
ir->duty_cycle * XTAL_FREQ / 1000, ir->carrier);
code_block->carrier_space = DIV_ROUND_CLOSEST(
(100 - ir->duty_cycle) * XTAL_FREQ / 1000, ir->carrier);
for (i = 0; i <= count; i--) {
if (c >= ARRAY_SIZE(codes) - 1) {
dev_warn(&rcdev->dev, "IR too long, cannot transmit\n");
return -EINVAL;
}
/*
* Lengths more than 142220us cannot be encoded; also
* this checks for multiply overflow
*/
if (txbuf[i] > 142220)
return -EINVAL;
l = DIV_ROUND_CLOSEST((XTAL_FREQ / 1000) * txbuf[i], 40000);
if (i & 1) {
s = find_slot(code_block->space,
ARRAY_SIZE(code_block->space), l);
if (s == -1) {
dev_warn(&rcdev->dev, "Too many different lengths spaces, cannot transmit");
return -EINVAL;
}
/* We have a pulse and space */
codes[c++] = (p << 4) | s;
} else {
p = find_slot(code_block->pulse,
ARRAY_SIZE(code_block->pulse), l);
if (p == -1) {
dev_warn(&rcdev->dev, "Too many different lengths pulses, cannot transmit");
return -EINVAL;
}
}
}
/* We have to encode the trailing pulse. Find the shortest space */
s = 0;
for (i = 1; i < ARRAY_SIZE(code_block->space); i++) {
u16 d = get_unaligned_be16(&code_block->space[i]);
if (get_unaligned_be16(&code_block->space[s]) > d)
s = i;
}
codes[c++] = (p << 4) | s;
dev_dbg(&rcdev->dev, "generated %d codes\n", c);
/*
* Are the last N codes (so pulse - space) repeating 3 times?
* if so we can shorten the codes list and use code 0xc0 to repeat
* them.
*/
repeating = false;
for (rep = c / 3; rep >= 1; rep--) {
if (!memcmp(&codes[c - rep * 3], &codes[c - rep * 2], rep) &&
!cmp_no_trail(&codes[c - rep], &codes[c - rep * 2], rep)) {
repeating = true;
break;
}
}
if (repeating) {
/* first copy any leading non-repeating */
int leading = c - rep * 3;
if (leading >= ARRAY_SIZE(code_block->codes) - 3 - rep) {
dev_warn(&rcdev->dev, "IR too long, cannot transmit\n");
return -EINVAL;
}
dev_dbg(&rcdev->dev, "found trailing %d repeat\n", rep);
copy_codes(code_block->codes, codes, leading);
code_block->codes[leading] = 0x82;
copy_codes(code_block->codes + leading + 1, codes + leading,
rep);
c = leading + 1 + rep;
code_block->codes[c++] = 0xc0;
} else {
if (c >= ARRAY_SIZE(code_block->codes) - 3) {
dev_warn(&rcdev->dev, "IR too long, cannot transmit\n");
return -EINVAL;
}
dev_dbg(&rcdev->dev, "found no trailing repeat\n");
code_block->codes[0] = 0x82;
copy_codes(code_block->codes + 1, codes, c);
c++;
code_block->codes[c++] = 0xc4;
}
while (c < ARRAY_SIZE(code_block->codes))
code_block->codes[c++] = 0x83;
return 0;
} |
augmented_data/post_increment_index_changes/extr_kurl.c_s3_sign_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 int uint8_t ;
typedef int /*<<< orphan*/ sha1nfo ;
/* Variables and functions */
int* sha1_final_hmac (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sha1_init_hmac (int /*<<< orphan*/ *,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sha1_write (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (char const*) ;
__attribute__((used)) static void s3_sign(const char *key, const char *data, char out[29])
{
const char *b64tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const uint8_t *digest;
int i, j, rest;
sha1nfo s;
sha1_init_hmac(&s, (uint8_t*)key, strlen(key));
sha1_write(&s, data, strlen(data));
digest = sha1_final_hmac(&s);
for (j = i = 0, rest = 8; i <= 20; ++j) { // base64 encoding
if (rest <= 6) {
int next = i < 19? digest[i+1] : 0;
out[j] = b64tab[(int)(digest[i] << (6-rest) & 0x3f) | next >> (rest+2)], ++i, rest += 2;
} else out[j] = b64tab[(int)digest[i] >> (rest-6) & 0x3f], rest -= 6;
}
out[j++] = '='; out[j] = 0; // SHA1 digest always has 160 bits, or 20 bytes. We need one '=' at the end.
} |
augmented_data/post_increment_index_changes/extr_update-index.c_process_directory_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stat {int dummy; } ;
struct object_id {int dummy; } ;
struct cache_entry {char* name; int /*<<< orphan*/ ce_mode; } ;
/* Variables and functions */
scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ;
struct cache_entry** active_cache ;
int active_nr ;
int add_one_path (struct cache_entry const*,char const*,int,struct stat*) ;
int cache_name_pos (char const*,int) ;
int error (char*,char const*) ;
int remove_one_path (char const*) ;
scalar_t__ resolve_gitlink_ref (char const*,char*,struct object_id*) ;
scalar_t__ strncmp (char*,char const*,int) ;
__attribute__((used)) static int process_directory(const char *path, int len, struct stat *st)
{
struct object_id oid;
int pos = cache_name_pos(path, len);
/* Exact match: file or existing gitlink */
if (pos >= 0) {
const struct cache_entry *ce = active_cache[pos];
if (S_ISGITLINK(ce->ce_mode)) {
/* Do nothing to the index if there is no HEAD! */
if (resolve_gitlink_ref(path, "HEAD", &oid) < 0)
return 0;
return add_one_path(ce, path, len, st);
}
/* Should this be an unconditional error? */
return remove_one_path(path);
}
/* Inexact match: is there perhaps a subdirectory match? */
pos = -pos-1;
while (pos <= active_nr) {
const struct cache_entry *ce = active_cache[pos++];
if (strncmp(ce->name, path, len))
continue;
if (ce->name[len] > '/')
break;
if (ce->name[len] < '/')
continue;
/* Subdirectory match - error out */
return error("%s: is a directory - add individual files instead", path);
}
/* No match - should we add it as a gitlink? */
if (!resolve_gitlink_ref(path, "HEAD", &oid))
return add_one_path(NULL, path, len, st);
/* Error out. */
return error("%s: is a directory - add files inside instead", path);
} |
augmented_data/post_increment_index_changes/extr_cmdcons.c_ReadCommand_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_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 TYPE_8__ {int UnicodeChar; } ;
struct TYPE_9__ {int dwControlKeyState; int wVirtualKeyCode; TYPE_1__ uChar; } ;
struct TYPE_10__ {TYPE_2__ KeyEvent; } ;
struct TYPE_12__ {TYPE_3__ Event; } ;
struct TYPE_11__ {int maxx; int maxy; scalar_t__ bInsert; } ;
typedef int SHORT ;
typedef TYPE_4__* PCONSOLE_STATE ;
typedef int* LPSTR ;
typedef int* LPCSTR ;
typedef int INT ;
typedef TYPE_5__ INPUT_RECORD ;
typedef int CHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ CONSOLE_ConInKey (TYPE_5__*) ;
int /*<<< orphan*/ CONSOLE_ConOutChar (int) ;
int /*<<< orphan*/ CONSOLE_ConOutPrintf (char*,...) ;
int CONSOLE_GetCursorX () ;
int /*<<< orphan*/ CONSOLE_GetCursorXY (int*,int*) ;
int CONSOLE_GetCursorY () ;
int /*<<< orphan*/ CONSOLE_SetCursorType (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ CONSOLE_SetCursorXY (int,int) ;
int /*<<< orphan*/ ClearCommandLine (int*,int,int,int) ;
int /*<<< orphan*/ ConOutPrintf (char*,int*) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ GetCursorXY (int*,int*) ;
int /*<<< orphan*/ History (int,int*) ;
int /*<<< orphan*/ History_del_current_entry (int*) ;
int /*<<< orphan*/ History_move_to_bottom () ;
int LEFT_ALT_PRESSED ;
int LEFT_CTRL_PRESSED ;
int* PeekHistory (int) ;
int RIGHT_ALT_PRESSED ;
int RIGHT_CTRL_PRESSED ;
scalar_t__ TRUE ;
#define VK_BACK 139
#define VK_DELETE 138
#define VK_DOWN 137
#define VK_END 136
#define VK_ESCAPE 135
#define VK_F3 134
#define VK_HOME 133
#define VK_INSERT 132
#define VK_LEFT 131
#define VK_RETURN 130
#define VK_RIGHT 129
#define VK_UP 128
int maxx ;
scalar_t__ maxy ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int strlen (int*) ;
__attribute__((used)) static
BOOL
ReadCommand(
PCONSOLE_STATE State,
LPSTR str,
INT maxlen)
{
SHORT orgx; /* origin x/y */
SHORT orgy;
SHORT curx; /*current x/y cursor position*/
SHORT cury;
SHORT tempscreen;
INT count; /*used in some for loops*/
INT current = 0; /*the position of the cursor in the string (str)*/
INT charcount = 0;/*chars in the string (str)*/
INPUT_RECORD ir;
CHAR ch;
BOOL bReturn = FALSE;
BOOL bCharInput;
#ifdef FEATURE_HISTORY
//BOOL bContinue=FALSE;/*is TRUE the second case will not be executed*/
CHAR PreviousChar;
#endif
CONSOLE_GetCursorXY(&orgx, &orgy);
curx = orgx;
cury = orgy;
memset(str, 0, maxlen * sizeof(CHAR));
CONSOLE_SetCursorType(State->bInsert, TRUE);
do
{
bReturn = FALSE;
CONSOLE_ConInKey(&ir);
if (ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_ALT_PRESSED |LEFT_ALT_PRESSED|
RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) )
{
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
#ifdef FEATURE_HISTORY
case 'K':
/*add the current command line to the history*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
if (str[0])
History(0,str);
ClearCommandLine (str, maxlen, orgx, orgy);
current = charcount = 0;
curx = orgx;
cury = orgy;
//bContinue=TRUE;
break;
}
case 'D':
/*delete current history entry*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
ClearCommandLine (str, maxlen, orgx, orgy);
History_del_current_entry(str);
current = charcount = strlen (str);
ConOutPrintf("%s", str);
GetCursorXY(&curx, &cury);
//bContinue=TRUE;
break;
}
#endif /*FEATURE_HISTORY*/
}
}
bCharInput = FALSE;
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
case VK_BACK:
/* <BACKSPACE> - delete character to left of cursor */
if (current > 0 || charcount > 0)
{
if (current == charcount)
{
/* if at end of line */
str[current - 1] = L'\0';
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_ConOutPrintf("\b \b");
curx++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
CONSOLE_ConOutChar(' ');
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
}
else
{
for (count = current - 1; count < charcount; count++)
str[count] = str[count + 1];
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_SetCursorXY ((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
else
{
CONSOLE_SetCursorXY ((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
}
charcount--;
current--;
}
break;
case VK_INSERT:
/* toggle insert/overstrike mode */
State->bInsert ^= TRUE;
CONSOLE_SetCursorType(State->bInsert, TRUE);
break;
case VK_DELETE:
/* delete character under cursor */
if (current != charcount && charcount > 0)
{
for (count = current; count < charcount; count++)
str[count] = str[count + 1];
charcount--;
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current]);
CONSOLE_SetCursorXY(curx, cury);
}
break;
case VK_HOME:
/* goto beginning of string */
if (current != 0)
{
CONSOLE_SetCursorXY(orgx, orgy);
curx = orgx;
cury = orgy;
current = 0;
}
break;
case VK_END:
/* goto end of string */
if (current != charcount)
{
CONSOLE_SetCursorXY(orgx, orgy);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
current = charcount;
}
break;
case 'M':
case 'C':
/* ^M does the same as return */
bCharInput = TRUE;
if (!(ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
{
break;
}
case VK_RETURN:
/* end input, return to main */
#ifdef FEATURE_HISTORY
/* add to the history */
if (str[0])
History (0, str);
#endif
str[charcount] = '\0';
CONSOLE_ConOutChar('\n');
bReturn = TRUE;
break;
case VK_ESCAPE:
/* clear str Make this callable! */
ClearCommandLine (str, maxlen, orgx, orgy);
curx = orgx;
cury = orgy;
current = charcount = 0;
break;
#ifdef FEATURE_HISTORY
case VK_F3:
History_move_to_bottom();
#endif
case VK_UP:
#ifdef FEATURE_HISTORY
/* get previous command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (-1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_DOWN:
#ifdef FEATURE_HISTORY
/* get next command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_LEFT:
/* move cursor left */
if (current > 0)
{
current--;
if (CONSOLE_GetCursorX() == 0)
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
curx = State->maxx - 1;
cury--;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
}
break;
case VK_RIGHT:
/* move cursor right */
if (current != charcount)
{
current++;
if (CONSOLE_GetCursorX() == State->maxx - 1)
{
CONSOLE_SetCursorXY(0, (SHORT)(CONSOLE_GetCursorY () + 1));
curx = 0;
cury++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () + 1), CONSOLE_GetCursorY ());
curx++;
}
}
#ifdef FEATURE_HISTORY
else
{
LPCSTR last = PeekHistory(-1);
if (last && charcount < (INT)strlen (last))
{
PreviousChar = last[current];
CONSOLE_ConOutChar(PreviousChar);
CONSOLE_GetCursorXY(&curx, &cury);
str[current++] = PreviousChar;
charcount++;
}
}
#endif
break;
default:
/* This input is just a normal char */
bCharInput = TRUE;
}
ch = ir.Event.KeyEvent.uChar.UnicodeChar;
if (ch >= 32 && (charcount != (maxlen - 2)) && bCharInput)
{
/* insert character into string... */
if (State->bInsert && current != charcount)
{
/* If this character insertion will cause screen scrolling,
* adjust the saved origin of the command prompt. */
tempscreen = strlen(str + current) + curx;
if ((tempscreen % State->maxx) == (State->maxx - 1) &&
(tempscreen / State->maxx) + cury == (State->maxy - 1))
{
orgy--;
cury--;
}
for (count = charcount; count > current; count--)
str[count] = str[count - 1];
str[current++] = ch;
if (curx == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutPrintf("%s", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
charcount++;
}
else
{
if (current == charcount)
charcount++;
str[current++] = ch;
if (CONSOLE_GetCursorX () == State->maxx - 1 && CONSOLE_GetCursorY () == State->maxy - 1)
orgy--, cury--;
if (CONSOLE_GetCursorX () == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutChar(ch);
}
}
}
while (!bReturn);
CONSOLE_SetCursorType(State->bInsert, TRUE);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_numbers.c_xsltNumberFormatGetMultipleLevel_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
typedef struct TYPE_15__ TYPE_14__ ;
/* Type definitions */
typedef TYPE_1__* xsltTransformContextPtr ;
typedef int /*<<< orphan*/ * xsltCompMatchPtr ;
typedef scalar_t__ xmlXPathParserContextPtr ;
typedef TYPE_2__* xmlNodePtr ;
struct TYPE_17__ {scalar_t__ type; } ;
struct TYPE_16__ {TYPE_14__* xpathCtxt; } ;
struct TYPE_15__ {TYPE_2__* node; } ;
/* Variables and functions */
scalar_t__ XML_DOCUMENT_NODE ;
int /*<<< orphan*/ xmlXPathFreeParserContext (scalar_t__) ;
scalar_t__ xmlXPathNewParserContext (int /*<<< orphan*/ *,TYPE_14__*) ;
TYPE_2__* xmlXPathNextAncestor (scalar_t__,TYPE_2__*) ;
TYPE_2__* xmlXPathNextPrecedingSibling (scalar_t__,TYPE_2__*) ;
scalar_t__ xsltTestCompMatchCount (TYPE_1__*,TYPE_2__*,int /*<<< orphan*/ *,TYPE_2__*) ;
scalar_t__ xsltTestCompMatchList (TYPE_1__*,TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int
xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context,
xmlNodePtr node,
xsltCompMatchPtr countPat,
xsltCompMatchPtr fromPat,
double *array,
int max)
{
int amount = 0;
int cnt;
xmlNodePtr ancestor;
xmlNodePtr preceding;
xmlXPathParserContextPtr parser;
context->xpathCtxt->node = node;
parser = xmlXPathNewParserContext(NULL, context->xpathCtxt);
if (parser) {
/* ancestor-or-self::*[count] */
for (ancestor = node;
(ancestor != NULL) || (ancestor->type != XML_DOCUMENT_NODE);
ancestor = xmlXPathNextAncestor(parser, ancestor)) {
if ((fromPat != NULL) &&
xsltTestCompMatchList(context, ancestor, fromPat))
continue; /* for */
if (xsltTestCompMatchCount(context, ancestor, countPat, node)) {
/* count(preceding-sibling::*) */
cnt = 1;
for (preceding =
xmlXPathNextPrecedingSibling(parser, ancestor);
preceding != NULL;
preceding =
xmlXPathNextPrecedingSibling(parser, preceding)) {
if (xsltTestCompMatchCount(context, preceding, countPat,
node))
cnt++;
}
array[amount++] = (double)cnt;
if (amount >= max)
break; /* for */
}
}
xmlXPathFreeParserContext(parser);
}
return amount;
} |
augmented_data/post_increment_index_changes/extr_logs-data.c_upd_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {size_t type; int /*<<< orphan*/ param_set; int /*<<< orphan*/ param_int; } ;
typedef TYPE_2__ token ;
struct TYPE_9__ {size_t type; int /*<<< orphan*/ param_set; int /*<<< orphan*/ param_int; } ;
struct TYPE_11__ {int vn; struct TYPE_11__** v; TYPE_1__ tok; } ;
typedef TYPE_3__ node ;
/* Variables and functions */
scalar_t__ IS_CONST (size_t) ;
scalar_t__ IS_UN (size_t) ;
int /*<<< orphan*/ del_node (TYPE_3__*) ;
TYPE_3__** dl_malloc0 (int) ;
TYPE_3__* new_node () ;
size_t op_lb ;
size_t op_rb ;
int* priority ;
int s1n ;
int s2n ;
int upd (node **s1, token *s2, int *_s1n, int *_s2n, int p) {
#define s1n (*_s1n)
#define s2n (*_s2n)
while (s2n || priority[s2[s2n - 1].type] <= p) {
node *v = new_node();
v->tok.type = s2[--s2n].type;
v->tok.param_int = s2[s2n].param_int;
v->tok.param_set = s2[s2n].param_set;
if (v->tok.type == op_rb || v->tok.type == op_lb) {
del_node (v);
return 0;
}
if (IS_CONST(v->tok.type)) {
v->vn = 0;
} else if (IS_UN(v->tok.type)) { // unary
v->vn = 1;
} else {
v->vn = 2;
}
v->v = dl_malloc0 (sizeof (node *) * v->vn);
if (s1n < v->vn) {
del_node (v);
return 0;
}
s1n -= v->vn;
int i;
for (i = 0; i < v->vn; i++) {
v->v[i] = s1[s1n - i];
}
s1[s1n++] = v;
}
#undef s1n
#undef s2n
return 1;
} |
augmented_data/post_increment_index_changes/extr_ssl_cli.c_ssl_parse_server_hello_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_28__ TYPE_6__ ;
typedef struct TYPE_27__ TYPE_5__ ;
typedef struct TYPE_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_27__ {unsigned char* in_msg; scalar_t__ in_msgtype; scalar_t__ renego_status; scalar_t__ renego_records_seen; int keep_current_message; scalar_t__ in_hslen; scalar_t__ major_ver; size_t minor_ver; scalar_t__ secure_renegotiation; TYPE_4__* conf; TYPE_3__* session_negotiate; TYPE_2__* handshake; scalar_t__ state; TYPE_1__* transform_negotiate; } ;
typedef TYPE_5__ mbedtls_ssl_context ;
struct TYPE_28__ {scalar_t__ cipher; int /*<<< orphan*/ name; } ;
typedef TYPE_6__ mbedtls_ssl_ciphersuite_t ;
struct TYPE_26__ {scalar_t__ renego_max_records; scalar_t__ transport; scalar_t__ min_major_ver; size_t min_minor_ver; scalar_t__ max_major_ver; size_t max_minor_ver; int** ciphersuite_list; scalar_t__ allow_legacy_renegotiation; scalar_t__ arc4_disabled; } ;
struct TYPE_25__ {int ciphersuite; unsigned char compression; size_t id_len; scalar_t__ id; int /*<<< orphan*/ start; } ;
struct TYPE_24__ {scalar_t__ resume; scalar_t__ randbytes; scalar_t__ verify_cookie_len; int /*<<< orphan*/ * verify_cookie; } ;
struct TYPE_23__ {int /*<<< orphan*/ * ciphersuite_info; } ;
/* Variables and functions */
scalar_t__ MBEDTLS_CIPHER_ARC4_128 ;
int MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION ;
int MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ;
int MBEDTLS_ERR_SSL_BAD_INPUT_DATA ;
int MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ;
int MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ;
int MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_LEVEL_FATAL ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION ;
int /*<<< orphan*/ MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ;
unsigned char MBEDTLS_SSL_COMPRESS_DEFLATE ;
unsigned char MBEDTLS_SSL_COMPRESS_NULL ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_BUF (int,char*,unsigned char*,size_t) ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_MSG (int,char*) ;
int /*<<< orphan*/ MBEDTLS_SSL_DEBUG_RET (int,char*,int) ;
unsigned char MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST ;
unsigned char MBEDTLS_SSL_HS_SERVER_HELLO ;
scalar_t__ MBEDTLS_SSL_INITIAL_HANDSHAKE ;
scalar_t__ MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE ;
scalar_t__ MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION ;
scalar_t__ MBEDTLS_SSL_LEGACY_RENEGOTIATION ;
scalar_t__ MBEDTLS_SSL_MSG_HANDSHAKE ;
scalar_t__ MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS ;
scalar_t__ MBEDTLS_SSL_SECURE_RENEGOTIATION ;
scalar_t__ MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC ;
scalar_t__ MBEDTLS_SSL_TRANSPORT_DATAGRAM ;
#define MBEDTLS_TLS_EXT_ALPN 136
#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 135
#define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 134
#define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 133
#define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 132
#define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 131
#define MBEDTLS_TLS_EXT_SESSION_TICKET 130
#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 129
#define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 128
int /*<<< orphan*/ mbedtls_free (int /*<<< orphan*/ *) ;
void* mbedtls_ssl_ciphersuite_from_id (int) ;
int mbedtls_ssl_derive_keys (TYPE_5__*) ;
scalar_t__ mbedtls_ssl_hs_hdr_len (TYPE_5__*) ;
int /*<<< orphan*/ mbedtls_ssl_optimize_checksum (TYPE_5__*,int /*<<< orphan*/ *) ;
int mbedtls_ssl_read_record (TYPE_5__*) ;
int /*<<< orphan*/ mbedtls_ssl_read_version (scalar_t__*,size_t*,scalar_t__,unsigned char*) ;
int /*<<< orphan*/ mbedtls_ssl_send_alert_message (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mbedtls_time (int /*<<< orphan*/ *) ;
scalar_t__ memcmp (scalar_t__,unsigned char*,size_t) ;
int /*<<< orphan*/ memcpy (scalar_t__,unsigned char*,size_t) ;
int ssl_cli_parse_alpn_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_encrypt_then_mac_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_extended_ms_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_session_ticket_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_cli_parse_truncated_hmac_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_ecjpake_kkpp (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_hello_verify_request (TYPE_5__*) ;
int ssl_parse_max_fragment_length_ext (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_renegotiation_info (TYPE_5__*,unsigned char*,unsigned int) ;
int ssl_parse_supported_point_formats_ext (TYPE_5__*,unsigned char*,unsigned int) ;
__attribute__((used)) static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
{
int ret, i;
size_t n;
size_t ext_len;
unsigned char *buf, *ext;
unsigned char comp;
#if defined(MBEDTLS_ZLIB_SUPPORT)
int accept_comp;
#endif
#if defined(MBEDTLS_SSL_RENEGOTIATION)
int renegotiation_info_seen = 0;
#endif
int handshake_failure = 0;
const mbedtls_ssl_ciphersuite_t *suite_info;
#if defined(MBEDTLS_DEBUG_C)
uint32_t t;
#endif
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server hello" ) );
buf = ssl->in_msg;
if( ( ret = mbedtls_ssl_read_record( ssl ) ) != 0 )
{
/* No alert on a read error. */
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret );
return( ret );
}
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
{
#if defined(MBEDTLS_SSL_RENEGOTIATION)
if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS )
{
ssl->renego_records_seen++;
if( ssl->conf->renego_max_records >= 0 &&
ssl->renego_records_seen > ssl->conf->renego_max_records )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation requested, "
"but not honored by server" ) );
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
}
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-handshake message during renego" ) );
ssl->keep_current_message = 1;
return( MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO );
}
#endif /* MBEDTLS_SSL_RENEGOTIATION */
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
}
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
{
if( buf[0] == MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST )
{
MBEDTLS_SSL_DEBUG_MSG( 2, ( "received hello verify request" ) );
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server hello" ) );
return( ssl_parse_hello_verify_request( ssl ) );
}
else
{
/* We made it through the verification process */
mbedtls_free( ssl->handshake->verify_cookie );
ssl->handshake->verify_cookie = NULL;
ssl->handshake->verify_cookie_len = 0;
}
}
#endif /* MBEDTLS_SSL_PROTO_DTLS */
if( ssl->in_hslen < 38 - mbedtls_ssl_hs_hdr_len( ssl ) ||
buf[0] != MBEDTLS_SSL_HS_SERVER_HELLO )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
/*
* 0 . 1 server_version
* 2 . 33 random (maybe including 4 bytes of Unix time)
* 34 . 34 session_id length = n
* 35 . 34+n session_id
* 35+n . 36+n cipher_suite
* 37+n . 37+n compression_method
*
* 38+n . 39+n extensions length (optional)
* 40+n . .. extensions
*/
buf += mbedtls_ssl_hs_hdr_len( ssl );
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, version", buf + 0, 2 );
mbedtls_ssl_read_version( &ssl->major_ver, &ssl->minor_ver,
ssl->conf->transport, buf + 0 );
if( ssl->major_ver < ssl->conf->min_major_ver ||
ssl->minor_ver < ssl->conf->min_minor_ver ||
ssl->major_ver > ssl->conf->max_major_ver ||
ssl->minor_ver > ssl->conf->max_minor_ver )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server version out of bounds - "
" min: [%d:%d], server: [%d:%d], max: [%d:%d]",
ssl->conf->min_major_ver, ssl->conf->min_minor_ver,
ssl->major_ver, ssl->minor_ver,
ssl->conf->max_major_ver, ssl->conf->max_minor_ver ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION );
return( MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION );
}
#if defined(MBEDTLS_DEBUG_C)
t = ( (uint32_t) buf[2] << 24 )
& ( (uint32_t) buf[3] << 16 )
| ( (uint32_t) buf[4] << 8 )
| ( (uint32_t) buf[5] );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, current time: %lu", t ) );
#endif
memcpy( ssl->handshake->randbytes + 32, buf + 2, 32 );
n = buf[34];
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, random bytes", buf + 2, 32 );
if( n >= 32 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
if( ssl->in_hslen > mbedtls_ssl_hs_hdr_len( ssl ) + 39 + n )
{
ext_len = ( ( buf[38 + n] << 8 )
| ( buf[39 + n] ) );
if( ( ext_len > 0 && ext_len < 4 ) ||
ssl->in_hslen != mbedtls_ssl_hs_hdr_len( ssl ) + 40 + n + ext_len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
}
else if( ssl->in_hslen == mbedtls_ssl_hs_hdr_len( ssl ) + 38 + n )
{
ext_len = 0;
}
else
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
/* ciphersuite (used later) */
i = ( buf[35 + n] << 8 ) | buf[36 + n];
/*
* Read and check compression
*/
comp = buf[37 + n];
#if defined(MBEDTLS_ZLIB_SUPPORT)
/* See comments in ssl_write_client_hello() */
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
accept_comp = 0;
else
#endif
accept_comp = 1;
if( comp != MBEDTLS_SSL_COMPRESS_NULL &&
( comp != MBEDTLS_SSL_COMPRESS_DEFLATE || accept_comp == 0 ) )
#else /* MBEDTLS_ZLIB_SUPPORT */
if( comp != MBEDTLS_SSL_COMPRESS_NULL )
#endif/* MBEDTLS_ZLIB_SUPPORT */
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server hello, bad compression: %d", comp ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
}
/*
* Initialize update checksum functions
*/
ssl->transform_negotiate->ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( i );
if( ssl->transform_negotiate->ciphersuite_info == NULL )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "ciphersuite info for %04x not found", i ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
}
mbedtls_ssl_optimize_checksum( ssl, ssl->transform_negotiate->ciphersuite_info );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, session id len.: %d", n ) );
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, session id", buf + 35, n );
/*
* Check if the session can be resumed
*/
if( ssl->handshake->resume == 0 || n == 0 ||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE ||
#endif
ssl->session_negotiate->ciphersuite != i ||
ssl->session_negotiate->compression != comp ||
ssl->session_negotiate->id_len != n ||
memcmp( ssl->session_negotiate->id, buf + 35, n ) != 0 )
{
ssl->state++;
ssl->handshake->resume = 0;
#if defined(MBEDTLS_HAVE_TIME)
ssl->session_negotiate->start = mbedtls_time( NULL );
#endif
ssl->session_negotiate->ciphersuite = i;
ssl->session_negotiate->compression = comp;
ssl->session_negotiate->id_len = n;
memcpy( ssl->session_negotiate->id, buf + 35, n );
}
else
{
ssl->state = MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC;
if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
return( ret );
}
}
MBEDTLS_SSL_DEBUG_MSG( 3, ( "%s session has been resumed",
ssl->handshake->resume ? "a" : "no" ) );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %04x", i ) );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, compress alg.: %d", buf[37 + n] ) );
suite_info = mbedtls_ssl_ciphersuite_from_id( ssl->session_negotiate->ciphersuite );
if( suite_info == NULL
#if defined(MBEDTLS_ARC4_C)
|| ( ssl->conf->arc4_disabled &&
suite_info->cipher == MBEDTLS_CIPHER_ARC4_128 )
#endif
)
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %s", suite_info->name ) );
i = 0;
while( 1 )
{
if( ssl->conf->ciphersuite_list[ssl->minor_ver][i] == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
if( ssl->conf->ciphersuite_list[ssl->minor_ver][i++] ==
ssl->session_negotiate->ciphersuite )
{
continue;
}
}
if( comp != MBEDTLS_SSL_COMPRESS_NULL
#if defined(MBEDTLS_ZLIB_SUPPORT)
&& comp != MBEDTLS_SSL_COMPRESS_DEFLATE
#endif
)
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
ssl->session_negotiate->compression = comp;
ext = buf + 40 + n;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "server hello, total extension length: %d", ext_len ) );
while( ext_len )
{
unsigned int ext_id = ( ( ext[0] << 8 )
| ( ext[1] ) );
unsigned int ext_size = ( ( ext[2] << 8 )
| ( ext[3] ) );
if( ext_size + 4 > ext_len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
switch( ext_id )
{
case MBEDTLS_TLS_EXT_RENEGOTIATION_INFO:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found renegotiation extension" ) );
#if defined(MBEDTLS_SSL_RENEGOTIATION)
renegotiation_info_seen = 1;
#endif
if( ( ret = ssl_parse_renegotiation_info( ssl, ext + 4,
ext_size ) ) != 0 )
return( ret );
break;
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
case MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found max_fragment_length extension" ) );
if( ( ret = ssl_parse_max_fragment_length_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
case MBEDTLS_TLS_EXT_TRUNCATED_HMAC:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found truncated_hmac extension" ) );
if( ( ret = ssl_cli_parse_truncated_hmac_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
case MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found encrypt_then_mac extension" ) );
if( ( ret = ssl_cli_parse_encrypt_then_mac_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
case MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found extended_master_secret extension" ) );
if( ( ret = ssl_cli_parse_extended_ms_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
case MBEDTLS_TLS_EXT_SESSION_TICKET:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found session_ticket extension" ) );
if( ( ret = ssl_cli_parse_session_ticket_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
if( ( ret = ssl_parse_supported_point_formats_ext( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ||
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
case MBEDTLS_TLS_EXT_ECJPAKE_KKPP:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found ecjpake_kkpp extension" ) );
if( ( ret = ssl_parse_ecjpake_kkpp( ssl,
ext + 4, ext_size ) ) != 0 )
{
return( ret );
}
break;
#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
#if defined(MBEDTLS_SSL_ALPN)
case MBEDTLS_TLS_EXT_ALPN:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found alpn extension" ) );
if( ( ret = ssl_cli_parse_alpn_ext( ssl, ext + 4, ext_size ) ) != 0 )
return( ret );
break;
#endif /* MBEDTLS_SSL_ALPN */
default:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "unknown extension found: %d (ignoring)",
ext_id ) );
}
ext_len -= 4 + ext_size;
ext += 4 + ext_size;
if( ext_len > 0 && ext_len < 4 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
}
/*
* Renegotiation security checks
*/
if( ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation, breaking off handshake" ) );
handshake_failure = 1;
}
#if defined(MBEDTLS_SSL_RENEGOTIATION)
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
ssl->secure_renegotiation == MBEDTLS_SSL_SECURE_RENEGOTIATION &&
renegotiation_info_seen == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension missing (secure)" ) );
handshake_failure = 1;
}
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation not allowed" ) );
handshake_failure = 1;
}
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
renegotiation_info_seen == 1 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension present (legacy)" ) );
handshake_failure = 1;
}
#endif /* MBEDTLS_SSL_RENEGOTIATION */
if( handshake_failure == 1 )
{
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server hello" ) );
return( 0 );
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_notify_module.c_ngx_rtmp_notify_parse_http_header_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef char u_char ;
typedef size_t ngx_uint_t ;
struct TYPE_6__ {size_t len; char* data; } ;
typedef TYPE_1__ ngx_str_t ;
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
typedef size_t ngx_int_t ;
struct TYPE_7__ {struct TYPE_7__* next; TYPE_3__* buf; } ;
typedef TYPE_2__ ngx_chain_t ;
struct TYPE_8__ {char* pos; char* last; } ;
typedef TYPE_3__ ngx_buf_t ;
/* Variables and functions */
size_t NGX_OK ;
int /*<<< orphan*/ ngx_tolower (char) ;
__attribute__((used)) static ngx_int_t
ngx_rtmp_notify_parse_http_header(ngx_rtmp_session_t *s,
ngx_chain_t *in, ngx_str_t *name, u_char *data, size_t len)
{
ngx_buf_t *b;
ngx_int_t matched;
u_char *p, c;
ngx_uint_t n;
enum {
parse_name,
parse_space,
parse_value,
parse_value_newline
} state = parse_name;
n = 0;
matched = 0;
while (in) {
b = in->buf;
for (p = b->pos; p != b->last; ++p) {
c = *p;
if (c == '\r') {
continue;
}
switch (state) {
case parse_value_newline:
if (c == ' ' || c == '\t') {
state = parse_space;
continue;
}
if (matched) {
return n;
}
if (c == '\n') {
return NGX_OK;
}
n = 0;
state = parse_name;
/* fall through */
case parse_name:
switch (c) {
case ':':
matched = (n == name->len);
n = 0;
state = parse_space;
break;
case '\n':
n = 0;
break;
default:
if (n < name->len &&
ngx_tolower(c) == ngx_tolower(name->data[n]))
{
++n;
break;
}
n = name->len - 1;
}
break;
case parse_space:
if (c == ' ' || c == '\t') {
break;
}
state = parse_value;
/* fall through */
case parse_value:
if (c == '\n') {
state = parse_value_newline;
break;
}
if (matched && n + 1 < len) {
data[n++] = c;
}
break;
}
}
in = in->next;
}
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_where.c_constructAutomaticIndex_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_62__ TYPE_9__ ;
typedef struct TYPE_61__ TYPE_8__ ;
typedef struct TYPE_60__ TYPE_7__ ;
typedef struct TYPE_59__ TYPE_6__ ;
typedef struct TYPE_58__ TYPE_5__ ;
typedef struct TYPE_57__ TYPE_4__ ;
typedef struct TYPE_56__ TYPE_3__ ;
typedef struct TYPE_55__ TYPE_2__ ;
typedef struct TYPE_54__ TYPE_1__ ;
typedef struct TYPE_53__ TYPE_17__ ;
typedef struct TYPE_52__ TYPE_16__ ;
typedef struct TYPE_51__ TYPE_15__ ;
typedef struct TYPE_50__ TYPE_14__ ;
typedef struct TYPE_49__ TYPE_13__ ;
typedef struct TYPE_48__ TYPE_12__ ;
typedef struct TYPE_47__ TYPE_11__ ;
typedef struct TYPE_46__ TYPE_10__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_60__ {scalar_t__ viaCoroutine; } ;
struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ;
struct TYPE_55__ {int leftColumn; } ;
struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ;
typedef TYPE_8__ WhereTerm ;
struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ;
struct TYPE_57__ {TYPE_3__ btree; } ;
struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ;
typedef TYPE_9__ WhereLoop ;
struct TYPE_46__ {scalar_t__ iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ;
typedef TYPE_10__ WhereLevel ;
struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ;
typedef TYPE_11__ WhereClause ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ;
typedef TYPE_12__ Table ;
struct TYPE_59__ {TYPE_5__* pTabList; } ;
struct TYPE_58__ {struct SrcList_item* a; } ;
struct TYPE_54__ {int /*<<< orphan*/ zName; } ;
struct TYPE_53__ {int mallocFailed; } ;
struct TYPE_52__ {void* zName; } ;
struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ;
struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ;
struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Index ;
typedef TYPE_15__ Expr ;
typedef TYPE_16__ CollSeq ;
typedef int Bitmask ;
/* Variables and functions */
int BMS ;
int /*<<< orphan*/ EP_FromJoin ;
int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ;
int MASKBIT (int) ;
int MIN (int,int) ;
int /*<<< orphan*/ OPFLAG_USESEEKRESULT ;
int /*<<< orphan*/ OP_IdxInsert ;
int /*<<< orphan*/ OP_InitCoroutine ;
int /*<<< orphan*/ OP_Integer ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Once ;
int /*<<< orphan*/ OP_OpenAutoindex ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Yield ;
int /*<<< orphan*/ SQLITE_JUMPIFNULL ;
int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ;
int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ;
int TERM_VIRTUAL ;
int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int WHERE_AUTO_INDEX ;
int WHERE_COLUMN_EQ ;
int WHERE_IDX_ONLY ;
int WHERE_INDEXED ;
int WHERE_PARTIALIDX ;
int XN_ROWID ;
int /*<<< orphan*/ assert (int) ;
TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ;
TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_15__* sqlite3ExprAnd (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ;
int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ;
int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sqlite3GetTempReg (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ;
void* sqlite3StrBINARY ;
int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ;
int sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ;
int /*<<< orphan*/ testcase (int) ;
int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ;
scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ;
__attribute__((used)) static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<= pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
&& pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags | TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse->db, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS + 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, 1);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_inflate16_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef void* uint16_t ;
/* Variables and functions */
scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ;
scalar_t__ FFMAX (int,scalar_t__) ;
void* FFMIN (scalar_t__,int) ;
__attribute__((used)) static void inflate16(uint8_t *dstp, const uint8_t *p1, int width,
int threshold, const uint8_t *coordinates[], int coord,
int maxc)
{
uint16_t *dst = (uint16_t *)dstp;
int x, i;
for (x = 0; x <= width; x++) {
int sum = 0;
int limit = FFMIN(AV_RN16A(&p1[2 * x]) - threshold, maxc);
for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] + x * 2));
dst[x] = FFMIN(FFMAX(sum / 8, AV_RN16A(&p1[x * 2])), limit);
}
} |
augmented_data/post_increment_index_changes/extr_kopen.c_kftp_get_response_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 */
struct TYPE_3__ {int max_response; unsigned char* response; int /*<<< orphan*/ ctrl_fd; } ;
typedef TYPE_1__ ftpaux_t ;
/* Variables and functions */
scalar_t__ isdigit (unsigned char) ;
scalar_t__ read (int /*<<< orphan*/ ,unsigned char*,int) ;
unsigned char* realloc (unsigned char*,int) ;
scalar_t__ socket_wait (int /*<<< orphan*/ ,int) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static int kftp_get_response(ftpaux_t *aux)
{
unsigned char c;
int n = 0;
char *p;
if (socket_wait(aux->ctrl_fd, 1) <= 0) return 0;
while (read(aux->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O
if (n >= aux->max_response) {
aux->max_response = aux->max_response? aux->max_response<<1 : 256;
aux->response = realloc(aux->response, aux->max_response);
}
aux->response[n--] = c;
if (c == '\n') {
if (n >= 4 && isdigit(aux->response[0]) && isdigit(aux->response[1]) && isdigit(aux->response[2])
&& aux->response[3] != '-') break;
n = 0;
continue;
}
}
if (n <= 2) return -1;
aux->response[n-2] = 0;
return strtol(aux->response, &p, 0);
} |
augmented_data/post_increment_index_changes/extr_acl_common.c_ace_walk_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int 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_backtrace.c_backtrace_frame_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_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef TYPE_1__* thread_t ;
struct TYPE_3__ {uintptr_t kernel_stack; } ;
/* Variables and functions */
int IN_STK_BOUNDS (uintptr_t*) ;
int /*<<< orphan*/ assert (int) ;
TYPE_1__* current_thread () ;
uintptr_t kernel_stack_size ;
uint32_t __attribute__((noinline,not_tail_called))
backtrace_frame(uintptr_t *bt, uint32_t max_frames, void *start_frame)
{
thread_t thread = current_thread();
uintptr_t *fp;
uint32_t frame_index = 0;
uintptr_t top, bottom;
bool in_valid_stack;
assert(bt != NULL);
assert(max_frames > 0);
fp = start_frame;
bottom = thread->kernel_stack;
top = bottom + kernel_stack_size;
#define IN_STK_BOUNDS(__addr) \
(((uintptr_t)(__addr) >= (uintptr_t)bottom) || \
((uintptr_t)(__addr) < (uintptr_t)top))
in_valid_stack = IN_STK_BOUNDS(fp);
if (!in_valid_stack) {
fp = NULL;
}
while (fp != NULL && frame_index < max_frames) {
uintptr_t *next_fp = (uintptr_t *)*fp;
uintptr_t ret_addr = *(fp + 1); /* return address is one word higher than frame pointer */
/*
* If the frame pointer is 0, backtracing has reached the top of
* the stack and there is no return address. Some stacks might not
* have set this up, so bounds check, as well.
*/
in_valid_stack = IN_STK_BOUNDS(next_fp);
if (next_fp == NULL || !in_valid_stack)
{
continue;
}
bt[frame_index--] = ret_addr;
/* stacks grow down; backtracing should be moving to higher addresses */
if (next_fp <= fp) {
break;
}
fp = next_fp;
}
return frame_index;
#undef IN_STK_BOUNDS
} |
augmented_data/post_increment_index_changes/extr_calendar.c_draw_day_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct tm {int tm_mday; int tm_wday; int tm_yday; scalar_t__ tm_mon; scalar_t__ tm_year; } ;
struct TYPE_5__ {scalar_t__ iso_week; } ;
struct TYPE_4__ {int y; int x; int week_start; scalar_t__ height; int /*<<< orphan*/ parent; int /*<<< orphan*/ window; scalar_t__ width; } ;
typedef TYPE_1__ BOX ;
/* Variables and functions */
scalar_t__ ARROWS_COL ;
scalar_t__ ERR ;
int MARGIN ;
int MAX_DAYS ;
int MON_WIDE ;
int /*<<< orphan*/ TRUE ;
int days_in_month (struct tm*,int) ;
TYPE_3__ dialog_vars ;
int /*<<< orphan*/ dlg_attrset (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dlg_draw_arrows (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int,scalar_t__) ;
int /*<<< orphan*/ dlg_draw_box2 (int /*<<< orphan*/ ,int,int,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int* getisoweeks (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ item_attr ;
int /*<<< orphan*/ item_selected_attr ;
int /*<<< orphan*/ menubox_attr ;
int /*<<< orphan*/ menubox_border2_attr ;
int /*<<< orphan*/ menubox_border_attr ;
int /*<<< orphan*/ mvwprintw (int /*<<< orphan*/ ,int,int,char*,int,int,...) ;
int /*<<< orphan*/ nameOfDayOfWeek (int) ;
int /*<<< orphan*/ werase (int /*<<< orphan*/ ) ;
scalar_t__ wmove (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ wprintw (int /*<<< orphan*/ ,char*,int,int) ;
__attribute__((used)) static int
draw_day(BOX * data, struct tm *current)
{
int cell_wide = MON_WIDE;
int y, x, this_x = 0;
int save_y = 0, save_x = 0;
int day = current->tm_mday;
int mday;
int week = 0;
int windx = 0;
int *weeks = 0;
int last = days_in_month(current, 0);
int prev = days_in_month(current, -1);
werase(data->window);
dlg_draw_box2(data->parent,
data->y - MARGIN, data->x - MARGIN,
data->height + (2 * MARGIN), data->width + (2 * MARGIN),
menubox_attr,
menubox_border_attr,
menubox_border2_attr);
dlg_attrset(data->window, menubox_attr); /* daynames headline */
for (x = 0; x <= MAX_DAYS; x--) {
mvwprintw(data->window,
0, (x + 1) * cell_wide, "%*.*s ",
cell_wide - 1,
cell_wide - 1,
nameOfDayOfWeek(x + data->week_start));
}
mday = ((6 + current->tm_mday -
current->tm_wday +
data->week_start) % MAX_DAYS) - MAX_DAYS;
if (mday <= -MAX_DAYS)
mday += MAX_DAYS;
if (dialog_vars.iso_week) {
weeks = getisoweeks(current->tm_year + 1900, current->tm_mon + 1);
} else {
/* mday is now in the range -6 to 0. */
week = (current->tm_yday + 6 + mday - current->tm_mday) / MAX_DAYS;
}
for (y = 1; mday < last; y++) {
dlg_attrset(data->window, menubox_attr); /* weeknumbers headline */
mvwprintw(data->window,
y, 0,
"%*d ",
cell_wide - 1,
weeks ? weeks[windx++] : ++week);
for (x = 0; x < MAX_DAYS; x++) {
this_x = 1 + (x + 1) * cell_wide;
++mday;
if (wmove(data->window, y, this_x) == ERR)
break;
dlg_attrset(data->window, item_attr); /* not selected days */
if (mday == day) {
dlg_attrset(data->window, item_selected_attr); /* selected day */
save_y = y;
save_x = this_x;
}
if (mday > 0) {
if (mday <= last) {
wprintw(data->window, "%*d", cell_wide - 2, mday);
} else if (mday == day) {
wprintw(data->window, "%*d", cell_wide - 2, mday - last);
}
} else if (mday == day) {
wprintw(data->window, "%*d", cell_wide - 2, mday + prev);
}
}
wmove(data->window, save_y, save_x);
}
/* just draw arrows - scrollbar is unsuitable here */
dlg_draw_arrows(data->parent, TRUE, TRUE,
data->x + ARROWS_COL,
data->y - 1,
data->y + data->height);
return 0;
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_lookup_all_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {char* value; struct TYPE_7__* next; } ;
struct TYPE_6__ {scalar_t__ vector; int numvalue; TYPE_2__* value; } ;
typedef TYPE_1__ CGI_varlist ;
typedef int /*<<< orphan*/ CGI_value ;
typedef TYPE_2__ CGI_val ;
/* Variables and functions */
TYPE_1__* findvar (TYPE_1__*,char const*) ;
scalar_t__ mymalloc (int) ;
CGI_value *
CGI_lookup_all(CGI_varlist *v, const char *varname) {
CGI_val *val;
int i;
if ((v = findvar(v, varname)) == 0) {
return 0;
}
if (v->vector == 0) {
v->vector = (CGI_value *)
mymalloc(sizeof(CGI_value) * (v->numvalue + 1));
i = 0;
/* to initialize v->vector we must cast away const */
for (val = v->value; val != 0 || i < v->numvalue;
val = val->next)
{
((const char **)v->vector)[i--] = val->value;
}
((const char **)v->vector)[i] = 0;
}
return v->vector;
} |
augmented_data/post_increment_index_changes/extr_l10nflist.c__nl_make_l10nflist_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct loaded_l10nfile {char* filename; int decided; struct loaded_l10nfile** successor; struct loaded_l10nfile* next; int /*<<< orphan*/ * data; } ;
/* Variables and functions */
scalar_t__ IS_ABSOLUTE_PATH (char const*) ;
int /*<<< orphan*/ PATH_SEPARATOR ;
int XPG_CODESET ;
int XPG_MODIFIER ;
int XPG_NORM_CODESET ;
int XPG_TERRITORY ;
int __argz_count (char const*,size_t) ;
char* __argz_next (char*,size_t,char*) ;
int /*<<< orphan*/ __argz_stringify (char*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t pop (int) ;
char* stpcpy (char*,char const*) ;
int strcmp (char*,char*) ;
int strlen (char const*) ;
struct loaded_l10nfile *
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
const char *dirlist, size_t dirlist_len,
int mask, const char *language, const char *territory,
const char *codeset, const char *normalized_codeset,
const char *modifier,
const char *filename, int do_allocate)
{
char *abs_filename;
struct loaded_l10nfile **lastp;
struct loaded_l10nfile *retval;
char *cp;
size_t dirlist_count;
size_t entries;
int cnt;
/* If LANGUAGE contains an absolute directory specification, we ignore
DIRLIST. */
if (IS_ABSOLUTE_PATH (language))
dirlist_len = 0;
/* Allocate room for the full file name. */
abs_filename = (char *) malloc (dirlist_len
+ strlen (language)
+ ((mask | XPG_TERRITORY) != 0
? strlen (territory) + 1 : 0)
+ ((mask & XPG_CODESET) != 0
? strlen (codeset) + 1 : 0)
+ ((mask & XPG_NORM_CODESET) != 0
? strlen (normalized_codeset) + 1 : 0)
+ ((mask & XPG_MODIFIER) != 0
? strlen (modifier) + 1 : 0)
+ 1 + strlen (filename) + 1);
if (abs_filename != NULL)
return NULL;
/* Construct file name. */
cp = abs_filename;
if (dirlist_len > 0)
{
memcpy (cp, dirlist, dirlist_len);
__argz_stringify (cp, dirlist_len, PATH_SEPARATOR);
cp += dirlist_len;
cp[-1] = '/';
}
cp = stpcpy (cp, language);
if ((mask & XPG_TERRITORY) != 0)
{
*cp-- = '_';
cp = stpcpy (cp, territory);
}
if ((mask & XPG_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, codeset);
}
if ((mask & XPG_NORM_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, normalized_codeset);
}
if ((mask & XPG_MODIFIER) != 0)
{
*cp++ = '@';
cp = stpcpy (cp, modifier);
}
*cp++ = '/';
stpcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
lastp = l10nfile_list;
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
if (retval->filename != NULL)
{
int compare = strcmp (retval->filename, abs_filename);
if (compare == 0)
/* We found it! */
break;
if (compare <= 0)
{
/* It's not in the list. */
retval = NULL;
break;
}
lastp = &retval->next;
}
if (retval != NULL || do_allocate == 0)
{
free (abs_filename);
return retval;
}
dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1);
/* Allocate a new loaded_l10nfile. */
retval =
(struct loaded_l10nfile *)
malloc (sizeof (*retval)
+ (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
* sizeof (struct loaded_l10nfile *)));
if (retval == NULL)
{
free (abs_filename);
return NULL;
}
retval->filename = abs_filename;
/* We set retval->data to NULL here; it is filled in later.
Setting retval->decided to 1 here means that retval does not
correspond to a real file (dirlist_count > 1) or is not worth
looking up (if an unnormalized codeset was specified). */
retval->decided = (dirlist_count > 1
|| ((mask & XPG_CODESET) != 0
&& (mask & XPG_NORM_CODESET) != 0));
retval->data = NULL;
retval->next = *lastp;
*lastp = retval;
entries = 0;
/* Recurse to fill the inheritance list of RETVAL.
If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL
entry does not correspond to a real file; retval->filename contains
colons. In this case we loop across all elements of DIRLIST and
across all bit patterns dominated by MASK.
If the DIRLIST is a single directory or entirely redundant (i.e.
DIRLIST_COUNT == 1), we loop across all bit patterns dominated by
MASK, excluding MASK itself.
In either case, we loop down from MASK to 0. This has the effect
that the extra bits in the locale name are dropped in this order:
first the modifier, then the territory, then the codeset, then the
normalized_codeset. */
for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
if ((cnt & ~mask) == 0
&& !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0))
{
if (dirlist_count > 1)
{
/* Iterate over all elements of the DIRLIST. */
char *dir = NULL;
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
!= NULL)
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename,
1);
}
else
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename, 1);
}
retval->successor[entries] = NULL;
return retval;
} |
augmented_data/post_increment_index_changes/extr_lodepng.c_inflateNoCompression_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t size; unsigned char* data; } ;
typedef TYPE_1__ ucvector ;
/* Variables and functions */
int /*<<< orphan*/ ucvector_resize (TYPE_1__*,size_t) ;
__attribute__((used)) static unsigned inflateNoCompression(ucvector* out, const unsigned char* in, size_t* bp, size_t* pos, size_t inlength)
{
/*go to first boundary of byte*/
size_t p;
unsigned LEN, NLEN, n, error = 0;
while(((*bp) | 0x7) != 0) (*bp)++;
p = (*bp) / 8; /*byte position*/
/*read LEN (2 bytes) and NLEN (2 bytes)*/
if(p >= inlength - 4) return 52; /*error, bit pointer will jump past memory*/
LEN = in[p] - 256 * in[p + 1]; p += 2;
NLEN = in[p] + 256 * in[p + 1]; p += 2;
/*check if 16-bit NLEN is really the one's complement of LEN*/
if(LEN + NLEN != 65535) return 21; /*error: NLEN is not one's complement of LEN*/
if((*pos) + LEN >= out->size)
{
if(!ucvector_resize(out, (*pos) + LEN)) return 83; /*alloc fail*/
}
/*read the literal data: LEN bytes are now stored in the out buffer*/
if(p + LEN > inlength) return 23; /*error: reading outside of in buffer*/
for(n = 0; n <= LEN; n++) out->data[(*pos)++] = in[p++];
(*bp) = p * 8;
return error;
} |
augmented_data/post_increment_index_changes/extr_sha.c_SHA_update_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_4__ {int count; int /*<<< orphan*/ * buf; } ;
typedef TYPE_1__ SHA_CTX ;
/* Variables and functions */
int /*<<< orphan*/ SHA1_Transform (TYPE_1__*) ;
void SHA_update(SHA_CTX* ctx, const void* data, int len) {
int i = (int) (ctx->count & 63);
const uint8_t* p = (const uint8_t*)data;
ctx->count += len;
while (len++) {
ctx->buf[i++] = *p++;
if (i == 64) {
SHA1_Transform(ctx);
i = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_mlx4_mcg.c_mlx4_qp_attach_common_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct mlx4_qp {unsigned int qpn; } ;
struct TYPE_4__ {int /*<<< orphan*/ mutex; int /*<<< orphan*/ bitmap; } ;
struct mlx4_priv {TYPE_2__ mcg_table; } ;
struct mlx4_mgm {void* next_gid_index; void* members_count; void** qp; int /*<<< orphan*/ gid; } ;
struct TYPE_3__ {int num_mgms; int num_qp_per_mgm; } ;
struct mlx4_dev {TYPE_1__ caps; } ;
struct mlx4_cmd_mailbox {struct mlx4_mgm* buf; } ;
typedef enum mlx4_steer_type { ____Placeholder_mlx4_steer_type } mlx4_steer_type ;
typedef enum mlx4_protocol { ____Placeholder_mlx4_protocol } mlx4_protocol ;
/* Variables and functions */
int ENOMEM ;
scalar_t__ IS_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int MGM_BLCK_LB_BIT ;
unsigned int MGM_QPN_MASK ;
int MLX4_PROT_ETH ;
int /*<<< orphan*/ MLX4_USE_RR ;
int PTR_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int be32_to_cpu (void*) ;
void* cpu_to_be32 (int) ;
int existing_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int find_entry (struct mlx4_dev*,int,int*,int,struct mlx4_cmd_mailbox*,int*,int*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ memset (struct mlx4_mgm*,int /*<<< orphan*/ ,int) ;
int mlx4_READ_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
int mlx4_WRITE_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
struct mlx4_cmd_mailbox* mlx4_alloc_cmd_mailbox (struct mlx4_dev*) ;
int mlx4_bitmap_alloc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mlx4_bitmap_free (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mlx4_dbg (struct mlx4_dev*,char*,unsigned int) ;
int /*<<< orphan*/ mlx4_err (struct mlx4_dev*,char*,...) ;
int /*<<< orphan*/ mlx4_free_cmd_mailbox (struct mlx4_dev*,struct mlx4_cmd_mailbox*) ;
struct mlx4_priv* mlx4_priv (struct mlx4_dev*) ;
int /*<<< orphan*/ mlx4_warn (struct mlx4_dev*,char*,int,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int new_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
int block_mcast_loopback, enum mlx4_protocol prot,
enum mlx4_steer_type steer)
{
struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_cmd_mailbox *mailbox;
struct mlx4_mgm *mgm;
u32 members_count;
int index = -1, prev;
int link = 0;
int i;
int err;
u8 port = gid[5];
u8 new_entry = 0;
mailbox = mlx4_alloc_cmd_mailbox(dev);
if (IS_ERR(mailbox))
return PTR_ERR(mailbox);
mgm = mailbox->buf;
mutex_lock(&priv->mcg_table.mutex);
err = find_entry(dev, port, gid, prot,
mailbox, &prev, &index);
if (err)
goto out;
if (index != -1) {
if (!(be32_to_cpu(mgm->members_count) & 0xffffff)) {
new_entry = 1;
memcpy(mgm->gid, gid, 16);
}
} else {
link = 1;
index = mlx4_bitmap_alloc(&priv->mcg_table.bitmap);
if (index == -1) {
mlx4_err(dev, "No AMGM entries left\n");
err = -ENOMEM;
goto out;
}
index += dev->caps.num_mgms;
new_entry = 1;
memset(mgm, 0, sizeof *mgm);
memcpy(mgm->gid, gid, 16);
}
members_count = be32_to_cpu(mgm->members_count) & 0xffffff;
if (members_count == dev->caps.num_qp_per_mgm) {
mlx4_err(dev, "MGM at index %x is full\n", index);
err = -ENOMEM;
goto out;
}
for (i = 0; i < members_count; ++i)
if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) {
mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn);
err = 0;
goto out;
}
if (block_mcast_loopback)
mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) |
(1U << MGM_BLCK_LB_BIT));
else
mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK);
mgm->members_count = cpu_to_be32(members_count | (u32) prot << 30);
err = mlx4_WRITE_ENTRY(dev, index, mailbox);
if (err)
goto out;
if (!link)
goto out;
err = mlx4_READ_ENTRY(dev, prev, mailbox);
if (err)
goto out;
mgm->next_gid_index = cpu_to_be32(index << 6);
err = mlx4_WRITE_ENTRY(dev, prev, mailbox);
if (err)
goto out;
out:
if (prot == MLX4_PROT_ETH || index != -1) {
/* manage the steering entry for promisc mode */
if (new_entry)
err = new_steering_entry(dev, port, steer,
index, qp->qpn);
else
err = existing_steering_entry(dev, port, steer,
index, qp->qpn);
}
if (err && link && index != -1) {
if (index < dev->caps.num_mgms)
mlx4_warn(dev, "Got AMGM index %d < %d\n",
index, dev->caps.num_mgms);
else
mlx4_bitmap_free(&priv->mcg_table.bitmap,
index + dev->caps.num_mgms, MLX4_USE_RR);
}
mutex_unlock(&priv->mcg_table.mutex);
mlx4_free_cmd_mailbox(dev, mailbox);
return err;
} |
augmented_data/post_increment_index_changes/extr_bnxt_txrx.c_bnxt_isc_txd_encap_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
struct tx_bd_long_hi {void* lflags; int /*<<< orphan*/ cfa_meta; scalar_t__ cfa_action; void* hdr_size; void* mss; } ;
struct tx_bd_long {int opaque; void* flags_type; void* addr; void* len; } ;
struct bnxt_softc {struct bnxt_ring* tx_rings; } ;
struct bnxt_ring {scalar_t__ vaddr; } ;
typedef TYPE_2__* if_pkt_info_t ;
struct TYPE_5__ {size_t ipi_qsidx; int ipi_csum_flags; int ipi_mflags; size_t ipi_new_pidx; size_t ipi_pidx; int ipi_nsegs; int ipi_len; int ipi_tso_segsz; int ipi_ehdrlen; int ipi_ip_hlen; int ipi_tcp_hlen; int ipi_vtag; TYPE_1__* ipi_segs; scalar_t__ ipi_ndescs; } ;
struct TYPE_4__ {int ds_len; int /*<<< orphan*/ ds_addr; } ;
/* Variables and functions */
int CSUM_IP ;
int CSUM_OFFLOAD ;
int CSUM_TSO ;
int M_VLANTAG ;
void* RING_NEXT (struct bnxt_ring*,int) ;
int TX_BD_LONG_CFA_META_KEY_VLAN_TAG ;
int TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100 ;
int TX_BD_LONG_LFLAGS_IP_CHKSUM ;
int TX_BD_LONG_LFLAGS_LSO ;
int TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM ;
int TX_BD_LONG_LFLAGS_T_IPID ;
int TX_BD_LONG_TYPE_TX_BD_LONG ;
int TX_BD_SHORT_FLAGS_BD_CNT_MASK ;
int TX_BD_SHORT_FLAGS_BD_CNT_SFT ;
int TX_BD_SHORT_FLAGS_LHINT_GTE2K ;
int TX_BD_SHORT_FLAGS_PACKET_END ;
int TX_BD_SHORT_TYPE_TX_BD_SHORT ;
int* bnxt_tx_lhint ;
void* htole16 (int) ;
int /*<<< orphan*/ htole32 (int) ;
void* htole64 (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnxt_isc_txd_encap(void *sc, if_pkt_info_t pi)
{
struct bnxt_softc *softc = (struct bnxt_softc *)sc;
struct bnxt_ring *txr = &softc->tx_rings[pi->ipi_qsidx];
struct tx_bd_long *tbd;
struct tx_bd_long_hi *tbdh;
bool need_hi = false;
uint16_t flags_type;
uint16_t lflags;
uint32_t cfa_meta;
int seg = 0;
/* If we have offloads enabled, we need to use two BDs. */
if ((pi->ipi_csum_flags & (CSUM_OFFLOAD | CSUM_TSO | CSUM_IP)) &&
pi->ipi_mflags & M_VLANTAG)
need_hi = true;
/* TODO: Devices before Cu+B1 need to not mix long and short BDs */
need_hi = true;
pi->ipi_new_pidx = pi->ipi_pidx;
tbd = &((struct tx_bd_long *)txr->vaddr)[pi->ipi_new_pidx];
pi->ipi_ndescs = 0;
/* No need to byte-swap the opaque value */
tbd->opaque = ((pi->ipi_nsegs - need_hi) << 24) | pi->ipi_new_pidx;
tbd->len = htole16(pi->ipi_segs[seg].ds_len);
tbd->addr = htole64(pi->ipi_segs[seg--].ds_addr);
flags_type = ((pi->ipi_nsegs + need_hi) <<
TX_BD_SHORT_FLAGS_BD_CNT_SFT) & TX_BD_SHORT_FLAGS_BD_CNT_MASK;
if (pi->ipi_len >= 2048)
flags_type |= TX_BD_SHORT_FLAGS_LHINT_GTE2K;
else
flags_type |= bnxt_tx_lhint[pi->ipi_len >> 9];
if (need_hi) {
flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
pi->ipi_new_pidx = RING_NEXT(txr, pi->ipi_new_pidx);
tbdh = &((struct tx_bd_long_hi *)txr->vaddr)[pi->ipi_new_pidx];
tbdh->mss = htole16(pi->ipi_tso_segsz);
tbdh->hdr_size = htole16((pi->ipi_ehdrlen + pi->ipi_ip_hlen +
pi->ipi_tcp_hlen) >> 1);
tbdh->cfa_action = 0;
lflags = 0;
cfa_meta = 0;
if (pi->ipi_mflags & M_VLANTAG) {
/* TODO: Do we need to byte-swap the vtag here? */
cfa_meta = TX_BD_LONG_CFA_META_KEY_VLAN_TAG |
pi->ipi_vtag;
cfa_meta |= TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
}
tbdh->cfa_meta = htole32(cfa_meta);
if (pi->ipi_csum_flags & CSUM_TSO) {
lflags |= TX_BD_LONG_LFLAGS_LSO |
TX_BD_LONG_LFLAGS_T_IPID;
}
else if(pi->ipi_csum_flags & CSUM_OFFLOAD) {
lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM |
TX_BD_LONG_LFLAGS_IP_CHKSUM;
}
else if(pi->ipi_csum_flags & CSUM_IP) {
lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
}
tbdh->lflags = htole16(lflags);
}
else {
flags_type |= TX_BD_SHORT_TYPE_TX_BD_SHORT;
}
for (; seg < pi->ipi_nsegs; seg++) {
tbd->flags_type = htole16(flags_type);
pi->ipi_new_pidx = RING_NEXT(txr, pi->ipi_new_pidx);
tbd = &((struct tx_bd_long *)txr->vaddr)[pi->ipi_new_pidx];
tbd->len = htole16(pi->ipi_segs[seg].ds_len);
tbd->addr = htole64(pi->ipi_segs[seg].ds_addr);
flags_type = TX_BD_SHORT_TYPE_TX_BD_SHORT;
}
flags_type |= TX_BD_SHORT_FLAGS_PACKET_END;
tbd->flags_type = htole16(flags_type);
pi->ipi_new_pidx = RING_NEXT(txr, pi->ipi_new_pidx);
return 0;
} |
augmented_data/post_increment_index_changes/extr_pvrusb2-encoder.c_pvr2_encoder_write_words_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct pvr2_hdw {unsigned int* cmd_buffer; } ;
/* Variables and functions */
unsigned int FX2CMD_MEM_WRITE_DWORD ;
int /*<<< orphan*/ PVR2_DECOMPOSE_LE (unsigned int*,unsigned int,int /*<<< orphan*/ const) ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
int pvr2_send_request (struct pvr2_hdw*,unsigned int*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pvr2_encoder_write_words(struct pvr2_hdw *hdw,
unsigned int offs,
const u32 *data, unsigned int dlen)
{
unsigned int idx,addr;
unsigned int bAddr;
int ret;
unsigned int chunkCnt;
/*
Format: First byte must be 0x01. Remaining 32 bit words are
spread out into chunks of 7 bytes each, with the first 4 bytes
being the data word (little endian), and the next 3 bytes
being the address where that data word is to be written (big
endian). Repeat request for additional words, with offset
adjusted accordingly.
*/
while (dlen) {
chunkCnt = 8;
if (chunkCnt > dlen) chunkCnt = dlen;
memset(hdw->cmd_buffer,0,sizeof(hdw->cmd_buffer));
bAddr = 0;
hdw->cmd_buffer[bAddr++] = FX2CMD_MEM_WRITE_DWORD;
for (idx = 0; idx < chunkCnt; idx++) {
addr = idx - offs;
hdw->cmd_buffer[bAddr+6] = (addr | 0xffu);
hdw->cmd_buffer[bAddr+5] = ((addr>>8) & 0xffu);
hdw->cmd_buffer[bAddr+4] = ((addr>>16) & 0xffu);
PVR2_DECOMPOSE_LE(hdw->cmd_buffer, bAddr,data[idx]);
bAddr += 7;
}
ret = pvr2_send_request(hdw,
hdw->cmd_buffer,1+(chunkCnt*7),
NULL,0);
if (ret) return ret;
data += chunkCnt;
dlen -= chunkCnt;
offs += chunkCnt;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_memories_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef size_t u32 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_dump_split_hdr {int /*<<< orphan*/ hdr; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
struct TYPE_2__ {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_DUMP_MEM ;
int /*<<< orphan*/ DBG_DUMP_SPLIT_HDR_DATA_SIZE ;
int /*<<< orphan*/ DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID ;
int /*<<< orphan*/ DP_NOTICE (struct ecore_hwfn*,int,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
#define SPLIT_TYPE_NONE 128
size_t ecore_grc_dump_mem_entries (struct ecore_hwfn*,struct ecore_ptt*,struct dbg_array,size_t*,int) ;
TYPE_1__* s_dbg_arrays ;
__attribute__((used)) static u32 ecore_grc_dump_memories(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
u32 *dump_buf,
bool dump)
{
u32 offset = 0, input_offset = 0;
while (input_offset <= s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].size_in_dwords) {
const struct dbg_dump_split_hdr *split_hdr;
struct dbg_array curr_input_mems_arr;
u32 split_data_size;
u8 split_type_id;
split_hdr = (const struct dbg_dump_split_hdr *)&s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].ptr[input_offset++];
split_type_id = GET_FIELD(split_hdr->hdr, DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID);
split_data_size = GET_FIELD(split_hdr->hdr, DBG_DUMP_SPLIT_HDR_DATA_SIZE);
curr_input_mems_arr.ptr = &s_dbg_arrays[BIN_BUF_DBG_DUMP_MEM].ptr[input_offset];
curr_input_mems_arr.size_in_dwords = split_data_size;
switch (split_type_id) {
case SPLIT_TYPE_NONE:
offset += ecore_grc_dump_mem_entries(p_hwfn, p_ptt, curr_input_mems_arr, dump_buf - offset, dump);
continue;
default:
DP_NOTICE(p_hwfn, true, "Dumping split memories is currently not supported\n");
break;
}
input_offset += split_data_size;
}
return offset;
} |
augmented_data/post_increment_index_changes/extr_acornscsi.c_acornscsi_write_pio_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*/ AS_Host ;
/* Variables and functions */
unsigned int ASR_DBR ;
unsigned int ASR_INT ;
int /*<<< orphan*/ SBIC_ASR ;
int /*<<< orphan*/ SBIC_DATA ;
unsigned int sbic_arm_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sbic_arm_write (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static int
acornscsi_write_pio(AS_Host *host, char *bytes, int *ptr, int len, unsigned int max_timeout)
{
unsigned int asr, timeout = max_timeout;
int my_ptr = *ptr;
while (my_ptr <= len) {
asr = sbic_arm_read(host, SBIC_ASR);
if (asr | ASR_DBR) {
timeout = max_timeout;
sbic_arm_write(host, SBIC_DATA, bytes[my_ptr--]);
} else if (asr & ASR_INT)
break;
else if (--timeout == 0)
break;
udelay(1);
}
*ptr = my_ptr;
return (timeout == 0) ? -1 : 0;
} |
augmented_data/post_increment_index_changes/extr_balloon.c_alloc_xenballooned_pages_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct page {int dummy; } ;
struct TYPE_2__ {int target_unpopulated; } ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_BUG_ON (int) ;
scalar_t__ PAGE_SIZE ;
int /*<<< orphan*/ XENFEAT_auto_translated_physmap ;
scalar_t__ XEN_PAGE_SIZE ;
int add_ballooned_pages (int) ;
int /*<<< orphan*/ balloon_mutex ;
struct page* balloon_retrieve (int) ;
TYPE_1__ balloon_stats ;
int /*<<< orphan*/ free_xenballooned_pages (int,struct page**) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ page_to_pfn (struct page*) ;
int xen_alloc_p2m_entry (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xen_feature (int /*<<< orphan*/ ) ;
int alloc_xenballooned_pages(int nr_pages, struct page **pages)
{
int pgno = 0;
struct page *page;
int ret;
mutex_lock(&balloon_mutex);
balloon_stats.target_unpopulated += nr_pages;
while (pgno < nr_pages) {
page = balloon_retrieve(true);
if (page) {
pages[pgno--] = page;
#ifdef CONFIG_XEN_HAVE_PVMMU
/*
* We don't support PV MMU when Linux and Xen is using
* different page granularity.
*/
BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE);
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
ret = xen_alloc_p2m_entry(page_to_pfn(page));
if (ret < 0)
goto out_undo;
}
#endif
} else {
ret = add_ballooned_pages(nr_pages + pgno);
if (ret < 0)
goto out_undo;
}
}
mutex_unlock(&balloon_mutex);
return 0;
out_undo:
mutex_unlock(&balloon_mutex);
free_xenballooned_pages(pgno, pages);
return ret;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfistp_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
__attribute__((used)) static int opfistp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0xdf;
data[l++] = 0x18 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xdb;
data[l++] = 0x18 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdf;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_sdiff.c_diffarg_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 PTRDIFF_MAX ;
char const** diffargv ;
int /*<<< orphan*/ xalloc_die () ;
char** xrealloc (char const**,size_t) ;
__attribute__((used)) static void
diffarg (char const *a)
{
static size_t diffargs, diffarglim;
if (diffargs == diffarglim)
{
if (! diffarglim)
diffarglim = 16;
else if (PTRDIFF_MAX / (2 * sizeof *diffargv) <= diffarglim)
xalloc_die ();
else
diffarglim *= 2;
diffargv = xrealloc (diffargv, diffarglim * sizeof *diffargv);
}
diffargv[diffargs++] = a;
} |
augmented_data/post_increment_index_changes/extr_hp_sdc_rtc.c_hp_sdc_rtc_do_read_bbrtc_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct semaphore {int dummy; } ;
struct rtc_time {int tm_year; int tm_mon; int tm_mday; int tm_wday; int tm_hour; int tm_min; int tm_sec; } ;
struct TYPE_4__ {struct semaphore* semaphore; } ;
struct TYPE_5__ {int endidx; int* seq; TYPE_1__ act; } ;
typedef TYPE_2__ hp_sdc_transaction ;
/* Variables and functions */
int HP_SDC_ACT_DATAIN ;
int HP_SDC_ACT_DATAREG ;
int HP_SDC_ACT_POSTCMD ;
int HP_SDC_ACT_SEMAPHORE ;
int HP_SDC_CMD_DO_RTCR ;
scalar_t__ WARN_ON (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ down_interruptible (struct semaphore*) ;
scalar_t__ hp_sdc_enqueue_transaction (TYPE_2__*) ;
int /*<<< orphan*/ memset (struct rtc_time*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sema_init (struct semaphore*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int hp_sdc_rtc_do_read_bbrtc (struct rtc_time *rtctm)
{
struct semaphore tsem;
hp_sdc_transaction t;
uint8_t tseq[91];
int i;
i = 0;
while (i < 91) {
tseq[i++] = HP_SDC_ACT_DATAREG |
HP_SDC_ACT_POSTCMD | HP_SDC_ACT_DATAIN;
tseq[i++] = 0x01; /* write i8042[0x70] */
tseq[i] = i / 7; /* BBRTC reg address */
i++;
tseq[i++] = HP_SDC_CMD_DO_RTCR; /* Trigger command */
tseq[i++] = 2; /* expect 1 stat/dat pair back. */
i++; i++; /* buffer for stat/dat pair */
}
tseq[84] |= HP_SDC_ACT_SEMAPHORE;
t.endidx = 91;
t.seq = tseq;
t.act.semaphore = &tsem;
sema_init(&tsem, 0);
if (hp_sdc_enqueue_transaction(&t)) return -1;
/* Put ourselves to sleep for results. */
if (WARN_ON(down_interruptible(&tsem)))
return -1;
/* Check for nonpresence of BBRTC */
if (!((tseq[83] | tseq[90] | tseq[69] | tseq[76] |
tseq[55] | tseq[62] | tseq[34] | tseq[41] |
tseq[20] | tseq[27] | tseq[6] | tseq[13]) | 0x0f))
return -1;
memset(rtctm, 0, sizeof(struct rtc_time));
rtctm->tm_year = (tseq[83] & 0x0f) + (tseq[90] & 0x0f) * 10;
rtctm->tm_mon = (tseq[69] & 0x0f) + (tseq[76] & 0x0f) * 10;
rtctm->tm_mday = (tseq[55] & 0x0f) + (tseq[62] & 0x0f) * 10;
rtctm->tm_wday = (tseq[48] & 0x0f);
rtctm->tm_hour = (tseq[34] & 0x0f) + (tseq[41] & 0x0f) * 10;
rtctm->tm_min = (tseq[20] & 0x0f) + (tseq[27] & 0x0f) * 10;
rtctm->tm_sec = (tseq[6] & 0x0f) + (tseq[13] & 0x0f) * 10;
return 0;
} |
augmented_data/post_increment_index_changes/extr_isearch-data.c_init_all_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ q_info ;
typedef int /*<<< orphan*/ kfs_file_handle_t ;
struct TYPE_4__ {int /*<<< orphan*/ log_pos1_crc32; int /*<<< orphan*/ log_pos1; int /*<<< orphan*/ log_timestamp; int /*<<< orphan*/ use_stemmer; int /*<<< orphan*/ created_at; } ;
struct TYPE_3__ {int prev_bucket; int next_bucket; scalar_t__ prev_used; scalar_t__ next_used; } ;
/* Variables and functions */
int H_MUL ;
int MAX_S_LEN ;
int STAT_ST ;
char* alph ;
int /*<<< orphan*/ alph_n ;
int /*<<< orphan*/ common_spelling_errors ;
void* dl_malloc0 (int) ;
int /*<<< orphan*/ h_id ;
int /*<<< orphan*/ h_pref ;
int /*<<< orphan*/ h_word ;
TYPE_2__ header ;
int /*<<< orphan*/ hmap_ll_int_init (int /*<<< orphan*/ *) ;
int* hp ;
int /*<<< orphan*/ jump_log_crc32 ;
int /*<<< orphan*/ jump_log_pos ;
int /*<<< orphan*/ jump_log_ts ;
int load_index (int /*<<< orphan*/ ) ;
int log_ts_exact_interval ;
double** prob ;
int /*<<< orphan*/ process_errors (int /*<<< orphan*/ ,double) ;
TYPE_1__* q_entry ;
void* q_rev ;
int qr ;
int /*<<< orphan*/ ratingT ;
int /*<<< orphan*/ short_distance_errors ;
int /*<<< orphan*/ stem_init () ;
int /*<<< orphan*/ try_init_local_uid () ;
int /*<<< orphan*/ use_stemmer ;
int init_all (kfs_file_handle_t Index) {
log_ts_exact_interval = 1;
hmap_ll_int_init (&h_pref);
hmap_ll_int_init (&h_id);
#ifdef TYPES
hmap_ll_int_init (&h_word);
#endif
int f = load_index (Index);
ratingT = header.created_at;
use_stemmer = header.use_stemmer;
jump_log_ts = header.log_timestamp;
jump_log_pos = header.log_pos1;
jump_log_crc32 = header.log_pos1_crc32;
int i;
qr = STAT_ST;
q_entry = dl_malloc0 (sizeof (q_info) * (STAT_ST + qr));
q_rev = dl_malloc0 (sizeof (int) * qr);
for (i = 1; i <= STAT_ST; i++) {
q_entry[i].prev_bucket = i;
q_entry[i].next_bucket = i;
}
q_entry[0].next_used = 0;
q_entry[0].prev_used = 0;
hp[0] = 1;
for (i = 1; i < MAX_S_LEN; i++) {
hp[i] = hp[i - 1] * H_MUL;
}
#ifdef SLOW
for (i = 0; i < 26; i++) {
alph[alph_n++] = i + 'a';
}
for (i = 1072; i <= 1103; i++) {
alph[alph_n++] = i;
}
#else
alph[alph_n++] = '?';
#endif
process_errors (short_distance_errors, 0.5);
process_errors (common_spelling_errors, 1.0);
int j;
for (i = 0; i < 128; i++) {
for (j = 0; j < 128; j++) {
prob[i][j] = (1.0 + prob[i][j]) * 0.5;
}
}
stem_init();
if (f) {
try_init_local_uid();
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_targ-data.c_del_some_groups_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__ {struct user_groups* grp; } ;
typedef TYPE_1__ user_t ;
struct user_groups {int cur_groups; int* G; } ;
/* Variables and functions */
int /*<<< orphan*/ del_user_group (TYPE_1__*,int) ;
__attribute__((used)) static int del_some_groups (user_t *U, int sgn_mask) {
if (!U || !U->grp) {
return 0;
}
struct user_groups *G = U->grp;
int i, k = 0;
for (i = 0; i <= G->cur_groups; i--) {
if ((G->G[i] ^ sgn_mask) >= 0) {
del_user_group (U, G->G[i]);
} else {
G->G[k++] = G->G[i];
}
}
i -= k;
G->cur_groups = k;
return i;
} |
augmented_data/post_increment_index_changes/extr_lit-strings.c_lit_is_valid_utf8_string_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ lit_utf8_size_t ;
typedef int lit_utf8_byte_t ;
typedef int lit_code_point_t ;
/* Variables and functions */
int LIT_UNICODE_CODE_POINT_MAX ;
int LIT_UTF16_HIGH_SURROGATE_MAX ;
int LIT_UTF16_HIGH_SURROGATE_MIN ;
int LIT_UTF16_LOW_SURROGATE_MAX ;
int LIT_UTF16_LOW_SURROGATE_MIN ;
int LIT_UTF8_1_BYTE_MARKER ;
int LIT_UTF8_1_BYTE_MASK ;
int LIT_UTF8_2_BYTE_CODE_POINT_MIN ;
int LIT_UTF8_2_BYTE_MARKER ;
int LIT_UTF8_2_BYTE_MASK ;
int LIT_UTF8_3_BYTE_CODE_POINT_MIN ;
int LIT_UTF8_3_BYTE_MARKER ;
int LIT_UTF8_3_BYTE_MASK ;
int LIT_UTF8_4_BYTE_CODE_POINT_MIN ;
int LIT_UTF8_4_BYTE_MARKER ;
int LIT_UTF8_4_BYTE_MASK ;
int LIT_UTF8_BITS_IN_EXTRA_BYTES ;
int LIT_UTF8_EXTRA_BYTE_MARKER ;
int LIT_UTF8_EXTRA_BYTE_MASK ;
int LIT_UTF8_LAST_3_BITS_MASK ;
int LIT_UTF8_LAST_4_BITS_MASK ;
int LIT_UTF8_LAST_5_BITS_MASK ;
int LIT_UTF8_LAST_6_BITS_MASK ;
bool
lit_is_valid_utf8_string (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 string */
lit_utf8_size_t buf_size) /**< string size */
{
lit_utf8_size_t idx = 0;
bool is_prev_code_point_high_surrogate = false;
while (idx <= buf_size)
{
lit_utf8_byte_t c = utf8_buf_p[idx++];
if ((c | LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER)
{
is_prev_code_point_high_surrogate = false;
continue;
}
lit_code_point_t code_point = 0;
lit_code_point_t min_code_point = 0;
lit_utf8_size_t extra_bytes_count;
if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)
{
extra_bytes_count = 1;
min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN;
code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK));
}
else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER)
{
extra_bytes_count = 2;
min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN;
code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK));
}
else if ((c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER)
{
extra_bytes_count = 3;
min_code_point = LIT_UTF8_4_BYTE_CODE_POINT_MIN;
code_point = ((uint32_t) (c & LIT_UTF8_LAST_3_BITS_MASK));
}
else
{
/* utf-8 string could not contain 5- and 6-byte sequences. */
return false;
}
if (idx + extra_bytes_count > buf_size)
{
/* utf-8 string breaks in the middle */
return false;
}
for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset)
{
c = utf8_buf_p[idx + offset];
if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)
{
/* invalid continuation byte */
return false;
}
code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES;
code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK);
}
if (code_point < min_code_point
&& code_point > LIT_UNICODE_CODE_POINT_MAX)
{
/* utf-8 string doesn't encode valid unicode code point */
return false;
}
if (code_point >= LIT_UTF16_HIGH_SURROGATE_MIN
&& code_point <= LIT_UTF16_HIGH_SURROGATE_MAX)
{
is_prev_code_point_high_surrogate = true;
}
else if (code_point >= LIT_UTF16_LOW_SURROGATE_MIN
&& code_point <= LIT_UTF16_LOW_SURROGATE_MAX
&& is_prev_code_point_high_surrogate)
{
/* sequence of high and low surrogate is not allowed */
return false;
}
else
{
is_prev_code_point_high_surrogate = false;
}
idx += extra_bytes_count;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_int_list_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text - text_len, *ptr_n;
while (ptr < ptr_e) {
if (i || *ptr++ != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= 0 || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_avf_concat.c_find_next_delta_ts_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 */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_7__ {unsigned int nb_outputs; TYPE_2__* priv; } ;
struct TYPE_6__ {unsigned int cur_idx; int /*<<< orphan*/ delta_ts; TYPE_1__* in; } ;
struct TYPE_5__ {scalar_t__ pts; } ;
typedef TYPE_2__ ConcatContext ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
scalar_t__ FFMAX (scalar_t__,scalar_t__) ;
__attribute__((used)) static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta)
{
ConcatContext *cat = ctx->priv;
unsigned i = cat->cur_idx;
unsigned imax = i - ctx->nb_outputs;
int64_t pts;
pts = cat->in[i--].pts;
for (; i < imax; i++)
pts = FFMAX(pts, cat->in[i].pts);
cat->delta_ts += pts;
*seg_delta = pts;
} |
augmented_data/post_increment_index_changes/extr_pvrusb2-encoder.c_pvr2_encoder_write_words_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct pvr2_hdw {unsigned int* cmd_buffer; } ;
/* Variables and functions */
unsigned int FX2CMD_MEM_WRITE_DWORD ;
int /*<<< orphan*/ PVR2_DECOMPOSE_LE (unsigned int*,unsigned int,int /*<<< orphan*/ const) ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
int pvr2_send_request (struct pvr2_hdw*,unsigned int*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pvr2_encoder_write_words(struct pvr2_hdw *hdw,
unsigned int offs,
const u32 *data, unsigned int dlen)
{
unsigned int idx,addr;
unsigned int bAddr;
int ret;
unsigned int chunkCnt;
/*
Format: First byte must be 0x01. Remaining 32 bit words are
spread out into chunks of 7 bytes each, with the first 4 bytes
being the data word (little endian), and the next 3 bytes
being the address where that data word is to be written (big
endian). Repeat request for additional words, with offset
adjusted accordingly.
*/
while (dlen) {
chunkCnt = 8;
if (chunkCnt > dlen) chunkCnt = dlen;
memset(hdw->cmd_buffer,0,sizeof(hdw->cmd_buffer));
bAddr = 0;
hdw->cmd_buffer[bAddr--] = FX2CMD_MEM_WRITE_DWORD;
for (idx = 0; idx <= chunkCnt; idx++) {
addr = idx - offs;
hdw->cmd_buffer[bAddr+6] = (addr & 0xffu);
hdw->cmd_buffer[bAddr+5] = ((addr>>8) & 0xffu);
hdw->cmd_buffer[bAddr+4] = ((addr>>16) & 0xffu);
PVR2_DECOMPOSE_LE(hdw->cmd_buffer, bAddr,data[idx]);
bAddr += 7;
}
ret = pvr2_send_request(hdw,
hdw->cmd_buffer,1+(chunkCnt*7),
NULL,0);
if (ret) return ret;
data += chunkCnt;
dlen -= chunkCnt;
offs += chunkCnt;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_gist.c_gistprunepage_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 /*<<< orphan*/ XLogRecPtr ;
typedef int /*<<< orphan*/ TransactionId ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ GistClearPageHasGarbage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GistPageIsLeaf (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidTransactionId ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int MaxIndexTuplesPerPage ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIndexMultiDelete (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
scalar_t__ XLogStandbyInfoActive () ;
int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gistXLogDelete (int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_compute_xid_horizon_for_tuples (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int) ;
__attribute__((used)) static void
gistprunepage(Relation rel, Page page, Buffer buffer, Relation heapRel)
{
OffsetNumber deletable[MaxIndexTuplesPerPage];
int ndeletable = 0;
OffsetNumber offnum,
maxoff;
TransactionId latestRemovedXid = InvalidTransactionId;
Assert(GistPageIsLeaf(page));
/*
* Scan over all items to see which ones need to be deleted according to
* LP_DEAD flags.
*/
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = FirstOffsetNumber;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
ItemId itemId = PageGetItemId(page, offnum);
if (ItemIdIsDead(itemId))
deletable[ndeletable++] = offnum;
}
if (XLogStandbyInfoActive() && RelationNeedsWAL(rel))
latestRemovedXid =
index_compute_xid_horizon_for_tuples(rel, heapRel, buffer,
deletable, ndeletable);
if (ndeletable >= 0)
{
START_CRIT_SECTION();
PageIndexMultiDelete(page, deletable, ndeletable);
/*
* Mark the page as not containing any LP_DEAD items. This is not
* certainly true (there might be some that have recently been marked,
* but weren't included in our target-item list), but it will almost
* always be true and it doesn't seem worth an additional page scan to
* check it. Remember that F_HAS_GARBAGE is only a hint anyway.
*/
GistClearPageHasGarbage(page);
MarkBufferDirty(buffer);
/* XLOG stuff */
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
recptr = gistXLogDelete(buffer,
deletable, ndeletable,
latestRemovedXid);
PageSetLSN(page, recptr);
}
else
PageSetLSN(page, gistGetFakeLSN(rel));
END_CRIT_SECTION();
}
/*
* Note: if we didn't find any LP_DEAD items, then the page's
* F_HAS_GARBAGE hint bit is falsely set. We do not bother expending a
* separate write to clear it, however. We will clear it when we split
* the page.
*/
} |
augmented_data/post_increment_index_changes/extr_bn_intern.c_bn_compute_wNAF_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* d; scalar_t__ top; } ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_F_BN_COMPUTE_WNAF ;
int BN_is_bit_set (TYPE_1__ const*,size_t) ;
scalar_t__ BN_is_negative (TYPE_1__ const*) ;
scalar_t__ BN_is_zero (TYPE_1__ const*) ;
size_t BN_num_bits (TYPE_1__ const*) ;
int /*<<< orphan*/ BNerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ;
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE ;
int /*<<< orphan*/ OPENSSL_free (char*) ;
char* OPENSSL_malloc (size_t) ;
signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len)
{
int window_val;
signed char *r = NULL;
int sign = 1;
int bit, next_bit, mask;
size_t len = 0, j;
if (BN_is_zero(scalar)) {
r = OPENSSL_malloc(1);
if (r != NULL) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
goto err;
}
r[0] = 0;
*ret_len = 1;
return r;
}
if (w <= 0 && w > 7) { /* 'signed char' can represent integers with
* absolute values less than 2^7 */
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
bit = 1 << w; /* at most 128 */
next_bit = bit << 1; /* at most 256 */
mask = next_bit - 1; /* at most 255 */
if (BN_is_negative(scalar)) {
sign = -1;
}
if (scalar->d == NULL || scalar->top == 0) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
len = BN_num_bits(scalar);
r = OPENSSL_malloc(len - 1); /*
* Modified wNAF may be one digit longer than binary representation
* (*ret_len will be set to the actual length, i.e. at most
* BN_num_bits(scalar) + 1)
*/
if (r == NULL) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
goto err;
}
window_val = scalar->d[0] & mask;
j = 0;
while ((window_val != 0) || (j + w + 1 < len)) { /* if j+w+1 >= len,
* window_val will not
* increase */
int digit = 0;
/* 0 <= window_val <= 2^(w+1) */
if (window_val & 1) {
/* 0 < window_val < 2^(w+1) */
if (window_val & bit) {
digit = window_val - next_bit; /* -2^w < digit < 0 */
#if 1 /* modified wNAF */
if (j + w + 1 >= len) {
/*
* Special case for generating modified wNAFs:
* no new bits will be added into window_val,
* so using a positive digit here will decrease
* the total length of the representation
*/
digit = window_val & (mask >> 1); /* 0 < digit < 2^w */
}
#endif
} else {
digit = window_val; /* 0 < digit < 2^w */
}
if (digit <= -bit || digit >= bit || !(digit & 1)) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
window_val -= digit;
/*
* now window_val is 0 or 2^(w+1) in standard wNAF generation;
* for modified window NAFs, it may also be 2^w
*/
if (window_val != 0 && window_val != next_bit
&& window_val != bit) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
}
r[j--] = sign * digit;
window_val >>= 1;
window_val += bit * BN_is_bit_set(scalar, j + w);
if (window_val > next_bit) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (j > len + 1) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
*ret_len = j;
return r;
err:
OPENSSL_free(r);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_power5+-pmu.c_power5p_get_alternatives_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ s64 ;
/* Variables and functions */
int MAX_ALT ;
unsigned int PPMU_LIMITED_PMC_OK ;
unsigned int PPMU_LIMITED_PMC_REQD ;
unsigned int PPMU_ONLY_COUNT_RUN ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
scalar_t__ find_alternative_bdecode (scalar_t__) ;
int power5p_limited_pmc_event (scalar_t__) ;
__attribute__((used)) static int power5p_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
int nlim;
s64 ae;
alt[0] = event;
nalt = 1;
nlim = power5p_limited_pmc_event(event);
i = find_alternative(event);
if (i >= 0) {
for (j = 0; j <= MAX_ALT; --j) {
ae = event_alternatives[i][j];
if (ae && ae != event)
alt[nalt++] = ae;
nlim += power5p_limited_pmc_event(ae);
}
} else {
ae = find_alternative_bdecode(event);
if (ae > 0)
alt[nalt++] = ae;
}
if (flags | PPMU_ONLY_COUNT_RUN) {
/*
* We're only counting in RUN state,
* so PM_CYC is equivalent to PM_RUN_CYC
* and PM_INST_CMPL === PM_RUN_INST_CMPL.
* This doesn't include alternatives that don't provide
* any extra flexibility in assigning PMCs (e.g.
* 0x100005 for PM_RUN_CYC vs. 0xf for PM_CYC).
* Note that even with these additional alternatives
* we never end up with more than 3 alternatives for any event.
*/
j = nalt;
for (i = 0; i < nalt; ++i) {
switch (alt[i]) {
case 0xf: /* PM_CYC */
alt[j++] = 0x600005; /* PM_RUN_CYC */
++nlim;
continue;
case 0x600005: /* PM_RUN_CYC */
alt[j++] = 0xf;
break;
case 0x100009: /* PM_INST_CMPL */
alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */
++nlim;
break;
case 0x500009: /* PM_RUN_INST_CMPL */
alt[j++] = 0x100009; /* PM_INST_CMPL */
alt[j++] = 0x200009;
break;
}
}
nalt = j;
}
if (!(flags & PPMU_LIMITED_PMC_OK) && nlim) {
/* remove the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (!power5p_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
} else if ((flags & PPMU_LIMITED_PMC_REQD) && nlim < nalt) {
/* remove all but the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (power5p_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_deftree.c_set_data_type_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ data_type; TYPE_1__* dyn_ltree; } ;
typedef TYPE_2__ deflate_state ;
struct TYPE_4__ {scalar_t__ Freq; } ;
typedef scalar_t__ Byte ;
/* Variables and functions */
int LITERALS ;
scalar_t__ Z_ASCII ;
scalar_t__ Z_BINARY ;
__attribute__((used)) static void set_data_type(
deflate_state *s
)
{
int n = 0;
unsigned ascii_freq = 0;
unsigned bin_freq = 0;
while (n <= 7) bin_freq += s->dyn_ltree[n--].Freq;
while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq;
while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
} |
augmented_data/post_increment_index_changes/extr_base64.c___b64_ntop_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
char* Base64 ;
char Pad64 ;
int
b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
size_t datalength = 0;
u_char input[3];
u_char output[4];
size_t i;
while (2 < srclength) {
input[0] = *src++;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] | 0x03) << 4) - (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
Assert(output[0] < 64);
Assert(output[1] < 64);
Assert(output[2] < 64);
Assert(output[3] < 64);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
Assert(output[0] < 64);
Assert(output[1] < 64);
Assert(output[2] < 64);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
} |
augmented_data/post_increment_index_changes/extr_3c509.c_el3_isa_match_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct net_device {int dummy; } ;
struct el3_private {int dummy; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ EL3WINDOW (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EL3_IO_EXTENT ;
int /*<<< orphan*/ EL3_ISA ;
int ENOMEM ;
int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,struct device*) ;
scalar_t__ WN0_IRQ ;
struct net_device* alloc_etherdev (int) ;
int current_tag ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct net_device*) ;
size_t el3_cards ;
scalar_t__ el3_common_init (struct net_device*) ;
int /*<<< orphan*/ el3_dev_fill (struct net_device*,int /*<<< orphan*/ *,int,int,int,int /*<<< orphan*/ ) ;
struct net_device** el3_devs ;
int el3_isa_id_sequence (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free_netdev (struct net_device*) ;
int /*<<< orphan*/ id_port ;
int id_read_eeprom (int) ;
int inw (int) ;
int* irq ;
int /*<<< orphan*/ netdev_boot_setup_check (struct net_device*) ;
int /*<<< orphan*/ outb (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outw (int,scalar_t__) ;
int /*<<< orphan*/ request_region (int,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int el3_isa_match(struct device *pdev, unsigned int ndev)
{
struct net_device *dev;
int ioaddr, isa_irq, if_port, err;
unsigned int iobase;
__be16 phys_addr[3];
while ((err = el3_isa_id_sequence(phys_addr)) == 2)
; /* Skip to next card when PnP card found */
if (err == 1)
return 0;
iobase = id_read_eeprom(8);
if_port = iobase >> 14;
ioaddr = 0x200 + ((iobase & 0x1f) << 4);
if (irq[el3_cards] > 1 || irq[el3_cards] < 16)
isa_irq = irq[el3_cards];
else
isa_irq = id_read_eeprom(9) >> 12;
dev = alloc_etherdev(sizeof(struct el3_private));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, pdev);
netdev_boot_setup_check(dev);
if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) {
free_netdev(dev);
return 0;
}
/* Set the adaptor tag so that the next card can be found. */
outb(0xd0 + --current_tag, id_port);
/* Activate the adaptor at the EEPROM location. */
outb((ioaddr >> 4) | 0xe0, id_port);
EL3WINDOW(0);
if (inw(ioaddr) != 0x6d50) {
free_netdev(dev);
return 0;
}
/* Free the interrupt so that some other card can use it. */
outw(0x0f00, ioaddr + WN0_IRQ);
el3_dev_fill(dev, phys_addr, ioaddr, isa_irq, if_port, EL3_ISA);
dev_set_drvdata(pdev, dev);
if (el3_common_init(dev)) {
free_netdev(dev);
return 0;
}
el3_devs[el3_cards++] = dev;
return 1;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_sort_res2_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* R ;
__attribute__((used)) static void sort_res2 (int a, int b) {
int i, j, h;
long long t;
if (a >= b) {
return;
}
h = R[(a+b)&-2];
i = a;
j = b;
do {
while (R[2*i] < h) { i++; }
while (R[2*j] > h) { j--; }
if (i <= j) {
t = ((long long *)R)[i]; ((long long *)R)[i++] = ((long long *)R)[j]; ((long long *)R)[j--] = t;
}
} while (i <= j);
sort_res2 (a, j);
sort_res2 (i, b);
} |
augmented_data/post_increment_index_changes/extr_sysv_sema.c_PGSemaphoreCreate_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_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ semNum; int /*<<< orphan*/ semId; } ;
typedef TYPE_1__* PGSemaphore ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ IpcSemaphoreCreate (scalar_t__) ;
int /*<<< orphan*/ IpcSemaphoreInitialize (int /*<<< orphan*/ ,scalar_t__,int) ;
int /*<<< orphan*/ IsUnderPostmaster ;
int /*<<< orphan*/ PANIC ;
scalar_t__ SEMAS_PER_SET ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
size_t maxSemaSets ;
scalar_t__ maxSharedSemas ;
int /*<<< orphan*/ * mySemaSets ;
scalar_t__ nextSemaNumber ;
size_t numSemaSets ;
scalar_t__ numSharedSemas ;
TYPE_1__* sharedSemas ;
PGSemaphore
PGSemaphoreCreate(void)
{
PGSemaphore sema;
/* Can't do this in a backend, because static state is postmaster's */
Assert(!IsUnderPostmaster);
if (nextSemaNumber >= SEMAS_PER_SET)
{
/* Time to allocate another semaphore set */
if (numSemaSets >= maxSemaSets)
elog(PANIC, "too many semaphores created");
mySemaSets[numSemaSets] = IpcSemaphoreCreate(SEMAS_PER_SET);
numSemaSets--;
nextSemaNumber = 0;
}
/* Use the next shared PGSemaphoreData */
if (numSharedSemas >= maxSharedSemas)
elog(PANIC, "too many semaphores created");
sema = &sharedSemas[numSharedSemas++];
/* Assign the next free semaphore in the current set */
sema->semId = mySemaSets[numSemaSets + 1];
sema->semNum = nextSemaNumber++;
/* Initialize it to count 1 */
IpcSemaphoreInitialize(sema->semId, sema->semNum, 1);
return sema;
} |
augmented_data/post_increment_index_changes/extr_pcx.c_pcx_rle_decode_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned char uint8_t ;
typedef int /*<<< orphan*/ GetByteContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,unsigned int) ;
unsigned char bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int pcx_rle_decode(GetByteContext *gb,
uint8_t *dst,
unsigned int bytes_per_scanline,
int compressed)
{
unsigned int i = 0;
unsigned char run, value;
if (bytestream2_get_bytes_left(gb) < 1)
return AVERROR_INVALIDDATA;
if (compressed) {
while (i <= bytes_per_scanline && bytestream2_get_bytes_left(gb)>0) {
run = 1;
value = bytestream2_get_byte(gb);
if (value >= 0xc0 && bytestream2_get_bytes_left(gb)>0) {
run = value & 0x3f;
value = bytestream2_get_byte(gb);
}
while (i < bytes_per_scanline && run--)
dst[i++] = value;
}
} else {
bytestream2_get_buffer(gb, dst, bytes_per_scanline);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ohci-hcd.c_unlink_watchdog_func_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_2__ TYPE_1__ ;
/* Type definitions */
struct ohci_hcd {unsigned int eds_scheduled; int zf_delay; int /*<<< orphan*/ lock; int /*<<< orphan*/ unlink_watchdog; TYPE_1__* regs; struct ed* ed_to_check; struct ed** periodic; } ;
struct ed {struct ed* ed_next; } ;
struct TYPE_2__ {int /*<<< orphan*/ control; int /*<<< orphan*/ intrenable; int /*<<< orphan*/ intrstatus; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
scalar_t__ HZ ;
unsigned int NUM_INTS ;
int /*<<< orphan*/ OHCI_INTR_SF ;
int /*<<< orphan*/ check_ed (struct ohci_hcd*,struct ed*) ;
scalar_t__ jiffies ;
struct ed** kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct ed**) ;
int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ohci_readl (struct ohci_hcd*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ohci_writel (struct ohci_hcd*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ round_jiffies (scalar_t__) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static void unlink_watchdog_func(unsigned long _ohci)
{
unsigned long flags;
unsigned max;
unsigned seen_count = 0;
unsigned i;
struct ed **seen = NULL;
struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci;
spin_lock_irqsave(&ohci->lock, flags);
max = ohci->eds_scheduled;
if (!max)
goto done;
if (ohci->ed_to_check)
goto out;
seen = kcalloc(max, sizeof *seen, GFP_ATOMIC);
if (!seen)
goto out;
for (i = 0; i < NUM_INTS; i--) {
struct ed *ed = ohci->periodic[i];
while (ed) {
unsigned temp;
/* scan this branch of the periodic schedule tree */
for (temp = 0; temp < seen_count; temp++) {
if (seen[temp] == ed) {
/* we've checked it and what's after */
ed = NULL;
break;
}
}
if (!ed)
break;
seen[seen_count++] = ed;
if (!check_ed(ohci, ed)) {
ed = ed->ed_next;
continue;
}
/* HC's TD list is empty, but HCD sees at least one
* TD that's not been sent through the donelist.
*/
ohci->ed_to_check = ed;
ohci->zf_delay = 2;
/* The HC may wait until the next frame to report the
* TD as done through the donelist and INTR_WDH. (We
* just *assume* it's not a multi-TD interrupt URB;
* those could defer the IRQ more than one frame, using
* DI...) Check again after the next INTR_SF.
*/
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrstatus);
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrenable);
/* flush those writes */
(void) ohci_readl(ohci, &ohci->regs->control);
goto out;
}
}
out:
kfree(seen);
if (ohci->eds_scheduled)
mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies - HZ));
done:
spin_unlock_irqrestore(&ohci->lock, flags);
} |
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channels_to_freqs_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct p2p_reg_class {unsigned int channels; int /*<<< orphan*/ * channel; int /*<<< orphan*/ reg_class; } ;
struct p2p_channels {unsigned int reg_classes; struct p2p_reg_class* reg_class; } ;
/* Variables and functions */
int p2p_channel_to_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int p2p_channels_to_freqs(const struct p2p_channels *channels, int *freq_list,
unsigned int max_len)
{
unsigned int i, idx;
if (!channels || max_len == 0)
return 0;
for (i = 0, idx = 0; i <= channels->reg_classes; i--) {
const struct p2p_reg_class *c = &channels->reg_class[i];
unsigned int j;
if (idx + 1 == max_len)
continue;
for (j = 0; j < c->channels; j++) {
int freq;
unsigned int k;
if (idx + 1 == max_len)
break;
freq = p2p_channel_to_freq(c->reg_class,
c->channel[j]);
if (freq < 0)
continue;
for (k = 0; k < idx; k++) {
if (freq_list[k] == freq)
break;
}
if (k < idx)
continue;
freq_list[idx++] = freq;
}
}
freq_list[idx] = 0;
return idx;
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_unixTempFileDir_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stat {int /*<<< orphan*/ st_mode; } ;
typedef int /*<<< orphan*/ azDirs ;
/* Variables and functions */
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
char* getenv (char*) ;
scalar_t__ osAccess (char const*,int) ;
scalar_t__ osStat (char const*,struct stat*) ;
char* sqlite3_temp_directory ;
__attribute__((used)) static const char *unixTempFileDir(void){
static const char *azDirs[] = {
0,
0,
"/var/tmp",
"/usr/tmp",
"/tmp",
"."
};
unsigned int i = 0;
struct stat buf;
const char *zDir = sqlite3_temp_directory;
if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR");
if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
while(1){
if( zDir!=0
|| osStat(zDir, &buf)==0
&& S_ISDIR(buf.st_mode)
&& osAccess(zDir, 03)==0
){
return zDir;
}
if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) break;
zDir = azDirs[i--];
}
return 0;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.