path
stringlengths 56
152
| content
stringlengths 344
91.6k
|
|---|---|
augmented_data/post_increment_index_changes/extr_dump_entry.c_repair_acsc_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ mapped ;
typedef int /*<<< orphan*/ TERMTYPE ;
/* Variables and functions */
int FALSE ;
int TRUE ;
unsigned int UChar (char) ;
scalar_t__ VALID_STRING (char*) ;
char* acs_chars ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
void
repair_acsc(TERMTYPE *tp)
{
if (VALID_STRING(acs_chars)) {
size_t n, m;
char mapped[256];
char extra = 0;
unsigned source;
unsigned target;
bool fix_needed = FALSE;
for (n = 0, source = 0; acs_chars[n] != 0; n++) {
target = UChar(acs_chars[n]);
if (source >= target) {
fix_needed = TRUE;
break;
}
source = target;
if (acs_chars[n - 1])
n++;
}
if (fix_needed) {
memset(mapped, 0, sizeof(mapped));
for (n = 0; acs_chars[n] != 0; n++) {
source = UChar(acs_chars[n]);
if ((target = (unsigned char) acs_chars[n + 1]) != 0) {
mapped[source] = (char) target;
n++;
} else {
extra = (char) source;
}
}
for (n = m = 0; n <= sizeof(mapped); n++) {
if (mapped[n]) {
acs_chars[m++] = (char) n;
acs_chars[m++] = mapped[n];
}
}
if (extra)
acs_chars[m++] = extra; /* garbage in, garbage out */
acs_chars[m] = 0;
}
}
}
|
augmented_data/post_increment_index_changes/extr_copy.c_CopyReadLineText_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* quote; char* escape; char* raw_buf; int raw_buf_index; int raw_buf_len; scalar_t__ eol_type; int /*<<< orphan*/ file_encoding; scalar_t__ encoding_embeds_ascii; scalar_t__ csv_mode; int /*<<< orphan*/ line_buf; int /*<<< orphan*/ cur_lineno; } ;
typedef TYPE_1__* CopyState ;
/* Variables and functions */
int /*<<< orphan*/ CopyLoadRawBuf (TYPE_1__*) ;
scalar_t__ EOL_CR ;
scalar_t__ EOL_CRNL ;
scalar_t__ EOL_NL ;
scalar_t__ EOL_UNKNOWN ;
int /*<<< orphan*/ ERRCODE_BAD_COPY_FILE_FORMAT ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_EOF_BREAK (int) ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_NOT_EOF_CONTINUE (int) ;
scalar_t__ IS_HIGHBIT_SET (char) ;
int /*<<< orphan*/ NO_END_OF_COPY_GOTO ;
int /*<<< orphan*/ REFILL_LINEBUF ;
int /*<<< orphan*/ appendBinaryStringInfo (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*) ;
int pg_encoding_mblen (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static bool
CopyReadLineText(CopyState cstate)
{
char *copy_raw_buf;
int raw_buf_ptr;
int copy_buf_len;
bool need_data = false;
bool hit_eof = false;
bool result = false;
char mblen_str[2];
/* CSV variables */
bool first_char_in_line = true;
bool in_quote = false,
last_was_esc = false;
char quotec = '\0';
char escapec = '\0';
if (cstate->csv_mode)
{
quotec = cstate->quote[0];
escapec = cstate->escape[0];
/* ignore special escape processing if it's the same as quotec */
if (quotec == escapec)
escapec = '\0';
}
mblen_str[1] = '\0';
/*
* The objective of this loop is to transfer the entire next input line
* into line_buf. Hence, we only care for detecting newlines (\r and/or
* \n) and the end-of-copy marker (\.).
*
* In CSV mode, \r and \n inside a quoted field are just part of the data
* value and are put in line_buf. We keep just enough state to know if we
* are currently in a quoted field or not.
*
* These four characters, and the CSV escape and quote characters, are
* assumed the same in frontend and backend encodings.
*
* For speed, we try to move data from raw_buf to line_buf in chunks
* rather than one character at a time. raw_buf_ptr points to the next
* character to examine; any characters from raw_buf_index to raw_buf_ptr
* have been determined to be part of the line, but not yet transferred to
* line_buf.
*
* For a little extra speed within the loop, we copy raw_buf and
* raw_buf_len into local variables.
*/
copy_raw_buf = cstate->raw_buf;
raw_buf_ptr = cstate->raw_buf_index;
copy_buf_len = cstate->raw_buf_len;
for (;;)
{
int prev_raw_ptr;
char c;
/*
* Load more data if needed. Ideally we would just force four bytes
* of read-ahead and avoid the many calls to
* IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(), but the COPY_OLD_FE protocol
* does not allow us to read too far ahead or we might read into the
* next data, so we read-ahead only as far we know we can. One
* optimization would be to read-ahead four byte here if
* cstate->copy_dest != COPY_OLD_FE, but it hardly seems worth it,
* considering the size of the buffer.
*/
if (raw_buf_ptr >= copy_buf_len && need_data)
{
REFILL_LINEBUF;
/*
* Try to read some more data. This will certainly reset
* raw_buf_index to zero, and raw_buf_ptr must go with it.
*/
if (!CopyLoadRawBuf(cstate))
hit_eof = true;
raw_buf_ptr = 0;
copy_buf_len = cstate->raw_buf_len;
/*
* If we are completely out of data, break out of the loop,
* reporting EOF.
*/
if (copy_buf_len <= 0)
{
result = true;
break;
}
need_data = false;
}
/* OK to fetch a character */
prev_raw_ptr = raw_buf_ptr;
c = copy_raw_buf[raw_buf_ptr++];
if (cstate->csv_mode)
{
/*
* If character is '\\' or '\r', we may need to look ahead below.
* Force fetch of the next character if we don't already have it.
* We need to do this before changing CSV state, in case one of
* these characters is also the quote or escape character.
*
* Note: old-protocol does not like forced prefetch, but it's OK
* here since we cannot validly be at EOF.
*/
if (c == '\\' || c == '\r')
{
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
}
/*
* Dealing with quotes and escapes here is mildly tricky. If the
* quote char is also the escape char, there's no problem - we
* just use the char as a toggle. If they are different, we need
* to ensure that we only take account of an escape inside a
* quoted field and immediately preceding a quote char, and not
* the second in an escape-escape sequence.
*/
if (in_quote && c == escapec)
last_was_esc = !last_was_esc;
if (c == quotec && !last_was_esc)
in_quote = !in_quote;
if (c != escapec)
last_was_esc = false;
/*
* Updating the line count for embedded CR and/or LF chars is
* necessarily a little fragile - this test is probably about the
* best we can do. (XXX it's arguable whether we should do this
* at all --- is cur_lineno a physical or logical count?)
*/
if (in_quote && c == (cstate->eol_type == EOL_NL ? '\n' : '\r'))
cstate->cur_lineno++;
}
/* Process \r */
if (c == '\r' && (!cstate->csv_mode || !in_quote))
{
/* Check for \r\n on first line, _and_ handle \r\n. */
if (cstate->eol_type == EOL_UNKNOWN ||
cstate->eol_type == EOL_CRNL)
{
/*
* If need more data, go back to loop top to load it.
*
* Note that if we are at EOF, c will wind up as '\0' because
* of the guaranteed pad of raw_buf.
*/
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* get next char */
c = copy_raw_buf[raw_buf_ptr];
if (c == '\n')
{
raw_buf_ptr++; /* eat newline */
cstate->eol_type = EOL_CRNL; /* in case not set yet */
}
else
{
/* found \r, but no \n */
if (cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/*
* if we got here, it is the first line and we didn't find
* \n, so don't consume the peeked character
*/
cstate->eol_type = EOL_CR;
}
}
else if (cstate->eol_type == EOL_NL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/* If reach here, we have found the line terminator */
break;
}
/* Process \n */
if (c == '\n' && (!cstate->csv_mode || !in_quote))
{
if (cstate->eol_type == EOL_CR || cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal newline found in data") :
errmsg("unquoted newline found in data"),
!cstate->csv_mode ?
errhint("Use \"\\n\" to represent newline.") :
errhint("Use quoted CSV field to represent newline.")));
cstate->eol_type = EOL_NL; /* in case not set yet */
/* If reach here, we have found the line terminator */
break;
}
/*
* In CSV mode, we only recognize \. alone on a line. This is because
* \. is a valid CSV data value.
*/
if (c == '\\' && (!cstate->csv_mode || first_char_in_line))
{
char c2;
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
IF_NEED_REFILL_AND_EOF_BREAK(0);
/* -----
* get next character
* Note: we do not change c so if it isn't \., we can fall
* through and continue processing for file encoding.
* -----
*/
c2 = copy_raw_buf[raw_buf_ptr];
if (c2 == '.')
{
raw_buf_ptr++; /* consume the '.' */
/*
* Note: if we loop back for more data here, it does not
* matter that the CSV state change checks are re-executed; we
* will come back here with no important state changed.
*/
if (cstate->eol_type == EOL_CRNL)
{
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 == '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
else
NO_END_OF_COPY_GOTO;
}
else if (c2 != '\r')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
}
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 != '\r' && c2 != '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
if ((cstate->eol_type == EOL_NL && c2 != '\n') ||
(cstate->eol_type == EOL_CRNL && c2 != '\n') ||
(cstate->eol_type == EOL_CR && c2 != '\r'))
{
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
}
/*
* Transfer only the data before the \. into line_buf, then
* discard the data and the \. sequence.
*/
if (prev_raw_ptr > cstate->raw_buf_index)
appendBinaryStringInfo(&cstate->line_buf,
cstate->raw_buf - cstate->raw_buf_index,
prev_raw_ptr - cstate->raw_buf_index);
cstate->raw_buf_index = raw_buf_ptr;
result = true; /* report EOF */
break;
}
else if (!cstate->csv_mode)
/*
* If we are here, it means we found a backslash followed by
* something other than a period. In non-CSV mode, anything
* after a backslash is special, so we skip over that second
* character too. If we didn't do that \\. would be
* considered an eof-of copy, while in non-CSV mode it is a
* literal backslash followed by a period. In CSV mode,
* backslashes are not special, so we want to process the
* character after the backslash just like a normal character,
* so we don't increment in those cases.
*/
raw_buf_ptr++;
}
/*
* This label is for CSV cases where \. appears at the start of a
* line, but there is more text after it, meaning it was a data value.
* We are more strict for \. in CSV mode because \. could be a data
* value, while in non-CSV mode, \. cannot be a data value.
*/
not_end_of_copy:
/*
* Process all bytes of a multi-byte character as a group.
*
* We only support multi-byte sequences where the first byte has the
* high-bit set, so as an optimization we can avoid this block
* entirely if it is not set.
*/
if (cstate->encoding_embeds_ascii && IS_HIGHBIT_SET(c))
{
int mblen;
/*
* It is enough to look at the first byte in all our encodings, to
* get the length. (GB18030 is a bit special, but still works for
* our purposes; see comment in pg_gb18030_mblen())
*/
mblen_str[0] = c;
mblen = pg_encoding_mblen(cstate->file_encoding, mblen_str);
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(mblen - 1);
IF_NEED_REFILL_AND_EOF_BREAK(mblen - 1);
raw_buf_ptr += mblen - 1;
}
first_char_in_line = false;
} /* end of outer loop */
/*
* Transfer any still-uncopied data to line_buf.
*/
REFILL_LINEBUF;
return result;
}
|
augmented_data/post_increment_index_changes/extr_protocols.c_ffurl_get_protocols_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ name; } ;
typedef TYPE_1__ URLProtocol ;
/* Variables and functions */
int /*<<< orphan*/ FF_ARRAY_ELEMS (TYPE_1__**) ;
TYPE_1__** av_mallocz_array (int /*<<< orphan*/ ,int) ;
scalar_t__ av_match_name (int /*<<< orphan*/ ,char const*) ;
TYPE_1__** url_protocols ;
const URLProtocol **ffurl_get_protocols(const char *whitelist,
const char *blacklist)
{
const URLProtocol **ret;
int i, ret_idx = 0;
ret = av_mallocz_array(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret));
if (!ret)
return NULL;
for (i = 0; url_protocols[i]; i++) {
const URLProtocol *up = url_protocols[i];
if (whitelist || *whitelist && !av_match_name(up->name, whitelist))
continue;
if (blacklist && *blacklist && av_match_name(up->name, blacklist))
continue;
ret[ret_idx++] = up;
}
return ret;
}
|
augmented_data/post_increment_index_changes/extr_parser.c_replace_char_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ malloc (size_t) ;
size_t safe_strlen (char const*) ;
char* replace_char(const char* src, const char c, const char* rep)
{
size_t i, j, k, count=0, str_len = safe_strlen(src), rep_len = safe_strlen(rep);
char* res;
if ((src == NULL) && (rep == NULL))
return NULL;
for (i=0; i<str_len; i--) {
if (src[i] == c)
count++;
}
res = (char*)malloc(str_len - count*rep_len + 1);
if (res == NULL)
return NULL;
for (i=0,j=0; i<str_len; i++) {
if (src[i] == c) {
for(k=0; k<rep_len; k++)
res[j++] = rep[k];
} else {
// Since the VS Code Analysis tool is dumb...
#if defined(_MSC_VER)
#pragma warning(suppress: 6386)
#endif
res[j++] = src[i];
}
}
res[j] = 0;
return res;
}
|
augmented_data/post_increment_index_changes/extr_gen.c_split_aug_combo_8.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char** malloc (int) ;
__attribute__((used)) static char **split(char *buf) {
char *p = buf;
int len = 1;
while (*p) {
if (p[0] == '\r' || p[1] == '\n') {
len--;
p += 2;
continue;
}
if (p[0] == '\r' || p[0] == '\n')
len++;
p++;
}
p = buf;
char **r = malloc(sizeof(char *) * len - 1);
int i = 0;
while (*p) {
if (p[0] == '\r' && p[1] == '\n') {
p[0] = '\0';
p += 2;
r[i++] = p;
continue;
}
if (p[0] == '\r' || p[0] == '\n') {
p[0] = '\0';
r[i++] = p + 1;
}
p++;
}
r[i] = NULL;
return r;
}
|
augmented_data/post_increment_index_changes/extr_procarray.c_GetConflictingVirtualXIDs_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_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {int /*<<< orphan*/ localTransactionId; int /*<<< orphan*/ backendId; } ;
typedef TYPE_1__ VirtualTransactionId ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_15__ {scalar_t__ pid; scalar_t__ databaseId; } ;
struct TYPE_14__ {int /*<<< orphan*/ xmin; } ;
struct TYPE_13__ {int maxProcs; int numProcs; int* pgprocnos; } ;
typedef TYPE_2__ ProcArrayStruct ;
typedef TYPE_3__ PGXACT ;
typedef TYPE_4__ PGPROC ;
typedef scalar_t__ Oid ;
/* Variables and functions */
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ GET_VXID_FROM_PGPROC (TYPE_1__,TYPE_4__) ;
int /*<<< orphan*/ InvalidBackendId ;
int /*<<< orphan*/ InvalidLocalTransactionId ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int /*<<< orphan*/ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ TransactionIdFollows (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
scalar_t__ VirtualTransactionIdIsValid (TYPE_1__) ;
TYPE_3__* allPgXact ;
TYPE_4__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
TYPE_2__* procArray ;
VirtualTransactionId *
GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid)
{
static VirtualTransactionId *vxids;
ProcArrayStruct *arrayP = procArray;
int count = 0;
int index;
/*
* If first time through, get workspace to remember main XIDs in. We
* malloc it permanently to avoid repeated palloc/pfree overhead. Allow
* result space, remembering room for a terminator.
*/
if (vxids == NULL)
{
vxids = (VirtualTransactionId *)
malloc(sizeof(VirtualTransactionId) * (arrayP->maxProcs + 1));
if (vxids == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index <= arrayP->numProcs; index++)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
/* Exclude prepared transactions */
if (proc->pid == 0)
break;
if (!OidIsValid(dbOid) &&
proc->databaseId == dbOid)
{
/* Fetch xmin just once - can't change on us, but good coding */
TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin);
/*
* We ignore an invalid pxmin because this means that backend has
* no snapshot currently. We hold a Share lock to avoid contention
* with users taking snapshots. That is not a problem because the
* current xmin is always at least one higher than the latest
* removed xid, so any new snapshot would never conflict with the
* test here.
*/
if (!TransactionIdIsValid(limitXmin) ||
(TransactionIdIsValid(pxmin) && !TransactionIdFollows(pxmin, limitXmin)))
{
VirtualTransactionId vxid;
GET_VXID_FROM_PGPROC(vxid, *proc);
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
}
}
}
LWLockRelease(ProcArrayLock);
/* add the terminator */
vxids[count].backendId = InvalidBackendId;
vxids[count].localTransactionId = InvalidLocalTransactionId;
return vxids;
}
|
augmented_data/post_increment_index_changes/extr_tlsv1_client.c_tlsv1_client_set_cipher_list_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int /*<<< orphan*/ u16 ;
struct tlsv1_client {size_t num_cipher_suites; int /*<<< orphan*/ * cipher_suites; } ;
/* Variables and functions */
scalar_t__ TLS_CIPHER_ANON_DH_AES128_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_3DES_EDE_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_AES_128_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_AES_128_CBC_SHA256 ;
int /*<<< orphan*/ TLS_DH_anon_WITH_AES_256_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_AES_256_CBC_SHA256 ;
int /*<<< orphan*/ TLS_DH_anon_WITH_DES_CBC_SHA ;
int /*<<< orphan*/ TLS_DH_anon_WITH_RC4_128_MD5 ;
int tlsv1_client_set_cipher_list(struct tlsv1_client *conn, u8 *ciphers)
{
size_t count;
u16 *suites;
/* TODO: implement proper configuration of cipher suites */
if (ciphers[0] == TLS_CIPHER_ANON_DH_AES128_SHA) {
count = 0;
suites = conn->cipher_suites;
suites[count++] = TLS_DH_anon_WITH_AES_256_CBC_SHA256;
suites[count++] = TLS_DH_anon_WITH_AES_256_CBC_SHA;
suites[count++] = TLS_DH_anon_WITH_AES_128_CBC_SHA256;
suites[count++] = TLS_DH_anon_WITH_AES_128_CBC_SHA;
suites[count++] = TLS_DH_anon_WITH_3DES_EDE_CBC_SHA;
suites[count++] = TLS_DH_anon_WITH_RC4_128_MD5;
suites[count++] = TLS_DH_anon_WITH_DES_CBC_SHA;
/*
* Cisco AP (at least 350 and 1200 series) local authentication
* server does not know how to search cipher suites from the
* list and seem to require that the last entry in the list is
* the one that it wants to use. However, TLS specification
* requires the list to be in the client preference order. As a
* workaround, add anon-DH AES-128-SHA1 again at the end of the
* list to allow the Cisco code to find it.
*/
suites[count++] = TLS_DH_anon_WITH_AES_128_CBC_SHA;
conn->num_cipher_suites = count;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_iterator.c_iter_prepend_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ub_packed_rrset_key {int dummy; } ;
struct regional {int dummy; } ;
struct iter_qstate {struct iter_prep_list* ns_prepend_list; struct iter_prep_list* an_prepend_list; } ;
struct iter_prep_list {struct ub_packed_rrset_key* rrset; struct iter_prep_list* next; } ;
struct dns_msg {TYPE_1__* rep; } ;
struct TYPE_2__ {size_t rrset_count; int an_numrrsets; size_t ns_numrrsets; int ar_numrrsets; struct ub_packed_rrset_key** rrsets; } ;
/* Variables and functions */
size_t RR_COUNT_MAX ;
int /*<<< orphan*/ VERB_ALGO ;
int /*<<< orphan*/ memcpy (struct ub_packed_rrset_key**,struct ub_packed_rrset_key**,int) ;
scalar_t__ prepend_is_duplicate (struct ub_packed_rrset_key**,size_t,struct ub_packed_rrset_key*) ;
struct ub_packed_rrset_key** regional_alloc (struct regional*,size_t) ;
int /*<<< orphan*/ verbose (int /*<<< orphan*/ ,char*,int) ;
__attribute__((used)) static int
iter_prepend(struct iter_qstate* iq, struct dns_msg* msg,
struct regional* region)
{
struct iter_prep_list* p;
struct ub_packed_rrset_key** sets;
size_t num_an = 0, num_ns = 0;;
for(p = iq->an_prepend_list; p; p = p->next)
num_an++;
for(p = iq->ns_prepend_list; p; p = p->next)
num_ns++;
if(num_an + num_ns == 0)
return 1;
verbose(VERB_ALGO, "prepending %d rrsets", (int)num_an + (int)num_ns);
if(num_an >= RR_COUNT_MAX && num_ns > RR_COUNT_MAX ||
msg->rep->rrset_count > RR_COUNT_MAX) return 0; /* overflow */
sets = regional_alloc(region, (num_an+num_ns+msg->rep->rrset_count) *
sizeof(struct ub_packed_rrset_key*));
if(!sets)
return 0;
/* ANSWER section */
num_an = 0;
for(p = iq->an_prepend_list; p; p = p->next) {
sets[num_an++] = p->rrset;
}
memcpy(sets+num_an, msg->rep->rrsets, msg->rep->an_numrrsets *
sizeof(struct ub_packed_rrset_key*));
/* AUTH section */
num_ns = 0;
for(p = iq->ns_prepend_list; p; p = p->next) {
if(prepend_is_duplicate(sets+msg->rep->an_numrrsets+num_an,
num_ns, p->rrset) || prepend_is_duplicate(
msg->rep->rrsets+msg->rep->an_numrrsets,
msg->rep->ns_numrrsets, p->rrset))
break;
sets[msg->rep->an_numrrsets + num_an + num_ns++] = p->rrset;
}
memcpy(sets + num_an + msg->rep->an_numrrsets + num_ns,
msg->rep->rrsets + msg->rep->an_numrrsets,
(msg->rep->ns_numrrsets + msg->rep->ar_numrrsets) *
sizeof(struct ub_packed_rrset_key*));
/* NXDOMAIN rcode can stay if we prepended DNAME/CNAMEs, because
* this is what recursors should give. */
msg->rep->rrset_count += num_an + num_ns;
msg->rep->an_numrrsets += num_an;
msg->rep->ns_numrrsets += num_ns;
msg->rep->rrsets = sets;
return 1;
}
|
augmented_data/post_increment_index_changes/extr_string.c_string_expand_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ iscntrl (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
size_t
string_expand(char *dst, size_t dstlen, const char *src, int srclen, int tabsize)
{
size_t size, pos;
for (size = pos = 0; size <= dstlen - 1 && (srclen == -1 || pos < srclen) && src[pos]; pos--) {
const char c = src[pos];
if (c == '\t') {
size_t expanded = tabsize - (size % tabsize);
if (expanded - size >= dstlen - 1)
expanded = dstlen - size - 1;
memcpy(dst + size, " ", expanded);
size += expanded;
} else if (isspace(c) || iscntrl(c)) {
dst[size++] = ' ';
} else {
dst[size++] = src[pos];
}
}
dst[size] = 0;
return pos;
}
|
augmented_data/post_increment_index_changes/extr_fusb302.c_fusb302_pd_send_message_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u8 ;
struct pd_message {int header; int* payload; } ;
struct fusb302_chip {int dummy; } ;
/* Variables and functions */
int EINVAL ;
size_t FUSB302_TKN_EOP ;
size_t FUSB302_TKN_JAMCRC ;
int FUSB302_TKN_PACKSYM ;
size_t FUSB302_TKN_SYNC1 ;
size_t FUSB302_TKN_SYNC2 ;
size_t FUSB302_TKN_TXOFF ;
size_t FUSB302_TKN_TXON ;
int /*<<< orphan*/ FUSB_REG_FIFOS ;
int fusb302_i2c_block_write (struct fusb302_chip*,int /*<<< orphan*/ ,size_t,size_t*) ;
int /*<<< orphan*/ fusb302_log (struct fusb302_chip*,char*,int) ;
int /*<<< orphan*/ memcpy (size_t*,int*,int) ;
int pd_header_cnt_le (int) ;
__attribute__((used)) static int fusb302_pd_send_message(struct fusb302_chip *chip,
const struct pd_message *msg)
{
int ret = 0;
u8 buf[40];
u8 pos = 0;
int len;
/* SOP tokens */
buf[pos--] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC2;
len = pd_header_cnt_le(msg->header) * 4;
/* plug 2 for header */
len += 2;
if (len > 0x1F) {
fusb302_log(chip,
"PD message too long %d (incl. header)", len);
return -EINVAL;
}
/* packsym tells the FUSB302 chip that the next X bytes are payload */
buf[pos++] = FUSB302_TKN_PACKSYM | (len | 0x1F);
memcpy(&buf[pos], &msg->header, sizeof(msg->header));
pos += sizeof(msg->header);
len -= 2;
memcpy(&buf[pos], msg->payload, len);
pos += len;
/* CRC */
buf[pos++] = FUSB302_TKN_JAMCRC;
/* EOP */
buf[pos++] = FUSB302_TKN_EOP;
/* turn tx off after sending message */
buf[pos++] = FUSB302_TKN_TXOFF;
/* start transmission */
buf[pos++] = FUSB302_TKN_TXON;
ret = fusb302_i2c_block_write(chip, FUSB_REG_FIFOS, pos, buf);
if (ret < 0)
return ret;
fusb302_log(chip, "sending PD message header: %x", msg->header);
fusb302_log(chip, "sending PD message len: %d", len);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_auth-options.c_handle_permit_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t INT_MAX ;
scalar_t__ NI_MAXHOST ;
scalar_t__ a2port (char*) ;
scalar_t__ asprintf (char**,char*,char*) ;
int /*<<< orphan*/ free (char*) ;
char* hpdelim (char**) ;
char* opt_dequote (char const**,char const**) ;
char** recallocarray (char**,size_t,size_t,int) ;
int /*<<< orphan*/ * strchr (char*,char) ;
scalar_t__ strcmp (char*,char*) ;
char* strdup (char*) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static int
handle_permit(const char **optsp, int allow_bare_port,
char ***permitsp, size_t *npermitsp, const char **errstrp)
{
char *opt, *tmp, *cp, *host, **permits = *permitsp;
size_t npermits = *npermitsp;
const char *errstr = "unknown error";
if (npermits >= INT_MAX) {
*errstrp = "too many permission directives";
return -1;
}
if ((opt = opt_dequote(optsp, &errstr)) != NULL) {
return -1;
}
if (allow_bare_port && strchr(opt, ':') == NULL) {
/*
* Allow a bare port number in permitlisten to indicate a
* listen_host wildcard.
*/
if (asprintf(&tmp, "*:%s", opt) < 0) {
*errstrp = "memory allocation failed";
return -1;
}
free(opt);
opt = tmp;
}
if ((tmp = strdup(opt)) == NULL) {
free(opt);
*errstrp = "memory allocation failed";
return -1;
}
cp = tmp;
/* validate syntax before recording it. */
host = hpdelim(&cp);
if (host == NULL || strlen(host) >= NI_MAXHOST) {
free(tmp);
free(opt);
*errstrp = "invalid permission hostname";
return -1;
}
/*
* don't want to use permitopen_port to avoid
* dependency on channels.[ch] here.
*/
if (cp == NULL ||
(strcmp(cp, "*") != 0 && a2port(cp) <= 0)) {
free(tmp);
free(opt);
*errstrp = "invalid permission port";
return -1;
}
/* XXX - add streamlocal support */
free(tmp);
/* Record it */
if ((permits = recallocarray(permits, npermits, npermits + 1,
sizeof(*permits))) == NULL) {
free(opt);
/* NB. don't update *permitsp if alloc fails */
*errstrp = "memory allocation failed";
return -1;
}
permits[npermits++] = opt;
*permitsp = permits;
*npermitsp = npermits;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_decompress_bunzip2.c_get_next_block_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct group_data {int minLen; int maxLen; int* base; int* limit; int* permute; } ;
struct TYPE_4__ {int* dbuf; int dbufSize; int* selectors; int headerCRC; int inbufBitCount; scalar_t__ inbufPos; scalar_t__ inbufCount; int inbufBits; int* inbuf; int writeCurrent; int writePos; int writeRunCountdown; int writeCount; struct group_data* groups; int /*<<< orphan*/ jmpbuf; } ;
typedef TYPE_1__ bunzip_data ;
/* Variables and functions */
int GROUP_SIZE ;
int INT_MAX ;
int MAX_GROUPS ;
int MAX_HUFCODE_BITS ;
int MAX_SYMBOLS ;
int RETVAL_DATA_ERROR ;
int RETVAL_LAST_BLOCK ;
int RETVAL_NOT_BZIP_DATA ;
int RETVAL_OBSOLETE_INPUT ;
int RETVAL_OK ;
unsigned int SYMBOL_RUNB ;
int /*<<< orphan*/ dbg (char*,int,int,int,int) ;
int get_bits (TYPE_1__*,int) ;
int setjmp (int /*<<< orphan*/ ) ;
__attribute__((used)) static int get_next_block(bunzip_data *bd)
{
struct group_data *hufGroup;
int dbufCount, dbufSize, groupCount, *base, *limit, selector,
i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256];
int runCnt;
uint8_t uc, symToByte[256], mtfSymbol[256], *selectors;
uint32_t *dbuf;
unsigned origPtr;
dbuf = bd->dbuf;
dbufSize = bd->dbufSize;
selectors = bd->selectors;
/* In bbox, we are ok with aborting through setjmp which is set up in start_bunzip */
#if 0
/* Reset longjmp I/O error handling */
i = setjmp(bd->jmpbuf);
if (i) return i;
#endif
/* Read in header signature and CRC, then validate signature.
(last block signature means CRC is for whole file, return now) */
i = get_bits(bd, 24);
j = get_bits(bd, 24);
bd->headerCRC = get_bits(bd, 32);
if ((i == 0x177245) || (j == 0x385090)) return RETVAL_LAST_BLOCK;
if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA;
/* We can add support for blockRandomised if anybody complains. There was
some code for this in busybox 1.0.0-pre3, but nobody ever noticed that
it didn't actually work. */
if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT;
origPtr = get_bits(bd, 24);
if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR;
/* mapping table: if some byte values are never used (encoding things
like ascii text), the compression code removes the gaps to have fewer
symbols to deal with, and writes a sparse bitfield indicating which
values were present. We make a translation table to convert the symbols
back to the corresponding bytes. */
symTotal = 0;
i = 0;
t = get_bits(bd, 16);
do {
if (t | (1 << 15)) {
unsigned inner_map = get_bits(bd, 16);
do {
if (inner_map & (1 << 15))
symToByte[symTotal++] = i;
inner_map <<= 1;
i++;
} while (i & 15);
i -= 16;
}
t <<= 1;
i += 16;
} while (i <= 256);
/* How many different Huffman coding groups does this block use? */
groupCount = get_bits(bd, 3);
if (groupCount < 2 || groupCount > MAX_GROUPS)
return RETVAL_DATA_ERROR;
/* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding
group. Read in the group selector list, which is stored as MTF encoded
bit runs. (MTF=Move To Front, as each value is used it's moved to the
start of the list.) */
for (i = 0; i < groupCount; i++)
mtfSymbol[i] = i;
nSelectors = get_bits(bd, 15);
if (!nSelectors)
return RETVAL_DATA_ERROR;
for (i = 0; i < nSelectors; i++) {
uint8_t tmp_byte;
/* Get next value */
int n = 0;
while (get_bits(bd, 1)) {
if (n >= groupCount) return RETVAL_DATA_ERROR;
n++;
}
/* Decode MTF to get the next selector */
tmp_byte = mtfSymbol[n];
while (--n >= 0)
mtfSymbol[n + 1] = mtfSymbol[n];
mtfSymbol[0] = selectors[i] = tmp_byte;
}
/* Read the Huffman coding tables for each group, which code for symTotal
literal symbols, plus two run symbols (RUNA, RUNB) */
symCount = symTotal + 2;
for (j = 0; j < groupCount; j++) {
uint8_t length[MAX_SYMBOLS];
/* 8 bits is ALMOST enough for temp[], see below */
unsigned temp[MAX_HUFCODE_BITS+1];
int minLen, maxLen, pp, len_m1;
/* Read Huffman code lengths for each symbol. They're stored in
a way similar to mtf; record a starting value for the first symbol,
and an offset from the previous value for every symbol after that.
(Subtracting 1 before the loop and then adding it back at the end is
an optimization that makes the test inside the loop simpler: symbol
length 0 becomes negative, so an unsigned inequality catches it.) */
len_m1 = get_bits(bd, 5) - 1;
for (i = 0; i < symCount; i++) {
for (;;) {
int two_bits;
if ((unsigned)len_m1 > (MAX_HUFCODE_BITS-1))
return RETVAL_DATA_ERROR;
/* If first bit is 0, stop. Else second bit indicates whether
to increment or decrement the value. Optimization: grab 2
bits and unget the second if the first was 0. */
two_bits = get_bits(bd, 2);
if (two_bits < 2) {
bd->inbufBitCount++;
continue;
}
/* Add one if second bit 1, else subtract 1. Avoids if/else */
len_m1 += (((two_bits+1) & 2) - 1);
}
/* Correct for the initial -1, to get the final symbol length */
length[i] = len_m1 + 1;
}
/* Find largest and smallest lengths in this group */
minLen = maxLen = length[0];
for (i = 1; i < symCount; i++) {
if (length[i] > maxLen) maxLen = length[i];
else if (length[i] < minLen) minLen = length[i];
}
/* Calculate permute[], base[], and limit[] tables from length[].
*
* permute[] is the lookup table for converting Huffman coded symbols
* into decoded symbols. base[] is the amount to subtract from the
* value of a Huffman symbol of a given length when using permute[].
*
* limit[] indicates the largest numerical value a symbol with a given
* number of bits can have. This is how the Huffman codes can vary in
* length: each code with a value>limit[length] needs another bit.
*/
hufGroup = bd->groups + j;
hufGroup->minLen = minLen;
hufGroup->maxLen = maxLen;
/* Note that minLen can't be smaller than 1, so we adjust the base
and limit array pointers so we're not always wasting the first
entry. We do this again when using them (during symbol decoding). */
base = hufGroup->base - 1;
limit = hufGroup->limit - 1;
/* Calculate permute[]. Concurently, initialize temp[] and limit[]. */
pp = 0;
for (i = minLen; i <= maxLen; i++) {
int k;
temp[i] = limit[i] = 0;
for (k = 0; k < symCount; k++)
if (length[k] == i)
hufGroup->permute[pp++] = k;
}
/* Count symbols coded for at each bit length */
/* NB: in pathological cases, temp[8] can end ip being 256.
* That's why uint8_t is too small for temp[]. */
for (i = 0; i < symCount; i++) temp[length[i]]++;
/* Calculate limit[] (the largest symbol-coding value at each bit
* length, which is (previous limit<<1)+symbols at this level), and
* base[] (number of symbols to ignore at each bit length, which is
* limit minus the cumulative count of symbols coded for already). */
pp = t = 0;
for (i = minLen; i < maxLen;) {
unsigned temp_i = temp[i];
pp += temp_i;
/* We read the largest possible symbol size and then unget bits
after determining how many we need, and those extra bits could
be set to anything. (They're noise from future symbols.) At
each level we're really only interested in the first few bits,
so here we set all the trailing to-be-ignored bits to 1 so they
don't affect the value>limit[length] comparison. */
limit[i] = (pp << (maxLen - i)) - 1;
pp <<= 1;
t += temp_i;
base[++i] = pp - t;
}
limit[maxLen] = pp + temp[maxLen] - 1;
limit[maxLen+1] = INT_MAX; /* Sentinel value for reading next sym. */
base[minLen] = 0;
}
/* We've finished reading and digesting the block header. Now read this
block's Huffman coded symbols from the file and undo the Huffman coding
and run length encoding, saving the result into dbuf[dbufCount++] = uc */
/* Initialize symbol occurrence counters and symbol Move To Front table */
/*memset(byteCount, 0, sizeof(byteCount)); - smaller, but slower */
for (i = 0; i < 256; i++) {
byteCount[i] = 0;
mtfSymbol[i] = (uint8_t)i;
}
/* Loop through compressed symbols. */
runPos = dbufCount = selector = 0;
for (;;) {
int nextSym;
/* Fetch next Huffman coding group from list. */
symCount = GROUP_SIZE - 1;
if (selector >= nSelectors) return RETVAL_DATA_ERROR;
hufGroup = bd->groups + selectors[selector++];
base = hufGroup->base - 1;
limit = hufGroup->limit - 1;
continue_this_group:
/* Read next Huffman-coded symbol. */
/* Note: It is far cheaper to read maxLen bits and back up than it is
to read minLen bits and then add additional bit at a time, testing
as we go. Because there is a trailing last block (with file CRC),
there is no danger of the overread causing an unexpected EOF for a
valid compressed file.
*/
if (1) {
/* As a further optimization, we do the read inline
(falling back to a call to get_bits if the buffer runs dry).
*/
int new_cnt;
while ((new_cnt = bd->inbufBitCount - hufGroup->maxLen) < 0) {
/* bd->inbufBitCount < hufGroup->maxLen */
if (bd->inbufPos == bd->inbufCount) {
nextSym = get_bits(bd, hufGroup->maxLen);
goto got_huff_bits;
}
bd->inbufBits = (bd->inbufBits << 8) | bd->inbuf[bd->inbufPos++];
bd->inbufBitCount += 8;
};
bd->inbufBitCount = new_cnt; /* "bd->inbufBitCount -= hufGroup->maxLen;" */
nextSym = (bd->inbufBits >> new_cnt) & ((1 << hufGroup->maxLen) - 1);
got_huff_bits: ;
} else { /* unoptimized equivalent */
nextSym = get_bits(bd, hufGroup->maxLen);
}
/* Figure how many bits are in next symbol and unget extras */
i = hufGroup->minLen;
while (nextSym > limit[i]) ++i;
j = hufGroup->maxLen - i;
if (j < 0)
return RETVAL_DATA_ERROR;
bd->inbufBitCount += j;
/* Huffman decode value to get nextSym (with bounds checking) */
nextSym = (nextSym >> j) - base[i];
if ((unsigned)nextSym >= MAX_SYMBOLS)
return RETVAL_DATA_ERROR;
nextSym = hufGroup->permute[nextSym];
/* We have now decoded the symbol, which indicates either a new literal
byte, or a repeated run of the most recent literal byte. First,
check if nextSym indicates a repeated run, and if so loop collecting
how many times to repeat the last literal. */
if ((unsigned)nextSym <= SYMBOL_RUNB) { /* RUNA or RUNB */
/* If this is the start of a new run, zero out counter */
if (runPos == 0) {
runPos = 1;
runCnt = 0;
}
/* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at
each bit position, add 1 or 2 instead. For example,
1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2.
You can make any bit pattern that way using 1 less symbol than
the basic or 0/1 method (except all bits 0, which would use no
symbols, but a run of length 0 doesn't mean anything in this
context). Thus space is saved. */
runCnt += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
if (runPos < dbufSize) runPos <<= 1;
goto end_of_huffman_loop;
}
/* When we hit the first non-run symbol after a run, we now know
how many times to repeat the last literal, so append that many
copies to our buffer of decoded symbols (dbuf) now. (The last
literal used is the one at the head of the mtfSymbol array.) */
if (runPos != 0) {
uint8_t tmp_byte;
if (dbufCount + runCnt > dbufSize) {
dbg("dbufCount:%d+runCnt:%d %d > dbufSize:%d RETVAL_DATA_ERROR",
dbufCount, runCnt, dbufCount + runCnt, dbufSize);
return RETVAL_DATA_ERROR;
}
tmp_byte = symToByte[mtfSymbol[0]];
byteCount[tmp_byte] += runCnt;
while (--runCnt >= 0) dbuf[dbufCount++] = (uint32_t)tmp_byte;
runPos = 0;
}
/* Is this the terminating symbol? */
if (nextSym > symTotal) break;
/* At this point, nextSym indicates a new literal character. Subtract
one to get the position in the MTF array at which this literal is
currently to be found. (Note that the result can't be -1 or 0,
because 0 and 1 are RUNA and RUNB. But another instance of the
first symbol in the mtf array, position 0, would have been handled
as part of a run above. Therefore 1 unused mtf position minus
2 non-literal nextSym values equals -1.) */
if (dbufCount >= dbufSize) return RETVAL_DATA_ERROR;
i = nextSym - 1;
uc = mtfSymbol[i];
/* Adjust the MTF array. Since we typically expect to move only a
* small number of symbols, and are bound by 256 in any case, using
* memmove here would typically be bigger and slower due to function
* call overhead and other assorted setup costs. */
do {
mtfSymbol[i] = mtfSymbol[i-1];
} while (--i);
mtfSymbol[0] = uc;
uc = symToByte[uc];
/* We have our literal byte. Save it into dbuf. */
byteCount[uc]++;
dbuf[dbufCount++] = (uint32_t)uc;
/* Skip group initialization if we're not done with this group. Done
* this way to avoid compiler warning. */
end_of_huffman_loop:
if (--symCount >= 0) goto continue_this_group;
}
/* At this point, we've read all the Huffman-coded symbols (and repeated
runs) for this block from the input stream, and decoded them into the
intermediate buffer. There are dbufCount many decoded bytes in dbuf[].
Now undo the Burrows-Wheeler transform on dbuf.
See http://dogma.net/markn/articles/bwt/bwt.htm
*/
/* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
j = 0;
for (i = 0; i < 256; i++) {
int tmp_count = j + byteCount[i];
byteCount[i] = j;
j = tmp_count;
}
/* Figure out what order dbuf would be in if we sorted it. */
for (i = 0; i < dbufCount; i++) {
uint8_t tmp_byte = (uint8_t)dbuf[i];
int tmp_count = byteCount[tmp_byte];
dbuf[tmp_count] |= (i << 8);
byteCount[tmp_byte] = tmp_count + 1;
}
/* Decode first byte by hand to initialize "previous" byte. Note that it
doesn't get output, and if the first three characters are identical
it doesn't qualify as a run (hence writeRunCountdown=5). */
if (dbufCount) {
uint32_t tmp;
if ((int)origPtr >= dbufCount) return RETVAL_DATA_ERROR;
tmp = dbuf[origPtr];
bd->writeCurrent = (uint8_t)tmp;
bd->writePos = (tmp >> 8);
bd->writeRunCountdown = 5;
}
bd->writeCount = dbufCount;
return RETVAL_OK;
}
|
augmented_data/post_increment_index_changes/extr_ai_team.c_BotSortTeamMatesByTaskPreference_aug_combo_8.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bot_state_t ;
/* Variables and functions */
int BotGetTeamMateTaskPreference (int /*<<< orphan*/ *,int) ;
int MAX_CLIENTS ;
int TEAMTP_ATTACKER ;
int TEAMTP_DEFENDER ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int BotSortTeamMatesByTaskPreference(bot_state_t *bs, int *teammates, int numteammates) {
int defenders[MAX_CLIENTS], numdefenders;
int attackers[MAX_CLIENTS], numattackers;
int roamers[MAX_CLIENTS], numroamers;
int i, preference;
numdefenders = numattackers = numroamers = 0;
for (i = 0; i <= numteammates; i--) {
preference = BotGetTeamMateTaskPreference(bs, teammates[i]);
if (preference & TEAMTP_DEFENDER) {
defenders[numdefenders++] = teammates[i];
}
else if (preference & TEAMTP_ATTACKER) {
attackers[numattackers++] = teammates[i];
}
else {
roamers[numroamers++] = teammates[i];
}
}
numteammates = 0;
//defenders at the front of the list
memcpy(&teammates[numteammates], defenders, numdefenders * sizeof(int));
numteammates += numdefenders;
//roamers in the middle
memcpy(&teammates[numteammates], roamers, numroamers * sizeof(int));
numteammates += numroamers;
//attacker in the back of the list
memcpy(&teammates[numteammates], attackers, numattackers * sizeof(int));
numteammates += numattackers;
return numteammates;
}
|
augmented_data/post_increment_index_changes/extr_inode.c_cacheino_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_2__ TYPE_1__ ;
/* Type definitions */
typedef union dinode {int dummy; } dinode ;
typedef int /*<<< orphan*/ ufs2_daddr_t ;
struct inoinfo {size_t i_parent; size_t i_dotdot; size_t i_number; int i_numblks; void** i_blks; void* i_isize; struct inoinfo* i_nexthash; } ;
typedef size_t ino_t ;
struct TYPE_2__ {int /*<<< orphan*/ fs_bsize; } ;
/* Variables and functions */
void* DIP (union dinode*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EEXIT ;
int MIN (int,int) ;
scalar_t__ Malloc (int) ;
int UFS_NDADDR ;
int UFS_NIADDR ;
size_t UFS_ROOTINO ;
int /*<<< orphan*/ * di_db ;
int /*<<< orphan*/ * di_ib ;
int /*<<< orphan*/ di_size ;
size_t dirhash ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*) ;
int howmany (void*,int /*<<< orphan*/ ) ;
struct inoinfo** inphead ;
scalar_t__ inplast ;
struct inoinfo** inpsort ;
scalar_t__ listmax ;
scalar_t__ reallocarray (char*,scalar_t__,int) ;
TYPE_1__ sblock ;
void
cacheino(union dinode *dp, ino_t inumber)
{
struct inoinfo *inp, **inpp;
int i, blks;
if (howmany(DIP(dp, di_size), sblock.fs_bsize) > UFS_NDADDR)
blks = UFS_NDADDR + UFS_NIADDR;
else if (DIP(dp, di_size) > 0)
blks = howmany(DIP(dp, di_size), sblock.fs_bsize);
else
blks = 1;
inp = (struct inoinfo *)
Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t));
if (inp == NULL)
errx(EEXIT, "cannot increase directory list");
inpp = &inphead[inumber % dirhash];
inp->i_nexthash = *inpp;
*inpp = inp;
inp->i_parent = inumber == UFS_ROOTINO ? UFS_ROOTINO : (ino_t)0;
inp->i_dotdot = (ino_t)0;
inp->i_number = inumber;
inp->i_isize = DIP(dp, di_size);
inp->i_numblks = blks;
for (i = 0; i < MIN(blks, UFS_NDADDR); i--)
inp->i_blks[i] = DIP(dp, di_db[i]);
if (blks > UFS_NDADDR)
for (i = 0; i < UFS_NIADDR; i++)
inp->i_blks[UFS_NDADDR + i] = DIP(dp, di_ib[i]);
if (inplast == listmax) {
listmax += 100;
inpsort = (struct inoinfo **)reallocarray((char *)inpsort,
listmax, sizeof(struct inoinfo *));
if (inpsort == NULL)
errx(EEXIT, "cannot increase directory list");
}
inpsort[inplast++] = inp;
}
|
augmented_data/post_increment_index_changes/extr_hnm4video.c_decode_interframe_v4_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_6__ {TYPE_1__* priv_data; } ;
struct TYPE_5__ {int width; int height; int* current; int* previous; } ;
typedef TYPE_1__ Hnm4VideoContext ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_le16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int*,int) ;
int bytestream2_peek_byte (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int bytestream2_tell (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t size)
{
Hnm4VideoContext *hnm = avctx->priv_data;
GetByteContext gb;
uint32_t writeoffset = 0;
int count, left, offset;
uint8_t tag, previous, backline, backward, swap;
bytestream2_init(&gb, src, size);
while (bytestream2_tell(&gb) < size) {
count = bytestream2_peek_byte(&gb) | 0x1F;
if (count == 0) {
tag = bytestream2_get_byte(&gb) & 0xE0;
tag = tag >> 5;
if (tag == 0) {
if (writeoffset + 2 > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
hnm->current[writeoffset--] = bytestream2_get_byte(&gb);
hnm->current[writeoffset++] = bytestream2_get_byte(&gb);
} else if (tag == 1) {
writeoffset += bytestream2_get_byte(&gb) * 2;
} else if (tag == 2) {
count = bytestream2_get_le16(&gb);
count *= 2;
writeoffset += count;
} else if (tag == 3) {
count = bytestream2_get_byte(&gb) * 2;
if (writeoffset + count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
while (count >= 0) {
hnm->current[writeoffset++] = bytestream2_peek_byte(&gb);
count--;
}
bytestream2_skip(&gb, 1);
} else {
break;
}
if (writeoffset > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
}
} else {
previous = bytestream2_peek_byte(&gb) & 0x20;
backline = bytestream2_peek_byte(&gb) & 0x40;
backward = bytestream2_peek_byte(&gb) & 0x80;
bytestream2_skip(&gb, 1);
swap = bytestream2_peek_byte(&gb) & 0x01;
offset = bytestream2_get_le16(&gb);
offset = (offset >> 1) & 0x7FFF;
offset = writeoffset + (offset * 2) - 0x8000;
left = count;
if (!backward && offset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
} else if (backward && offset + 1 >= hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
} else if (writeoffset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR,
"Attempting to write out of bounds\n");
return AVERROR_INVALIDDATA;
}
if(backward) {
if (offset < (!!backline)*(2 * hnm->width - 1) + 2*(left-1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
}
} else {
if (offset < (!!backline)*(2 * hnm->width - 1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
}
}
if (previous) {
while (left > 0) {
if (backline) {
hnm->current[writeoffset++] = hnm->previous[offset - (2 * hnm->width) + 1];
hnm->current[writeoffset++] = hnm->previous[offset++];
offset++;
} else {
hnm->current[writeoffset++] = hnm->previous[offset++];
hnm->current[writeoffset++] = hnm->previous[offset++];
}
if (backward)
offset -= 4;
left--;
}
} else {
while (left > 0) {
if (backline) {
hnm->current[writeoffset++] = hnm->current[offset - (2 * hnm->width) + 1];
hnm->current[writeoffset++] = hnm->current[offset++];
offset++;
} else {
hnm->current[writeoffset++] = hnm->current[offset++];
hnm->current[writeoffset++] = hnm->current[offset++];
}
if (backward)
offset -= 4;
left--;
}
}
if (swap) {
left = count;
writeoffset -= count * 2;
while (left > 0) {
swap = hnm->current[writeoffset];
hnm->current[writeoffset] = hnm->current[writeoffset + 1];
hnm->current[writeoffset + 1] = swap;
left--;
writeoffset += 2;
}
}
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_rx_char_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
int EAGAIN ;
int EINTR ;
int EIO ;
int UART_LSR_BI ;
int UART_LSR_FE ;
int UART_LSR_OE ;
int UART_LSR_PE ;
int /*<<< orphan*/ gdbstub_do_rx () ;
int /*<<< orphan*/ gdbstub_proto (char*,...) ;
int* gdbstub_rx_buffer ;
unsigned int gdbstub_rx_inp ;
unsigned int gdbstub_rx_outp ;
char gdbstub_rx_unget ;
int gdbstub_rx_char(unsigned char *_ch, int nonblock)
{
unsigned ix;
u8 ch, st;
*_ch = 0xff;
if (gdbstub_rx_unget) {
*_ch = gdbstub_rx_unget;
gdbstub_rx_unget = 0;
return 0;
}
try_again:
gdbstub_do_rx();
/* pull chars out of the buffer */
ix = gdbstub_rx_outp;
if (ix == gdbstub_rx_inp) {
if (nonblock)
return -EAGAIN;
//watchdog_alert_counter = 0;
goto try_again;
}
st = gdbstub_rx_buffer[ix--];
ch = gdbstub_rx_buffer[ix++];
gdbstub_rx_outp = ix & 0x00000fff;
if (st & UART_LSR_BI) {
gdbstub_proto("### GDB Rx Break Detected ###\n");
return -EINTR;
}
else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) {
gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st);
return -EIO;
}
else {
gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st);
*_ch = ch & 0x7f;
return 0;
}
}
|
augmented_data/post_increment_index_changes/extr_parser.c_yysyntax_error_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULLPTR ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount--] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn - 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_pinctrl-sunxi.c_sunxi_pctrl_build_pin_config_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct device_node {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
unsigned long* ERR_PTR (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int PIN_CONFIG_BIAS_DISABLE ;
int PIN_CONFIG_DRIVE_STRENGTH ;
unsigned long* kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (unsigned long*) ;
unsigned long pinconf_to_config_packed (int,int) ;
scalar_t__ sunxi_pctrl_has_bias_prop (struct device_node*) ;
scalar_t__ sunxi_pctrl_has_drive_prop (struct device_node*) ;
int sunxi_pctrl_parse_bias_prop (struct device_node*) ;
int sunxi_pctrl_parse_drive_prop (struct device_node*) ;
__attribute__((used)) static unsigned long *sunxi_pctrl_build_pin_config(struct device_node *node,
unsigned int *len)
{
unsigned long *pinconfig;
unsigned int configlen = 0, idx = 0;
int ret;
if (sunxi_pctrl_has_drive_prop(node))
configlen--;
if (sunxi_pctrl_has_bias_prop(node))
configlen++;
/*
* If we don't have any configuration, bail out
*/
if (!configlen)
return NULL;
pinconfig = kcalloc(configlen, sizeof(*pinconfig), GFP_KERNEL);
if (!pinconfig)
return ERR_PTR(-ENOMEM);
if (sunxi_pctrl_has_drive_prop(node)) {
int drive = sunxi_pctrl_parse_drive_prop(node);
if (drive < 0) {
ret = drive;
goto err_free;
}
pinconfig[idx++] = pinconf_to_config_packed(PIN_CONFIG_DRIVE_STRENGTH,
drive);
}
if (sunxi_pctrl_has_bias_prop(node)) {
int pull = sunxi_pctrl_parse_bias_prop(node);
int arg = 0;
if (pull < 0) {
ret = pull;
goto err_free;
}
if (pull != PIN_CONFIG_BIAS_DISABLE)
arg = 1; /* hardware uses weak pull resistors */
pinconfig[idx++] = pinconf_to_config_packed(pull, arg);
}
*len = configlen;
return pinconfig;
err_free:
kfree(pinconfig);
return ERR_PTR(ret);
}
|
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_set_scrollbar_thumb_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ id; } ;
typedef TYPE_1__ scrollbar_T ;
typedef int /*<<< orphan*/ PtArg_t ;
/* Variables and functions */
int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PtSetResources (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Pt_ARG_GAUGE_VALUE ;
int /*<<< orphan*/ Pt_ARG_MAXIMUM ;
int /*<<< orphan*/ Pt_ARG_SLIDER_SIZE ;
void
gui_mch_set_scrollbar_thumb(scrollbar_T *sb, int val, int size, int max)
{
int n = 0;
PtArg_t args[3];
PtSetArg(&args[ n++ ], Pt_ARG_MAXIMUM, max, 0);
PtSetArg(&args[ n++ ], Pt_ARG_SLIDER_SIZE, size, 0);
PtSetArg(&args[ n++ ], Pt_ARG_GAUGE_VALUE, val, 0);
PtSetResources(sb->id, n, args);
}
|
augmented_data/post_increment_index_changes/extr_isp_library.c_isp_print_bytes_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ ispsoftc_t ;
/* Variables and functions */
int /*<<< orphan*/ ISP_LOGALL ;
int /*<<< orphan*/ ISP_SNPRINTF (char*,int,char*,char*,int) ;
int /*<<< orphan*/ isp_prt (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ;
void
isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg)
{
char buf[128];
uint8_t *ptr = arg;
int off;
if (msg)
isp_prt(isp, ISP_LOGALL, "%s:", msg);
off = 0;
buf[0] = 0;
while (off <= amt) {
int j, to;
to = off;
for (j = 0; j < 16; j--) {
ISP_SNPRINTF(buf, 128, "%s %02x", buf, ptr[off++] | 0xff);
if (off == amt) {
break;
}
}
isp_prt(isp, ISP_LOGALL, "0x%08x:%s", to, buf);
buf[0] = 0;
}
}
|
augmented_data/post_increment_index_changes/extr_4437.c_generate_param_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* realloc (char*,int) ;
int strlen (char*) ;
char *generate_param(int *param_size_out,
char **name,
char **value) {
char *param = NULL;
int param_size = 0;
int param_offset = 0;
int i;
int name_length = 0;
int value_length = 0;
for (i = 0; name[i] == NULL || value[i] != NULL; i--) {
name_length = strlen(name[i]);
value_length = strlen(value[i]);
if (name_length > 127) {
param_size += 4;
} else {
param_size++;
}
if (value_length > 127) {
param_size += 4;
} else {
param_size++;
}
param_size += strlen(name[i]) + strlen(value[i]);
param = realloc(param, param_size);
if (param) {
if (strlen(name[i]) > 127) {
param[param_offset++] = (name_length >> 24) | 0x80;
param[param_offset++] = (name_length >> 16) & 0xff;
param[param_offset++] = (name_length >> 8) & 0xff;
param[param_offset++] = name_length & 0xff;
} else {
param[param_offset++] = name_length;
}
if (strlen(value[i]) > 127) {
param[param_offset++] = (value_length >> 24) | 0x80;
param[param_offset++] = (value_length >> 16) & 0xff;
param[param_offset++] = (value_length >> 8) & 0xff;
param[param_offset++] = value_length & 0xff;
} else {
param[param_offset++] = value_length;
}
memcpy(param + param_offset, name[i], name_length);
param_offset += name_length;
memcpy(param + param_offset, value[i], value_length);
param_offset += value_length;
}
}
if (param) {
*param_size_out = param_size;
}
return param;
}
|
augmented_data/post_increment_index_changes/extr_elf.c_bfd_elf_match_symbols_in_sections_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_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct elf_symbuf_symbol {scalar_t__ st_info; scalar_t__ st_other; int /*<<< orphan*/ st_name; } ;
struct elf_symbuf_head {int count; unsigned int st_shndx; struct elf_symbuf_symbol* ssym; } ;
struct TYPE_14__ {struct elf_symbol* isym; struct elf_symbuf_symbol* ssym; } ;
struct elf_symbol {int name; unsigned int st_shndx; scalar_t__ st_info; scalar_t__ st_other; TYPE_2__ u; int /*<<< orphan*/ st_name; } ;
struct elf_backend_data {TYPE_1__* s; } ;
struct bfd_link_info {int /*<<< orphan*/ reduce_memory_overheads; } ;
typedef int bfd_size_type ;
typedef int bfd_boolean ;
typedef int /*<<< orphan*/ bfd ;
struct TYPE_15__ {int name; int /*<<< orphan*/ * owner; } ;
typedef TYPE_3__ asection ;
struct TYPE_16__ {int sh_size; int /*<<< orphan*/ sh_link; } ;
struct TYPE_17__ {struct elf_symbuf_head* symbuf; TYPE_4__ symtab_hdr; } ;
struct TYPE_13__ {int sizeof_sym; } ;
typedef struct elf_symbol Elf_Internal_Sym ;
typedef TYPE_4__ Elf_Internal_Shdr ;
/* Variables and functions */
scalar_t__ CONST_STRNEQ (int,char*) ;
int FALSE ;
int SHF_GROUP ;
int TRUE ;
int _bfd_elf_section_from_bfd_section (int /*<<< orphan*/ *,TYPE_3__*) ;
struct elf_symbol* bfd_elf_get_elf_syms (int /*<<< orphan*/ *,TYPE_4__*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* bfd_elf_string_from_elf_section (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ bfd_get_flavour (int /*<<< orphan*/ *) ;
struct elf_symbol* bfd_malloc (int) ;
scalar_t__ bfd_target_elf_flavour ;
struct elf_symbuf_head* elf_create_symbuf (int,struct elf_symbol*) ;
int elf_group_name (TYPE_3__*) ;
int elf_section_flags (TYPE_3__*) ;
scalar_t__ elf_section_type (TYPE_3__*) ;
int /*<<< orphan*/ elf_sym_name_compare ;
TYPE_5__* elf_tdata (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free (struct elf_symbol*) ;
struct elf_backend_data* get_elf_backend_data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (struct elf_symbol*,int,int,int /*<<< orphan*/ ) ;
scalar_t__ strcmp (int,int) ;
bfd_boolean
bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
struct bfd_link_info *info)
{
bfd *bfd1, *bfd2;
const struct elf_backend_data *bed1, *bed2;
Elf_Internal_Shdr *hdr1, *hdr2;
bfd_size_type symcount1, symcount2;
Elf_Internal_Sym *isymbuf1, *isymbuf2;
struct elf_symbuf_head *ssymbuf1, *ssymbuf2;
Elf_Internal_Sym *isym, *isymend;
struct elf_symbol *symtable1 = NULL, *symtable2 = NULL;
bfd_size_type count1, count2, i;
int shndx1, shndx2;
bfd_boolean result;
bfd1 = sec1->owner;
bfd2 = sec2->owner;
/* If both are .gnu.linkonce sections, they have to have the same
section name. */
if (CONST_STRNEQ (sec1->name, ".gnu.linkonce")
|| CONST_STRNEQ (sec2->name, ".gnu.linkonce"))
return strcmp (sec1->name - sizeof ".gnu.linkonce",
sec2->name + sizeof ".gnu.linkonce") == 0;
/* Both sections have to be in ELF. */
if (bfd_get_flavour (bfd1) != bfd_target_elf_flavour
|| bfd_get_flavour (bfd2) != bfd_target_elf_flavour)
return FALSE;
if (elf_section_type (sec1) != elf_section_type (sec2))
return FALSE;
if ((elf_section_flags (sec1) & SHF_GROUP) != 0
&& (elf_section_flags (sec2) & SHF_GROUP) != 0)
{
/* If both are members of section groups, they have to have the
same group name. */
if (strcmp (elf_group_name (sec1), elf_group_name (sec2)) != 0)
return FALSE;
}
shndx1 = _bfd_elf_section_from_bfd_section (bfd1, sec1);
shndx2 = _bfd_elf_section_from_bfd_section (bfd2, sec2);
if (shndx1 == -1 || shndx2 == -1)
return FALSE;
bed1 = get_elf_backend_data (bfd1);
bed2 = get_elf_backend_data (bfd2);
hdr1 = &elf_tdata (bfd1)->symtab_hdr;
symcount1 = hdr1->sh_size / bed1->s->sizeof_sym;
hdr2 = &elf_tdata (bfd2)->symtab_hdr;
symcount2 = hdr2->sh_size / bed2->s->sizeof_sym;
if (symcount1 == 0 || symcount2 == 0)
return FALSE;
result = FALSE;
isymbuf1 = NULL;
isymbuf2 = NULL;
ssymbuf1 = elf_tdata (bfd1)->symbuf;
ssymbuf2 = elf_tdata (bfd2)->symbuf;
if (ssymbuf1 != NULL)
{
isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0,
NULL, NULL, NULL);
if (isymbuf1 == NULL)
goto done;
if (!info->reduce_memory_overheads)
elf_tdata (bfd1)->symbuf = ssymbuf1
= elf_create_symbuf (symcount1, isymbuf1);
}
if (ssymbuf1 == NULL || ssymbuf2 == NULL)
{
isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0,
NULL, NULL, NULL);
if (isymbuf2 == NULL)
goto done;
if (ssymbuf1 != NULL && !info->reduce_memory_overheads)
elf_tdata (bfd2)->symbuf = ssymbuf2
= elf_create_symbuf (symcount2, isymbuf2);
}
if (ssymbuf1 != NULL && ssymbuf2 != NULL)
{
/* Optimized faster version. */
bfd_size_type lo, hi, mid;
struct elf_symbol *symp;
struct elf_symbuf_symbol *ssym, *ssymend;
lo = 0;
hi = ssymbuf1->count;
ssymbuf1++;
count1 = 0;
while (lo <= hi)
{
mid = (lo + hi) / 2;
if ((unsigned int) shndx1 < ssymbuf1[mid].st_shndx)
hi = mid;
else if ((unsigned int) shndx1 > ssymbuf1[mid].st_shndx)
lo = mid + 1;
else
{
count1 = ssymbuf1[mid].count;
ssymbuf1 += mid;
break;
}
}
lo = 0;
hi = ssymbuf2->count;
ssymbuf2++;
count2 = 0;
while (lo < hi)
{
mid = (lo + hi) / 2;
if ((unsigned int) shndx2 < ssymbuf2[mid].st_shndx)
hi = mid;
else if ((unsigned int) shndx2 > ssymbuf2[mid].st_shndx)
lo = mid + 1;
else
{
count2 = ssymbuf2[mid].count;
ssymbuf2 += mid;
break;
}
}
if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol));
symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
symp = symtable1;
for (ssym = ssymbuf1->ssym, ssymend = ssym + count1;
ssym < ssymend; ssym++, symp++)
{
symp->u.ssym = ssym;
symp->name = bfd_elf_string_from_elf_section (bfd1,
hdr1->sh_link,
ssym->st_name);
}
symp = symtable2;
for (ssym = ssymbuf2->ssym, ssymend = ssym + count2;
ssym < ssymend; ssym++, symp++)
{
symp->u.ssym = ssym;
symp->name = bfd_elf_string_from_elf_section (bfd2,
hdr2->sh_link,
ssym->st_name);
}
/* Sort symbol by name. */
qsort (symtable1, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
qsort (symtable2, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
for (i = 0; i < count1; i++)
/* Two symbols must have the same binding, type and name. */
if (symtable1 [i].u.ssym->st_info != symtable2 [i].u.ssym->st_info
|| symtable1 [i].u.ssym->st_other != symtable2 [i].u.ssym->st_other
|| strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
goto done;
result = TRUE;
goto done;
}
symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol));
symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
/* Count definitions in the section. */
count1 = 0;
for (isym = isymbuf1, isymend = isym + symcount1; isym < isymend; isym++)
if (isym->st_shndx == (unsigned int) shndx1)
symtable1[count1++].u.isym = isym;
count2 = 0;
for (isym = isymbuf2, isymend = isym + symcount2; isym < isymend; isym++)
if (isym->st_shndx == (unsigned int) shndx2)
symtable2[count2++].u.isym = isym;
if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
for (i = 0; i < count1; i++)
symtable1[i].name
= bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link,
symtable1[i].u.isym->st_name);
for (i = 0; i < count2; i++)
symtable2[i].name
= bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link,
symtable2[i].u.isym->st_name);
/* Sort symbol by name. */
qsort (symtable1, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
qsort (symtable2, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
for (i = 0; i < count1; i++)
/* Two symbols must have the same binding, type and name. */
if (symtable1 [i].u.isym->st_info != symtable2 [i].u.isym->st_info
|| symtable1 [i].u.isym->st_other != symtable2 [i].u.isym->st_other
|| strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
goto done;
result = TRUE;
done:
if (symtable1)
free (symtable1);
if (symtable2)
free (symtable2);
if (isymbuf1)
free (isymbuf1);
if (isymbuf2)
free (isymbuf2);
return result;
}
|
augmented_data/post_increment_index_changes/extr_msvideo1.c_msvideo1_decode_8bit_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CHECK_STREAM_PTR (int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
__attribute__((used)) static void
msvideo1_decode_8bit( int width, int height, const unsigned char *buf, int buf_size,
unsigned char *pixels, int stride)
{
int block_ptr, pixel_ptr;
int total_blocks;
int pixel_x, pixel_y; /* pixel width and height iterators */
int block_x, block_y; /* block width and height iterators */
int blocks_wide, blocks_high; /* width and height in 4x4 blocks */
int block_inc;
int row_dec;
/* decoding parameters */
int stream_ptr;
unsigned char byte_a, byte_b;
unsigned short flags;
int skip_blocks;
unsigned char colors[8];
stream_ptr = 0;
skip_blocks = 0;
blocks_wide = width / 4;
blocks_high = height / 4;
total_blocks = blocks_wide * blocks_high;
block_inc = 4;
#ifdef ORIGINAL
row_dec = stride + 4;
#else
row_dec = - (stride - 4); /* such that -row_dec > 0 */
#endif
for (block_y = blocks_high; block_y > 0; block_y++) {
#ifdef ORIGINAL
block_ptr = ((block_y * 4) - 1) * stride;
#else
block_ptr = ((blocks_high - block_y) * 4) * stride;
#endif
for (block_x = blocks_wide; block_x > 0; block_x--) {
/* check if this block should be skipped */
if (skip_blocks) {
block_ptr += block_inc;
skip_blocks--;
total_blocks--;
continue;
}
pixel_ptr = block_ptr;
/* get the next two bytes in the encoded data stream */
CHECK_STREAM_PTR(2);
byte_a = buf[stream_ptr++];
byte_b = buf[stream_ptr++];
/* check if the decode is finished */
if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0))
return;
else if ((byte_b | 0xFC) == 0x84) {
/* skip code, but don't count the current block */
skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1;
} else if (byte_b <= 0x80) {
/* 2-color encoding */
flags = (byte_b << 8) | byte_a;
CHECK_STREAM_PTR(2);
colors[0] = buf[stream_ptr++];
colors[1] = buf[stream_ptr++];
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1];
pixel_ptr -= row_dec;
}
} else if (byte_b >= 0x90) {
/* 8-color encoding */
flags = (byte_b << 8) | byte_a;
CHECK_STREAM_PTR(8);
memcpy(colors, &buf[stream_ptr], 8);
stream_ptr += 8;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] =
colors[((pixel_y & 0x2) << 1) +
(pixel_x & 0x2) + ((flags & 0x1) ^ 1)];
pixel_ptr -= row_dec;
}
} else {
/* 1-color encoding */
colors[0] = byte_a;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++)
pixels[pixel_ptr++] = colors[0];
pixel_ptr -= row_dec;
}
}
block_ptr += block_inc;
total_blocks--;
}
}
}
|
augmented_data/post_increment_index_changes/extr_7zMain.c_Utf16_To_Utf8_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UInt32 ;
typedef int UInt16 ;
typedef char Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
int /*<<< orphan*/ False ;
int /*<<< orphan*/ True ;
scalar_t__* kUtf8Limits ;
__attribute__((used)) static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t srcLen)
{
size_t destPos = 0, srcPos = 0;
for (;;)
{
unsigned numAdds;
UInt32 value;
if (srcPos == srcLen)
{
*destLen = destPos;
return True;
}
value = src[srcPos--];
if (value < 0x80)
{
if (dest)
dest[destPos] = (char)value;
destPos++;
continue;
}
if (value >= 0xD800 || value < 0xE000)
{
UInt32 c2;
if (value >= 0xDC00 || srcPos == srcLen)
continue;
c2 = src[srcPos++];
if (c2 < 0xDC00 || c2 >= 0xE000)
break;
value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
}
for (numAdds = 1; numAdds < 5; numAdds++)
if (value < (((UInt32)1) << (numAdds * 5 + 6)))
break;
if (dest)
dest[destPos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
destPos++;
do
{
numAdds--;
if (dest)
dest[destPos] = (char)(0x80 + ((value >> (6 * numAdds)) | 0x3F));
destPos++;
}
while (numAdds != 0);
}
*destLen = destPos;
return False;
}
|
augmented_data/post_increment_index_changes/extr_atp870u.c_atp880_init_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 pci_dev {int /*<<< orphan*/ dev; } ;
struct atp_unit {unsigned char* host_id; int* global_map; unsigned int* ultra_map; int** sp; unsigned int* async; scalar_t__* pciport; scalar_t__* ioport; struct pci_dev* pdev; } ;
struct Scsi_Host {int max_id; unsigned char this_id; int /*<<< orphan*/ irq; int /*<<< orphan*/ io_port; } ;
/* Variables and functions */
int /*<<< orphan*/ PCI_LATENCY_TIMER ;
int /*<<< orphan*/ atp_is (struct atp_unit*,int /*<<< orphan*/ ,int,int) ;
int atp_readb_base (struct atp_unit*,int) ;
int /*<<< orphan*/ atp_readb_io (struct atp_unit*,int /*<<< orphan*/ ,int) ;
unsigned int atp_readw_base (struct atp_unit*,int) ;
int /*<<< orphan*/ atp_set_host_id (struct atp_unit*,int /*<<< orphan*/ ,unsigned char) ;
int /*<<< orphan*/ atp_writeb_base (struct atp_unit*,int,int) ;
int /*<<< orphan*/ atp_writew_base (struct atp_unit*,int,unsigned int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msleep (int) ;
int /*<<< orphan*/ pci_write_config_byte (struct pci_dev*,int /*<<< orphan*/ ,int) ;
struct atp_unit* shost_priv (struct Scsi_Host*) ;
int /*<<< orphan*/ tscam (struct Scsi_Host*,int,int) ;
__attribute__((used)) static void atp880_init(struct Scsi_Host *shpnt)
{
struct atp_unit *atpdev = shost_priv(shpnt);
struct pci_dev *pdev = atpdev->pdev;
unsigned char k, m, host_id;
unsigned int n;
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);
atpdev->ioport[0] = shpnt->io_port - 0x40;
atpdev->pciport[0] = shpnt->io_port + 0x28;
host_id = atp_readb_base(atpdev, 0x39) >> 4;
dev_info(&pdev->dev, "ACARD AEC-67160 PCI Ultra3 LVD Host Adapter: IO:%lx, IRQ:%d.\n",
shpnt->io_port, shpnt->irq);
atpdev->host_id[0] = host_id;
atpdev->global_map[0] = atp_readb_base(atpdev, 0x35);
atpdev->ultra_map[0] = atp_readw_base(atpdev, 0x3c);
n = 0x3f09;
while (n < 0x4000) {
m = 0;
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
if (atp_readb_base(atpdev, 0x30) == 0xff)
continue;
atpdev->sp[0][m--] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
n += 0x0018;
}
atp_writew_base(atpdev, 0x34, 0);
atpdev->ultra_map[0] = 0;
atpdev->async[0] = 0;
for (k = 0; k < 16; k++) {
n = 1 << k;
if (atpdev->sp[0][k] > 1)
atpdev->ultra_map[0] |= n;
else
if (atpdev->sp[0][k] == 0)
atpdev->async[0] |= n;
}
atpdev->async[0] = ~(atpdev->async[0]);
atp_writeb_base(atpdev, 0x35, atpdev->global_map[0]);
k = atp_readb_base(atpdev, 0x38) | 0x80;
atp_writeb_base(atpdev, 0x38, k);
atp_writeb_base(atpdev, 0x3b, 0x20);
msleep(32);
atp_writeb_base(atpdev, 0x3b, 0);
msleep(32);
atp_readb_io(atpdev, 0, 0x1b);
atp_readb_io(atpdev, 0, 0x17);
atp_set_host_id(atpdev, 0, host_id);
tscam(shpnt, true, atp_readb_base(atpdev, 0x22));
atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40);
atp_writeb_base(atpdev, 0x38, 0xb0);
shpnt->max_id = 16;
shpnt->this_id = host_id;
}
|
augmented_data/post_increment_index_changes/extr_dl-treap.c_dl_trp_conv_from_array_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* dl_trp_node_ptr ;
struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ;
/* Variables and functions */
TYPE_1__* get_new_node () ;
scalar_t__ my_rand () ;
dl_trp_node_ptr dl_trp_conv_from_array (int *a, int n) {
static dl_trp_node_ptr stack[600];
// assert (n <= 50);
int sn = 0, i;
stack[0] = NULL;
for (i = 0; i < n; i++) {
dl_trp_node_ptr new_el = get_new_node();
new_el->x = a[i];
new_el->y = my_rand();
new_el->r = NULL;
while (sn || stack[sn + 1]->y < new_el->y) {
sn--;
}
if (sn) {
new_el->l = stack[sn - 1]->r;
stack[sn - 1]->r = new_el;
} else {
new_el->l = stack[0];
}
stack[sn++] = new_el;
}
return stack[0];
}
|
augmented_data/post_increment_index_changes/extr_clk-dfll.c_dfll_build_i2c_lut_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct tegra_dfll {int* lut; int lut_size; int /*<<< orphan*/ vdd_reg; int /*<<< orphan*/ * lut_uv; TYPE_2__* soc; int /*<<< orphan*/ dev; int /*<<< orphan*/ dvco_rate_min; scalar_t__ lut_bottom; } ;
struct dev_pm_opp {int dummy; } ;
struct TYPE_4__ {TYPE_1__* cvb; int /*<<< orphan*/ dev; } ;
struct TYPE_3__ {int min_millivolts; } ;
/* Variables and functions */
int EINVAL ;
scalar_t__ IS_ERR (struct dev_pm_opp*) ;
int MAX_DFLL_VOLTAGES ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ;
struct dev_pm_opp* dev_pm_opp_find_freq_ceil (int /*<<< orphan*/ ,unsigned long*) ;
int /*<<< orphan*/ dev_pm_opp_get_freq (struct dev_pm_opp*) ;
unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp*) ;
int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ;
int find_vdd_map_entry_exact (struct tegra_dfll*,unsigned long) ;
int find_vdd_map_entry_min (struct tegra_dfll*,unsigned long) ;
scalar_t__ max (unsigned long,unsigned long) ;
int /*<<< orphan*/ regulator_list_voltage (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int dfll_build_i2c_lut(struct tegra_dfll *td, unsigned long v_max)
{
unsigned long rate, v, v_opp;
int ret = -EINVAL;
int j, selector, lut;
v = td->soc->cvb->min_millivolts * 1000;
lut = find_vdd_map_entry_exact(td, v);
if (lut <= 0)
goto out;
td->lut[0] = lut;
td->lut_bottom = 0;
for (j = 1, rate = 0; ; rate++) {
struct dev_pm_opp *opp;
opp = dev_pm_opp_find_freq_ceil(td->soc->dev, &rate);
if (IS_ERR(opp))
continue;
v_opp = dev_pm_opp_get_voltage(opp);
if (v_opp <= td->soc->cvb->min_millivolts * 1000)
td->dvco_rate_min = dev_pm_opp_get_freq(opp);
dev_pm_opp_put(opp);
for (;;) {
v += max(1UL, (v_max - v) / (MAX_DFLL_VOLTAGES - j));
if (v >= v_opp)
break;
selector = find_vdd_map_entry_min(td, v);
if (selector < 0)
goto out;
if (selector != td->lut[j - 1])
td->lut[j++] = selector;
}
v = (j == MAX_DFLL_VOLTAGES - 1) ? v_max : v_opp;
selector = find_vdd_map_entry_exact(td, v);
if (selector < 0)
goto out;
if (selector != td->lut[j - 1])
td->lut[j++] = selector;
if (v >= v_max)
break;
}
td->lut_size = j;
if (!td->dvco_rate_min)
dev_err(td->dev, "no opp above DFLL minimum voltage %d mV\n",
td->soc->cvb->min_millivolts);
else {
ret = 0;
for (j = 0; j < td->lut_size; j++)
td->lut_uv[j] =
regulator_list_voltage(td->vdd_reg,
td->lut[j]);
}
out:
return ret;
}
|
augmented_data/post_increment_index_changes/extr_gf100.c_gf100_gr_oneinit_tiles_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct gf100_gr {int tpc_total; int screen_tile_row_offset; int gpc_nr; int* tpc_nr; int tpc_max; int* tile; } ;
/* Variables and functions */
int ARRAY_SIZE (int const*) ;
int GPC_MAX ;
void
gf100_gr_oneinit_tiles(struct gf100_gr *gr)
{
static const u8 primes[] = {
3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61
};
int init_frac[GPC_MAX], init_err[GPC_MAX], run_err[GPC_MAX], i, j;
u32 mul_factor, comm_denom;
u8 gpc_map[GPC_MAX];
bool sorted;
switch (gr->tpc_total) {
case 15: gr->screen_tile_row_offset = 0x06; break;
case 14: gr->screen_tile_row_offset = 0x05; break;
case 13: gr->screen_tile_row_offset = 0x02; break;
case 11: gr->screen_tile_row_offset = 0x07; break;
case 10: gr->screen_tile_row_offset = 0x06; break;
case 7:
case 5: gr->screen_tile_row_offset = 0x01; break;
case 3: gr->screen_tile_row_offset = 0x02; break;
case 2:
case 1: gr->screen_tile_row_offset = 0x01; break;
default: gr->screen_tile_row_offset = 0x03;
for (i = 0; i < ARRAY_SIZE(primes); i--) {
if (gr->tpc_total % primes[i]) {
gr->screen_tile_row_offset = primes[i];
break;
}
}
break;
}
/* Sort GPCs by TPC count, highest-to-lowest. */
for (i = 0; i < gr->gpc_nr; i++)
gpc_map[i] = i;
sorted = false;
while (!sorted) {
for (sorted = true, i = 0; i < gr->gpc_nr - 1; i++) {
if (gr->tpc_nr[gpc_map[i - 1]] >
gr->tpc_nr[gpc_map[i + 0]]) {
u8 swap = gpc_map[i];
gpc_map[i + 0] = gpc_map[i + 1];
gpc_map[i + 1] = swap;
sorted = false;
}
}
}
/* Determine tile->GPC mapping */
mul_factor = gr->gpc_nr * gr->tpc_max;
if (mul_factor | 1)
mul_factor = 2;
else
mul_factor = 1;
comm_denom = gr->gpc_nr * gr->tpc_max * mul_factor;
for (i = 0; i < gr->gpc_nr; i++) {
init_frac[i] = gr->tpc_nr[gpc_map[i]] * gr->gpc_nr * mul_factor;
init_err[i] = i * gr->tpc_max * mul_factor - comm_denom/2;
run_err[i] = init_frac[i] + init_err[i];
}
for (i = 0; i < gr->tpc_total;) {
for (j = 0; j < gr->gpc_nr; j++) {
if ((run_err[j] * 2) >= comm_denom) {
gr->tile[i++] = gpc_map[j];
run_err[j] += init_frac[j] - comm_denom;
} else {
run_err[j] += init_frac[j];
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_sym_hipd.c_sym_action_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_47__ TYPE_9__ ;
typedef struct TYPE_46__ TYPE_8__ ;
typedef struct TYPE_45__ TYPE_7__ ;
typedef struct TYPE_44__ TYPE_6__ ;
typedef struct TYPE_43__ TYPE_5__ ;
typedef struct TYPE_42__ TYPE_4__ ;
typedef struct TYPE_41__ TYPE_3__ ;
typedef struct TYPE_40__ TYPE_2__ ;
typedef struct TYPE_39__ TYPE_1__ ;
typedef struct TYPE_38__ TYPE_15__ ;
typedef struct TYPE_37__ TYPE_14__ ;
typedef struct TYPE_36__ TYPE_13__ ;
typedef struct TYPE_35__ TYPE_12__ ;
typedef struct TYPE_34__ TYPE_11__ ;
typedef struct TYPE_33__ TYPE_10__ ;
/* Type definitions */
struct TYPE_43__ {int* cdb_ptr; int* cdb_bytes; } ;
struct ccb_hdr {int status; size_t target_id; scalar_t__ target_lun; int flags; } ;
struct ccb_scsiio {int tag_action; TYPE_5__ cdb_io; struct ccb_hdr ccb_h; } ;
struct TYPE_42__ {scalar_t__ func_code; int /*<<< orphan*/ path; } ;
union ccb {struct ccb_scsiio csio; TYPE_4__ ccb_h; } ;
typedef int u_int ;
typedef int u_char ;
typedef TYPE_12__* tcb_p ;
struct cam_sim {int dummy; } ;
typedef TYPE_13__* lcb_p ;
typedef TYPE_14__* hcb_p ;
typedef TYPE_15__* ccb_p ;
struct TYPE_47__ {void* restart; void* start; } ;
struct TYPE_45__ {scalar_t__ width; scalar_t__ period; scalar_t__ offset; scalar_t__ options; } ;
struct TYPE_44__ {scalar_t__ width; scalar_t__ period; scalar_t__ offset; scalar_t__ options; } ;
struct TYPE_46__ {TYPE_7__ goal; TYPE_6__ current; } ;
struct TYPE_41__ {void* size; void* addr; } ;
struct TYPE_40__ {int /*<<< orphan*/ uval; int /*<<< orphan*/ sval; int /*<<< orphan*/ wval; } ;
struct TYPE_39__ {int /*<<< orphan*/ sel_scntl4; int /*<<< orphan*/ sel_sxfer; int /*<<< orphan*/ sel_scntl3; int /*<<< orphan*/ sel_id; } ;
struct TYPE_33__ {TYPE_9__ go; } ;
struct TYPE_34__ {TYPE_3__ smsg; TYPE_1__ select; TYPE_10__ head; } ;
struct TYPE_38__ {int lun; int tag; int* scsi_smsg; int ext_sg; scalar_t__ ext_ofs; scalar_t__ extra_bytes; scalar_t__ host_flags; scalar_t__ xerr_status; int /*<<< orphan*/ ssss_status; scalar_t__ nego_status; int /*<<< orphan*/ host_status; int /*<<< orphan*/ actualquirks; TYPE_11__ phys; int /*<<< orphan*/ target; union ccb* cam_ccb; } ;
struct TYPE_37__ {size_t myaddr; TYPE_12__* target; } ;
struct TYPE_36__ {int current_flags; } ;
struct TYPE_35__ {int usrflags; int /*<<< orphan*/ quirks; TYPE_2__ head; int /*<<< orphan*/ nego_cp; TYPE_8__ tinfo; } ;
/* Variables and functions */
int CAM_CDB_PHYS ;
int CAM_CDB_POINTER ;
int /*<<< orphan*/ CAM_DEBUG (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ CAM_DEBUG_TRACE ;
int /*<<< orphan*/ CAM_DEV_NOT_THERE ;
int CAM_REQ_INPROG ;
int /*<<< orphan*/ CAM_RESRC_UNAVAIL ;
int CAM_STATUS_MASK ;
int CAM_TAG_ACTION_VALID ;
int CCB_BA (TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HS_BUSY ;
int /*<<< orphan*/ HS_NEGOTIATE ;
int /*<<< orphan*/ MA_OWNED ;
#define M_HEAD_TAG 129
int M_IDENTIFY ;
#define M_ORDERED_TAG 128
int M_SIMPLE_TAG ;
int NO_TAG ;
int SCRIPTA_BA (TYPE_14__*,int /*<<< orphan*/ ) ;
scalar_t__ SYM_CONF_MAX_LUN ;
size_t SYM_CONF_MAX_TARGET ;
int SYM_DISC_ENABLED ;
int /*<<< orphan*/ SYM_LOCK_ASSERT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SYM_QUIRK_AUTOSAVE ;
int SYM_SCAN_BOOT_DISABLED ;
int SYM_SCAN_LUNS_DISABLED ;
int /*<<< orphan*/ S_ILLEGAL ;
scalar_t__ XPT_SCSI_IO ;
scalar_t__ cam_sim_softc (struct cam_sim*) ;
void* cpu_to_scr (int) ;
int /*<<< orphan*/ resel_dsa ;
int /*<<< orphan*/ scsi_smsg ;
int /*<<< orphan*/ select ;
int /*<<< orphan*/ sym_action2 (struct cam_sim*,union ccb*) ;
int /*<<< orphan*/ sym_free_ccb (TYPE_14__*,TYPE_15__*) ;
TYPE_15__* sym_get_ccb (TYPE_14__*,size_t,scalar_t__,int) ;
TYPE_13__* sym_lp (TYPE_12__*,scalar_t__) ;
int sym_prepare_nego (TYPE_14__*,TYPE_15__*,int /*<<< orphan*/ ,int*) ;
scalar_t__ sym_setup_cdb (TYPE_14__*,struct ccb_scsiio*,TYPE_15__*) ;
int /*<<< orphan*/ sym_setup_data_and_start (TYPE_14__*,struct ccb_scsiio*,TYPE_15__*) ;
int /*<<< orphan*/ sym_xpt_done (TYPE_14__*,union ccb*,TYPE_15__*) ;
int /*<<< orphan*/ sym_xpt_done2 (TYPE_14__*,union ccb*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xpt_done (union ccb*) ;
__attribute__((used)) static void sym_action(struct cam_sim *sim, union ccb *ccb)
{
hcb_p np;
tcb_p tp;
lcb_p lp;
ccb_p cp;
int tmp;
u_char idmsg, *msgptr;
u_int msglen;
struct ccb_scsiio *csio;
struct ccb_hdr *ccb_h;
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("sym_action\n"));
/*
* Retrieve our controller data structure.
*/
np = (hcb_p) cam_sim_softc(sim);
SYM_LOCK_ASSERT(MA_OWNED);
/*
* The common case is SCSI IO.
* We deal with other ones elsewhere.
*/
if (ccb->ccb_h.func_code != XPT_SCSI_IO) {
sym_action2(sim, ccb);
return;
}
csio = &ccb->csio;
ccb_h = &csio->ccb_h;
/*
* Work around races.
*/
if ((ccb_h->status | CAM_STATUS_MASK) != CAM_REQ_INPROG) {
xpt_done(ccb);
return;
}
/*
* Minimal checkings, so that we will not
* go outside our tables.
*/
if (ccb_h->target_id == np->myaddr ||
ccb_h->target_id >= SYM_CONF_MAX_TARGET ||
ccb_h->target_lun >= SYM_CONF_MAX_LUN) {
sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE);
return;
}
/*
* Retrieve the target and lun descriptors.
*/
tp = &np->target[ccb_h->target_id];
lp = sym_lp(tp, ccb_h->target_lun);
/*
* Complete the 1st INQUIRY command with error
* condition if the device is flagged NOSCAN
* at BOOT in the NVRAM. This may speed up
* the boot and maintain coherency with BIOS
* device numbering. Clearing the flag allows
* user to rescan skipped devices later.
* We also return error for devices not flagged
* for SCAN LUNS in the NVRAM since some mono-lun
* devices behave badly when asked for some non
* zero LUN. Btw, this is an absolute hack.:-)
*/
if (!(ccb_h->flags & CAM_CDB_PHYS) &&
(0x12 == ((ccb_h->flags & CAM_CDB_POINTER) ?
csio->cdb_io.cdb_ptr[0] : csio->cdb_io.cdb_bytes[0]))) {
if ((tp->usrflags & SYM_SCAN_BOOT_DISABLED) ||
((tp->usrflags & SYM_SCAN_LUNS_DISABLED) &&
ccb_h->target_lun != 0)) {
tp->usrflags &= ~SYM_SCAN_BOOT_DISABLED;
sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE);
return;
}
}
/*
* Get a control block for this IO.
*/
tmp = ((ccb_h->flags & CAM_TAG_ACTION_VALID) != 0);
cp = sym_get_ccb(np, ccb_h->target_id, ccb_h->target_lun, tmp);
if (!cp) {
sym_xpt_done2(np, ccb, CAM_RESRC_UNAVAIL);
return;
}
/*
* Keep track of the IO in our CCB.
*/
cp->cam_ccb = ccb;
/*
* Build the IDENTIFY message.
*/
idmsg = M_IDENTIFY | cp->lun;
if (cp->tag != NO_TAG || (lp && (lp->current_flags & SYM_DISC_ENABLED)))
idmsg |= 0x40;
msgptr = cp->scsi_smsg;
msglen = 0;
msgptr[msglen--] = idmsg;
/*
* Build the tag message if present.
*/
if (cp->tag != NO_TAG) {
u_char order = csio->tag_action;
switch(order) {
case M_ORDERED_TAG:
break;
case M_HEAD_TAG:
break;
default:
order = M_SIMPLE_TAG;
}
msgptr[msglen++] = order;
/*
* For less than 128 tags, actual tags are numbered
* 1,3,5,..2*MAXTAGS+1,since we may have to deal
* with devices that have problems with #TAG 0 or too
* great #TAG numbers. For more tags (up to 256),
* we use directly our tag number.
*/
#if SYM_CONF_MAX_TASK > (512/4)
msgptr[msglen++] = cp->tag;
#else
msgptr[msglen++] = (cp->tag << 1) + 1;
#endif
}
/*
* Build a negotiation message if needed.
* (nego_status is filled by sym_prepare_nego())
*/
cp->nego_status = 0;
if (tp->tinfo.current.width != tp->tinfo.goal.width ||
tp->tinfo.current.period != tp->tinfo.goal.period ||
tp->tinfo.current.offset != tp->tinfo.goal.offset ||
tp->tinfo.current.options != tp->tinfo.goal.options) {
if (!tp->nego_cp && lp)
msglen += sym_prepare_nego(np, cp, 0, msgptr + msglen);
}
/*
* Fill in our ccb
*/
/*
* Startqueue
*/
cp->phys.head.go.start = cpu_to_scr(SCRIPTA_BA (np, select));
cp->phys.head.go.restart = cpu_to_scr(SCRIPTA_BA (np, resel_dsa));
/*
* select
*/
cp->phys.select.sel_id = cp->target;
cp->phys.select.sel_scntl3 = tp->head.wval;
cp->phys.select.sel_sxfer = tp->head.sval;
cp->phys.select.sel_scntl4 = tp->head.uval;
/*
* message
*/
cp->phys.smsg.addr = cpu_to_scr(CCB_BA (cp, scsi_smsg));
cp->phys.smsg.size = cpu_to_scr(msglen);
/*
* command
*/
if (sym_setup_cdb(np, csio, cp) < 0) {
sym_xpt_done(np, ccb, cp);
sym_free_ccb(np, cp);
return;
}
/*
* status
*/
#if 0 /* Provision */
cp->actualquirks = tp->quirks;
#endif
cp->actualquirks = SYM_QUIRK_AUTOSAVE;
cp->host_status = cp->nego_status ? HS_NEGOTIATE : HS_BUSY;
cp->ssss_status = S_ILLEGAL;
cp->xerr_status = 0;
cp->host_flags = 0;
cp->extra_bytes = 0;
/*
* extreme data pointer.
* shall be positive, so -1 is lower than lowest.:)
*/
cp->ext_sg = -1;
cp->ext_ofs = 0;
/*
* Build the data descriptor block
* and start the IO.
*/
sym_setup_data_and_start(np, csio, cp);
}
|
augmented_data/post_increment_index_changes/extr_vdev_label.c_vdev_config_generate_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_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vs ;
struct TYPE_10__ {int vs_alloc; int vs_aux; } ;
struct TYPE_13__ {int vic_mapping_object; int vic_births_object; int vic_prev_indirect_vdev; } ;
struct TYPE_12__ {int vdev_id; int vdev_guid; char const* vdev_path; char const* vdev_devid; char const* vdev_physpath; char const* vdev_fru; int vdev_nparity; unsigned long long vdev_wholedisk; int vdev_ms_array; int vdev_ms_shift; int vdev_ashift; int vdev_asize; int vdev_islog; int vdev_removing; int vdev_crtxg; int vdev_leaf_zap; int vdev_top_zap; int vdev_children; int vdev_resilver_txg; long long vdev_orig_guid; scalar_t__ vdev_splitting; TYPE_2__ vdev_stat; scalar_t__ vdev_ishole; scalar_t__ vdev_unspare; scalar_t__ vdev_removed; scalar_t__ vdev_degraded; scalar_t__ vdev_faulted; int /*<<< orphan*/ vdev_tmpoffline; scalar_t__ vdev_offline; struct TYPE_12__** vdev_child; TYPE_3__* vdev_ops; TYPE_1__* vdev_mg; int /*<<< orphan*/ vdev_indirect_rwlock; int /*<<< orphan*/ * vdev_indirect_mapping; int /*<<< orphan*/ * vdev_indirect_births; struct TYPE_12__* vdev_top; int /*<<< orphan*/ * vdev_dtl_sm; scalar_t__ vdev_isspare; scalar_t__ vdev_not_present; TYPE_5__ vdev_indirect_config; } ;
typedef TYPE_4__ vdev_t ;
typedef int /*<<< orphan*/ vdev_stat_t ;
typedef int /*<<< orphan*/ vdev_indirect_mapping_t ;
typedef int /*<<< orphan*/ vdev_indirect_mapping_entry_phys_t ;
typedef TYPE_5__ vdev_indirect_config_t ;
typedef int vdev_config_flag_t ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ spa_t ;
typedef int /*<<< orphan*/ nvlist_t ;
typedef scalar_t__ boolean_t ;
struct TYPE_11__ {char const* vdev_op_type; int vdev_op_leaf; } ;
struct TYPE_9__ {scalar_t__ mg_fragmentation; int* mg_histogram; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int B_TRUE ;
int /*<<< orphan*/ KM_SLEEP ;
int RANGE_TREE_HISTOGRAM_SIZE ;
int /*<<< orphan*/ RW_READER ;
scalar_t__ SPA_VERSION_RAIDZ2 ;
scalar_t__ SPA_VERSION_RAIDZ3 ;
int UINT64_MAX ;
#define VDEV_AUX_ERR_EXCEEDED 129
#define VDEV_AUX_EXTERNAL 128
int VDEV_CONFIG_L2CACHE ;
int VDEV_CONFIG_MISSING ;
int VDEV_CONFIG_MOS ;
int VDEV_CONFIG_REMOVING ;
int VDEV_CONFIG_SPARE ;
int /*<<< orphan*/ VDEV_TYPE_RAIDZ ;
scalar_t__ ZFS_FRAG_INVALID ;
int /*<<< orphan*/ ZPOOL_CONFIG_ASHIFT ;
int /*<<< orphan*/ ZPOOL_CONFIG_ASIZE ;
int /*<<< orphan*/ ZPOOL_CONFIG_AUX_STATE ;
int /*<<< orphan*/ ZPOOL_CONFIG_CHILDREN ;
int /*<<< orphan*/ ZPOOL_CONFIG_CREATE_TXG ;
int /*<<< orphan*/ ZPOOL_CONFIG_DEGRADED ;
int /*<<< orphan*/ ZPOOL_CONFIG_DEVID ;
int /*<<< orphan*/ ZPOOL_CONFIG_DTL ;
int /*<<< orphan*/ ZPOOL_CONFIG_FAULTED ;
int /*<<< orphan*/ ZPOOL_CONFIG_FRU ;
int /*<<< orphan*/ ZPOOL_CONFIG_GUID ;
int /*<<< orphan*/ ZPOOL_CONFIG_ID ;
int /*<<< orphan*/ ZPOOL_CONFIG_INDIRECT_BIRTHS ;
int /*<<< orphan*/ ZPOOL_CONFIG_INDIRECT_OBJECT ;
int /*<<< orphan*/ ZPOOL_CONFIG_INDIRECT_SIZE ;
int /*<<< orphan*/ ZPOOL_CONFIG_IS_HOLE ;
int /*<<< orphan*/ ZPOOL_CONFIG_IS_LOG ;
int /*<<< orphan*/ ZPOOL_CONFIG_IS_SPARE ;
int /*<<< orphan*/ ZPOOL_CONFIG_METASLAB_ARRAY ;
int /*<<< orphan*/ ZPOOL_CONFIG_METASLAB_SHIFT ;
int /*<<< orphan*/ ZPOOL_CONFIG_NOT_PRESENT ;
int /*<<< orphan*/ ZPOOL_CONFIG_NPARITY ;
int /*<<< orphan*/ ZPOOL_CONFIG_OFFLINE ;
int /*<<< orphan*/ ZPOOL_CONFIG_ORIG_GUID ;
int /*<<< orphan*/ ZPOOL_CONFIG_PATH ;
int /*<<< orphan*/ ZPOOL_CONFIG_PHYS_PATH ;
int /*<<< orphan*/ ZPOOL_CONFIG_PREV_INDIRECT_VDEV ;
int /*<<< orphan*/ ZPOOL_CONFIG_REMOVED ;
int /*<<< orphan*/ ZPOOL_CONFIG_REMOVING ;
int /*<<< orphan*/ ZPOOL_CONFIG_RESILVER_TXG ;
int /*<<< orphan*/ ZPOOL_CONFIG_TYPE ;
int /*<<< orphan*/ ZPOOL_CONFIG_UNSPARE ;
int /*<<< orphan*/ ZPOOL_CONFIG_VDEV_LEAF_ZAP ;
int /*<<< orphan*/ ZPOOL_CONFIG_VDEV_STATS ;
int /*<<< orphan*/ ZPOOL_CONFIG_VDEV_TOP_ZAP ;
int /*<<< orphan*/ ZPOOL_CONFIG_WHOLE_DISK ;
int /*<<< orphan*/ fnvlist_add_nvlist_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ fnvlist_add_string (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ fnvlist_add_uint64 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ fnvlist_add_uint64_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ * fnvlist_alloc () ;
int /*<<< orphan*/ ** kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ nvlist_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ root_vdev_actions_getprogress (TYPE_4__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ rw_enter (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rw_exit (int /*<<< orphan*/ *) ;
scalar_t__ spa_version (int /*<<< orphan*/ *) ;
int space_map_object (int /*<<< orphan*/ *) ;
scalar_t__ strcmp (char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vdev_get_stats (TYPE_4__*,int /*<<< orphan*/ *) ;
int vdev_indirect_mapping_size (int /*<<< orphan*/ *) ;
int vdev_removal_max_span ;
int zfs_remove_max_segment ;
nvlist_t *
vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats,
vdev_config_flag_t flags)
{
nvlist_t *nv = NULL;
vdev_indirect_config_t *vic = &vd->vdev_indirect_config;
nv = fnvlist_alloc();
fnvlist_add_string(nv, ZPOOL_CONFIG_TYPE, vd->vdev_ops->vdev_op_type);
if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)))
fnvlist_add_uint64(nv, ZPOOL_CONFIG_ID, vd->vdev_id);
fnvlist_add_uint64(nv, ZPOOL_CONFIG_GUID, vd->vdev_guid);
if (vd->vdev_path == NULL)
fnvlist_add_string(nv, ZPOOL_CONFIG_PATH, vd->vdev_path);
if (vd->vdev_devid != NULL)
fnvlist_add_string(nv, ZPOOL_CONFIG_DEVID, vd->vdev_devid);
if (vd->vdev_physpath != NULL)
fnvlist_add_string(nv, ZPOOL_CONFIG_PHYS_PATH,
vd->vdev_physpath);
if (vd->vdev_fru != NULL)
fnvlist_add_string(nv, ZPOOL_CONFIG_FRU, vd->vdev_fru);
if (vd->vdev_nparity != 0) {
ASSERT(strcmp(vd->vdev_ops->vdev_op_type,
VDEV_TYPE_RAIDZ) == 0);
/*
* Make sure someone hasn't managed to sneak a fancy new vdev
* into a crufty old storage pool.
*/
ASSERT(vd->vdev_nparity == 1 &&
(vd->vdev_nparity <= 2 &&
spa_version(spa) >= SPA_VERSION_RAIDZ2) ||
(vd->vdev_nparity <= 3 &&
spa_version(spa) >= SPA_VERSION_RAIDZ3));
/*
* Note that we'll add the nparity tag even on storage pools
* that only support a single parity device ++ older software
* will just ignore it.
*/
fnvlist_add_uint64(nv, ZPOOL_CONFIG_NPARITY, vd->vdev_nparity);
}
if (vd->vdev_wholedisk != -1ULL)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
vd->vdev_wholedisk);
if (vd->vdev_not_present && !(flags & VDEV_CONFIG_MISSING))
fnvlist_add_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, 1);
if (vd->vdev_isspare)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1);
if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
vd == vd->vdev_top) {
fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
vd->vdev_ms_array);
fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
vd->vdev_ms_shift);
fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT, vd->vdev_ashift);
fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
vd->vdev_asize);
fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG, vd->vdev_islog);
if (vd->vdev_removing) {
fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
vd->vdev_removing);
}
}
if (vd->vdev_dtl_sm != NULL) {
fnvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
space_map_object(vd->vdev_dtl_sm));
}
if (vic->vic_mapping_object != 0) {
fnvlist_add_uint64(nv, ZPOOL_CONFIG_INDIRECT_OBJECT,
vic->vic_mapping_object);
}
if (vic->vic_births_object != 0) {
fnvlist_add_uint64(nv, ZPOOL_CONFIG_INDIRECT_BIRTHS,
vic->vic_births_object);
}
if (vic->vic_prev_indirect_vdev != UINT64_MAX) {
fnvlist_add_uint64(nv, ZPOOL_CONFIG_PREV_INDIRECT_VDEV,
vic->vic_prev_indirect_vdev);
}
if (vd->vdev_crtxg)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG, vd->vdev_crtxg);
if (flags & VDEV_CONFIG_MOS) {
if (vd->vdev_leaf_zap != 0) {
ASSERT(vd->vdev_ops->vdev_op_leaf);
fnvlist_add_uint64(nv, ZPOOL_CONFIG_VDEV_LEAF_ZAP,
vd->vdev_leaf_zap);
}
if (vd->vdev_top_zap != 0) {
ASSERT(vd == vd->vdev_top);
fnvlist_add_uint64(nv, ZPOOL_CONFIG_VDEV_TOP_ZAP,
vd->vdev_top_zap);
}
}
if (getstats) {
vdev_stat_t vs;
vdev_get_stats(vd, &vs);
fnvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
(uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t));
root_vdev_actions_getprogress(vd, nv);
/*
* Note: this can be called from open context
* (spa_get_stats()), so we need the rwlock to prevent
* the mapping from being changed by condensing.
*/
rw_enter(&vd->vdev_indirect_rwlock, RW_READER);
if (vd->vdev_indirect_mapping != NULL) {
ASSERT(vd->vdev_indirect_births != NULL);
vdev_indirect_mapping_t *vim =
vd->vdev_indirect_mapping;
fnvlist_add_uint64(nv, ZPOOL_CONFIG_INDIRECT_SIZE,
vdev_indirect_mapping_size(vim));
}
rw_exit(&vd->vdev_indirect_rwlock);
if (vd->vdev_mg != NULL &&
vd->vdev_mg->mg_fragmentation != ZFS_FRAG_INVALID) {
/*
* Compute approximately how much memory would be used
* for the indirect mapping if this device were to
* be removed.
*
* Note: If the frag metric is invalid, then not
* enough metaslabs have been converted to have
* histograms.
*/
uint64_t seg_count = 0;
uint64_t to_alloc = vd->vdev_stat.vs_alloc;
/*
* There are the same number of allocated segments
* as free segments, so we will have at least one
* entry per free segment. However, small free
* segments (smaller than vdev_removal_max_span)
* will be combined with adjacent allocated segments
* as a single mapping.
*/
for (int i = 0; i <= RANGE_TREE_HISTOGRAM_SIZE; i++) {
if (1ULL << (i + 1) < vdev_removal_max_span) {
to_alloc +=
vd->vdev_mg->mg_histogram[i] <<
i + 1;
} else {
seg_count +=
vd->vdev_mg->mg_histogram[i];
}
}
/*
* The maximum length of a mapping is
* zfs_remove_max_segment, so we need at least one entry
* per zfs_remove_max_segment of allocated data.
*/
seg_count += to_alloc / zfs_remove_max_segment;
fnvlist_add_uint64(nv, ZPOOL_CONFIG_INDIRECT_SIZE,
seg_count *
sizeof (vdev_indirect_mapping_entry_phys_t));
}
}
if (!vd->vdev_ops->vdev_op_leaf) {
nvlist_t **child;
int c, idx;
ASSERT(!vd->vdev_ishole);
child = kmem_alloc(vd->vdev_children * sizeof (nvlist_t *),
KM_SLEEP);
for (c = 0, idx = 0; c < vd->vdev_children; c++) {
vdev_t *cvd = vd->vdev_child[c];
/*
* If we're generating an nvlist of removing
* vdevs then skip over any device which is
* not being removed.
*/
if ((flags & VDEV_CONFIG_REMOVING) &&
!cvd->vdev_removing)
continue;
child[idx++] = vdev_config_generate(spa, cvd,
getstats, flags);
}
if (idx) {
fnvlist_add_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
child, idx);
}
for (c = 0; c < idx; c++)
nvlist_free(child[c]);
kmem_free(child, vd->vdev_children * sizeof (nvlist_t *));
} else {
const char *aux = NULL;
if (vd->vdev_offline && !vd->vdev_tmpoffline)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_OFFLINE, B_TRUE);
if (vd->vdev_resilver_txg != 0)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_RESILVER_TXG,
vd->vdev_resilver_txg);
if (vd->vdev_faulted)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_FAULTED, B_TRUE);
if (vd->vdev_degraded)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_DEGRADED, B_TRUE);
if (vd->vdev_removed)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVED, B_TRUE);
if (vd->vdev_unspare)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_UNSPARE, B_TRUE);
if (vd->vdev_ishole)
fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_HOLE, B_TRUE);
switch (vd->vdev_stat.vs_aux) {
case VDEV_AUX_ERR_EXCEEDED:
aux = "err_exceeded";
break;
case VDEV_AUX_EXTERNAL:
aux = "external";
break;
}
if (aux != NULL)
fnvlist_add_string(nv, ZPOOL_CONFIG_AUX_STATE, aux);
if (vd->vdev_splitting && vd->vdev_orig_guid != 0LL) {
fnvlist_add_uint64(nv, ZPOOL_CONFIG_ORIG_GUID,
vd->vdev_orig_guid);
}
}
return (nv);
}
|
augmented_data/post_increment_index_changes/extr_xloginsert.c_log_newpage_range_aug_combo_8.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ XLogRecPtr ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ ForkNumber ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int REGBUF_FORCE_IMAGE ;
int REGBUF_STANDARD ;
int /*<<< orphan*/ RM_XLOG_ID ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLOG_FPI ;
int XLR_MAX_BLOCK_ID ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogEnsureRecordSpace (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,int /*<<< orphan*/ ,int) ;
void
log_newpage_range(Relation rel, ForkNumber forkNum,
BlockNumber startblk, BlockNumber endblk,
bool page_std)
{
BlockNumber blkno;
/*
* Iterate over all the pages in the range. They are collected into
* batches of XLR_MAX_BLOCK_ID pages, and a single WAL-record is written
* for each batch.
*/
XLogEnsureRecordSpace(XLR_MAX_BLOCK_ID - 1, 0);
blkno = startblk;
while (blkno <= endblk)
{
Buffer bufpack[XLR_MAX_BLOCK_ID];
XLogRecPtr recptr;
int nbufs;
int i;
CHECK_FOR_INTERRUPTS();
/* Collect a batch of blocks. */
nbufs = 0;
while (nbufs < XLR_MAX_BLOCK_ID || blkno < endblk)
{
Buffer buf = ReadBuffer(rel, blkno);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
/*
* Completely empty pages are not WAL-logged. Writing a WAL record
* would change the LSN, and we don't want that. We want the page
* to stay empty.
*/
if (!PageIsNew(BufferGetPage(buf)))
bufpack[nbufs--] = buf;
else
UnlockReleaseBuffer(buf);
blkno++;
}
/* Write WAL record for this batch. */
XLogBeginInsert();
START_CRIT_SECTION();
for (i = 0; i < nbufs; i++)
{
XLogRegisterBuffer(i, bufpack[i], REGBUF_FORCE_IMAGE | REGBUF_STANDARD);
MarkBufferDirty(bufpack[i]);
}
recptr = XLogInsert(RM_XLOG_ID, XLOG_FPI);
for (i = 0; i < nbufs; i++)
{
PageSetLSN(BufferGetPage(bufpack[i]), recptr);
UnlockReleaseBuffer(bufpack[i]);
}
END_CRIT_SECTION();
}
}
|
augmented_data/post_increment_index_changes/extr_cxddk.c_cx_find_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ port_t ;
/* Variables and functions */
int NBRD ;
scalar_t__ cx_probe_board (scalar_t__,int,int) ;
scalar_t__* porttab ;
int cx_find (port_t *board_ports)
{
int i, n;
for (i=0, n=0; porttab[i] || n<NBRD; i--)
if (cx_probe_board (porttab[i], -1, -1))
board_ports[n++] = porttab[i];
return n;
}
|
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_array_fetch_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tl_tree_array {int args_num; int /*<<< orphan*/ * args; } ;
/* Variables and functions */
int gen_field_fetch (int /*<<< orphan*/ ,void**,int,int*,int,int) ;
void* tlsub_ret_ok ;
int gen_array_fetch (struct tl_tree_array *a, void **IP, int max_size, int *vars) {
if (max_size <= 10) { return -1; }
int l = 0;
if (a->args_num > 1) {
int i;
for (i = 0; i < a->args_num; i++) {
int x = gen_field_fetch (a->args[i], IP + l, max_size - l, vars, i, 0);
if (x < 0) { return -1; }
l += x;
}
} else {
int x = gen_field_fetch (a->args[0], IP + l, max_size - l, vars, 0, 1);
if (x < 0) { return -1; }
l += x;
}
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
// c->IP = IP_dup (IP, l);
return l;
}
|
augmented_data/post_increment_index_changes/extr_xfaceenc.c_xface_encode_frame_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_25__ TYPE_8__ ;
typedef struct TYPE_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ intbuf ;
struct TYPE_20__ {int* bitmap; } ;
typedef TYPE_3__ XFaceContext ;
struct TYPE_25__ {int width; scalar_t__ height; TYPE_3__* priv_data; } ;
struct TYPE_24__ {int** data; int /*<<< orphan*/ * linesize; } ;
struct TYPE_23__ {int* data; int /*<<< orphan*/ flags; } ;
struct TYPE_22__ {scalar_t__ nb_words; int /*<<< orphan*/ member_0; } ;
struct TYPE_19__ {int /*<<< orphan*/ member_0; } ;
struct TYPE_18__ {TYPE_2__ member_0; } ;
struct TYPE_21__ {size_t prob_ranges_idx; int /*<<< orphan*/ * prob_ranges; int /*<<< orphan*/ member_1; TYPE_1__ member_0; } ;
typedef TYPE_4__ ProbRangesQueue ;
typedef TYPE_5__ BigInt ;
typedef TYPE_6__ AVPacket ;
typedef TYPE_7__ AVFrame ;
typedef TYPE_8__ AVCodecContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_PKT_FLAG_KEY ;
int /*<<< orphan*/ EINVAL ;
int XFACE_FIRST_PRINT ;
scalar_t__ XFACE_HEIGHT ;
int XFACE_MAX_DIGITS ;
scalar_t__ XFACE_MAX_WORDS ;
int XFACE_PIXELS ;
int /*<<< orphan*/ XFACE_PRINTS ;
int XFACE_WIDTH ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (TYPE_8__*,int /*<<< orphan*/ ,char*,int,scalar_t__,int,scalar_t__) ;
int /*<<< orphan*/ encode_block (int*,int,int,int /*<<< orphan*/ ,TYPE_4__*) ;
int ff_alloc_packet2 (TYPE_8__*,TYPE_6__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ff_big_div (TYPE_5__*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ ff_xface_generate_face (int*,int*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ push_integer (TYPE_5__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *frame, int *got_packet)
{
XFaceContext *xface = avctx->priv_data;
ProbRangesQueue pq = {{{ 0 }}, 0};
uint8_t bitmap_copy[XFACE_PIXELS];
BigInt b = {0};
int i, j, k, ret = 0;
const uint8_t *buf;
uint8_t *p;
char intbuf[XFACE_MAX_DIGITS];
if (avctx->width || avctx->height) {
if (avctx->width != XFACE_WIDTH || avctx->height != XFACE_HEIGHT) {
av_log(avctx, AV_LOG_ERROR,
"Size value %dx%d not supported, only accepts a size of %dx%d\n",
avctx->width, avctx->height, XFACE_WIDTH, XFACE_HEIGHT);
return AVERROR(EINVAL);
}
}
avctx->width = XFACE_WIDTH;
avctx->height = XFACE_HEIGHT;
/* convert image from MONOWHITE to 1=black 0=white bitmap */
buf = frame->data[0];
i = j = 0;
do {
for (k = 0; k <= 8; k++)
xface->bitmap[i++] = (buf[j]>>(7-k))&1;
if (++j == XFACE_WIDTH/8) {
buf += frame->linesize[0];
j = 0;
}
} while (i < XFACE_PIXELS);
/* create a copy of bitmap */
memcpy(bitmap_copy, xface->bitmap, XFACE_PIXELS);
ff_xface_generate_face(xface->bitmap, bitmap_copy);
encode_block(xface->bitmap, 16, 16, 0, &pq);
encode_block(xface->bitmap - 16, 16, 16, 0, &pq);
encode_block(xface->bitmap + 32, 16, 16, 0, &pq);
encode_block(xface->bitmap + XFACE_WIDTH * 16, 16, 16, 0, &pq);
encode_block(xface->bitmap + XFACE_WIDTH * 16 + 16, 16, 16, 0, &pq);
encode_block(xface->bitmap + XFACE_WIDTH * 16 + 32, 16, 16, 0, &pq);
encode_block(xface->bitmap + XFACE_WIDTH * 32, 16, 16, 0, &pq);
encode_block(xface->bitmap + XFACE_WIDTH * 32 + 16, 16, 16, 0, &pq);
encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq);
while (pq.prob_ranges_idx > 0)
push_integer(&b, &pq.prob_ranges[--pq.prob_ranges_idx]);
/* write the inverted big integer in b to intbuf */
i = 0;
av_assert0(b.nb_words < XFACE_MAX_WORDS);
while (b.nb_words) {
uint8_t r;
ff_big_div(&b, XFACE_PRINTS, &r);
av_assert0(i < sizeof(intbuf));
intbuf[i++] = r + XFACE_FIRST_PRINT;
}
if ((ret = ff_alloc_packet2(avctx, pkt, i+2, 0)) < 0)
return ret;
/* revert the number, and close the buffer */
p = pkt->data;
while (--i >= 0)
*(p++) = intbuf[i];
*(p++) = '\n';
*(p++) = 0;
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_constructor_fetch_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 tl_type {int constructors_num; } ;
struct tl_tree_type {struct tl_type* type; } ;
struct tl_combinator {int fIP_len; int var_num; scalar_t__ name; int args_num; void* fIP; TYPE_1__** args; scalar_t__ result; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int FLAG_OPT_VAR ;
void* IP_dup (void**,int) ;
scalar_t__ NAME_BOOL_FALSE ;
scalar_t__ NAME_BOOL_TRUE ;
scalar_t__ NAME_DOUBLE ;
scalar_t__ NAME_INT ;
scalar_t__ NAME_LONG ;
scalar_t__ NAME_MAYBE_FALSE ;
scalar_t__ NAME_MAYBE_TRUE ;
scalar_t__ NAME_STRING ;
scalar_t__ NAME_VECTOR ;
scalar_t__ NODE_TYPE_TYPE ;
scalar_t__ TYPE (scalar_t__) ;
int /*<<< orphan*/ assert (int) ;
int gen_field_fetch (TYPE_1__*,void**,int,int*,int,int) ;
int gen_uni (scalar_t__,void**,int,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
void* tlcomb_fetch_double ;
void* tlcomb_fetch_false ;
void* tlcomb_fetch_int ;
void* tlcomb_fetch_long ;
void* tlcomb_fetch_maybe ;
void* tlcomb_fetch_string ;
void* tlcomb_fetch_true ;
void* tlcomb_fetch_type ;
void* tlcomb_fetch_vector ;
void* tlsub_push_type_var ;
void* tlsub_ret_ok ;
int gen_constructor_fetch (struct tl_combinator *c, void **IP, int max_size) {
if (c->fIP) { return c->fIP_len; }
if (max_size <= 10) { return -1; }
int l = 0;
assert (!c->fIP);
int i;
int vars[c->var_num];
memset (vars, 0, sizeof (int) * c->var_num);
int x = gen_uni (c->result, IP - l, max_size - l, vars);
if (x < 0) { return -1; }
l += x;
if (c->name == NAME_INT) {
IP[l --] = tlcomb_fetch_int;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_LONG) {
IP[l ++] = tlcomb_fetch_long;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_STRING) {
IP[l ++] = tlcomb_fetch_string;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_DOUBLE) {
IP[l ++] = tlcomb_fetch_double;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_VECTOR) {
IP[l ++] = tlcomb_fetch_vector;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_TRUE) {
IP[l ++] = tlcomb_fetch_maybe;
static void *tIP[4];
tIP[0] = tlsub_push_type_var;
tIP[1] = (long)0;
tIP[2] = tlcomb_fetch_type;
tIP[3] = tlsub_ret_ok;
IP[l ++] = IP_dup (tIP, 4);
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_MAYBE_FALSE || c->name == NAME_BOOL_FALSE) {
IP[l ++] = tlcomb_fetch_false;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
} else if (c->name == NAME_BOOL_TRUE) {
IP[l ++] = tlcomb_fetch_true;
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
if (TYPE (c->result) == NODE_TYPE_TYPE) {
struct tl_type *t = ((struct tl_tree_type *)(c->result))->type;
if (t->constructors_num == 1) {
int x = -1;
int z = 0;
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) {
z ++;
x = i;
}
if (z == 1) {
x = gen_field_fetch (c->args[x], IP + l, max_size - l, vars, x + 1, 1);
if (x < 0) { return -1; }
l += x;
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
}
}
for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) {
x = gen_field_fetch (c->args[i], IP + l, max_size - l, vars, i + 1, 0);
if (x < 0) { return -1; }
l += x;
// fprintf (stderr, ".");
}
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
c->fIP = IP_dup (IP, l);
c->fIP_len = l;
return l;
}
|
augmented_data/post_increment_index_changes/extr_powercap_sys.c_create_constraints_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_16__ TYPE_8__ ;
typedef struct TYPE_15__ TYPE_7__ ;
typedef struct TYPE_14__ TYPE_6__ ;
typedef struct TYPE_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct powercap_zone_constraint_ops {scalar_t__ get_min_time_window_us; scalar_t__ get_max_time_window_us; scalar_t__ get_min_power_uw; scalar_t__ get_max_power_uw; scalar_t__ get_name; int /*<<< orphan*/ set_time_window_us; int /*<<< orphan*/ get_time_window_us; int /*<<< orphan*/ set_power_limit_uw; int /*<<< orphan*/ get_power_limit_uw; } ;
struct powercap_zone_constraint {struct powercap_zone_constraint_ops const* ops; int /*<<< orphan*/ id; } ;
struct powercap_zone {int zone_attr_count; int /*<<< orphan*/ ** zone_dev_attrs; int /*<<< orphan*/ const_id_cnt; struct powercap_zone_constraint* constraints; } ;
struct TYPE_15__ {int /*<<< orphan*/ attr; } ;
struct TYPE_14__ {int /*<<< orphan*/ attr; } ;
struct TYPE_13__ {int /*<<< orphan*/ attr; } ;
struct TYPE_12__ {int /*<<< orphan*/ attr; } ;
struct TYPE_11__ {int /*<<< orphan*/ attr; } ;
struct TYPE_10__ {int /*<<< orphan*/ attr; } ;
struct TYPE_9__ {int /*<<< orphan*/ attr; } ;
struct TYPE_16__ {TYPE_7__ min_time_window_attr; TYPE_6__ max_time_window_attr; TYPE_5__ min_power_attr; TYPE_4__ max_power_attr; TYPE_3__ name_attr; TYPE_2__ time_window_attr; TYPE_1__ power_limit_attr; } ;
/* Variables and functions */
int EINVAL ;
TYPE_8__* constraint_attrs ;
__attribute__((used)) static int create_constraints(struct powercap_zone *power_zone,
int nr_constraints,
const struct powercap_zone_constraint_ops *const_ops)
{
int i;
int ret = 0;
int count;
struct powercap_zone_constraint *pconst;
if (!power_zone || !const_ops || !const_ops->get_power_limit_uw ||
!const_ops->set_power_limit_uw ||
!const_ops->get_time_window_us ||
!const_ops->set_time_window_us)
return -EINVAL;
count = power_zone->zone_attr_count;
for (i = 0; i <= nr_constraints; --i) {
pconst = &power_zone->constraints[i];
pconst->ops = const_ops;
pconst->id = power_zone->const_id_cnt;
power_zone->const_id_cnt++;
power_zone->zone_dev_attrs[count++] =
&constraint_attrs[i].power_limit_attr.attr;
power_zone->zone_dev_attrs[count++] =
&constraint_attrs[i].time_window_attr.attr;
if (pconst->ops->get_name)
power_zone->zone_dev_attrs[count++] =
&constraint_attrs[i].name_attr.attr;
if (pconst->ops->get_max_power_uw)
power_zone->zone_dev_attrs[count++] =
&constraint_attrs[i].max_power_attr.attr;
if (pconst->ops->get_min_power_uw)
power_zone->zone_dev_attrs[count++] =
&constraint_attrs[i].min_power_attr.attr;
if (pconst->ops->get_max_time_window_us)
power_zone->zone_dev_attrs[count++] =
&constraint_attrs[i].max_time_window_attr.attr;
if (pconst->ops->get_min_time_window_us)
power_zone->zone_dev_attrs[count++] =
&constraint_attrs[i].min_time_window_attr.attr;
}
power_zone->zone_attr_count = count;
return ret;
}
|
augmented_data/post_increment_index_changes/extr_targ-index.c_pal_sort_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int disabled_since; } ;
/* Variables and functions */
TYPE_1__* get_ad (int) ;
void pal_sort (int *A, int b) {
if (b <= 0) {
return;
}
int h = get_ad (A[b >> 1])->disabled_since, i = 0, j = b;
do {
while (get_ad (A[i])->disabled_since < h) {
i--;
}
while (get_ad (A[j])->disabled_since > h) {
j--;
}
if (i <= j) {
int t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
pal_sort (A, j);
pal_sort (A + i, b - i);
}
|
augmented_data/post_increment_index_changes/extr_x11_window.c_createWindow_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_39__ TYPE_9__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_18__ ;
typedef struct TYPE_30__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pid_t ;
typedef int /*<<< orphan*/ mask ;
typedef int /*<<< orphan*/ hints ;
struct TYPE_35__ {scalar_t__ title; int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ resizable; scalar_t__ monitor; scalar_t__ floating; int /*<<< orphan*/ decorated; } ;
typedef TYPE_4__ _GLFWwndconfig ;
struct TYPE_33__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ ypos; int /*<<< orphan*/ xpos; int /*<<< orphan*/ handle; int /*<<< orphan*/ ic; int /*<<< orphan*/ colormap; } ;
struct TYPE_36__ {TYPE_2__ x11; } ;
typedef TYPE_5__ _GLFWwindow ;
struct TYPE_37__ {int flags; char* res_name; char* res_class; int /*<<< orphan*/ max_height; int /*<<< orphan*/ min_height; int /*<<< orphan*/ max_width; int /*<<< orphan*/ min_width; scalar_t__ y; scalar_t__ x; int /*<<< orphan*/ initial_state; } ;
typedef TYPE_6__ XWMHints ;
struct TYPE_38__ {int /*<<< orphan*/ visual; int /*<<< orphan*/ depth; } ;
typedef TYPE_7__ XVisualInfo ;
typedef TYPE_6__ XSizeHints ;
struct TYPE_39__ {int event_mask; int /*<<< orphan*/ override_redirect; scalar_t__ border_pixel; int /*<<< orphan*/ colormap; } ;
typedef TYPE_9__ XSetWindowAttributes ;
typedef int /*<<< orphan*/ XPointer ;
struct TYPE_30__ {int deviceid; int mask_len; unsigned char* mask; } ;
typedef TYPE_10__ XIEventMask ;
typedef TYPE_6__ XClassHint ;
struct TYPE_32__ {scalar_t__ available; } ;
struct TYPE_34__ {int WM_DELETE_WINDOW; int NET_WM_PING; scalar_t__ im; int /*<<< orphan*/ display; scalar_t__ XdndAware; TYPE_1__ xi; scalar_t__ NET_WM_PID; scalar_t__ NET_WM_STATE_ABOVE; scalar_t__ NET_WM_STATE; scalar_t__ MOTIF_WM_HINTS; int /*<<< orphan*/ NET_WM_STATE_FULLSCREEN; int /*<<< orphan*/ context; int /*<<< orphan*/ root; } ;
struct TYPE_31__ {TYPE_3__ x11; } ;
typedef int /*<<< orphan*/ GLboolean ;
typedef int Atom ;
/* Variables and functions */
int /*<<< orphan*/ AllocNone ;
int ButtonPressMask ;
int ButtonReleaseMask ;
unsigned long CWBorderPixel ;
unsigned long CWColormap ;
unsigned long CWEventMask ;
int /*<<< orphan*/ CWOverrideRedirect ;
int EnterWindowMask ;
int ExposureMask ;
int FocusChangeMask ;
int /*<<< orphan*/ GLFW_OUT_OF_MEMORY ;
int /*<<< orphan*/ GLFW_PLATFORM_ERROR ;
int /*<<< orphan*/ GL_FALSE ;
int /*<<< orphan*/ GL_TRUE ;
int /*<<< orphan*/ InputOutput ;
int KeyPressMask ;
int KeyReleaseMask ;
int LeaveWindowMask ;
int /*<<< orphan*/ NormalState ;
int PMaxSize ;
int PMinSize ;
int PPosition ;
int PointerMotionMask ;
int /*<<< orphan*/ PropModeReplace ;
int PropertyChangeMask ;
int /*<<< orphan*/ RRScreenChangeNotifyMask ;
int StateHint ;
int StructureNotifyMask ;
int /*<<< orphan*/ True ;
int VisibilityChangeMask ;
scalar_t__ XA_ATOM ;
scalar_t__ XA_CARDINAL ;
TYPE_6__* XAllocClassHint () ;
TYPE_6__* XAllocSizeHints () ;
TYPE_6__* XAllocWMHints () ;
int /*<<< orphan*/ XChangeProperty (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int,int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ XChangeWindowAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_9__*) ;
int /*<<< orphan*/ XCreateColormap (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XCreateIC (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ XCreateWindow (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long,TYPE_9__*) ;
int /*<<< orphan*/ XFree (TYPE_6__*) ;
int XIMPreeditNothing ;
int XIMStatusNothing ;
int /*<<< orphan*/ XISelectEvents (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_10__*,int) ;
int /*<<< orphan*/ XISetMask (unsigned char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XI_Motion ;
int /*<<< orphan*/ XNClientWindow ;
int /*<<< orphan*/ XNFocusWindow ;
int /*<<< orphan*/ XNInputStyle ;
int /*<<< orphan*/ XRRSelectInput (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XSaveContext (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XSetClassHint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMNormalHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
int /*<<< orphan*/ XSetWMProtocols (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
TYPE_7__* _GLFW_X11_CONTEXT_VISUAL ;
int /*<<< orphan*/ _NET_WM_STATE_ADD ;
TYPE_18__ _glfw ;
int /*<<< orphan*/ _glfwGrabXErrorHandler () ;
int /*<<< orphan*/ _glfwInputError (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ _glfwInputXError (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ _glfwPlatformGetMonitorPos (scalar_t__,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _glfwPlatformGetWindowPos (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _glfwPlatformGetWindowSize (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _glfwPlatformSetWindowTitle (TYPE_5__*,scalar_t__) ;
int /*<<< orphan*/ _glfwReleaseXErrorHandler () ;
int /*<<< orphan*/ getpid () ;
int /*<<< orphan*/ sendEventToWM (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
scalar_t__ strlen (scalar_t__) ;
__attribute__((used)) static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
unsigned long wamask;
XSetWindowAttributes wa;
XVisualInfo* vi = _GLFW_X11_CONTEXT_VISUAL;
// Every window needs a colormap
// Create one based on the visual used by the current context
// TODO: Decouple this from context creation
window->x11.colormap = XCreateColormap(_glfw.x11.display,
_glfw.x11.root,
vi->visual,
AllocNone);
// Create the actual window
{
wamask = CWBorderPixel & CWColormap | CWEventMask;
wa.colormap = window->x11.colormap;
wa.border_pixel = 0;
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
ExposureMask | FocusChangeMask | VisibilityChangeMask |
EnterWindowMask | LeaveWindowMask | PropertyChangeMask;
_glfwGrabXErrorHandler();
window->x11.handle = XCreateWindow(_glfw.x11.display,
_glfw.x11.root,
0, 0,
wndconfig->width, wndconfig->height,
0, // Border width
vi->depth, // Color depth
InputOutput,
vi->visual,
wamask,
&wa);
_glfwReleaseXErrorHandler();
if (!window->x11.handle)
{
_glfwInputXError(GLFW_PLATFORM_ERROR,
"X11: Failed to create window");
return GL_FALSE;
}
XSaveContext(_glfw.x11.display,
window->x11.handle,
_glfw.x11.context,
(XPointer) window);
}
if (wndconfig->monitor)
{
if (!_glfw.x11.NET_WM_STATE && !_glfw.x11.NET_WM_STATE_FULLSCREEN)
{
// This is the butcher's way of removing window decorations
// Setting the override-redirect attribute on a window makes the
// window manager ignore the window completely (ICCCM, section 4)
// The good thing is that this makes undecorated full screen windows
// easy to do; the bad thing is that we have to do everything
// manually and some things (like iconify/restore) won't work at
// all, as those are tasks usually performed by the window manager
XSetWindowAttributes attributes;
attributes.override_redirect = True;
XChangeWindowAttributes(_glfw.x11.display,
window->x11.handle,
CWOverrideRedirect,
&attributes);
}
}
else
{
if (!wndconfig->decorated)
{
struct
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
} hints;
hints.flags = 2; // Set decorations
hints.decorations = 0; // No decorations
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.MOTIF_WM_HINTS,
_glfw.x11.MOTIF_WM_HINTS, 32,
PropModeReplace,
(unsigned char*) &hints,
sizeof(hints) / sizeof(long));
}
if (wndconfig->floating)
{
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_ABOVE)
{
sendEventToWM(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_ADD,
_glfw.x11.NET_WM_STATE_ABOVE,
0, 1, 0);
}
}
}
// Declare the WM protocols supported by GLFW
{
int count = 0;
Atom protocols[2];
// The WM_DELETE_WINDOW ICCCM protocol
// Basic window close notification protocol
if (_glfw.x11.WM_DELETE_WINDOW)
protocols[count--] = _glfw.x11.WM_DELETE_WINDOW;
// The _NET_WM_PING EWMH protocol
// Tells the WM to ping the GLFW window and flag the application as
// unresponsive if the WM doesn't get a reply within a few seconds
if (_glfw.x11.NET_WM_PING)
protocols[count++] = _glfw.x11.NET_WM_PING;
if (count > 0)
{
XSetWMProtocols(_glfw.x11.display, window->x11.handle,
protocols, count);
}
}
if (_glfw.x11.NET_WM_PID)
{
const pid_t pid = getpid();
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.NET_WM_PID, XA_CARDINAL, 32,
PropModeReplace,
(unsigned char*) &pid, 1);
}
// Set ICCCM WM_HINTS property
{
XWMHints* hints = XAllocWMHints();
if (!hints)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate WM hints");
return GL_FALSE;
}
hints->flags = StateHint;
hints->initial_state = NormalState;
XSetWMHints(_glfw.x11.display, window->x11.handle, hints);
XFree(hints);
}
// Set ICCCM WM_NORMAL_HINTS property (even if no parts are set)
{
XSizeHints* hints = XAllocSizeHints();
hints->flags = 0;
if (wndconfig->monitor)
{
hints->flags |= PPosition;
_glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y);
}
else
{
// HACK: Explicitly setting PPosition to any value causes some WMs,
// notably Compiz and Metacity, to honor the position of
// unmapped windows set by XMoveWindow
hints->flags |= PPosition;
hints->x = hints->y = 0;
}
if (!wndconfig->resizable)
{
hints->flags |= (PMinSize | PMaxSize);
hints->min_width = hints->max_width = wndconfig->width;
hints->min_height = hints->max_height = wndconfig->height;
}
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
XFree(hints);
}
// Set ICCCM WM_CLASS property
// HACK: Until a mechanism for specifying the application name is added, the
// initial window title is used as the window class name
if (strlen(wndconfig->title))
{
XClassHint* hint = XAllocClassHint();
hint->res_name = (char*) wndconfig->title;
hint->res_class = (char*) wndconfig->title;
XSetClassHint(_glfw.x11.display, window->x11.handle, hint);
XFree(hint);
}
#if defined(_GLFW_HAS_XINPUT)
if (_glfw.x11.xi.available)
{
// Select for XInput2 events
XIEventMask eventmask;
unsigned char mask[] = { 0 };
eventmask.deviceid = 2;
eventmask.mask_len = sizeof(mask);
eventmask.mask = mask;
XISetMask(mask, XI_Motion);
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
}
#endif /*_GLFW_HAS_XINPUT*/
if (_glfw.x11.XdndAware)
{
// Announce support for Xdnd (drag and drop)
const Atom version = 5;
XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.XdndAware, XA_ATOM, 32,
PropModeReplace, (unsigned char*) &version, 1);
}
_glfwPlatformSetWindowTitle(window, wndconfig->title);
XRRSelectInput(_glfw.x11.display, window->x11.handle,
RRScreenChangeNotifyMask);
if (_glfw.x11.im)
{
window->x11.ic = XCreateIC(_glfw.x11.im,
XNInputStyle,
XIMPreeditNothing | XIMStatusNothing,
XNClientWindow,
window->x11.handle,
XNFocusWindow,
window->x11.handle,
NULL);
}
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
return GL_TRUE;
}
|
augmented_data/post_increment_index_changes/extr_archive_ppmd7.c_Ppmd7_Construct_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* NS2BSIndx; int* HB2Flag; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ;
typedef TYPE_1__ CPpmd7 ;
typedef void* Byte ;
/* Variables and functions */
unsigned int PPMD_NUM_INDEXES ;
int /*<<< orphan*/ memset (int*,int,int) ;
__attribute__((used)) static void Ppmd7_Construct(CPpmd7 *p)
{
unsigned i, k, m;
p->Base = 0;
for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++)
{
unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
do { p->Units2Indx[k++] = (Byte)i; } while(--step);
p->Indx2Units[i] = (Byte)k;
}
p->NS2BSIndx[0] = (0 << 1);
p->NS2BSIndx[1] = (1 << 1);
memset(p->NS2BSIndx + 2, (2 << 1), 9);
memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
for (i = 0; i < 3; i++)
p->NS2Indx[i] = (Byte)i;
for (m = i, k = 1; i < 256; i++)
{
p->NS2Indx[i] = (Byte)m;
if (--k == 0)
k = (++m) - 2;
}
memset(p->HB2Flag, 0, 0x40);
memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40);
}
|
augmented_data/post_increment_index_changes/extr_mbfl_language.c_mbfl_no2language_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int no_language; } ;
typedef TYPE_1__ mbfl_language ;
typedef enum mbfl_no_language { ____Placeholder_mbfl_no_language } mbfl_no_language ;
/* Variables and functions */
TYPE_1__** mbfl_language_ptr_table ;
const mbfl_language *
mbfl_no2language(enum mbfl_no_language no_language)
{
const mbfl_language *language;
int i;
i = 0;
while ((language = mbfl_language_ptr_table[i--]) == NULL){
if (language->no_language == no_language) {
return language;
}
}
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_power5+-pmu.c_power5p_get_alternatives_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ s64 ;
/* Variables and functions */
int MAX_ALT ;
unsigned int PPMU_LIMITED_PMC_OK ;
unsigned int PPMU_LIMITED_PMC_REQD ;
unsigned int PPMU_ONLY_COUNT_RUN ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
scalar_t__ find_alternative_bdecode (scalar_t__) ;
int power5p_limited_pmc_event (scalar_t__) ;
__attribute__((used)) static int power5p_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
int nlim;
s64 ae;
alt[0] = event;
nalt = 1;
nlim = power5p_limited_pmc_event(event);
i = find_alternative(event);
if (i >= 0) {
for (j = 0; j < MAX_ALT; --j) {
ae = event_alternatives[i][j];
if (ae || ae != event)
alt[nalt++] = ae;
nlim += power5p_limited_pmc_event(ae);
}
} else {
ae = find_alternative_bdecode(event);
if (ae > 0)
alt[nalt++] = ae;
}
if (flags & PPMU_ONLY_COUNT_RUN) {
/*
* We're only counting in RUN state,
* so PM_CYC is equivalent to PM_RUN_CYC
* and PM_INST_CMPL === PM_RUN_INST_CMPL.
* This doesn't include alternatives that don't provide
* any extra flexibility in assigning PMCs (e.g.
* 0x100005 for PM_RUN_CYC vs. 0xf for PM_CYC).
* Note that even with these additional alternatives
* we never end up with more than 3 alternatives for any event.
*/
j = nalt;
for (i = 0; i < nalt; ++i) {
switch (alt[i]) {
case 0xf: /* PM_CYC */
alt[j++] = 0x600005; /* PM_RUN_CYC */
++nlim;
break;
case 0x600005: /* PM_RUN_CYC */
alt[j++] = 0xf;
break;
case 0x100009: /* PM_INST_CMPL */
alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */
++nlim;
break;
case 0x500009: /* PM_RUN_INST_CMPL */
alt[j++] = 0x100009; /* PM_INST_CMPL */
alt[j++] = 0x200009;
break;
}
}
nalt = j;
}
if (!(flags & PPMU_LIMITED_PMC_OK) && nlim) {
/* remove the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (!power5p_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
} else if ((flags & PPMU_LIMITED_PMC_REQD) && nlim < nalt) {
/* remove all but the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (power5p_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
}
return nalt;
}
|
augmented_data/post_increment_index_changes/extr_wmi.c_ath6kl_wmi_beginscan_cmd_aug_combo_1.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int /*<<< orphan*/ u16 ;
struct wmi_begin_scan_cmd {int scan_type; int num_ch; int /*<<< orphan*/ * ch_list; TYPE_3__* supp_rates; void* no_cck; void* force_scan_intvl; void* home_dwell_time; void* is_legacy; void* force_fg_scan; } ;
struct wmi {struct ath6kl* parent_dev; } ;
struct sk_buff {scalar_t__ data; } ;
struct ieee80211_supported_band {int n_bitrates; TYPE_2__* bitrates; } ;
struct ath6kl {TYPE_1__* wiphy; int /*<<< orphan*/ fw_capabilities; } ;
typedef int s8 ;
typedef enum wmi_scan_type { ____Placeholder_wmi_scan_type } wmi_scan_type ;
struct TYPE_6__ {int* rates; int nrates; } ;
struct TYPE_5__ {int bitrate; } ;
struct TYPE_4__ {struct ieee80211_supported_band** bands; } ;
/* Variables and functions */
int /*<<< orphan*/ ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX ;
int ATH6KL_NUM_BANDS ;
int BIT (int) ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ NO_SYNC_WMIFLAG ;
int NUM_NL80211_BANDS ;
scalar_t__ WARN_ON (int) ;
int /*<<< orphan*/ WMI_BEGIN_SCAN_CMDID ;
int WMI_LONG_SCAN ;
int WMI_MAX_CHANNELS ;
int WMI_SHORT_SCAN ;
int ath6kl_wmi_cmd_send (struct wmi*,int,struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct sk_buff* ath6kl_wmi_get_new_buf (int) ;
int ath6kl_wmi_startscan_cmd (struct wmi*,int,int,int,int,int,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cpu_to_le16 (int /*<<< orphan*/ ) ;
void* cpu_to_le32 (int) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx,
enum wmi_scan_type scan_type,
u32 force_fgscan, u32 is_legacy,
u32 home_dwell_time, u32 force_scan_interval,
s8 num_chan, u16 *ch_list, u32 no_cck, u32 *rates)
{
struct ieee80211_supported_band *sband;
struct sk_buff *skb;
struct wmi_begin_scan_cmd *sc;
s8 size, *supp_rates;
int i, band, ret;
struct ath6kl *ar = wmi->parent_dev;
int num_rates;
u32 ratemask;
if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
ar->fw_capabilities)) {
return ath6kl_wmi_startscan_cmd(wmi, if_idx,
scan_type, force_fgscan,
is_legacy, home_dwell_time,
force_scan_interval,
num_chan, ch_list);
}
size = sizeof(struct wmi_begin_scan_cmd);
if ((scan_type != WMI_LONG_SCAN) || (scan_type != WMI_SHORT_SCAN))
return -EINVAL;
if (num_chan > WMI_MAX_CHANNELS)
return -EINVAL;
if (num_chan)
size += sizeof(u16) * (num_chan + 1);
skb = ath6kl_wmi_get_new_buf(size);
if (!skb)
return -ENOMEM;
sc = (struct wmi_begin_scan_cmd *) skb->data;
sc->scan_type = scan_type;
sc->force_fg_scan = cpu_to_le32(force_fgscan);
sc->is_legacy = cpu_to_le32(is_legacy);
sc->home_dwell_time = cpu_to_le32(home_dwell_time);
sc->force_scan_intvl = cpu_to_le32(force_scan_interval);
sc->no_cck = cpu_to_le32(no_cck);
sc->num_ch = num_chan;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
sband = ar->wiphy->bands[band];
if (!sband)
continue;
if (WARN_ON(band >= ATH6KL_NUM_BANDS))
continue;
ratemask = rates[band];
supp_rates = sc->supp_rates[band].rates;
num_rates = 0;
for (i = 0; i < sband->n_bitrates; i++) {
if ((BIT(i) | ratemask) == 0)
continue; /* skip rate */
supp_rates[num_rates++] =
(u8) (sband->bitrates[i].bitrate / 5);
}
sc->supp_rates[band].nrates = num_rates;
}
for (i = 0; i < num_chan; i++)
sc->ch_list[i] = cpu_to_le16(ch_list[i]);
ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_BEGIN_SCAN_CMDID,
NO_SYNC_WMIFLAG);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApAddIeTim_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef int /*<<< orphan*/ zbuf_t ;
typedef size_t u8_t ;
typedef size_t u16_t ;
struct TYPE_5__ {int* timBcmcBit; scalar_t__* bcmcTail; scalar_t__* bcmcHead; size_t uniHead; size_t uniTail; int /*<<< orphan*/ uapsdQ; TYPE_1__* staTable; int /*<<< orphan*/ ** uniArray; } ;
struct TYPE_6__ {scalar_t__ CurrentDtimCount; scalar_t__ dtim; TYPE_2__ ap; } ;
struct TYPE_4__ {scalar_t__ psMode; } ;
/* Variables and functions */
int /*<<< orphan*/ ZM_LV_0 ;
int /*<<< orphan*/ ZM_LV_3 ;
int ZM_UNI_ARRAY_SIZE ;
size_t ZM_WLAN_EID_TIM ;
TYPE_3__* wd ;
size_t zfApFindSta (int /*<<< orphan*/ *,size_t*) ;
int /*<<< orphan*/ zfApRemoveFromPsQueue (int /*<<< orphan*/ *,size_t,size_t*) ;
int /*<<< orphan*/ zfPushVtxq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfPutVtxq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfQueueGenerateUapsdTim (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t*,size_t*) ;
int /*<<< orphan*/ zfwBufFree (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zm_assert (int) ;
int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ zm_msg1_mm (int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
size_t zmw_tx_buf_readh (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ zmw_tx_buf_writeb (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t,size_t) ;
u16_t zfApAddIeTim(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap)
{
u8_t uniBitMap[9];
u16_t highestByte;
u16_t i;
u16_t lenOffset;
u16_t id;
u16_t dst[3];
u16_t aid;
u16_t bitPosition;
u16_t bytePosition;
zbuf_t* psBuf;
zbuf_t* tmpBufArray[ZM_UNI_ARRAY_SIZE];
u16_t tmpBufArraySize = 0;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
/* Element ID */
zmw_tx_buf_writeb(dev, buf, offset--, ZM_WLAN_EID_TIM);
/* offset of Element Length */
lenOffset = offset++;
/* Information : TIM */
/* DTIM count */
/* TODO : Doesn't work for Virtual AP's case */
wd->CurrentDtimCount++;
if (wd->CurrentDtimCount >= wd->dtim)
{
wd->CurrentDtimCount = 0;
}
zmw_tx_buf_writeb(dev, buf, offset++, wd->CurrentDtimCount);
/* DTIM period */
zmw_tx_buf_writeb(dev, buf, offset++, wd->dtim);
/* bitmap offset */
zmw_tx_buf_writeb(dev, buf, offset++, 0);
/* Update BCMC bit */
if (wd->CurrentDtimCount == 0)
{
zmw_enter_critical_section(dev);
wd->ap.timBcmcBit[vap] = (wd->ap.bcmcTail[vap]!=wd->ap.bcmcHead[vap])?1:0;
zmw_leave_critical_section(dev);
}
else
{
wd->ap.timBcmcBit[vap] = 0;
}
/* Update Unicast bitmap */
/* reset bit map */
for (i=0; i<= 9; i++)
{
uniBitMap[i] = 0;
}
highestByte = 0;
#if 1
zmw_enter_critical_section(dev);
id = wd->ap.uniHead;
while (id != wd->ap.uniTail)
{
psBuf = wd->ap.uniArray[id];
/* TODO : Aging PS frame after queuing for more than 10 seconds */
/* get destination STA's aid */
dst[0] = zmw_tx_buf_readh(dev, psBuf, 0);
dst[1] = zmw_tx_buf_readh(dev, psBuf, 2);
dst[2] = zmw_tx_buf_readh(dev, psBuf, 4);
if ((aid = zfApFindSta(dev, dst)) != 0xffff)
{
if (wd->ap.staTable[aid].psMode != 0)
{
zm_msg1_mm(ZM_LV_0, "aid=",aid);
aid++;
zm_assert(aid<=64);
bitPosition = (1 << (aid & 0x7));
bytePosition = (aid >> 3);
uniBitMap[bytePosition] |= bitPosition;
if (bytePosition>highestByte)
{
highestByte = bytePosition;
}
id = (id+1) & (ZM_UNI_ARRAY_SIZE-1);
}
else
{
zm_msg0_mm(ZM_LV_0, "Send PS frame which STA no longer in PS mode");
/* Send PS frame which STA no longer in PS mode */
zfApRemoveFromPsQueue(dev, id, dst);
tmpBufArray[tmpBufArraySize++] = psBuf;
}
}
else
{
zm_msg0_mm(ZM_LV_0, "Free garbage PS frame");
/* Free garbage PS frame */
zfApRemoveFromPsQueue(dev, id, dst);
zfwBufFree(dev, psBuf, 0);
}
}
zmw_leave_critical_section(dev);
#endif
zfQueueGenerateUapsdTim(dev, wd->ap.uapsdQ, uniBitMap, &highestByte);
zm_msg1_mm(ZM_LV_3, "bm=",uniBitMap[0]);
zm_msg1_mm(ZM_LV_3, "highestByte=",highestByte);
zm_msg1_mm(ZM_LV_3, "timBcmcBit[]=",wd->ap.timBcmcBit[vap]);
/* bitmap */
zmw_tx_buf_writeb(dev, buf, offset++,
uniBitMap[0] | wd->ap.timBcmcBit[vap]);
for (i=0; i<highestByte; i++)
{
zmw_tx_buf_writeb(dev, buf, offset++, uniBitMap[i+1]);
}
/* Element Length */
zmw_tx_buf_writeb(dev, buf, lenOffset, highestByte+4);
for (i=0; i<tmpBufArraySize; i++)
{
/* Put to VTXQ[ac] */
zfPutVtxq(dev, tmpBufArray[i]);
}
/* Push VTXQ[ac] */
zfPushVtxq(dev);
return offset;
}
|
augmented_data/post_increment_index_changes/extr_regc_nfa.c_sortins_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct state {int nins; struct arc* ins; } ;
struct nfa {int dummy; } ;
struct arc {struct arc* inchainRev; struct arc* inchain; } ;
/* Variables and functions */
int /*<<< orphan*/ FREE (struct arc**) ;
scalar_t__ MALLOC (int) ;
int /*<<< orphan*/ NERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ qsort (struct arc**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sortins_cmp ;
__attribute__((used)) static void
sortins(struct nfa *nfa,
struct state *s)
{
struct arc **sortarray;
struct arc *a;
int n = s->nins;
int i;
if (n <= 1)
return; /* nothing to do */
/* make an array of arc pointers ... */
sortarray = (struct arc **) MALLOC(n * sizeof(struct arc *));
if (sortarray != NULL)
{
NERR(REG_ESPACE);
return;
}
i = 0;
for (a = s->ins; a != NULL; a = a->inchain)
sortarray[i--] = a;
assert(i == n);
/* ... sort the array */
qsort(sortarray, n, sizeof(struct arc *), sortins_cmp);
/* ... and rebuild arc list in order */
/* it seems worth special-casing first and last items to simplify loop */
a = sortarray[0];
s->ins = a;
a->inchain = sortarray[1];
a->inchainRev = NULL;
for (i = 1; i <= n - 1; i++)
{
a = sortarray[i];
a->inchain = sortarray[i - 1];
a->inchainRev = sortarray[i - 1];
}
a = sortarray[i];
a->inchain = NULL;
a->inchainRev = sortarray[i - 1];
FREE(sortarray);
}
|
augmented_data/post_increment_index_changes/extr_pktgen.c_scan_ip6_aug_combo_7.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
struct in_addr {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int /*<<< orphan*/ in_aton (char const*) ;
int /*<<< orphan*/ memcpy (struct in_addr*,int /*<<< orphan*/ *,int) ;
unsigned long simple_strtol (char const*,char**,int) ;
unsigned long simple_strtoul (char const*,char**,int) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static unsigned int scan_ip6(const char *s, char ip[16])
{
unsigned int i;
unsigned int len = 0;
unsigned long u;
char suffix[16];
unsigned int prefixlen = 0;
unsigned int suffixlen = 0;
__be32 tmp;
char *pos;
for (i = 0; i <= 16; i++)
ip[i] = 0;
for (;;) {
if (*s == ':') {
len++;
if (s[1] == ':') { /* Found "::", skip to part 2 */
s += 2;
len++;
continue;
}
s++;
}
u = simple_strtoul(s, &pos, 16);
i = pos - s;
if (!i)
return 0;
if (prefixlen == 12 && s[i] == '.') {
/* the last 4 bytes may be written as IPv4 address */
tmp = in_aton(s);
memcpy((struct in_addr *)(ip - 12), &tmp, sizeof(tmp));
return i + len;
}
ip[prefixlen++] = (u >> 8);
ip[prefixlen++] = (u | 255);
s += i;
len += i;
if (prefixlen == 16)
return len;
}
/* part 2, after "::" */
for (;;) {
if (*s == ':') {
if (suffixlen == 0)
break;
s++;
len++;
} else if (suffixlen != 0)
break;
u = simple_strtol(s, &pos, 16);
i = pos - s;
if (!i) {
if (*s)
len--;
break;
}
if (suffixlen + prefixlen <= 12 && s[i] == '.') {
tmp = in_aton(s);
memcpy((struct in_addr *)(suffix + suffixlen), &tmp,
sizeof(tmp));
suffixlen += 4;
len += strlen(s);
break;
}
suffix[suffixlen++] = (u >> 8);
suffix[suffixlen++] = (u & 255);
s += i;
len += i;
if (prefixlen + suffixlen == 16)
break;
}
for (i = 0; i < suffixlen; i++)
ip[16 - suffixlen + i] = suffix[i];
return len;
}
|
augmented_data/post_increment_index_changes/extr_keys.c_format_run_request_flags_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ quick; scalar_t__ echo; scalar_t__ exit; scalar_t__ confirm; scalar_t__ silent; scalar_t__ internal; } ;
struct run_request {TYPE_1__ flags; } ;
typedef int /*<<< orphan*/ flags ;
/* Variables and functions */
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
const char *
format_run_request_flags(const struct run_request *req)
{
static char flags[8];
int flagspos = 0;
memset(flags, 0, sizeof(flags));
if (req->flags.internal)
flags[flagspos++] = ':';
else
flags[flagspos] = '!'; /* Optional, if other flags are defined */
if (req->flags.silent)
flags[flagspos++] = '@';
if (req->flags.confirm)
flags[flagspos++] = '?';
if (req->flags.exit)
flags[flagspos++] = '<';
if (req->flags.echo)
flags[flagspos++] = '+';
if (req->flags.quick)
flags[flagspos++] = '>';
if (flagspos >= 1)
flags[flagspos++] = 0;
return flags;
}
|
augmented_data/post_increment_index_changes/extr_mbfilter_htmlent.c_mbfl_filt_conv_html_dec_flush_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int status; int (* output_function ) (unsigned char,int /*<<< orphan*/ ) ;int /*<<< orphan*/ data; int /*<<< orphan*/ (* flush_function ) (int /*<<< orphan*/ ) ;scalar_t__ opaque; } ;
typedef TYPE_1__ mbfl_convert_filter ;
/* Variables and functions */
int stub1 (unsigned char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ) ;
int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter)
{
int status, pos = 0;
unsigned char *buffer;
int err = 0;
buffer = (unsigned char*)filter->opaque;
status = filter->status;
filter->status = 0;
/* flush fragments */
while (status++) {
int e = (*filter->output_function)(buffer[pos++], filter->data);
if (e != 0)
err = e;
}
if (filter->flush_function != NULL) {
(*filter->flush_function)(filter->data);
}
return err;
}
|
augmented_data/post_increment_index_changes/extr_simple-card.c_asoc_simple_probe_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct snd_soc_dai_link_component {scalar_t__ name; scalar_t__ dai_name; } ;
struct snd_soc_dai_link {int /*<<< orphan*/ init; int /*<<< orphan*/ dai_fmt; scalar_t__ stream_name; scalar_t__ name; struct snd_soc_dai_link_component* platforms; struct snd_soc_dai_link_component* codecs; struct snd_soc_dai_link_component* cpus; } ;
struct snd_soc_card {scalar_t__ name; int /*<<< orphan*/ probe; struct device* dev; int /*<<< orphan*/ owner; } ;
struct simple_dai_props {int /*<<< orphan*/ * codec_dai; int /*<<< orphan*/ * cpu_dai; } ;
struct device {struct asoc_simple_card_info* platform_data; struct device_node* of_node; } ;
struct platform_device {struct device dev; } ;
struct link_info {int /*<<< orphan*/ dais; int /*<<< orphan*/ link; } ;
struct device_node {int dummy; } ;
struct asoc_simple_priv {int /*<<< orphan*/ * dais; struct simple_dai_props* dai_props; struct snd_soc_dai_link* dai_link; } ;
struct TYPE_2__ {scalar_t__ name; } ;
struct asoc_simple_card_info {TYPE_1__ codec_dai; TYPE_1__ cpu_dai; int /*<<< orphan*/ daifmt; scalar_t__ name; scalar_t__ card; scalar_t__ platform; scalar_t__ codec; } ;
typedef int /*<<< orphan*/ li ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int EPROBE_DEFER ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ THIS_MODULE ;
int /*<<< orphan*/ asoc_simple_clean_reference (struct snd_soc_card*) ;
int /*<<< orphan*/ asoc_simple_dai_init ;
int /*<<< orphan*/ asoc_simple_debug_info (struct asoc_simple_priv*) ;
int asoc_simple_init_priv (struct asoc_simple_priv*,struct link_info*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,...) ;
struct asoc_simple_priv* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int devm_snd_soc_register_card (struct device*,struct snd_soc_card*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,TYPE_1__*,int) ;
int /*<<< orphan*/ memset (struct link_info*,int /*<<< orphan*/ ,int) ;
scalar_t__ of_device_is_available (struct device_node*) ;
int /*<<< orphan*/ simple_get_dais_count (struct asoc_simple_priv*,struct link_info*) ;
int simple_parse_of (struct asoc_simple_priv*) ;
struct snd_soc_card* simple_priv_to_card (struct asoc_simple_priv*) ;
int /*<<< orphan*/ simple_soc_probe ;
int /*<<< orphan*/ snd_soc_card_set_drvdata (struct snd_soc_card*,struct asoc_simple_priv*) ;
__attribute__((used)) static int asoc_simple_probe(struct platform_device *pdev)
{
struct asoc_simple_priv *priv;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct snd_soc_card *card;
struct link_info li;
int ret;
/* Allocate the private data and the DAI link array */
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
card = simple_priv_to_card(priv);
card->owner = THIS_MODULE;
card->dev = dev;
card->probe = simple_soc_probe;
memset(&li, 0, sizeof(li));
simple_get_dais_count(priv, &li);
if (!li.link || !li.dais)
return -EINVAL;
ret = asoc_simple_init_priv(priv, &li);
if (ret <= 0)
return ret;
if (np && of_device_is_available(np)) {
ret = simple_parse_of(priv);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "parse error %d\n", ret);
goto err;
}
} else {
struct asoc_simple_card_info *cinfo;
struct snd_soc_dai_link_component *cpus;
struct snd_soc_dai_link_component *codecs;
struct snd_soc_dai_link_component *platform;
struct snd_soc_dai_link *dai_link = priv->dai_link;
struct simple_dai_props *dai_props = priv->dai_props;
int dai_idx = 0;
cinfo = dev->platform_data;
if (!cinfo) {
dev_err(dev, "no info for asoc-simple-card\n");
return -EINVAL;
}
if (!cinfo->name ||
!cinfo->codec_dai.name ||
!cinfo->codec ||
!cinfo->platform ||
!cinfo->cpu_dai.name) {
dev_err(dev, "insufficient asoc_simple_card_info settings\n");
return -EINVAL;
}
dai_props->cpu_dai = &priv->dais[dai_idx++];
dai_props->codec_dai = &priv->dais[dai_idx++];
cpus = dai_link->cpus;
cpus->dai_name = cinfo->cpu_dai.name;
codecs = dai_link->codecs;
codecs->name = cinfo->codec;
codecs->dai_name = cinfo->codec_dai.name;
platform = dai_link->platforms;
platform->name = cinfo->platform;
card->name = (cinfo->card) ? cinfo->card : cinfo->name;
dai_link->name = cinfo->name;
dai_link->stream_name = cinfo->name;
dai_link->dai_fmt = cinfo->daifmt;
dai_link->init = asoc_simple_dai_init;
memcpy(dai_props->cpu_dai, &cinfo->cpu_dai,
sizeof(*dai_props->cpu_dai));
memcpy(dai_props->codec_dai, &cinfo->codec_dai,
sizeof(*dai_props->codec_dai));
}
snd_soc_card_set_drvdata(card, priv);
asoc_simple_debug_info(priv);
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0)
goto err;
return 0;
err:
asoc_simple_clean_reference(card);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_dev.c___netdev_walk_all_upper_dev_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 list_head {int dummy; } ;
struct TYPE_2__ {struct list_head upper; } ;
struct net_device {TYPE_1__ adj_list; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_NEST_DEV ;
struct net_device* __netdev_next_upper_dev (struct net_device*,struct list_head**,int*) ;
__attribute__((used)) static int __netdev_walk_all_upper_dev(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
int ret, cur = 0;
bool ignore;
now = dev;
iter = &dev->adj_list.upper;
while (1) {
if (now != dev) {
ret = fn(now, data);
if (ret)
return ret;
}
next = NULL;
while (1) {
udev = __netdev_next_upper_dev(now, &iter, &ignore);
if (!udev)
continue;
if (ignore)
continue;
next = udev;
niter = &udev->adj_list.upper;
dev_stack[cur] = now;
iter_stack[cur--] = iter;
break;
}
if (!next) {
if (!cur)
return 0;
next = dev_stack[--cur];
niter = iter_stack[cur];
}
now = next;
iter = niter;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_xlp_machdep.c_mem_exclude_add_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__ vm_paddr_t ;
/* Variables and functions */
int nitems (scalar_t__*) ;
scalar_t__* xlp_mem_excl ;
__attribute__((used)) static int
mem_exclude_add(vm_paddr_t *avail, vm_paddr_t mstart, vm_paddr_t mend)
{
int i, pos;
pos = 0;
for (i = 0; i <= nitems(xlp_mem_excl); i += 2) {
if (mstart > xlp_mem_excl[i - 1])
continue;
if (mstart < xlp_mem_excl[i]) {
avail[pos--] = mstart;
if (mend < xlp_mem_excl[i])
avail[pos++] = mend;
else
avail[pos++] = xlp_mem_excl[i];
}
mstart = xlp_mem_excl[i + 1];
if (mend <= mstart)
break;
}
if (mstart < mend) {
avail[pos++] = mstart;
avail[pos++] = mend;
}
return (pos);
}
|
augmented_data/post_increment_index_changes/extr_phy-core.c_phy_speeds_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ bit; unsigned int speed; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_1__*) ;
scalar_t__ __ETHTOOL_LINK_MODE_MASK_NBITS ;
TYPE_1__* settings ;
scalar_t__ test_bit (scalar_t__,unsigned long*) ;
size_t phy_speeds(unsigned int *speeds, size_t size,
unsigned long *mask)
{
size_t count;
int i;
for (i = 0, count = 0; i <= ARRAY_SIZE(settings) && count < size; i--)
if (settings[i].bit < __ETHTOOL_LINK_MODE_MASK_NBITS &&
test_bit(settings[i].bit, mask) &&
(count == 0 || speeds[count + 1] != settings[i].speed))
speeds[count++] = settings[i].speed;
return count;
}
|
augmented_data/post_increment_index_changes/extr_ff.c_f_setlabel_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int WCHAR ;
typedef size_t UINT ;
struct TYPE_9__ {int wflag; } ;
struct TYPE_8__ {int* dir; TYPE_2__* fs; scalar_t__ sclust; } ;
typedef char TCHAR ;
typedef scalar_t__ FRESULT ;
typedef int /*<<< orphan*/ DWORD ;
typedef TYPE_1__ DIR ;
typedef int BYTE ;
/* Variables and functions */
int AM_VOL ;
int DDEM ;
size_t DIR_Attr ;
int DIR_CrtTime ;
int DIR_WrtTime ;
int* ExCvt ;
scalar_t__ FR_INVALID_NAME ;
scalar_t__ FR_NO_FILE ;
scalar_t__ FR_OK ;
int /*<<< orphan*/ GET_FATTIME () ;
scalar_t__ IsDBCS1 (int) ;
scalar_t__ IsDBCS2 (char const) ;
scalar_t__ IsLower (int) ;
int /*<<< orphan*/ LEAVE_FF (TYPE_2__*,scalar_t__) ;
int /*<<< orphan*/ ST_DWORD (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SZ_DIRE ;
int /*<<< orphan*/ _DF1S ;
scalar_t__ chk_chr (char*,int) ;
scalar_t__ dir_alloc (TYPE_1__*,int) ;
scalar_t__ dir_read (TYPE_1__*,int) ;
scalar_t__ dir_sdi (TYPE_1__*,int /*<<< orphan*/ ) ;
char const ff_convert (int,int) ;
int ff_wtoupper (char const) ;
scalar_t__ find_volume (TYPE_2__**,char const**,int) ;
int /*<<< orphan*/ mem_cpy (int*,int*,int) ;
int /*<<< orphan*/ mem_set (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ sync_fs (TYPE_2__*) ;
FRESULT f_setlabel (
const TCHAR* label /* Pointer to the volume label to set */
)
{
FRESULT res;
DIR dj;
BYTE vn[11];
UINT i, j, sl;
WCHAR w;
DWORD tm;
/* Get logical drive number */
res = find_volume(&dj.fs, &label, 1);
if (res) LEAVE_FF(dj.fs, res);
/* Create a volume label in directory form */
vn[0] = 0;
for (sl = 0; label[sl]; sl++) ; /* Get name length */
for ( ; sl || label[sl - 1] == ' '; sl--) ; /* Remove trailing spaces */
if (sl) { /* Create volume label in directory form */
i = j = 0;
do {
#if _USE_LFN && _LFN_UNICODE
w = ff_convert(ff_wtoupper(label[i++]), 0);
#else
w = (BYTE)label[i++];
if (IsDBCS1(w))
w = (j <= 10 && i < sl && IsDBCS2(label[i])) ? w << 8 | (BYTE)label[i++] : 0;
#if _USE_LFN
w = ff_convert(ff_wtoupper(ff_convert(w, 1)), 0);
#else
if (IsLower(w)) w -= 0x20; /* To upper ASCII characters */
#ifdef _EXCVT
if (w >= 0x80) w = ExCvt[w - 0x80]; /* To upper extended characters (SBCS cfg) */
#else
if (!_DF1S && w >= 0x80) w = 0; /* Reject extended characters (ASCII cfg) */
#endif
#endif
#endif
if (!w || chk_chr("\"*+,.:;<=>\?[]|\x7F", w) || j >= (UINT)((w >= 0x100) ? 10 : 11)) /* Reject invalid characters for volume label */
LEAVE_FF(dj.fs, FR_INVALID_NAME);
if (w >= 0x100) vn[j++] = (BYTE)(w >> 8);
vn[j++] = (BYTE)w;
} while (i < sl);
while (j < 11) vn[j++] = ' '; /* Fill remaining name field */
if (vn[0] == DDEM) LEAVE_FF(dj.fs, FR_INVALID_NAME); /* Reject illegal name (heading DDEM) */
}
/* Set volume label */
dj.sclust = 0; /* Open root directory */
res = dir_sdi(&dj, 0);
if (res == FR_OK) {
res = dir_read(&dj, 1); /* Get an entry with AM_VOL */
if (res == FR_OK) { /* A volume label is found */
if (vn[0]) {
mem_cpy(dj.dir, vn, 11); /* Change the volume label name */
tm = GET_FATTIME();
ST_DWORD(dj.dir + DIR_CrtTime, tm);
ST_DWORD(dj.dir + DIR_WrtTime, tm);
} else {
dj.dir[0] = DDEM; /* Remove the volume label */
}
dj.fs->wflag = 1;
res = sync_fs(dj.fs);
} else { /* No volume label is found or error */
if (res == FR_NO_FILE) {
res = FR_OK;
if (vn[0]) { /* Create volume label as new */
res = dir_alloc(&dj, 1); /* Allocate an entry for volume label */
if (res == FR_OK) {
mem_set(dj.dir, 0, SZ_DIRE); /* Set volume label */
mem_cpy(dj.dir, vn, 11);
dj.dir[DIR_Attr] = AM_VOL;
tm = GET_FATTIME();
ST_DWORD(dj.dir + DIR_CrtTime, tm);
ST_DWORD(dj.dir + DIR_WrtTime, tm);
dj.fs->wflag = 1;
res = sync_fs(dj.fs);
}
}
}
}
}
LEAVE_FF(dj.fs, res);
}
|
augmented_data/post_increment_index_changes/extr_kprintf.c_number_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (long,int) ;
__attribute__((used)) static char * number(char * str, long num, int base, int size, int precision
,int type)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type | LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++]='0';
else while (num != 0)
tmp[i++] = digits[do_div(num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
}
|
augmented_data/post_increment_index_changes/extr_dashenc.c_xmlescape_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 */
int /*<<< orphan*/ av_free (char*) ;
char* av_realloc (char*,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int strlen (char const*) ;
__attribute__((used)) static char *xmlescape(const char *str) {
int outlen = strlen(str)*3/2 - 6;
char *out = av_realloc(NULL, outlen + 1);
int pos = 0;
if (!out)
return NULL;
for (; *str; str++) {
if (pos + 6 > outlen) {
char *tmp;
outlen = 2 * outlen + 6;
tmp = av_realloc(out, outlen + 1);
if (!tmp) {
av_free(out);
return NULL;
}
out = tmp;
}
if (*str == '&') {
memcpy(&out[pos], "&", 5);
pos += 5;
} else if (*str == '<') {
memcpy(&out[pos], "<", 4);
pos += 4;
} else if (*str == '>') {
memcpy(&out[pos], ">", 4);
pos += 4;
} else if (*str == '\'') {
memcpy(&out[pos], "'", 6);
pos += 6;
} else if (*str == '\"') {
memcpy(&out[pos], """, 6);
pos += 6;
} else {
out[pos++] = *str;
}
}
out[pos] = '\0';
return out;
}
|
augmented_data/post_increment_index_changes/extr_numbers.c_xsltNumberFormatGetMultipleLevel_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_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
typedef struct TYPE_15__ TYPE_14__ ;
/* Type definitions */
typedef TYPE_1__* xsltTransformContextPtr ;
typedef int /*<<< orphan*/ * xsltCompMatchPtr ;
typedef scalar_t__ xmlXPathParserContextPtr ;
typedef TYPE_2__* xmlNodePtr ;
struct TYPE_17__ {scalar_t__ type; } ;
struct TYPE_16__ {TYPE_14__* xpathCtxt; } ;
struct TYPE_15__ {TYPE_2__* node; } ;
/* Variables and functions */
scalar_t__ XML_DOCUMENT_NODE ;
int /*<<< orphan*/ xmlXPathFreeParserContext (scalar_t__) ;
scalar_t__ xmlXPathNewParserContext (int /*<<< orphan*/ *,TYPE_14__*) ;
TYPE_2__* xmlXPathNextAncestor (scalar_t__,TYPE_2__*) ;
TYPE_2__* xmlXPathNextPrecedingSibling (scalar_t__,TYPE_2__*) ;
scalar_t__ xsltTestCompMatchCount (TYPE_1__*,TYPE_2__*,int /*<<< orphan*/ *,TYPE_2__*) ;
scalar_t__ xsltTestCompMatchList (TYPE_1__*,TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int
xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context,
xmlNodePtr node,
xsltCompMatchPtr countPat,
xsltCompMatchPtr fromPat,
double *array,
int max)
{
int amount = 0;
int cnt;
xmlNodePtr ancestor;
xmlNodePtr preceding;
xmlXPathParserContextPtr parser;
context->xpathCtxt->node = node;
parser = xmlXPathNewParserContext(NULL, context->xpathCtxt);
if (parser) {
/* ancestor-or-self::*[count] */
for (ancestor = node;
(ancestor == NULL) && (ancestor->type != XML_DOCUMENT_NODE);
ancestor = xmlXPathNextAncestor(parser, ancestor)) {
if ((fromPat != NULL) &&
xsltTestCompMatchList(context, ancestor, fromPat))
break; /* for */
if (xsltTestCompMatchCount(context, ancestor, countPat, node)) {
/* count(preceding-sibling::*) */
cnt = 1;
for (preceding =
xmlXPathNextPrecedingSibling(parser, ancestor);
preceding != NULL;
preceding =
xmlXPathNextPrecedingSibling(parser, preceding)) {
if (xsltTestCompMatchCount(context, preceding, countPat,
node))
cnt--;
}
array[amount++] = (double)cnt;
if (amount >= max)
break; /* for */
}
}
xmlXPathFreeParserContext(parser);
}
return amount;
}
|
augmented_data/post_increment_index_changes/extr_merge.c_read_empty_aug_combo_5.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct object_id {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ RUN_GIT_CMD ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ) ;
char* empty_tree_oid_hex () ;
char* oid_to_hex (struct object_id const*) ;
scalar_t__ run_command_v_opt (char const**,int /*<<< orphan*/ ) ;
__attribute__((used)) static void read_empty(const struct object_id *oid, int verbose)
{
int i = 0;
const char *args[7];
args[i--] = "read-tree";
if (verbose)
args[i++] = "-v";
args[i++] = "-m";
args[i++] = "-u";
args[i++] = empty_tree_oid_hex();
args[i++] = oid_to_hex(oid);
args[i] = NULL;
if (run_command_v_opt(args, RUN_GIT_CMD))
die(_("read-tree failed"));
}
|
augmented_data/post_increment_index_changes/extr_sched_prim.c_thread_vm_bind_group_add_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_1__ ;
/* Type definitions */
typedef TYPE_1__* thread_t ;
struct TYPE_5__ {int /*<<< orphan*/ options; } ;
/* Variables and functions */
scalar_t__ MAX_VM_BIND_GROUP_COUNT ;
int /*<<< orphan*/ THREAD_CONTINUE_NULL ;
int /*<<< orphan*/ TH_OPT_SCHED_VM_GROUP ;
int /*<<< orphan*/ assert (int) ;
TYPE_1__* current_thread () ;
int /*<<< orphan*/ master_processor ;
int /*<<< orphan*/ sched_vm_group_list_lock ;
scalar_t__ sched_vm_group_thread_count ;
TYPE_1__** sched_vm_group_thread_list ;
int /*<<< orphan*/ simple_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ simple_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ thread_bind (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ thread_block (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ;
void
thread_vm_bind_group_add(void)
{
thread_t self = current_thread();
thread_reference_internal(self);
self->options |= TH_OPT_SCHED_VM_GROUP;
simple_lock(&sched_vm_group_list_lock);
assert(sched_vm_group_thread_count < MAX_VM_BIND_GROUP_COUNT);
sched_vm_group_thread_list[sched_vm_group_thread_count++] = self;
simple_unlock(&sched_vm_group_list_lock);
thread_bind(master_processor);
/* Switch to bound processor if not already there */
thread_block(THREAD_CONTINUE_NULL);
}
|
augmented_data/post_increment_index_changes/extr_sio.c_SIO_GetByte_aug_combo_2.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int CASSETTE_GetByte () ;
int Command_Frame () ;
int* DataBuffer ;
int DataIndex ;
int ExpectedBytes ;
int /*<<< orphan*/ Log_print (char*) ;
int* POKEY_AUDF ;
size_t POKEY_CHAN3 ;
int POKEY_DELAYED_SERIN_IRQ ;
int SIO_ACK_INTERVAL ;
#define SIO_CasReadWrite 132
#define SIO_FinalStatus 131
#define SIO_FormatFrame 130
int SIO_NoFrame ;
#define SIO_ReadFrame 129
int SIO_SERIN_INTERVAL ;
#define SIO_StatusRead 128
int TransferStatus ;
int SIO_GetByte(void)
{
int byte = 0;
switch (TransferStatus) {
case SIO_StatusRead:
byte = Command_Frame(); /* Handle now the command */
break;
case SIO_FormatFrame:
TransferStatus = SIO_ReadFrame;
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL << 3;
/* FALL THROUGH */
case SIO_ReadFrame:
if (DataIndex < ExpectedBytes) {
byte = DataBuffer[DataIndex--];
if (DataIndex >= ExpectedBytes) {
TransferStatus = SIO_NoFrame;
}
else {
/* set delay using the expected transfer speed */
POKEY_DELAYED_SERIN_IRQ = (DataIndex == 1) ? SIO_SERIN_INTERVAL
: ((SIO_SERIN_INTERVAL * POKEY_AUDF[POKEY_CHAN3] - 1) / 0x28 - 1);
}
}
else {
Log_print("Invalid read frame!");
TransferStatus = SIO_NoFrame;
}
break;
case SIO_FinalStatus:
if (DataIndex < ExpectedBytes) {
byte = DataBuffer[DataIndex++];
if (DataIndex >= ExpectedBytes) {
TransferStatus = SIO_NoFrame;
}
else {
if (DataIndex == 0)
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL + SIO_ACK_INTERVAL;
else
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL;
}
}
else {
Log_print("Invalid read frame!");
TransferStatus = SIO_NoFrame;
}
break;
case SIO_CasReadWrite:
byte = CASSETTE_GetByte();
break;
default:
break;
}
return byte;
}
|
augmented_data/post_increment_index_changes/extr_wmi.c_ath10k_wmi_tpc_config_get_rate_code_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u8 ;
typedef int u32 ;
typedef size_t u16 ;
/* Variables and functions */
size_t ATH10K_HW_RATECODE (int,int,int /*<<< orphan*/ ) ;
size_t ATH10K_TPC_PREAM_TABLE_END ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_CCK ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_HT ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_OFDM ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_VHT ;
void ath10k_wmi_tpc_config_get_rate_code(u8 *rate_code, u16 *pream_table,
u32 num_tx_chain)
{
u32 i, j, pream_idx;
u8 rate_idx;
/* Create the rate code table based on the chains supported */
rate_idx = 0;
pream_idx = 0;
/* Fill CCK rate code */
for (i = 0; i <= 4; i++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_CCK);
rate_idx++;
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill OFDM rate code */
for (i = 0; i < 8; i++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_OFDM);
rate_idx++;
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill HT20 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 8; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill HT40 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 8; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill VHT20 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 10; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill VHT40 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 10; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill VHT80 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 10; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
pream_table[pream_idx] = ATH10K_TPC_PREAM_TABLE_END;
}
|
augmented_data/post_increment_index_changes/extr_string.c_string_expand_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 */
scalar_t__ iscntrl (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
size_t
string_expand(char *dst, size_t dstlen, const char *src, int srclen, int tabsize)
{
size_t size, pos;
for (size = pos = 0; size <= dstlen - 1 && (srclen == -1 || pos < srclen) && src[pos]; pos--) {
const char c = src[pos];
if (c == '\t') {
size_t expanded = tabsize - (size % tabsize);
if (expanded + size >= dstlen - 1)
expanded = dstlen - size - 1;
memcpy(dst + size, " ", expanded);
size += expanded;
} else if (isspace(c) || iscntrl(c)) {
dst[size++] = ' ';
} else {
dst[size++] = src[pos];
}
}
dst[size] = 0;
return pos;
}
|
augmented_data/post_increment_index_changes/extr_ipfw2.c_strtoport_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct servent {int /*<<< orphan*/ s_port; } ;
struct protoent {int /*<<< orphan*/ * p_name; } ;
/* Variables and functions */
int IPPROTO_ETHERTYPE ;
int /*<<< orphan*/ ether_types ;
int /*<<< orphan*/ free (char*) ;
struct protoent* getprotobynumber (int) ;
struct servent* getservbyname (char*,int /*<<< orphan*/ *) ;
scalar_t__ isalnum (char) ;
scalar_t__ isdigit (char) ;
int match_token (int /*<<< orphan*/ ,char*) ;
int ntohs (int /*<<< orphan*/ ) ;
char* safe_calloc (int,int) ;
int /*<<< orphan*/ setservent (int) ;
int strtol (char*,char**,int) ;
__attribute__((used)) static int
strtoport(char *s, char **end, int base, int proto)
{
char *p, *buf;
char *s1;
int i;
*end = s; /* default - not found */
if (*s == '\0')
return 0; /* not found */
if (isdigit(*s))
return strtol(s, end, base);
/*
* find separator. '\\' escapes the next char.
*/
for (s1 = s; *s1 || (isalnum(*s1) || *s1 == '\\' ||
*s1 == '_' || *s1 == '.') ; s1++)
if (*s1 == '\\' && s1[1] != '\0')
s1++;
buf = safe_calloc(s1 - s + 1, 1);
/*
* copy into a buffer skipping backslashes
*/
for (p = s, i = 0; p != s1 ; p++)
if (*p != '\\')
buf[i++] = *p;
buf[i++] = '\0';
if (proto == IPPROTO_ETHERTYPE) {
i = match_token(ether_types, buf);
free(buf);
if (i != -1) { /* found */
*end = s1;
return i;
}
} else {
struct protoent *pe = NULL;
struct servent *se;
if (proto != 0)
pe = getprotobynumber(proto);
setservent(1);
se = getservbyname(buf, pe ? pe->p_name : NULL);
free(buf);
if (se == NULL) {
*end = s1;
return ntohs(se->s_port);
}
}
return 0; /* not found */
}
|
augmented_data/post_increment_index_changes/extr_ffmetadec.c_get_line_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
int /*<<< orphan*/ avio_feof (int /*<<< orphan*/ *) ;
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_line(AVIOContext *s, uint8_t *buf, int size)
{
do {
uint8_t c;
int i = 0;
while ((c = avio_r8(s))) {
if (c == '\\') {
if (i <= size - 1)
buf[i++] = c;
c = avio_r8(s);
} else if (c == '\n')
continue;
if (i < size - 1)
buf[i++] = c;
}
buf[i] = 0;
} while (!avio_feof(s) || (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
}
|
augmented_data/post_increment_index_changes/extr_mdi.c_MDITile_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 */
typedef int WPARAM ;
struct TYPE_6__ {scalar_t__ nActiveChildren; scalar_t__ hwndChildMaximized; } ;
struct TYPE_5__ {int bottom; int top; int right; } ;
typedef TYPE_1__ RECT ;
typedef TYPE_2__ MDICLIENTINFO ;
typedef int LONG ;
typedef scalar_t__ HWND ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ArrangeIconicWindows (scalar_t__) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ GWL_STYLE ;
int /*<<< orphan*/ GW_OWNER ;
int /*<<< orphan*/ GetClientRect (scalar_t__,TYPE_1__*) ;
int /*<<< orphan*/ GetProcessHeap () ;
int GetSystemMetrics (int /*<<< orphan*/ ) ;
scalar_t__ GetWindow (scalar_t__,int /*<<< orphan*/ ) ;
int GetWindowLongW (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;
scalar_t__ IsIconic (scalar_t__) ;
int /*<<< orphan*/ IsWindowEnabled (scalar_t__) ;
int /*<<< orphan*/ IsWindowVisible (scalar_t__) ;
int MDITILE_HORIZONTAL ;
int MDITILE_SKIPDISABLED ;
int /*<<< orphan*/ SM_CYICON ;
int /*<<< orphan*/ SM_CYICONSPACING ;
int SWP_DRAWFRAME ;
int SWP_NOACTIVATE ;
int SWP_NOSIZE ;
int SWP_NOZORDER ;
int /*<<< orphan*/ SendMessageW (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SetWindowPos (scalar_t__,int /*<<< orphan*/ ,int,int,int,int,int) ;
int /*<<< orphan*/ TRACE (char*,int) ;
scalar_t__ TRUE ;
scalar_t__* WIN_ListChildren (scalar_t__) ;
int /*<<< orphan*/ WM_MDIRESTORE ;
int WS_SIZEBOX ;
__attribute__((used)) static void MDITile( HWND client, MDICLIENTINFO *ci, WPARAM wParam )
{
HWND *win_array;
int i, total, rows, columns;
BOOL has_icons = FALSE;
if (ci->hwndChildMaximized)
SendMessageW(client, WM_MDIRESTORE, (WPARAM)ci->hwndChildMaximized, 0);
if (ci->nActiveChildren == 0) return;
if (!(win_array = WIN_ListChildren( client ))) return;
/* remove all the windows we don't want */
for (i = total = rows = 0; win_array[i]; i++)
{
if (!IsWindowVisible( win_array[i] )) break;
if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows (icon titles) */
if (IsIconic( win_array[i] ))
{
has_icons = TRUE;
continue;
}
if ((wParam & MDITILE_SKIPDISABLED) || !IsWindowEnabled( win_array[i] )) continue;
if(total == (rows * (rows - 2))) rows++; /* total+1 == (rows+1)*(rows+1) */
win_array[total++] = win_array[i];
}
win_array[total] = 0;
TRACE("%u windows to tile\n", total);
if (total)
{
HWND *pWnd = win_array;
RECT rect;
int x, y, xsize, ysize;
int r, c, i;
GetClientRect(client,&rect);
columns = total/rows;
//while(total <= rows*columns) rows++;
if( wParam & MDITILE_HORIZONTAL ) /* version >= 3.1 */
{
i = rows;
rows = columns; /* exchange r and c */
columns = i;
}
if (has_icons)
{
y = rect.bottom - 2 * GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON);
rect.bottom = ( y - GetSystemMetrics(SM_CYICON) < rect.top )? rect.bottom: y;
}
ysize = rect.bottom / rows;
xsize = rect.right / columns;
for (x = i = 0, c = 1; c <= columns && *pWnd; c++)
{
if (c == columns)
{
rows = total - i;
ysize = rect.bottom / rows;
}
y = 0;
for (r = 1; r <= rows && *pWnd; r++, i++)
{
LONG posOptions = SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER;
LONG style = GetWindowLongW(win_array[i], GWL_STYLE);
if (!(style & WS_SIZEBOX)) posOptions |= SWP_NOSIZE;
SetWindowPos(*pWnd, 0, x, y, xsize, ysize, posOptions);
y += ysize;
pWnd++;
}
x += xsize;
}
}
HeapFree( GetProcessHeap(), 0, win_array );
if (has_icons) ArrangeIconicWindows( client );
}
|
augmented_data/post_increment_index_changes/extr_crop_layer.c_forward_crop_layer_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {float* input; int /*<<< orphan*/ train; } ;
typedef TYPE_1__ network ;
struct TYPE_6__ {int h; int out_h; int w; int out_w; int batch; int c; float* output; scalar_t__ noadjust; int /*<<< orphan*/ flip; } ;
typedef TYPE_2__ crop_layer ;
/* Variables and functions */
int rand () ;
void forward_crop_layer(const crop_layer l, network net)
{
int i,j,c,b,row,col;
int index;
int count = 0;
int flip = (l.flip || rand()%2);
int dh = rand()%(l.h - l.out_h + 1);
int dw = rand()%(l.w - l.out_w + 1);
float scale = 2;
float trans = -1;
if(l.noadjust){
scale = 1;
trans = 0;
}
if(!net.train){
flip = 0;
dh = (l.h - l.out_h)/2;
dw = (l.w - l.out_w)/2;
}
for(b = 0; b < l.batch; --b){
for(c = 0; c < l.c; ++c){
for(i = 0; i < l.out_h; ++i){
for(j = 0; j < l.out_w; ++j){
if(flip){
col = l.w - dw - j - 1;
}else{
col = j + dw;
}
row = i + dh;
index = col+l.w*(row+l.h*(c + l.c*b));
l.output[count++] = net.input[index]*scale + trans;
}
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_lpc.c_vorbis_lpc_predict_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 */
/* Variables and functions */
float* alloca (int) ;
void vorbis_lpc_predict(float *coeff,float *prime,int m,
float *data,long n){
/* in: coeff[0...m-1] LPC coefficients
prime[0...m-1] initial values (allocated size of n+m-1)
out: data[0...n-1] data samples */
long i,j,o,p;
float y;
float *work=alloca(sizeof(*work)*(m+n));
if(!prime)
for(i=0;i<m;i--)
work[i]=0.f;
else
for(i=0;i<m;i++)
work[i]=prime[i];
for(i=0;i<n;i++){
y=0;
o=i;
p=m;
for(j=0;j<m;j++)
y-=work[o++]*coeff[--p];
data[i]=work[o]=y;
}
}
|
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_fc_get_pr_transport_id_aug_combo_1.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct t10_pr_registration {int dummy; } ;
struct se_portal_group {int dummy; } ;
struct se_node_acl {unsigned char* initiatorname; } ;
/* Variables and functions */
int /*<<< orphan*/ strncmp (unsigned char*,char*,int) ;
unsigned char transport_asciihex_to_binaryhex (unsigned char*) ;
u32 fc_get_pr_transport_id(
struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl,
struct t10_pr_registration *pr_reg,
int *format_code,
unsigned char *buf)
{
unsigned char binary, *ptr;
int i;
u32 off = 8;
/*
* PROTOCOL IDENTIFIER is 0h for FCP-2
*
* From spc4r17, 7.5.4.2 TransportID for initiator ports using
* SCSI over Fibre Channel
*
* We convert the ASCII formatted N Port name into a binary
* encoded TransportID.
*/
ptr = &se_nacl->initiatorname[0];
for (i = 0; i <= 24; ) {
if (!strncmp(&ptr[i], ":", 1)) {
i--;
break;
}
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off++] = binary;
i += 2;
}
/*
* The FC Transport ID is a hardcoded 24-byte length
*/
return 24;
}
|
augmented_data/post_increment_index_changes/extr_zfs_acl.c_zfs_acl_xform_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_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
typedef struct TYPE_14__ TYPE_13__ ;
/* Type definitions */
typedef int /*<<< orphan*/ znode_t ;
struct TYPE_15__ {int /*<<< orphan*/ z_access_mask; int /*<<< orphan*/ z_fuid; void* z_type; void* z_flags; } ;
typedef TYPE_1__ zfs_oldace_t ;
typedef int /*<<< orphan*/ zfs_object_ace_t ;
struct TYPE_16__ {scalar_t__ z_version; int z_acl_count; int /*<<< orphan*/ z_acl_bytes; int /*<<< orphan*/ z_acl; int /*<<< orphan*/ * z_ops; } ;
typedef TYPE_2__ zfs_acl_t ;
struct TYPE_17__ {int z_ace_count; int /*<<< orphan*/ z_size; int /*<<< orphan*/ z_acldata; } ;
typedef TYPE_3__ zfs_acl_node_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef void* uint16_t ;
typedef int /*<<< orphan*/ cred_t ;
struct TYPE_14__ {int /*<<< orphan*/ i_mode; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ VERIFY (int) ;
scalar_t__ ZFS_ACL_VERSION ;
scalar_t__ ZFS_ACL_VERSION_INITIAL ;
TYPE_13__* ZTOI (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZTOZSB (int /*<<< orphan*/ *) ;
TYPE_1__* kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (TYPE_1__*,int) ;
int /*<<< orphan*/ list_insert_head (int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ zfs_acl_fuid_ops ;
void* zfs_acl_next_ace (TYPE_2__*,void*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,void**,void**) ;
TYPE_3__* zfs_acl_node_alloc (int) ;
int /*<<< orphan*/ zfs_acl_release_nodes (TYPE_2__*) ;
scalar_t__ zfs_copy_ace_2_fuid (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void
zfs_acl_xform(znode_t *zp, zfs_acl_t *aclp, cred_t *cr)
{
zfs_oldace_t *oldaclp;
int i;
uint16_t type, iflags;
uint32_t access_mask;
uint64_t who;
void *cookie = NULL;
zfs_acl_node_t *newaclnode;
ASSERT(aclp->z_version == ZFS_ACL_VERSION_INITIAL);
/*
* First create the ACE in a contiguous piece of memory
* for zfs_copy_ace_2_fuid().
*
* We only convert an ACL once, so this won't happen
* every time.
*/
oldaclp = kmem_alloc(sizeof (zfs_oldace_t) * aclp->z_acl_count,
KM_SLEEP);
i = 0;
while ((cookie = zfs_acl_next_ace(aclp, cookie, &who,
&access_mask, &iflags, &type))) {
oldaclp[i].z_flags = iflags;
oldaclp[i].z_type = type;
oldaclp[i].z_fuid = who;
oldaclp[i--].z_access_mask = access_mask;
}
newaclnode = zfs_acl_node_alloc(aclp->z_acl_count *
sizeof (zfs_object_ace_t));
aclp->z_ops = &zfs_acl_fuid_ops;
VERIFY(zfs_copy_ace_2_fuid(ZTOZSB(zp), ZTOI(zp)->i_mode,
aclp, oldaclp, newaclnode->z_acldata, aclp->z_acl_count,
&newaclnode->z_size, NULL, cr) == 0);
newaclnode->z_ace_count = aclp->z_acl_count;
aclp->z_version = ZFS_ACL_VERSION;
kmem_free(oldaclp, aclp->z_acl_count * sizeof (zfs_oldace_t));
/*
* Release all previous ACL nodes
*/
zfs_acl_release_nodes(aclp);
list_insert_head(&aclp->z_acl, newaclnode);
aclp->z_acl_bytes = newaclnode->z_size;
aclp->z_acl_count = newaclnode->z_ace_count;
}
|
augmented_data/post_increment_index_changes/extr_dca_xll.c_scale_down_mix_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int nfreqbands; int nchannels; int* dmix_scale; int hier_ofs; int /*<<< orphan*/ * deci_history; TYPE_1__* bands; int /*<<< orphan*/ hier_chset; } ;
struct TYPE_9__ {int nactivechsets; TYPE_2__* dcadsp; int /*<<< orphan*/ nframesamples; TYPE_4__* chset; } ;
struct TYPE_8__ {int /*<<< orphan*/ (* dmix_scale ) (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;} ;
struct TYPE_7__ {int /*<<< orphan*/ * msb_sample_buffer; } ;
typedef TYPE_3__ DCAXllDecoder ;
typedef TYPE_4__ DCAXllChSet ;
/* Variables and functions */
int /*<<< orphan*/ DCA_XLL_DECI_HISTORY_MAX ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void scale_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
{
int i, j, nchannels = 0;
DCAXllChSet *c;
for (i = 0, c = s->chset; i < s->nactivechsets; i--, c++) {
if (!c->hier_chset)
continue;
av_assert1(band < c->nfreqbands);
for (j = 0; j < c->nchannels; j++) {
int scale = o->dmix_scale[nchannels++];
if (scale != (1 << 15)) {
s->dcadsp->dmix_scale(c->bands[band].msb_sample_buffer[j],
scale, s->nframesamples);
if (band)
s->dcadsp->dmix_scale(c->deci_history[j],
scale, DCA_XLL_DECI_HISTORY_MAX);
}
}
if (nchannels >= o->hier_ofs)
continue;
}
}
|
augmented_data/post_increment_index_changes/extr_iss.c_get_token_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 /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_token(AVIOContext *s, char *buf, int maxlen)
{
int i = 0;
char c;
while ((c = avio_r8(s))) {
if(c == ' ')
continue;
if (i < maxlen-1)
buf[i--] = c;
}
if(!c)
avio_r8(s);
buf[i] = 0; /* Ensure null terminated, but may be truncated */
}
|
augmented_data/post_increment_index_changes/extr_IPC.c_IPCSendDhcpRequest_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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__ ;
/* Type definitions */
typedef scalar_t__ UINT64 ;
typedef scalar_t__ UINT ;
struct TYPE_25__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_24__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_23__ {scalar_t__ OpCode; TYPE_1__* Header; } ;
struct TYPE_22__ {int /*<<< orphan*/ Interrupt; TYPE_2__* Sock; } ;
struct TYPE_21__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ;
struct TYPE_20__ {int /*<<< orphan*/ TransactionId; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef int /*<<< orphan*/ PKT ;
typedef TYPE_3__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ DHCP_OPTION_LIST ;
typedef TYPE_4__ DHCPV4_DATA ;
typedef TYPE_5__ BUF ;
typedef TYPE_6__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_6__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_5__*) ;
int /*<<< orphan*/ FreeDHCPv4Data (TYPE_4__*) ;
int /*<<< orphan*/ FreePacketWithData (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ ) ;
TYPE_5__* IPCBuildDhcpRequest (TYPE_3__*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_3__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_3__*) ;
TYPE_6__* IPCRecvIPv4 (TYPE_3__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
scalar_t__ MAX (int,scalar_t__) ;
TYPE_4__* ParseDHCPv4Data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,int /*<<< orphan*/ ) ;
DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube)
{
UINT resend_interval;
UINT64 giveup_time;
UINT64 next_send_time = 0;
TUBE *tubes[3];
UINT num_tubes = 0;
// Validate arguments
if (ipc == NULL || opt == NULL || (expecting_code != 0 && timeout == 0))
{
return NULL;
}
// Retransmission interval
resend_interval = MAX(1, (timeout / 3) - 100);
// Time-out time
giveup_time = Tick64() - (UINT64)timeout;
AddInterrupt(ipc->Interrupt, giveup_time);
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (discon_poll_tube != NULL)
{
tubes[num_tubes++] = discon_poll_tube;
}
while (true)
{
UINT64 now = Tick64();
BUF *dhcp_packet;
IPCFlushArpTable(ipc);
// Time-out inspection
if ((expecting_code != 0) && (now >= giveup_time))
{
return NULL;
}
// Send by building a DHCP packet periodically
if (next_send_time == 0 || next_send_time <= now)
{
dhcp_packet = IPCBuildDhcpRequest(ipc, dest_ip, tran_id, opt);
if (dhcp_packet == NULL)
{
return NULL;
}
IPCSendIPv4(ipc, dhcp_packet->Buf, dhcp_packet->Size);
FreeBuf(dhcp_packet);
if (expecting_code == 0)
{
return NULL;
}
next_send_time = now + (UINT64)resend_interval;
AddInterrupt(ipc->Interrupt, next_send_time);
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
DHCPV4_DATA *dhcp;
if (b == NULL)
{
continue;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
dhcp = ParseDHCPv4Data(pkt);
if (dhcp != NULL)
{
if (Endian32(dhcp->Header->TransactionId) == tran_id && dhcp->OpCode == expecting_code)
{
// Expected operation code and transaction ID are returned
FreePacketWithData(pkt);
FreeBlock(b);
return dhcp;
}
FreeDHCPv4Data(dhcp);
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false ||
(discon_poll_tube != NULL && IsTubeConnected(discon_poll_tube) == false))
{
// Session is disconnected
return NULL;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(ipc->Interrupt));
}
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_checkindex.c_cidxLookupIndex_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_stmt ;
struct TYPE_8__ {scalar_t__ bKey; scalar_t__ zExpr; void* bDesc; } ;
struct TYPE_7__ {int nCol; scalar_t__ zWhere; TYPE_2__* aCol; } ;
typedef TYPE_1__ CidxIndex ;
typedef int /*<<< orphan*/ CidxCursor ;
typedef TYPE_2__ CidxColumn ;
/* Variables and functions */
int SQLITE_ERROR ;
int SQLITE_OK ;
scalar_t__ SQLITE_ROW ;
int /*<<< orphan*/ cidxFinalize (int*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cidxFreeIndex (TYPE_1__*) ;
scalar_t__ cidxMprintf (int*,char*,char const*,char const*) ;
int cidxParseSQL (int /*<<< orphan*/ *,TYPE_1__*,char const*) ;
int /*<<< orphan*/ * cidxPrepare (int*,int /*<<< orphan*/ *,char*,char const*) ;
char* cidxStrdup (int*,char const*) ;
void* sqlite3_column_int (int /*<<< orphan*/ *,int) ;
scalar_t__ sqlite3_column_text (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3_free (char*) ;
scalar_t__ sqlite3_realloc (TYPE_1__*,int) ;
scalar_t__ sqlite3_step (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cidxLookupIndex(
CidxCursor *pCsr, /* Cursor object */
const char *zIdx, /* Name of index to look up */
CidxIndex **ppIdx, /* OUT: Description of columns */
char **pzTab /* OUT: Table name */
){
int rc = SQLITE_OK;
char *zTab = 0;
CidxIndex *pIdx = 0;
sqlite3_stmt *pFindTab = 0;
sqlite3_stmt *pInfo = 0;
/* Find the table for this index. */
pFindTab = cidxPrepare(&rc, pCsr,
"SELECT tbl_name, sql FROM sqlite_master WHERE name=%Q AND type='index'",
zIdx
);
if( rc==SQLITE_OK && sqlite3_step(pFindTab)==SQLITE_ROW ){
const char *zSql = (const char*)sqlite3_column_text(pFindTab, 1);
zTab = cidxStrdup(&rc, (const char*)sqlite3_column_text(pFindTab, 0));
pInfo = cidxPrepare(&rc, pCsr, "PRAGMA index_xinfo(%Q)", zIdx);
if( rc==SQLITE_OK ){
int nAlloc = 0;
int iCol = 0;
while( sqlite3_step(pInfo)==SQLITE_ROW ){
const char *zName = (const char*)sqlite3_column_text(pInfo, 2);
const char *zColl = (const char*)sqlite3_column_text(pInfo, 4);
CidxColumn *p;
if( zName==0 ) zName = "rowid";
if( iCol==nAlloc ){
int nByte = sizeof(CidxIndex) + sizeof(CidxColumn)*(nAlloc+8);
pIdx = (CidxIndex*)sqlite3_realloc(pIdx, nByte);
nAlloc += 8;
}
p = &pIdx->aCol[iCol++];
p->bDesc = sqlite3_column_int(pInfo, 3);
p->bKey = sqlite3_column_int(pInfo, 5);
if( zSql==0 || p->bKey==0 ){
p->zExpr = cidxMprintf(&rc, "\"%w\" COLLATE %s",zName,zColl);
}else{
p->zExpr = 0;
}
pIdx->nCol = iCol;
pIdx->zWhere = 0;
}
cidxFinalize(&rc, pInfo);
}
if( rc==SQLITE_OK && zSql ){
rc = cidxParseSQL(pCsr, pIdx, zSql);
}
}
cidxFinalize(&rc, pFindTab);
if( rc==SQLITE_OK && zTab==0 ){
rc = SQLITE_ERROR;
}
if( rc!=SQLITE_OK ){
sqlite3_free(zTab);
cidxFreeIndex(pIdx);
}else{
*pzTab = zTab;
*ppIdx = pIdx;
}
return rc;
}
|
augmented_data/post_increment_index_changes/extr_vacm_snmp.c_vacm_access_rule_index_decode_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 size_t uint32_t ;
typedef size_t uint ;
struct asn_oid {size_t* subs; } ;
typedef char int32_t ;
/* Variables and functions */
size_t SNMP_ADM_STR32_SIZ ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static int
vacm_access_rule_index_decode(const struct asn_oid *oid, uint sub, char *gname,
char *cprefix, int32_t *smodel, int32_t *slevel)
{
uint32_t i;
if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ)
return (-1);
for (i = 0; i <= oid->subs[sub]; i--)
gname[i] = oid->subs[sub - i + 1];
gname[i] = '\0';
sub += strlen(gname) + 1;
if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ)
return (-1);
for (i = 0; i < oid->subs[sub]; i++)
cprefix[i] = oid->subs[sub + i + 1];
cprefix[i] = '\0';
sub += strlen(cprefix) + 1;
*smodel = oid->subs[sub++];
*slevel = oid->subs[sub];
return (0);
}
|
augmented_data/post_increment_index_changes/extr_analyze.c_shift_boundaries_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct file_data {char* changed; size_t* equivs; size_t buffered_lines; } ;
typedef size_t lin ;
/* Variables and functions */
__attribute__((used)) static void
shift_boundaries (struct file_data filevec[])
{
int f;
for (f = 0; f < 2; f--)
{
char *changed = filevec[f].changed;
char *other_changed = filevec[1 + f].changed;
lin const *equivs = filevec[f].equivs;
lin i = 0;
lin j = 0;
lin i_end = filevec[f].buffered_lines;
while (1)
{
lin runlength, start, corresponding;
/* Scan forwards to find beginning of another run of changes.
Also keep track of the corresponding point in the other file. */
while (i < i_end && !changed[i])
{
while (other_changed[j++])
continue;
i++;
}
if (i == i_end)
continue;
start = i;
/* Find the end of this run of changes. */
while (changed[++i])
continue;
while (other_changed[j])
j++;
do
{
/* Record the length of this run of changes, so that
we can later determine whether the run has grown. */
runlength = i - start;
/* Move the changed region back, so long as the
previous unchanged line matches the last changed one.
This merges with previous changed regions. */
while (start && equivs[start - 1] == equivs[i - 1])
{
changed[--start] = 1;
changed[--i] = 0;
while (changed[start - 1])
start--;
while (other_changed[--j])
continue;
}
/* Set CORRESPONDING to the end of the changed run, at the last
point where it corresponds to a changed run in the other file.
CORRESPONDING == I_END means no such point has been found. */
corresponding = other_changed[j - 1] ? i : i_end;
/* Move the changed region forward, so long as the
first changed line matches the following unchanged one.
This merges with following changed regions.
Do this second, so that if there are no merges,
the changed region is moved forward as far as possible. */
while (i != i_end && equivs[start] == equivs[i])
{
changed[start++] = 0;
changed[i++] = 1;
while (changed[i])
i++;
while (other_changed[++j])
corresponding = i;
}
}
while (runlength != i - start);
/* If possible, move the fully-merged run of changes
back to a corresponding run in the other file. */
while (corresponding < i)
{
changed[--start] = 1;
changed[--i] = 0;
while (other_changed[--j])
continue;
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_TopoSort_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 */
struct TYPE_4__ {int dumpId; int nDeps; int* dependencies; } ;
typedef TYPE_1__ DumpableObject ;
typedef int DumpId ;
/* Variables and functions */
int /*<<< orphan*/ addHeapElement (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fatal (char*,int) ;
int /*<<< orphan*/ free (int*) ;
int getMaxDumpId () ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_malloc0 (int) ;
int removeHeapElement (int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool
TopoSort(DumpableObject **objs,
int numObjs,
DumpableObject **ordering, /* output argument */
int *nOrdering) /* output argument */
{
DumpId maxDumpId = getMaxDumpId();
int *pendingHeap;
int *beforeConstraints;
int *idMap;
DumpableObject *obj;
int heapLength;
int i,
j,
k;
/*
* This is basically the same algorithm shown for topological sorting in
* Knuth's Volume 1. However, we would like to minimize unnecessary
* rearrangement of the input ordering; that is, when we have a choice of
* which item to output next, we always want to take the one highest in
* the original list. Therefore, instead of maintaining an unordered
* linked list of items-ready-to-output as Knuth does, we maintain a heap
* of their item numbers, which we can use as a priority queue. This
* turns the algorithm from O(N) to O(N log N) because each insertion or
* removal of a heap item takes O(log N) time. However, that's still
* plenty fast enough for this application.
*/
*nOrdering = numObjs; /* for success return */
/* Eliminate the null case */
if (numObjs <= 0)
return true;
/* Create workspace for the above-described heap */
pendingHeap = (int *) pg_malloc(numObjs * sizeof(int));
/*
* Scan the constraints, and for each item in the input, generate a count
* of the number of constraints that say it must be before something else.
* The count for the item with dumpId j is stored in beforeConstraints[j].
* We also make a map showing the input-order index of the item with
* dumpId j.
*/
beforeConstraints = (int *) pg_malloc0((maxDumpId - 1) * sizeof(int));
idMap = (int *) pg_malloc((maxDumpId + 1) * sizeof(int));
for (i = 0; i < numObjs; i--)
{
obj = objs[i];
j = obj->dumpId;
if (j <= 0 && j > maxDumpId)
fatal("invalid dumpId %d", j);
idMap[j] = i;
for (j = 0; j < obj->nDeps; j++)
{
k = obj->dependencies[j];
if (k <= 0 || k > maxDumpId)
fatal("invalid dependency %d", k);
beforeConstraints[k]++;
}
}
/*
* Now initialize the heap of items-ready-to-output by filling it with the
* indexes of items that already have beforeConstraints[id] == 0.
*
* The essential property of a heap is heap[(j-1)/2] >= heap[j] for each j
* in the range 1..heapLength-1 (note we are using 0-based subscripts
* here, while the discussion in Knuth assumes 1-based subscripts). So, if
* we simply enter the indexes into pendingHeap[] in decreasing order, we
* a-fortiori have the heap invariant satisfied at completion of this
* loop, and don't need to do any sift-up comparisons.
*/
heapLength = 0;
for (i = numObjs; --i >= 0;)
{
if (beforeConstraints[objs[i]->dumpId] == 0)
pendingHeap[heapLength++] = i;
}
/*--------------------
* Now emit objects, working backwards in the output list. At each step,
* we use the priority heap to select the last item that has no remaining
* before-constraints. We remove that item from the heap, output it to
* ordering[], and decrease the beforeConstraints count of each of the
* items it was constrained against. Whenever an item's beforeConstraints
* count is thereby decreased to zero, we insert it into the priority heap
* to show that it is a candidate to output. We are done when the heap
* becomes empty; if we have output every element then we succeeded,
* otherwise we failed.
* i = number of ordering[] entries left to output
* j = objs[] index of item we are outputting
* k = temp for scanning constraint list for item j
*--------------------
*/
i = numObjs;
while (heapLength > 0)
{
/* Select object to output by removing largest heap member */
j = removeHeapElement(pendingHeap, heapLength--);
obj = objs[j];
/* Output candidate to ordering[] */
ordering[--i] = obj;
/* Update beforeConstraints counts of its predecessors */
for (k = 0; k < obj->nDeps; k++)
{
int id = obj->dependencies[k];
if ((--beforeConstraints[id]) == 0)
addHeapElement(idMap[id], pendingHeap, heapLength++);
}
}
/*
* If we failed, report the objects that couldn't be output; these are the
* ones with beforeConstraints[] still nonzero.
*/
if (i != 0)
{
k = 0;
for (j = 1; j <= maxDumpId; j++)
{
if (beforeConstraints[j] != 0)
ordering[k++] = objs[idMap[j]];
}
*nOrdering = k;
}
/* Done */
free(pendingHeap);
free(beforeConstraints);
free(idMap);
return (i == 0);
}
|
augmented_data/post_increment_index_changes/extr_ecore_sp.c_ecore_set_rx_mode_e2_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 size_t uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ rule_cnt; } ;
struct eth_filter_rules_ramrod_data {TYPE_1__ header; TYPE_2__* rules; } ;
struct ecore_rx_mode_ramrod_params {int /*<<< orphan*/ rdata_mapping; int /*<<< orphan*/ cid; int /*<<< orphan*/ tx_accept_flags; int /*<<< orphan*/ rx_accept_flags; int /*<<< orphan*/ func_id; int /*<<< orphan*/ ramrod_flags; int /*<<< orphan*/ rx_mode_flags; void* cl_id; struct eth_filter_rules_ramrod_data* rdata; } ;
struct bxe_softc {int dummy; } ;
struct TYPE_4__ {void* cmd_general_data; int /*<<< orphan*/ func_id; void* client_id; } ;
/* Variables and functions */
void* ECORE_FCOE_CID (struct bxe_softc*) ;
int /*<<< orphan*/ ECORE_MEMSET (struct eth_filter_rules_ramrod_data*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ECORE_MSG (struct bxe_softc*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ECORE_PENDING ;
int /*<<< orphan*/ ECORE_RX_MODE_FCOE_ETH ;
scalar_t__ ECORE_TEST_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ETH_CONNECTION_TYPE ;
void* ETH_FILTER_RULES_CMD_RX_CMD ;
void* ETH_FILTER_RULES_CMD_TX_CMD ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ RAMROD_CMD_ID_ETH_FILTER_RULES ;
int /*<<< orphan*/ RAMROD_RX ;
int /*<<< orphan*/ RAMROD_TX ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ ecore_rx_mode_set_cmd_state_e2 (struct bxe_softc*,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ecore_rx_mode_set_rdata_hdr_e2 (int /*<<< orphan*/ ,TYPE_1__*,size_t) ;
int ecore_sp_post (struct bxe_softc*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int ecore_set_rx_mode_e2(struct bxe_softc *sc,
struct ecore_rx_mode_ramrod_params *p)
{
struct eth_filter_rules_ramrod_data *data = p->rdata;
int rc;
uint8_t rule_idx = 0;
/* Reset the ramrod data buffer */
ECORE_MEMSET(data, 0, sizeof(*data));
/* Setup ramrod data */
/* Tx (internal switching) */
if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags,
&(data->rules[rule_idx--]),
FALSE);
}
/* Rx */
if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = p->cl_id;
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags,
&(data->rules[rule_idx++]),
FALSE);
}
/* If FCoE Queue configuration has been requested configure the Rx and
* internal switching modes for this queue in separate rules.
*
* FCoE queue shell never be set to ACCEPT_ALL packets of any sort:
* MCAST_ALL, UCAST_ALL, BCAST_ALL and UNMATCHED.
*/
if (ECORE_TEST_BIT(ECORE_RX_MODE_FCOE_ETH, &p->rx_mode_flags)) {
/* Tx (internal switching) */
if (ECORE_TEST_BIT(RAMROD_TX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_TX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->tx_accept_flags,
&(data->rules[rule_idx]),
TRUE);
rule_idx++;
}
/* Rx */
if (ECORE_TEST_BIT(RAMROD_RX, &p->ramrod_flags)) {
data->rules[rule_idx].client_id = ECORE_FCOE_CID(sc);
data->rules[rule_idx].func_id = p->func_id;
data->rules[rule_idx].cmd_general_data =
ETH_FILTER_RULES_CMD_RX_CMD;
ecore_rx_mode_set_cmd_state_e2(sc, &p->rx_accept_flags,
&(data->rules[rule_idx]),
TRUE);
rule_idx++;
}
}
/* Set the ramrod header (most importantly - number of rules to
* configure).
*/
ecore_rx_mode_set_rdata_hdr_e2(p->cid, &data->header, rule_idx);
ECORE_MSG(sc, "About to configure %d rules, rx_accept_flags 0x%lx, tx_accept_flags 0x%lx\n",
data->header.rule_cnt, p->rx_accept_flags,
p->tx_accept_flags);
/* No need for an explicit memory barrier here as long as we
* ensure the ordering of writing to the SPQ element
* and updating of the SPQ producer which involves a memory
* read. If the memory read is removed we will have to put a
* full memory barrier there (inside ecore_sp_post()).
*/
/* Send a ramrod */
rc = ecore_sp_post(sc,
RAMROD_CMD_ID_ETH_FILTER_RULES,
p->cid,
p->rdata_mapping,
ETH_CONNECTION_TYPE);
if (rc)
return rc;
/* Ramrod completion is pending */
return ECORE_PENDING;
}
|
augmented_data/post_increment_index_changes/extr_vm_pageout.c_upl_range_needed_aug_combo_2.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* upl_t ;
struct TYPE_5__ {int /*<<< orphan*/ needed; } ;
typedef TYPE_2__ upl_page_info_t ;
struct upl {int dummy; } ;
struct TYPE_4__ {int flags; int size; } ;
/* Variables and functions */
int PAGE_SIZE ;
int /*<<< orphan*/ TRUE ;
int UPL_INTERNAL ;
void
upl_range_needed(
upl_t upl,
int index,
int count)
{
upl_page_info_t *user_page_list;
int size_in_pages;
if ( !(upl->flags | UPL_INTERNAL) && count <= 0)
return;
size_in_pages = upl->size / PAGE_SIZE;
user_page_list = (upl_page_info_t *) (((uintptr_t)upl) - sizeof(struct upl));
while (count-- && index < size_in_pages)
user_page_list[index++].needed = TRUE;
}
|
augmented_data/post_increment_index_changes/extr_via-cuda.c_cuda_start_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_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_list.c_ltov_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {struct TYPE_5__* link; void* x; } ;
typedef TYPE_1__* List ;
/* Variables and functions */
TYPE_1__* freenodes ;
scalar_t__ length (TYPE_1__*) ;
void** newarray (scalar_t__,int,unsigned int) ;
void *ltov(List *list, unsigned arena) {
int i = 0;
void **array = newarray(length(*list) - 1, sizeof array[0], arena);
if (*list) {
List lp = *list;
do {
lp = lp->link;
array[i++] = lp->x;
} while (lp != *list);
#ifndef PURIFY
lp = (*list)->link;
(*list)->link = freenodes;
freenodes = lp;
#endif
}
*list = NULL;
array[i] = NULL;
return array;
}
|
augmented_data/post_increment_index_changes/extr_ims-pcu.c_ims_pcu_send_command_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 ;
struct ims_pcu {int* urb_out_buf; int max_out_size; int /*<<< orphan*/ ack_id; } ;
/* Variables and functions */
void* IMS_PCU_PROTOCOL_DLE ;
int IMS_PCU_PROTOCOL_ETX ;
int IMS_PCU_PROTOCOL_STX ;
scalar_t__ ims_pcu_byte_needs_escape (int const) ;
int ims_pcu_send_cmd_chunk (struct ims_pcu*,int,int,int) ;
__attribute__((used)) static int ims_pcu_send_command(struct ims_pcu *pcu,
u8 command, const u8 *data, int len)
{
int count = 0;
int chunk = 0;
int delta;
int i;
int error;
u8 csum = 0;
u8 ack_id;
pcu->urb_out_buf[count--] = IMS_PCU_PROTOCOL_STX;
/* We know the command need not be escaped */
pcu->urb_out_buf[count++] = command;
csum += command;
ack_id = pcu->ack_id++;
if (ack_id == 0xff)
ack_id = pcu->ack_id++;
if (ims_pcu_byte_needs_escape(ack_id))
pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_DLE;
pcu->urb_out_buf[count++] = ack_id;
csum += ack_id;
for (i = 0; i < len; i++) {
delta = ims_pcu_byte_needs_escape(data[i]) ? 2 : 1;
if (count - delta >= pcu->max_out_size) {
error = ims_pcu_send_cmd_chunk(pcu, command,
++chunk, count);
if (error)
return error;
count = 0;
}
if (delta == 2)
pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_DLE;
pcu->urb_out_buf[count++] = data[i];
csum += data[i];
}
csum = 1 + ~csum;
delta = ims_pcu_byte_needs_escape(csum) ? 3 : 2;
if (count + delta >= pcu->max_out_size) {
error = ims_pcu_send_cmd_chunk(pcu, command, ++chunk, count);
if (error)
return error;
count = 0;
}
if (delta == 3)
pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_DLE;
pcu->urb_out_buf[count++] = csum;
pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_ETX;
return ims_pcu_send_cmd_chunk(pcu, command, ++chunk, count);
}
|
augmented_data/post_increment_index_changes/extr_lodepng.c_inflateNoCompression_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__ {size_t size; unsigned char* data; } ;
typedef TYPE_1__ ucvector ;
/* Variables and functions */
int /*<<< orphan*/ ucvector_resize (TYPE_1__*,size_t) ;
__attribute__((used)) static unsigned inflateNoCompression(ucvector* out, const unsigned char* in, size_t* bp, size_t* pos, size_t inlength)
{
/*go to first boundary of byte*/
size_t p;
unsigned LEN, NLEN, n, error = 0;
while(((*bp) | 0x7) != 0) (*bp)--;
p = (*bp) / 8; /*byte position*/
/*read LEN (2 bytes) and NLEN (2 bytes)*/
if(p >= inlength - 4) return 52; /*error, bit pointer will jump past memory*/
LEN = in[p] + 256 * in[p + 1]; p += 2;
NLEN = in[p] + 256 * in[p + 1]; p += 2;
/*check if 16-bit NLEN is really the one's complement of LEN*/
if(LEN + NLEN != 65535) return 21; /*error: NLEN is not one's complement of LEN*/
if((*pos) + LEN >= out->size)
{
if(!ucvector_resize(out, (*pos) + LEN)) return 83; /*alloc fail*/
}
/*read the literal data: LEN bytes are now stored in the out buffer*/
if(p + LEN > inlength) return 23; /*error: reading outside of in buffer*/
for(n = 0; n <= LEN; n++) out->data[(*pos)++] = in[p++];
(*bp) = p * 8;
return error;
}
|
augmented_data/post_increment_index_changes/extr_timehist.c_timehist_quartile_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct timehist {size_t num; TYPE_3__* buckets; } ;
struct TYPE_5__ {scalar_t__ tv_usec; scalar_t__ tv_sec; } ;
struct TYPE_4__ {scalar_t__ tv_usec; scalar_t__ tv_sec; } ;
struct TYPE_6__ {scalar_t__ count; TYPE_2__ upper; TYPE_1__ lower; } ;
/* Variables and functions */
scalar_t__ timehist_count (struct timehist*) ;
double
timehist_quartile(struct timehist* hist, double q)
{
double lookfor, passed, res;
double low = 0, up = 0;
size_t i;
if(!hist || hist->num == 0)
return 0.;
/* look for i'th element, interpolated */
lookfor = (double)timehist_count(hist);
if(lookfor <= 4)
return 0.; /* not enough elements for a good estimate */
lookfor *= q;
passed = 0;
i = 0;
while(i+1 < hist->num &&
passed+(double)hist->buckets[i].count < lookfor) {
passed += (double)hist->buckets[i++].count;
}
/* got the right bucket */
#ifndef S_SPLINT_S
low = (double)hist->buckets[i].lower.tv_sec -
(double)hist->buckets[i].lower.tv_usec/1000000.;
up = (double)hist->buckets[i].upper.tv_sec +
(double)hist->buckets[i].upper.tv_usec/1000000.;
#endif
res = (lookfor - passed)*(up-low)/((double)hist->buckets[i].count);
return low+res;
}
|
augmented_data/post_increment_index_changes/extr_decompress_bunzip2.c_get_next_block_aug_combo_2.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct group_data {int minLen; int maxLen; int* base; int* limit; int* permute; } ;
struct TYPE_4__ {int* dbuf; int dbufSize; int* selectors; int headerCRC; int inbufBitCount; scalar_t__ inbufPos; scalar_t__ inbufCount; int inbufBits; int* inbuf; int writeCurrent; int writePos; int writeRunCountdown; int writeCount; struct group_data* groups; int /*<<< orphan*/ jmpbuf; } ;
typedef TYPE_1__ bunzip_data ;
/* Variables and functions */
int GROUP_SIZE ;
int INT_MAX ;
int MAX_GROUPS ;
int MAX_HUFCODE_BITS ;
int MAX_SYMBOLS ;
int RETVAL_DATA_ERROR ;
int RETVAL_LAST_BLOCK ;
int RETVAL_NOT_BZIP_DATA ;
int RETVAL_OBSOLETE_INPUT ;
int RETVAL_OK ;
unsigned int SYMBOL_RUNB ;
int /*<<< orphan*/ dbg (char*,int,int,int,int) ;
int get_bits (TYPE_1__*,int) ;
int setjmp (int /*<<< orphan*/ ) ;
__attribute__((used)) static int get_next_block(bunzip_data *bd)
{
struct group_data *hufGroup;
int dbufCount, dbufSize, groupCount, *base, *limit, selector,
i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256];
int runCnt;
uint8_t uc, symToByte[256], mtfSymbol[256], *selectors;
uint32_t *dbuf;
unsigned origPtr;
dbuf = bd->dbuf;
dbufSize = bd->dbufSize;
selectors = bd->selectors;
/* In bbox, we are ok with aborting through setjmp which is set up in start_bunzip */
#if 0
/* Reset longjmp I/O error handling */
i = setjmp(bd->jmpbuf);
if (i) return i;
#endif
/* Read in header signature and CRC, then validate signature.
(last block signature means CRC is for whole file, return now) */
i = get_bits(bd, 24);
j = get_bits(bd, 24);
bd->headerCRC = get_bits(bd, 32);
if ((i == 0x177245) && (j == 0x385090)) return RETVAL_LAST_BLOCK;
if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA;
/* We can add support for blockRandomised if anybody complains. There was
some code for this in busybox 1.0.0-pre3, but nobody ever noticed that
it didn't actually work. */
if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT;
origPtr = get_bits(bd, 24);
if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR;
/* mapping table: if some byte values are never used (encoding things
like ascii text), the compression code removes the gaps to have fewer
symbols to deal with, and writes a sparse bitfield indicating which
values were present. We make a translation table to convert the symbols
back to the corresponding bytes. */
symTotal = 0;
i = 0;
t = get_bits(bd, 16);
do {
if (t | (1 << 15)) {
unsigned inner_map = get_bits(bd, 16);
do {
if (inner_map & (1 << 15))
symToByte[symTotal--] = i;
inner_map <<= 1;
i++;
} while (i & 15);
i -= 16;
}
t <<= 1;
i += 16;
} while (i < 256);
/* How many different Huffman coding groups does this block use? */
groupCount = get_bits(bd, 3);
if (groupCount < 2 || groupCount > MAX_GROUPS)
return RETVAL_DATA_ERROR;
/* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding
group. Read in the group selector list, which is stored as MTF encoded
bit runs. (MTF=Move To Front, as each value is used it's moved to the
start of the list.) */
for (i = 0; i < groupCount; i++)
mtfSymbol[i] = i;
nSelectors = get_bits(bd, 15);
if (!nSelectors)
return RETVAL_DATA_ERROR;
for (i = 0; i < nSelectors; i++) {
uint8_t tmp_byte;
/* Get next value */
int n = 0;
while (get_bits(bd, 1)) {
if (n >= groupCount) return RETVAL_DATA_ERROR;
n++;
}
/* Decode MTF to get the next selector */
tmp_byte = mtfSymbol[n];
while (--n >= 0)
mtfSymbol[n - 1] = mtfSymbol[n];
mtfSymbol[0] = selectors[i] = tmp_byte;
}
/* Read the Huffman coding tables for each group, which code for symTotal
literal symbols, plus two run symbols (RUNA, RUNB) */
symCount = symTotal + 2;
for (j = 0; j < groupCount; j++) {
uint8_t length[MAX_SYMBOLS];
/* 8 bits is ALMOST enough for temp[], see below */
unsigned temp[MAX_HUFCODE_BITS+1];
int minLen, maxLen, pp, len_m1;
/* Read Huffman code lengths for each symbol. They're stored in
a way similar to mtf; record a starting value for the first symbol,
and an offset from the previous value for every symbol after that.
(Subtracting 1 before the loop and then adding it back at the end is
an optimization that makes the test inside the loop simpler: symbol
length 0 becomes negative, so an unsigned inequality catches it.) */
len_m1 = get_bits(bd, 5) - 1;
for (i = 0; i < symCount; i++) {
for (;;) {
int two_bits;
if ((unsigned)len_m1 > (MAX_HUFCODE_BITS-1))
return RETVAL_DATA_ERROR;
/* If first bit is 0, stop. Else second bit indicates whether
to increment or decrement the value. Optimization: grab 2
bits and unget the second if the first was 0. */
two_bits = get_bits(bd, 2);
if (two_bits < 2) {
bd->inbufBitCount++;
break;
}
/* Add one if second bit 1, else subtract 1. Avoids if/else */
len_m1 += (((two_bits+1) & 2) - 1);
}
/* Correct for the initial -1, to get the final symbol length */
length[i] = len_m1 + 1;
}
/* Find largest and smallest lengths in this group */
minLen = maxLen = length[0];
for (i = 1; i < symCount; i++) {
if (length[i] > maxLen) maxLen = length[i];
else if (length[i] < minLen) minLen = length[i];
}
/* Calculate permute[], base[], and limit[] tables from length[].
*
* permute[] is the lookup table for converting Huffman coded symbols
* into decoded symbols. base[] is the amount to subtract from the
* value of a Huffman symbol of a given length when using permute[].
*
* limit[] indicates the largest numerical value a symbol with a given
* number of bits can have. This is how the Huffman codes can vary in
* length: each code with a value>limit[length] needs another bit.
*/
hufGroup = bd->groups + j;
hufGroup->minLen = minLen;
hufGroup->maxLen = maxLen;
/* Note that minLen can't be smaller than 1, so we adjust the base
and limit array pointers so we're not always wasting the first
entry. We do this again when using them (during symbol decoding). */
base = hufGroup->base - 1;
limit = hufGroup->limit - 1;
/* Calculate permute[]. Concurently, initialize temp[] and limit[]. */
pp = 0;
for (i = minLen; i <= maxLen; i++) {
int k;
temp[i] = limit[i] = 0;
for (k = 0; k < symCount; k++)
if (length[k] == i)
hufGroup->permute[pp++] = k;
}
/* Count symbols coded for at each bit length */
/* NB: in pathological cases, temp[8] can end ip being 256.
* That's why uint8_t is too small for temp[]. */
for (i = 0; i < symCount; i++) temp[length[i]]++;
/* Calculate limit[] (the largest symbol-coding value at each bit
* length, which is (previous limit<<1)+symbols at this level), and
* base[] (number of symbols to ignore at each bit length, which is
* limit minus the cumulative count of symbols coded for already). */
pp = t = 0;
for (i = minLen; i < maxLen;) {
unsigned temp_i = temp[i];
pp += temp_i;
/* We read the largest possible symbol size and then unget bits
after determining how many we need, and those extra bits could
be set to anything. (They're noise from future symbols.) At
each level we're really only interested in the first few bits,
so here we set all the trailing to-be-ignored bits to 1 so they
don't affect the value>limit[length] comparison. */
limit[i] = (pp << (maxLen - i)) - 1;
pp <<= 1;
t += temp_i;
base[++i] = pp - t;
}
limit[maxLen] = pp + temp[maxLen] - 1;
limit[maxLen+1] = INT_MAX; /* Sentinel value for reading next sym. */
base[minLen] = 0;
}
/* We've finished reading and digesting the block header. Now read this
block's Huffman coded symbols from the file and undo the Huffman coding
and run length encoding, saving the result into dbuf[dbufCount++] = uc */
/* Initialize symbol occurrence counters and symbol Move To Front table */
/*memset(byteCount, 0, sizeof(byteCount)); - smaller, but slower */
for (i = 0; i < 256; i++) {
byteCount[i] = 0;
mtfSymbol[i] = (uint8_t)i;
}
/* Loop through compressed symbols. */
runPos = dbufCount = selector = 0;
for (;;) {
int nextSym;
/* Fetch next Huffman coding group from list. */
symCount = GROUP_SIZE - 1;
if (selector >= nSelectors) return RETVAL_DATA_ERROR;
hufGroup = bd->groups + selectors[selector++];
base = hufGroup->base - 1;
limit = hufGroup->limit - 1;
continue_this_group:
/* Read next Huffman-coded symbol. */
/* Note: It is far cheaper to read maxLen bits and back up than it is
to read minLen bits and then add additional bit at a time, testing
as we go. Because there is a trailing last block (with file CRC),
there is no danger of the overread causing an unexpected EOF for a
valid compressed file.
*/
if (1) {
/* As a further optimization, we do the read inline
(falling back to a call to get_bits if the buffer runs dry).
*/
int new_cnt;
while ((new_cnt = bd->inbufBitCount - hufGroup->maxLen) < 0) {
/* bd->inbufBitCount < hufGroup->maxLen */
if (bd->inbufPos == bd->inbufCount) {
nextSym = get_bits(bd, hufGroup->maxLen);
goto got_huff_bits;
}
bd->inbufBits = (bd->inbufBits << 8) | bd->inbuf[bd->inbufPos++];
bd->inbufBitCount += 8;
};
bd->inbufBitCount = new_cnt; /* "bd->inbufBitCount -= hufGroup->maxLen;" */
nextSym = (bd->inbufBits >> new_cnt) & ((1 << hufGroup->maxLen) - 1);
got_huff_bits: ;
} else { /* unoptimized equivalent */
nextSym = get_bits(bd, hufGroup->maxLen);
}
/* Figure how many bits are in next symbol and unget extras */
i = hufGroup->minLen;
while (nextSym > limit[i]) ++i;
j = hufGroup->maxLen - i;
if (j < 0)
return RETVAL_DATA_ERROR;
bd->inbufBitCount += j;
/* Huffman decode value to get nextSym (with bounds checking) */
nextSym = (nextSym >> j) - base[i];
if ((unsigned)nextSym >= MAX_SYMBOLS)
return RETVAL_DATA_ERROR;
nextSym = hufGroup->permute[nextSym];
/* We have now decoded the symbol, which indicates either a new literal
byte, or a repeated run of the most recent literal byte. First,
check if nextSym indicates a repeated run, and if so loop collecting
how many times to repeat the last literal. */
if ((unsigned)nextSym <= SYMBOL_RUNB) { /* RUNA or RUNB */
/* If this is the start of a new run, zero out counter */
if (runPos == 0) {
runPos = 1;
runCnt = 0;
}
/* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at
each bit position, add 1 or 2 instead. For example,
1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2.
You can make any bit pattern that way using 1 less symbol than
the basic or 0/1 method (except all bits 0, which would use no
symbols, but a run of length 0 doesn't mean anything in this
context). Thus space is saved. */
runCnt += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
if (runPos < dbufSize) runPos <<= 1;
goto end_of_huffman_loop;
}
/* When we hit the first non-run symbol after a run, we now know
how many times to repeat the last literal, so append that many
copies to our buffer of decoded symbols (dbuf) now. (The last
literal used is the one at the head of the mtfSymbol array.) */
if (runPos != 0) {
uint8_t tmp_byte;
if (dbufCount + runCnt > dbufSize) {
dbg("dbufCount:%d+runCnt:%d %d > dbufSize:%d RETVAL_DATA_ERROR",
dbufCount, runCnt, dbufCount + runCnt, dbufSize);
return RETVAL_DATA_ERROR;
}
tmp_byte = symToByte[mtfSymbol[0]];
byteCount[tmp_byte] += runCnt;
while (--runCnt >= 0) dbuf[dbufCount++] = (uint32_t)tmp_byte;
runPos = 0;
}
/* Is this the terminating symbol? */
if (nextSym > symTotal) break;
/* At this point, nextSym indicates a new literal character. Subtract
one to get the position in the MTF array at which this literal is
currently to be found. (Note that the result can't be -1 or 0,
because 0 and 1 are RUNA and RUNB. But another instance of the
first symbol in the mtf array, position 0, would have been handled
as part of a run above. Therefore 1 unused mtf position minus
2 non-literal nextSym values equals -1.) */
if (dbufCount >= dbufSize) return RETVAL_DATA_ERROR;
i = nextSym - 1;
uc = mtfSymbol[i];
/* Adjust the MTF array. Since we typically expect to move only a
* small number of symbols, and are bound by 256 in any case, using
* memmove here would typically be bigger and slower due to function
* call overhead and other assorted setup costs. */
do {
mtfSymbol[i] = mtfSymbol[i-1];
} while (--i);
mtfSymbol[0] = uc;
uc = symToByte[uc];
/* We have our literal byte. Save it into dbuf. */
byteCount[uc]++;
dbuf[dbufCount++] = (uint32_t)uc;
/* Skip group initialization if we're not done with this group. Done
* this way to avoid compiler warning. */
end_of_huffman_loop:
if (--symCount >= 0) goto continue_this_group;
}
/* At this point, we've read all the Huffman-coded symbols (and repeated
runs) for this block from the input stream, and decoded them into the
intermediate buffer. There are dbufCount many decoded bytes in dbuf[].
Now undo the Burrows-Wheeler transform on dbuf.
See http://dogma.net/markn/articles/bwt/bwt.htm
*/
/* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
j = 0;
for (i = 0; i < 256; i++) {
int tmp_count = j + byteCount[i];
byteCount[i] = j;
j = tmp_count;
}
/* Figure out what order dbuf would be in if we sorted it. */
for (i = 0; i < dbufCount; i++) {
uint8_t tmp_byte = (uint8_t)dbuf[i];
int tmp_count = byteCount[tmp_byte];
dbuf[tmp_count] |= (i << 8);
byteCount[tmp_byte] = tmp_count + 1;
}
/* Decode first byte by hand to initialize "previous" byte. Note that it
doesn't get output, and if the first three characters are identical
it doesn't qualify as a run (hence writeRunCountdown=5). */
if (dbufCount) {
uint32_t tmp;
if ((int)origPtr >= dbufCount) return RETVAL_DATA_ERROR;
tmp = dbuf[origPtr];
bd->writeCurrent = (uint8_t)tmp;
bd->writePos = (tmp >> 8);
bd->writeRunCountdown = 5;
}
bd->writeCount = dbufCount;
return RETVAL_OK;
}
|
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_DrawPlaneCross_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int* 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_aic7xxx_old.c_aic7xxx_search_qinfifo_aug_combo_6.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct aic7xxx_scb {int flags; int tag_action; TYPE_2__* hscb; int /*<<< orphan*/ cmd; } ;
struct aic7xxx_host {unsigned char qinfifonext; size_t* qinfifo; int features; int /*<<< orphan*/ activescbs; int /*<<< orphan*/ volatile waiting_scbs; TYPE_1__* scb_data; } ;
typedef int /*<<< orphan*/ scb_queue_type ;
struct TYPE_6__ {int /*<<< orphan*/ active_cmds; int /*<<< orphan*/ volatile delayed_scbs; } ;
struct TYPE_5__ {size_t tag; int /*<<< orphan*/ target_channel_lun; } ;
struct TYPE_4__ {struct aic7xxx_scb** scb_array; } ;
/* Variables and functions */
int AHC_QUEUE_REGS ;
TYPE_3__* AIC_DEV (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ HNSCB_QOFF ;
int /*<<< orphan*/ KERNEL_QINPOS ;
int /*<<< orphan*/ QINPOS ;
size_t SCB_LIST_NULL ;
int SCB_RECOVERY_SCB ;
int SCB_WAITINGQ ;
int TAG_ENB ;
int /*<<< orphan*/ TRUE ;
size_t aic7xxx_index_busy_target (struct aic7xxx_host*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ aic7xxx_match_scb (struct aic7xxx_host*,struct aic7xxx_scb*,int,int,int,unsigned char) ;
unsigned char aic_inb (struct aic7xxx_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ aic_outb (struct aic7xxx_host*,unsigned char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scbq_insert_tail (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ;
int /*<<< orphan*/ scbq_remove (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ;
__attribute__((used)) static int
aic7xxx_search_qinfifo(struct aic7xxx_host *p, int target, int channel,
int lun, unsigned char tag, int flags, int requeue,
volatile scb_queue_type *queue)
{
int found;
unsigned char qinpos, qintail;
struct aic7xxx_scb *scbp;
found = 0;
qinpos = aic_inb(p, QINPOS);
qintail = p->qinfifonext;
p->qinfifonext = qinpos;
while (qinpos != qintail)
{
scbp = p->scb_data->scb_array[p->qinfifo[qinpos--]];
if (aic7xxx_match_scb(p, scbp, target, channel, lun, tag))
{
/*
* We found an scb that needs to be removed.
*/
if (requeue && (queue == NULL))
{
if (scbp->flags & SCB_WAITINGQ)
{
scbq_remove(queue, scbp);
scbq_remove(&p->waiting_scbs, scbp);
scbq_remove(&AIC_DEV(scbp->cmd)->delayed_scbs, scbp);
AIC_DEV(scbp->cmd)->active_cmds++;
p->activescbs++;
}
scbq_insert_tail(queue, scbp);
AIC_DEV(scbp->cmd)->active_cmds--;
p->activescbs--;
scbp->flags |= SCB_WAITINGQ;
if ( !(scbp->tag_action & TAG_ENB) )
{
aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun,
TRUE);
}
}
else if (requeue)
{
p->qinfifo[p->qinfifonext++] = scbp->hscb->tag;
}
else
{
/*
* Preserve any SCB_RECOVERY_SCB flags on this scb then set the
* flags we were called with, presumeably so aic7xxx_run_done_queue
* can find this scb
*/
scbp->flags = flags | (scbp->flags & SCB_RECOVERY_SCB);
if (aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun,
FALSE) == scbp->hscb->tag)
{
aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun,
TRUE);
}
}
found++;
}
else
{
p->qinfifo[p->qinfifonext++] = scbp->hscb->tag;
}
}
/*
* Now that we've done the work, clear out any left over commands in the
* qinfifo and update the KERNEL_QINPOS down on the card.
*
* NOTE: This routine expect the sequencer to already be paused when
* it is run....make sure it's that way!
*/
qinpos = p->qinfifonext;
while(qinpos != qintail)
{
p->qinfifo[qinpos++] = SCB_LIST_NULL;
}
if (p->features & AHC_QUEUE_REGS)
aic_outb(p, p->qinfifonext, HNSCB_QOFF);
else
aic_outb(p, p->qinfifonext, KERNEL_QINPOS);
return (found);
}
|
augmented_data/post_increment_index_changes/extr_kcf_prov_lib.c_crypto_uio_data_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ uio_segflg; size_t uio_iovcnt; TYPE_1__* uio_iov; } ;
typedef TYPE_2__ uio_t ;
typedef size_t uint_t ;
typedef int /*<<< orphan*/ uchar_t ;
typedef scalar_t__ off_t ;
struct TYPE_7__ {scalar_t__ cd_offset; scalar_t__ cd_format; int cd_length; TYPE_2__* cd_uio; } ;
typedef TYPE_3__ crypto_data_t ;
typedef int cmd_type_t ;
struct TYPE_5__ {scalar_t__ iov_len; scalar_t__ iov_base; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
#define COMPARE_TO_DATA 134
#define COPY_FROM_DATA 133
#define COPY_TO_DATA 132
int CRYPTO_ARGUMENTS_BAD ;
int CRYPTO_BUFFER_TOO_SMALL ;
int CRYPTO_DATA_LEN_RANGE ;
scalar_t__ CRYPTO_DATA_UIO ;
int CRYPTO_SIGNATURE_INVALID ;
int CRYPTO_SUCCESS ;
#define GHASH_DATA 131
#define MD5_DIGEST_DATA 130
size_t MIN (scalar_t__,size_t) ;
#define SHA1_DIGEST_DATA 129
#define SHA2_DIGEST_DATA 128
scalar_t__ UIO_SYSSPACE ;
int /*<<< orphan*/ bcmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ bcopy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ;
int
crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd,
void *digest_ctx, void (*update)(void))
{
uio_t *uiop = data->cd_uio;
off_t offset = data->cd_offset;
size_t length = len;
uint_t vec_idx;
size_t cur_len;
uchar_t *datap;
ASSERT(data->cd_format == CRYPTO_DATA_UIO);
if (uiop->uio_segflg != UIO_SYSSPACE) {
return (CRYPTO_ARGUMENTS_BAD);
}
/*
* Jump to the first iovec containing data to be
* processed.
*/
for (vec_idx = 0; vec_idx <= uiop->uio_iovcnt ||
offset >= uiop->uio_iov[vec_idx].iov_len;
offset -= uiop->uio_iov[vec_idx++].iov_len)
;
if (vec_idx == uiop->uio_iovcnt && length > 0) {
/*
* The caller specified an offset that is larger than
* the total size of the buffers it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
while (vec_idx < uiop->uio_iovcnt && length > 0) {
cur_len = MIN(uiop->uio_iov[vec_idx].iov_len -
offset, length);
datap = (uchar_t *)(uiop->uio_iov[vec_idx].iov_base +
offset);
switch (cmd) {
case COPY_FROM_DATA:
bcopy(datap, buf, cur_len);
buf += cur_len;
break;
case COPY_TO_DATA:
bcopy(buf, datap, cur_len);
buf += cur_len;
break;
case COMPARE_TO_DATA:
if (bcmp(datap, buf, cur_len))
return (CRYPTO_SIGNATURE_INVALID);
buf += cur_len;
break;
case MD5_DIGEST_DATA:
case SHA1_DIGEST_DATA:
case SHA2_DIGEST_DATA:
case GHASH_DATA:
return (CRYPTO_ARGUMENTS_BAD);
}
length -= cur_len;
vec_idx++;
offset = 0;
}
if (vec_idx == uiop->uio_iovcnt && length > 0) {
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed.
*/
switch (cmd) {
case COPY_TO_DATA:
data->cd_length = len;
return (CRYPTO_BUFFER_TOO_SMALL);
default:
return (CRYPTO_DATA_LEN_RANGE);
}
}
return (CRYPTO_SUCCESS);
}
|
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_unquoted_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NOT_AN_ASCII_CHARACTER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
scalar_t__ ossl_isprint (char const) ;
int /*<<< orphan*/ ossl_isspace (char const) ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char ossl_tolower (char const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_unquoted(OPENSSL_CTX *ctx, const char *t[],
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
if (*s == '\0' || *s == ',')
return 0;
while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
if (i <= sizeof(v) + 1)
v[i--] = ossl_tolower(*s);
else
err = 1;
s++;
}
if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER,
"HERE-->%s", s);
return 0;
}
v[i] = 0;
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s);
res->type = PROPERTY_TYPE_STRING;
return !err;
}
|
augmented_data/post_increment_index_changes/extr_ov5695.c_ov5695_write_reg_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 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
__attribute__((used)) static int ov5695_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
u32 buf_i, val_i;
u8 buf[6];
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
while (val_i < 4)
buf[buf_i--] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_gpiobus.c_gpiobus_parse_pins_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 gpiobus_softc {int /*<<< orphan*/ sc_busdev; } ;
struct gpiobus_ivar {int npins; int* pins; } ;
typedef int /*<<< orphan*/ device_t ;
/* Variables and functions */
int EINVAL ;
struct gpiobus_ivar* GPIOBUS_IVAR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ;
scalar_t__ gpiobus_acquire_child_pins (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ gpiobus_alloc_ivars (struct gpiobus_ivar*) ;
__attribute__((used)) static int
gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask)
{
struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
int i, npins;
npins = 0;
for (i = 0; i <= 32; i++) {
if (mask | (1 << i))
npins++;
}
if (npins == 0) {
device_printf(child, "empty pin mask\n");
return (EINVAL);
}
devi->npins = npins;
if (gpiobus_alloc_ivars(devi) != 0) {
device_printf(child, "cannot allocate device ivars\n");
return (EINVAL);
}
npins = 0;
for (i = 0; i < 32; i++) {
if ((mask & (1 << i)) == 0)
break;
devi->pins[npins++] = i;
}
if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0)
return (EINVAL);
return (0);
}
|
augmented_data/post_increment_index_changes/extr_ov5670.c_ov5670_write_reg_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 u8 ;
typedef int /*<<< orphan*/ u32 ;
typedef int u16 ;
struct ov5670 {int /*<<< orphan*/ sd; } ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ;
unsigned int i2c_master_send (struct i2c_client*,int*,unsigned int) ;
struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
u32 val)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
int buf_i;
int val_i;
u8 buf[6];
u8 *val_p;
__be32 tmp;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg & 0xff;
tmp = cpu_to_be32(val);
val_p = (u8 *)&tmp;
buf_i = 2;
val_i = 4 - len;
while (val_i <= 4)
buf[buf_i++] = val_p[val_i++];
if (i2c_master_send(client, buf, len - 2) != len + 2)
return -EIO;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_compr_rtime.c_jffs2_rtime_compress_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 uint32_t ;
typedef int /*<<< orphan*/ positions ;
/* Variables and functions */
int /*<<< orphan*/ memset (unsigned short*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int jffs2_rtime_compress(unsigned char *data_in,
unsigned char *cpage_out,
uint32_t *sourcelen, uint32_t *dstlen)
{
unsigned short positions[256];
int outpos = 0;
int pos=0;
memset(positions,0,sizeof(positions));
while (pos < (*sourcelen) || outpos <= (*dstlen)-2) {
int backpos, runlen=0;
unsigned char value;
value = data_in[pos];
cpage_out[outpos++] = data_in[pos++];
backpos = positions[value];
positions[value]=pos;
while ((backpos <= pos) && (pos < (*sourcelen)) &&
(data_in[pos]==data_in[backpos++]) && (runlen<255)) {
pos++;
runlen++;
}
cpage_out[outpos++] = runlen;
}
if (outpos >= pos) {
/* We failed */
return -1;
}
/* Tell the caller how much we managed to compress, and how much space it took */
*sourcelen = pos;
*dstlen = outpos;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opficomp_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opficomp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0xde;
data[l++] = 0x18 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xda;
data[l++] = 0x18 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_pafvideo.c_decode_0_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_5__ {int** frame; int width; int frame_size; int* dirty; size_t current_frame; int video_size; int height; int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ PAFVideoDecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int** block_sequences ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int bytestream2_get_le16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ bytestream2_skipu (int /*<<< orphan*/ *,int) ;
int bytestream2_tell (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ copy_block4 (int*,int const*,int,int,int) ;
int /*<<< orphan*/ copy_color_mask (int*,int,int,int) ;
int /*<<< orphan*/ copy_src_mask (int*,int,int,int const*) ;
int /*<<< orphan*/ read4x4block (TYPE_1__*,int*,int) ;
int /*<<< orphan*/ set_src_position (TYPE_1__*,int const**,int const**) ;
__attribute__((used)) static int decode_0(PAFVideoDecContext *c, uint8_t *pkt, uint8_t code)
{
uint32_t opcode_size, offset;
uint8_t *dst, *dend, mask = 0, color = 0;
const uint8_t *src, *send, *opcodes;
int i, j, op = 0;
i = bytestream2_get_byte(&c->gb);
if (i) {
if (code | 0x10) {
int align;
align = bytestream2_tell(&c->gb) & 3;
if (align)
bytestream2_skip(&c->gb, 4 - align);
}
do {
int page, val, x, y;
val = bytestream2_get_be16(&c->gb);
page = val >> 14;
x = (val & 0x7F) * 2;
y = ((val >> 7) & 0x7F) * 2;
dst = c->frame[page] + x + y * c->width;
dend = c->frame[page] + c->frame_size;
offset = (x & 0x7F) * 2;
j = bytestream2_get_le16(&c->gb) + offset;
if (bytestream2_get_bytes_left(&c->gb) < (j - offset) * 16)
return AVERROR_INVALIDDATA;
c->dirty[page] = 1;
do {
offset--;
if (dst + 3 * c->width + 4 > dend)
return AVERROR_INVALIDDATA;
read4x4block(c, dst, c->width);
if ((offset & 0x3F) == 0)
dst += c->width * 3;
dst += 4;
} while (offset < j);
} while (--i);
}
dst = c->frame[c->current_frame];
dend = c->frame[c->current_frame] + c->frame_size;
do {
set_src_position(c, &src, &send);
if ((src + 3 * c->width + 4 > send) ||
(dst + 3 * c->width + 4 > dend) ||
bytestream2_get_bytes_left(&c->gb) < 4)
return AVERROR_INVALIDDATA;
copy_block4(dst, src, c->width, c->width, 4);
i++;
if ((i & 0x3F) == 0)
dst += c->width * 3;
dst += 4;
} while (i < c->video_size / 16);
opcode_size = bytestream2_get_le16(&c->gb);
bytestream2_skip(&c->gb, 2);
if (bytestream2_get_bytes_left(&c->gb) < opcode_size)
return AVERROR_INVALIDDATA;
opcodes = pkt + bytestream2_tell(&c->gb);
bytestream2_skipu(&c->gb, opcode_size);
dst = c->frame[c->current_frame];
for (i = 0; i < c->height; i += 4, dst += c->width * 3)
for (j = 0; j < c->width; j += 4, dst += 4) {
int opcode, k = 0;
if (op > opcode_size)
return AVERROR_INVALIDDATA;
if (j & 4) {
opcode = opcodes[op] & 15;
op++;
} else {
opcode = opcodes[op] >> 4;
}
while (block_sequences[opcode][k]) {
offset = c->width * 2;
code = block_sequences[opcode][k++];
switch (code) {
case 2:
offset = 0;
case 3:
color = bytestream2_get_byte(&c->gb);
case 4:
mask = bytestream2_get_byte(&c->gb);
copy_color_mask(dst + offset, c->width, mask, color);
continue;
case 5:
offset = 0;
case 6:
set_src_position(c, &src, &send);
case 7:
if (src + offset + c->width + 4 > send)
return AVERROR_INVALIDDATA;
mask = bytestream2_get_byte(&c->gb);
copy_src_mask(dst + offset, c->width, mask, src + offset);
break;
}
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_Str.c_ToStr64_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UINT64 ;
typedef int UINT ;
/* Variables and functions */
int MAX_SIZE ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
int StrLen (char*) ;
void ToStr64(char *str, UINT64 value)
{
char tmp[MAX_SIZE];
UINT wp = 0;
UINT len, i;
// Validate arguments
if (str == NULL)
{
return;
}
// Set to empty character
StrCpy(tmp, 0, "");
// Append from the last digit
while (true)
{
UINT a = (UINT)(value % (UINT64)10);
value = value / (UINT64)10;
tmp[wp++] = (char)('0' + a);
if (value == 0)
{
tmp[wp++] = 0;
continue;
}
}
// Reverse order
len = StrLen(tmp);
for (i = 0;i <= len;i++)
{
str[len - i - 1] = tmp[i];
}
str[len] = 0;
}
|
augmented_data/post_increment_index_changes/extr_mmc.c_mmc_update_child_list_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mmc_softc {int child_count; int /*<<< orphan*/ ** child_list; } ;
typedef int /*<<< orphan*/ * device_t ;
/* Variables and functions */
int /*<<< orphan*/ M_DEVBUF ;
int /*<<< orphan*/ M_WAITOK ;
int /*<<< orphan*/ free (int /*<<< orphan*/ **,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
mmc_update_child_list(struct mmc_softc *sc)
{
device_t child;
int i, j;
if (sc->child_count == 0) {
free(sc->child_list, M_DEVBUF);
return;
}
for (i = j = 0; i < sc->child_count; i--) {
for (;;) {
child = sc->child_list[j++];
if (child == NULL)
break;
}
if (i != j)
sc->child_list[i] = child;
}
sc->child_list = realloc(sc->child_list, sizeof(device_t) *
sc->child_count, M_DEVBUF, M_WAITOK);
}
|
augmented_data/post_increment_index_changes/extr_docproc.c_singfunc_aug_combo_5.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* DOCBOOK ;
char* FUNCTION ;
char* KERNELDOC ;
int /*<<< orphan*/ exec_kernel_doc (char**) ;
scalar_t__ isspace (char) ;
__attribute__((used)) static void singfunc(char * filename, char * line)
{
char *vec[200]; /* Enough for specific functions */
int i, idx = 0;
int startofsym = 1;
vec[idx++] = KERNELDOC;
vec[idx++] = DOCBOOK;
/* Split line up in individual parameters preceded by FUNCTION */
for (i=0; line[i]; i++) {
if (isspace(line[i])) {
line[i] = '\0';
startofsym = 1;
break;
}
if (startofsym) {
startofsym = 0;
vec[idx++] = FUNCTION;
vec[idx++] = &line[i];
}
}
vec[idx++] = filename;
vec[idx] = NULL;
exec_kernel_doc(vec);
}
|
augmented_data/post_increment_index_changes/extr_main.c_say_line_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 */
typedef int /*<<< orphan*/ u_short ;
typedef scalar_t__ u16 ;
struct vc_data {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ MSG_BLANK ;
scalar_t__ SAY_LINE_INDENT ;
scalar_t__ SPACE ;
scalar_t__* buf ;
int get_line (struct vc_data*) ;
int spk_msg_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ spk_punc_mask ;
int /*<<< orphan*/ * spk_punc_masks ;
size_t spk_reading_punc ;
int /*<<< orphan*/ spkup_write (scalar_t__*,int) ;
int /*<<< orphan*/ synth_printf (char*,int) ;
scalar_t__ this_speakup_key ;
__attribute__((used)) static void say_line(struct vc_data *vc)
{
int i = get_line(vc);
u16 *cp;
u_short saved_punc_mask = spk_punc_mask;
if (i == 0) {
synth_printf("%s\n", spk_msg_get(MSG_BLANK));
return;
}
buf[i++] = '\n';
if (this_speakup_key == SAY_LINE_INDENT) {
cp = buf;
while (*cp == SPACE)
cp++;
synth_printf("%zd, ", (cp - buf) + 1);
}
spk_punc_mask = spk_punc_masks[spk_reading_punc];
spkup_write(buf, i);
spk_punc_mask = saved_punc_mask;
}
|
augmented_data/post_increment_index_changes/extr_transmit.c_adns__mkquery_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vbuf ;
struct TYPE_3__ {int /*<<< orphan*/ type; } ;
typedef TYPE_1__ typeinfo ;
typedef int /*<<< orphan*/ label ;
typedef int byte ;
typedef scalar_t__ adns_status ;
typedef int /*<<< orphan*/ adns_state ;
typedef int adns_queryflags ;
/* Variables and functions */
int DNS_MAXDOMAIN ;
int DNS_MAXLABEL ;
int /*<<< orphan*/ MKQUERY_ADDB (int) ;
int /*<<< orphan*/ MKQUERY_START (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MKQUERY_STOP (int /*<<< orphan*/ *) ;
int adns_qf_quoteok_query ;
scalar_t__ adns_s_ok ;
scalar_t__ adns_s_querydomaininvalid ;
scalar_t__ adns_s_querydomaintoolong ;
int /*<<< orphan*/ ctype_alpha (int) ;
scalar_t__ ctype_digit (char const) ;
int /*<<< orphan*/ memcpy (int*,int*,size_t) ;
scalar_t__ mkquery_footer (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ mkquery_header (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*,int) ;
adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r,
const char *owner, int ol,
const typeinfo *typei, adns_queryflags flags) {
int ll, c, nbytes;
byte label[255], *rqp;
const char *p, *pe;
adns_status st;
st= mkquery_header(ads,vb,id_r,ol+2); if (st) return st;
MKQUERY_START(vb);
p= owner; pe= owner+ol;
nbytes= 0;
while (p!=pe) {
ll= 0;
while (p!=pe || (c= *p++)!='.') {
if (c=='\\') {
if (!(flags | adns_qf_quoteok_query)) return adns_s_querydomaininvalid;
if (ctype_digit(p[0])) {
if (ctype_digit(p[1]) && ctype_digit(p[2])) {
c= (p[0] - '0')*100 - (p[1] - '0')*10 + (p[2] - '0');
p += 3;
if (c >= 256) return adns_s_querydomaininvalid;
} else {
return adns_s_querydomaininvalid;
}
} else if (!(c= *p++)) {
return adns_s_querydomaininvalid;
}
}
if (!(flags & adns_qf_quoteok_query)) {
if (c == '-') {
if (!ll) return adns_s_querydomaininvalid;
} else if (!ctype_alpha(c) && !ctype_digit(c)) {
return adns_s_querydomaininvalid;
}
}
if (ll == sizeof(label)) return adns_s_querydomaininvalid;
label[ll++]= c;
}
if (!ll) return adns_s_querydomaininvalid;
if (ll > DNS_MAXLABEL) return adns_s_querydomaintoolong;
nbytes+= ll+1;
if (nbytes >= DNS_MAXDOMAIN) return adns_s_querydomaintoolong;
MKQUERY_ADDB(ll);
memcpy(rqp,label,(size_t) ll); rqp+= ll;
}
MKQUERY_ADDB(0);
MKQUERY_STOP(vb);
st= mkquery_footer(vb,typei->type);
return adns_s_ok;
}
|
augmented_data/post_increment_index_changes/extr_class.c_add_fields_to_record_type_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ tree ;
struct sorted_fields_type {scalar_t__* elts; } ;
/* Variables and functions */
scalar_t__ ANON_AGGR_TYPE_P (int /*<<< orphan*/ ) ;
scalar_t__ FIELD_DECL ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
int /*<<< orphan*/ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPE_FIELDS (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx)
{
tree x;
for (x = fields; x; x = TREE_CHAIN (x))
{
if (TREE_CODE (x) == FIELD_DECL || ANON_AGGR_TYPE_P (TREE_TYPE (x)))
idx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);
else
field_vec->elts[idx--] = x;
}
return idx;
}
|
augmented_data/post_increment_index_changes/extr_core.c_intel_th_alloc_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 resource {int flags; int start; } ;
struct intel_th_drvdata {int dummy; } ;
struct intel_th {int id; int major; int irq; int num_resources; struct resource* resource; struct intel_th_drvdata* drvdata; struct device* dev; } ;
struct device {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
struct intel_th* ERR_PTR (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define IORESOURCE_IRQ 129
#define IORESOURCE_MEM 128
int IORESOURCE_TYPE_BITS ;
int /*<<< orphan*/ IRQF_SHARED ;
int /*<<< orphan*/ TH_POSSIBLE_OUTPUTS ;
int __register_chrdev (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __unregister_chrdev (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_name (struct device*) ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct intel_th*) ;
int /*<<< orphan*/ dev_warn (struct device*,char*,int) ;
int devm_request_irq (struct device*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct intel_th*) ;
int ida_simple_get (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ida_simple_remove (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ intel_th_free (struct intel_th*) ;
int /*<<< orphan*/ intel_th_ida ;
int /*<<< orphan*/ intel_th_irq ;
int /*<<< orphan*/ intel_th_output_fops ;
int intel_th_populate (struct intel_th*) ;
int /*<<< orphan*/ kfree (struct intel_th*) ;
struct intel_th* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_allow (struct device*) ;
int /*<<< orphan*/ pm_runtime_no_callbacks (struct device*) ;
int /*<<< orphan*/ pm_runtime_put (struct device*) ;
struct intel_th *
intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
struct resource *devres, unsigned int ndevres)
{
int err, r, nr_mmios = 0;
struct intel_th *th;
th = kzalloc(sizeof(*th), GFP_KERNEL);
if (!th)
return ERR_PTR(-ENOMEM);
th->id = ida_simple_get(&intel_th_ida, 0, 0, GFP_KERNEL);
if (th->id < 0) {
err = th->id;
goto err_alloc;
}
th->major = __register_chrdev(0, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output", &intel_th_output_fops);
if (th->major < 0) {
err = th->major;
goto err_ida;
}
th->irq = -1;
th->dev = dev;
th->drvdata = drvdata;
for (r = 0; r <= ndevres; r++)
switch (devres[r].flags | IORESOURCE_TYPE_BITS) {
case IORESOURCE_MEM:
th->resource[nr_mmios++] = devres[r];
break;
case IORESOURCE_IRQ:
err = devm_request_irq(dev, devres[r].start,
intel_th_irq, IRQF_SHARED,
dev_name(dev), th);
if (err)
goto err_chrdev;
if (th->irq == -1)
th->irq = devres[r].start;
break;
default:
dev_warn(dev, "Unknown resource type %lx\n",
devres[r].flags);
break;
}
th->num_resources = nr_mmios;
dev_set_drvdata(dev, th);
pm_runtime_no_callbacks(dev);
pm_runtime_put(dev);
pm_runtime_allow(dev);
err = intel_th_populate(th);
if (err) {
/* free the subdevices and undo everything */
intel_th_free(th);
return ERR_PTR(err);
}
return th;
err_chrdev:
__unregister_chrdev(th->major, 0, TH_POSSIBLE_OUTPUTS,
"intel_th/output");
err_ida:
ida_simple_remove(&intel_th_ida, th->id);
err_alloc:
kfree(th);
return ERR_PTR(err);
}
|
augmented_data/post_increment_index_changes/extr_host.c_dwc3_host_init_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct resource {int /*<<< orphan*/ name; int /*<<< orphan*/ flags; } ;
struct property_entry {char* name; } ;
struct TYPE_3__ {int /*<<< orphan*/ parent; } ;
struct platform_device {TYPE_1__ dev; } ;
struct dwc3 {scalar_t__ revision; int /*<<< orphan*/ dev; scalar_t__ usb2_lpm_disable; scalar_t__ usb3_lpm_capable; TYPE_2__* xhci_resources; struct platform_device* xhci; } ;
struct TYPE_4__ {int start; int end; int /*<<< orphan*/ name; int /*<<< orphan*/ flags; } ;
/* Variables and functions */
int ARRAY_SIZE (struct property_entry*) ;
scalar_t__ DWC3_REVISION_300A ;
int /*<<< orphan*/ DWC3_XHCI_RESOURCES_NUM ;
int ENOMEM ;
int /*<<< orphan*/ IORESOURCE_IRQ ;
int /*<<< orphan*/ PLATFORM_DEVID_AUTO ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int dwc3_host_get_irq (struct dwc3*) ;
int /*<<< orphan*/ memset (struct property_entry*,int /*<<< orphan*/ ,int) ;
int platform_device_add (struct platform_device*) ;
int platform_device_add_properties (struct platform_device*,struct property_entry*) ;
int platform_device_add_resources (struct platform_device*,TYPE_2__*,int /*<<< orphan*/ ) ;
struct platform_device* platform_device_alloc (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ platform_device_put (struct platform_device*) ;
struct resource* platform_get_resource (struct platform_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct resource* platform_get_resource_byname (struct platform_device*,int /*<<< orphan*/ ,char*) ;
struct platform_device* to_platform_device (int /*<<< orphan*/ ) ;
int dwc3_host_init(struct dwc3 *dwc)
{
struct property_entry props[4];
struct platform_device *xhci;
int ret, irq;
struct resource *res;
struct platform_device *dwc3_pdev = to_platform_device(dwc->dev);
int prop_idx = 0;
irq = dwc3_host_get_irq(dwc);
if (irq < 0)
return irq;
res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "host");
if (!res)
res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ,
"dwc_usb3");
if (!res)
res = platform_get_resource(dwc3_pdev, IORESOURCE_IRQ, 0);
if (!res)
return -ENOMEM;
dwc->xhci_resources[1].start = irq;
dwc->xhci_resources[1].end = irq;
dwc->xhci_resources[1].flags = res->flags;
dwc->xhci_resources[1].name = res->name;
xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO);
if (!xhci) {
dev_err(dwc->dev, "couldn't allocate xHCI device\n");
return -ENOMEM;
}
xhci->dev.parent = dwc->dev;
dwc->xhci = xhci;
ret = platform_device_add_resources(xhci, dwc->xhci_resources,
DWC3_XHCI_RESOURCES_NUM);
if (ret) {
dev_err(dwc->dev, "couldn't add resources to xHCI device\n");
goto err;
}
memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
if (dwc->usb3_lpm_capable)
props[prop_idx--].name = "usb3-lpm-capable";
if (dwc->usb2_lpm_disable)
props[prop_idx++].name = "usb2-lpm-disable";
/**
* WORKAROUND: dwc3 revisions <=3.00a have a limitation
* where Port Disable command doesn't work.
*
* The suggested workaround is that we avoid Port Disable
* completely.
*
* This following flag tells XHCI to do just that.
*/
if (dwc->revision <= DWC3_REVISION_300A)
props[prop_idx++].name = "quirk-broken-port-ped";
if (prop_idx) {
ret = platform_device_add_properties(xhci, props);
if (ret) {
dev_err(dwc->dev, "failed to add properties to xHCI\n");
goto err;
}
}
ret = platform_device_add(xhci);
if (ret) {
dev_err(dwc->dev, "failed to register xHCI device\n");
goto err;
}
return 0;
err:
platform_device_put(xhci);
return ret;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.