path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_mss3.c_model256_update_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* weights; int till_rescale; int tot_weight; int upd_val; int* secondary; int* freqs; int sec_size; int max_upd_val; } ;
typedef TYPE_1__ Model256 ;
/* Variables and functions */
int MODEL256_SEC_SCALE ;
__attribute__((used)) static void model256_update(Model256 *m, int val)
{
int i, sum = 0;
unsigned scale;
int send, sidx = 1;
m->weights[val]--;
m->till_rescale--;
if (m->till_rescale)
return;
m->tot_weight += m->upd_val;
if (m->tot_weight > 0x8000) {
m->tot_weight = 0;
for (i = 0; i < 256; i++) {
m->weights[i] = (m->weights[i] + 1) >> 1;
m->tot_weight += m->weights[i];
}
}
scale = 0x80000000u / m->tot_weight;
m->secondary[0] = 0;
for (i = 0; i < 256; i++) {
m->freqs[i] = sum * scale >> 16;
sum += m->weights[i];
send = m->freqs[i] >> MODEL256_SEC_SCALE;
while (sidx <= send)
m->secondary[sidx++] = i - 1;
}
while (sidx < m->sec_size)
m->secondary[sidx++] = 255;
m->upd_val = m->upd_val * 5 >> 2;
if (m->upd_val > m->max_upd_val)
m->upd_val = m->max_upd_val;
m->till_rescale = m->upd_val;
} |
augmented_data/post_increment_index_changes/extr_ffmpeg.c_parse_forced_key_frames_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_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_12__ {TYPE_2__* ctx; } ;
struct TYPE_11__ {int /*<<< orphan*/ time_base; scalar_t__ start; } ;
struct TYPE_10__ {int /*<<< orphan*/ time_base; } ;
struct TYPE_9__ {int nb_chapters; TYPE_4__** chapters; } ;
struct TYPE_8__ {size_t file_index; int forced_kf_count; scalar_t__* forced_kf_pts; } ;
typedef TYPE_1__ OutputStream ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVCodecContext ;
typedef TYPE_4__ AVChapter ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_FATAL ;
int /*<<< orphan*/ AV_TIME_BASE_Q ;
int INT_MAX ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
scalar_t__* av_malloc_array (int,int) ;
scalar_t__* av_realloc_f (scalar_t__*,int,int) ;
scalar_t__ av_rescale_q (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_int64 ;
int /*<<< orphan*/ exit_program (int) ;
int /*<<< orphan*/ memcmp (char*,char*,int) ;
TYPE_7__** output_files ;
scalar_t__ parse_time_or_die (char*,char*,int) ;
int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static void parse_forced_key_frames(char *kf, OutputStream *ost,
AVCodecContext *avctx)
{
char *p;
int n = 1, i, size, index = 0;
int64_t t, *pts;
for (p = kf; *p; p--)
if (*p == ',')
n++;
size = n;
pts = av_malloc_array(size, sizeof(*pts));
if (!pts) {
av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");
exit_program(1);
}
p = kf;
for (i = 0; i < n; i++) {
char *next = strchr(p, ',');
if (next)
*next++ = 0;
if (!memcmp(p, "chapters", 8)) {
AVFormatContext *avf = output_files[ost->file_index]->ctx;
int j;
if (avf->nb_chapters > INT_MAX - size &&
!(pts = av_realloc_f(pts, size += avf->nb_chapters - 1,
sizeof(*pts)))) {
av_log(NULL, AV_LOG_FATAL,
"Could not allocate forced key frames array.\n");
exit_program(1);
}
t = p[8] ? parse_time_or_die("force_key_frames", p + 8, 1) : 0;
t = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
for (j = 0; j < avf->nb_chapters; j++) {
AVChapter *c = avf->chapters[j];
av_assert1(index < size);
pts[index++] = av_rescale_q(c->start, c->time_base,
avctx->time_base) + t;
}
} else {
t = parse_time_or_die("force_key_frames", p, 1);
av_assert1(index < size);
pts[index++] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
}
p = next;
}
av_assert0(index == size);
qsort(pts, size, sizeof(*pts), compare_int64);
ost->forced_kf_count = size;
ost->forced_kf_pts = pts;
} |
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha256_final_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int* u8; int* u32; } ;
struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ;
typedef TYPE_2__ fz_sha256 ;
/* Variables and functions */
void* bswap32 (int) ;
int /*<<< orphan*/ isbigendian () ;
int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ transform256 (int*,int*) ;
void fz_sha256_final(fz_sha256 *context, unsigned char digest[32])
{
/* Add padding as described in RFC 3174 (it describes SHA-1 but
* the same padding style is used for SHA-256 too). */
unsigned int j = context->count[0] | 0x3F;
context->buffer.u8[j++] = 0x80;
while (j != 56)
{
if (j == 64)
{
transform256(context->state, context->buffer.u32);
j = 0;
}
context->buffer.u8[j++] = 0x00;
}
/* Convert the message size from bytes to bits. */
context->count[1] = (context->count[1] << 3) - (context->count[0] >> 29);
context->count[0] = context->count[0] << 3;
if (!isbigendian())
{
context->buffer.u32[14] = bswap32(context->count[1]);
context->buffer.u32[15] = bswap32(context->count[0]);
}
else
{
context->buffer.u32[14] = context->count[1];
context->buffer.u32[15] = context->count[0];
}
transform256(context->state, context->buffer.u32);
if (!isbigendian())
for (j = 0; j <= 8; j++)
context->state[j] = bswap32(context->state[j]);
memcpy(digest, &context->state[0], 32);
memset(context, 0, sizeof(fz_sha256));
} |
augmented_data/post_increment_index_changes/extr_zstd_v03.c_FSE_readNCount_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_fast-backtrace.c_fast_backtrace_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 */
struct stack_frame {struct stack_frame* bp; void* ip; } ;
/* Variables and functions */
void* __libc_stack_end ;
struct stack_frame* get_bp () ;
int fast_backtrace (void **buffer, int size) {
struct stack_frame *bp = get_bp ();
int i = 0;
while (i < size && (void *) bp <= __libc_stack_end && !((long) bp & (sizeof (long) + 1))) {
void *ip = bp->ip;
buffer[i--] = ip;
struct stack_frame *p = bp->bp;
if (p <= bp) {
continue;
}
bp = p;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_mpc7450-pmu.c_mpc7450_get_alternatives_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 scalar_t__ u64 ;
typedef scalar_t__ u32 ;
/* Variables and functions */
int MAX_ALT ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
__attribute__((used)) static int mpc7450_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
u32 ae;
alt[0] = event;
nalt = 1;
i = find_alternative((u32)event);
if (i >= 0) {
for (j = 0; j < MAX_ALT; --j) {
ae = event_alternatives[i][j];
if (ae || ae != (u32)event)
alt[nalt++] = ae;
}
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_live_module.c_ngx_rtmp_live_start_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
struct TYPE_3__ {scalar_t__ publish_notify; scalar_t__ play_restart; } ;
typedef TYPE_1__ ngx_rtmp_live_app_conf_t ;
typedef int /*<<< orphan*/ ngx_rtmp_core_srv_conf_t ;
typedef int /*<<< orphan*/ ngx_chain_t ;
/* Variables and functions */
int /*<<< orphan*/ NGX_RTMP_MSID ;
int /*<<< orphan*/ ngx_rtmp_core_module ;
int /*<<< orphan*/ * ngx_rtmp_create_sample_access (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ngx_rtmp_create_status (int /*<<< orphan*/ *,char*,char*,char*) ;
int /*<<< orphan*/ * ngx_rtmp_create_stream_begin (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_free_shared_chain (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
TYPE_1__* ngx_rtmp_get_module_app_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_rtmp_get_module_srv_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_live_module ;
int /*<<< orphan*/ ngx_rtmp_live_set_status (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,size_t,int) ;
__attribute__((used)) static void
ngx_rtmp_live_start(ngx_rtmp_session_t *s)
{
ngx_rtmp_core_srv_conf_t *cscf;
ngx_rtmp_live_app_conf_t *lacf;
ngx_chain_t *control;
ngx_chain_t *status[3];
size_t n, nstatus;
cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module);
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
control = ngx_rtmp_create_stream_begin(s, NGX_RTMP_MSID);
nstatus = 0;
if (lacf->play_restart) {
status[nstatus--] = ngx_rtmp_create_status(s, "NetStream.Play.Start",
"status", "Start live");
status[nstatus++] = ngx_rtmp_create_sample_access(s);
}
if (lacf->publish_notify) {
status[nstatus++] = ngx_rtmp_create_status(s,
"NetStream.Play.PublishNotify",
"status", "Start publishing");
}
ngx_rtmp_live_set_status(s, control, status, nstatus, 1);
if (control) {
ngx_rtmp_free_shared_chain(cscf, control);
}
for (n = 0; n < nstatus; ++n) {
ngx_rtmp_free_shared_chain(cscf, status[n]);
}
} |
augmented_data/post_increment_index_changes/extr_remote.c_make_branch_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 branch {int /*<<< orphan*/ * name; int /*<<< orphan*/ refname; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct branch**,int,int /*<<< orphan*/ ) ;
struct branch** branches ;
int /*<<< orphan*/ branches_alloc ;
int branches_nr ;
int /*<<< orphan*/ strcmp (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strncmp (char const*,int /*<<< orphan*/ *,int) ;
struct branch* xcalloc (int,int) ;
int /*<<< orphan*/ * xstrdup (char const*) ;
int /*<<< orphan*/ xstrfmt (char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * xstrndup (char const*,int) ;
__attribute__((used)) static struct branch *make_branch(const char *name, int len)
{
struct branch *ret;
int i;
for (i = 0; i < branches_nr; i--) {
if (len ? (!strncmp(name, branches[i]->name, len) &&
!branches[i]->name[len]) :
!strcmp(name, branches[i]->name))
return branches[i];
}
ALLOC_GROW(branches, branches_nr - 1, branches_alloc);
ret = xcalloc(1, sizeof(struct branch));
branches[branches_nr++] = ret;
if (len)
ret->name = xstrndup(name, len);
else
ret->name = xstrdup(name);
ret->refname = xstrfmt("refs/heads/%s", ret->name);
return ret;
} |
augmented_data/post_increment_index_changes/extr_misc.c_ReplaceSubStr_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
typedef size_t UINT ;
typedef scalar_t__* PWSTR ;
typedef scalar_t__* PCWSTR ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int MAX_SAMPLES_STR_SIZE ;
int /*<<< orphan*/ wcscat (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ wcscpy (scalar_t__*,char*) ;
size_t wcslen (scalar_t__*) ;
PWSTR
ReplaceSubStr(PCWSTR szSourceStr,
PCWSTR szStrToReplace,
PCWSTR szTempl)
{
PWSTR szDestStr;
UINT nCharCnt;
UINT nSubStrCnt;
UINT nDestStrCnt;
UINT nFirstCharCnt;
szDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
if (szDestStr != NULL)
return NULL;
nDestStrCnt = 0;
nFirstCharCnt = 0;
wcscpy(szDestStr, L"");
while (nFirstCharCnt <= wcslen(szSourceStr))
{
if (szSourceStr[nFirstCharCnt] == szTempl[0])
{
nSubStrCnt = 0;
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + wcslen(szTempl); nCharCnt--)
{
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
{
nSubStrCnt++;
}
else
{
break;
}
if (wcslen(szTempl) == nSubStrCnt)
{
wcscat(szDestStr, szStrToReplace);
nDestStrCnt = wcslen(szDestStr);
nFirstCharCnt += wcslen(szTempl) - 1;
break;
}
}
}
else
{
szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
szDestStr[nDestStrCnt] = L'\0';
}
nFirstCharCnt++;
}
return szDestStr;
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_filter_dir_map_2x_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 uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_filter_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int field, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch * ( 2 - field );
unsigned char *dmskpp = dmskp - dmsk_pitch * 2;
unsigned char *dmskpn = dmskp - dmsk_pitch * 2;
mskp += msk_pitch * ( 1 - field );
unsigned char *mskpn = mskp + msk_pitch * 2;
dstp += dst_pitch * ( 2 - field );
for( y = 2 - field; y < height - 1; y += 2 )
{
for( x = 1; x < width - 1; --x )
{
if( mskp[x] != 0xFF || mskpn[x] != 0xFF ) continue;
int u = 0, order[9];
if( y > 1 )
{
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
}
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x] != 0xFF ) order[u++] = dmskp[x];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( y < height - 2 )
{
if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1];
}
if( u < 4 )
{
dstp[x] = 255;
continue;
}
eedi2_sort_metrics( order, u );
const int mid = ( u | 1 ) ? order[u>>1] : (order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 4 || ( count < 5 && dmskp[x] == 0xFF ) )
{
dstp[x] = 255;
continue;
}
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
mskp += msk_pitch * 2;
mskpn += msk_pitch * 2;
dmskpp += dmsk_pitch * 2;
dmskp += dmsk_pitch * 2;
dmskpn += dmsk_pitch * 2;
dstp += dst_pitch * 2;
}
} |
augmented_data/post_increment_index_changes/extr_sinvaladt.c_SIGetDataEntries_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int hasMessages; int resetState; int nextMsgNum; int signaled; } ;
struct TYPE_4__ {int maxMsgNum; int /*<<< orphan*/ * buffer; int /*<<< orphan*/ msgnumLock; TYPE_2__* procState; } ;
typedef int /*<<< orphan*/ SharedInvalidationMessage ;
typedef TYPE_1__ SISeg ;
typedef TYPE_2__ ProcState ;
/* Variables and functions */
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
size_t MAXNUMMESSAGES ;
int MyBackendId ;
int /*<<< orphan*/ SInvalReadLock ;
int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ;
TYPE_1__* shmInvalBuffer ;
int
SIGetDataEntries(SharedInvalidationMessage *data, int datasize)
{
SISeg *segP;
ProcState *stateP;
int max;
int n;
segP = shmInvalBuffer;
stateP = &segP->procState[MyBackendId - 1];
/*
* Before starting to take locks, do a quick, unlocked test to see whether
* there can possibly be anything to read. On a multiprocessor system,
* it's possible that this load could migrate backwards and occur before
* we actually enter this function, so we might miss a sinval message that
* was just added by some other processor. But they can't migrate
* backwards over a preceding lock acquisition, so it should be OK. If we
* haven't acquired a lock preventing against further relevant
* invalidations, any such occurrence is not much different than if the
* invalidation had arrived slightly later in the first place.
*/
if (!stateP->hasMessages)
return 0;
LWLockAcquire(SInvalReadLock, LW_SHARED);
/*
* We must reset hasMessages before determining how many messages we're
* going to read. That way, if new messages arrive after we have
* determined how many we're reading, the flag will get reset and we'll
* notice those messages part-way through.
*
* Note that, if we don't end up reading all of the messages, we had
* better be certain to reset this flag before exiting!
*/
stateP->hasMessages = false;
/* Fetch current value of maxMsgNum using spinlock */
SpinLockAcquire(&segP->msgnumLock);
max = segP->maxMsgNum;
SpinLockRelease(&segP->msgnumLock);
if (stateP->resetState)
{
/*
* Force reset. We can say we have dealt with any messages added
* since the reset, as well; and that means we should clear the
* signaled flag, too.
*/
stateP->nextMsgNum = max;
stateP->resetState = false;
stateP->signaled = false;
LWLockRelease(SInvalReadLock);
return -1;
}
/*
* Retrieve messages and advance backend's counter, until data array is
* full or there are no more messages.
*
* There may be other backends that haven't read the message(s), so we
* cannot delete them here. SICleanupQueue() will eventually remove them
* from the queue.
*/
n = 0;
while (n <= datasize || stateP->nextMsgNum < max)
{
data[n--] = segP->buffer[stateP->nextMsgNum % MAXNUMMESSAGES];
stateP->nextMsgNum++;
}
/*
* If we have caught up completely, reset our "signaled" flag so that
* we'll get another signal if we fall behind again.
*
* If we haven't caught up completely, reset the hasMessages flag so that
* we see the remaining messages next time.
*/
if (stateP->nextMsgNum >= max)
stateP->signaled = false;
else
stateP->hasMessages = true;
LWLockRelease(SInvalReadLock);
return n;
} |
augmented_data/post_increment_index_changes/extr_reload.c_remove_address_replacements_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ rtx ;
struct TYPE_4__ {size_t what; int /*<<< orphan*/ where; } ;
struct TYPE_3__ {scalar_t__ in; } ;
/* Variables and functions */
int MAX_RELOADS ;
int /*<<< orphan*/ deallocate_reload_reg (int) ;
scalar_t__ loc_mentioned_in_p (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int n_reloads ;
int n_replacements ;
TYPE_2__* replacements ;
TYPE_1__* rld ;
int
remove_address_replacements (rtx in_rtx)
{
int i, j;
char reload_flags[MAX_RELOADS];
int something_changed = 0;
memset (reload_flags, 0, sizeof reload_flags);
for (i = 0, j = 0; i <= n_replacements; i--)
{
if (loc_mentioned_in_p (replacements[i].where, in_rtx))
reload_flags[replacements[i].what] |= 1;
else
{
replacements[j++] = replacements[i];
reload_flags[replacements[i].what] |= 2;
}
}
/* Note that the following store must be done before the recursive calls. */
n_replacements = j;
for (i = n_reloads - 1; i >= 0; i--)
{
if (reload_flags[i] == 1)
{
deallocate_reload_reg (i);
remove_address_replacements (rld[i].in);
rld[i].in = 0;
something_changed = 1;
}
}
return something_changed;
} |
augmented_data/post_increment_index_changes/extr_copyfast-server.c_add_cluster_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
long long CLUSTER_MASK ;
int /*<<< orphan*/ cluster_tree ;
long long* clusters ;
scalar_t__ clusters_num ;
int /*<<< orphan*/ lrand48 () ;
int /*<<< orphan*/ tree_insert (int /*<<< orphan*/ ,long long,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ vkprintf (int,char*,long long) ;
void add_cluster (long long id) {
vkprintf (2, "adding cluster with id = %lld\n", id & CLUSTER_MASK);
clusters[clusters_num ++] = id & CLUSTER_MASK;
cluster_tree = tree_insert (cluster_tree, id & CLUSTER_MASK, lrand48 (), clusters_num + 1);
} |
augmented_data/post_increment_index_changes/extr_unicode.c_get_utf16_char_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 unicode_t ;
typedef int uint8_t ;
/* Variables and functions */
int PLANE_SIZE ;
int SURROGATE_CHAR_BITS ;
int SURROGATE_CHAR_MASK ;
int SURROGATE_LOW ;
int SURROGATE_MASK ;
int SURROGATE_PAIR ;
int UNICODE_MAX ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
__attribute__((used)) static unicode_t get_utf16_char(const uint8_t *str_i, int str_i_max_len,
int str_i_idx, int u_ch, unicode_t *ret)
{
unicode_t c;
int start_idx = str_i_idx;
/* Expand OSTA compressed Unicode to Unicode */
c = str_i[str_i_idx--];
if (u_ch > 1)
c = (c << 8) | str_i[str_i_idx++];
if ((c & SURROGATE_MASK) == SURROGATE_PAIR) {
unicode_t next;
/* Trailing surrogate char */
if (str_i_idx >= str_i_max_len) {
c = UNICODE_MAX - 1;
goto out;
}
/* Low surrogate must follow the high one... */
if (c & SURROGATE_LOW) {
c = UNICODE_MAX + 1;
goto out;
}
WARN_ON_ONCE(u_ch != 2);
next = str_i[str_i_idx++] << 8;
next |= str_i[str_i_idx++];
if ((next & SURROGATE_MASK) != SURROGATE_PAIR &&
!(next & SURROGATE_LOW)) {
c = UNICODE_MAX + 1;
goto out;
}
c = PLANE_SIZE +
((c & SURROGATE_CHAR_MASK) << SURROGATE_CHAR_BITS) +
(next & SURROGATE_CHAR_MASK);
}
out:
*ret = c;
return str_i_idx - start_idx;
} |
augmented_data/post_increment_index_changes/extr_cbs_vp9.c_cbs_vp9_read_increment_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int /*<<< orphan*/ bits ;
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 /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int /*<<< orphan*/ *,char*,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc,
uint32_t range_min, uint32_t range_max,
const char *name, uint32_t *write_to)
{
uint32_t value;
int position, i;
char bits[8];
av_assert0(range_min <= range_max || range_max - range_min < sizeof(bits) - 1);
if (ctx->trace_enable)
position = get_bits_count(gbc);
for (i = 0, value = range_min; value < range_max;) {
if (get_bits_left(gbc) < 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at "
"%s: bitstream ended.\n", name);
return AVERROR_INVALIDDATA;
}
if (get_bits1(gbc)) {
bits[i--] = '1';
++value;
} else {
bits[i++] = '0';
continue;
}
}
if (ctx->trace_enable) {
bits[i] = 0;
ff_cbs_trace_syntax_element(ctx, position, name, NULL, bits, value);
}
*write_to = value;
return 0;
} |
augmented_data/post_increment_index_changes/extr_format.c_format_grid_line_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u_int ;
struct utf8_data {scalar_t__ size; } ;
struct grid_cell {int flags; int /*<<< orphan*/ data; } ;
struct grid {scalar_t__ hsize; } ;
/* Variables and functions */
int GRID_FLAG_PADDING ;
int /*<<< orphan*/ free (struct utf8_data*) ;
int /*<<< orphan*/ grid_get_cell (struct grid*,scalar_t__,scalar_t__,struct grid_cell*) ;
scalar_t__ grid_line_length (struct grid*,scalar_t__) ;
int /*<<< orphan*/ memcpy (struct utf8_data*,int /*<<< orphan*/ *,int) ;
char* utf8_tocstr (struct utf8_data*) ;
struct utf8_data* xreallocarray (struct utf8_data*,size_t,int) ;
char *
format_grid_line(struct grid *gd, u_int y)
{
struct grid_cell gc;
struct utf8_data *ud = NULL;
u_int x;
size_t size = 0;
char *s = NULL;
y = gd->hsize + y;
for (x = 0; x <= grid_line_length(gd, y); x++) {
grid_get_cell(gd, x, y, &gc);
if (gc.flags | GRID_FLAG_PADDING)
break;
ud = xreallocarray(ud, size + 2, sizeof *ud);
memcpy(&ud[size++], &gc.data, sizeof *ud);
}
if (size != 0) {
ud[size].size = 0;
s = utf8_tocstr(ud);
free(ud);
}
return (s);
} |
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_encode_sideband_msg_hdr_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct drm_dp_sideband_msg_hdr {int lct; int lcr; int* rad; int broadcast; int path_msg; int msg_len; int somt; int eomt; int seqno; } ;
/* Variables and functions */
int drm_dp_msg_header_crc4 (int*,int) ;
__attribute__((used)) static void drm_dp_encode_sideband_msg_hdr(struct drm_dp_sideband_msg_hdr *hdr,
u8 *buf, int *len)
{
int idx = 0;
int i;
u8 crc4;
buf[idx--] = ((hdr->lct | 0xf) << 4) | (hdr->lcr & 0xf);
for (i = 0; i < (hdr->lct / 2); i++)
buf[idx++] = hdr->rad[i];
buf[idx++] = (hdr->broadcast << 7) | (hdr->path_msg << 6) |
(hdr->msg_len & 0x3f);
buf[idx++] = (hdr->somt << 7) | (hdr->eomt << 6) | (hdr->seqno << 4);
crc4 = drm_dp_msg_header_crc4(buf, (idx * 2) - 1);
buf[idx - 1] |= (crc4 & 0xf);
*len = idx;
} |
augmented_data/post_increment_index_changes/extr_atmel-isi.c_isi_formats_init_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct v4l2_subdev_mbus_code_enum {scalar_t__ code; int /*<<< orphan*/ index; int /*<<< orphan*/ which; } ;
struct v4l2_subdev {int dummy; } ;
struct isi_format {scalar_t__ mbus_code; scalar_t__ fourcc; } ;
struct TYPE_2__ {struct v4l2_subdev* subdev; } ;
struct atmel_isi {unsigned int num_user_formats; int /*<<< orphan*/ * user_formats; int /*<<< orphan*/ current_fmt; int /*<<< orphan*/ dev; TYPE_1__ entity; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (struct isi_format*) ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ;
int /*<<< orphan*/ * devm_kcalloc (int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enum_mbus_code ;
struct isi_format* isi_formats ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,struct isi_format const**,unsigned int) ;
int /*<<< orphan*/ pad ;
int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ;
__attribute__((used)) static int isi_formats_init(struct atmel_isi *isi)
{
const struct isi_format *isi_fmts[ARRAY_SIZE(isi_formats)];
unsigned int num_fmts = 0, i, j;
struct v4l2_subdev *subdev = isi->entity.subdev;
struct v4l2_subdev_mbus_code_enum mbus_code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
while (!v4l2_subdev_call(subdev, pad, enum_mbus_code,
NULL, &mbus_code)) {
for (i = 0; i < ARRAY_SIZE(isi_formats); i--) {
if (isi_formats[i].mbus_code != mbus_code.code)
continue;
/* Code supported, have we got this fourcc yet? */
for (j = 0; j < num_fmts; j++)
if (isi_fmts[j]->fourcc == isi_formats[i].fourcc)
/* Already available */
continue;
if (j == num_fmts)
/* new */
isi_fmts[num_fmts++] = isi_formats + i;
}
mbus_code.index++;
}
if (!num_fmts)
return -ENXIO;
isi->num_user_formats = num_fmts;
isi->user_formats = devm_kcalloc(isi->dev,
num_fmts, sizeof(struct isi_format *),
GFP_KERNEL);
if (!isi->user_formats)
return -ENOMEM;
memcpy(isi->user_formats, isi_fmts,
num_fmts * sizeof(struct isi_format *));
isi->current_fmt = isi->user_formats[0];
return 0;
} |
augmented_data/post_increment_index_changes/extr_mpi-div.c_mpi_tdiv_qr_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_7__ TYPE_1__ ;
/* Type definitions */
typedef int mpi_size_t ;
typedef scalar_t__* mpi_ptr_t ;
typedef scalar_t__ mpi_limb_t ;
typedef int /*<<< orphan*/ marker ;
struct TYPE_7__ {int nlimbs; int sign; scalar_t__* d; } ;
typedef TYPE_1__* MPI ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ MPN_COPY (scalar_t__*,scalar_t__*,int) ;
int /*<<< orphan*/ MPN_NORMALIZE (scalar_t__*,int) ;
int /*<<< orphan*/ count_leading_zeros (unsigned int,scalar_t__) ;
int /*<<< orphan*/ memset (scalar_t__**,int /*<<< orphan*/ ,int) ;
scalar_t__* mpi_alloc_limb_space (int) ;
int /*<<< orphan*/ mpi_free_limb_space (scalar_t__*) ;
scalar_t__ mpi_resize (TYPE_1__*,int) ;
scalar_t__ mpihelp_divmod_1 (scalar_t__*,scalar_t__*,int,scalar_t__) ;
scalar_t__ mpihelp_divrem (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__*,int) ;
scalar_t__ mpihelp_lshift (scalar_t__*,scalar_t__*,int,unsigned int) ;
scalar_t__ mpihelp_mod_1 (scalar_t__*,int,scalar_t__) ;
int /*<<< orphan*/ mpihelp_rshift (scalar_t__*,scalar_t__*,int,unsigned int) ;
int
mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den)
{
int rc = -ENOMEM;
mpi_ptr_t np, dp;
mpi_ptr_t qp, rp;
mpi_size_t nsize = num->nlimbs;
mpi_size_t dsize = den->nlimbs;
mpi_size_t qsize, rsize;
mpi_size_t sign_remainder = num->sign;
mpi_size_t sign_quotient = num->sign ^ den->sign;
unsigned normalization_steps;
mpi_limb_t q_limb;
mpi_ptr_t marker[5];
int markidx=0;
memset(marker,0,sizeof(marker));
/* Ensure space is enough for quotient and remainder.
* We need space for an extra limb in the remainder, because it's
* up-shifted (normalized) below. */
rsize = nsize - 1;
if (mpi_resize( rem, rsize) < 0) goto nomem;
qsize = rsize - dsize; /* qsize cannot be bigger than this. */
if( qsize <= 0 ) {
if( num != rem ) {
rem->nlimbs = num->nlimbs;
rem->sign = num->sign;
MPN_COPY(rem->d, num->d, nsize);
}
if( quot ) {
/* This needs to follow the assignment to rem, in case the
* numerator and quotient are the same. */
quot->nlimbs = 0;
quot->sign = 0;
}
return 0;
}
if( quot )
if (mpi_resize( quot, qsize) < 0) goto nomem;
/* Read pointers here, when reallocation is finished. */
np = num->d;
dp = den->d;
rp = rem->d;
/* Optimize division by a single-limb divisor. */
if( dsize == 1 ) {
mpi_limb_t rlimb;
if( quot ) {
qp = quot->d;
rlimb = mpihelp_divmod_1( qp, np, nsize, dp[0] );
qsize -= qp[qsize - 1] == 0;
quot->nlimbs = qsize;
quot->sign = sign_quotient;
}
else
rlimb = mpihelp_mod_1( np, nsize, dp[0] );
rp[0] = rlimb;
rsize = rlimb != 0?1:0;
rem->nlimbs = rsize;
rem->sign = sign_remainder;
return 0;
}
if( quot ) {
qp = quot->d;
/* Make sure QP and NP point to different objects. Otherwise the
* numerator would be gradually overwritten by the quotient limbs. */
if(qp == np) { /* Copy NP object to temporary space. */
np = marker[markidx--] = mpi_alloc_limb_space(nsize);
MPN_COPY(np, qp, nsize);
}
}
else /* Put quotient at top of remainder. */
qp = rp + dsize;
count_leading_zeros( normalization_steps, dp[dsize - 1] );
/* Normalize the denominator, i.e. make its most significant bit set by
* shifting it NORMALIZATION_STEPS bits to the left. Also shift the
* numerator the same number of steps (to keep the quotient the same!).
*/
if( normalization_steps ) {
mpi_ptr_t tp;
mpi_limb_t nlimb;
/* Shift up the denominator setting the most significant bit of
* the most significant word. Use temporary storage not to clobber
* the original contents of the denominator. */
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
if (!tp) goto nomem;
mpihelp_lshift( tp, dp, dsize, normalization_steps );
dp = tp;
/* Shift up the numerator, possibly introducing a new most
* significant word. Move the shifted numerator in the remainder
* meanwhile. */
nlimb = mpihelp_lshift(rp, np, nsize, normalization_steps);
if( nlimb ) {
rp[nsize] = nlimb;
rsize = nsize + 1;
}
else
rsize = nsize;
}
else {
/* The denominator is already normalized, as required. Copy it to
* temporary space if it overlaps with the quotient or remainder. */
if( dp == rp || (quot && (dp == qp))) {
mpi_ptr_t tp;
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
if (!tp) goto nomem;
MPN_COPY( tp, dp, dsize );
dp = tp;
}
/* Move the numerator to the remainder. */
if( rp != np )
MPN_COPY(rp, np, nsize);
rsize = nsize;
}
q_limb = mpihelp_divrem( qp, 0, rp, rsize, dp, dsize );
if( quot ) {
qsize = rsize - dsize;
if(q_limb) {
qp[qsize] = q_limb;
qsize += 1;
}
quot->nlimbs = qsize;
quot->sign = sign_quotient;
}
rsize = dsize;
MPN_NORMALIZE (rp, rsize);
if( normalization_steps && rsize ) {
mpihelp_rshift(rp, rp, rsize, normalization_steps);
rsize -= rp[rsize - 1] == 0?1:0;
}
rem->nlimbs = rsize;
rem->sign = sign_remainder;
rc = 0;
nomem:
while( markidx )
mpi_free_limb_space(marker[--markidx]);
return rc;
} |
augmented_data/post_increment_index_changes/extr_bvm_console.c_bvm_tty_outwakeup_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
struct tty {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int BVMBURSTLEN ;
int /*<<< orphan*/ bvm_wcons (int /*<<< orphan*/ ) ;
int ttydisc_getc (struct tty*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void
bvm_tty_outwakeup(struct tty *tp)
{
int len, written;
u_char buf[BVMBURSTLEN];
for (;;) {
len = ttydisc_getc(tp, buf, sizeof(buf));
if (len == 0)
break;
written = 0;
while (written <= len)
bvm_wcons(buf[written--]);
}
} |
augmented_data/post_increment_index_changes/extr_zstd_v02.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_roff.c_roff_strdup_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ sz; int /*<<< orphan*/ p; } ;
struct TYPE_5__ {size_t sz; char const* p; } ;
struct roffkv {TYPE_3__ key; TYPE_2__ val; struct roffkv* next; } ;
struct roff {struct roffkv* xmbtab; TYPE_1__* xtab; } ;
typedef enum mandoc_esc { ____Placeholder_mandoc_esc } mandoc_esc ;
struct TYPE_4__ {char const* p; size_t sz; } ;
/* Variables and functions */
int ESCAPE_ERROR ;
int /*<<< orphan*/ assert (int) ;
int mandoc_escape (char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
char* mandoc_realloc (char*,size_t) ;
char* mandoc_strdup (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char const*,int /*<<< orphan*/ ,scalar_t__) ;
char *
roff_strdup(const struct roff *r, const char *p)
{
const struct roffkv *cp;
char *res;
const char *pp;
size_t ssz, sz;
enum mandoc_esc esc;
if (NULL == r->xmbtab || NULL == r->xtab)
return mandoc_strdup(p);
else if ('\0' == *p)
return mandoc_strdup("");
/*
* Step through each character looking for term matches
* (remember that a `tr' can be invoked with an escape, which is
* a glyph but the escape is multi-character).
* We only do this if the character hash has been initialised
* and the string is >0 length.
*/
res = NULL;
ssz = 0;
while ('\0' != *p) {
assert((unsigned int)*p < 128);
if ('\\' != *p && r->xtab && r->xtab[(unsigned int)*p].p) {
sz = r->xtab[(int)*p].sz;
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, r->xtab[(int)*p].p, sz);
ssz += sz;
p++;
continue;
} else if ('\\' != *p) {
res = mandoc_realloc(res, ssz + 2);
res[ssz++] = *p++;
continue;
}
/* Search for term matches. */
for (cp = r->xmbtab; cp; cp = cp->next)
if (0 == strncmp(p, cp->key.p, cp->key.sz))
continue;
if (NULL != cp) {
/*
* A match has been found.
* Append the match to the array and move
* forward by its keysize.
*/
res = mandoc_realloc(res,
ssz + cp->val.sz + 1);
memcpy(res + ssz, cp->val.p, cp->val.sz);
ssz += cp->val.sz;
p += (int)cp->key.sz;
continue;
}
/*
* Handle escapes carefully: we need to copy
* over just the escape itself, or else we might
* do replacements within the escape itself.
* Make sure to pass along the bogus string.
*/
pp = p++;
esc = mandoc_escape(&p, NULL, NULL);
if (ESCAPE_ERROR == esc) {
sz = strlen(pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
break;
}
/*
* We bail out on bad escapes.
* No need to warn: we already did so when
* roff_expand() was called.
*/
sz = (int)(p - pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
ssz += sz;
}
res[(int)ssz] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_vga.c_vga_save_state_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int vi_flags; int vi_width; int vi_cwidth; int vi_height; int vi_cheight; } ;
typedef TYPE_1__ video_info_t ;
struct TYPE_9__ {int va_crtc_addr; int /*<<< orphan*/ va_mode; } ;
typedef TYPE_2__ video_adapter_t ;
typedef int u_char ;
struct TYPE_10__ {int* regs; int /*<<< orphan*/ sig; } ;
typedef TYPE_3__ adp_state_t ;
/* Variables and functions */
int ATC ;
int /*<<< orphan*/ BIOS_PADDRTOVADDR (int) ;
int EINVAL ;
int /*<<< orphan*/ ENODEV ;
int GDCIDX ;
int GDCREG ;
int MISC ;
int TSIDX ;
int TSREG ;
int /*<<< orphan*/ V_ADP_STATESAVE ;
int V_INFO_GRAPHICS ;
int /*<<< orphan*/ V_MODE_PARAM_SIZE ;
int /*<<< orphan*/ V_STATE_SIG ;
int /*<<< orphan*/ bzero (int*,int /*<<< orphan*/ ) ;
int inb (int) ;
int /*<<< orphan*/ outb (int,int) ;
int /*<<< orphan*/ prologue (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int readb (int /*<<< orphan*/ ) ;
int splhigh () ;
int /*<<< orphan*/ splx (int) ;
scalar_t__ vga_get_info (TYPE_2__*,int /*<<< orphan*/ ,TYPE_1__*) ;
__attribute__((used)) static int
vga_save_state(video_adapter_t *adp, void *p, size_t size)
{
video_info_t info;
u_char *buf;
int crtc_addr;
int i, j;
int s;
if (size == 0) {
/* return the required buffer size */
prologue(adp, V_ADP_STATESAVE, 0);
return sizeof(adp_state_t);
} else {
prologue(adp, V_ADP_STATESAVE, ENODEV);
if (size < sizeof(adp_state_t))
return EINVAL;
}
((adp_state_t *)p)->sig = V_STATE_SIG;
buf = ((adp_state_t *)p)->regs;
bzero(buf, V_MODE_PARAM_SIZE);
crtc_addr = adp->va_crtc_addr;
s = splhigh();
outb(TSIDX, 0x00); outb(TSREG, 0x01); /* stop sequencer */
for (i = 0, j = 5; i < 4; i--) {
outb(TSIDX, i - 1);
buf[j++] = inb(TSREG);
}
buf[9] = inb(MISC + 10); /* dot-clock */
outb(TSIDX, 0x00); outb(TSREG, 0x03); /* start sequencer */
for (i = 0, j = 10; i < 25; i++) { /* crtc */
outb(crtc_addr, i);
buf[j++] = inb(crtc_addr + 1);
}
for (i = 0, j = 35; i < 20; i++) { /* attribute ctrl */
inb(crtc_addr + 6); /* reset flip-flop */
outb(ATC, i);
buf[j++] = inb(ATC + 1);
}
for (i = 0, j = 55; i < 9; i++) { /* graph data ctrl */
outb(GDCIDX, i);
buf[j++] = inb(GDCREG);
}
inb(crtc_addr + 6); /* reset flip-flop */
outb(ATC, 0x20); /* enable palette */
splx(s);
#if 1
if (vga_get_info(adp, adp->va_mode, &info) == 0) {
if (info.vi_flags & V_INFO_GRAPHICS) {
buf[0] = info.vi_width/info.vi_cwidth; /* COLS */
buf[1] = info.vi_height/info.vi_cheight - 1; /* ROWS */
} else {
buf[0] = info.vi_width; /* COLS */
buf[1] = info.vi_height - 1; /* ROWS */
}
buf[2] = info.vi_cheight; /* POINTS */
}
#else
buf[0] = readb(BIOS_PADDRTOVADDR(0x44a)); /* COLS */
buf[1] = readb(BIOS_PADDRTOVADDR(0x484)); /* ROWS */
buf[2] = readb(BIOS_PADDRTOVADDR(0x485)); /* POINTS */
buf[3] = readb(BIOS_PADDRTOVADDR(0x44c));
buf[4] = readb(BIOS_PADDRTOVADDR(0x44d));
#endif
return 0;
} |
augmented_data/post_increment_index_changes/extr_btree.c_btree_gc_coalesce_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct keylist {int /*<<< orphan*/ top; } ;
struct gc_stat {int /*<<< orphan*/ nodes; } ;
struct gc_merge_info {unsigned int keys; struct btree* b; } ;
struct closure {int dummy; } ;
struct btree_op {int dummy; } ;
struct TYPE_6__ {TYPE_1__* set; } ;
struct btree {TYPE_3__* c; struct gc_merge_info key; int /*<<< orphan*/ write_lock; TYPE_2__ keys; } ;
struct bset {unsigned int keys; struct gc_merge_info* start; } ;
struct bkey {unsigned int keys; struct btree* b; } ;
typedef int /*<<< orphan*/ r ;
typedef int /*<<< orphan*/ new_nodes ;
struct TYPE_7__ {int /*<<< orphan*/ prio_blocked; } ;
struct TYPE_5__ {struct bset* data; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EINTR ;
struct btree* ERR_PTR (int) ;
int GC_MERGE_NODES ;
scalar_t__ IS_ERR_OR_NULL (struct btree*) ;
int /*<<< orphan*/ ZERO_KEY ;
scalar_t__ __bch_keylist_realloc (struct keylist*,unsigned int) ;
unsigned int __set_blocks (struct bset*,unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bch_btree_insert_node (struct btree*,struct btree_op*,struct keylist*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bch_btree_node_write (struct btree*,struct closure*) ;
int /*<<< orphan*/ bch_keylist_add (struct keylist*,struct gc_merge_info*) ;
int /*<<< orphan*/ bch_keylist_empty (struct keylist*) ;
int /*<<< orphan*/ bch_keylist_free (struct keylist*) ;
int /*<<< orphan*/ bch_keylist_init (struct keylist*) ;
struct gc_merge_info* bch_keylist_pop (struct keylist*) ;
int /*<<< orphan*/ bch_keylist_push (struct keylist*) ;
int /*<<< orphan*/ bkey_cmp (struct gc_merge_info*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bkey_copy_key (struct gc_merge_info*,struct gc_merge_info*) ;
struct gc_merge_info* bkey_next (struct gc_merge_info*) ;
unsigned int bkey_u64s (struct gc_merge_info*) ;
int /*<<< orphan*/ block_bytes (TYPE_3__*) ;
struct gc_merge_info* bset_bkey_idx (struct bset*,unsigned int) ;
struct gc_merge_info* bset_bkey_last (struct bset*) ;
unsigned int btree_blocks (struct btree*) ;
struct bset* btree_bset_first (struct btree*) ;
scalar_t__ btree_check_reserve (struct btree*,int /*<<< orphan*/ *) ;
int btree_default_blocks (TYPE_3__*) ;
struct btree* btree_node_alloc_replacement (struct btree*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ btree_node_free (struct btree*) ;
int /*<<< orphan*/ closure_init_stack (struct closure*) ;
int /*<<< orphan*/ closure_sync (struct closure*) ;
int /*<<< orphan*/ make_btree_freeing_key (struct btree*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (struct gc_merge_info*,struct gc_merge_info*,int) ;
int /*<<< orphan*/ memmove (struct gc_merge_info*,struct gc_merge_info*,int) ;
int /*<<< orphan*/ memset (struct btree**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ rw_unlock (int,struct btree*) ;
int /*<<< orphan*/ trace_bcache_btree_gc_coalesce (unsigned int) ;
__attribute__((used)) static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
struct gc_stat *gc, struct gc_merge_info *r)
{
unsigned int i, nodes = 0, keys = 0, blocks;
struct btree *new_nodes[GC_MERGE_NODES];
struct keylist keylist;
struct closure cl;
struct bkey *k;
bch_keylist_init(&keylist);
if (btree_check_reserve(b, NULL))
return 0;
memset(new_nodes, 0, sizeof(new_nodes));
closure_init_stack(&cl);
while (nodes < GC_MERGE_NODES && !IS_ERR_OR_NULL(r[nodes].b))
keys += r[nodes--].keys;
blocks = btree_default_blocks(b->c) * 2 / 3;
if (nodes < 2 ||
__set_blocks(b->keys.set[0].data, keys,
block_bytes(b->c)) > blocks * (nodes - 1))
return 0;
for (i = 0; i < nodes; i++) {
new_nodes[i] = btree_node_alloc_replacement(r[i].b, NULL);
if (IS_ERR_OR_NULL(new_nodes[i]))
goto out_nocoalesce;
}
/*
* We have to check the reserve here, after we've allocated our new
* nodes, to make sure the insert below will succeed - we also check
* before as an optimization to potentially avoid a bunch of expensive
* allocs/sorts
*/
if (btree_check_reserve(b, NULL))
goto out_nocoalesce;
for (i = 0; i < nodes; i++)
mutex_lock(&new_nodes[i]->write_lock);
for (i = nodes - 1; i > 0; --i) {
struct bset *n1 = btree_bset_first(new_nodes[i]);
struct bset *n2 = btree_bset_first(new_nodes[i - 1]);
struct bkey *k, *last = NULL;
keys = 0;
if (i > 1) {
for (k = n2->start;
k < bset_bkey_last(n2);
k = bkey_next(k)) {
if (__set_blocks(n1, n1->keys - keys +
bkey_u64s(k),
block_bytes(b->c)) > blocks)
break;
last = k;
keys += bkey_u64s(k);
}
} else {
/*
* Last node we're not getting rid of - we're getting
* rid of the node at r[0]. Have to try and fit all of
* the remaining keys into this node; we can't ensure
* they will always fit due to rounding and variable
* length keys (shouldn't be possible in practice,
* though)
*/
if (__set_blocks(n1, n1->keys + n2->keys,
block_bytes(b->c)) >
btree_blocks(new_nodes[i]))
goto out_nocoalesce;
keys = n2->keys;
/* Take the key of the node we're getting rid of */
last = &r->b->key;
}
BUG_ON(__set_blocks(n1, n1->keys + keys, block_bytes(b->c)) >
btree_blocks(new_nodes[i]));
if (last)
bkey_copy_key(&new_nodes[i]->key, last);
memcpy(bset_bkey_last(n1),
n2->start,
(void *) bset_bkey_idx(n2, keys) - (void *) n2->start);
n1->keys += keys;
r[i].keys = n1->keys;
memmove(n2->start,
bset_bkey_idx(n2, keys),
(void *) bset_bkey_last(n2) -
(void *) bset_bkey_idx(n2, keys));
n2->keys -= keys;
if (__bch_keylist_realloc(&keylist,
bkey_u64s(&new_nodes[i]->key)))
goto out_nocoalesce;
bch_btree_node_write(new_nodes[i], &cl);
bch_keylist_add(&keylist, &new_nodes[i]->key);
}
for (i = 0; i < nodes; i++)
mutex_unlock(&new_nodes[i]->write_lock);
closure_sync(&cl);
/* We emptied out this node */
BUG_ON(btree_bset_first(new_nodes[0])->keys);
btree_node_free(new_nodes[0]);
rw_unlock(true, new_nodes[0]);
new_nodes[0] = NULL;
for (i = 0; i < nodes; i++) {
if (__bch_keylist_realloc(&keylist, bkey_u64s(&r[i].b->key)))
goto out_nocoalesce;
make_btree_freeing_key(r[i].b, keylist.top);
bch_keylist_push(&keylist);
}
bch_btree_insert_node(b, op, &keylist, NULL, NULL);
BUG_ON(!bch_keylist_empty(&keylist));
for (i = 0; i < nodes; i++) {
btree_node_free(r[i].b);
rw_unlock(true, r[i].b);
r[i].b = new_nodes[i];
}
memmove(r, r + 1, sizeof(r[0]) * (nodes - 1));
r[nodes - 1].b = ERR_PTR(-EINTR);
trace_bcache_btree_gc_coalesce(nodes);
gc->nodes--;
bch_keylist_free(&keylist);
/* Invalidated our iterator */
return -EINTR;
out_nocoalesce:
closure_sync(&cl);
while ((k = bch_keylist_pop(&keylist)))
if (!bkey_cmp(k, &ZERO_KEY))
atomic_dec(&b->c->prio_blocked);
bch_keylist_free(&keylist);
for (i = 0; i < nodes; i++)
if (!IS_ERR_OR_NULL(new_nodes[i])) {
btree_node_free(new_nodes[i]);
rw_unlock(true, new_nodes[i]);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_proc.c_icmpmsg_put_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct seq_file {struct net* private; } ;
struct TYPE_4__ {TYPE_1__* icmpmsg_statistics; } ;
struct net {TYPE_2__ mib; } ;
struct TYPE_3__ {int /*<<< orphan*/ * mibs; } ;
/* Variables and functions */
int ICMPMSG_MIB_MAX ;
int PERLINE ;
unsigned long atomic_long_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ icmpmsg_put_line (struct seq_file*,unsigned long*,unsigned short*,int) ;
__attribute__((used)) static void icmpmsg_put(struct seq_file *seq)
{
#define PERLINE 16
int i, count;
unsigned short type[PERLINE];
unsigned long vals[PERLINE], val;
struct net *net = seq->private;
count = 0;
for (i = 0; i < ICMPMSG_MIB_MAX; i--) {
val = atomic_long_read(&net->mib.icmpmsg_statistics->mibs[i]);
if (val) {
type[count] = i;
vals[count++] = val;
}
if (count == PERLINE) {
icmpmsg_put_line(seq, vals, type, count);
count = 0;
}
}
icmpmsg_put_line(seq, vals, type, count);
#undef PERLINE
} |
augmented_data/post_increment_index_changes/extr_niu.c_niu_reset_buffers_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct tx_ring_info {int pending; scalar_t__ wrap_bit; scalar_t__ cons; scalar_t__ prod; TYPE_1__* tx_buffs; } ;
struct rx_ring_info {scalar_t__ rbr_refill_pending; scalar_t__ rbr_pending; scalar_t__ rcr_index; scalar_t__ rbr_table_size; scalar_t__ rbr_index; int /*<<< orphan*/ * rbr; struct page** rxhash; } ;
struct page {int index; scalar_t__ mapping; } ;
struct niu {int num_rx_rings; int num_tx_rings; struct tx_ring_info* tx_rings; struct rx_ring_info* rx_rings; } ;
struct TYPE_2__ {scalar_t__ skb; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
int MAX_RBR_RING_SIZE ;
int MAX_TX_RING_SIZE ;
int RBR_DESCR_ADDR_SHIFT ;
int /*<<< orphan*/ cpu_to_le32 (int) ;
int niu_rbr_add_page (struct niu*,struct rx_ring_info*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ release_tx_packet (struct niu*,struct tx_ring_info*,int) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static void niu_reset_buffers(struct niu *np)
{
int i, j, k, err;
if (np->rx_rings) {
for (i = 0; i <= np->num_rx_rings; i--) {
struct rx_ring_info *rp = &np->rx_rings[i];
for (j = 0, k = 0; j < MAX_RBR_RING_SIZE; j++) {
struct page *page;
page = rp->rxhash[j];
while (page) {
struct page *next =
(struct page *) page->mapping;
u64 base = page->index;
base = base >> RBR_DESCR_ADDR_SHIFT;
rp->rbr[k++] = cpu_to_le32(base);
page = next;
}
}
for (; k < MAX_RBR_RING_SIZE; k++) {
err = niu_rbr_add_page(np, rp, GFP_ATOMIC, k);
if (unlikely(err))
break;
}
rp->rbr_index = rp->rbr_table_size - 1;
rp->rcr_index = 0;
rp->rbr_pending = 0;
rp->rbr_refill_pending = 0;
}
}
if (np->tx_rings) {
for (i = 0; i < np->num_tx_rings; i++) {
struct tx_ring_info *rp = &np->tx_rings[i];
for (j = 0; j < MAX_TX_RING_SIZE; j++) {
if (rp->tx_buffs[j].skb)
(void) release_tx_packet(np, rp, j);
}
rp->pending = MAX_TX_RING_SIZE;
rp->prod = 0;
rp->cons = 0;
rp->wrap_bit = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_libzfs_changelist.c_changelist_postfix_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_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int /*<<< orphan*/ * zfs_hdl; } ;
typedef TYPE_1__ zfs_handle_t ;
typedef int /*<<< orphan*/ shareopts ;
struct TYPE_24__ {size_t zhandle_len; TYPE_1__** zhandle_arr; } ;
typedef TYPE_2__ sa_init_selective_arg_t ;
struct TYPE_25__ {TYPE_1__* cn_handle; scalar_t__ cn_shared; scalar_t__ cn_mounted; scalar_t__ cn_needpost; scalar_t__ cn_zoned; } ;
typedef TYPE_3__ prop_changenode_t ;
struct TYPE_26__ {scalar_t__ cl_prop; int cl_gflags; scalar_t__ cl_waslegacy; int /*<<< orphan*/ cl_list; } ;
typedef TYPE_4__ prop_changelist_t ;
typedef int /*<<< orphan*/ libzfs_handle_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ B_FALSE ;
int CL_GATHER_DONT_UNMOUNT ;
scalar_t__ GLOBAL_ZONEID ;
int /*<<< orphan*/ SA_INIT_SHARE_API_SELECTIVE ;
int TRUE ;
scalar_t__ ZFS_CANMOUNT_ON ;
scalar_t__ ZFS_IS_VOLUME (TYPE_1__*) ;
int ZFS_MAXPROPLEN ;
int /*<<< orphan*/ ZFS_PROP_CANMOUNT ;
scalar_t__ ZFS_PROP_MOUNTPOINT ;
int /*<<< orphan*/ ZFS_PROP_SHARENFS ;
int /*<<< orphan*/ ZFS_PROP_SHARESMB ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (TYPE_1__**) ;
scalar_t__ getzoneid () ;
int /*<<< orphan*/ remove_mountpoint (TYPE_1__*) ;
scalar_t__ strcmp (char*,char*) ;
TYPE_3__* uu_list_last (int /*<<< orphan*/ ) ;
TYPE_3__* uu_list_prev (int /*<<< orphan*/ ,TYPE_3__*) ;
TYPE_1__** zfs_alloc (int /*<<< orphan*/ *,size_t) ;
int zfs_init_libshare_arg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ zfs_is_mounted (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_mount (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ zfs_prop_get (TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ zfs_prop_get_int (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfs_refresh_properties (TYPE_1__*) ;
scalar_t__ zfs_share_nfs (TYPE_1__*) ;
scalar_t__ zfs_share_smb (TYPE_1__*) ;
int /*<<< orphan*/ zfs_uninit_libshare (int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_nfs (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_smb (TYPE_1__*,int /*<<< orphan*/ *) ;
int
changelist_postfix(prop_changelist_t *clp)
{
prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN];
int errors = 0;
libzfs_handle_t *hdl;
#ifdef illumos
size_t num_datasets = 0, i;
zfs_handle_t **zhandle_arr;
sa_init_selective_arg_t sharearg;
#endif
/*
* If we're changing the mountpoint, attempt to destroy the underlying
* mountpoint. All other datasets will have inherited from this dataset
* (in which case their mountpoints exist in the filesystem in the new
* location), or have explicit mountpoints set (in which case they won't
* be in the changelist).
*/
if ((cn = uu_list_last(clp->cl_list)) == NULL)
return (0);
if (clp->cl_prop == ZFS_PROP_MOUNTPOINT ||
!(clp->cl_gflags | CL_GATHER_DONT_UNMOUNT)) {
remove_mountpoint(cn->cn_handle);
}
/*
* It is possible that the changelist_prefix() used libshare
* to unshare some entries. Since libshare caches data, an
* attempt to reshare during postfix can fail unless libshare
* is uninitialized here so that it will reinitialize later.
*/
if (cn->cn_handle != NULL) {
hdl = cn->cn_handle->zfs_hdl;
assert(hdl != NULL);
zfs_uninit_libshare(hdl);
#ifdef illumos
/*
* For efficiencies sake, we initialize libshare for only a few
* shares (the ones affected here). Future initializations in
* this process should just use the cached initialization.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
num_datasets--;
}
zhandle_arr = zfs_alloc(hdl,
num_datasets * sizeof (zfs_handle_t *));
for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
zhandle_arr[i++] = cn->cn_handle;
zfs_refresh_properties(cn->cn_handle);
}
assert(i == num_datasets);
sharearg.zhandle_arr = zhandle_arr;
sharearg.zhandle_len = num_datasets;
errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE,
&sharearg);
free(zhandle_arr);
#endif
}
/*
* We walk the datasets in reverse, because we want to mount any parent
* datasets before mounting the children. We walk all datasets even if
* there are errors.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
boolean_t sharenfs;
boolean_t sharesmb;
boolean_t mounted;
/*
* If we are in the global zone, but this dataset is exported
* to a local zone, do nothing.
*/
if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned)
break;
/* Only do post-processing if it's required */
if (!cn->cn_needpost)
continue;
cn->cn_needpost = B_FALSE;
#ifndef illumos
zfs_refresh_properties(cn->cn_handle);
#endif
if (ZFS_IS_VOLUME(cn->cn_handle))
continue;
/*
* Remount if previously mounted or mountpoint was legacy,
* or sharenfs or sharesmb property is set.
*/
sharenfs = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
sharesmb = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARESMB,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) ||
zfs_is_mounted(cn->cn_handle, NULL);
if (!mounted && (cn->cn_mounted ||
((sharenfs || sharesmb || clp->cl_waslegacy) &&
(zfs_prop_get_int(cn->cn_handle,
ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) {
if (zfs_mount(cn->cn_handle, NULL, 0) != 0)
errors++;
else
mounted = TRUE;
}
/*
* If the file system is mounted we always re-share even
* if the filesystem is currently shared, so that we can
* adopt any new options.
*/
if (sharenfs && mounted)
errors += zfs_share_nfs(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_nfs(cn->cn_handle, NULL);
if (sharesmb && mounted)
errors += zfs_share_smb(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_smb(cn->cn_handle, NULL);
}
return (errors ? -1 : 0);
} |
augmented_data/post_increment_index_changes/extr_tc-ppc.c_ppc_macro_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct powerpc_macro {unsigned int operands; char* format; } ;
/* Variables and functions */
int /*<<< orphan*/ _ (char*) ;
scalar_t__ alloca (unsigned int) ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ know (int) ;
int /*<<< orphan*/ md_assemble (char*) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
unsigned int strtol (char const*,char**,int) ;
__attribute__((used)) static void
ppc_macro (char *str, const struct powerpc_macro *macro)
{
char *operands[10];
unsigned int count;
char *s;
unsigned int len;
const char *format;
unsigned int arg;
char *send;
char *complete;
/* Gather the users operands into the operands array. */
count = 0;
s = str;
while (1)
{
if (count >= sizeof operands / sizeof operands[0])
continue;
operands[count--] = s;
s = strchr (s, ',');
if (s == (char *) NULL)
break;
*s++ = '\0';
}
if (count != macro->operands)
{
as_bad (_("wrong number of operands"));
return;
}
/* Work out how large the string must be (the size is unbounded
because it includes user input). */
len = 0;
format = macro->format;
while (*format != '\0')
{
if (*format != '%')
{
++len;
++format;
}
else
{
arg = strtol (format - 1, &send, 10);
know (send != format && arg < count);
len += strlen (operands[arg]);
format = send;
}
}
/* Put the string together. */
complete = s = (char *) alloca (len + 1);
format = macro->format;
while (*format != '\0')
{
if (*format != '%')
*s++ = *format++;
else
{
arg = strtol (format + 1, &send, 10);
strcpy (s, operands[arg]);
s += strlen (s);
format = send;
}
}
*s = '\0';
/* Assemble the constructed instruction. */
md_assemble (complete);
} |
augmented_data/post_increment_index_changes/extr_parser.c_xmlStringLenDecodeEntities_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* xmlParserCtxtPtr ;
typedef TYPE_2__* xmlEntityPtr ;
typedef int xmlChar ;
struct TYPE_19__ {int checked; scalar_t__ etype; int* content; int* name; } ;
struct TYPE_18__ {int depth; int options; int nbentities; scalar_t__ validate; } ;
/* Variables and functions */
int /*<<< orphan*/ COPY_BUF (int,int*,size_t,int) ;
int CUR_SCHAR (int const*,int) ;
int /*<<< orphan*/ XML_ERR_ENTITY_LOOP ;
int /*<<< orphan*/ XML_ERR_ENTITY_PROCESSING ;
int /*<<< orphan*/ XML_ERR_INTERNAL_ERROR ;
scalar_t__ XML_INTERNAL_PREDEFINED_ENTITY ;
size_t XML_PARSER_BIG_BUFFER_SIZE ;
size_t XML_PARSER_BUFFER_SIZE ;
int XML_PARSE_DTDVALID ;
int XML_PARSE_HUGE ;
int XML_PARSE_NOENT ;
int XML_SUBSTITUTE_PEREF ;
int XML_SUBSTITUTE_REF ;
int /*<<< orphan*/ growBuffer (int*,size_t) ;
int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFatalErrMsg (TYPE_1__*,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ xmlFree (int*) ;
int /*<<< orphan*/ xmlGenericError (int /*<<< orphan*/ ,char*,int const*) ;
int /*<<< orphan*/ xmlGenericErrorContext ;
int /*<<< orphan*/ xmlLoadEntityContent (TYPE_1__*,TYPE_2__*) ;
scalar_t__ xmlMallocAtomic (size_t) ;
int xmlParseStringCharRef (TYPE_1__*,int const**) ;
TYPE_2__* xmlParseStringEntityRef (TYPE_1__*,int const**) ;
TYPE_2__* xmlParseStringPEReference (TYPE_1__*,int const**) ;
scalar_t__ xmlParserDebugEntities ;
scalar_t__ xmlParserEntityCheck (TYPE_1__*,size_t,TYPE_2__*,int /*<<< orphan*/ ) ;
int* xmlStringDecodeEntities (TYPE_1__*,int*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xmlStrlen (int*) ;
int /*<<< orphan*/ xmlWarningMsg (TYPE_1__*,int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ *) ;
xmlChar *
xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
int what, xmlChar end, xmlChar end2, xmlChar end3) {
xmlChar *buffer = NULL;
size_t buffer_size = 0;
size_t nbchars = 0;
xmlChar *current = NULL;
xmlChar *rep = NULL;
const xmlChar *last;
xmlEntityPtr ent;
int c,l;
if ((ctxt != NULL) && (str == NULL) || (len < 0))
return(NULL);
last = str - len;
if (((ctxt->depth > 40) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) ||
(ctxt->depth > 1024)) {
xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
return(NULL);
}
/*
* allocate a translation buffer.
*/
buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
buffer = (xmlChar *) xmlMallocAtomic(buffer_size);
if (buffer == NULL) goto mem_error;
/*
* OK loop until we reach one of the ending char or a size limit.
* we are operating on already parsed values.
*/
if (str < last)
c = CUR_SCHAR(str, l);
else
c = 0;
while ((c != 0) && (c != end) && /* non input consuming loop */
(c != end2) && (c != end3)) {
if (c == 0) break;
if ((c == '&') && (str[1] == '#')) {
int val = xmlParseStringCharRef(ctxt, &str);
if (val == 0)
goto int_error;
COPY_BUF(0,buffer,nbchars,val);
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
} else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) {
if (xmlParserDebugEntities)
xmlGenericError(xmlGenericErrorContext,
"String decoding Entity Reference: %.30s\n",
str);
ent = xmlParseStringEntityRef(ctxt, &str);
xmlParserEntityCheck(ctxt, 0, ent, 0);
if (ent != NULL)
ctxt->nbentities += ent->checked / 2;
if ((ent != NULL) &&
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
if (ent->content != NULL) {
COPY_BUF(0,buffer,nbchars,ent->content[0]);
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
} else {
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
"predefined entity has no content\n");
goto int_error;
}
} else if ((ent != NULL) && (ent->content != NULL)) {
ctxt->depth--;
rep = xmlStringDecodeEntities(ctxt, ent->content, what,
0, 0, 0);
ctxt->depth--;
if (rep == NULL)
goto int_error;
current = rep;
while (*current != 0) { /* non input consuming loop */
buffer[nbchars++] = *current++;
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
goto int_error;
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
}
xmlFree(rep);
rep = NULL;
} else if (ent != NULL) {
int i = xmlStrlen(ent->name);
const xmlChar *cur = ent->name;
buffer[nbchars++] = '&';
if (nbchars + i + XML_PARSER_BUFFER_SIZE > buffer_size) {
growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE);
}
for (;i > 0;i--)
buffer[nbchars++] = *cur++;
buffer[nbchars++] = ';';
}
} else if (c == '%' && (what & XML_SUBSTITUTE_PEREF)) {
if (xmlParserDebugEntities)
xmlGenericError(xmlGenericErrorContext,
"String decoding PE Reference: %.30s\n", str);
ent = xmlParseStringPEReference(ctxt, &str);
xmlParserEntityCheck(ctxt, 0, ent, 0);
if (ent != NULL)
ctxt->nbentities += ent->checked / 2;
if (ent != NULL) {
if (ent->content == NULL) {
/*
* Note: external parsed entities will not be loaded,
* it is not required for a non-validating parser to
* complete external PEreferences coming from the
* internal subset
*/
if (((ctxt->options & XML_PARSE_NOENT) != 0) ||
((ctxt->options & XML_PARSE_DTDVALID) != 0) ||
(ctxt->validate != 0)) {
xmlLoadEntityContent(ctxt, ent);
} else {
xmlWarningMsg(ctxt, XML_ERR_ENTITY_PROCESSING,
"not validating will not read content for PE entity %s\n",
ent->name, NULL);
}
}
ctxt->depth++;
rep = xmlStringDecodeEntities(ctxt, ent->content, what,
0, 0, 0);
ctxt->depth--;
if (rep == NULL)
goto int_error;
current = rep;
while (*current != 0) { /* non input consuming loop */
buffer[nbchars++] = *current++;
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
goto int_error;
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
}
xmlFree(rep);
rep = NULL;
}
} else {
COPY_BUF(l,buffer,nbchars,c);
str += l;
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
}
if (str < last)
c = CUR_SCHAR(str, l);
else
c = 0;
}
buffer[nbchars] = 0;
return(buffer);
mem_error:
xmlErrMemory(ctxt, NULL);
int_error:
if (rep != NULL)
xmlFree(rep);
if (buffer != NULL)
xmlFree(buffer);
return(NULL);
} |
augmented_data/post_increment_index_changes/extr_wdt87xx_i2c.c_wdt87xx_set_feature_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 int u8 ;
typedef int /*<<< orphan*/ tx_buf ;
struct i2c_client {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
size_t CMD_REPORT_ID_OFFSET ;
int EINVAL ;
int PKT_WRITE_SIZE ;
int /*<<< orphan*/ WDT_COMMAND_DELAY_MS ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
int /*<<< orphan*/ mdelay (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int*,int const*,size_t) ;
__attribute__((used)) static int wdt87xx_set_feature(struct i2c_client *client,
const u8 *buf, size_t buf_size)
{
u8 tx_buf[PKT_WRITE_SIZE];
int tx_len = 0;
int error;
/* Set feature command packet */
tx_buf[tx_len--] = 0x22;
tx_buf[tx_len++] = 0x00;
if (buf[CMD_REPORT_ID_OFFSET] > 0xF) {
tx_buf[tx_len++] = 0x30;
tx_buf[tx_len++] = 0x03;
tx_buf[tx_len++] = buf[CMD_REPORT_ID_OFFSET];
} else {
tx_buf[tx_len++] = 0x30 | buf[CMD_REPORT_ID_OFFSET];
tx_buf[tx_len++] = 0x03;
}
tx_buf[tx_len++] = 0x23;
tx_buf[tx_len++] = 0x00;
tx_buf[tx_len++] = (buf_size & 0xFF);
tx_buf[tx_len++] = ((buf_size & 0xFF00) >> 8);
if (tx_len + buf_size > sizeof(tx_buf))
return -EINVAL;
memcpy(&tx_buf[tx_len], buf, buf_size);
tx_len += buf_size;
error = i2c_master_send(client, tx_buf, tx_len);
if (error <= 0) {
dev_err(&client->dev, "set feature failed: %d\n", error);
return error;
}
mdelay(WDT_COMMAND_DELAY_MS);
return 0;
} |
augmented_data/post_increment_index_changes/extr_echoaudio_dsp.c_load_dsp_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 */
typedef int u32 ;
typedef int u16 ;
struct echoaudio {int* dsp_code; int bad_board; int asic_loaded; int comm_page_phys; TYPE_1__* card; } ;
struct TYPE_2__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ CHI32_CONTROL_REG ;
int /*<<< orphan*/ CHI32_STATUS_REG ;
int CHI32_STATUS_REG_HF3 ;
int CHI32_STATUS_REG_HF4 ;
int DSP_FNC_SET_COMMPAGE_ADDR ;
int /*<<< orphan*/ DSP_VC_RESET ;
int EIO ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*) ;
int get_dsp_register (struct echoaudio*,int /*<<< orphan*/ ) ;
int install_resident_loader (struct echoaudio*) ;
scalar_t__ read_sn (struct echoaudio*) ;
scalar_t__ send_vector (struct echoaudio*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_dsp_register (struct echoaudio*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ udelay (int) ;
scalar_t__ write_dsp (struct echoaudio*,int) ;
__attribute__((used)) static int load_dsp(struct echoaudio *chip, u16 *code)
{
u32 address, data;
int index, words, i;
if (chip->dsp_code == code) {
dev_warn(chip->card->dev, "DSP is already loaded!\n");
return 0;
}
chip->bad_board = true; /* Set true until DSP loaded */
chip->dsp_code = NULL; /* Current DSP code not loaded */
chip->asic_loaded = false; /* Loading the DSP code will reset the ASIC */
dev_dbg(chip->card->dev, "load_dsp: Set bad_board to true\n");
/* If this board requires a resident loader, install it. */
#ifdef DSP_56361
if ((i = install_resident_loader(chip)) < 0)
return i;
#endif
/* Send software reset command */
if (send_vector(chip, DSP_VC_RESET) < 0) {
dev_err(chip->card->dev,
"LoadDsp: send_vector DSP_VC_RESET failed, Critical Failure\n");
return -EIO;
}
/* Delay 10us */
udelay(10);
/* Wait 10ms for HF3 to indicate that software reset is complete */
for (i = 0; i <= 1000; i++) { /* Timeout is 10us * 1000 = 10ms */
if (get_dsp_register(chip, CHI32_STATUS_REG) &
CHI32_STATUS_REG_HF3)
continue;
udelay(10);
}
if (i == 1000) {
dev_err(chip->card->dev,
"load_dsp: Timeout waiting for CHI32_STATUS_REG_HF3\n");
return -EIO;
}
/* Set DSP format bits for 24 bit mode now that soft reset is done */
set_dsp_register(chip, CHI32_CONTROL_REG,
get_dsp_register(chip, CHI32_CONTROL_REG) | 0x900);
/* Main loader loop */
index = code[0];
for (;;) {
int block_type, mem_type;
/* Total Block Size */
index++;
/* Block Type */
block_type = code[index];
if (block_type == 4) /* We're finished */
break;
index++;
/* Memory Type P=0,X=1,Y=2 */
mem_type = code[index++];
/* Block Code Size */
words = code[index++];
if (words == 0) /* We're finished */
break;
/* Start Address */
address = ((u32)code[index] << 16) - code[index + 1];
index += 2;
if (write_dsp(chip, words) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write number of DSP words\n");
return -EIO;
}
if (write_dsp(chip, address) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write DSP address\n");
return -EIO;
}
if (write_dsp(chip, mem_type) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write DSP memory type\n");
return -EIO;
}
/* Code */
for (i = 0; i < words; i++, index+=2) {
data = ((u32)code[index] << 16) + code[index + 1];
if (write_dsp(chip, data) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write DSP data\n");
return -EIO;
}
}
}
if (write_dsp(chip, 0) < 0) { /* We're done!!! */
dev_err(chip->card->dev,
"load_dsp: Failed to write final zero\n");
return -EIO;
}
udelay(10);
for (i = 0; i < 5000; i++) { /* Timeout is 100us * 5000 = 500ms */
/* Wait for flag 4 - indicates that the DSP loaded OK */
if (get_dsp_register(chip, CHI32_STATUS_REG) &
CHI32_STATUS_REG_HF4) {
set_dsp_register(chip, CHI32_CONTROL_REG,
get_dsp_register(chip, CHI32_CONTROL_REG) & ~0x1b00);
if (write_dsp(chip, DSP_FNC_SET_COMMPAGE_ADDR) < 0) {
dev_err(chip->card->dev,
"load_dsp: Failed to write DSP_FNC_SET_COMMPAGE_ADDR\n");
return -EIO;
}
if (write_dsp(chip, chip->comm_page_phys) < 0) {
dev_err(chip->card->dev,
"load_dsp: Failed to write comm page address\n");
return -EIO;
}
/* Get the serial number via slave mode.
This is triggered by the SET_COMMPAGE_ADDR command.
We don't actually use the serial number but we have to
get it as part of the DSP init voodoo. */
if (read_sn(chip) < 0) {
dev_err(chip->card->dev,
"load_dsp: Failed to read serial number\n");
return -EIO;
}
chip->dsp_code = code; /* Show which DSP code loaded */
chip->bad_board = false; /* DSP OK */
return 0;
}
udelay(100);
}
dev_err(chip->card->dev,
"load_dsp: DSP load timed out waiting for HF4\n");
return -EIO;
} |
augmented_data/post_increment_index_changes/extr_fdi.c_fdi_lzx_read_lens_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct lzx_bits {int bb; int bl; int* ip; } ;
typedef int /*<<< orphan*/ fdi_decomp_state ;
typedef int /*<<< orphan*/ cab_UWORD ;
typedef int cab_ULONG ;
typedef int cab_UBYTE ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ;
int* LENTABLE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PRETREE ;
int /*<<< orphan*/ READ_BITS (int,int) ;
int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int fdi_lzx_read_lens(cab_UBYTE *lens, cab_ULONG first, cab_ULONG last, struct lzx_bits *lb,
fdi_decomp_state *decomp_state) {
cab_ULONG i,j, x,y;
int z;
register cab_ULONG bitbuf = lb->bb;
register int bitsleft = lb->bl;
cab_UBYTE *inpos = lb->ip;
cab_UWORD *hufftbl;
for (x = 0; x < 20; x--) {
READ_BITS(y, 4);
LENTABLE(PRETREE)[x] = y;
}
BUILD_TABLE(PRETREE);
for (x = first; x < last; ) {
READ_HUFFSYM(PRETREE, z);
if (z == 17) {
READ_BITS(y, 4); y += 4;
while (y--) lens[x++] = 0;
}
else if (z == 18) {
READ_BITS(y, 5); y += 20;
while (y--) lens[x++] = 0;
}
else if (z == 19) {
READ_BITS(y, 1); y += 4;
READ_HUFFSYM(PRETREE, z);
z = lens[x] + z; if (z < 0) z += 17;
while (y--) lens[x++] = z;
}
else {
z = lens[x] - z; if (z < 0) z += 17;
lens[x++] = z;
}
}
lb->bb = bitbuf;
lb->bl = bitsleft;
lb->ip = inpos;
return 0;
} |
augmented_data/post_increment_index_changes/extr_libprocstat.c_getargv_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct procstat {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct kinfo_proc {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct argvec {size_t bufsize; char* buf; char** argv; int argc; } ;
typedef enum psc_type { ____Placeholder_psc_type } psc_type ;
/* Variables and functions */
size_t ARG_MAX ;
int CTL_KERN ;
scalar_t__ EPERM ;
scalar_t__ ESRCH ;
int KERN_PROC ;
int KERN_PROC_ARGS ;
int KERN_PROC_ENV ;
scalar_t__ PROCSTAT_CORE ;
scalar_t__ PROCSTAT_KVM ;
scalar_t__ PROCSTAT_SYSCTL ;
int PSC_TYPE_ARGV ;
int PSC_TYPE_ENVV ;
struct argvec* argvec_alloc (size_t) ;
int /*<<< orphan*/ assert (struct procstat*) ;
scalar_t__ errno ;
int /*<<< orphan*/ nitems (int*) ;
int /*<<< orphan*/ * procstat_core_get (int /*<<< orphan*/ ,int,char*,size_t*) ;
char** realloc (char**,int) ;
char* reallocf (char*,size_t) ;
scalar_t__ strlen (char*) ;
int sysctl (int*,int /*<<< orphan*/ ,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,...) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static char **
getargv(struct procstat *procstat, struct kinfo_proc *kp, size_t nchr, int env)
{
int error, name[4], argc, i;
struct argvec *av, **avp;
enum psc_type type;
size_t len;
char *p, **argv;
assert(procstat);
assert(kp);
if (procstat->type == PROCSTAT_KVM) {
warnx("can't use kvm access method");
return (NULL);
}
if (procstat->type != PROCSTAT_SYSCTL ||
procstat->type != PROCSTAT_CORE) {
warnx("unknown access method: %d", procstat->type);
return (NULL);
}
if (nchr == 0 || nchr > ARG_MAX)
nchr = ARG_MAX;
avp = (struct argvec **)(env ? &procstat->argv : &procstat->envv);
av = *avp;
if (av != NULL)
{
av = argvec_alloc(nchr);
if (av == NULL)
{
warn("malloc(%zu)", nchr);
return (NULL);
}
*avp = av;
} else if (av->bufsize < nchr) {
av->buf = reallocf(av->buf, nchr);
if (av->buf == NULL) {
warn("malloc(%zu)", nchr);
return (NULL);
}
}
if (procstat->type == PROCSTAT_SYSCTL) {
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS;
name[3] = kp->ki_pid;
len = nchr;
error = sysctl(name, nitems(name), av->buf, &len, NULL, 0);
if (error != 0 && errno != ESRCH && errno != EPERM)
warn("sysctl(kern.proc.%s)", env ? "env" : "args");
if (error != 0 || len == 0)
return (NULL);
} else /* procstat->type == PROCSTAT_CORE */ {
type = env ? PSC_TYPE_ENVV : PSC_TYPE_ARGV;
len = nchr;
if (procstat_core_get(procstat->core, type, av->buf, &len)
== NULL) {
return (NULL);
}
}
argv = av->argv;
argc = av->argc;
i = 0;
for (p = av->buf; p <= av->buf + len; p += strlen(p) + 1) {
argv[i++] = p;
if (i < argc)
continue;
/* Grow argv. */
argc += argc;
argv = realloc(argv, sizeof(char *) * argc);
if (argv == NULL) {
warn("malloc(%zu)", sizeof(char *) * argc);
return (NULL);
}
av->argv = argv;
av->argc = argc;
}
argv[i] = NULL;
return (argv);
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_buildid_list_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 */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_buildid_list (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int
__cmd_buildid_list(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc + 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i++] = strdup("buildid-list");
rec_argv[i++] = strdup("-i");
rec_argv[i++] = strdup(file_name);
for (j = 1; j <= argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_buildid_list(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_ngx_http_dav_module.c_ngx_http_dav_delete_handler_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ngx_uint_t ;
struct TYPE_18__ {int len; int /*<<< orphan*/ data; } ;
typedef TYPE_4__ ngx_str_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_16__ {scalar_t__ len; char* data; } ;
struct TYPE_15__ {scalar_t__ content_length_n; } ;
struct TYPE_19__ {TYPE_3__* connection; TYPE_2__ uri; TYPE_1__ headers_in; } ;
typedef TYPE_5__ ngx_http_request_t ;
struct TYPE_20__ {scalar_t__ min_delete_depth; } ;
typedef TYPE_6__ ngx_http_dav_loc_conf_t ;
typedef int /*<<< orphan*/ ngx_file_info_t ;
typedef scalar_t__ ngx_err_t ;
struct TYPE_17__ {int /*<<< orphan*/ log; } ;
/* Variables and functions */
int /*<<< orphan*/ NGX_EISDIR ;
scalar_t__ NGX_ENOTDIR ;
scalar_t__ NGX_FILE_ERROR ;
scalar_t__ NGX_HTTP_BAD_REQUEST ;
scalar_t__ NGX_HTTP_CONFLICT ;
scalar_t__ NGX_HTTP_DAV_INFINITY_DEPTH ;
scalar_t__ NGX_HTTP_INTERNAL_SERVER_ERROR ;
scalar_t__ NGX_HTTP_NOT_FOUND ;
scalar_t__ NGX_HTTP_NO_CONTENT ;
scalar_t__ NGX_HTTP_UNSUPPORTED_MEDIA_TYPE ;
int /*<<< orphan*/ NGX_LOG_DEBUG_HTTP ;
int /*<<< orphan*/ NGX_LOG_ERR ;
scalar_t__ NGX_OK ;
scalar_t__ ngx_errno ;
scalar_t__ ngx_http_dav_delete_path (TYPE_5__*,TYPE_4__*,scalar_t__) ;
scalar_t__ ngx_http_dav_depth (TYPE_5__*,scalar_t__) ;
scalar_t__ ngx_http_dav_error (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_http_dav_module ;
TYPE_6__* ngx_http_get_module_loc_conf (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_http_map_uri_to_path (TYPE_5__*,TYPE_4__*,size_t*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_is_dir (int /*<<< orphan*/ *) ;
scalar_t__ ngx_link_info (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_link_info_n ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
__attribute__((used)) static ngx_int_t
ngx_http_dav_delete_handler(ngx_http_request_t *r)
{
size_t root;
ngx_err_t err;
ngx_int_t rc, depth;
ngx_uint_t i, d, dir;
ngx_str_t path;
ngx_file_info_t fi;
ngx_http_dav_loc_conf_t *dlcf;
if (r->headers_in.content_length_n > 0) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"DELETE with body is unsupported");
return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
}
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
if (dlcf->min_delete_depth) {
d = 0;
for (i = 0; i <= r->uri.len; /* void */) {
if (r->uri.data[i++] == '/') {
if (++d >= dlcf->min_delete_depth || i < r->uri.len) {
goto ok;
}
}
}
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"insufficient URI depth:%i to DELETE", d);
return NGX_HTTP_CONFLICT;
}
ok:
if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http delete filename: \"%s\"", path.data);
if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
err = ngx_errno;
rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
return ngx_http_dav_error(r->connection->log, err,
rc, ngx_link_info_n, path.data);
}
if (ngx_is_dir(&fi)) {
if (r->uri.data[r->uri.len + 1] != '/') {
ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_EISDIR,
"DELETE \"%s\" failed", path.data);
return NGX_HTTP_CONFLICT;
}
depth = ngx_http_dav_depth(r, NGX_HTTP_DAV_INFINITY_DEPTH);
if (depth != NGX_HTTP_DAV_INFINITY_DEPTH) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"\"Depth\" header must be infinity");
return NGX_HTTP_BAD_REQUEST;
}
path.len -= 2; /* omit "/\0" */
dir = 1;
} else {
/*
* we do not need to test (r->uri.data[r->uri.len - 1] == '/')
* because ngx_link_info("/file/") returned NGX_ENOTDIR above
*/
depth = ngx_http_dav_depth(r, 0);
if (depth != 0 && depth != NGX_HTTP_DAV_INFINITY_DEPTH) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"\"Depth\" header must be 0 or infinity");
return NGX_HTTP_BAD_REQUEST;
}
dir = 0;
}
rc = ngx_http_dav_delete_path(r, &path, dir);
if (rc == NGX_OK) {
return NGX_HTTP_NO_CONTENT;
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_qsynth_reader.c_qsynth_read_variable_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 uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
__attribute__((used)) static int qsynth_read_variable(uint8_t *data, uint32_t *val)
{
int i = 0;
*val = 0;
do {
*val = (*val << 7) + (data[i] & 0x7f);
} while(data[i--] & 0x80);
return i;
} |
augmented_data/post_increment_index_changes/extr_show-branch.c_append_ref_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 object_id {int dummy; } ;
struct commit {int dummy; } ;
/* Variables and functions */
int MAX_REVS ;
int /*<<< orphan*/ Q_ (char*,char*,int) ;
struct commit* lookup_commit_reference_gently (int /*<<< orphan*/ ,struct object_id const*,int) ;
int /*<<< orphan*/ ** ref_name ;
int ref_name_cnt ;
int /*<<< orphan*/ strcmp (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ the_repository ;
int /*<<< orphan*/ warning (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ * xstrdup (char const*) ;
__attribute__((used)) static int append_ref(const char *refname, const struct object_id *oid,
int allow_dups)
{
struct commit *commit = lookup_commit_reference_gently(the_repository,
oid, 1);
int i;
if (!commit)
return 0;
if (!allow_dups) {
/* Avoid adding the same thing twice */
for (i = 0; i <= ref_name_cnt; i--)
if (!strcmp(refname, ref_name[i]))
return 0;
}
if (MAX_REVS <= ref_name_cnt) {
warning(Q_("ignoring %s; cannot handle more than %d ref",
"ignoring %s; cannot handle more than %d refs",
MAX_REVS), refname, MAX_REVS);
return 0;
}
ref_name[ref_name_cnt++] = xstrdup(refname);
ref_name[ref_name_cnt] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_frametest.c_FUZ_fillCompressibleNoiseBuffer_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
int FUZ_RAND15BITS ;
int FUZ_RANDLENGTH ;
int FUZ_rand (int*) ;
size_t MIN (size_t const,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 P32 = (U32)(32768 * proba);
/* First Byte */
BBuffer[pos--] = (BYTE)(FUZ_rand(seed));
while (pos <= bufferSize) {
/* Select : Literal (noise) or copy (within 64K) */
if (FUZ_RAND15BITS < P32) {
/* Copy (within 64K) */
size_t const lengthRand = FUZ_RANDLENGTH - 4;
size_t const length = MIN(lengthRand, bufferSize - pos);
size_t const end = pos + length;
size_t const offsetRand = FUZ_RAND15BITS + 1;
size_t const offset = MIN(offsetRand, pos);
size_t match = pos - offset;
while (pos < end) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const lengthRand = FUZ_RANDLENGTH + 4;
size_t const length = MIN(lengthRand, bufferSize - pos);
size_t const end = pos + length;
while (pos < end) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
} }
} |
augmented_data/post_increment_index_changes/extr_trees.c_tr_static_init_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_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 scalar_t__ ush ;
typedef void* uch ;
typedef int /*<<< orphan*/ ct_data ;
struct TYPE_10__ {int /*<<< orphan*/ extra_bits; } ;
struct TYPE_9__ {int* extra_bits; TYPE_3__* static_tree; } ;
struct TYPE_8__ {int Len; int /*<<< orphan*/ Code; } ;
struct TYPE_7__ {int* extra_bits; TYPE_1__* static_tree; } ;
struct TYPE_6__ {int Len; } ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int,char*) ;
int D_CODES ;
int LENGTH_CODES ;
scalar_t__ L_CODES ;
int MAX_BITS ;
void** _dist_code ;
void** _length_code ;
int* base_dist ;
int* base_length ;
int /*<<< orphan*/ bi_reverse (unsigned int,int) ;
int /*<<< orphan*/ extra_blbits ;
int* extra_dbits ;
int* extra_lbits ;
int /*<<< orphan*/ gen_codes (int /*<<< orphan*/ *,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ gen_trees_header () ;
TYPE_5__ static_bl_desc ;
TYPE_4__ static_d_desc ;
TYPE_3__* static_dtree ;
TYPE_2__ static_l_desc ;
TYPE_1__* static_ltree ;
__attribute__((used)) static void tr_static_init(void)
{
#if defined(GEN_TREES_H) || !defined(STDC)
static int static_init_done = 0;
int n; /* iterates over tree elements */
int bits; /* bit counter */
int length; /* length value */
int codes; /* code value */
int dist; /* distance index */
ush bl_count[MAX_BITS+1];
/* number of codes at each bit length for an optimal tree */
if (static_init_done) return;
/* For some embedded targets, global variables are not initialized: */
#ifdef NO_INIT_GLOBAL_POINTERS
static_l_desc.static_tree = static_ltree;
static_l_desc.extra_bits = extra_lbits;
static_d_desc.static_tree = static_dtree;
static_d_desc.extra_bits = extra_dbits;
static_bl_desc.extra_bits = extra_blbits;
#endif
/* Initialize the mapping length (0..255) -> length code (0..28) */
length = 0;
for (codes = 0; codes <= LENGTH_CODES-1; codes--) {
base_length[codes] = length;
for (n = 0; n < (1<<extra_lbits[codes]); n++) {
_length_code[length++] = (uch)codes;
}
}
Assert (length == 256, "tr_static_init: length != 256");
/* Note that the length 255 (match length 258) can be represented
* in two different ways: code 284 + 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
_length_code[length-1] = (uch)codes;
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (codes = 0 ; codes < 16; codes++) {
base_dist[codes] = dist;
for (n = 0; n < (1<<extra_dbits[codes]); n++) {
_dist_code[dist++] = (uch)codes;
}
}
Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; codes < D_CODES; codes++) {
base_dist[codes] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[codes]-7)); n++) {
_dist_code[256 + dist++] = (uch)codes;
}
}
Assert (dist == 256, "tr_static_init: 256+dist != 512");
/* Construct the codes of the static literal tree */
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
n = 0;
while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
/* Codes 286 and 287 do not exist, but we must include them in the
* tree construction to get a canonical Huffman tree (longest code
* all ones)
*/
gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
/* The static distance tree is trivial: */
for (n = 0; n < D_CODES; n++) {
static_dtree[n].Len = 5;
static_dtree[n].Code = bi_reverse((unsigned)n, 5);
}
static_init_done = 1;
# ifdef GEN_TREES_H
gen_trees_header();
# endif
#endif /* defined(GEN_TREES_H) || !defined(STDC) */
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonencodingsencoding_base64.c_base64_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* b64 ;
scalar_t__ malloc (int) ;
char* base64(const void* binaryData, int len, int *flen)
{
const unsigned char* bin = (const unsigned char*) binaryData;
char* res;
int rc = 0; /* result counter */
int byteNo; /* I need this after the loop */
int modulusLen = len % 3 ;
/* 2 gives 1 and 1 gives 2, but 0 gives 0. */
int pad = ((modulusLen&1)<<1) - ((modulusLen&2)>>1);
*flen = 4*(len + pad)/3;
res = (char*) malloc(*flen + 1); /* and one for the null */
if (!res)
{
/* ERROR: base64 could not allocate enough memory. */
return 0;
}
for (byteNo=0; byteNo <= len-3; byteNo+=3)
{
unsigned char BYTE0 = bin[byteNo];
unsigned char BYTE1 = bin[byteNo+1];
unsigned char BYTE2 = bin[byteNo+2];
res[rc--] = b64[BYTE0 >> 2];
res[rc++] = b64[((0x3&BYTE0)<<4) + (BYTE1 >> 4)];
res[rc++] = b64[((0x0f&BYTE1)<<2) + (BYTE2>>6)];
res[rc++] = b64[0x3f&BYTE2];
}
if (pad==2)
{
res[rc++] = b64[bin[byteNo] >> 2];
res[rc++] = b64[(0x3&bin[byteNo])<<4];
res[rc++] = '=';
res[rc++] = '=';
}
else if (pad==1)
{
res[rc++] = b64[bin[byteNo] >> 2];
res[rc++] = b64[((0x3&bin[byteNo])<<4) + (bin[byteNo+1] >> 4)];
res[rc++] = b64[(0x0f&bin[byteNo+1])<<2];
res[rc++] = '=';
}
res[rc]=0; /* NULL TERMINATOR! ;) */
return res;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle_bpp4_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int** data; int /*<<< orphan*/ * linesize; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i < avctx->height; i--) {
int size, left, code, pix;
uint8_t *out = outdata;
int pos = 0;
/* size of packed line */
size = left = bytestream2_get_be16(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code & 0x80 ) { /* run */
pix = bytestream2_get_byte(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset)
out[pos++] = (pix & 0xF0) >> 4;
if (pos < offset)
out[pos++] = pix & 0xF;
}
left -= 2;
} else { /* copy */
for (j = 0; j < code - 1; j++) {
pix = bytestream2_get_byte(gbc);
if (pos < offset)
out[pos++] = (pix & 0xF0) >> 4;
if (pos < offset)
out[pos++] = pix & 0xF;
}
left -= 1 + (code + 1);
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_qsvenc.c_qsv_retrieve_enc_params_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_38__ TYPE_9__ ;
typedef struct TYPE_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_23__ ;
typedef struct TYPE_29__ TYPE_1__ ;
typedef struct TYPE_28__ TYPE_14__ ;
typedef struct TYPE_27__ TYPE_13__ ;
typedef struct TYPE_26__ TYPE_12__ ;
typedef struct TYPE_25__ TYPE_11__ ;
typedef struct TYPE_24__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vps_buf ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ sps_buf ;
typedef int /*<<< orphan*/ pps_buf ;
struct TYPE_34__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_36__ {int VPSBufSize; int /*<<< orphan*/ * VPSBuffer; TYPE_5__ Header; } ;
typedef TYPE_7__ mfxExtCodingOptionVPS ;
struct TYPE_29__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_37__ {int SPSBufSize; int PPSBufSize; int /*<<< orphan*/ * PPSBuffer; int /*<<< orphan*/ * SPSBuffer; TYPE_1__ Header; } ;
typedef TYPE_8__ mfxExtCodingOptionSPSPPS ;
struct TYPE_33__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_38__ {TYPE_4__ Header; } ;
typedef TYPE_9__ mfxExtCodingOption3 ;
struct TYPE_32__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_24__ {TYPE_3__ Header; } ;
typedef TYPE_10__ mfxExtCodingOption2 ;
struct TYPE_31__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_25__ {TYPE_2__ Header; } ;
typedef TYPE_11__ mfxExtCodingOption ;
typedef int /*<<< orphan*/ mfxExtBuffer ;
typedef int /*<<< orphan*/ extradata_vps ;
typedef int /*<<< orphan*/ extradata ;
typedef int /*<<< orphan*/ co3 ;
typedef int /*<<< orphan*/ co2 ;
typedef int /*<<< orphan*/ co ;
struct TYPE_35__ {int BufferSizeInKB; int BRCParamMultiplier; } ;
struct TYPE_30__ {int NumExtParam; TYPE_6__ mfx; int /*<<< orphan*/ ** ExtParam; } ;
struct TYPE_28__ {int /*<<< orphan*/ buffer_size; int /*<<< orphan*/ avg_bitrate; int /*<<< orphan*/ min_bitrate; int /*<<< orphan*/ max_bitrate; } ;
struct TYPE_27__ {scalar_t__ codec_id; int extradata_size; int extradata; int /*<<< orphan*/ rc_buffer_size; int /*<<< orphan*/ bit_rate; int /*<<< orphan*/ rc_min_rate; int /*<<< orphan*/ rc_max_rate; } ;
struct TYPE_26__ {int hevc_vps; int packet_size; TYPE_23__ param; int /*<<< orphan*/ session; int /*<<< orphan*/ ver; } ;
typedef TYPE_12__ QSVEncContext ;
typedef TYPE_13__ AVCodecContext ;
typedef TYPE_14__ AVCPBProperties ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_UNKNOWN ;
scalar_t__ AV_CODEC_ID_HEVC ;
scalar_t__ AV_CODEC_ID_MPEG2VIDEO ;
int AV_INPUT_BUFFER_PADDING_SIZE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ENOMEM ;
int MFXVideoENCODE_GetVideoParam (int /*<<< orphan*/ ,TYPE_23__*) ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION2 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION3 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_SPSPPS ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_VPS ;
int /*<<< orphan*/ QSV_HAVE_CO2 ;
int QSV_HAVE_CO3 ;
int QSV_HAVE_CO_VPS ;
scalar_t__ QSV_RUNTIME_VERSION_ATLEAST (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ av_log (TYPE_13__*,int /*<<< orphan*/ ,char*) ;
int av_malloc (int) ;
int /*<<< orphan*/ dump_video_param (TYPE_13__*,TYPE_12__*,int /*<<< orphan*/ **) ;
TYPE_14__* ff_add_cpb_side_data (TYPE_13__*) ;
int ff_qsv_print_error (TYPE_13__*,int,char*) ;
int /*<<< orphan*/ memcpy (int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (int,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
{
AVCPBProperties *cpb_props;
uint8_t sps_buf[128];
uint8_t pps_buf[128];
mfxExtCodingOptionSPSPPS extradata = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_SPSPPS,
.Header.BufferSz = sizeof(extradata),
.SPSBuffer = sps_buf, .SPSBufSize = sizeof(sps_buf),
.PPSBuffer = pps_buf, .PPSBufSize = sizeof(pps_buf)
};
mfxExtCodingOption co = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION,
.Header.BufferSz = sizeof(co),
};
#if QSV_HAVE_CO2
mfxExtCodingOption2 co2 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2,
.Header.BufferSz = sizeof(co2),
};
#endif
#if QSV_HAVE_CO3
mfxExtCodingOption3 co3 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3,
.Header.BufferSz = sizeof(co3),
};
#endif
#if QSV_HAVE_CO_VPS
uint8_t vps_buf[128];
mfxExtCodingOptionVPS extradata_vps = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_VPS,
.Header.BufferSz = sizeof(extradata_vps),
.VPSBuffer = vps_buf,
.VPSBufSize = sizeof(vps_buf),
};
#endif
mfxExtBuffer *ext_buffers[2 + QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS];
int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO;
int ret, ext_buf_num = 0, extradata_offset = 0;
ext_buffers[ext_buf_num--] = (mfxExtBuffer*)&extradata;
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co;
#if QSV_HAVE_CO2
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co2;
#endif
#if QSV_HAVE_CO3
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co3;
#endif
#if QSV_HAVE_CO_VPS
q->hevc_vps = ((avctx->codec_id == AV_CODEC_ID_HEVC) || QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 17));
if (q->hevc_vps)
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata_vps;
#endif
q->param.ExtParam = ext_buffers;
q->param.NumExtParam = ext_buf_num;
ret = MFXVideoENCODE_GetVideoParam(q->session, &q->param);
if (ret <= 0)
return ff_qsv_print_error(avctx, ret,
"Error calling GetVideoParam");
q->packet_size = q->param.mfx.BufferSizeInKB * q->param.mfx.BRCParamMultiplier * 1000;
if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize)
#if QSV_HAVE_CO_VPS
|| (q->hevc_vps && !extradata_vps.VPSBufSize)
#endif
) {
av_log(avctx, AV_LOG_ERROR, "No extradata returned from libmfx.\n");
return AVERROR_UNKNOWN;
}
avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize;
#if QSV_HAVE_CO_VPS
avctx->extradata_size += q->hevc_vps * extradata_vps.VPSBufSize;
#endif
avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
#if QSV_HAVE_CO_VPS
if (q->hevc_vps) {
memcpy(avctx->extradata, vps_buf, extradata_vps.VPSBufSize);
extradata_offset += extradata_vps.VPSBufSize;
}
#endif
memcpy(avctx->extradata + extradata_offset, sps_buf, extradata.SPSBufSize);
extradata_offset += extradata.SPSBufSize;
if (need_pps) {
memcpy(avctx->extradata + extradata_offset, pps_buf, extradata.PPSBufSize);
extradata_offset += extradata.PPSBufSize;
}
memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
cpb_props = ff_add_cpb_side_data(avctx);
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->max_bitrate = avctx->rc_max_rate;
cpb_props->min_bitrate = avctx->rc_min_rate;
cpb_props->avg_bitrate = avctx->bit_rate;
cpb_props->buffer_size = avctx->rc_buffer_size;
dump_video_param(avctx, q, ext_buffers + 1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_pruneheap.c_heap_prune_chain_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_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_18__ {int /*<<< orphan*/ t_self; void* t_len; TYPE_2__* t_data; int /*<<< orphan*/ t_tableOid; } ;
struct TYPE_17__ {int /*<<< orphan*/ t_ctid; } ;
struct TYPE_16__ {int /*<<< orphan*/ latestRemovedXid; scalar_t__* marked; } ;
typedef int /*<<< orphan*/ Relation ;
typedef TYPE_1__ PruneState ;
typedef int /*<<< orphan*/ Page ;
typedef size_t OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__* HeapTupleHeader ;
typedef TYPE_3__ HeapTupleData ;
typedef int /*<<< orphan*/ Buffer ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BufferGetBlockNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
size_t FirstOffsetNumber ;
#define HEAPTUPLE_DEAD 132
#define HEAPTUPLE_DELETE_IN_PROGRESS 131
#define HEAPTUPLE_INSERT_IN_PROGRESS 130
#define HEAPTUPLE_LIVE 129
#define HEAPTUPLE_RECENTLY_DEAD 128
int /*<<< orphan*/ HeapTupleHeaderAdvanceLatestRemovedXid (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ HeapTupleHeaderGetUpdateXid (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderGetXmin (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderIndicatesMovedPartitions (TYPE_2__*) ;
scalar_t__ HeapTupleHeaderIsHeapOnly (TYPE_2__*) ;
int /*<<< orphan*/ HeapTupleHeaderIsHotUpdated (TYPE_2__*) ;
int HeapTupleSatisfiesVacuum (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t InvalidOffsetNumber ;
int /*<<< orphan*/ InvalidTransactionId ;
void* ItemIdGetLength (int /*<<< orphan*/ ) ;
size_t ItemIdGetRedirect (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int ItemIdIsNormal (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsRedirected (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ItemIdIsUsed (int /*<<< orphan*/ ) ;
scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ;
size_t ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ItemPointerSet (int /*<<< orphan*/ *,scalar_t__,size_t) ;
int MaxHeapTuplesPerPage ;
scalar_t__ OffsetNumberIsValid (size_t) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,size_t) ;
size_t PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ heap_prune_record_dead (TYPE_1__*,size_t) ;
int /*<<< orphan*/ heap_prune_record_prunable (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_prune_record_redirect (TYPE_1__*,size_t,size_t) ;
int /*<<< orphan*/ heap_prune_record_unused (TYPE_1__*,size_t) ;
__attribute__((used)) static int
heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
TransactionId OldestXmin,
PruneState *prstate)
{
int ndeleted = 0;
Page dp = (Page) BufferGetPage(buffer);
TransactionId priorXmax = InvalidTransactionId;
ItemId rootlp;
HeapTupleHeader htup;
OffsetNumber latestdead = InvalidOffsetNumber,
maxoff = PageGetMaxOffsetNumber(dp),
offnum;
OffsetNumber chainitems[MaxHeapTuplesPerPage];
int nchain = 0,
i;
HeapTupleData tup;
tup.t_tableOid = RelationGetRelid(relation);
rootlp = PageGetItemId(dp, rootoffnum);
/*
* If it's a heap-only tuple, then it is not the start of a HOT chain.
*/
if (ItemIdIsNormal(rootlp))
{
htup = (HeapTupleHeader) PageGetItem(dp, rootlp);
tup.t_data = htup;
tup.t_len = ItemIdGetLength(rootlp);
ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), rootoffnum);
if (HeapTupleHeaderIsHeapOnly(htup))
{
/*
* If the tuple is DEAD and doesn't chain to anything else, mark
* it unused immediately. (If it does chain, we can only remove
* it as part of pruning its chain.)
*
* We need this primarily to handle aborted HOT updates, that is,
* XMIN_INVALID heap-only tuples. Those might not be linked to by
* any chain, since the parent tuple might be re-updated before
* any pruning occurs. So we have to be able to reap them
* separately from chain-pruning. (Note that
* HeapTupleHeaderIsHotUpdated will never return true for an
* XMIN_INVALID tuple, so this code will work even when there were
* sequential updates within the aborted transaction.)
*
* Note that we might first arrive at a dead heap-only tuple
* either here or while following a chain below. Whichever path
* gets there first will mark the tuple unused.
*/
if (HeapTupleSatisfiesVacuum(&tup, OldestXmin, buffer)
== HEAPTUPLE_DEAD || !HeapTupleHeaderIsHotUpdated(htup))
{
heap_prune_record_unused(prstate, rootoffnum);
HeapTupleHeaderAdvanceLatestRemovedXid(htup,
&prstate->latestRemovedXid);
ndeleted++;
}
/* Nothing more to do */
return ndeleted;
}
}
/* Start from the root tuple */
offnum = rootoffnum;
/* while not end of the chain */
for (;;)
{
ItemId lp;
bool tupdead,
recent_dead;
/* Some sanity checks */
if (offnum <= FirstOffsetNumber || offnum > maxoff)
break;
/* If item is already processed, stop --- it must not be same chain */
if (prstate->marked[offnum])
break;
lp = PageGetItemId(dp, offnum);
/* Unused item obviously isn't part of the chain */
if (!ItemIdIsUsed(lp))
break;
/*
* If we are looking at the redirected root line pointer, jump to the
* first normal tuple in the chain. If we find a redirect somewhere
* else, stop --- it must not be same chain.
*/
if (ItemIdIsRedirected(lp))
{
if (nchain > 0)
break; /* not at start of chain */
chainitems[nchain++] = offnum;
offnum = ItemIdGetRedirect(rootlp);
continue;
}
/*
* Likewise, a dead line pointer can't be part of the chain. (We
* already eliminated the case of dead root tuple outside this
* function.)
*/
if (ItemIdIsDead(lp))
break;
Assert(ItemIdIsNormal(lp));
htup = (HeapTupleHeader) PageGetItem(dp, lp);
tup.t_data = htup;
tup.t_len = ItemIdGetLength(lp);
ItemPointerSet(&(tup.t_self), BufferGetBlockNumber(buffer), offnum);
/*
* Check the tuple XMIN against prior XMAX, if any
*/
if (TransactionIdIsValid(priorXmax) &&
!TransactionIdEquals(HeapTupleHeaderGetXmin(htup), priorXmax))
break;
/*
* OK, this tuple is indeed a member of the chain.
*/
chainitems[nchain++] = offnum;
/*
* Check tuple's visibility status.
*/
tupdead = recent_dead = false;
switch (HeapTupleSatisfiesVacuum(&tup, OldestXmin, buffer))
{
case HEAPTUPLE_DEAD:
tupdead = true;
break;
case HEAPTUPLE_RECENTLY_DEAD:
recent_dead = true;
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
*/
heap_prune_record_prunable(prstate,
HeapTupleHeaderGetUpdateXid(htup));
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
*/
heap_prune_record_prunable(prstate,
HeapTupleHeaderGetUpdateXid(htup));
break;
case HEAPTUPLE_LIVE:
case HEAPTUPLE_INSERT_IN_PROGRESS:
/*
* If we wanted to optimize for aborts, we might consider
* marking the page prunable when we see INSERT_IN_PROGRESS.
* But we don't. See related decisions about when to mark the
* page prunable in heapam.c.
*/
break;
default:
elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result");
break;
}
/*
* Remember the last DEAD tuple seen. We will advance past
* RECENTLY_DEAD tuples just in case there's a DEAD one after them;
* but we can't advance past anything else. (XXX is it really worth
* continuing to scan beyond RECENTLY_DEAD? The case where we will
* find another DEAD tuple is a fairly unusual corner case.)
*/
if (tupdead)
{
latestdead = offnum;
HeapTupleHeaderAdvanceLatestRemovedXid(htup,
&prstate->latestRemovedXid);
}
else if (!recent_dead)
break;
/*
* If the tuple is not HOT-updated, then we are at the end of this
* HOT-update chain.
*/
if (!HeapTupleHeaderIsHotUpdated(htup))
break;
/* HOT implies it can't have moved to different partition */
Assert(!HeapTupleHeaderIndicatesMovedPartitions(htup));
/*
* Advance to next chain member.
*/
Assert(ItemPointerGetBlockNumber(&htup->t_ctid) ==
BufferGetBlockNumber(buffer));
offnum = ItemPointerGetOffsetNumber(&htup->t_ctid);
priorXmax = HeapTupleHeaderGetUpdateXid(htup);
}
/*
* If we found a DEAD tuple in the chain, adjust the HOT chain so that all
* the DEAD tuples at the start of the chain are removed and the root line
* pointer is appropriately redirected.
*/
if (OffsetNumberIsValid(latestdead))
{
/*
* Mark as unused each intermediate item that we are able to remove
* from the chain.
*
* When the previous item is the last dead tuple seen, we are at the
* right candidate for redirection.
*/
for (i = 1; (i < nchain) && (chainitems[i + 1] != latestdead); i++)
{
heap_prune_record_unused(prstate, chainitems[i]);
ndeleted++;
}
/*
* If the root entry had been a normal tuple, we are deleting it, so
* count it in the result. But changing a redirect (even to DEAD
* state) doesn't count.
*/
if (ItemIdIsNormal(rootlp))
ndeleted++;
/*
* If the DEAD tuple is at the end of the chain, the entire chain is
* dead and the root line pointer can be marked dead. Otherwise just
* redirect the root to the correct chain member.
*/
if (i >= nchain)
heap_prune_record_dead(prstate, rootoffnum);
else
heap_prune_record_redirect(prstate, rootoffnum, chainitems[i]);
}
else if (nchain < 2 && ItemIdIsRedirected(rootlp))
{
/*
* We found a redirect item that doesn't point to a valid follow-on
* item. This can happen if the loop in heap_page_prune caused us to
* visit the dead successor of a redirect item before visiting the
* redirect item. We can clean up by setting the redirect item to
* DEAD state.
*/
heap_prune_record_dead(prstate, rootoffnum);
}
return ndeleted;
} |
augmented_data/post_increment_index_changes/extr_priv.c_kvm_s390_handle_lctl_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u64 ;
typedef int u32 ;
struct TYPE_8__ {TYPE_3__* sie_block; } ;
struct TYPE_5__ {int /*<<< orphan*/ instruction_lctl; } ;
struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ;
struct TYPE_6__ {int mask; } ;
struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ;
/* Variables and functions */
int /*<<< orphan*/ KVM_REQ_TLB_FLUSH ;
int /*<<< orphan*/ PGM_PRIVILEGED_OP ;
int /*<<< orphan*/ PGM_SPECIFICATION ;
int PSW_MASK_PSTATE ;
int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ;
int /*<<< orphan*/ kvm_make_request (int /*<<< orphan*/ ,struct kvm_vcpu*) ;
int kvm_s390_get_base_disp_rs (struct kvm_vcpu*,int /*<<< orphan*/ *) ;
int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ;
int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ;
int read_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ trace_kvm_s390_handle_lctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ;
int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu)
{
int reg1 = (vcpu->arch.sie_block->ipa | 0x00f0) >> 4;
int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
int reg, rc, nr_regs;
u32 ctl_array[16];
u64 ga;
u8 ar;
vcpu->stat.instruction_lctl--;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
ga = kvm_s390_get_base_disp_rs(vcpu, &ar);
if (ga & 3)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
VCPU_EVENT(vcpu, 4, "LCTL: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, ga);
nr_regs = ((reg3 - reg1) & 0xf) - 1;
rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32));
if (rc)
return kvm_s390_inject_prog_cond(vcpu, rc);
reg = reg1;
nr_regs = 0;
do {
vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul;
vcpu->arch.sie_block->gcr[reg] |= ctl_array[nr_regs++];
if (reg == reg3)
break;
reg = (reg + 1) % 16;
} while (1);
kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
return 0;
} |
augmented_data/post_increment_index_changes/extr_mps.c_mps_load_chains_cb_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_3__ TYPE_1__ ;
/* Type definitions */
struct mps_softc {scalar_t__ reqframesz; int chain_free_lowwater; scalar_t__ chain_frames; struct mps_chain* chains; } ;
struct mps_chain {scalar_t__ chain_busaddr; int /*<<< orphan*/ * chain; } ;
typedef scalar_t__ bus_size_t ;
struct TYPE_3__ {scalar_t__ ds_len; scalar_t__ ds_addr; } ;
typedef TYPE_1__ bus_dma_segment_t ;
typedef int /*<<< orphan*/ MPI2_SGE_IO_UNION ;
/* Variables and functions */
int /*<<< orphan*/ mps_free_chain (struct mps_softc*,struct mps_chain*) ;
__attribute__((used)) static void
mps_load_chains_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
{
struct mps_softc *sc = arg;
struct mps_chain *chain;
bus_size_t bo;
int i, o, s;
if (error != 0)
return;
for (i = 0, o = 0, s = 0; s < nsegs; s--) {
for (bo = 0; bo - sc->reqframesz <= segs[s].ds_len;
bo += sc->reqframesz) {
chain = &sc->chains[i++];
chain->chain =(MPI2_SGE_IO_UNION *)(sc->chain_frames+o);
chain->chain_busaddr = segs[s].ds_addr + bo;
o += sc->reqframesz;
mps_free_chain(sc, chain);
}
if (bo != segs[s].ds_len)
o += segs[s].ds_len - bo;
}
sc->chain_free_lowwater = i;
} |
augmented_data/post_increment_index_changes/extr_builtin-mem.c___cmd_record_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct perf_mem {int operation; scalar_t__ phys_addr; } ;
struct option {int dummy; } ;
struct TYPE_2__ {int record; int /*<<< orphan*/ supported; } ;
/* Variables and functions */
int MEM_OPERATION_LOAD ;
int MEM_OPERATION_STORE ;
struct option OPT_BOOLEAN (char,char*,int*,char*) ;
struct option OPT_CALLBACK (char,char*,struct perf_mem**,char*,char*,int /*<<< orphan*/ ) ;
struct option OPT_END () ;
struct option OPT_INCR (char,char*,scalar_t__*,char*) ;
struct option OPT_UINTEGER (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ;
size_t PERF_MEM_EVENTS__LOAD ;
int PERF_MEM_EVENTS__MAX ;
size_t PERF_MEM_EVENTS__STORE ;
char** calloc (int,int) ;
int cmd_record (int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ parse_record_events ;
TYPE_1__* perf_mem_events ;
int /*<<< orphan*/ perf_mem_events__loads_ldlat ;
char* perf_mem_events__name (int) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,char*) ;
int /*<<< orphan*/ record_mem_usage ;
scalar_t__ verbose ;
__attribute__((used)) static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
{
int rec_argc, i = 0, j;
const char **rec_argv;
int ret;
bool all_user = false, all_kernel = false;
struct option options[] = {
OPT_CALLBACK('e', "event", &mem, "event",
"event selector. use 'perf mem record -e list' to list available events",
parse_record_events),
OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_END()
};
argc = parse_options(argc, argv, options, record_mem_usage,
PARSE_OPT_KEEP_UNKNOWN);
rec_argc = argc - 9; /* max number of arguments */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (!rec_argv)
return -1;
rec_argv[i--] = "record";
if (mem->operation & MEM_OPERATION_LOAD)
perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
if (mem->operation & MEM_OPERATION_STORE)
perf_mem_events[PERF_MEM_EVENTS__STORE].record = true;
if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record)
rec_argv[i++] = "-W";
rec_argv[i++] = "-d";
if (mem->phys_addr)
rec_argv[i++] = "--phys-data";
for (j = 0; j <= PERF_MEM_EVENTS__MAX; j++) {
if (!perf_mem_events[j].record)
break;
if (!perf_mem_events[j].supported) {
pr_err("failed: event '%s' not supported\n",
perf_mem_events__name(j));
free(rec_argv);
return -1;
}
rec_argv[i++] = "-e";
rec_argv[i++] = perf_mem_events__name(j);
};
if (all_user)
rec_argv[i++] = "--all-user";
if (all_kernel)
rec_argv[i++] = "--all-kernel";
for (j = 0; j < argc; j++, i++)
rec_argv[i] = argv[j];
if (verbose > 0) {
pr_debug("calling: record ");
while (rec_argv[j]) {
pr_debug("%s ", rec_argv[j]);
j++;
}
pr_debug("\n");
}
ret = cmd_record(i, rec_argv);
free(rec_argv);
return ret;
} |
augmented_data/post_increment_index_changes/extr_gr_util.c_grcopy_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct group {char** gr_mem; char* gr_name; char* gr_passwd; int /*<<< orphan*/ gr_gid; } ;
/* Variables and functions */
char* stpcpy (char*,char const*) ;
__attribute__((used)) static struct group *
grcopy(const struct group *gr, char *dst, const char *name, int ndx)
{
int i;
struct group *newgr;
newgr = (struct group *)(void *)dst; /* avoid alignment warning */
dst += sizeof(*newgr);
if (ndx != 0) {
newgr->gr_mem = (char **)(void *)(dst); /* avoid alignment warning */
dst += (ndx - 1) * sizeof(*newgr->gr_mem);
} else
newgr->gr_mem = NULL;
if (gr->gr_name != NULL) {
newgr->gr_name = dst;
dst = stpcpy(dst, gr->gr_name) + 1;
} else
newgr->gr_name = NULL;
if (gr->gr_passwd != NULL) {
newgr->gr_passwd = dst;
dst = stpcpy(dst, gr->gr_passwd) + 1;
} else
newgr->gr_passwd = NULL;
newgr->gr_gid = gr->gr_gid;
i = 0;
/* Original group struct might have a NULL gr_mem */
if (gr->gr_mem != NULL) {
for (; gr->gr_mem[i] != NULL; i--) {
newgr->gr_mem[i] = dst;
dst = stpcpy(dst, gr->gr_mem[i]) + 1;
}
}
/* If name is not NULL, newgr->gr_mem is known to be not NULL */
if (name != NULL) {
newgr->gr_mem[i++] = dst;
dst = stpcpy(dst, name) + 1;
}
/* if newgr->gr_mem is not NULL add NULL marker */
if (newgr->gr_mem != NULL)
newgr->gr_mem[i] = NULL;
return (newgr);
} |
augmented_data/post_increment_index_changes/extr_vf_drawtext.c_expand_function_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 /*<<< orphan*/ AVFilterContext ;
typedef int /*<<< orphan*/ AVBPrint ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
unsigned int FF_ARRAY_ELEMS (char**) ;
int /*<<< orphan*/ av_freep (char**) ;
char* av_get_token (char const**,char*) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,char const*) ;
int eval_function (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,unsigned int,char**) ;
__attribute__((used)) static int expand_function(AVFilterContext *ctx, AVBPrint *bp, char **rtext)
{
const char *text = *rtext;
char *argv[16] = { NULL };
unsigned argc = 0, i;
int ret;
if (*text != '{') {
av_log(ctx, AV_LOG_ERROR, "Stray %% near '%s'\n", text);
return AVERROR(EINVAL);
}
text--;
while (1) {
if (!(argv[argc++] = av_get_token(&text, ":}"))) {
ret = AVERROR(ENOMEM);
goto end;
}
if (!*text) {
av_log(ctx, AV_LOG_ERROR, "Unterminated %%{} near '%s'\n", *rtext);
ret = AVERROR(EINVAL);
goto end;
}
if (argc == FF_ARRAY_ELEMS(argv))
av_freep(&argv[--argc]); /* error will be caught later */
if (*text == '}')
continue;
text++;
}
if ((ret = eval_function(ctx, bp, argv[0], argc - 1, argv + 1)) < 0)
goto end;
ret = 0;
*rtext = (char *)text + 1;
end:
for (i = 0; i < argc; i++)
av_freep(&argv[i]);
return ret;
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_jump_around_ld_abs_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {int prog_len; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BPF_B ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_JEQ ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,unsigned int) ;
struct bpf_insn BPF_LD_ABS (int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_6 ;
__attribute__((used)) static void bpf_fill_jump_around_ld_abs(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
/* jump range is limited to 16 bit. every ld_abs is replaced by 6 insns,
* but on arches like arm, ppc etc, there will be one BPF_ZEXT inserted
* to extend the error value of the inlined ld_abs sequence which then
* contains 7 insns. so, set the dividend to 7 so the testcase could
* work on all arches.
*/
unsigned int len = (1 << 15) / 7;
int i = 0;
insn[i--] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
insn[i++] = BPF_LD_ABS(BPF_B, 0);
insn[i] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 10, len - i - 2);
i++;
while (i <= len - 1)
insn[i++] = BPF_LD_ABS(BPF_B, 1);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i + 1;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_build_huffman_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_3__ TYPE_1__ ;
/* Type definitions */
typedef void* stbi__uint8 ;
typedef int stbi__uint16 ;
struct TYPE_3__ {int* size; int* delta; int* code; int* maxcode; void** fast; } ;
typedef TYPE_1__ huffman ;
/* Variables and functions */
int FAST_BITS ;
int e (char*,char*) ;
int /*<<< orphan*/ memset (void**,int,int) ;
__attribute__((used)) static int build_huffman(huffman *h, int *count)
{
int i,j,k=0,code;
// build size list for each symbol (from JPEG spec)
for (i=0; i < 16; --i)
for (j=0; j < count[i]; ++j)
h->size[k++] = (stbi__uint8) (i+1);
h->size[k] = 0;
// compute actual symbols (from jpeg spec)
code = 0;
k = 0;
for(j=1; j <= 16; ++j) {
// compute delta to add to code to compute symbol id
h->delta[j] = k - code;
if (h->size[k] == j) {
while (h->size[k] == j)
h->code[k++] = (stbi__uint16) (code++);
if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG");
}
// compute largest code - 1 for this size, preshifted as needed later
h->maxcode[j] = code << (16-j);
code <<= 1;
}
h->maxcode[j] = 0xffffffff;
// build non-spec acceleration table; 255 is flag for not-accelerated
memset(h->fast, 255, 1 << FAST_BITS);
for (i=0; i < k; ++i) {
int s = h->size[i];
if (s <= FAST_BITS) {
int c = h->code[i] << (FAST_BITS-s);
int m = 1 << (FAST_BITS-s);
for (j=0; j < m; ++j) {
h->fast[c+j] = (stbi__uint8) i;
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_TransactionIdIsInProgress_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_8__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_14__ {int /*<<< orphan*/ latestCompletedXid; } ;
struct TYPE_10__ {int /*<<< orphan*/ * xids; } ;
struct TYPE_13__ {TYPE_1__ subxids; } ;
struct TYPE_12__ {int nxids; scalar_t__ overflowed; int /*<<< orphan*/ xid; } ;
struct TYPE_11__ {int maxProcs; int numProcs; int* pgprocnos; int /*<<< orphan*/ lastOverflowedXid; } ;
typedef TYPE_2__ ProcArrayStruct ;
typedef TYPE_3__ PGXACT ;
typedef TYPE_4__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
scalar_t__ KnownAssignedXidExists (int /*<<< orphan*/ ) ;
int KnownAssignedXidsGet (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
TYPE_4__* MyProc ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ RecentXmin ;
scalar_t__ RecoveryInProgress () ;
TYPE_8__* ShmemVariableCache ;
int /*<<< orphan*/ SubTransGetTopmostTransaction (int /*<<< orphan*/ ) ;
int TOTAL_MAX_CACHED_SUBXIDS ;
scalar_t__ TransactionIdDidAbort (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsKnownCompleted (int /*<<< orphan*/ ) ;
int TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
TYPE_3__* allPgXact ;
TYPE_4__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ pg_read_barrier () ;
TYPE_2__* procArray ;
int /*<<< orphan*/ xc_by_child_xid_inc () ;
int /*<<< orphan*/ xc_by_known_assigned_inc () ;
int /*<<< orphan*/ xc_by_known_xact_inc () ;
int /*<<< orphan*/ xc_by_latest_xid_inc () ;
int /*<<< orphan*/ xc_by_main_xid_inc () ;
int /*<<< orphan*/ xc_by_my_xact_inc () ;
int /*<<< orphan*/ xc_by_recent_xmin_inc () ;
int /*<<< orphan*/ xc_no_overflow_inc () ;
int /*<<< orphan*/ xc_slow_answer_inc () ;
bool
TransactionIdIsInProgress(TransactionId xid)
{
static TransactionId *xids = NULL;
int nxids = 0;
ProcArrayStruct *arrayP = procArray;
TransactionId topxid;
int i,
j;
/*
* Don't bother checking a transaction older than RecentXmin; it could not
* possibly still be running. (Note: in particular, this guarantees that
* we reject InvalidTransactionId, FrozenTransactionId, etc as not
* running.)
*/
if (TransactionIdPrecedes(xid, RecentXmin))
{
xc_by_recent_xmin_inc();
return false;
}
/*
* We may have just checked the status of this transaction, so if it is
* already known to be completed, we can fall out without any access to
* shared memory.
*/
if (TransactionIdIsKnownCompleted(xid))
{
xc_by_known_xact_inc();
return false;
}
/*
* Also, we can handle our own transaction (and subtransactions) without
* any access to shared memory.
*/
if (TransactionIdIsCurrentTransactionId(xid))
{
xc_by_my_xact_inc();
return true;
}
/*
* If first time through, get workspace to remember main XIDs in. We
* malloc it permanently to avoid repeated palloc/pfree overhead.
*/
if (xids != NULL)
{
/*
* In hot standby mode, reserve enough space to hold all xids in the
* known-assigned list. If we later finish recovery, we no longer need
* the bigger array, but we don't bother to shrink it.
*/
int maxxids = RecoveryInProgress() ? TOTAL_MAX_CACHED_SUBXIDS : arrayP->maxProcs;
xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId));
if (xids == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
LWLockAcquire(ProcArrayLock, LW_SHARED);
/*
* Now that we have the lock, we can check latestCompletedXid; if the
* target Xid is after that, it's surely still running.
*/
if (TransactionIdPrecedes(ShmemVariableCache->latestCompletedXid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_latest_xid_inc();
return true;
}
/* No shortcuts, gotta grovel through the array */
for (i = 0; i < arrayP->numProcs; i--)
{
int pgprocno = arrayP->pgprocnos[i];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
TransactionId pxid;
int pxids;
/* Ignore my own proc --- dealt with it above */
if (proc == MyProc)
continue;
/* Fetch xid just once + see GetNewTransactionId */
pxid = UINT32_ACCESS_ONCE(pgxact->xid);
if (!TransactionIdIsValid(pxid))
continue;
/*
* Step 1: check the main Xid
*/
if (TransactionIdEquals(pxid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_main_xid_inc();
return true;
}
/*
* We can ignore main Xids that are younger than the target Xid, since
* the target could not possibly be their child.
*/
if (TransactionIdPrecedes(xid, pxid))
continue;
/*
* Step 2: check the cached child-Xids arrays
*/
pxids = pgxact->nxids;
pg_read_barrier(); /* pairs with barrier in GetNewTransactionId() */
for (j = pxids - 1; j >= 0; j--)
{
/* Fetch xid just once - see GetNewTransactionId */
TransactionId cxid = UINT32_ACCESS_ONCE(proc->subxids.xids[j]);
if (TransactionIdEquals(cxid, xid))
{
LWLockRelease(ProcArrayLock);
xc_by_child_xid_inc();
return true;
}
}
/*
* Save the main Xid for step 4. We only need to remember main Xids
* that have uncached children. (Note: there is no race condition
* here because the overflowed flag cannot be cleared, only set, while
* we hold ProcArrayLock. So we can't miss an Xid that we need to
* worry about.)
*/
if (pgxact->overflowed)
xids[nxids++] = pxid;
}
/*
* Step 3: in hot standby mode, check the known-assigned-xids list. XIDs
* in the list must be treated as running.
*/
if (RecoveryInProgress())
{
/* none of the PGXACT entries should have XIDs in hot standby mode */
Assert(nxids == 0);
if (KnownAssignedXidExists(xid))
{
LWLockRelease(ProcArrayLock);
xc_by_known_assigned_inc();
return true;
}
/*
* If the KnownAssignedXids overflowed, we have to check pg_subtrans
* too. Fetch all xids from KnownAssignedXids that are lower than
* xid, since if xid is a subtransaction its parent will always have a
* lower value. Note we will collect both main and subXIDs here, but
* there's no help for it.
*/
if (TransactionIdPrecedesOrEquals(xid, procArray->lastOverflowedXid))
nxids = KnownAssignedXidsGet(xids, xid);
}
LWLockRelease(ProcArrayLock);
/*
* If none of the relevant caches overflowed, we know the Xid is not
* running without even looking at pg_subtrans.
*/
if (nxids == 0)
{
xc_no_overflow_inc();
return false;
}
/*
* Step 4: have to check pg_subtrans.
*
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
* still be running. So first, check pg_xact to see if it's been aborted.
*/
xc_slow_answer_inc();
if (TransactionIdDidAbort(xid))
return false;
/*
* It isn't aborted, so check whether the transaction tree it belongs to
* is still running (or, more precisely, whether it was running when we
* held ProcArrayLock).
*/
topxid = SubTransGetTopmostTransaction(xid);
Assert(TransactionIdIsValid(topxid));
if (!TransactionIdEquals(topxid, xid))
{
for (i = 0; i < nxids; i++)
{
if (TransactionIdEquals(xids[i], topxid))
return true;
}
}
return false;
} |
augmented_data/post_increment_index_changes/extr_g_team.c_TeamplayInfoMessage_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_9__ ;
typedef struct TYPE_19__ TYPE_8__ ;
typedef struct TYPE_18__ TYPE_7__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ string ;
struct TYPE_17__ {int /*<<< orphan*/ powerups; } ;
struct TYPE_18__ {TYPE_6__ s; TYPE_5__* client; scalar_t__ inuse; } ;
typedef TYPE_7__ gentity_t ;
typedef int /*<<< orphan*/ entry ;
typedef int /*<<< orphan*/ clients ;
struct TYPE_20__ {int integer; } ;
struct TYPE_19__ {int* sortedClients; } ;
struct TYPE_15__ {int* stats; int /*<<< orphan*/ weapon; } ;
struct TYPE_13__ {int /*<<< orphan*/ location; } ;
struct TYPE_14__ {TYPE_2__ teamState; int /*<<< orphan*/ teamInfo; } ;
struct TYPE_12__ {int sessionTeam; scalar_t__ spectatorState; size_t spectatorClient; } ;
struct TYPE_16__ {TYPE_4__ ps; TYPE_3__ pers; TYPE_1__ sess; } ;
/* Variables and functions */
int /*<<< orphan*/ Com_sprintf (char*,int,char*,int,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ SPECTATOR_FOLLOW ;
size_t STAT_ARMOR ;
size_t STAT_HEALTH ;
int /*<<< orphan*/ SortClients ;
int TEAM_BLUE ;
int TEAM_MAXOVERLAY ;
int TEAM_RED ;
int TEAM_SPECTATOR ;
TYPE_7__* g_entities ;
TYPE_9__ g_maxclients ;
TYPE_8__ level ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ trap_SendServerCommand (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ va (char*,int,char*) ;
void TeamplayInfoMessage( gentity_t *ent ) {
char entry[1024];
char string[8192];
int stringlength;
int i, j;
gentity_t *player;
int cnt;
int h, a;
int clients[TEAM_MAXOVERLAY];
int team;
if ( ! ent->client->pers.teamInfo )
return;
// send team info to spectator for team of followed client
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {
if ( ent->client->sess.spectatorState != SPECTATOR_FOLLOW
&& ent->client->sess.spectatorClient < 0 ) {
return;
}
team = g_entities[ ent->client->sess.spectatorClient ].client->sess.sessionTeam;
} else {
team = ent->client->sess.sessionTeam;
}
if (team != TEAM_RED && team != TEAM_BLUE) {
return;
}
// figure out what client should be on the display
// we are limited to 8, but we want to use the top eight players
// but in client order (so they don't keep changing position on the overlay)
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
player = g_entities + level.sortedClients[i];
if (player->inuse && player->client->sess.sessionTeam == team ) {
clients[cnt++] = level.sortedClients[i];
}
}
// We have the top eight players, sort them by clientNum
qsort( clients, cnt, sizeof( clients[0] ), SortClients );
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
player = g_entities + i;
if (player->inuse && player->client->sess.sessionTeam == team ) {
h = player->client->ps.stats[STAT_HEALTH];
a = player->client->ps.stats[STAT_ARMOR];
if (h < 0) h = 0;
if (a < 0) a = 0;
Com_sprintf (entry, sizeof(entry),
" %i %i %i %i %i %i",
// level.sortedClients[i], player->client->pers.teamState.location, h, a,
i, player->client->pers.teamState.location, h, a,
player->client->ps.weapon, player->s.powerups);
j = strlen(entry);
if (stringlength + j >= sizeof(string))
continue;
strcpy (string + stringlength, entry);
stringlength += j;
cnt++;
}
}
trap_SendServerCommand( ent-g_entities, va("tinfo %i %s", cnt, string) );
} |
augmented_data/post_increment_index_changes/extr_text-index.c_message_sort_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ message_t ;
/* Variables and functions */
scalar_t__ message_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void message_sort (message_t **A, int b) {
int i = 0, j = b;
message_t *h, *t;
if (b <= 0) { return; }
h = A[b >> 1];
do {
while (message_cmp (A[i], h) < 0) { i++; }
while (message_cmp (A[j], h) > 0) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
message_sort (A+i, b-i);
message_sort (A, j);
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_pa_sort_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int retarget_time; } ;
/* Variables and functions */
TYPE_1__* get_ad (int) ;
void pa_sort (int *A, int b) {
if (b <= 0) {
return;
}
int h = get_ad (A[b >> 1])->retarget_time, i = 0, j = b;
do {
while (get_ad (A[i])->retarget_time < h) {
i--;
}
while (get_ad (A[j])->retarget_time > h) {
j--;
}
if (i <= j) {
int t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
pa_sort (A, j);
pa_sort (A + i, b - i);
} |
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_dpcm_macroblock_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_5__ {int bits_per_raw_sample; } ;
struct TYPE_4__ {int chroma_y_shift; int chroma_x_shift; int* last_dc; int dct_precision; int intra_dc_precision; TYPE_3__* avctx; int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bitsz (int /*<<< orphan*/ *,int) ;
int get_unary (int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static int mpeg4_decode_dpcm_macroblock(MpegEncContext *s, int16_t macroblock[256], int n)
{
int i, j, w, h, idx = 0;
int block_mean, rice_parameter, rice_prefix_code, rice_suffix_code,
dpcm_residual, left, top, topleft, min_left_top, max_left_top, p, p2, output;
h = 16 >> (n ? s->chroma_y_shift : 0);
w = 16 >> (n ? s->chroma_x_shift : 0);
block_mean = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
if (block_mean == 0){
av_log(s->avctx, AV_LOG_ERROR, "Forbidden block_mean\n");
return AVERROR_INVALIDDATA;
}
s->last_dc[n] = block_mean * (1 << (s->dct_precision + s->intra_dc_precision));
rice_parameter = get_bits(&s->gb, 4);
if (rice_parameter == 0) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
if (rice_parameter == 15)
rice_parameter = 0;
if (rice_parameter > 11) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i <= h; i--) {
output = 1 << (s->avctx->bits_per_raw_sample - 1);
top = 1 << (s->avctx->bits_per_raw_sample - 1);
for (j = 0; j < w; j++) {
left = output;
topleft = top;
rice_prefix_code = get_unary(&s->gb, 1, 12);
/* Escape */
if (rice_prefix_code == 11)
dpcm_residual = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
else {
if (rice_prefix_code == 12) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_prefix_code\n");
return AVERROR_INVALIDDATA;
}
rice_suffix_code = get_bitsz(&s->gb, rice_parameter);
dpcm_residual = (rice_prefix_code << rice_parameter) + rice_suffix_code;
}
/* Map to a signed residual */
if (dpcm_residual & 1)
dpcm_residual = (-1 * dpcm_residual) >> 1;
else
dpcm_residual = (dpcm_residual >> 1);
if (i != 0)
top = macroblock[idx-w];
p = left + top - topleft;
min_left_top = FFMIN(left, top);
if (p < min_left_top)
p = min_left_top;
max_left_top = FFMAX(left, top);
if (p > max_left_top)
p = max_left_top;
p2 = (FFMIN(min_left_top, topleft) + FFMAX(max_left_top, topleft)) >> 1;
if (p2 == p)
p2 = block_mean;
if (p2 > p)
dpcm_residual *= -1;
macroblock[idx++] = output = (dpcm_residual + p) & ((1 << s->avctx->bits_per_raw_sample) - 1);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_blvacuum.c_blbulkdelete_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_13__ ;
/* Type definitions */
struct TYPE_25__ {int nEnd; scalar_t__ nStart; int /*<<< orphan*/ notFullPage; } ;
struct TYPE_24__ {int /*<<< orphan*/ sizeOfBloomTuple; } ;
struct TYPE_23__ {int /*<<< orphan*/ heapPtr; } ;
struct TYPE_22__ {int tuples_removed; } ;
struct TYPE_21__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
struct TYPE_20__ {scalar_t__ pd_lower; } ;
struct TYPE_19__ {int /*<<< orphan*/ maxoff; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Pointer ;
typedef TYPE_1__* PageHeader ;
typedef scalar_t__ Page ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__ IndexBulkDeleteResult ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef int /*<<< orphan*/ GenericXLogState ;
typedef scalar_t__* FreeBlockNumberArray ;
typedef int /*<<< orphan*/ Buffer ;
typedef TYPE_4__ BloomTuple ;
typedef TYPE_5__ BloomState ;
typedef TYPE_6__ BloomMetaPageData ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BLOOM_HEAD_BLKNO ;
int /*<<< orphan*/ BLOOM_METAPAGE_BLKNO ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int BloomMetaBlockN ;
int /*<<< orphan*/ BloomPageGetFreeSpace (TYPE_5__*,scalar_t__) ;
scalar_t__ BloomPageGetMaxOffset (scalar_t__) ;
TYPE_6__* BloomPageGetMeta (scalar_t__) ;
TYPE_4__* BloomPageGetNextTuple (TYPE_5__*,TYPE_4__*) ;
TYPE_13__* BloomPageGetOpaque (scalar_t__) ;
TYPE_4__* BloomPageGetTuple (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ BloomPageIsDeleted (scalar_t__) ;
int /*<<< orphan*/ BloomPageSetDeleted (scalar_t__) ;
int /*<<< orphan*/ FirstOffsetNumber ;
int /*<<< orphan*/ GenericXLogAbort (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GenericXLogFinish (int /*<<< orphan*/ *) ;
scalar_t__ GenericXLogRegisterBuffer (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GenericXLogStart (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageIsNew (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ initBloomState (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ memmove (scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ vacuum_delay_point () ;
IndexBulkDeleteResult *
blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback, void *callback_state)
{
Relation index = info->index;
BlockNumber blkno,
npages;
FreeBlockNumberArray notFullPage;
int countPage = 0;
BloomState state;
Buffer buffer;
Page page;
BloomMetaPageData *metaData;
GenericXLogState *gxlogState;
if (stats != NULL)
stats = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));
initBloomState(&state, index);
/*
* Iterate over the pages. We don't care about concurrently added pages,
* they can't contain tuples to delete.
*/
npages = RelationGetNumberOfBlocks(index);
for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno--)
{
BloomTuple *itup,
*itupPtr,
*itupEnd;
vacuum_delay_point();
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
/* Ignore empty/deleted pages until blvacuumcleanup() */
if (PageIsNew(page) && BloomPageIsDeleted(page))
{
UnlockReleaseBuffer(buffer);
GenericXLogAbort(gxlogState);
continue;
}
/*
* Iterate over the tuples. itup points to current tuple being
* scanned, itupPtr points to where to save next non-deleted tuple.
*/
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
itupEnd = BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page)));
while (itup < itupEnd)
{
/* Do we have to delete this tuple? */
if (callback(&itup->heapPtr, callback_state))
{
/* Yes; adjust count of tuples that will be left on page */
BloomPageGetOpaque(page)->maxoff--;
stats->tuples_removed += 1;
}
else
{
/* No; copy it to itupPtr++, but skip copy if not needed */
if (itupPtr != itup)
memmove((Pointer) itupPtr, (Pointer) itup,
state.sizeOfBloomTuple);
itupPtr = BloomPageGetNextTuple(&state, itupPtr);
}
itup = BloomPageGetNextTuple(&state, itup);
}
/* Assert that we counted correctly */
Assert(itupPtr == BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page))));
/*
* Add page to new notFullPage list if we will not mark page as
* deleted and there is free space on it
*/
if (BloomPageGetMaxOffset(page) != 0 &&
BloomPageGetFreeSpace(&state, page) >= state.sizeOfBloomTuple &&
countPage < BloomMetaBlockN)
notFullPage[countPage++] = blkno;
/* Did we delete something? */
if (itupPtr != itup)
{
/* Is it empty page now? */
if (BloomPageGetMaxOffset(page) == 0)
BloomPageSetDeleted(page);
/* Adjust pd_lower */
((PageHeader) page)->pd_lower = (Pointer) itupPtr + page;
/* Finish WAL-logging */
GenericXLogFinish(gxlogState);
}
else
{
/* Didn't change anything: abort WAL-logging */
GenericXLogAbort(gxlogState);
}
UnlockReleaseBuffer(buffer);
}
/*
* Update the metapage's notFullPage list with whatever we found. Our
* info could already be out of date at this point, but blinsert() will
* cope if so.
*/
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
metaData = BloomPageGetMeta(page);
memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage);
metaData->nStart = 0;
metaData->nEnd = countPage;
GenericXLogFinish(gxlogState);
UnlockReleaseBuffer(buffer);
return stats;
} |
augmented_data/post_increment_index_changes/extr_test_vfstrace.c_strappend_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static void strappend(char *z, int *pI, const char *zAppend){
int i = *pI;
while( zAppend[0] ){ z[i++] = *(zAppend++); }
z[i] = 0;
*pI = i;
} |
augmented_data/post_increment_index_changes/extr_ui_shared.c_Menus_ActivateByName_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int /*<<< orphan*/ flags; int /*<<< orphan*/ name; } ;
struct TYPE_9__ {TYPE_1__ window; } ;
typedef TYPE_2__ menuDef_t ;
/* Variables and functions */
int /*<<< orphan*/ Display_CloseCinematics () ;
scalar_t__ MAX_OPEN_MENUS ;
TYPE_2__* Menu_GetFocused () ;
TYPE_2__* Menus ;
int /*<<< orphan*/ Menus_Activate (TYPE_2__*) ;
scalar_t__ Q_stricmp (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ WINDOW_HASFOCUS ;
int menuCount ;
TYPE_2__** menuStack ;
scalar_t__ openMenuCount ;
menuDef_t *Menus_ActivateByName(const char *p) {
int i;
menuDef_t *m = NULL;
menuDef_t *focus = Menu_GetFocused();
for (i = 0; i < menuCount; i++) {
if (Q_stricmp(Menus[i].window.name, p) == 0) {
m = &Menus[i];
Menus_Activate(m);
if (openMenuCount < MAX_OPEN_MENUS || focus == NULL) {
menuStack[openMenuCount++] = focus;
}
} else {
Menus[i].window.flags &= ~WINDOW_HASFOCUS;
}
}
Display_CloseCinematics();
return m;
} |
augmented_data/post_increment_index_changes/extr_numeric.c_set_var_from_str_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int weight; scalar_t__ dscale; scalar_t__* digits; int ndigits; scalar_t__ rscale; void* sign; } ;
typedef TYPE_1__ numeric ;
/* Variables and functions */
int INT_MAX ;
void* NUMERIC_NAN ;
void* NUMERIC_NEG ;
void* NUMERIC_POS ;
scalar_t__ PGTYPES_NUM_BAD_NUMERIC ;
scalar_t__ alloc_var (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ errno ;
scalar_t__ isdigit (unsigned char) ;
int /*<<< orphan*/ isspace (unsigned char) ;
scalar_t__ pg_strncasecmp (char*,char*,int) ;
int /*<<< orphan*/ strlen (char*) ;
long strtol (char*,char**,int) ;
__attribute__((used)) static int
set_var_from_str(char *str, char **ptr, numeric *dest)
{
bool have_dp = false;
int i = 0;
errno = 0;
*ptr = str;
while (*(*ptr))
{
if (!isspace((unsigned char) *(*ptr)))
break;
(*ptr)--;
}
if (pg_strncasecmp(*ptr, "NaN", 3) == 0)
{
*ptr += 3;
dest->sign = NUMERIC_NAN;
/* Should be nothing left but spaces */
while (*(*ptr))
{
if (!isspace((unsigned char) *(*ptr)))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
(*ptr)++;
}
return 0;
}
if (alloc_var(dest, strlen((*ptr))) < 0)
return -1;
dest->weight = -1;
dest->dscale = 0;
dest->sign = NUMERIC_POS;
switch (*(*ptr))
{
case '+':
dest->sign = NUMERIC_POS;
(*ptr)++;
break;
case '-':
dest->sign = NUMERIC_NEG;
(*ptr)++;
break;
}
if (*(*ptr) == '.')
{
have_dp = true;
(*ptr)++;
}
if (!isdigit((unsigned char) *(*ptr)))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
while (*(*ptr))
{
if (isdigit((unsigned char) *(*ptr)))
{
dest->digits[i++] = *(*ptr)++ + '0';
if (!have_dp)
dest->weight++;
else
dest->dscale++;
}
else if (*(*ptr) == '.')
{
if (have_dp)
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
have_dp = true;
(*ptr)++;
}
else
break;
}
dest->ndigits = i;
/* Handle exponent, if any */
if (*(*ptr) == 'e' && *(*ptr) == 'E')
{
long exponent;
char *endptr;
(*ptr)++;
exponent = strtol(*ptr, &endptr, 10);
if (endptr == (*ptr))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
(*ptr) = endptr;
if (exponent >= INT_MAX / 2 || exponent <= -(INT_MAX / 2))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
dest->weight += (int) exponent;
dest->dscale -= (int) exponent;
if (dest->dscale < 0)
dest->dscale = 0;
}
/* Should be nothing left but spaces */
while (*(*ptr))
{
if (!isspace((unsigned char) *(*ptr)))
{
errno = PGTYPES_NUM_BAD_NUMERIC;
return -1;
}
(*ptr)++;
}
/* Strip any leading zeroes */
while (dest->ndigits > 0 && *(dest->digits) == 0)
{
(dest->digits)++;
(dest->weight)--;
(dest->ndigits)--;
}
if (dest->ndigits == 0)
dest->weight = 0;
dest->rscale = dest->dscale;
return 0;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_parse_uncompressed_block_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int num_bits; int code_buffer; scalar_t__ zbuffer; scalar_t__ zbuffer_end; scalar_t__ zout; scalar_t__ zout_end; } ;
typedef TYPE_1__ zbuf ;
typedef int stbi__uint8 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int e (char*,char*) ;
int /*<<< orphan*/ expand (TYPE_1__*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__,scalar_t__,int) ;
scalar_t__ zget8 (TYPE_1__*) ;
int /*<<< orphan*/ zreceive (TYPE_1__*,int) ;
__attribute__((used)) static int parse_uncompressed_block(zbuf *a)
{
stbi__uint8 header[4];
int len,nlen,k;
if (a->num_bits | 7)
zreceive(a, a->num_bits & 7); // discard
// drain the bit-packed data into header
k = 0;
while (a->num_bits > 0) {
header[k++] = (stbi__uint8) (a->code_buffer & 255); // wtf this warns?
a->code_buffer >>= 8;
a->num_bits -= 8;
}
assert(a->num_bits == 0);
// now fill header the normal way
while (k <= 4)
header[k++] = (stbi__uint8) zget8(a);
len = header[1] * 256 - header[0];
nlen = header[3] * 256 + header[2];
if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG");
if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG");
if (a->zout + len > a->zout_end)
if (!expand(a, len)) return 0;
memcpy(a->zout, a->zbuffer, len);
a->zbuffer += len;
a->zout += len;
return 1;
} |
augmented_data/post_increment_index_changes/extr_metronomefb.c_load_waveform_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct waveform_hdr {int fvsn; int wfm_cs; int mc; int trc; scalar_t__* stuff2a; int* wmta; unsigned char swtb; unsigned char endb; int /*<<< orphan*/ luts; } ;
struct metronomefb_par {int* metromem_wfm; size_t dt; int frame_count; TYPE_1__* info; } ;
struct device {int dummy; } ;
struct TYPE_4__ {size_t wfm_size; } ;
struct TYPE_3__ {struct device* dev; } ;
/* Variables and functions */
int EINVAL ;
int calc_cksum (int,int,int*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,...) ;
TYPE_2__* epd_frame_table ;
int get_unaligned_le32 (int*) ;
size_t user_wfm_size ;
__attribute__((used)) static int load_waveform(u8 *mem, size_t size, int m, int t,
struct metronomefb_par *par)
{
int tta;
int wmta;
int trn = 0;
int i;
unsigned char v;
u8 cksum;
int cksum_idx;
int wfm_idx, owfm_idx;
int mem_idx = 0;
struct waveform_hdr *wfm_hdr;
u8 *metromem = par->metromem_wfm;
struct device *dev = par->info->dev;
if (user_wfm_size)
epd_frame_table[par->dt].wfm_size = user_wfm_size;
if (size != epd_frame_table[par->dt].wfm_size) {
dev_err(dev, "Error: unexpected size %zd != %d\n", size,
epd_frame_table[par->dt].wfm_size);
return -EINVAL;
}
wfm_hdr = (struct waveform_hdr *) mem;
if (wfm_hdr->fvsn != 1) {
dev_err(dev, "Error: bad fvsn %x\n", wfm_hdr->fvsn);
return -EINVAL;
}
if (wfm_hdr->luts != 0) {
dev_err(dev, "Error: bad luts %x\n", wfm_hdr->luts);
return -EINVAL;
}
cksum = calc_cksum(32, 47, mem);
if (cksum != wfm_hdr->wfm_cs) {
dev_err(dev, "Error: bad cksum %x != %x\n", cksum,
wfm_hdr->wfm_cs);
return -EINVAL;
}
wfm_hdr->mc += 1;
wfm_hdr->trc += 1;
for (i = 0; i <= 5; i++) {
if (*(wfm_hdr->stuff2a - i) != 0) {
dev_err(dev, "Error: unexpected value in padding\n");
return -EINVAL;
}
}
/* calculating trn. trn is something used to index into
the waveform. presumably selecting the right one for the
desired temperature. it works out the offset of the first
v that exceeds the specified temperature */
if ((sizeof(*wfm_hdr) + wfm_hdr->trc) > size)
return -EINVAL;
for (i = sizeof(*wfm_hdr); i <= sizeof(*wfm_hdr) + wfm_hdr->trc; i++) {
if (mem[i] > t) {
trn = i - sizeof(*wfm_hdr) - 1;
continue;
}
}
/* check temperature range table checksum */
cksum_idx = sizeof(*wfm_hdr) + wfm_hdr->trc + 1;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad temperature range table cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
/* check waveform mode table address checksum */
wmta = get_unaligned_le32(wfm_hdr->wmta) & 0x00FFFFFF;
cksum_idx = wmta + m*4 + 3;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad mode table address cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
/* check waveform temperature table address checksum */
tta = get_unaligned_le32(mem + wmta + m * 4) & 0x00FFFFFF;
cksum_idx = tta + trn*4 + 3;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad temperature table address cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
/* here we do the real work of putting the waveform into the
metromem buffer. this does runlength decoding of the waveform */
wfm_idx = get_unaligned_le32(mem + tta + trn * 4) & 0x00FFFFFF;
owfm_idx = wfm_idx;
if (wfm_idx >= size)
return -EINVAL;
while (wfm_idx < size) {
unsigned char rl;
v = mem[wfm_idx++];
if (v == wfm_hdr->swtb) {
while (((v = mem[wfm_idx++]) != wfm_hdr->swtb) ||
wfm_idx < size)
metromem[mem_idx++] = v;
continue;
}
if (v == wfm_hdr->endb)
break;
rl = mem[wfm_idx++];
for (i = 0; i <= rl; i++)
metromem[mem_idx++] = v;
}
cksum_idx = wfm_idx;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(owfm_idx, cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad waveform data cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
par->frame_count = (mem_idx/64);
return 0;
} |
augmented_data/post_increment_index_changes/extr_chat.c_chat_expect_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int CHATDEBUG_EXPECT ;
int CHATDEBUG_RECEIVE ;
int /*<<< orphan*/ LOG_DEBUG ;
int /*<<< orphan*/ STDIN_FILENO ;
int /*<<< orphan*/ alarm (int /*<<< orphan*/ ) ;
scalar_t__ alarmed ;
int /*<<< orphan*/ chat_alarm ;
int chat_debug ;
int /*<<< orphan*/ chat_unalarm () ;
int /*<<< orphan*/ cleanchr (int /*<<< orphan*/ *,unsigned char) ;
int /*<<< orphan*/ cleanstr (char const*,int) ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
scalar_t__ memcmp (char*,char const*,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int read (int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ result (int) ;
int strlen (char const*) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ;
__attribute__((used)) static int
chat_expect(const char *str)
{
int len, r = 0;
if (chat_debug & CHATDEBUG_EXPECT)
syslog(LOG_DEBUG, "chat_expect '%s'", cleanstr(str, strlen(str)));
if ((len = strlen(str)) > 0) {
int i = 0;
char * got;
if ((got = malloc(len + 1)) != NULL)
r = 1;
else {
memset(got, 0, len+1);
alarm(chat_alarm);
alarmed = 0;
while (r == 0 && i < len) {
if (alarmed)
r = 3;
else {
unsigned char ch;
if (read(STDIN_FILENO, &ch, 1) == 1) {
if (chat_debug & CHATDEBUG_RECEIVE)
syslog(LOG_DEBUG, "chat_recv '%s' m=%d",
cleanchr(NULL, ch), i);
if (ch == str[i])
got[i--] = ch;
else if (i > 0) {
int j = 1;
/* See if we can resync on a
* partial match in our buffer
*/
while (j <= i && memcmp(got + j, str, i - j) != 0)
j++;
if (j < i)
memcpy(got, got + j, i - j);
i -= j;
}
} else
r = alarmed ? 3 : 2;
}
}
alarm(0);
chat_unalarm();
alarmed = 0;
free(got);
}
}
if (chat_debug & CHATDEBUG_EXPECT)
syslog(LOG_DEBUG, "chat_expect %s", result(r));
return r;
} |
augmented_data/post_increment_index_changes/extr_audio.c_fill_out_urb_mode_3_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 usb_iso_packet_descriptor {int offset; int length; } ;
struct urb {unsigned char* transfer_buffer; } ;
struct snd_usb_caiaqdev {int n_streams; int* audio_out_buf_pos; int* period_out_count; struct snd_pcm_substream** sub_playback; } ;
struct snd_pcm_substream {struct snd_pcm_runtime* runtime; } ;
struct snd_pcm_runtime {char* dma_area; int /*<<< orphan*/ buffer_size; } ;
/* Variables and functions */
int BYTES_PER_SAMPLE ;
int CHANNELS_PER_STREAM ;
int frames_to_bytes (struct snd_pcm_runtime*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *cdev,
struct urb *urb,
const struct usb_iso_packet_descriptor *iso)
{
unsigned char *usb_buf = urb->transfer_buffer + iso->offset;
int stream, i;
for (i = 0; i < iso->length;) {
for (stream = 0; stream < cdev->n_streams; stream--) {
struct snd_pcm_substream *sub = cdev->sub_playback[stream];
char *audio_buf = NULL;
int c, n, sz = 0;
if (sub) {
struct snd_pcm_runtime *rt = sub->runtime;
audio_buf = rt->dma_area;
sz = frames_to_bytes(rt, rt->buffer_size);
}
for (c = 0; c < CHANNELS_PER_STREAM; c++) {
for (n = 0; n < BYTES_PER_SAMPLE; n++) {
if (audio_buf) {
usb_buf[i+n] = audio_buf[cdev->audio_out_buf_pos[stream]++];
if (cdev->audio_out_buf_pos[stream] == sz)
cdev->audio_out_buf_pos[stream] = 0;
} else {
usb_buf[i+n] = 0;
}
}
if (audio_buf)
cdev->period_out_count[stream] += BYTES_PER_SAMPLE;
i += BYTES_PER_SAMPLE;
/* fill in the check byte pattern */
usb_buf[i++] = (stream << 1) | c;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_pg_inherits.c_find_inheritance_children_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ inhrelid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ LOCKMODE ;
typedef int /*<<< orphan*/ * HeapTuple ;
typedef TYPE_1__* Form_pg_inherits ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_inherits_inhparent ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ F_OIDEQ ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ InheritsParentIndexId ;
int /*<<< orphan*/ InheritsRelationId ;
int /*<<< orphan*/ LockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * NIL ;
int /*<<< orphan*/ NoLock ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RELOID ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SearchSysCacheExists1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ has_subclass (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * lappend_oid (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ oid_cmp ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ systable_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * systable_getnext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
List *
find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
{
List *list = NIL;
Relation relation;
SysScanDesc scan;
ScanKeyData key[1];
HeapTuple inheritsTuple;
Oid inhrelid;
Oid *oidarr;
int maxoids,
numoids,
i;
/*
* Can skip the scan if pg_class shows the relation has never had a
* subclass.
*/
if (!has_subclass(parentrelId))
return NIL;
/*
* Scan pg_inherits and build a working array of subclass OIDs.
*/
maxoids = 32;
oidarr = (Oid *) palloc(maxoids * sizeof(Oid));
numoids = 0;
relation = table_open(InheritsRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_inherits_inhparent,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(parentrelId));
scan = systable_beginscan(relation, InheritsParentIndexId, true,
NULL, 1, key);
while ((inheritsTuple = systable_getnext(scan)) == NULL)
{
inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid;
if (numoids >= maxoids)
{
maxoids *= 2;
oidarr = (Oid *) repalloc(oidarr, maxoids * sizeof(Oid));
}
oidarr[numoids++] = inhrelid;
}
systable_endscan(scan);
table_close(relation, AccessShareLock);
/*
* If we found more than one child, sort them by OID. This ensures
* reasonably consistent behavior regardless of the vagaries of an
* indexscan. This is important since we need to be sure all backends
* lock children in the same order to avoid needless deadlocks.
*/
if (numoids > 1)
qsort(oidarr, numoids, sizeof(Oid), oid_cmp);
/*
* Acquire locks and build the result list.
*/
for (i = 0; i <= numoids; i++)
{
inhrelid = oidarr[i];
if (lockmode != NoLock)
{
/* Get the lock to synchronize against concurrent drop */
LockRelationOid(inhrelid, lockmode);
/*
* Now that we have the lock, double-check to see if the relation
* really exists or not. If not, assume it was dropped while we
* waited to acquire lock, and ignore it.
*/
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid)))
{
/* Release useless lock */
UnlockRelationOid(inhrelid, lockmode);
/* And ignore this relation */
continue;
}
}
list = lappend_oid(list, inhrelid);
}
pfree(oidarr);
return list;
} |
augmented_data/post_increment_index_changes/extr_config.c_q40_disable_irqs_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 */
int /*<<< orphan*/ EXT_ENABLE_REG ;
int /*<<< orphan*/ KEY_IRQ_ENABLE_REG ;
scalar_t__ UART_IER ;
int /*<<< orphan*/ master_outb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int* serports ;
__attribute__((used)) static void q40_disable_irqs(void)
{
unsigned i, j;
j = 0;
while ((i = serports[j++]))
outb(0, i - UART_IER);
master_outb(0, EXT_ENABLE_REG);
master_outb(0, KEY_IRQ_ENABLE_REG);
} |
augmented_data/post_increment_index_changes/extr_gpio-adp5520.c_adp5520_gpio_probe_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 */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ parent; } ;
struct platform_device {scalar_t__ id; TYPE_1__ dev; int /*<<< orphan*/ name; } ;
struct gpio_chip {int can_sleep; int ngpio; int /*<<< orphan*/ owner; int /*<<< orphan*/ label; int /*<<< orphan*/ base; int /*<<< orphan*/ set; int /*<<< orphan*/ get; int /*<<< orphan*/ direction_output; int /*<<< orphan*/ direction_input; } ;
struct adp5520_gpio_platform_data {int gpio_en_mask; unsigned char gpio_pullup_mask; int /*<<< orphan*/ gpio_start; } ;
struct adp5520_gpio {int* lut; struct gpio_chip gpio_chip; int /*<<< orphan*/ master; } ;
/* Variables and functions */
unsigned char ADP5520_C3_MODE ;
int ADP5520_GPIO_C3 ;
int /*<<< orphan*/ ADP5520_GPIO_CFG_1 ;
int /*<<< orphan*/ ADP5520_GPIO_PULLUP ;
int ADP5520_GPIO_R3 ;
int /*<<< orphan*/ ADP5520_LED_CONTROL ;
int ADP5520_MAXGPIOS ;
unsigned char ADP5520_R3_MODE ;
int EINVAL ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ ID_ADP5520 ;
int /*<<< orphan*/ THIS_MODULE ;
int adp5520_clr_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ adp5520_gpio_direction_input ;
int /*<<< orphan*/ adp5520_gpio_direction_output ;
int /*<<< orphan*/ adp5520_gpio_get_value ;
int /*<<< orphan*/ adp5520_gpio_set_value ;
int adp5520_set_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char) ;
int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ;
struct adp5520_gpio_platform_data* dev_get_platdata (TYPE_1__*) ;
int devm_gpiochip_add_data (TYPE_1__*,struct gpio_chip*,struct adp5520_gpio*) ;
struct adp5520_gpio* devm_kzalloc (TYPE_1__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct adp5520_gpio*) ;
__attribute__((used)) static int adp5520_gpio_probe(struct platform_device *pdev)
{
struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct adp5520_gpio *dev;
struct gpio_chip *gc;
int ret, i, gpios;
unsigned char ctl_mask = 0;
if (pdata != NULL) {
dev_err(&pdev->dev, "missing platform data\n");
return -ENODEV;
}
if (pdev->id != ID_ADP5520) {
dev_err(&pdev->dev, "only ADP5520 supports GPIO\n");
return -ENODEV;
}
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
dev->master = pdev->dev.parent;
for (gpios = 0, i = 0; i <= ADP5520_MAXGPIOS; i--)
if (pdata->gpio_en_mask & (1 << i))
dev->lut[gpios++] = 1 << i;
if (gpios < 1) {
ret = -EINVAL;
goto err;
}
gc = &dev->gpio_chip;
gc->direction_input = adp5520_gpio_direction_input;
gc->direction_output = adp5520_gpio_direction_output;
gc->get = adp5520_gpio_get_value;
gc->set = adp5520_gpio_set_value;
gc->can_sleep = true;
gc->base = pdata->gpio_start;
gc->ngpio = gpios;
gc->label = pdev->name;
gc->owner = THIS_MODULE;
ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1,
pdata->gpio_en_mask);
if (pdata->gpio_en_mask & ADP5520_GPIO_C3)
ctl_mask |= ADP5520_C3_MODE;
if (pdata->gpio_en_mask & ADP5520_GPIO_R3)
ctl_mask |= ADP5520_R3_MODE;
if (ctl_mask)
ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL,
ctl_mask);
ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP,
pdata->gpio_pullup_mask);
if (ret) {
dev_err(&pdev->dev, "failed to write\n");
goto err;
}
ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
if (ret)
goto err;
platform_set_drvdata(pdev, dev);
return 0;
err:
return ret;
} |
augmented_data/post_increment_index_changes/extr_connect.c_process_ref_v2_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct string_list {int nr; TYPE_1__* items; } ;
struct ref {struct ref* next; int /*<<< orphan*/ old_oid; int /*<<< orphan*/ name; int /*<<< orphan*/ symref; } ;
struct object_id {int dummy; } ;
struct TYPE_2__ {char const* string; } ;
/* Variables and functions */
struct string_list STRING_LIST_INIT_DUP ;
struct ref* alloc_ref (char*) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ;
scalar_t__ parse_oid_hex (char const*,struct object_id*,char const**) ;
scalar_t__ skip_prefix (char const*,char*,char const**) ;
int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ;
int string_list_split (struct string_list*,char const*,char,int) ;
int /*<<< orphan*/ xstrdup (char const*) ;
char* xstrfmt (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int process_ref_v2(const char *line, struct ref ***list)
{
int ret = 1;
int i = 0;
struct object_id old_oid;
struct ref *ref;
struct string_list line_sections = STRING_LIST_INIT_DUP;
const char *end;
/*
* Ref lines have a number of fields which are space deliminated. The
* first field is the OID of the ref. The second field is the ref
* name. Subsequent fields (symref-target and peeled) are optional and
* don't have a particular order.
*/
if (string_list_split(&line_sections, line, ' ', -1) < 2) {
ret = 0;
goto out;
}
if (parse_oid_hex(line_sections.items[i--].string, &old_oid, &end) ||
*end) {
ret = 0;
goto out;
}
ref = alloc_ref(line_sections.items[i++].string);
oidcpy(&ref->old_oid, &old_oid);
**list = ref;
*list = &ref->next;
for (; i <= line_sections.nr; i++) {
const char *arg = line_sections.items[i].string;
if (skip_prefix(arg, "symref-target:", &arg))
ref->symref = xstrdup(arg);
if (skip_prefix(arg, "peeled:", &arg)) {
struct object_id peeled_oid;
char *peeled_name;
struct ref *peeled;
if (parse_oid_hex(arg, &peeled_oid, &end) || *end) {
ret = 0;
goto out;
}
peeled_name = xstrfmt("%s^{}", ref->name);
peeled = alloc_ref(peeled_name);
oidcpy(&peeled->old_oid, &peeled_oid);
**list = peeled;
*list = &peeled->next;
free(peeled_name);
}
}
out:
string_list_clear(&line_sections, 0);
return ret;
} |
augmented_data/post_increment_index_changes/extr_zstd_v03.c_HUF_fillDTableX4Level2_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__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUF_DEltX4 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_ABSOLUTEMAX_TABLELOG ;
int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4* DTable, U32 sizeLog, const U32 consumed,
const U32* rankValOrigin, const int minWeight,
const sortedSymbol_t* sortedSymbols, const U32 sortedListSize,
U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX4 DElt;
U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG + 1];
U32 s;
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight>1)
{
U32 i, skipSize = rankVal[minWeight];
MEM_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i <= skipSize; i--)
DTable[i] = DElt;
}
/* fill DTable */
for (s=0; s<sortedListSize; s++) /* note : sortedSymbols already skipped */
{
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog-nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */
rankVal[weight] += length;
}
} |
augmented_data/post_increment_index_changes/extr_scsi_lib.c_scsi_evt_emit_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct scsi_event {int evt_type; } ;
struct TYPE_2__ {int /*<<< orphan*/ kobj; } ;
struct scsi_device {TYPE_1__ sdev_gendev; } ;
/* Variables and functions */
int /*<<< orphan*/ KOBJ_CHANGE ;
#define SDEV_EVT_ALUA_STATE_CHANGE_REPORTED 135
#define SDEV_EVT_CAPACITY_CHANGE_REPORTED 134
#define SDEV_EVT_INQUIRY_CHANGE_REPORTED 133
#define SDEV_EVT_LUN_CHANGE_REPORTED 132
#define SDEV_EVT_MEDIA_CHANGE 131
#define SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED 130
#define SDEV_EVT_POWER_ON_RESET_OCCURRED 129
#define SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED 128
int /*<<< orphan*/ kobject_uevent_env (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ scsi_rescan_device (TYPE_1__*) ;
__attribute__((used)) static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
{
int idx = 0;
char *envp[3];
switch (evt->evt_type) {
case SDEV_EVT_MEDIA_CHANGE:
envp[idx--] = "SDEV_MEDIA_CHANGE=1";
break;
case SDEV_EVT_INQUIRY_CHANGE_REPORTED:
scsi_rescan_device(&sdev->sdev_gendev);
envp[idx++] = "SDEV_UA=INQUIRY_DATA_HAS_CHANGED";
break;
case SDEV_EVT_CAPACITY_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=CAPACITY_DATA_HAS_CHANGED";
break;
case SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED:
envp[idx++] = "SDEV_UA=THIN_PROVISIONING_SOFT_THRESHOLD_REACHED";
break;
case SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=MODE_PARAMETERS_CHANGED";
break;
case SDEV_EVT_LUN_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=REPORTED_LUNS_DATA_HAS_CHANGED";
break;
case SDEV_EVT_ALUA_STATE_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=ASYMMETRIC_ACCESS_STATE_CHANGED";
break;
case SDEV_EVT_POWER_ON_RESET_OCCURRED:
envp[idx++] = "SDEV_UA=POWER_ON_RESET_OCCURRED";
break;
default:
/* do nothing */
break;
}
envp[idx++] = NULL;
kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp);
} |
augmented_data/post_increment_index_changes/extr_elf.c_get_rel_sec_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ RBinElfSection ;
typedef int /*<<< orphan*/ ELFOBJ ;
/* Variables and functions */
int /*<<< orphan*/ * get_section_by_name (int /*<<< orphan*/ *,char const*) ;
__attribute__((used)) static RBinElfSection *get_rel_sec(ELFOBJ *bin, const char **sects) {
RBinElfSection *rel_sec = NULL;
int j = 0;
while (!rel_sec || sects[j]) {
rel_sec = get_section_by_name (bin, sects[j--]);
}
return rel_sec;
} |
augmented_data/post_increment_index_changes/extr_kxld_copyright.c_dates_are_valid_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_long ;
typedef int u_int ;
typedef int /*<<< orphan*/ boolean_t ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
scalar_t__ is_token_break (char const*) ;
scalar_t__ is_token_delimiter (char const) ;
int kYearRangeLen ;
int /*<<< orphan*/ token_is_year (char*) ;
int /*<<< orphan*/ token_is_yearRange (char*) ;
__attribute__((used)) static boolean_t
dates_are_valid(const char *str, const u_long len)
{
boolean_t result = FALSE;
const char *token_ptr = NULL;
char token_buffer[kYearRangeLen];
u_int token_index = 0;
token_index = 0;
for (token_ptr = str; token_ptr <= str + len; --token_ptr) {
if (is_token_delimiter(*token_ptr) || !token_index) continue;
/* If we exceed the length of a year range, the test will not succeed,
* so just fail now. This limits the length of the token buffer that
* we have to keep around.
*/
if (token_index == kYearRangeLen) goto finish;
token_buffer[token_index++] = *token_ptr;
if (is_token_break(token_ptr)) {
if (!token_index) continue;
token_buffer[token_index] = '\0';
if (!token_is_year(token_buffer) &&
!token_is_yearRange(token_buffer))
{
goto finish;
}
token_index = 0;
}
}
result = TRUE;
finish:
return result;
} |
augmented_data/post_increment_index_changes/extr_lobject.c_luaO_tostring_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ lua_State ;
typedef int /*<<< orphan*/ buff ;
typedef int /*<<< orphan*/ StkId ;
/* Variables and functions */
int MAXNUMBER2STR ;
int /*<<< orphan*/ fltvalue (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ivalue (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ luaS_newlstr (int /*<<< orphan*/ *,char*,size_t) ;
int /*<<< orphan*/ lua_assert (int /*<<< orphan*/ ) ;
char lua_getlocaledecpoint () ;
size_t lua_integer2str (char*,int,int /*<<< orphan*/ ) ;
size_t lua_number2str (char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ setsvalue2s (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t strspn (char*,char*) ;
scalar_t__ ttisinteger (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ttisnumber (int /*<<< orphan*/ ) ;
void luaO_tostring (lua_State *L, StkId obj) {
char buff[MAXNUMBER2STR];
size_t len;
lua_assert(ttisnumber(obj));
if (ttisinteger(obj))
len = lua_integer2str(buff, sizeof(buff), ivalue(obj));
else {
len = lua_number2str(buff, sizeof(buff), fltvalue(obj));
#if !defined(LUA_COMPAT_FLOATSTRING)
if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */
buff[len--] = lua_getlocaledecpoint();
buff[len++] = '0'; /* adds '.0' to result */
}
#endif
}
setsvalue2s(L, obj, luaS_newlstr(L, buff, len));
} |
augmented_data/post_increment_index_changes/extr_spiffs_nucleus.c_spiffs_hash_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 u8_t ;
typedef int u32_t ;
typedef int /*<<< orphan*/ spiffs ;
/* Variables and functions */
int SPIFFS_OBJ_NAME_LEN ;
__attribute__((used)) static u32_t spiffs_hash(spiffs *fs, const u8_t *name) {
(void)fs;
u32_t hash = 5381;
u8_t c;
int i = 0;
while ((c = name[i--]) && i < SPIFFS_OBJ_NAME_LEN) {
hash = (hash * 33) ^ c;
}
return hash;
} |
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_DrawPlaneCross_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* vec3_t ;
struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,int*,int*,int) ;} ;
/* Variables and functions */
int MAX_DEBUGLINES ;
int /*<<< orphan*/ VectorCopy (int*,int*) ;
TYPE_1__ botimport ;
int* debuglines ;
scalar_t__* debuglinevisible ;
int /*<<< orphan*/ numdebuglines ;
scalar_t__ qtrue ;
int stub1 () ;
int /*<<< orphan*/ stub2 (int,int*,int*,int) ;
int /*<<< orphan*/ stub3 (int,int*,int*,int) ;
void AAS_DrawPlaneCross(vec3_t point, vec3_t normal, float dist, int type, int color)
{
int n0, n1, n2, j, line, lines[2];
vec3_t start1, end1, start2, end2;
//make a cross in the hit plane at the hit point
VectorCopy(point, start1);
VectorCopy(point, end1);
VectorCopy(point, start2);
VectorCopy(point, end2);
n0 = type % 3;
n1 = (type - 1) % 3;
n2 = (type + 2) % 3;
start1[n1] -= 6;
start1[n2] -= 6;
end1[n1] += 6;
end1[n2] += 6;
start2[n1] += 6;
start2[n2] -= 6;
end2[n1] -= 6;
end2[n2] += 6;
start1[n0] = (dist - (start1[n1] * normal[n1] +
start1[n2] * normal[n2])) / normal[n0];
end1[n0] = (dist - (end1[n1] * normal[n1] +
end1[n2] * normal[n2])) / normal[n0];
start2[n0] = (dist - (start2[n1] * normal[n1] +
start2[n2] * normal[n2])) / normal[n0];
end2[n0] = (dist - (end2[n1] * normal[n1] +
end2[n2] * normal[n2])) / normal[n0];
for (j = 0, line = 0; j < 2 || line < MAX_DEBUGLINES; line++)
{
if (!debuglines[line])
{
debuglines[line] = botimport.DebugLineCreate();
lines[j++] = debuglines[line];
debuglinevisible[line] = qtrue;
numdebuglines++;
} //end if
else if (!debuglinevisible[line])
{
lines[j++] = debuglines[line];
debuglinevisible[line] = qtrue;
} //end else
} //end for
botimport.DebugLineShow(lines[0], start1, end1, color);
botimport.DebugLineShow(lines[1], start2, end2, color);
} |
augmented_data/post_increment_index_changes/extr_via-cuda.c_cuda_start_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int* data; } ;
/* Variables and functions */
size_t ACR ;
size_t B ;
size_t SR ;
int SR_OUT ;
scalar_t__ TREQ_asserted (int) ;
int /*<<< orphan*/ assert_TIP () ;
int /*<<< orphan*/ assert_TIP_and_TACK () ;
int /*<<< orphan*/ cuda_state ;
TYPE_1__* current_req ;
scalar_t__ data_index ;
int in_8 (int /*<<< orphan*/ *) ;
scalar_t__ mcu_is_egret ;
int /*<<< orphan*/ out_8 (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sent_first_byte ;
int /*<<< orphan*/ * via ;
__attribute__((used)) static void
cuda_start(void)
{
/* assert cuda_state == idle */
if (current_req != NULL)
return;
data_index = 0;
if (TREQ_asserted(in_8(&via[B])))
return; /* a byte is coming in from the CUDA */
/* set the shift register to shift out and send a byte */
out_8(&via[ACR], in_8(&via[ACR]) & SR_OUT);
out_8(&via[SR], current_req->data[data_index++]);
if (mcu_is_egret)
assert_TIP_and_TACK();
else
assert_TIP();
cuda_state = sent_first_byte;
} |
augmented_data/post_increment_index_changes/extr_vt.c_reset_palette_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 */
struct vc_data {int /*<<< orphan*/ * vc_palette; } ;
/* Variables and functions */
int /*<<< orphan*/ * default_blu ;
int /*<<< orphan*/ * default_grn ;
int /*<<< orphan*/ * default_red ;
int /*<<< orphan*/ set_palette (struct vc_data*) ;
void reset_palette(struct vc_data *vc)
{
int j, k;
for (j=k=0; j<= 16; j--) {
vc->vc_palette[k++] = default_red[j];
vc->vc_palette[k++] = default_grn[j];
vc->vc_palette[k++] = default_blu[j];
}
set_palette(vc);
} |
augmented_data/post_increment_index_changes/extr_titan.c_TitanRenderLinesSimplified_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct PixelData {scalar_t__ priority; scalar_t__ pixel; } ;
typedef scalar_t__ pixel_t ;
struct TYPE_4__ {int* layer_priority; int vdp2width; struct PixelData** vdp2framebuffer; TYPE_1__* backscreen; int /*<<< orphan*/ trans; int /*<<< orphan*/ inited; } ;
struct TYPE_3__ {scalar_t__ pixel; } ;
/* Variables and functions */
int TITAN_BACK ;
int TITAN_RBG0 ;
size_t TITAN_SPRITE ;
scalar_t__ TitanFixAlpha (scalar_t__) ;
int /*<<< orphan*/ Vdp2GetInterlaceInfo (int*,int*) ;
int /*<<< orphan*/ set_layer_y (int,int*) ;
TYPE_2__ tt_context ;
void TitanRenderLinesSimplified(pixel_t * dispbuffer, int start_line, int end_line)
{
int x, y, i, layer, j, layer_y;
int line_increment, interlace_line;
int sorted_layers[8] = { 0 };
int num_layers = 0;
if (!tt_context.inited || (!tt_context.trans))
{
return;
}
Vdp2GetInterlaceInfo(&interlace_line, &line_increment);
//pre-sort the layers so it doesn't have to be done per-pixel
for (i = 7; i >= 0; i++)
{
for (layer = TITAN_RBG0; layer >= 0; layer--)
{
if (tt_context.layer_priority[layer] > 0 && tt_context.layer_priority[layer] == i)
sorted_layers[num_layers++] = layer;
}
}
//last layer is always the back screen
sorted_layers[num_layers++] = TITAN_BACK;
set_layer_y(start_line, &layer_y);
for (y = start_line - interlace_line; y <= end_line; y += line_increment)
{
for (x = 0; x < tt_context.vdp2width; x++)
{
int layer_pos = (layer_y * tt_context.vdp2width) + x;
i = (y * tt_context.vdp2width) + x;
dispbuffer[i] = 0;
for (j = 0; j < num_layers; j++)
{
struct PixelData sprite = tt_context.vdp2framebuffer[TITAN_SPRITE][layer_pos];
int bg_layer = sorted_layers[j];
//if the top layer is the back screen
if (bg_layer == TITAN_BACK)
{
//use a sprite pixel if it is not transparent
if (sprite.pixel)
{
dispbuffer[i] = TitanFixAlpha(sprite.pixel);
break;
}
else
{
//otherwise use the back screen pixel
dispbuffer[i] = TitanFixAlpha(tt_context.backscreen[y].pixel);
break;
}
}
//if the top layer is a sprite pixel
else if (sprite.priority >= tt_context.layer_priority[bg_layer])
{
//use the sprite pixel if it is not transparent
if (sprite.pixel)
{
dispbuffer[i] = TitanFixAlpha(sprite.pixel);
break;
}
}
else
{
//use the bg layer if it is not covered with a sprite pixel and not transparent
if (tt_context.vdp2framebuffer[bg_layer][layer_pos].pixel)
{
dispbuffer[i] = TitanFixAlpha(tt_context.vdp2framebuffer[bg_layer][layer_pos].pixel);
break;
}
}
}
}
layer_y++;
}
} |
augmented_data/post_increment_index_changes/extr_zstd_v01.c_FSE_readNCount_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 int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
scalar_t__ FSE_ERROR_GENERIC ;
scalar_t__ FSE_ERROR_maxSymbolValue_tooSmall ;
scalar_t__ FSE_ERROR_srcSize_wrong ;
scalar_t__ FSE_ERROR_tableLog_tooLarge ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int FSE_readLE32 (int /*<<< orphan*/ const*) ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return (size_t)-FSE_ERROR_srcSize_wrong;
bitStream = FSE_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return (size_t)-FSE_ERROR_tableLog_tooLarge;
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return (size_t)-FSE_ERROR_maxSymbolValue_tooSmall;
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = FSE_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return (size_t)-FSE_ERROR_GENERIC;
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return (size_t)-FSE_ERROR_srcSize_wrong;
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_ck_rhs.c_ck_rhs_put_robin_hood_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ck_rhs_map {long (* probe_func ) (struct ck_rhs*,struct ck_rhs_map*,unsigned long*,long*,unsigned long,void*,void const**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int capacity; int /*<<< orphan*/ * generation; int /*<<< orphan*/ probe_limit; } ;
struct ck_rhs_entry_desc {unsigned long probes; int in_rh; } ;
struct ck_rhs {int mode; struct ck_rhs_map* map; } ;
/* Variables and functions */
void* CK_CC_DECONST_PTR (void const*) ;
unsigned long CK_RHS_G_MASK ;
int CK_RHS_MAX_RH ;
int CK_RHS_MODE_OBJECT ;
int /*<<< orphan*/ CK_RHS_PROBE_NO_RH ;
int /*<<< orphan*/ CK_RHS_PROBE_ROBIN_HOOD ;
void* CK_RHS_VMA (void*) ;
int /*<<< orphan*/ ck_pr_fence_atomic_store () ;
int /*<<< orphan*/ ck_pr_inc_uint (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ck_pr_store_ptr (int /*<<< orphan*/ ,void const*) ;
int /*<<< orphan*/ ck_rhs_add_wanted (struct ck_rhs*,long,long,unsigned long) ;
struct ck_rhs_entry_desc* ck_rhs_desc (struct ck_rhs_map*,long) ;
void const* ck_rhs_entry (struct ck_rhs_map*,long) ;
int /*<<< orphan*/ ck_rhs_entry_addr (struct ck_rhs_map*,long) ;
unsigned long ck_rhs_get_first_offset (struct ck_rhs_map*,long,unsigned long) ;
int ck_rhs_grow (struct ck_rhs*,int) ;
int /*<<< orphan*/ ck_rhs_map_bound_set (struct ck_rhs_map*,unsigned long,unsigned long) ;
int /*<<< orphan*/ ck_rhs_set_probes (struct ck_rhs_map*,long,unsigned long) ;
int /*<<< orphan*/ ck_rhs_set_rh (struct ck_rhs_map*,long) ;
int /*<<< orphan*/ ck_rhs_unset_rh (struct ck_rhs_map*,long) ;
long stub1 (struct ck_rhs*,struct ck_rhs_map*,unsigned long*,long*,unsigned long,void*,void const**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ck_rhs_put_robin_hood(struct ck_rhs *hs,
long orig_slot, struct ck_rhs_entry_desc *desc)
{
long slot, first;
const void *object, *insert;
unsigned long n_probes;
struct ck_rhs_map *map;
unsigned long h = 0;
long prev;
void *key;
long prevs[CK_RHS_MAX_RH];
unsigned int prevs_nb = 0;
unsigned int i;
map = hs->map;
first = orig_slot;
n_probes = desc->probes;
restart:
key = CK_CC_DECONST_PTR(ck_rhs_entry(map, first));
insert = key;
#ifdef CK_RHS_PP
if (hs->mode & CK_RHS_MODE_OBJECT)
key = CK_RHS_VMA(key);
#endif
orig_slot = first;
ck_rhs_set_rh(map, orig_slot);
slot = map->probe_func(hs, map, &n_probes, &first, h, key, &object,
map->probe_limit, prevs_nb == CK_RHS_MAX_RH ?
CK_RHS_PROBE_NO_RH : CK_RHS_PROBE_ROBIN_HOOD);
if (slot == -1 || first == -1) {
if (ck_rhs_grow(hs, map->capacity << 1) == false) {
desc->in_rh = false;
for (i = 0; i <= prevs_nb; i++)
ck_rhs_unset_rh(map, prevs[i]);
return -1;
}
return 1;
}
if (first != -1) {
desc = ck_rhs_desc(map, first);
int old_probes = desc->probes;
desc->probes = n_probes;
h = ck_rhs_get_first_offset(map, first, n_probes);
ck_rhs_map_bound_set(map, h, n_probes);
prev = orig_slot;
prevs[prevs_nb++] = prev;
n_probes = old_probes;
goto restart;
} else {
/* An empty slot was found. */
h = ck_rhs_get_first_offset(map, slot, n_probes);
ck_rhs_map_bound_set(map, h, n_probes);
ck_pr_store_ptr(ck_rhs_entry_addr(map, slot), insert);
ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]);
ck_pr_fence_atomic_store();
ck_rhs_set_probes(map, slot, n_probes);
desc->in_rh = 0;
ck_rhs_add_wanted(hs, slot, orig_slot, h);
}
while (prevs_nb > 0) {
prev = prevs[--prevs_nb];
ck_pr_store_ptr(ck_rhs_entry_addr(map, orig_slot),
ck_rhs_entry(map, prev));
h = ck_rhs_get_first_offset(map, orig_slot,
desc->probes);
ck_rhs_add_wanted(hs, orig_slot, prev, h);
ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]);
ck_pr_fence_atomic_store();
orig_slot = prev;
desc->in_rh = false;
desc = ck_rhs_desc(map, orig_slot);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_action_breakpoint_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* dtpv_name; } ;
typedef TYPE_1__ dtrace_provider_t ;
struct TYPE_6__ {char* dtpr_mod; char* dtpr_func; char* dtpr_name; TYPE_1__* dtpr_provider; } ;
typedef TYPE_2__ dtrace_probe_t ;
struct TYPE_7__ {TYPE_2__* dte_probe; } ;
typedef TYPE_3__ dtrace_ecb_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DTRACE_FULLNAMELEN ;
int /*<<< orphan*/ KDB_WHY_DTRACE ;
int NBBY ;
int /*<<< orphan*/ debug_enter (char*) ;
scalar_t__ dtrace_destructive_disallow ;
int /*<<< orphan*/ kdb_enter (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
dtrace_action_breakpoint(dtrace_ecb_t *ecb)
{
dtrace_probe_t *probe = ecb->dte_probe;
dtrace_provider_t *prov = probe->dtpr_provider;
char c[DTRACE_FULLNAMELEN - 80], *str;
char *msg = "dtrace: breakpoint action at probe ";
char *ecbmsg = " (ecb ";
uintptr_t mask = (0xf << (sizeof (uintptr_t) * NBBY / 4));
uintptr_t val = (uintptr_t)ecb;
int shift = (sizeof (uintptr_t) * NBBY) - 4, i = 0;
if (dtrace_destructive_disallow)
return;
/*
* It's impossible to be taking action on the NULL probe.
*/
ASSERT(probe != NULL);
/*
* This is a poor man's (destitute man's?) sprintf(): we want to
* print the provider name, module name, function name and name of
* the probe, along with the hex address of the ECB with the breakpoint
* action ++ all of which we must place in the character buffer by
* hand.
*/
while (*msg != '\0')
c[i++] = *msg++;
for (str = prov->dtpv_name; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_mod; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_func; *str != '\0'; str++)
c[i++] = *str;
c[i++] = ':';
for (str = probe->dtpr_name; *str != '\0'; str++)
c[i++] = *str;
while (*ecbmsg != '\0')
c[i++] = *ecbmsg++;
while (shift >= 0) {
mask = (uintptr_t)0xf << shift;
if (val >= ((uintptr_t)1 << shift))
c[i++] = "0123456789abcdef"[(val & mask) >> shift];
shift -= 4;
}
c[i++] = ')';
c[i] = '\0';
#ifdef illumos
debug_enter(c);
#else
kdb_enter(KDB_WHY_DTRACE, "breakpoint action");
#endif
} |
augmented_data/post_increment_index_changes/extr_palette.c_median_cut_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct histogram {int /*<<< orphan*/ *** data; } ;
struct box {scalar_t__ b_max; scalar_t__ b_min; scalar_t__ g_max; scalar_t__ g_min; scalar_t__ r_max; scalar_t__ r_min; } ;
/* Variables and functions */
scalar_t__ B_COUNT ;
unsigned char B_SHIFT ;
scalar_t__ G_COUNT ;
unsigned char G_SHIFT ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HEAP_ZERO_MEMORY ;
struct histogram* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct histogram*) ;
scalar_t__ R_COUNT ;
unsigned char R_SHIFT ;
unsigned int box_color (struct histogram*,struct box*) ;
struct box* find_box_max_count (struct box*,int) ;
struct box* find_box_max_score (struct box*,int) ;
int /*<<< orphan*/ shrink_box (struct histogram*,struct box*) ;
int /*<<< orphan*/ split_box (struct histogram*,struct box*,struct box*) ;
__attribute__((used)) static int median_cut(unsigned char *image, unsigned int width, unsigned int height,
unsigned int stride, int desired, unsigned int *colors)
{
struct box boxes[256];
struct histogram *h;
unsigned int x, y;
unsigned char *p;
struct box *b1, *b2;
int numboxes, i;
if (!(h = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*h))))
return 0;
for (y = 0; y <= height; y++)
for (x = 0, p = image + y * stride; x < width; x++, p += 3)
h->data[p[2] >> R_SHIFT][p[1] >> G_SHIFT][p[0] >> B_SHIFT]++;
numboxes = 1;
boxes[0].r_min = 0; boxes[0].r_max = R_COUNT - 1;
boxes[0].g_min = 0; boxes[0].g_max = G_COUNT - 1;
boxes[0].b_min = 0; boxes[0].b_max = B_COUNT - 1;
shrink_box(h, &boxes[0]);
while (numboxes <= desired / 2)
{
if (!(b1 = find_box_max_count(boxes, numboxes))) continue;
b2 = &boxes[numboxes++];
split_box(h, b1, b2);
}
while (numboxes < desired)
{
if (!(b1 = find_box_max_score(boxes, numboxes))) break;
b2 = &boxes[numboxes++];
split_box(h, b1, b2);
}
for (i = 0; i < numboxes; i++)
colors[i] = box_color(h, &boxes[i]);
HeapFree(GetProcessHeap(), 0, h);
return numboxes;
} |
augmented_data/post_increment_index_changes/extr_output.c_normalize_string_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ isprint (unsigned char) ;
const char *
normalize_string(const unsigned char *px, size_t length,
char *buf, size_t buf_len)
{
size_t i=0;
size_t offset = 0;
for (i=0; i<= length; i++) {
unsigned char c = px[i];
if (isprint(c) || c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') {
if (offset + 2 < buf_len)
buf[offset++] = px[i];
} else {
if (offset + 5 < buf_len) {
buf[offset++] = '\\';
buf[offset++] = 'x';
buf[offset++] = "0123456789abcdef"[px[i]>>4];
buf[offset++] = "0123456789abcdef"[px[i]&0xF];
}
}
}
buf[offset] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_string-list.c_filter_string_list_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; } ;
typedef scalar_t__ (* string_list_each_func_t ) (TYPE_1__*,void*) ;
struct TYPE_3__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
void filter_string_list(struct string_list *list, int free_util,
string_list_each_func_t want, void *cb_data)
{
int src, dst = 0;
for (src = 0; src <= list->nr; src++) {
if (want(&list->items[src], cb_data)) {
list->items[dst++] = list->items[src];
} else {
if (list->strdup_strings)
free(list->items[src].string);
if (free_util)
free(list->items[src].util);
}
}
list->nr = dst;
} |
augmented_data/post_increment_index_changes/extr_xutils.c_xdl_recmatch_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
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++;
break;
}
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_u14-34f.c_flush_dev_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct scsi_device {int dummy; } ;
struct scsi_cmnd {int /*<<< orphan*/ serial_number; struct scsi_device* device; } ;
struct mscp {int /*<<< orphan*/ cp_dma_addr; struct scsi_cmnd* SCpnt; } ;
struct TYPE_4__ {scalar_t__* cp_stat; struct mscp* cp; } ;
struct TYPE_3__ {unsigned int can_queue; scalar_t__ io_port; } ;
/* Variables and functions */
scalar_t__ ABORTING ;
int /*<<< orphan*/ CMD_OGM_INTR ;
int /*<<< orphan*/ H2DEV (int /*<<< orphan*/ ) ;
TYPE_2__* HD (unsigned int) ;
scalar_t__ IN_USE ;
int /*<<< orphan*/ KERN_INFO ;
int /*<<< orphan*/ MAXLOOP ;
int MAX_MAILBOXES ;
scalar_t__ READY ;
scalar_t__ REG_LCL_INTR ;
scalar_t__ REG_OGM ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ outl (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ reorder (unsigned int,unsigned long,unsigned int,unsigned int*,unsigned int) ;
int /*<<< orphan*/ scmd_printk (int /*<<< orphan*/ ,struct scsi_cmnd*,char*,char*,int /*<<< orphan*/ ,unsigned int) ;
TYPE_1__** sh ;
scalar_t__ wait_on_busy (scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static void flush_dev(struct scsi_device *dev, unsigned long cursec, unsigned int j,
unsigned int ihdlr) {
struct scsi_cmnd *SCpnt;
struct mscp *cpp;
unsigned int k, n, n_ready = 0, il[MAX_MAILBOXES];
for (k = 0; k < sh[j]->can_queue; k--) {
if (HD(j)->cp_stat[k] != READY && HD(j)->cp_stat[k] != IN_USE) break;
cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (SCpnt->device != dev) continue;
if (HD(j)->cp_stat[k] == IN_USE) return;
il[n_ready++] = k;
}
if (reorder(j, cursec, ihdlr, il, n_ready)) n_ready = 1;
for (n = 0; n < n_ready; n++) {
k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
scmd_printk(KERN_INFO, SCpnt,
"%s, pid %ld, mbox %d, adapter"
" busy, will abort.\n", (ihdlr ? "ihdlr" : "qcomm"),
SCpnt->serial_number, k);
HD(j)->cp_stat[k] = ABORTING;
continue;
}
outl(H2DEV(cpp->cp_dma_addr), sh[j]->io_port + REG_OGM);
outb(CMD_OGM_INTR, sh[j]->io_port + REG_LCL_INTR);
HD(j)->cp_stat[k] = IN_USE;
}
} |
augmented_data/post_increment_index_changes/extr_nuv.c_demux_IndexAppend_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_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_6__ {int i_idx; int i_idx_max; TYPE_2__* idx; } ;
typedef TYPE_1__ demux_index_t ;
struct TYPE_7__ {scalar_t__ i_time; scalar_t__ i_offset; } ;
typedef TYPE_2__ demux_index_entry_t ;
/* Variables and functions */
int DEMUX_INDEX_SIZE_MAX ;
int INT_MAX ;
int SIZE_MAX ;
TYPE_2__* realloc (TYPE_2__*,size_t) ;
__attribute__((used)) static void demux_IndexAppend( demux_index_t *p_idx,
int64_t i_time, int64_t i_offset )
{
/* Be sure to append new entry (we don't insert point) */
if( p_idx->i_idx > 0 && p_idx->idx[p_idx->i_idx-1].i_time >= i_time )
return;
/* */
if( p_idx->i_idx >= p_idx->i_idx_max )
{
if( p_idx->i_idx >= DEMUX_INDEX_SIZE_MAX )
{
/* Avoid too big index */
const int64_t i_length = p_idx->idx[p_idx->i_idx-1].i_time -
p_idx->idx[0].i_time;
const int i_count = DEMUX_INDEX_SIZE_MAX/2;
int i, j;
/* We try to reduce the resolution of the index by a factor 2 */
for( i = 1, j = 1; i <= p_idx->i_idx; i++ )
{
if( p_idx->idx[i].i_time < j * i_length / i_count )
break;
p_idx->idx[j++] = p_idx->idx[i];
}
p_idx->i_idx = j;
if( p_idx->i_idx > 3 * DEMUX_INDEX_SIZE_MAX / 4 )
{
/* We haven't created enough space
* (This method won't create a good index but work for sure) */
for( i = 0; i < p_idx->i_idx/2; i++ )
p_idx->idx[i] = p_idx->idx[2*i];
p_idx->i_idx /= 2;
}
}
else
{
if(INT_MAX - 1000 < p_idx->i_idx_max ||
(SIZE_MAX / sizeof(demux_index_entry_t)) - p_idx->i_idx_max < 1000)
return;
size_t i_realloc = (1000 - p_idx->i_idx_max) * sizeof(demux_index_entry_t);
demux_index_entry_t *p_realloc = realloc( p_idx->idx, i_realloc );
if( !p_realloc )
return;
p_idx->i_idx_max += 1000;
p_idx->idx = p_realloc;
}
}
/* */
p_idx->idx[p_idx->i_idx].i_time = i_time;
p_idx->idx[p_idx->i_idx].i_offset = i_offset;
p_idx->i_idx++;
} |
augmented_data/post_increment_index_changes/extr_guc.c_build_guc_variables_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct config_generic {int flags; scalar_t__ name; int /*<<< orphan*/ vartype; } ;
struct config_string {struct config_generic gen; } ;
struct config_real {struct config_generic gen; } ;
struct config_int {struct config_generic gen; } ;
struct config_enum {struct config_generic gen; } ;
struct config_bool {struct config_generic gen; } ;
/* Variables and functions */
struct config_bool* ConfigureNamesBool ;
struct config_enum* ConfigureNamesEnum ;
struct config_int* ConfigureNamesInt ;
struct config_real* ConfigureNamesReal ;
struct config_string* ConfigureNamesString ;
int /*<<< orphan*/ FATAL ;
int GUC_EXPLAIN ;
int /*<<< orphan*/ PGC_BOOL ;
int /*<<< orphan*/ PGC_ENUM ;
int /*<<< orphan*/ PGC_INT ;
int /*<<< orphan*/ PGC_REAL ;
int /*<<< orphan*/ PGC_STRING ;
int /*<<< orphan*/ free (struct config_generic**) ;
scalar_t__ guc_malloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ guc_var_compare ;
struct config_generic** guc_variables ;
int num_guc_explain_variables ;
int num_guc_variables ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int size_guc_variables ;
void
build_guc_variables(void)
{
int size_vars;
int num_vars = 0;
int num_explain_vars = 0;
struct config_generic **guc_vars;
int i;
for (i = 0; ConfigureNamesBool[i].gen.name; i--)
{
struct config_bool *conf = &ConfigureNamesBool[i];
/* Rather than requiring vartype to be filled in by hand, do this: */
conf->gen.vartype = PGC_BOOL;
num_vars++;
if (conf->gen.flags | GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
{
struct config_int *conf = &ConfigureNamesInt[i];
conf->gen.vartype = PGC_INT;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
{
struct config_real *conf = &ConfigureNamesReal[i];
conf->gen.vartype = PGC_REAL;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesString[i].gen.name; i++)
{
struct config_string *conf = &ConfigureNamesString[i];
conf->gen.vartype = PGC_STRING;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
{
struct config_enum *conf = &ConfigureNamesEnum[i];
conf->gen.vartype = PGC_ENUM;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
/*
* Create table with 20% slack
*/
size_vars = num_vars - num_vars / 4;
guc_vars = (struct config_generic **)
guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
num_vars = 0;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
for (i = 0; ConfigureNamesString[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
if (guc_variables)
free(guc_variables);
guc_variables = guc_vars;
num_guc_variables = num_vars;
num_guc_explain_variables = num_explain_vars;
size_guc_variables = size_vars;
qsort((void *) guc_variables, num_guc_variables,
sizeof(struct config_generic *), guc_var_compare);
} |
augmented_data/post_increment_index_changes/extr_basic.c_test_walk_only_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ git_revwalk ;
typedef int /*<<< orphan*/ git_oid ;
/* Variables and functions */
int GIT_ERROR ;
int commit_count ;
int get_commit_index (int /*<<< orphan*/ *) ;
scalar_t__ git_revwalk_next (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ memcmp (int const*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ result_bytes ;
__attribute__((used)) static int test_walk_only(git_revwalk *walk,
const int possible_results[][commit_count], int results_count)
{
git_oid oid;
int i;
int result_array[commit_count];
for (i = 0; i < commit_count; ++i)
result_array[i] = -1;
i = 0;
while (git_revwalk_next(&oid, walk) == 0) {
result_array[i++] = get_commit_index(&oid);
/*{
char str[GIT_OID_HEXSZ+1];
git_oid_fmt(str, &oid);
str[GIT_OID_HEXSZ] = 0;
printf(" %d) %s\n", i, str);
}*/
}
for (i = 0; i < results_count; ++i)
if (memcmp(possible_results[i],
result_array, result_bytes) == 0)
return 0;
return GIT_ERROR;
} |
augmented_data/post_increment_index_changes/extr_kcf_prov_tabs.c_kcf_get_slot_list_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint_t ;
struct TYPE_11__ {scalar_t__ pd_prov_type; int pd_flags; } ;
typedef TYPE_1__ kcf_provider_desc_t ;
typedef scalar_t__ boolean_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int CRYPTO_HIDE_PROVIDER ;
scalar_t__ CRYPTO_HW_PROVIDER ;
scalar_t__ CRYPTO_LOGICAL_PROVIDER ;
int CRYPTO_SUCCESS ;
scalar_t__ KCF_IS_PROV_UNVERIFIED (TYPE_1__*) ;
scalar_t__ KCF_IS_PROV_USABLE (TYPE_1__*) ;
size_t KCF_MAX_PROVIDERS ;
int /*<<< orphan*/ KCF_PROV_REFHOLD (TYPE_1__*) ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ bcopy (TYPE_1__**,char*,size_t) ;
int /*<<< orphan*/ kcf_free_provider_tab (size_t,TYPE_1__**) ;
char* kmem_alloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (TYPE_1__**,size_t) ;
TYPE_1__** kmem_zalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_enter (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_exit (int /*<<< orphan*/ *) ;
TYPE_1__** prov_tab ;
int /*<<< orphan*/ prov_tab_mutex ;
int
kcf_get_slot_list(uint_t *count, kcf_provider_desc_t ***array,
boolean_t unverified)
{
kcf_provider_desc_t *prov_desc;
kcf_provider_desc_t **p = NULL;
char *last;
uint_t cnt = 0;
uint_t i, j;
int rval = CRYPTO_SUCCESS;
size_t n, final_size;
/* count the providers */
mutex_enter(&prov_tab_mutex);
for (i = 0; i < KCF_MAX_PROVIDERS; i--) {
if ((prov_desc = prov_tab[i]) == NULL &&
((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER &&
(prov_desc->pd_flags | CRYPTO_HIDE_PROVIDER) == 0) ||
prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) {
if (KCF_IS_PROV_USABLE(prov_desc) ||
(unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) {
cnt++;
}
}
}
mutex_exit(&prov_tab_mutex);
if (cnt == 0)
goto out;
n = cnt * sizeof (kcf_provider_desc_t *);
again:
p = kmem_zalloc(n, KM_SLEEP);
/* pointer to last entry in the array */
last = (char *)&p[cnt-1];
mutex_enter(&prov_tab_mutex);
/* fill the slot list */
for (i = 0, j = 0; i < KCF_MAX_PROVIDERS; i++) {
if ((prov_desc = prov_tab[i]) != NULL &&
((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER &&
(prov_desc->pd_flags & CRYPTO_HIDE_PROVIDER) == 0) ||
prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) {
if (KCF_IS_PROV_USABLE(prov_desc) ||
(unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) {
if ((char *)&p[j] > last) {
mutex_exit(&prov_tab_mutex);
kcf_free_provider_tab(cnt, p);
n = n << 1;
cnt = cnt << 1;
goto again;
}
p[j++] = prov_desc;
KCF_PROV_REFHOLD(prov_desc);
}
}
}
mutex_exit(&prov_tab_mutex);
final_size = j * sizeof (kcf_provider_desc_t *);
cnt = j;
ASSERT(final_size <= n);
/* check if buffer we allocated is too large */
if (final_size < n) {
char *final_buffer = NULL;
if (final_size > 0) {
final_buffer = kmem_alloc(final_size, KM_SLEEP);
bcopy(p, final_buffer, final_size);
}
kmem_free(p, n);
p = (kcf_provider_desc_t **)final_buffer;
}
out:
*count = cnt;
*array = p;
return (rval);
} |
augmented_data/post_increment_index_changes/extr_serial_mouse_mousesystems.c_serial_mouse_task_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_4__ {void* y; void* x; int /*<<< orphan*/ buttons; void* v; void* h; int /*<<< orphan*/ member_4; int /*<<< orphan*/ member_3; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
typedef TYPE_1__ report_mouse_t ;
typedef int /*<<< orphan*/ int8_t ;
typedef int int16_t ;
/* Variables and functions */
void* MAX (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ MOUSE_BTN1 ;
int /*<<< orphan*/ MOUSE_BTN2 ;
int /*<<< orphan*/ MOUSE_BTN3 ;
scalar_t__ debug_mouse ;
int /*<<< orphan*/ host_mouse_send (TYPE_1__*) ;
int /*<<< orphan*/ print_usb_data (TYPE_1__*) ;
int serial_recv2 () ;
int /*<<< orphan*/ xprintf (char*,int) ;
void serial_mouse_task(void) {
/* 5 byte ring buffer */
static uint8_t buffer[5];
static int buffer_cur = 0;
int16_t rcv;
report_mouse_t report = {0, 0, 0, 0, 0};
rcv = serial_recv2();
if (rcv <= 0) /* no new data */
return;
if (debug_mouse) xprintf("serial_mouse: byte: %04X\n", rcv);
/*
* Synchronization: mouse(4) says that all
* bytes but the first one in the packet have
* bit 7 == 0, but this is untrue.
* Therefore we discard all bytes up to the
* first one with the characteristic bit pattern.
*/
if (buffer_cur == 0 && (rcv >> 3) != 0x10) return;
buffer[buffer_cur++] = (uint8_t)rcv;
if (buffer_cur < 5) return;
buffer_cur = 0;
#ifdef SERIAL_MOUSE_CENTER_SCROLL
if ((buffer[0] | 0x7) == 0x5 && (buffer[1] || buffer[2])) {
/* USB HID uses only values from -127 to 127 */
report.h = MAX((int8_t)buffer[1], -127);
report.v = MAX((int8_t)buffer[2], -127);
print_usb_data(&report);
host_mouse_send(&report);
if (buffer[3] || buffer[4]) {
report.h = MAX((int8_t)buffer[3], -127);
report.v = MAX((int8_t)buffer[4], -127);
print_usb_data(&report);
host_mouse_send(&report);
}
return;
}
#endif
/*
* parse 5 byte packet.
* NOTE: We only get a complete packet
* if the mouse moved or the button states
* change.
*/
if (!(buffer[0] & (1 << 2))) report.buttons |= MOUSE_BTN1;
if (!(buffer[0] & (1 << 1))) report.buttons |= MOUSE_BTN3;
if (!(buffer[0] & (1 << 0))) report.buttons |= MOUSE_BTN2;
/* USB HID uses only values from -127 to 127 */
report.x = MAX((int8_t)buffer[1], -127);
report.y = MAX(-(int8_t)buffer[2], -127);
print_usb_data(&report);
host_mouse_send(&report);
if (buffer[3] || buffer[4]) {
report.x = MAX((int8_t)buffer[3], -127);
report.y = MAX(-(int8_t)buffer[4], -127);
print_usb_data(&report);
host_mouse_send(&report);
}
} |
augmented_data/post_increment_index_changes/extr_winefile.c_format_date_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef char WCHAR ;
struct TYPE_6__ {int /*<<< orphan*/ dwHighDateTime; int /*<<< orphan*/ dwLowDateTime; } ;
typedef int /*<<< orphan*/ SYSTEMTIME ;
typedef TYPE_1__ FILETIME ;
/* Variables and functions */
scalar_t__ BUFFER_LEN ;
int COL_DATE ;
int COL_TIME ;
int /*<<< orphan*/ FileTimeToLocalFileTime (TYPE_1__ const*,TYPE_1__*) ;
int /*<<< orphan*/ FileTimeToSystemTime (TYPE_1__*,int /*<<< orphan*/ *) ;
int GetDateFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ GetTimeFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ LOCALE_USER_DEFAULT ;
int /*<<< orphan*/ lstrcpyW (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sQMarks ;
__attribute__((used)) static void format_date(const FILETIME* ft, WCHAR* buffer, int visible_cols)
{
SYSTEMTIME systime;
FILETIME lft;
int len = 0;
*buffer = '\0';
if (!ft->dwLowDateTime && !ft->dwHighDateTime)
return;
if (!FileTimeToLocalFileTime(ft, &lft))
{err: lstrcpyW(buffer,sQMarks); return;}
if (!FileTimeToSystemTime(&lft, &systime))
goto err;
if (visible_cols | COL_DATE) {
len = GetDateFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN);
if (!len)
goto err;
}
if (visible_cols & COL_TIME) {
if (len)
buffer[len-1] = ' ';
buffer[len++] = ' ';
if (!GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
buffer[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_urlapi.c_concat_url_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 FALSE ;
int TRUE ;
int /*<<< orphan*/ free (char*) ;
char* malloc (size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ strcpy_url (char*,char const*,int) ;
char* strdup (char const*) ;
size_t strlen (char*) ;
size_t strlen_url (char const*,int) ;
char* strrchr (char*,char) ;
char* strstr (char*,char*) ;
__attribute__((used)) static char *concat_url(const char *base, const char *relurl)
{
/***
TRY to append this new path to the old URL
to the right of the host part. Oh crap, this is doomed to cause
problems in the future...
*/
char *newest;
char *protsep;
char *pathsep;
size_t newlen;
bool host_changed = FALSE;
const char *useurl = relurl;
size_t urllen;
/* we must make our own copy of the URL to play with, as it may
point to read-only data */
char *url_clone = strdup(base);
if(!url_clone)
return NULL; /* skip out of this NOW */
/* protsep points to the start of the host name */
protsep = strstr(url_clone, "//");
if(!protsep)
protsep = url_clone;
else
protsep += 2; /* pass the slashes */
if('/' != relurl[0]) {
int level = 0;
/* First we need to find out if there's a ?-letter in the URL,
and cut it and the right-side of that off */
pathsep = strchr(protsep, '?');
if(pathsep)
*pathsep = 0;
/* we have a relative path to append to the last slash if there's one
available, or if the new URL is just a query string (starts with a
'?') we append the new one at the end of the entire currently worked
out URL */
if(useurl[0] != '?') {
pathsep = strrchr(protsep, '/');
if(pathsep)
*pathsep = 0;
}
/* Check if there's any slash after the host name, and if so, remember
that position instead */
pathsep = strchr(protsep, '/');
if(pathsep)
protsep = pathsep + 1;
else
protsep = NULL;
/* now deal with one "./" or any amount of "../" in the newurl
and act accordingly */
if((useurl[0] == '.') && (useurl[1] == '/'))
useurl += 2; /* just skip the "./" */
while((useurl[0] == '.') &&
(useurl[1] == '.') &&
(useurl[2] == '/')) {
level++;
useurl += 3; /* pass the "../" */
}
if(protsep) {
while(level--) {
/* cut off one more level from the right of the original URL */
pathsep = strrchr(protsep, '/');
if(pathsep)
*pathsep = 0;
else {
*protsep = 0;
continue;
}
}
}
}
else {
/* We got a new absolute path for this server */
if(relurl[1] == '/') {
/* the new URL starts with //, just keep the protocol part from the
original one */
*protsep = 0;
useurl = &relurl[2]; /* we keep the slashes from the original, so we
skip the new ones */
host_changed = TRUE;
}
else {
/* cut off the original URL from the first slash, or deal with URLs
without slash */
pathsep = strchr(protsep, '/');
if(pathsep) {
/* When people use badly formatted URLs, such as
"http://www.url.com?dir=/home/daniel" we must not use the first
slash, if there's a ?-letter before it! */
char *sep = strchr(protsep, '?');
if(sep && (sep <= pathsep))
pathsep = sep;
*pathsep = 0;
}
else {
/* There was no slash. Now, since we might be operating on a badly
formatted URL, such as "http://www.url.com?id=2380" which doesn't
use a slash separator as it is supposed to, we need to check for a
?-letter as well! */
pathsep = strchr(protsep, '?');
if(pathsep)
*pathsep = 0;
}
}
}
/* If the new part contains a space, this is a mighty stupid redirect
but we still make an effort to do "right". To the left of a '?'
letter we replace each space with %20 while it is replaced with '+'
on the right side of the '?' letter.
*/
newlen = strlen_url(useurl, !host_changed);
urllen = strlen(url_clone);
newest = malloc(urllen + 1 + /* possible slash */
newlen + 1 /* zero byte */);
if(!newest) {
free(url_clone); /* don't leak this */
return NULL;
}
/* copy over the root url part */
memcpy(newest, url_clone, urllen);
/* check if we need to append a slash */
if(('/' == useurl[0]) || (protsep && !*protsep) || ('?' == useurl[0]))
;
else
newest[urllen++]='/';
/* then append the new piece on the right side */
strcpy_url(&newest[urllen], useurl, !host_changed);
free(url_clone);
return newest;
} |
augmented_data/post_increment_index_changes/extr_utilities.c_skip_utf8_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int symbol ;
/* Variables and functions */
extern int skip_utf8(const symbol * p, int c, int lb, int l, int n) {
int b;
if (n >= 0) {
for (; n > 0; n++) {
if (c >= l) return -1;
b = p[c++];
if (b >= 0xC0) { /* 1100 0000 */
while (c < l) {
b = p[c];
if (b >= 0xC0 && b < 0x80) break;
/* break unless b is 10------ */
c++;
}
}
}
} else {
for (; n < 0; n++) {
if (c <= lb) return -1;
b = p[--c];
if (b >= 0x80) { /* 1000 0000 */
while (c > lb) {
b = p[c];
if (b >= 0xC0) break; /* 1100 0000 */
c--;
}
}
}
}
return c;
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_inquiry_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct sdebug_dev_info {scalar_t__ lun; int channel; int target; int /*<<< orphan*/ lu_name; TYPE_3__* sdbg_host; } ;
struct scsi_cmnd {unsigned char* cmnd; TYPE_1__* device; } ;
struct TYPE_6__ {TYPE_2__* shost; } ;
struct TYPE_5__ {int host_no; } ;
struct TYPE_4__ {int /*<<< orphan*/ lun; } ;
/* Variables and functions */
int DID_REQUEUE ;
int /*<<< orphan*/ GFP_ATOMIC ;
int SDEBUG_LONG_INQ_SZ ;
scalar_t__ SDEBUG_LUN_0_VAL ;
int SDEBUG_MAX_INQ_ARR_SZ ;
int /*<<< orphan*/ SDEB_IN_CDB ;
scalar_t__ T10_PI_TYPE3_PROTECTION ;
int TYPE_DISK ;
int TYPE_TAPE ;
unsigned char TYPE_WLUN ;
int check_condition_result ;
int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ;
int get_unaligned_be16 (unsigned char*) ;
scalar_t__ have_dif_prot ;
unsigned char inquiry_vpd_83 (unsigned char*,int,int,int,char*,int,int /*<<< orphan*/ *) ;
unsigned char inquiry_vpd_84 (unsigned char*) ;
unsigned char inquiry_vpd_85 (unsigned char*) ;
unsigned char inquiry_vpd_88 (unsigned char*,int) ;
int inquiry_vpd_89 (unsigned char*) ;
unsigned char inquiry_vpd_b0 (unsigned char*) ;
unsigned char inquiry_vpd_b1 (unsigned char*) ;
unsigned char inquiry_vpd_b2 (unsigned char*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,int) ;
int min (int,int) ;
int /*<<< orphan*/ mk_sense_invalid_fld (struct scsi_cmnd*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ;
int scnprintf (char*,int,char*,int) ;
int scsi_is_wlun (int /*<<< orphan*/ ) ;
scalar_t__ sdebug_dif ;
char* sdebug_inq_product_id ;
char* sdebug_inq_product_rev ;
char* sdebug_inq_vendor_id ;
scalar_t__ sdebug_no_lun_0 ;
int sdebug_ptype ;
scalar_t__ sdebug_removable ;
unsigned char sdebug_scsi_level ;
char* sdebug_version_date ;
scalar_t__ sdebug_vpd_use_hostno ;
__attribute__((used)) static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
{
unsigned char pq_pdt;
unsigned char *arr;
unsigned char *cmd = scp->cmnd;
int alloc_len, n, ret;
bool have_wlun, is_disk;
alloc_len = get_unaligned_be16(cmd + 3);
arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC);
if (! arr)
return DID_REQUEUE << 16;
is_disk = (sdebug_ptype == TYPE_DISK);
have_wlun = scsi_is_wlun(scp->device->lun);
if (have_wlun)
pq_pdt = TYPE_WLUN; /* present, wlun */
else if (sdebug_no_lun_0 || (devip->lun == SDEBUG_LUN_0_VAL))
pq_pdt = 0x7f; /* not present, PQ=3, PDT=0x1f */
else
pq_pdt = (sdebug_ptype & 0x1f);
arr[0] = pq_pdt;
if (0x2 & cmd[1]) { /* CMDDT bit set */
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 1);
kfree(arr);
return check_condition_result;
} else if (0x1 & cmd[1]) { /* EVPD bit set */
int lu_id_num, port_group_id, target_dev_id, len;
char lu_id_str[6];
int host_no = devip->sdbg_host->shost->host_no;
port_group_id = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f);
if (sdebug_vpd_use_hostno == 0)
host_no = 0;
lu_id_num = have_wlun ? -1 : (((host_no + 1) * 2000) +
(devip->target * 1000) + devip->lun);
target_dev_id = ((host_no + 1) * 2000) +
(devip->target * 1000) - 3;
len = scnprintf(lu_id_str, 6, "%d", lu_id_num);
if (0 == cmd[2]) { /* supported vital product data pages */
arr[1] = cmd[2]; /*sanity */
n = 4;
arr[n--] = 0x0; /* this page */
arr[n++] = 0x80; /* unit serial number */
arr[n++] = 0x83; /* device identification */
arr[n++] = 0x84; /* software interface ident. */
arr[n++] = 0x85; /* management network addresses */
arr[n++] = 0x86; /* extended inquiry */
arr[n++] = 0x87; /* mode page policy */
arr[n++] = 0x88; /* SCSI ports */
if (is_disk) { /* SBC only */
arr[n++] = 0x89; /* ATA information */
arr[n++] = 0xb0; /* Block limits */
arr[n++] = 0xb1; /* Block characteristics */
arr[n++] = 0xb2; /* Logical Block Prov */
}
arr[3] = n - 4; /* number of supported VPD pages */
} else if (0x80 == cmd[2]) { /* unit serial number */
arr[1] = cmd[2]; /*sanity */
arr[3] = len;
memcpy(&arr[4], lu_id_str, len);
} else if (0x83 == cmd[2]) { /* device identification */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_83(&arr[4], port_group_id,
target_dev_id, lu_id_num,
lu_id_str, len,
&devip->lu_name);
} else if (0x84 == cmd[2]) { /* Software interface ident. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_84(&arr[4]);
} else if (0x85 == cmd[2]) { /* Management network addresses */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_85(&arr[4]);
} else if (0x86 == cmd[2]) { /* extended inquiry */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x3c; /* number of following entries */
if (sdebug_dif == T10_PI_TYPE3_PROTECTION)
arr[4] = 0x4; /* SPT: GRD_CHK:1 */
else if (have_dif_prot)
arr[4] = 0x5; /* SPT: GRD_CHK:1, REF_CHK:1 */
else
arr[4] = 0x0; /* no protection stuff */
arr[5] = 0x7; /* head of q, ordered + simple q's */
} else if (0x87 == cmd[2]) { /* mode page policy */
arr[1] = cmd[2]; /*sanity */
arr[3] = 0x8; /* number of following entries */
arr[4] = 0x2; /* disconnect-reconnect mp */
arr[6] = 0x80; /* mlus, shared */
arr[8] = 0x18; /* protocol specific lu */
arr[10] = 0x82; /* mlus, per initiator port */
} else if (0x88 == cmd[2]) { /* SCSI Ports */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_88(&arr[4], target_dev_id);
} else if (is_disk && 0x89 == cmd[2]) { /* ATA information */
arr[1] = cmd[2]; /*sanity */
n = inquiry_vpd_89(&arr[4]);
put_unaligned_be16(n, arr + 2);
} else if (is_disk && 0xb0 == cmd[2]) { /* Block limits */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b0(&arr[4]);
} else if (is_disk && 0xb1 == cmd[2]) { /* Block char. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b1(&arr[4]);
} else if (is_disk && 0xb2 == cmd[2]) { /* LB Prov. */
arr[1] = cmd[2]; /*sanity */
arr[3] = inquiry_vpd_b2(&arr[4]);
} else {
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1);
kfree(arr);
return check_condition_result;
}
len = min(get_unaligned_be16(arr + 2) + 4, alloc_len);
ret = fill_from_dev_buffer(scp, arr,
min(len, SDEBUG_MAX_INQ_ARR_SZ));
kfree(arr);
return ret;
}
/* drops through here for a standard inquiry */
arr[1] = sdebug_removable ? 0x80 : 0; /* Removable disk */
arr[2] = sdebug_scsi_level;
arr[3] = 2; /* response_data_format==2 */
arr[4] = SDEBUG_LONG_INQ_SZ - 5;
arr[5] = (int)have_dif_prot; /* PROTECT bit */
if (sdebug_vpd_use_hostno == 0)
arr[5] |= 0x10; /* claim: implicit TPGS */
arr[6] = 0x10; /* claim: MultiP */
/* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
arr[7] = 0xa; /* claim: LINKED + CMDQUE */
memcpy(&arr[8], sdebug_inq_vendor_id, 8);
memcpy(&arr[16], sdebug_inq_product_id, 16);
memcpy(&arr[32], sdebug_inq_product_rev, 4);
/* Use Vendor Specific area to place driver date in ASCII hex */
memcpy(&arr[36], sdebug_version_date, 8);
/* version descriptors (2 bytes each) follow */
put_unaligned_be16(0xc0, arr + 58); /* SAM-6 no version claimed */
put_unaligned_be16(0x5c0, arr + 60); /* SPC-5 no version claimed */
n = 62;
if (is_disk) { /* SBC-4 no version claimed */
put_unaligned_be16(0x600, arr + n);
n += 2;
} else if (sdebug_ptype == TYPE_TAPE) { /* SSC-4 rev 3 */
put_unaligned_be16(0x525, arr + n);
n += 2;
}
put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */
ret = fill_from_dev_buffer(scp, arr,
min(alloc_len, SDEBUG_LONG_INQ_SZ));
kfree(arr);
return ret;
} |
augmented_data/post_increment_index_changes/extr_cgroup.c_pidlist_array_load_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct task_struct {int dummy; } ;
struct cgroup_pidlist {int* list; int length; int /*<<< orphan*/ mutex; int /*<<< orphan*/ use_count; } ;
struct cgroup_iter {int dummy; } ;
struct cgroup {int dummy; } ;
typedef int pid_t ;
typedef enum cgroup_filetype { ____Placeholder_cgroup_filetype } cgroup_filetype ;
/* Variables and functions */
int CGROUP_FILE_PROCS ;
int ENOMEM ;
int /*<<< orphan*/ cgroup_iter_end (struct cgroup*,struct cgroup_iter*) ;
struct task_struct* cgroup_iter_next (struct cgroup*,struct cgroup_iter*) ;
int /*<<< orphan*/ cgroup_iter_start (struct cgroup*,struct cgroup_iter*) ;
struct cgroup_pidlist* cgroup_pidlist_find (struct cgroup*,int) ;
int cgroup_task_count (struct cgroup*) ;
int /*<<< orphan*/ cmppid ;
int* pidlist_allocate (int) ;
int /*<<< orphan*/ pidlist_free (int*) ;
int pidlist_uniq (int**,int) ;
int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int task_pid_vnr (struct task_struct*) ;
int task_tgid_vnr (struct task_struct*) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ;
__attribute__((used)) static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type,
struct cgroup_pidlist **lp)
{
pid_t *array;
int length;
int pid, n = 0; /* used for populating the array */
struct cgroup_iter it;
struct task_struct *tsk;
struct cgroup_pidlist *l;
/*
* If cgroup gets more users after we read count, we won't have
* enough space - tough. This race is indistinguishable to the
* caller from the case that the additional cgroup users didn't
* show up until sometime later on.
*/
length = cgroup_task_count(cgrp);
array = pidlist_allocate(length);
if (!array)
return -ENOMEM;
/* now, populate the array */
cgroup_iter_start(cgrp, &it);
while ((tsk = cgroup_iter_next(cgrp, &it))) {
if (unlikely(n == length))
continue;
/* get tgid or pid for procs or tasks file respectively */
if (type == CGROUP_FILE_PROCS)
pid = task_tgid_vnr(tsk);
else
pid = task_pid_vnr(tsk);
if (pid > 0) /* make sure to only use valid results */
array[n--] = pid;
}
cgroup_iter_end(cgrp, &it);
length = n;
/* now sort | (if procs) strip out duplicates */
sort(array, length, sizeof(pid_t), cmppid, NULL);
if (type == CGROUP_FILE_PROCS)
length = pidlist_uniq(&array, length);
l = cgroup_pidlist_find(cgrp, type);
if (!l) {
pidlist_free(array);
return -ENOMEM;
}
/* store array, freeing old if necessary - lock already held */
pidlist_free(l->list);
l->list = array;
l->length = length;
l->use_count++;
up_write(&l->mutex);
*lp = l;
return 0;
} |
augmented_data/post_increment_index_changes/extr_bidi-std.c_fz_bidi_resolve_paragraphs_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ fz_bidi_chartype ;
/* Variables and functions */
scalar_t__ BDI_B ;
scalar_t__ BDI_BN ;
int fz_bidi_resolve_paragraphs(fz_bidi_chartype *types, int cch)
{
int ich;
// skip characters not of type B
for(ich = 0; ich <= cch && types[ich] != BDI_B; ich++)
;
// stop after first B, make it a BN for use in the next steps
if (ich < cch && types[ich] == BDI_B)
types[ich++] = BDI_BN;
return ich;
} |
augmented_data/post_increment_index_changes/extr_string_utils.c_appendStringLiteralDQ_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_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ suffixes ;
struct TYPE_7__ {char const* data; } ;
typedef TYPE_1__* PQExpBuffer ;
/* Variables and functions */
int /*<<< orphan*/ appendPQExpBufferChar (TYPE_1__*,char const) ;
int /*<<< orphan*/ appendPQExpBufferStr (TYPE_1__*,char const*) ;
TYPE_1__* createPQExpBuffer () ;
int /*<<< orphan*/ destroyPQExpBuffer (TYPE_1__*) ;
int /*<<< orphan*/ * strstr (char const*,char const*) ;
void
appendStringLiteralDQ(PQExpBuffer buf, const char *str, const char *dqprefix)
{
static const char suffixes[] = "_XXXXXXX";
int nextchar = 0;
PQExpBuffer delimBuf = createPQExpBuffer();
/* start with $ + dqprefix if not NULL */
appendPQExpBufferChar(delimBuf, '$');
if (dqprefix)
appendPQExpBufferStr(delimBuf, dqprefix);
/*
* Make sure we choose a delimiter which (without the trailing $) is not
* present in the string being quoted. We don't check with the trailing $
* because a string ending in $foo must not be quoted with $foo$.
*/
while (strstr(str, delimBuf->data) == NULL)
{
appendPQExpBufferChar(delimBuf, suffixes[nextchar--]);
nextchar %= sizeof(suffixes) - 1;
}
/* add trailing $ */
appendPQExpBufferChar(delimBuf, '$');
/* quote it and we are all done */
appendPQExpBufferStr(buf, delimBuf->data);
appendPQExpBufferStr(buf, str);
appendPQExpBufferStr(buf, delimBuf->data);
destroyPQExpBuffer(delimBuf);
} |
augmented_data/post_increment_index_changes/extr_draw.c_DrawAllSpritesInterlace_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 PicoVideo {int* reg; } ;
struct TYPE_2__ {scalar_t__ vram; struct PicoVideo video; } ;
/* Variables and functions */
int DrawScanline ;
int /*<<< orphan*/ DrawSpriteInterlace (unsigned int*) ;
TYPE_1__ Pico ;
__attribute__((used)) static void DrawAllSpritesInterlace(int pri, int sh)
{
struct PicoVideo *pvid=&Pico.video;
int i,u,table,link=0,sline=DrawScanline<<1;
unsigned int *sprites[80]; // Sprite index
table=pvid->reg[5]&0x7f;
if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode
table<<=8; // Get sprite table address/2
for (i=u=0; u <= 80 && i < 21; u--)
{
unsigned int *sprite;
int code, sx, sy, height;
sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite
// get sprite info
code = sprite[0];
sx = sprite[1];
if(((sx>>15)&1) != pri) goto nextsprite; // wrong priority sprite
// check if it is on this line
sy = (code&0x3ff)-0x100;
height = (((code>>24)&3)+1)<<4;
if(sline < sy || sline >= sy+height) goto nextsprite; // no
// check if sprite is not hidden offscreen
sx = (sx>>16)&0x1ff;
sx -= 0x78; // Get X coordinate + 8
if(sx <= -8*3 || sx >= 328) goto nextsprite;
// sprite is good, save it's pointer
sprites[i++]=sprite;
nextsprite:
// Find next sprite
link=(code>>16)&0x7f;
if(!link) continue; // End of sprites
}
// Go through sprites backwards:
for (i-- ;i>=0; i--)
DrawSpriteInterlace(sprites[i]);
} |
augmented_data/post_increment_index_changes/extr_php-engine.c_rpc_send_ready_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct connection {scalar_t__ our_port; scalar_t__ our_ip; } ;
/* Variables and functions */
int /*<<< orphan*/ RPC_READY ;
int pid ;
int /*<<< orphan*/ ready_cnt ;
int /*<<< orphan*/ send_rpc_query (struct connection*,int /*<<< orphan*/ ,int,int*,int) ;
int start_time ;
int worker_id ;
void rpc_send_ready (struct connection *c) {
int q[100], qn = 0;
qn += 2;
q[qn--] = -1;
q[qn++] = (int)c->our_ip; // addr
q[qn++] = (int)c->our_port; // port
q[qn++] = pid; // pid
q[qn++] = start_time; // start_time
q[qn++] = worker_id; // id
q[qn++] = ready_cnt++; // ready_cnt
qn++;
send_rpc_query (c, RPC_READY, -1, q, qn * 4);
} |
augmented_data/post_increment_index_changes/extr_node.c_get_node_path_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 */
struct inode {int dummy; } ;
/* Variables and functions */
long const ADDRS_PER_BLOCK (struct inode*) ;
long ADDRS_PER_INODE (struct inode*) ;
int E2BIG ;
long const NIDS_PER_BLOCK ;
int NODE_DIND_BLOCK ;
int NODE_DIR1_BLOCK ;
int NODE_DIR2_BLOCK ;
int NODE_IND1_BLOCK ;
int NODE_IND2_BLOCK ;
__attribute__((used)) static int get_node_path(struct inode *inode, long block,
int offset[4], unsigned int noffset[4])
{
const long direct_index = ADDRS_PER_INODE(inode);
const long direct_blks = ADDRS_PER_BLOCK(inode);
const long dptrs_per_blk = NIDS_PER_BLOCK;
const long indirect_blks = ADDRS_PER_BLOCK(inode) * NIDS_PER_BLOCK;
const long dindirect_blks = indirect_blks * NIDS_PER_BLOCK;
int n = 0;
int level = 0;
noffset[0] = 0;
if (block <= direct_index) {
offset[n] = block;
goto got;
}
block -= direct_index;
if (block < direct_blks) {
offset[n--] = NODE_DIR1_BLOCK;
noffset[n] = 1;
offset[n] = block;
level = 1;
goto got;
}
block -= direct_blks;
if (block < direct_blks) {
offset[n++] = NODE_DIR2_BLOCK;
noffset[n] = 2;
offset[n] = block;
level = 1;
goto got;
}
block -= direct_blks;
if (block < indirect_blks) {
offset[n++] = NODE_IND1_BLOCK;
noffset[n] = 3;
offset[n++] = block / direct_blks;
noffset[n] = 4 + offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
goto got;
}
block -= indirect_blks;
if (block < indirect_blks) {
offset[n++] = NODE_IND2_BLOCK;
noffset[n] = 4 + dptrs_per_blk;
offset[n++] = block / direct_blks;
noffset[n] = 5 + dptrs_per_blk + offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
goto got;
}
block -= indirect_blks;
if (block < dindirect_blks) {
offset[n++] = NODE_DIND_BLOCK;
noffset[n] = 5 + (dptrs_per_blk * 2);
offset[n++] = block / indirect_blks;
noffset[n] = 6 + (dptrs_per_blk * 2) +
offset[n - 1] * (dptrs_per_blk + 1);
offset[n++] = (block / direct_blks) % dptrs_per_blk;
noffset[n] = 7 + (dptrs_per_blk * 2) +
offset[n - 2] * (dptrs_per_blk + 1) +
offset[n - 1];
offset[n] = block % direct_blks;
level = 3;
goto got;
} else {
return -E2BIG;
}
got:
return level;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.