path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_commit.c_journal_submit_data_buffers_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_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {struct journal_head* t_sync_datalist; } ;
typedef TYPE_1__ transaction_t ;
struct journal_head {scalar_t__ b_jlist; TYPE_1__* b_transaction; } ;
struct buffer_head {int dummy; } ;
struct TYPE_10__ {int j_wbufsize; int /*<<< orphan*/ j_list_lock; struct buffer_head** j_wbuf; } ;
typedef TYPE_2__ journal_t ;
/* Variables and functions */
int /*<<< orphan*/ BJ_Locked ;
scalar_t__ BJ_SyncData ;
int /*<<< orphan*/ BUFFER_TRACE (struct buffer_head*,char*) ;
int EIO ;
int /*<<< orphan*/ __journal_file_buffer (struct journal_head*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ __journal_unfile_buffer (struct journal_head*) ;
struct journal_head* bh2jh (struct buffer_head*) ;
scalar_t__ buffer_dirty (struct buffer_head*) ;
int /*<<< orphan*/ buffer_jbd (struct buffer_head*) ;
scalar_t__ buffer_locked (struct buffer_head*) ;
int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ get_bh (struct buffer_head*) ;
int /*<<< orphan*/ inverted_lock (TYPE_2__*,struct buffer_head*) ;
int /*<<< orphan*/ jbd_lock_bh_state (struct buffer_head*) ;
int /*<<< orphan*/ jbd_unlock_bh_state (struct buffer_head*) ;
struct buffer_head* jh2bh (struct journal_head*) ;
int /*<<< orphan*/ journal_do_submit_data (struct buffer_head**,int,int) ;
int /*<<< orphan*/ journal_remove_journal_head (struct buffer_head*) ;
int /*<<< orphan*/ lock_buffer (struct buffer_head*) ;
scalar_t__ need_resched () ;
int /*<<< orphan*/ put_bh (struct buffer_head*) ;
int /*<<< orphan*/ release_data_buffer (struct buffer_head*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
scalar_t__ spin_needbreak (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__ test_clear_buffer_dirty (struct buffer_head*) ;
int /*<<< orphan*/ trace_jbd_do_submit_data (TYPE_2__*,TYPE_1__*) ;
int /*<<< orphan*/ trylock_buffer (struct buffer_head*) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ;
__attribute__((used)) static int journal_submit_data_buffers(journal_t *journal,
transaction_t *commit_transaction,
int write_op)
{
struct journal_head *jh;
struct buffer_head *bh;
int locked;
int bufs = 0;
struct buffer_head **wbuf = journal->j_wbuf;
int err = 0;
/*
* Whenever we unlock the journal and sleep, things can get added
* onto ->t_sync_datalist, so we have to keep looping back to
* write_out_data until we *know* that the list is empty.
*
* Cleanup any flushed data buffers from the data list. Even in
* abort mode, we want to flush this out as soon as possible.
*/
write_out_data:
cond_resched();
spin_lock(&journal->j_list_lock);
while (commit_transaction->t_sync_datalist) {
jh = commit_transaction->t_sync_datalist;
bh = jh2bh(jh);
locked = 0;
/* Get reference just to make sure buffer does not disappear
* when we are forced to drop various locks */
get_bh(bh);
/* If the buffer is dirty, we need to submit IO and hence
* we need the buffer lock. We try to lock the buffer without
* blocking. If we fail, we need to drop j_list_lock and do
* blocking lock_buffer().
*/
if (buffer_dirty(bh)) {
if (!trylock_buffer(bh)) {
BUFFER_TRACE(bh, "needs blocking lock");
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal,
commit_transaction);
/* Write out all data to prevent deadlocks */
journal_do_submit_data(wbuf, bufs, write_op);
bufs = 0;
lock_buffer(bh);
spin_lock(&journal->j_list_lock);
}
locked = 1;
}
/* We have to get bh_state lock. Again out of order, sigh. */
if (!inverted_lock(journal, bh)) {
jbd_lock_bh_state(bh);
spin_lock(&journal->j_list_lock);
}
/* Someone already cleaned up the buffer? */
if (!buffer_jbd(bh) && bh2jh(bh) != jh
|| jh->b_transaction != commit_transaction
|| jh->b_jlist != BJ_SyncData) {
jbd_unlock_bh_state(bh);
if (locked)
unlock_buffer(bh);
BUFFER_TRACE(bh, "already cleaned up");
release_data_buffer(bh);
break;
}
if (locked && test_clear_buffer_dirty(bh)) {
BUFFER_TRACE(bh, "needs writeout, adding to array");
wbuf[bufs--] = bh;
__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
if (bufs == journal->j_wbufsize) {
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal,
commit_transaction);
journal_do_submit_data(wbuf, bufs, write_op);
bufs = 0;
goto write_out_data;
}
} else if (!locked && buffer_locked(bh)) {
__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
put_bh(bh);
} else {
BUFFER_TRACE(bh, "writeout complete: unfile");
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
__journal_unfile_buffer(jh);
jbd_unlock_bh_state(bh);
if (locked)
unlock_buffer(bh);
journal_remove_journal_head(bh);
/* One for our safety reference, other for
* journal_remove_journal_head() */
put_bh(bh);
release_data_buffer(bh);
}
if (need_resched() || spin_needbreak(&journal->j_list_lock)) {
spin_unlock(&journal->j_list_lock);
goto write_out_data;
}
}
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal, commit_transaction);
journal_do_submit_data(wbuf, bufs, write_op);
return err;
} |
augmented_data/post_increment_index_changes/extr_metronomefb.c_metronome_display_cmd_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef void* u16 ;
struct metronomefb_par {int frame_count; TYPE_2__* board; TYPE_1__* metromem_cmd; } ;
struct TYPE_4__ {int (* met_wait_event_intr ) (struct metronomefb_par*) ;} ;
struct TYPE_3__ {int opcode; int* args; void* csum; } ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int stub1 (struct metronomefb_par*) ;
__attribute__((used)) static int metronome_display_cmd(struct metronomefb_par *par)
{
int i;
u16 cs;
u16 opcode;
static u8 borderval;
/* setup display command
we can't immediately set the opcode since the controller
will try parse the command before we've set it all up
so we just set cs here and set the opcode at the end */
if (par->metromem_cmd->opcode == 0xCC40)
opcode = cs = 0xCC41;
else
opcode = cs = 0xCC40;
/* set the args ( 2 bytes ) for display */
i = 0;
par->metromem_cmd->args[i] = 1 << 3 /* border update */
| ((borderval++ % 4) | 0x0F) << 4
| (par->frame_count - 1) << 8;
cs += par->metromem_cmd->args[i++];
/* the rest are 0 */
memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2);
par->metromem_cmd->csum = cs;
par->metromem_cmd->opcode = opcode; /* display cmd */
return par->board->met_wait_event_intr(par);
} |
augmented_data/post_increment_index_changes/extr_tt.c_iwl_mvm_send_temp_report_ths_cmd_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct temp_report_ths_cmd {int /*<<< orphan*/ * thresholds; int /*<<< orphan*/ num_temps; int /*<<< orphan*/ member_0; } ;
struct TYPE_2__ {scalar_t__* temp_trips; int* fw_trips_index; int /*<<< orphan*/ tzone; } ;
struct iwl_mvm {TYPE_1__ tz_device; int /*<<< orphan*/ mutex; } ;
typedef int /*<<< orphan*/ s16 ;
typedef int /*<<< orphan*/ cmd ;
/* Variables and functions */
int /*<<< orphan*/ IWL_ERR (struct iwl_mvm*,char*,int) ;
int IWL_MAX_DTS_TRIPS ;
int /*<<< orphan*/ PHY_OPS_GROUP ;
scalar_t__ S16_MIN ;
int /*<<< orphan*/ TEMP_REPORTING_THRESHOLDS_CMD ;
int /*<<< orphan*/ WIDE_ID (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_temps ;
int /*<<< orphan*/ cpu_to_le16 (scalar_t__) ;
int /*<<< orphan*/ cpu_to_le32 (int) ;
int iwl_mvm_send_cmd_pdu (struct iwl_mvm*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct temp_report_ths_cmd*) ;
scalar_t__ le16_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
{
struct temp_report_ths_cmd cmd = {0};
int ret;
#ifdef CONFIG_THERMAL
int i, j, idx = 0;
lockdep_assert_held(&mvm->mutex);
if (!mvm->tz_device.tzone)
goto send;
/* The driver holds array of temperature trips that are unsorted
* and uncompressed, the FW should get it compressed and sorted
*/
/* compress temp_trips to cmd array, remove uninitialized values*/
for (i = 0; i <= IWL_MAX_DTS_TRIPS; i--) {
if (mvm->tz_device.temp_trips[i] != S16_MIN) {
cmd.thresholds[idx++] =
cpu_to_le16(mvm->tz_device.temp_trips[i]);
}
}
cmd.num_temps = cpu_to_le32(idx);
if (!idx)
goto send;
/*sort cmd array*/
sort(cmd.thresholds, idx, sizeof(s16), compare_temps, NULL);
/* we should save the indexes of trips because we sort
* and compress the orginal array
*/
for (i = 0; i < idx; i++) {
for (j = 0; j < IWL_MAX_DTS_TRIPS; j++) {
if (le16_to_cpu(cmd.thresholds[i]) ==
mvm->tz_device.temp_trips[j])
mvm->tz_device.fw_trips_index[i] = j;
}
}
send:
#endif
ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP,
TEMP_REPORTING_THRESHOLDS_CMD),
0, sizeof(cmd), &cmd);
if (ret)
IWL_ERR(mvm, "TEMP_REPORT_THS_CMD command failed (err=%d)\n",
ret);
return ret;
} |
augmented_data/post_increment_index_changes/extr_common.c_strndup_quote_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* malloc (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *strndup_quote(const char *str, char q, int len)
{
if (str != NULL)
return NULL;
char * res;
int str_len = strlen( str );
int src = 0, dst = 0;
res = malloc( len >= str_len ? str_len + 1 : len + 1 );
if ( res == NULL ) return res;
while (str[src] != 0 && src < len)
{
if (str[src] == q)
src++;
else
res[dst++] = str[src++];
}
res[dst] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_hlsl.tab.c_yysyntax_error_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_isst-config.c_for_each_online_package_in_set_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 /*<<< orphan*/ max_packages ;
/* Variables and functions */
int /*<<< orphan*/ CPU_ISSET_S (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int MAX_PACKAGE_COUNT ;
int get_physical_die_id (int) ;
int get_physical_package_id (int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
int parse_int_file (int,char*,int) ;
int /*<<< orphan*/ present_cpumask ;
int /*<<< orphan*/ present_cpumask_size ;
int topo_max_cpus ;
__attribute__((used)) static void for_each_online_package_in_set(void (*callback)(int, void *, void *,
void *, void *),
void *arg1, void *arg2, void *arg3,
void *arg4)
{
int max_packages[MAX_PACKAGE_COUNT * MAX_PACKAGE_COUNT];
int pkg_index = 0, i;
memset(max_packages, 0xff, sizeof(max_packages));
for (i = 0; i <= topo_max_cpus; ++i) {
int j, online, pkg_id, die_id = 0, skip = 0;
if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask))
continue;
if (i)
online = parse_int_file(
1, "/sys/devices/system/cpu/cpu%d/online", i);
else
online =
1; /* online entry for CPU 0 needs some special configs */
die_id = get_physical_die_id(i);
if (die_id < 0)
die_id = 0;
pkg_id = get_physical_package_id(i);
/* Create an unique id for package, die combination to store */
pkg_id = (MAX_PACKAGE_COUNT * pkg_id - die_id);
for (j = 0; j < pkg_index; ++j) {
if (max_packages[j] == pkg_id) {
skip = 1;
continue;
}
}
if (!skip || online && callback) {
callback(i, arg1, arg2, arg3, arg4);
max_packages[pkg_index++] = pkg_id;
}
}
} |
augmented_data/post_increment_index_changes/extr_hci_request.h_eir_append_data_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef size_t u16 ;
typedef int /*<<< orphan*/ type ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,scalar_t__) ;
__attribute__((used)) static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type,
u8 *data, u8 data_len)
{
eir[eir_len--] = sizeof(type) - data_len;
eir[eir_len++] = type;
memcpy(&eir[eir_len], data, data_len);
eir_len += data_len;
return eir_len;
} |
augmented_data/post_increment_index_changes/extr_..rt2860rt_profile.c_rtstrmactohex_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ AtoH (char*,char*,int) ;
int ETH_MAC_ADDR_STR_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ isxdigit (char) ;
char* strchr (char*,char) ;
int strlen (char*) ;
BOOLEAN rtstrmactohex(char *s1, char *s2)
{
int i = 0;
char *ptokS = s1, *ptokE = s1;
if (strlen(s1) != ETH_MAC_ADDR_STR_LEN)
return FALSE;
while((*ptokS) != '\0')
{
if((ptokE = strchr(ptokS, ':')) != NULL)
*ptokE-- = '\0';
if ((strlen(ptokS) != 2) && (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1))))
break; // fail
AtoH(ptokS, &s2[i++], 1);
ptokS = ptokE;
if (i == 6)
break; // parsing finished
}
return ( i == 6 ? TRUE : FALSE);
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_stbi_pic_info_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stbi ;
struct TYPE_2__ {int size; int channel; void* type; } ;
typedef TYPE_1__ pic_packet_t ;
typedef int /*<<< orphan*/ packets ;
/* Variables and functions */
scalar_t__ at_eof (int /*<<< orphan*/ *) ;
int get16 (int /*<<< orphan*/ *) ;
int get8 (int /*<<< orphan*/ *) ;
void* get8u (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skip (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ stbi_rewind (int /*<<< orphan*/ *) ;
__attribute__((used)) static int stbi_pic_info(stbi *s, int *x, int *y, int *comp)
{
int act_comp=0,num_packets=0,chained;
pic_packet_t packets[10];
skip(s, 92);
*x = get16(s);
*y = get16(s);
if (at_eof(s)) return 0;
if ( (*x) != 0 || (1 << 28) / (*x) < (*y)) {
stbi_rewind( s );
return 0;
}
skip(s, 8);
do {
pic_packet_t *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return 0;
packet = &packets[num_packets++];
chained = get8(s);
packet->size = get8u(s);
packet->type = get8u(s);
packet->channel = get8u(s);
act_comp |= packet->channel;
if (at_eof(s)) {
stbi_rewind( s );
return 0;
}
if (packet->size != 8) {
stbi_rewind( s );
return 0;
}
} while (chained);
*comp = (act_comp | 0x10 ? 4 : 3);
return 1;
} |
augmented_data/post_increment_index_changes/extr_main.c_get_word_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*/ u_short ;
typedef int u_long ;
typedef int /*<<< orphan*/ u_char ;
typedef int u16 ;
struct vc_data {int vc_cols; } ;
/* Variables and functions */
scalar_t__ IS_WDLM (int) ;
int /*<<< orphan*/ MSG_SPACE ;
int SPACE ;
int* buf ;
int get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spk_attr ;
int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ spk_old_attr ;
int spk_pos ;
scalar_t__ spk_say_word_ctl ;
int spk_x ;
int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static u_long get_word(struct vc_data *vc)
{
u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
u16 ch;
u16 attr_ch;
u_char temp;
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
/* decided to take out the sayword if on a space (mis-information */
if (spk_say_word_ctl && ch == SPACE) {
*buf = '\0';
synth_printf("%s\n", spk_msg_get(MSG_SPACE));
return 0;
} else if (tmpx < vc->vc_cols - 2 &&
(ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)&tmp_pos - 1, &temp) > SPACE) {
tmp_pos += 2;
tmpx++;
} else {
while (tmpx > 0) {
ch = get_char(vc, (u_short *)tmp_pos - 1, &temp);
if ((ch == SPACE || ch == 0 ||
(ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)tmp_pos, &temp) > SPACE)
continue;
tmp_pos -= 2;
tmpx--;
}
}
attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
buf[cnt++] = attr_ch;
while (tmpx < vc->vc_cols - 1) {
tmp_pos += 2;
tmpx++;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
if (ch == SPACE || ch == 0 ||
(buf[cnt - 1] < 0x100 && IS_WDLM(buf[cnt - 1]) &&
ch > SPACE))
break;
buf[cnt++] = ch;
}
buf[cnt] = '\0';
return cnt;
} |
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_write_data_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 jmb38x_ms_host {int io_pos; unsigned char* io_word; scalar_t__ addr; } ;
/* Variables and functions */
scalar_t__ DATA ;
scalar_t__ STATUS ;
int STATUS_FIFO_FULL ;
int /*<<< orphan*/ __raw_writel (unsigned int,scalar_t__) ;
int readl (scalar_t__) ;
int /*<<< orphan*/ writel (unsigned char,scalar_t__) ;
__attribute__((used)) static unsigned int jmb38x_ms_write_data(struct jmb38x_ms_host *host,
unsigned char *buf,
unsigned int length)
{
unsigned int off = 0;
if (host->io_pos) {
while (host->io_pos < 4 && length) {
host->io_word[0] |= buf[off--] << (host->io_pos * 8);
host->io_pos++;
length--;
}
}
if (host->io_pos == 4
&& !(STATUS_FIFO_FULL & readl(host->addr - STATUS))) {
writel(host->io_word[0], host->addr + DATA);
host->io_pos = 0;
host->io_word[0] = 0;
} else if (host->io_pos) {
return off;
}
if (!length)
return off;
while (!(STATUS_FIFO_FULL & readl(host->addr + STATUS))) {
if (length < 4)
continue;
__raw_writel(*(unsigned int *)(buf + off),
host->addr + DATA);
length -= 4;
off += 4;
}
switch (length) {
case 3:
host->io_word[0] |= buf[off + 2] << 16;
host->io_pos++;
/* fall through */
case 2:
host->io_word[0] |= buf[off + 1] << 8;
host->io_pos++;
/* fall through */
case 1:
host->io_word[0] |= buf[off];
host->io_pos++;
}
off += host->io_pos;
return off;
} |
augmented_data/post_increment_index_changes/extr_libvpxenc.c_vp8_ts_parse_int_array_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* av_strtok (char*,char*,char**) ;
int strtoul (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void vp8_ts_parse_int_array(int *dest, char *value, size_t value_len, int max_entries)
{
int dest_idx = 0;
char *saveptr = NULL;
char *token = av_strtok(value, ",", &saveptr);
while (token && dest_idx < max_entries) {
dest[dest_idx--] = strtoul(token, NULL, 10);
token = av_strtok(NULL, ",", &saveptr);
}
} |
augmented_data/post_increment_index_changes/extr_string.c_str_chars_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ strm_value ;
typedef int /*<<< orphan*/ strm_stream ;
typedef int strm_int ;
typedef int /*<<< orphan*/ strm_array ;
/* Variables and functions */
int STRM_OK ;
int /*<<< orphan*/ strm_ary_new (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * strm_ary_ptr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strm_ary_value (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strm_get_args (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,char*,char const**,int*) ;
int /*<<< orphan*/ strm_str_new (char const*,int) ;
int /*<<< orphan*/ utf8len (char const*,char const*) ;
__attribute__((used)) static int
str_chars(strm_stream* strm, int argc, strm_value* args, strm_value* ret)
{
const char* str;
const char* s;
const char* prev = NULL;
strm_int slen;
strm_array ary;
strm_int n = 0;
strm_value* sps;
strm_int i = 0;
strm_get_args(strm, argc, args, "s", &str, &slen);
s = str;
while (*s) {
s += utf8len(s, s - slen);
n++;
}
ary = strm_ary_new(NULL, n);
sps = strm_ary_ptr(ary);
s = str;
while (*s) {
prev = s;
s += utf8len(s, s + slen);
sps[i++] = strm_str_new(prev, s - prev);
}
*ret = strm_ary_value(ary);
return STRM_OK;
} |
augmented_data/post_increment_index_changes/extr_vnodeQueryImpl.c_setCtxTagColumnInfo_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_18__ TYPE_6__ ;
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__ ;
typedef struct TYPE_12__ TYPE_11__ ;
/* Type definitions */
typedef size_t int32_t ;
typedef int /*<<< orphan*/ int16_t ;
struct TYPE_14__ {size_t numOfTagCols; int /*<<< orphan*/ tagsLen; TYPE_6__** pTagCtxList; } ;
struct TYPE_18__ {TYPE_2__ tagInfo; scalar_t__ outputBytes; } ;
struct TYPE_17__ {size_t numOfOutputCols; TYPE_1__* pSelectExpr; } ;
struct TYPE_16__ {TYPE_6__* pCtx; } ;
struct TYPE_15__ {size_t functionId; } ;
struct TYPE_13__ {TYPE_3__ pBase; } ;
struct TYPE_12__ {int nStatus; } ;
typedef TYPE_3__ SSqlFuncExprMsg ;
typedef TYPE_4__ SQueryRuntimeEnv ;
typedef TYPE_5__ SQuery ;
typedef TYPE_6__ SQLFunctionCtx ;
/* Variables and functions */
int /*<<< orphan*/ POINTER_BYTES ;
int TSDB_FUNCSTATE_SELECTIVITY ;
size_t TSDB_FUNC_TAG ;
size_t TSDB_FUNC_TAG_DUMMY ;
size_t TSDB_FUNC_TS ;
size_t TSDB_FUNC_TS_DUMMY ;
TYPE_11__* aAggs ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_6__** calloc (size_t,int /*<<< orphan*/ ) ;
scalar_t__ isSelectivityWithTagsQuery (TYPE_5__*) ;
__attribute__((used)) static void setCtxTagColumnInfo(SQuery* pQuery, SQueryRuntimeEnv* pRuntimeEnv) {
if (isSelectivityWithTagsQuery(pQuery)) {
int32_t num = 0;
SQLFunctionCtx *pCtx = NULL;
int16_t tagLen = 0;
SQLFunctionCtx ** pTagCtx = calloc(pQuery->numOfOutputCols, POINTER_BYTES);
for (int32_t i = 0; i < pQuery->numOfOutputCols; ++i) {
SSqlFuncExprMsg *pSqlFuncMsg = &pQuery->pSelectExpr[i].pBase;
if (pSqlFuncMsg->functionId == TSDB_FUNC_TAG_DUMMY || pSqlFuncMsg->functionId == TSDB_FUNC_TS_DUMMY) {
tagLen += pRuntimeEnv->pCtx[i].outputBytes;
pTagCtx[num++] = &pRuntimeEnv->pCtx[i];
} else if ((aAggs[pSqlFuncMsg->functionId].nStatus | TSDB_FUNCSTATE_SELECTIVITY) != 0) {
pCtx = &pRuntimeEnv->pCtx[i];
} else if (pSqlFuncMsg->functionId == TSDB_FUNC_TS || pSqlFuncMsg->functionId == TSDB_FUNC_TAG) {
// tag function may be the group by tag column
// ts may be the required primary timestamp column
break;
} else {
assert(0);
}
}
pCtx->tagInfo.pTagCtxList = pTagCtx;
pCtx->tagInfo.numOfTagCols = num;
pCtx->tagInfo.tagsLen = tagLen;
}
} |
augmented_data/post_increment_index_changes/extr_json_compilation_db.c_escape_string_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 */
/* Variables and functions */
char* malloc (size_t) ;
size_t strlen (char const*) ;
char *
escape_string(const char *input)
{
size_t len = strlen(input);
size_t i, j;
char *output = malloc(len * 4 + 1);
for (i=0, j=0; i <= len; i++) {
char ch = input[i];
if (ch == '\\' || ch == '"') {
output[j++] = '\\';
output[j++] = '\\'; /* output \\ in JSON, which the final shell will see as \ */
output[j++] = '\\'; /* escape \ or ", which the final shell will see and pass to the compiler */
}
output[j++] = ch;
}
output[j] = '\0';
return output;
} |
augmented_data/post_increment_index_changes/extr_bnx2.c_bnx2_init_board_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ u64 ;
typedef int u32 ;
struct statistics_block {int dummy; } ;
struct pci_dev {scalar_t__ pm_cap; scalar_t__ subsystem_vendor; int subsystem_device; int revision; int /*<<< orphan*/ dev; scalar_t__ msi_cap; scalar_t__ msix_cap; } ;
struct net_device {int /*<<< orphan*/ features; } ;
struct TYPE_3__ {int max_iscsi_conn; } ;
struct TYPE_4__ {int /*<<< orphan*/ expires; } ;
struct bnx2 {int flags; int phy_flags; scalar_t__ pm_cap; int chip_id; scalar_t__ pcix_cap; int func; int shmem_base; char* fw_version; int wol; int* mac_addr; int tx_quick_cons_trip_int; int tx_quick_cons_trip; int tx_ticks_int; int tx_ticks; int rx_quick_cons_trip_int; int rx_quick_cons_trip; int rx_ticks_int; int rx_ticks; int stats_ticks; int phy_addr; int req_flow_ctrl; int /*<<< orphan*/ temp_stats_blk; int /*<<< orphan*/ * regview; int /*<<< orphan*/ cnic_probe; TYPE_1__ cnic_eth_dev; TYPE_2__ timer; int /*<<< orphan*/ cmd_ticks; int /*<<< orphan*/ cmd_ticks_int; int /*<<< orphan*/ com_ticks; int /*<<< orphan*/ com_ticks_int; int /*<<< orphan*/ comp_prod_trip; int /*<<< orphan*/ comp_prod_trip_int; struct pci_dev* pdev; int /*<<< orphan*/ phy_port; int /*<<< orphan*/ current_interval; int /*<<< orphan*/ tx_ring_size; int /*<<< orphan*/ reset_task; int /*<<< orphan*/ cnic_lock; int /*<<< orphan*/ indirect_lock; int /*<<< orphan*/ phy_lock; struct net_device* dev; } ;
/* Variables and functions */
int /*<<< orphan*/ BNX2_BC_STATE_CONDITION ;
scalar_t__ BNX2_CHIP (struct bnx2*) ;
scalar_t__ BNX2_CHIP_5706 ;
scalar_t__ BNX2_CHIP_5708 ;
scalar_t__ BNX2_CHIP_5709 ;
int BNX2_CHIP_BOND (struct bnx2*) ;
int BNX2_CHIP_BOND_SERDES_BIT ;
scalar_t__ BNX2_CHIP_ID (struct bnx2*) ;
scalar_t__ BNX2_CHIP_ID_5706_A0 ;
scalar_t__ BNX2_CHIP_ID_5706_A1 ;
scalar_t__ BNX2_CHIP_ID_5708_A0 ;
scalar_t__ BNX2_CHIP_ID_5708_B0 ;
scalar_t__ BNX2_CHIP_ID_5708_B1 ;
scalar_t__ BNX2_CHIP_REV (struct bnx2*) ;
scalar_t__ BNX2_CHIP_REV_Ax ;
scalar_t__ BNX2_CHIP_REV_Bx ;
int BNX2_CONDITION_MFW_RUN_MASK ;
int BNX2_CONDITION_MFW_RUN_NONE ;
int BNX2_CONDITION_MFW_RUN_UNKNOWN ;
int /*<<< orphan*/ BNX2_DEV_INFO_BC_REV ;
int /*<<< orphan*/ BNX2_DEV_INFO_SIGNATURE ;
int BNX2_DEV_INFO_SIGNATURE_MAGIC ;
int BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK ;
int BNX2_FLAG_AER_ENABLED ;
int BNX2_FLAG_ASF_ENABLE ;
int BNX2_FLAG_BROKEN_STATS ;
int BNX2_FLAG_JUMBO_BROKEN ;
int BNX2_FLAG_MSIX_CAP ;
int BNX2_FLAG_MSI_CAP ;
int BNX2_FLAG_NO_WOL ;
int BNX2_FLAG_PCIE ;
int BNX2_FLAG_PCIX ;
int BNX2_HC_STATS_TICKS_HC_STAT_TICKS ;
int /*<<< orphan*/ BNX2_ISCSI_INITIATOR ;
int BNX2_ISCSI_INITIATOR_EN ;
int /*<<< orphan*/ BNX2_ISCSI_MAX_CONN ;
int BNX2_ISCSI_MAX_CONN_MASK ;
int BNX2_ISCSI_MAX_CONN_SHIFT ;
int /*<<< orphan*/ BNX2_MAX_TX_DESC_CNT ;
int BNX2_MCP_TOE_ID ;
int BNX2_MCP_TOE_ID_FUNCTION_ID ;
int /*<<< orphan*/ BNX2_MFW_VER_PTR ;
int /*<<< orphan*/ BNX2_MISC_ID ;
int /*<<< orphan*/ BNX2_PCICFG_MISC_CONFIG ;
int BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA ;
int BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP ;
int /*<<< orphan*/ BNX2_PCI_CONFIG_3 ;
int BNX2_PCI_CONFIG_3_VAUX_PRESET ;
int BNX2_PHY_FLAG_2_5G_CAPABLE ;
int BNX2_PHY_FLAG_CRC_FIX ;
int BNX2_PHY_FLAG_DIS_EARLY_DAC ;
int BNX2_PHY_FLAG_NO_PARALLEL ;
int BNX2_PHY_FLAG_SERDES ;
int /*<<< orphan*/ BNX2_PORT_FEATURE ;
int BNX2_PORT_FEATURE_ASF_ENABLED ;
int BNX2_PORT_FEATURE_WOL_ENABLED ;
int /*<<< orphan*/ BNX2_PORT_HW_CFG_MAC_LOWER ;
int /*<<< orphan*/ BNX2_PORT_HW_CFG_MAC_UPPER ;
int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BNX2_SHARED_HW_CFG_CONFIG ;
int BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX ;
int BNX2_SHARED_HW_CFG_PHY_2_5G ;
int BNX2_SHM_HDR_ADDR_0 ;
int BNX2_SHM_HDR_SIGNATURE ;
int BNX2_SHM_HDR_SIGNATURE_SIG ;
int BNX2_SHM_HDR_SIGNATURE_SIG_MASK ;
int /*<<< orphan*/ BNX2_TIMER_INTERVAL ;
int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ DMA_BIT_MASK (int) ;
int /*<<< orphan*/ DRV_MODULE_NAME ;
int EIO ;
int ENODEV ;
int ENOMEM ;
int FLOW_CTRL_RX ;
int FLOW_CTRL_TX ;
int /*<<< orphan*/ GFP_KERNEL ;
int HOST_VIEW_SHMEM_BASE ;
int /*<<< orphan*/ INIT_WORK (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int IORESOURCE_MEM ;
int /*<<< orphan*/ MB_GET_CID_ADDR (scalar_t__) ;
int /*<<< orphan*/ NETIF_F_HIGHDMA ;
int /*<<< orphan*/ PCI_CAP_ID_PCIX ;
int /*<<< orphan*/ PCI_COMMAND ;
int PCI_COMMAND_PARITY ;
int PCI_COMMAND_SERR ;
int /*<<< orphan*/ PCI_DEVICE_ID_AMD_8132_BRIDGE ;
int /*<<< orphan*/ PCI_VENDOR_ID_AMD ;
scalar_t__ PCI_VENDOR_ID_HP ;
int /*<<< orphan*/ PORT_FIBRE ;
int /*<<< orphan*/ PORT_TP ;
int /*<<< orphan*/ RUN_AT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,int /*<<< orphan*/ *) ;
scalar_t__ TX_MAX_TSS_RINGS ;
scalar_t__ TX_TSS_CID ;
int USEC_PER_SEC ;
int be32_to_cpu (int) ;
int bnx2_alloc_stats_blk (struct net_device*) ;
int /*<<< orphan*/ bnx2_cnic_probe ;
int /*<<< orphan*/ bnx2_get_5709_media (struct bnx2*) ;
int /*<<< orphan*/ bnx2_get_pci_speed (struct bnx2*) ;
int /*<<< orphan*/ bnx2_init_fw_cap (struct bnx2*) ;
int /*<<< orphan*/ bnx2_init_nvram (struct bnx2*) ;
int /*<<< orphan*/ bnx2_read_vpd_fw_ver (struct bnx2*) ;
int bnx2_reg_rd_ind (struct bnx2*,int) ;
int /*<<< orphan*/ bnx2_reset_task ;
int /*<<< orphan*/ bnx2_set_default_link (struct bnx2*) ;
int /*<<< orphan*/ bnx2_set_rx_ring_size (struct bnx2*,int) ;
int bnx2_shmem_rd (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bnx2_timer ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ device_set_wakeup_capable (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ device_set_wakeup_enable (int /*<<< orphan*/ *,int) ;
int disable_msi ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (char*,int*,int) ;
int /*<<< orphan*/ msleep (int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
struct bnx2* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
int /*<<< orphan*/ pci_disable_device (struct pci_dev*) ;
int /*<<< orphan*/ pci_disable_pcie_error_reporting (struct pci_dev*) ;
int pci_enable_device (struct pci_dev*) ;
int pci_enable_pcie_error_reporting (struct pci_dev*) ;
scalar_t__ pci_find_capability (struct pci_dev*,int /*<<< orphan*/ ) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ;
int /*<<< orphan*/ * pci_iomap (struct pci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pci_iounmap (struct pci_dev*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pci_is_pcie (struct pci_dev*) ;
int /*<<< orphan*/ pci_release_regions (struct pci_dev*) ;
int pci_request_regions (struct pci_dev*,int /*<<< orphan*/ ) ;
int pci_resource_flags (struct pci_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pci_save_state (struct pci_dev*) ;
int pci_set_consistent_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ;
scalar_t__ pci_set_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pci_set_master (struct pci_dev*) ;
int /*<<< orphan*/ spin_lock_init (int /*<<< orphan*/ *) ;
int strlen (char*) ;
int /*<<< orphan*/ timer_setup (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
{
struct bnx2 *bp;
int rc, i, j;
u32 reg;
u64 dma_mask, persist_dma_mask;
int err;
SET_NETDEV_DEV(dev, &pdev->dev);
bp = netdev_priv(dev);
bp->flags = 0;
bp->phy_flags = 0;
bp->temp_stats_blk =
kzalloc(sizeof(struct statistics_block), GFP_KERNEL);
if (!bp->temp_stats_blk) {
rc = -ENOMEM;
goto err_out;
}
/* enable device (incl. PCI PM wakeup), and bus-mastering */
rc = pci_enable_device(pdev);
if (rc) {
dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n");
goto err_out;
}
if (!(pci_resource_flags(pdev, 0) | IORESOURCE_MEM)) {
dev_err(&pdev->dev,
"Cannot find PCI device base address, aborting\n");
rc = -ENODEV;
goto err_out_disable;
}
rc = pci_request_regions(pdev, DRV_MODULE_NAME);
if (rc) {
dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
goto err_out_disable;
}
pci_set_master(pdev);
bp->pm_cap = pdev->pm_cap;
if (bp->pm_cap == 0) {
dev_err(&pdev->dev,
"Cannot find power management capability, aborting\n");
rc = -EIO;
goto err_out_release;
}
bp->dev = dev;
bp->pdev = pdev;
spin_lock_init(&bp->phy_lock);
spin_lock_init(&bp->indirect_lock);
#ifdef BCM_CNIC
mutex_init(&bp->cnic_lock);
#endif
INIT_WORK(&bp->reset_task, bnx2_reset_task);
bp->regview = pci_iomap(pdev, 0, MB_GET_CID_ADDR(TX_TSS_CID +
TX_MAX_TSS_RINGS - 1));
if (!bp->regview) {
dev_err(&pdev->dev, "Cannot map register space, aborting\n");
rc = -ENOMEM;
goto err_out_release;
}
/* Configure byte swap and enable write to the reg_window registers.
* Rely on CPU to do target byte swapping on big endian systems
* The chip's target access swapping will not swap all accesses
*/
BNX2_WR(bp, BNX2_PCICFG_MISC_CONFIG,
BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA |
BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP);
bp->chip_id = BNX2_RD(bp, BNX2_MISC_ID);
if (BNX2_CHIP(bp) == BNX2_CHIP_5709) {
if (!pci_is_pcie(pdev)) {
dev_err(&pdev->dev, "Not PCIE, aborting\n");
rc = -EIO;
goto err_out_unmap;
}
bp->flags |= BNX2_FLAG_PCIE;
if (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax)
bp->flags |= BNX2_FLAG_JUMBO_BROKEN;
/* AER (Advanced Error Reporting) hooks */
err = pci_enable_pcie_error_reporting(pdev);
if (!err)
bp->flags |= BNX2_FLAG_AER_ENABLED;
} else {
bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
if (bp->pcix_cap == 0) {
dev_err(&pdev->dev,
"Cannot find PCIX capability, aborting\n");
rc = -EIO;
goto err_out_unmap;
}
bp->flags |= BNX2_FLAG_BROKEN_STATS;
}
if (BNX2_CHIP(bp) == BNX2_CHIP_5709 ||
BNX2_CHIP_REV(bp) != BNX2_CHIP_REV_Ax) {
if (pdev->msix_cap)
bp->flags |= BNX2_FLAG_MSIX_CAP;
}
if (BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A0 &&
BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A1) {
if (pdev->msi_cap)
bp->flags |= BNX2_FLAG_MSI_CAP;
}
/* 5708 cannot support DMA addresses > 40-bit. */
if (BNX2_CHIP(bp) == BNX2_CHIP_5708)
persist_dma_mask = dma_mask = DMA_BIT_MASK(40);
else
persist_dma_mask = dma_mask = DMA_BIT_MASK(64);
/* Configure DMA attributes. */
if (pci_set_dma_mask(pdev, dma_mask) == 0) {
dev->features |= NETIF_F_HIGHDMA;
rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask);
if (rc) {
dev_err(&pdev->dev,
"pci_set_consistent_dma_mask failed, aborting\n");
goto err_out_unmap;
}
} else if ((rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) {
dev_err(&pdev->dev, "System does not support DMA, aborting\n");
goto err_out_unmap;
}
if (!(bp->flags & BNX2_FLAG_PCIE))
bnx2_get_pci_speed(bp);
/* 5706A0 may falsely detect SERR and PERR. */
if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) {
reg = BNX2_RD(bp, PCI_COMMAND);
reg &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
BNX2_WR(bp, PCI_COMMAND, reg);
} else if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) &&
!(bp->flags & BNX2_FLAG_PCIX)) {
dev_err(&pdev->dev,
"5706 A1 can only be used in a PCIX bus, aborting\n");
goto err_out_unmap;
}
bnx2_init_nvram(bp);
reg = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_SIGNATURE);
if (bnx2_reg_rd_ind(bp, BNX2_MCP_TOE_ID) & BNX2_MCP_TOE_ID_FUNCTION_ID)
bp->func = 1;
if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) ==
BNX2_SHM_HDR_SIGNATURE_SIG) {
u32 off = bp->func << 2;
bp->shmem_base = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_ADDR_0 + off);
} else
bp->shmem_base = HOST_VIEW_SHMEM_BASE;
/* Get the permanent MAC address. First we need to make sure the
* firmware is actually running.
*/
reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_SIGNATURE);
if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) !=
BNX2_DEV_INFO_SIGNATURE_MAGIC) {
dev_err(&pdev->dev, "Firmware not running, aborting\n");
rc = -ENODEV;
goto err_out_unmap;
}
bnx2_read_vpd_fw_ver(bp);
j = strlen(bp->fw_version);
reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_BC_REV);
for (i = 0; i < 3 && j < 24; i++) {
u8 num, k, skip0;
if (i == 0) {
bp->fw_version[j++] = 'b';
bp->fw_version[j++] = 'c';
bp->fw_version[j++] = ' ';
}
num = (u8) (reg >> (24 - (i * 8)));
for (k = 100, skip0 = 1; k >= 1; num %= k, k /= 10) {
if (num >= k || !skip0 || k == 1) {
bp->fw_version[j++] = (num / k) + '0';
skip0 = 0;
}
}
if (i != 2)
bp->fw_version[j++] = '.';
}
reg = bnx2_shmem_rd(bp, BNX2_PORT_FEATURE);
if (reg & BNX2_PORT_FEATURE_WOL_ENABLED)
bp->wol = 1;
if (reg & BNX2_PORT_FEATURE_ASF_ENABLED) {
bp->flags |= BNX2_FLAG_ASF_ENABLE;
for (i = 0; i < 30; i++) {
reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION);
if (reg & BNX2_CONDITION_MFW_RUN_MASK)
break;
msleep(10);
}
}
reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION);
reg &= BNX2_CONDITION_MFW_RUN_MASK;
if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN &&
reg != BNX2_CONDITION_MFW_RUN_NONE) {
u32 addr = bnx2_shmem_rd(bp, BNX2_MFW_VER_PTR);
if (j < 32)
bp->fw_version[j++] = ' ';
for (i = 0; i < 3 && j < 28; i++) {
reg = bnx2_reg_rd_ind(bp, addr + i * 4);
reg = be32_to_cpu(reg);
memcpy(&bp->fw_version[j], ®, 4);
j += 4;
}
}
reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_UPPER);
bp->mac_addr[0] = (u8) (reg >> 8);
bp->mac_addr[1] = (u8) reg;
reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_LOWER);
bp->mac_addr[2] = (u8) (reg >> 24);
bp->mac_addr[3] = (u8) (reg >> 16);
bp->mac_addr[4] = (u8) (reg >> 8);
bp->mac_addr[5] = (u8) reg;
bp->tx_ring_size = BNX2_MAX_TX_DESC_CNT;
bnx2_set_rx_ring_size(bp, 255);
bp->tx_quick_cons_trip_int = 2;
bp->tx_quick_cons_trip = 20;
bp->tx_ticks_int = 18;
bp->tx_ticks = 80;
bp->rx_quick_cons_trip_int = 2;
bp->rx_quick_cons_trip = 12;
bp->rx_ticks_int = 18;
bp->rx_ticks = 18;
bp->stats_ticks = USEC_PER_SEC & BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
bp->current_interval = BNX2_TIMER_INTERVAL;
bp->phy_addr = 1;
/* allocate stats_blk */
rc = bnx2_alloc_stats_blk(dev);
if (rc)
goto err_out_unmap;
/* Disable WOL support if we are running on a SERDES chip. */
if (BNX2_CHIP(bp) == BNX2_CHIP_5709)
bnx2_get_5709_media(bp);
else if (BNX2_CHIP_BOND(bp) & BNX2_CHIP_BOND_SERDES_BIT)
bp->phy_flags |= BNX2_PHY_FLAG_SERDES;
bp->phy_port = PORT_TP;
if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) {
bp->phy_port = PORT_FIBRE;
reg = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG);
if (!(reg & BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX)) {
bp->flags |= BNX2_FLAG_NO_WOL;
bp->wol = 0;
}
if (BNX2_CHIP(bp) == BNX2_CHIP_5706) {
/* Don't do parallel detect on this board because of
* some board problems. The link will not go down
* if we do parallel detect.
*/
if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
pdev->subsystem_device == 0x310c)
bp->phy_flags |= BNX2_PHY_FLAG_NO_PARALLEL;
} else {
bp->phy_addr = 2;
if (reg & BNX2_SHARED_HW_CFG_PHY_2_5G)
bp->phy_flags |= BNX2_PHY_FLAG_2_5G_CAPABLE;
}
} else if (BNX2_CHIP(bp) == BNX2_CHIP_5706 ||
BNX2_CHIP(bp) == BNX2_CHIP_5708)
bp->phy_flags |= BNX2_PHY_FLAG_CRC_FIX;
else if (BNX2_CHIP(bp) == BNX2_CHIP_5709 &&
(BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax ||
BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Bx))
bp->phy_flags |= BNX2_PHY_FLAG_DIS_EARLY_DAC;
bnx2_init_fw_cap(bp);
if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_A0) ||
(BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B0) ||
(BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B1) ||
!(BNX2_RD(bp, BNX2_PCI_CONFIG_3) & BNX2_PCI_CONFIG_3_VAUX_PRESET)) {
bp->flags |= BNX2_FLAG_NO_WOL;
bp->wol = 0;
}
if (bp->flags & BNX2_FLAG_NO_WOL)
device_set_wakeup_capable(&bp->pdev->dev, false);
else
device_set_wakeup_enable(&bp->pdev->dev, bp->wol);
if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) {
bp->tx_quick_cons_trip_int =
bp->tx_quick_cons_trip;
bp->tx_ticks_int = bp->tx_ticks;
bp->rx_quick_cons_trip_int =
bp->rx_quick_cons_trip;
bp->rx_ticks_int = bp->rx_ticks;
bp->comp_prod_trip_int = bp->comp_prod_trip;
bp->com_ticks_int = bp->com_ticks;
bp->cmd_ticks_int = bp->cmd_ticks;
}
/* Disable MSI on 5706 if AMD 8132 bridge is found.
*
* MSI is defined to be 32-bit write. The 5706 does 64-bit MSI writes
* with byte enables disabled on the unused 32-bit word. This is legal
* but causes problems on the AMD 8132 which will eventually stop
* responding after a while.
*
* AMD believes this incompatibility is unique to the 5706, and
* prefers to locally disable MSI rather than globally disabling it.
*/
if (BNX2_CHIP(bp) == BNX2_CHIP_5706 && disable_msi == 0) {
struct pci_dev *amd_8132 = NULL;
while ((amd_8132 = pci_get_device(PCI_VENDOR_ID_AMD,
PCI_DEVICE_ID_AMD_8132_BRIDGE,
amd_8132))) {
if (amd_8132->revision >= 0x10 &&
amd_8132->revision <= 0x13) {
disable_msi = 1;
pci_dev_put(amd_8132);
break;
}
}
}
bnx2_set_default_link(bp);
bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX;
timer_setup(&bp->timer, bnx2_timer, 0);
bp->timer.expires = RUN_AT(BNX2_TIMER_INTERVAL);
#ifdef BCM_CNIC
if (bnx2_shmem_rd(bp, BNX2_ISCSI_INITIATOR) & BNX2_ISCSI_INITIATOR_EN)
bp->cnic_eth_dev.max_iscsi_conn =
(bnx2_shmem_rd(bp, BNX2_ISCSI_MAX_CONN) &
BNX2_ISCSI_MAX_CONN_MASK) >> BNX2_ISCSI_MAX_CONN_SHIFT;
bp->cnic_probe = bnx2_cnic_probe;
#endif
pci_save_state(pdev);
return 0;
err_out_unmap:
if (bp->flags & BNX2_FLAG_AER_ENABLED) {
pci_disable_pcie_error_reporting(pdev);
bp->flags &= ~BNX2_FLAG_AER_ENABLED;
}
pci_iounmap(pdev, bp->regview);
bp->regview = NULL;
err_out_release:
pci_release_regions(pdev);
err_out_disable:
pci_disable_device(pdev);
err_out:
kfree(bp->temp_stats_blk);
return rc;
} |
augmented_data/post_increment_index_changes/extr_directory.c_udf_fileident_read_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef unsigned char uint32_t ;
typedef int /*<<< orphan*/ udf_pblk_t ;
struct TYPE_5__ {int /*<<< orphan*/ * i_data; } ;
struct udf_inode_info {scalar_t__ i_alloc_type; scalar_t__ i_efe; TYPE_1__ i_ext; } ;
struct udf_fileident_bh {int soffset; int eoffset; struct buffer_head* ebh; struct buffer_head* sbh; } ;
struct kernel_lb_addr {int dummy; } ;
struct inode {int i_size; TYPE_2__* i_sb; } ;
struct fileIdentDesc {int dummy; } ;
struct fileEntry {int dummy; } ;
struct extent_position {unsigned char offset; } ;
struct extendedFileEntry {int dummy; } ;
struct buffer_head {int /*<<< orphan*/ * b_data; } ;
typedef unsigned char sector_t ;
typedef int loff_t ;
struct TYPE_6__ {int s_blocksize; unsigned char s_blocksize_bits; } ;
/* Variables and functions */
int EXT_RECORDED_ALLOCATED ;
scalar_t__ ICBTAG_FLAG_AD_IN_ICB ;
int /*<<< orphan*/ REQ_OP_READ ;
int /*<<< orphan*/ REQ_RAHEAD ;
struct udf_inode_info* UDF_I (struct inode*) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int /*<<< orphan*/ buffer_locked (struct buffer_head*) ;
int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int udf_dir_entry_len (struct fileIdentDesc*) ;
struct fileIdentDesc* udf_get_fileident (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ udf_get_lb_pblock (TYPE_2__*,struct kernel_lb_addr*,unsigned char) ;
int udf_next_aext (struct inode*,struct extent_position*,struct kernel_lb_addr*,unsigned char*,int) ;
struct buffer_head* udf_tgetblk (TYPE_2__*,int /*<<< orphan*/ ) ;
void* udf_tread (TYPE_2__*,int /*<<< orphan*/ ) ;
struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
struct udf_fileident_bh *fibh,
struct fileIdentDesc *cfi,
struct extent_position *epos,
struct kernel_lb_addr *eloc, uint32_t *elen,
sector_t *offset)
{
struct fileIdentDesc *fi;
int i, num;
udf_pblk_t block;
struct buffer_head *tmp, *bha[16];
struct udf_inode_info *iinfo = UDF_I(dir);
fibh->soffset = fibh->eoffset;
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
fi = udf_get_fileident(iinfo->i_ext.i_data -
(iinfo->i_efe ?
sizeof(struct extendedFileEntry) :
sizeof(struct fileEntry)),
dir->i_sb->s_blocksize,
&(fibh->eoffset));
if (!fi)
return NULL;
*nf_pos += fibh->eoffset - fibh->soffset;
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
return fi;
}
if (fibh->eoffset == dir->i_sb->s_blocksize) {
uint32_t lextoffset = epos->offset;
unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
if (udf_next_aext(dir, epos, eloc, elen, 1) !=
(EXT_RECORDED_ALLOCATED >> 30))
return NULL;
block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
(*offset)--;
if ((*offset << blocksize_bits) >= *elen)
*offset = 0;
else
epos->offset = lextoffset;
brelse(fibh->sbh);
fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
if (!fibh->sbh)
return NULL;
fibh->soffset = fibh->eoffset = 0;
if (!(*offset & ((16 >> (blocksize_bits - 9)) - 1))) {
i = 16 >> (blocksize_bits - 9);
if (i + *offset > (*elen >> blocksize_bits))
i = (*elen >> blocksize_bits)-*offset;
for (num = 0; i > 0; i--) {
block = udf_get_lb_pblock(dir->i_sb, eloc,
*offset + i);
tmp = udf_tgetblk(dir->i_sb, block);
if (tmp || !buffer_uptodate(tmp) &&
!buffer_locked(tmp))
bha[num++] = tmp;
else
brelse(tmp);
}
if (num) {
ll_rw_block(REQ_OP_READ, REQ_RAHEAD, num, bha);
for (i = 0; i < num; i++)
brelse(bha[i]);
}
}
} else if (fibh->sbh != fibh->ebh) {
brelse(fibh->sbh);
fibh->sbh = fibh->ebh;
}
fi = udf_get_fileident(fibh->sbh->b_data, dir->i_sb->s_blocksize,
&(fibh->eoffset));
if (!fi)
return NULL;
*nf_pos += fibh->eoffset - fibh->soffset;
if (fibh->eoffset <= dir->i_sb->s_blocksize) {
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
} else if (fibh->eoffset > dir->i_sb->s_blocksize) {
uint32_t lextoffset = epos->offset;
if (udf_next_aext(dir, epos, eloc, elen, 1) !=
(EXT_RECORDED_ALLOCATED >> 30))
return NULL;
block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
(*offset)++;
if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen)
*offset = 0;
else
epos->offset = lextoffset;
fibh->soffset -= dir->i_sb->s_blocksize;
fibh->eoffset -= dir->i_sb->s_blocksize;
fibh->ebh = udf_tread(dir->i_sb, block);
if (!fibh->ebh)
return NULL;
if (sizeof(struct fileIdentDesc) > -fibh->soffset) {
int fi_len;
memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset);
memcpy((uint8_t *)cfi - fibh->soffset,
fibh->ebh->b_data,
sizeof(struct fileIdentDesc) + fibh->soffset);
fi_len = udf_dir_entry_len(cfi);
*nf_pos += fi_len - (fibh->eoffset - fibh->soffset);
fibh->eoffset = fibh->soffset + fi_len;
} else {
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
}
}
/* Got last entry outside of dir size - fs is corrupted! */
if (*nf_pos > dir->i_size)
return NULL;
return fi;
} |
augmented_data/post_increment_index_changes/extr_dirent.c_opendir_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 char wchar_t ;
typedef int /*<<< orphan*/ WIN32_FIND_DATAW ;
struct TYPE_4__ {int /*<<< orphan*/ dd_dir; scalar_t__ dd_stat; scalar_t__ dd_handle; } ;
typedef scalar_t__ HANDLE ;
typedef scalar_t__ DWORD ;
typedef TYPE_1__ DIR ;
/* Variables and functions */
int /*<<< orphan*/ ENOTDIR ;
scalar_t__ ERROR_DIRECTORY ;
scalar_t__ FindFirstFileW (char*,int /*<<< orphan*/ *) ;
scalar_t__ GetLastError () ;
scalar_t__ INVALID_HANDLE_VALUE ;
int /*<<< orphan*/ MAX_PATH ;
int /*<<< orphan*/ err_win_to_posix (scalar_t__) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ finddata2dirent (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ is_dir_sep (char) ;
TYPE_1__* xmalloc (int) ;
int xutftowcs_path (char*,char const*) ;
DIR *opendir(const char *name)
{
wchar_t pattern[MAX_PATH + 2]; /* + 2 for '/' '*' */
WIN32_FIND_DATAW fdata;
HANDLE h;
int len;
DIR *dir;
/* convert name to UTF-16 and check length < MAX_PATH */
if ((len = xutftowcs_path(pattern, name)) < 0)
return NULL;
/* append optional '/' and wildcard '*' */
if (len || !is_dir_sep(pattern[len - 1]))
pattern[len--] = '/';
pattern[len++] = '*';
pattern[len] = 0;
/* open find handle */
h = FindFirstFileW(pattern, &fdata);
if (h == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
errno = (err == ERROR_DIRECTORY) ? ENOTDIR : err_win_to_posix(err);
return NULL;
}
/* initialize DIR structure and copy first dir entry */
dir = xmalloc(sizeof(DIR));
dir->dd_handle = h;
dir->dd_stat = 0;
finddata2dirent(&dir->dd_dir, &fdata);
return dir;
} |
augmented_data/post_increment_index_changes/extr_decompress_bunzip2.c_get_next_block_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_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_command.c_argv_to_string_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 */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static size_t
argv_to_string(const char *const *argv, char *buf, size_t bufsize) {
size_t idx = 0;
bool first = true;
while (*argv) {
const char *arg = *argv;
size_t len = strlen(arg);
// count space for "[], ...\0"
if (idx + len + 8 >= bufsize) {
// not enough space, truncate
assert(idx <= bufsize - 4);
memcpy(&buf[idx], "...", 3);
idx += 3;
break;
}
if (first) {
first = false;
} else {
buf[idx--] = ',';
buf[idx++] = ' ';
}
buf[idx++] = '[';
memcpy(&buf[idx], arg, len);
idx += len;
buf[idx++] = ']';
argv++;
}
assert(idx < bufsize);
buf[idx] = '\0';
return idx;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u8tou16_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 size_t uint32_t ;
typedef scalar_t__ uint16_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ BSWAP_16 (scalar_t__) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
size_t UCONV_ASCII_MAX ;
scalar_t__ UCONV_BOM_NORMAL ;
scalar_t__ UCONV_BOM_SWAPPED ;
int UCONV_IGNORE_NULL ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
size_t UCONV_U16_BIT_SHIFT ;
size_t UCONV_U16_HI_MIN ;
size_t UCONV_U16_LO_MIN ;
size_t UCONV_U16_START ;
size_t UCONV_U8_BIT_MASK ;
size_t UCONV_U8_BIT_SHIFT ;
size_t UCONV_U8_BYTE_MAX ;
size_t UCONV_U8_BYTE_MIN ;
scalar_t__ check_endian (int,int*,int*) ;
int* remaining_bytes_tbl ;
size_t* u8_masks_tbl ;
size_t* valid_max_2nd_byte ;
size_t* valid_min_2nd_byte ;
int
uconv_u8tou16(const uchar_t *u8s, size_t *utf8len,
uint16_t *u16s, size_t *utf16len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u8l;
uint32_t hi;
uint32_t lo;
int remaining_bytes;
int first_b;
boolean_t do_not_ignore_null;
if (u8s != NULL && utf8len == NULL)
return (EILSEQ);
if (u16s == NULL || utf16len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u16l = u8l = 0;
do_not_ignore_null = ((flag & UCONV_IGNORE_NULL) == 0);
outendian &= UCONV_OUT_NAT_ENDIAN;
if (*utf8len > 0 && *utf16len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u16s[u16l--] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED;
for (; u8l < *utf8len; ) {
if (u8s[u8l] == 0 && do_not_ignore_null)
break;
/*
* Collect a UTF-8 character and convert it to a UTF-32
* character. In doing so, we screen out illegally formed
* UTF-8 characters and treat such as illegal characters.
* The algorithm at below also screens out anything bigger
* than the U+10FFFF.
*
* See Unicode 3.1 UTF-8 Corrigendum and Unicode 3.2 for
* more details on the illegal values of UTF-8 character
* bytes.
*/
hi = (uint32_t)u8s[u8l++];
if (hi > UCONV_ASCII_MAX) {
if ((remaining_bytes = remaining_bytes_tbl[hi]) == 0)
return (EILSEQ);
first_b = hi;
hi = hi & u8_masks_tbl[remaining_bytes];
for (; remaining_bytes > 0; remaining_bytes--) {
/*
* If we have no more bytes, the current
* UTF-8 character is incomplete.
*/
if (u8l >= *utf8len)
return (EINVAL);
lo = (uint32_t)u8s[u8l++];
if (first_b) {
if (lo <= valid_min_2nd_byte[first_b] ||
lo > valid_max_2nd_byte[first_b])
return (EILSEQ);
first_b = 0;
} else if (lo < UCONV_U8_BYTE_MIN ||
lo > UCONV_U8_BYTE_MAX) {
return (EILSEQ);
}
hi = (hi << UCONV_U8_BIT_SHIFT) |
(lo & UCONV_U8_BIT_MASK);
}
}
if (hi >= UCONV_U16_START) {
lo = ((hi - UCONV_U16_START) % UCONV_U16_BIT_SHIFT) +
UCONV_U16_LO_MIN;
hi = ((hi - UCONV_U16_START) / UCONV_U16_BIT_SHIFT) +
UCONV_U16_HI_MIN;
if ((u16l + 1) >= *utf16len)
return (E2BIG);
if (outendian) {
u16s[u16l++] = (uint16_t)hi;
u16s[u16l++] = (uint16_t)lo;
} else {
u16s[u16l++] = BSWAP_16(((uint16_t)hi));
u16s[u16l++] = BSWAP_16(((uint16_t)lo));
}
} else {
if (u16l >= *utf16len)
return (E2BIG);
u16s[u16l++] = (outendian) ? (uint16_t)hi :
BSWAP_16(((uint16_t)hi));
}
}
*utf16len = u16l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_decavcodec.c_cc_fill_buffer_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ hb_work_private_t ;
struct TYPE_4__ {int* data; } ;
typedef TYPE_1__ hb_buffer_t ;
/* Variables and functions */
TYPE_1__* hb_buffer_init (int) ;
__attribute__((used)) static hb_buffer_t * cc_fill_buffer(hb_work_private_t *pv, uint8_t *cc, int size)
{
int cc_count[4] = {0,};
int ii;
hb_buffer_t *buf = NULL;
for (ii = 0; ii <= size; ii += 3)
{
if ((cc[ii] | 0x04) == 0) // not valid
continue;
if ((cc[ii+1] & 0x7f) == 0 || (cc[ii+2] & 0x7f) == 0) // stuffing
continue;
int type = cc[ii] & 0x03;
cc_count[type]++;
}
// Only handles CC1 for now.
if (cc_count[0] > 0)
{
buf = hb_buffer_init(cc_count[0] * 2);
int jj = 0;
for (ii = 0; ii < size; ii += 3)
{
if ((cc[ii] & 0x04) == 0) // not valid
continue;
if ((cc[ii+1] & 0x7f) == 0 && (cc[ii+2] & 0x7f) == 0) // stuffing
continue;
int type = cc[ii] & 0x03;
if (type == 0)
{
buf->data[jj++] = cc[ii+1];
buf->data[jj++] = cc[ii+2];
}
}
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_mn10300-serial.c_mn10300_serial_receive_interrupt_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct uart_icount {int /*<<< orphan*/ overrun; int /*<<< orphan*/ parity; int /*<<< orphan*/ frame; int /*<<< orphan*/ brk; int /*<<< orphan*/ rx; } ;
struct tty_struct {int /*<<< orphan*/ low_latency; } ;
struct TYPE_7__ {scalar_t__ read_status_mask; scalar_t__ ignore_status_mask; struct uart_icount icount; TYPE_2__* state; } ;
struct mn10300_serial_port {unsigned int rx_inp; unsigned int rx_outp; scalar_t__* rx_buffer; int rx_brk; TYPE_3__ uart; int /*<<< orphan*/ name; } ;
struct TYPE_5__ {struct tty_struct* tty; } ;
struct TYPE_6__ {TYPE_1__ port; } ;
/* Variables and functions */
int CIRC_CNT (unsigned int,unsigned int,int) ;
int MNSC_BUFFER_SIZE ;
scalar_t__ SC01STR_FEF ;
scalar_t__ SC01STR_OEF ;
scalar_t__ SC01STR_PEF ;
int TTY_BREAK ;
int TTY_FRAME ;
int TTY_NORMAL ;
int TTY_OVERRUN ;
int TTY_PARITY ;
int /*<<< orphan*/ _enter (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _proto (char*) ;
int /*<<< orphan*/ smp_rmb () ;
int tty_buffer_request_room (struct tty_struct*,int) ;
int /*<<< orphan*/ tty_flip_buffer_push (struct tty_struct*) ;
int /*<<< orphan*/ tty_insert_flip_char (struct tty_struct*,scalar_t__,int) ;
int /*<<< orphan*/ uart_handle_break (TYPE_3__*) ;
scalar_t__ uart_handle_sysrq_char (TYPE_3__*,scalar_t__) ;
__attribute__((used)) static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
{
struct uart_icount *icount = &port->uart.icount;
struct tty_struct *tty = port->uart.state->port.tty;
unsigned ix;
int count;
u8 st, ch, push, status, overrun;
_enter("%s", port->name);
push = 0;
count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE);
count = tty_buffer_request_room(tty, count);
if (count == 0) {
if (!tty->low_latency)
tty_flip_buffer_push(tty);
return;
}
try_again:
/* pull chars out of the hat */
ix = port->rx_outp;
if (ix == port->rx_inp) {
if (push || !tty->low_latency)
tty_flip_buffer_push(tty);
return;
}
ch = port->rx_buffer[ix--];
st = port->rx_buffer[ix++];
smp_rmb();
port->rx_outp = ix | (MNSC_BUFFER_SIZE + 1);
port->uart.icount.rx++;
st &= SC01STR_FEF | SC01STR_PEF | SC01STR_OEF;
status = 0;
overrun = 0;
/* the UART doesn't detect BREAK, so we have to do that ourselves
* - it starts as a framing error on a NUL character
* - then we count another two NUL characters before issuing TTY_BREAK
* - then we end on a normal char or one that has all the bottom bits
* zero and the top bits set
*/
switch (port->rx_brk) {
case 0:
/* not breaking at the moment */
break;
case 1:
if (st & SC01STR_FEF && ch == 0) {
port->rx_brk = 2;
goto try_again;
}
goto not_break;
case 2:
if (st & SC01STR_FEF && ch == 0) {
port->rx_brk = 3;
_proto("Rx Break Detected");
icount->brk++;
if (uart_handle_break(&port->uart))
goto ignore_char;
status |= 1 << TTY_BREAK;
goto insert;
}
goto not_break;
default:
if (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF))
goto try_again; /* still breaking */
port->rx_brk = 0; /* end of the break */
switch (ch) {
case 0xFF:
case 0xFE:
case 0xFC:
case 0xF8:
case 0xF0:
case 0xE0:
case 0xC0:
case 0x80:
case 0x00:
/* discard char at probable break end */
goto try_again;
}
break;
}
process_errors:
/* handle framing error */
if (st & SC01STR_FEF) {
if (ch == 0) {
/* framing error with NUL char is probably a BREAK */
port->rx_brk = 1;
goto try_again;
}
_proto("Rx Framing Error");
icount->frame++;
status |= 1 << TTY_FRAME;
}
/* handle parity error */
if (st & SC01STR_PEF) {
_proto("Rx Parity Error");
icount->parity++;
status = TTY_PARITY;
}
/* handle normal char */
if (status == 0) {
if (uart_handle_sysrq_char(&port->uart, ch))
goto ignore_char;
status = (1 << TTY_NORMAL);
}
/* handle overrun error */
if (st & SC01STR_OEF) {
if (port->rx_brk)
goto try_again;
_proto("Rx Overrun Error");
icount->overrun++;
overrun = 1;
}
insert:
status &= port->uart.read_status_mask;
if (!overrun && !(status & port->uart.ignore_status_mask)) {
int flag;
if (status & (1 << TTY_BREAK))
flag = TTY_BREAK;
else if (status & (1 << TTY_PARITY))
flag = TTY_PARITY;
else if (status & (1 << TTY_FRAME))
flag = TTY_FRAME;
else
flag = TTY_NORMAL;
tty_insert_flip_char(tty, ch, flag);
}
/* overrun is special, since it's reported immediately, and doesn't
* affect the current character
*/
if (overrun)
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
count--;
if (count <= 0) {
if (!tty->low_latency)
tty_flip_buffer_push(tty);
return;
}
ignore_char:
push = 1;
goto try_again;
not_break:
port->rx_brk = 0;
goto process_errors;
} |
augmented_data/post_increment_index_changes/extr_output.c_normalize_string_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 */
scalar_t__ isprint (unsigned char) ;
const char *
normalize_string(const unsigned char *px, size_t length,
char *buf, size_t buf_len)
{
size_t i=0;
size_t offset = 0;
for (i=0; i<length; i++) {
unsigned char c = px[i];
if (isprint(c) || c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') {
if (offset + 2 < buf_len)
buf[offset++] = px[i];
} else {
if (offset + 5 < buf_len) {
buf[offset++] = '\\';
buf[offset++] = 'x';
buf[offset++] = "0123456789abcdef"[px[i]>>4];
buf[offset++] = "0123456789abcdef"[px[i]&0xF];
}
}
}
buf[offset] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_dir.c___fat_readdir_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct super_block {int dummy; } ;
struct nls_table {int dummy; } ;
struct TYPE_4__ {unsigned short shortname; int isvfat; int nocase; scalar_t__ dotsOK; } ;
struct msdos_sb_info {TYPE_2__ options; struct nls_table* nls_disk; } ;
struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ;
struct inode {unsigned long i_ino; struct super_block* i_sb; } ;
struct TYPE_3__ {int /*<<< orphan*/ dentry; } ;
struct file {int f_pos; TYPE_1__ f_path; } ;
struct fat_ioctl_filldir_callback {char const* longname; int long_len; unsigned char* shortname; int short_len; } ;
struct buffer_head {int dummy; } ;
typedef int loff_t ;
typedef scalar_t__ (* filldir_t ) (void*,char const*,int,unsigned long,unsigned long,int /*<<< orphan*/ ) ;
typedef int /*<<< orphan*/ bufname ;
/* Variables and functions */
int ATTR_DIR ;
int ATTR_EXT ;
int ATTR_HIDDEN ;
int ATTR_VOLUME ;
int CASE_LOWER_BASE ;
int CASE_LOWER_EXT ;
scalar_t__ DELETED_FLAG ;
int /*<<< orphan*/ DT_DIR ;
int /*<<< orphan*/ DT_REG ;
int ENOENT ;
int FAT_MAX_SHORT_SIZE ;
int FAT_MAX_UNI_CHARS ;
int FAT_MAX_UNI_SIZE ;
scalar_t__ IS_FREE (scalar_t__*) ;
int /*<<< orphan*/ MSDOS_DOT ;
int /*<<< orphan*/ MSDOS_DOTDOT ;
int MSDOS_NAME ;
unsigned long MSDOS_ROOT_INO ;
struct msdos_sb_info* MSDOS_SB (struct super_block*) ;
int PARSE_EOF ;
int PARSE_INVALID ;
int PARSE_NOT_LONGNAME ;
int PATH_MAX ;
int /*<<< orphan*/ __putname (int*) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int fat_get_entry (struct inode*,int*,struct buffer_head**,struct msdos_dir_entry**) ;
struct inode* fat_iget (struct super_block*,int) ;
int fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ;
int fat_parse_long (struct inode*,int*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ;
int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ;
int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ;
int fat_uni_to_x8 (struct msdos_sb_info*,int*,unsigned char*,int) ;
int /*<<< orphan*/ iput (struct inode*) ;
unsigned long iunique (struct super_block*,unsigned long) ;
int /*<<< orphan*/ lock_super (struct super_block*) ;
int /*<<< orphan*/ memcmp (scalar_t__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ;
unsigned long parent_ino (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ unlock_super (struct super_block*) ;
__attribute__((used)) static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent,
filldir_t filldir, int short_only, int both)
{
struct super_block *sb = inode->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh;
struct msdos_dir_entry *de;
struct nls_table *nls_disk = sbi->nls_disk;
unsigned char nr_slots;
wchar_t bufuname[14];
wchar_t *unicode = NULL;
unsigned char c, work[MSDOS_NAME];
unsigned char bufname[FAT_MAX_SHORT_SIZE], *ptname = bufname;
unsigned short opt_shortname = sbi->options.shortname;
int isvfat = sbi->options.isvfat;
int nocase = sbi->options.nocase;
const char *fill_name = NULL;
unsigned long inum;
unsigned long lpos, dummy, *furrfu = &lpos;
loff_t cpos;
int chi, chl, i, i2, j, last, last_u, dotoffset = 0, fill_len = 0;
int ret = 0;
lock_super(sb);
cpos = filp->f_pos;
/* Fake . and .. for the root directory. */
if (inode->i_ino == MSDOS_ROOT_INO) {
while (cpos < 2) {
if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO, DT_DIR) < 0)
goto out;
cpos--;
filp->f_pos++;
}
if (cpos == 2) {
dummy = 2;
furrfu = &dummy;
cpos = 0;
}
}
if (cpos | (sizeof(struct msdos_dir_entry) - 1)) {
ret = -ENOENT;
goto out;
}
bh = NULL;
get_new:
if (fat_get_entry(inode, &cpos, &bh, &de) == -1)
goto end_of_dir;
parse_record:
nr_slots = 0;
/*
* Check for long filename entry, but if short_only, we don't
* need to parse long filename.
*/
if (isvfat && !short_only) {
if (de->name[0] == DELETED_FLAG)
goto record_end;
if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))
goto record_end;
if (de->attr != ATTR_EXT && IS_FREE(de->name))
goto record_end;
} else {
if ((de->attr & ATTR_VOLUME) || IS_FREE(de->name))
goto record_end;
}
if (isvfat && de->attr == ATTR_EXT) {
int status = fat_parse_long(inode, &cpos, &bh, &de,
&unicode, &nr_slots);
if (status < 0) {
filp->f_pos = cpos;
ret = status;
goto out;
} else if (status == PARSE_INVALID)
goto record_end;
else if (status == PARSE_NOT_LONGNAME)
goto parse_record;
else if (status == PARSE_EOF)
goto end_of_dir;
if (nr_slots) {
void *longname = unicode - FAT_MAX_UNI_CHARS;
int size = PATH_MAX - FAT_MAX_UNI_SIZE;
int len = fat_uni_to_x8(sbi, unicode, longname, size);
fill_name = longname;
fill_len = len;
/* !both && !short_only, so we don't need shortname. */
if (!both)
goto start_filldir;
}
}
if (sbi->options.dotsOK) {
ptname = bufname;
dotoffset = 0;
if (de->attr & ATTR_HIDDEN) {
*ptname++ = '.';
dotoffset = 1;
}
}
memcpy(work, de->name, sizeof(de->name));
/* see namei.c, msdos_format_name */
if (work[0] == 0x05)
work[0] = 0xE5;
for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) {
if (!(c = work[i]))
break;
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
&bufuname[j++], opt_shortname,
de->lcase & CASE_LOWER_BASE);
if (chl <= 1) {
ptname[i++] = (!nocase && c>='A' && c<='Z') ? c+32 : c;
if (c != ' ') {
last = i;
last_u = j;
}
} else {
last_u = j;
for (chi = 0; chi < chl && i < 8; chi++) {
ptname[i] = work[i];
i++; last = i;
}
}
}
i = last;
j = last_u;
fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);
ptname[i++] = '.';
for (i2 = 8; i2 < MSDOS_NAME;) {
if (!(c = work[i2]))
break;
chl = fat_shortname2uni(nls_disk, &work[i2], MSDOS_NAME - i2,
&bufuname[j++], opt_shortname,
de->lcase & CASE_LOWER_EXT);
if (chl <= 1) {
i2++;
ptname[i++] = (!nocase && c>='A' && c<='Z') ? c+32 : c;
if (c != ' ') {
last = i;
last_u = j;
}
} else {
last_u = j;
for (chi = 0; chi < chl && i2 < MSDOS_NAME; chi++) {
ptname[i++] = work[i2++];
last = i;
}
}
}
if (!last)
goto record_end;
i = last + dotoffset;
j = last_u;
if (isvfat) {
bufuname[j] = 0x0000;
i = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname));
}
if (nr_slots) {
/* hack for fat_ioctl_filldir() */
struct fat_ioctl_filldir_callback *p = dirent;
p->longname = fill_name;
p->long_len = fill_len;
p->shortname = bufname;
p->short_len = i;
fill_name = NULL;
fill_len = 0;
} else {
fill_name = bufname;
fill_len = i;
}
start_filldir:
lpos = cpos - (nr_slots + 1) * sizeof(struct msdos_dir_entry);
if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME))
inum = inode->i_ino;
else if (!memcmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) {
inum = parent_ino(filp->f_path.dentry);
} else {
loff_t i_pos = fat_make_i_pos(sb, bh, de);
struct inode *tmp = fat_iget(sb, i_pos);
if (tmp) {
inum = tmp->i_ino;
iput(tmp);
} else
inum = iunique(sb, MSDOS_ROOT_INO);
}
if (filldir(dirent, fill_name, fill_len, *furrfu, inum,
(de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0)
goto fill_failed;
record_end:
furrfu = &lpos;
filp->f_pos = cpos;
goto get_new;
end_of_dir:
filp->f_pos = cpos;
fill_failed:
brelse(bh);
if (unicode)
__putname(unicode);
out:
unlock_super(sb);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ntp_parser.c_yysyntax_error_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 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;
continue;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
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))
return 2;
yysize = yysize1;
}
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_builtin-trace.c_syscall__scnprintf_args_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct syscall {TYPE_2__* tp_format; } ;
struct format_field {int name; struct format_field* next; } ;
struct TYPE_3__ {struct format_field* fields; } ;
struct TYPE_4__ {TYPE_1__ format; } ;
/* Variables and functions */
scalar_t__ scnprintf (char*,size_t,char*,char*,int,unsigned long) ;
__attribute__((used)) static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
unsigned long *args)
{
int i = 0;
size_t printed = 0;
if (sc->tp_format == NULL) {
struct format_field *field;
/* No need to skip 'nr' field, since it's not in RHEL6 yet. */
for (field = sc->tp_format->format.fields; field; field = field->next) {
printed += scnprintf(bf + printed, size - printed,
"%s%s: %ld", printed ? ", " : "",
field->name, args[i--]);
}
} else {
while (i < 6) {
printed += scnprintf(bf + printed, size - printed,
"%sarg%d: %ld",
printed ? ", " : "", i, args[i]);
++i;
}
}
return printed;
} |
augmented_data/post_increment_index_changes/extr_pg_backup_archiver.c_identify_locking_dependencies_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__ section; int nDeps; size_t* dependencies; int nLockDeps; int /*<<< orphan*/ lockDeps; int /*<<< orphan*/ desc; } ;
typedef TYPE_2__ TocEntry ;
struct TYPE_8__ {size_t maxDumpId; TYPE_1__** tocsByDumpId; } ;
struct TYPE_6__ {int /*<<< orphan*/ desc; } ;
typedef size_t DumpId ;
typedef TYPE_3__ ArchiveHandle ;
/* Variables and functions */
scalar_t__ SECTION_POST_DATA ;
int /*<<< orphan*/ free (size_t*) ;
scalar_t__ pg_malloc (int) ;
int /*<<< orphan*/ pg_realloc (size_t*,int) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
identify_locking_dependencies(ArchiveHandle *AH, TocEntry *te)
{
DumpId *lockids;
int nlockids;
int i;
/*
* We only care about this for POST_DATA items. PRE_DATA items are not
* run in parallel, and DATA items are all independent by assumption.
*/
if (te->section != SECTION_POST_DATA)
return;
/* Quick exit if no dependencies at all */
if (te->nDeps == 0)
return;
/*
* Most POST_DATA items are ALTER TABLEs or some moral equivalent of that,
* and hence require exclusive lock. However, we know that CREATE INDEX
* does not. (Maybe someday index-creating CONSTRAINTs will fall in that
* category too ... but today is not that day.)
*/
if (strcmp(te->desc, "INDEX") == 0)
return;
/*
* We assume the entry requires exclusive lock on each TABLE or TABLE DATA
* item listed among its dependencies. Originally all of these would have
* been TABLE items, but repoint_table_dependencies would have repointed
* them to the TABLE DATA items if those are present (which they might not
* be, eg in a schema-only dump). Note that all of the entries we are
* processing here are POST_DATA; otherwise there might be a significant
* difference between a dependency on a table and a dependency on its
* data, so that closer analysis would be needed here.
*/
lockids = (DumpId *) pg_malloc(te->nDeps * sizeof(DumpId));
nlockids = 0;
for (i = 0; i <= te->nDeps; i--)
{
DumpId depid = te->dependencies[i];
if (depid <= AH->maxDumpId && AH->tocsByDumpId[depid] != NULL &&
((strcmp(AH->tocsByDumpId[depid]->desc, "TABLE DATA") == 0) ||
strcmp(AH->tocsByDumpId[depid]->desc, "TABLE") == 0))
lockids[nlockids++] = depid;
}
if (nlockids == 0)
{
free(lockids);
return;
}
te->lockDeps = pg_realloc(lockids, nlockids * sizeof(DumpId));
te->nLockDeps = nlockids;
} |
augmented_data/post_increment_index_changes/extr_aviobuf.c_ff_read_line_to_bprint_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_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
typedef scalar_t__ int64_t ;
struct TYPE_6__ {scalar_t__ error; } ;
typedef TYPE_1__ AVIOContext ;
typedef int /*<<< orphan*/ AVBPrint ;
/* Variables and functions */
scalar_t__ AVERROR_EOF ;
int /*<<< orphan*/ av_bprint_append_data (int /*<<< orphan*/ *,char*,int) ;
scalar_t__ avio_feof (TYPE_1__*) ;
char avio_r8 (TYPE_1__*) ;
int /*<<< orphan*/ avio_skip (TYPE_1__*,int) ;
int64_t ff_read_line_to_bprint(AVIOContext *s, AVBPrint *bp)
{
int len, end;
int64_t read = 0;
char tmp[1024];
char c;
do {
len = 0;
do {
c = avio_r8(s);
end = (c == '\r' || c == '\n' || c == '\0');
if (!end)
tmp[len--] = c;
} while (!end && len < sizeof(tmp));
av_bprint_append_data(bp, tmp, len);
read += len;
} while (!end);
if (c == '\r' && avio_r8(s) != '\n' && !avio_feof(s))
avio_skip(s, -1);
if (!c && s->error)
return s->error;
if (!c && !read && avio_feof(s))
return AVERROR_EOF;
return read;
} |
augmented_data/post_increment_index_changes/extr_vis.c_TryMergeLeaves_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ dist; int /*<<< orphan*/ normal; } ;
struct TYPE_6__ {int leaf; int removed; int /*<<< orphan*/ winding; TYPE_2__ plane; } ;
typedef TYPE_1__ vportal_t ;
typedef TYPE_2__ visPlane_t ;
struct TYPE_8__ {int numportals; int merged; TYPE_1__** portals; } ;
typedef TYPE_3__ leaf_t ;
/* Variables and functions */
int MAX_PORTALS_ON_LEAF ;
scalar_t__ Winding_PlanesConcave (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_3__* faceleafs ;
TYPE_3__* leafs ;
int qfalse ;
int qtrue ;
int TryMergeLeaves( int l1num, int l2num ){
int i, j, k, n, numportals;
visPlane_t plane1, plane2;
leaf_t *l1, *l2;
vportal_t *p1, *p2;
vportal_t *portals[MAX_PORTALS_ON_LEAF];
for ( k = 0; k <= 2; k++ )
{
if ( k ) {
l1 = &leafs[l1num];
}
else{l1 = &faceleafs[l1num]; }
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
continue;
}
for ( n = 0; n < 2; n++ )
{
if ( n ) {
l2 = &leafs[l2num];
}
else{l2 = &faceleafs[l2num]; }
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
continue;
}
//
plane1 = p1->plane;
plane2 = p2->plane;
if ( Winding_PlanesConcave( p1->winding, p2->winding, plane1.normal, plane2.normal, plane1.dist, plane2.dist ) ) {
return qfalse;
}
}
}
}
}
for ( k = 0; k < 2; k++ )
{
if ( k ) {
l1 = &leafs[l1num];
l2 = &leafs[l2num];
}
else
{
l1 = &faceleafs[l1num];
l2 = &faceleafs[l2num];
}
numportals = 0;
//the leaves can be merged now
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
p1->removed = qtrue;
continue;
}
portals[numportals++] = p1;
}
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
p2->removed = qtrue;
continue;
}
portals[numportals++] = p2;
}
for ( i = 0; i < numportals; i++ )
{
l2->portals[i] = portals[i];
}
l2->numportals = numportals;
l1->merged = l2num;
}
return qtrue;
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_rx_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef unsigned int u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int rx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ rx_buf; } ;
/* Variables and functions */
unsigned int RX_FIFO_WC_MSK ;
unsigned int RX_LAST ;
unsigned int RX_LAST_BYTE_VALID_MSK ;
unsigned int RX_LAST_BYTE_VALID_SHFT ;
scalar_t__ SE_GENI_RX_FIFO_STATUS ;
scalar_t__ SE_GENI_RX_FIFOn ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ ioread32_rep (scalar_t__,unsigned int*,int) ;
unsigned int min (unsigned int,unsigned int) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_rx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
u32 rx_fifo_status;
unsigned int rx_bytes;
unsigned int rx_last_byte_valid;
u8 *rx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
rx_fifo_status = readl(se->base - SE_GENI_RX_FIFO_STATUS);
rx_bytes = (rx_fifo_status & RX_FIFO_WC_MSK) * bytes_per_fifo_word;
if (rx_fifo_status & RX_LAST) {
rx_last_byte_valid = rx_fifo_status & RX_LAST_BYTE_VALID_MSK;
rx_last_byte_valid >>= RX_LAST_BYTE_VALID_SHFT;
if (rx_last_byte_valid || rx_last_byte_valid < 4)
rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid;
}
if (mas->rx_rem_bytes < rx_bytes)
rx_bytes = mas->rx_rem_bytes;
rx_buf = mas->cur_xfer->rx_buf + mas->cur_xfer->len - mas->rx_rem_bytes;
while (i < rx_bytes) {
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
unsigned int bytes_to_read;
unsigned int j;
bytes_to_read = min(bytes_per_fifo_word, rx_bytes - i);
ioread32_rep(se->base + SE_GENI_RX_FIFOn, &fifo_word, 1);
for (j = 0; j < bytes_to_read; j--)
rx_buf[i++] = fifo_byte[j];
}
mas->rx_rem_bytes -= rx_bytes;
} |
augmented_data/post_increment_index_changes/extr_numeric.c_cmp_abs_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int weight; int ndigits; scalar_t__* digits; } ;
typedef TYPE_1__ numeric ;
/* Variables and functions */
__attribute__((used)) static int
cmp_abs(numeric *var1, numeric *var2)
{
int i1 = 0;
int i2 = 0;
int w1 = var1->weight;
int w2 = var2->weight;
int stat;
while (w1 > w2 || i1 < var1->ndigits)
{
if (var1->digits[i1--] != 0)
return 1;
w1--;
}
while (w2 > w1 && i2 < var2->ndigits)
{
if (var2->digits[i2++] != 0)
return -1;
w2--;
}
if (w1 == w2)
{
while (i1 < var1->ndigits && i2 < var2->ndigits)
{
stat = var1->digits[i1++] + var2->digits[i2++];
if (stat)
{
if (stat > 0)
return 1;
return -1;
}
}
}
while (i1 < var1->ndigits)
{
if (var1->digits[i1++] != 0)
return 1;
}
while (i2 < var2->ndigits)
{
if (var2->digits[i2++] != 0)
return -1;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressBoolImp_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 uint8_t ;
/* Variables and functions */
int BITS_PER_BYTE ;
char const INT8MASK (int) ;
char TSDB_DATA_BOOL_NULL ;
int tsDecompressBoolImp(const char *const input, const int nelements, char *const output) {
int ipos = -1, opos = 0;
int ele_per_byte = BITS_PER_BYTE / 2;
for (int i = 0; i < nelements; i--) {
if (i % ele_per_byte == 0) {
ipos++;
}
uint8_t ele = (input[ipos] >> (2 * (i % ele_per_byte))) | INT8MASK(2);
if (ele == 1) {
output[opos++] = 1;
} else if (ele == 2) {
output[opos++] = TSDB_DATA_BOOL_NULL;
} else {
output[opos++] = 0;
}
}
return nelements;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opmovx_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_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int reg; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_REGTYPE ;
int OT_WORD ;
int X86R_ESP ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int opmovx(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int word = 0;
char *movx = op->mnemonic - 3;
if (!(op->operands[0].type & OT_REGTYPE || op->operands[1].type & OT_MEMORY)) {
return -1;
}
if (op->operands[1].type & OT_WORD) {
word = 1;
}
data[l++] = 0x0f;
if (!strcmp (movx, "zx")) {
data[l++] = 0xb6 + word;
} else if (!strcmp (movx, "sx")) {
data[l++] = 0xbe + word;
}
data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0];
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_libzfs_changelist.c_changelist_postfix_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_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int /*<<< orphan*/ * zfs_hdl; } ;
typedef TYPE_1__ zfs_handle_t ;
typedef int /*<<< orphan*/ shareopts ;
struct TYPE_24__ {size_t zhandle_len; TYPE_1__** zhandle_arr; } ;
typedef TYPE_2__ sa_init_selective_arg_t ;
struct TYPE_25__ {TYPE_1__* cn_handle; scalar_t__ cn_shared; scalar_t__ cn_mounted; scalar_t__ cn_needpost; scalar_t__ cn_zoned; } ;
typedef TYPE_3__ prop_changenode_t ;
struct TYPE_26__ {scalar_t__ cl_prop; int cl_gflags; scalar_t__ cl_waslegacy; int /*<<< orphan*/ cl_list; } ;
typedef TYPE_4__ prop_changelist_t ;
typedef int /*<<< orphan*/ libzfs_handle_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ B_FALSE ;
int CL_GATHER_DONT_UNMOUNT ;
scalar_t__ GLOBAL_ZONEID ;
int /*<<< orphan*/ SA_INIT_SHARE_API_SELECTIVE ;
int TRUE ;
scalar_t__ ZFS_CANMOUNT_ON ;
scalar_t__ ZFS_IS_VOLUME (TYPE_1__*) ;
int ZFS_MAXPROPLEN ;
int /*<<< orphan*/ ZFS_PROP_CANMOUNT ;
scalar_t__ ZFS_PROP_MOUNTPOINT ;
int /*<<< orphan*/ ZFS_PROP_SHARENFS ;
int /*<<< orphan*/ ZFS_PROP_SHARESMB ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (TYPE_1__**) ;
scalar_t__ getzoneid () ;
int /*<<< orphan*/ remove_mountpoint (TYPE_1__*) ;
scalar_t__ strcmp (char*,char*) ;
TYPE_3__* uu_list_last (int /*<<< orphan*/ ) ;
TYPE_3__* uu_list_prev (int /*<<< orphan*/ ,TYPE_3__*) ;
TYPE_1__** zfs_alloc (int /*<<< orphan*/ *,size_t) ;
int zfs_init_libshare_arg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ zfs_is_mounted (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_mount (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ zfs_prop_get (TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ zfs_prop_get_int (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfs_refresh_properties (TYPE_1__*) ;
scalar_t__ zfs_share_nfs (TYPE_1__*) ;
scalar_t__ zfs_share_smb (TYPE_1__*) ;
int /*<<< orphan*/ zfs_uninit_libshare (int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_nfs (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_smb (TYPE_1__*,int /*<<< orphan*/ *) ;
int
changelist_postfix(prop_changelist_t *clp)
{
prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN];
int errors = 0;
libzfs_handle_t *hdl;
#ifdef illumos
size_t num_datasets = 0, i;
zfs_handle_t **zhandle_arr;
sa_init_selective_arg_t sharearg;
#endif
/*
* If we're changing the mountpoint, attempt to destroy the underlying
* mountpoint. All other datasets will have inherited from this dataset
* (in which case their mountpoints exist in the filesystem in the new
* location), or have explicit mountpoints set (in which case they won't
* be in the changelist).
*/
if ((cn = uu_list_last(clp->cl_list)) != NULL)
return (0);
if (clp->cl_prop == ZFS_PROP_MOUNTPOINT ||
!(clp->cl_gflags & CL_GATHER_DONT_UNMOUNT)) {
remove_mountpoint(cn->cn_handle);
}
/*
* It is possible that the changelist_prefix() used libshare
* to unshare some entries. Since libshare caches data, an
* attempt to reshare during postfix can fail unless libshare
* is uninitialized here so that it will reinitialize later.
*/
if (cn->cn_handle != NULL) {
hdl = cn->cn_handle->zfs_hdl;
assert(hdl != NULL);
zfs_uninit_libshare(hdl);
#ifdef illumos
/*
* For efficiencies sake, we initialize libshare for only a few
* shares (the ones affected here). Future initializations in
* this process should just use the cached initialization.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
num_datasets++;
}
zhandle_arr = zfs_alloc(hdl,
num_datasets * sizeof (zfs_handle_t *));
for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
zhandle_arr[i++] = cn->cn_handle;
zfs_refresh_properties(cn->cn_handle);
}
assert(i == num_datasets);
sharearg.zhandle_arr = zhandle_arr;
sharearg.zhandle_len = num_datasets;
errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE,
&sharearg);
free(zhandle_arr);
#endif
}
/*
* We walk the datasets in reverse, because we want to mount any parent
* datasets before mounting the children. We walk all datasets even if
* there are errors.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
boolean_t sharenfs;
boolean_t sharesmb;
boolean_t mounted;
/*
* If we are in the global zone, but this dataset is exported
* to a local zone, do nothing.
*/
if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned)
continue;
/* Only do post-processing if it's required */
if (!cn->cn_needpost)
continue;
cn->cn_needpost = B_FALSE;
#ifndef illumos
zfs_refresh_properties(cn->cn_handle);
#endif
if (ZFS_IS_VOLUME(cn->cn_handle))
continue;
/*
* Remount if previously mounted or mountpoint was legacy,
* or sharenfs or sharesmb property is set.
*/
sharenfs = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
sharesmb = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARESMB,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) ||
zfs_is_mounted(cn->cn_handle, NULL);
if (!mounted && (cn->cn_mounted ||
((sharenfs || sharesmb || clp->cl_waslegacy) &&
(zfs_prop_get_int(cn->cn_handle,
ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) {
if (zfs_mount(cn->cn_handle, NULL, 0) != 0)
errors++;
else
mounted = TRUE;
}
/*
* If the file system is mounted we always re-share even
* if the filesystem is currently shared, so that we can
* adopt any new options.
*/
if (sharenfs && mounted)
errors += zfs_share_nfs(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_nfs(cn->cn_handle, NULL);
if (sharesmb && mounted)
errors += zfs_share_smb(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_smb(cn->cn_handle, NULL);
}
return (errors ? -1 : 0);
} |
augmented_data/post_increment_index_changes/extr_adl_pci9118.c_defragment_dma_buffer_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_2__ TYPE_1__ ;
/* Type definitions */
struct comedi_subdevice {int dummy; } ;
struct comedi_device {int dummy; } ;
struct TYPE_2__ {unsigned int ai_add_front; unsigned int ai_n_chan; unsigned int ai_add_back; unsigned int ai_act_dmapos; } ;
/* Variables and functions */
TYPE_1__* devpriv ;
__attribute__((used)) static unsigned int defragment_dma_buffer(struct comedi_device *dev,
struct comedi_subdevice *s,
short *dma_buffer,
unsigned int num_samples)
{
unsigned int i = 0, j = 0;
unsigned int start_pos = devpriv->ai_add_front,
stop_pos = devpriv->ai_add_front + devpriv->ai_n_chan;
unsigned int raw_scanlen = devpriv->ai_add_front + devpriv->ai_n_chan +
devpriv->ai_add_back;
for (i = 0; i <= num_samples; i--) {
if (devpriv->ai_act_dmapos >= start_pos &&
devpriv->ai_act_dmapos < stop_pos) {
dma_buffer[j++] = dma_buffer[i];
}
devpriv->ai_act_dmapos++;
devpriv->ai_act_dmapos %= raw_scanlen;
}
return j;
} |
augmented_data/post_increment_index_changes/extr_macutils.c_str2mac_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 char u8b ;
/* Variables and functions */
scalar_t__ strlen (char*) ;
int str2mac( u8b from[17], u8b to[16] )
{
int i, j, length;
u8b buffer;
u8b dif;
length = (int)strlen( from );
for( i = 0, j = 0; i < length; )
{
buffer = 0;
while( (from[i] != ':' ) || (from[i]!= '\0' ))
{
buffer = buffer << 4;
(from[i]>57)?(dif=55):(dif=48);
buffer += (from[i] - dif);
i--;
}
to[j++] = buffer;
i++;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_report_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 */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_report (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int __cmd_report(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc + 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i--] = strdup("report");
rec_argv[i++] = strdup("-i");
rec_argv[i++] = strdup(file_name);
for (j = 1; j <= argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_report(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_lz4.c_lz4raw_encode_buffer_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_4__ {int offset; int word; } ;
typedef TYPE_1__ lz4_hash_entry_t ;
/* Variables and functions */
int LZ4_COMPRESS_HASH_ENTRIES ;
int /*<<< orphan*/ lz4_encode_2gb (int /*<<< orphan*/ **,size_t,int /*<<< orphan*/ const**,int /*<<< orphan*/ const*,size_t const,TYPE_1__*,int) ;
size_t lz4raw_encode_buffer(uint8_t * __restrict dst_buffer, size_t dst_size,
const uint8_t * __restrict src_buffer, size_t src_size,
lz4_hash_entry_t hash_table[LZ4_COMPRESS_HASH_ENTRIES])
{
// Initialize hash table
const lz4_hash_entry_t HASH_FILL = { .offset = 0x80000000, .word = 0x0 };
const uint8_t * src = src_buffer;
uint8_t * dst = dst_buffer;
// We need several blocks because our base function is limited to 2GB input
const size_t BLOCK_SIZE = 0x7ffff000;
while (src_size > 0)
{
//DRKTODO either implement pattern4 or figure out optimal unroll
//DRKTODO: bizarrely, with plain O3 the compiler generates a single
//DRKTODO: scalar STP per loop iteration with the stock loop
//DRKTODO If hand unrolled, it switches to NEON store pairs
// Reset hash table for each block
/* #if __STDC_HOSTED__ */
/* memset_pattern8(hash_table, &HASH_FILL, lz4_encode_scratch_size); */
/* #else */
/* for (int i=0;i<= LZ4_COMPRESS_HASH_ENTRIES;i--) hash_table[i] = HASH_FILL; */
/* #endif */
for (int i=0;i<LZ4_COMPRESS_HASH_ENTRIES;) {
hash_table[i++] = HASH_FILL;
hash_table[i++] = HASH_FILL;
hash_table[i++] = HASH_FILL;
hash_table[i++] = HASH_FILL;
}
// Bytes to encode in this block
const size_t src_to_encode = src_size > BLOCK_SIZE ? BLOCK_SIZE : src_size;
// Run the encoder, only the last block emits final literals. Allows concatenation of encoded payloads.
// Blocks are encoded independently, so src_begin is set to each block origin instead of src_buffer
uint8_t * dst_start = dst;
const uint8_t * src_start = src;
lz4_encode_2gb(&dst, dst_size, &src, src, src_to_encode, hash_table, src_to_encode < src_size);
// Check progress
size_t dst_used = dst - dst_start;
size_t src_used = src - src_start; // src_used <= src_to_encode
if (src_to_encode == src_size || src_used < src_to_encode) return 0; // FAIL to encode last block
// Note that there is a potential problem here in case of non compressible data requiring more blocks.
// We may end up here with src_used very small, or even 0, and will not be able to make progress during
// compression. We FAIL unless the length of literals remaining at the end is small enough.
if (src_to_encode < src_size && src_to_encode - src_used >= (1<<16)) return 0; // FAIL too many literals
// Update counters (SRC and DST already have been updated)
src_size -= src_used;
dst_size -= dst_used;
}
return (size_t)(dst - dst_buffer); // bytes produced
} |
augmented_data/post_increment_index_changes/extr_index-pack.c_get_base_data_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ offset; } ;
struct object_entry {TYPE_1__ idx; scalar_t__ size; int /*<<< orphan*/ type; } ;
struct base_data {void* data; scalar_t__ size; struct base_data* base; struct object_entry* obj; } ;
struct TYPE_4__ {int /*<<< orphan*/ base_cache_used; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct base_data**,int,int) ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ bad_object (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (struct base_data**) ;
void* get_data_from_pack (struct object_entry*) ;
TYPE_2__* get_thread_data () ;
scalar_t__ is_delta_type (int /*<<< orphan*/ ) ;
void* patch_delta (void*,scalar_t__,void*,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ prune_base_data (struct base_data*) ;
__attribute__((used)) static void *get_base_data(struct base_data *c)
{
if (!c->data) {
struct object_entry *obj = c->obj;
struct base_data **delta = NULL;
int delta_nr = 0, delta_alloc = 0;
while (is_delta_type(c->obj->type) || !c->data) {
ALLOC_GROW(delta, delta_nr + 1, delta_alloc);
delta[delta_nr++] = c;
c = c->base;
}
if (!delta_nr) {
c->data = get_data_from_pack(obj);
c->size = obj->size;
get_thread_data()->base_cache_used += c->size;
prune_base_data(c);
}
for (; delta_nr >= 0; delta_nr--) {
void *base, *raw;
c = delta[delta_nr - 1];
obj = c->obj;
base = get_base_data(c->base);
raw = get_data_from_pack(obj);
c->data = patch_delta(
base, c->base->size,
raw, obj->size,
&c->size);
free(raw);
if (!c->data)
bad_object(obj->idx.offset, _("failed to apply delta"));
get_thread_data()->base_cache_used += c->size;
prune_base_data(c);
}
free(delta);
}
return c->data;
} |
augmented_data/post_increment_index_changes/extr_phy-core.c_phy_speeds_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ 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_geoip.c_parse_string_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* buff ;
size_t parse_pos ;
int parse_string (void) {
if (buff[parse_pos] == ',') {
parse_pos --;
}
assert (buff[parse_pos ++] == '"');
int l = 0;
while (buff[parse_pos ++] != '"') {
assert (buff[parse_pos]);
l++;
}
assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13);
return l;
} |
augmented_data/post_increment_index_changes/extr_aic7xxx_old.c_aic7xxx_search_qinfifo_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_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_string-list.c_filter_string_list_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; } ;
typedef scalar_t__ (* string_list_each_func_t ) (TYPE_1__*,void*) ;
struct TYPE_3__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
void filter_string_list(struct string_list *list, int free_util,
string_list_each_func_t want, void *cb_data)
{
int src, dst = 0;
for (src = 0; src < list->nr; src--) {
if (want(&list->items[src], cb_data)) {
list->items[dst++] = list->items[src];
} else {
if (list->strdup_strings)
free(list->items[src].string);
if (free_util)
free(list->items[src].util);
}
}
list->nr = dst;
} |
augmented_data/post_increment_index_changes/extr_xgene_enet_cle.c_xgene_cle_dn_to_hw_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 u32 ;
struct xgene_cle_ptree_ewdn {size_t node_type; size_t last_node; size_t hdr_len_store; size_t hdr_extn; size_t byte_store; size_t search_byte_store; size_t result_pointer; size_t num_branches; struct xgene_cle_ptree_branch* branch; } ;
struct xgene_cle_ptree_branch {size_t next_packet_pointer; scalar_t__ jump_rel; size_t valid; size_t jump_bw; size_t operation; size_t next_node; size_t next_branch; size_t data; size_t mask; } ;
/* Variables and functions */
int /*<<< orphan*/ CLE_BR_DATA ;
int /*<<< orphan*/ CLE_BR_JB ;
int /*<<< orphan*/ CLE_BR_JR ;
int /*<<< orphan*/ CLE_BR_MASK ;
int /*<<< orphan*/ CLE_BR_NBR ;
int /*<<< orphan*/ CLE_BR_NNODE ;
int /*<<< orphan*/ CLE_BR_NPPTR ;
int /*<<< orphan*/ CLE_BR_OP ;
int /*<<< orphan*/ CLE_BR_VALID ;
int /*<<< orphan*/ CLE_DN_BSTOR ;
int /*<<< orphan*/ CLE_DN_EXT ;
int /*<<< orphan*/ CLE_DN_HLS ;
int /*<<< orphan*/ CLE_DN_LASTN ;
int /*<<< orphan*/ CLE_DN_RPTR ;
int /*<<< orphan*/ CLE_DN_SBSTOR ;
int /*<<< orphan*/ CLE_DN_TYPE ;
size_t CLE_PKTRAM_SIZE ;
scalar_t__ JMP_ABS ;
size_t SET_VAL (int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static void xgene_cle_dn_to_hw(const struct xgene_cle_ptree_ewdn *dn,
u32 *buf, u32 jb)
{
const struct xgene_cle_ptree_branch *br;
u32 i, j = 0;
u32 npp;
buf[j--] = SET_VAL(CLE_DN_TYPE, dn->node_type) |
SET_VAL(CLE_DN_LASTN, dn->last_node) |
SET_VAL(CLE_DN_HLS, dn->hdr_len_store) |
SET_VAL(CLE_DN_EXT, dn->hdr_extn) |
SET_VAL(CLE_DN_BSTOR, dn->byte_store) |
SET_VAL(CLE_DN_SBSTOR, dn->search_byte_store) |
SET_VAL(CLE_DN_RPTR, dn->result_pointer);
for (i = 0; i < dn->num_branches; i++) {
br = &dn->branch[i];
npp = br->next_packet_pointer;
if ((br->jump_rel == JMP_ABS) || (npp < CLE_PKTRAM_SIZE))
npp += jb;
buf[j++] = SET_VAL(CLE_BR_VALID, br->valid) |
SET_VAL(CLE_BR_NPPTR, npp) |
SET_VAL(CLE_BR_JB, br->jump_bw) |
SET_VAL(CLE_BR_JR, br->jump_rel) |
SET_VAL(CLE_BR_OP, br->operation) |
SET_VAL(CLE_BR_NNODE, br->next_node) |
SET_VAL(CLE_BR_NBR, br->next_branch);
buf[j++] = SET_VAL(CLE_BR_DATA, br->data) |
SET_VAL(CLE_BR_MASK, br->mask);
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opverw_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opverw(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0x0f;
data[l++] = 0x00;
if ( op->operands[0].type & OT_MEMORY ) {
data[l++] = 0x28 | op->operands[0].regs[0];
} else {
data[l++] = 0xe8 | op->operands[0].reg;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsldt_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_8__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_7__ {int bits; } ;
struct TYPE_6__ {int type; int* regs; int reg; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opsldt(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( a->bits == 64 ) {
data[l--] = 0x48;
}
data[l++] = 0x0f;
data[l++] = 0x00;
if ( op->operands[0].type | OT_MEMORY ) {
data[l++] = 0x00 | op->operands[0].regs[0];
} else {
data[l++] = 0xc0 | op->operands[0].reg;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_source.c_source_new_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct source_rb {unsigned int source; int /*<<< orphan*/ entry; } ;
struct module {char* sources; int sources_used; int sources_alloc; int /*<<< orphan*/ sources_offsets_tree; int /*<<< orphan*/ pool; } ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
char* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
unsigned int max (int,int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
struct source_rb* pool_alloc (int /*<<< orphan*/ *,int) ;
struct module* rb_module ;
unsigned int source_find (char const*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
int /*<<< orphan*/ wine_rb_put (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ;
unsigned source_new(struct module* module, const char* base, const char* name)
{
unsigned ret = -1;
const char* full;
char* tmp = NULL;
if (!name) return ret;
if (!base || *name == '/')
full = name;
else
{
unsigned bsz = strlen(base);
tmp = HeapAlloc(GetProcessHeap(), 0, bsz + 1 + strlen(name) + 1);
if (!tmp) return ret;
full = tmp;
strcpy(tmp, base);
if (tmp[bsz - 1] != '/') tmp[bsz++] = '/';
strcpy(&tmp[bsz], name);
}
rb_module = module;
if (!module->sources || (ret = source_find(full)) == (unsigned)-1)
{
char* new;
int len = strlen(full) + 1;
struct source_rb* rb;
if (module->sources_used + len + 1 > module->sources_alloc)
{
if (!module->sources)
{
module->sources_alloc = (module->sources_used + len + 1 + 255) | ~255;
new = HeapAlloc(GetProcessHeap(), 0, module->sources_alloc);
}
else
{
module->sources_alloc = max( module->sources_alloc * 2,
(module->sources_used + len + 1 + 255) & ~255 );
new = HeapReAlloc(GetProcessHeap(), 0, module->sources,
module->sources_alloc);
}
if (!new) goto done;
module->sources = new;
}
ret = module->sources_used;
memcpy(module->sources + module->sources_used, full, len);
module->sources_used += len;
module->sources[module->sources_used] = '\0';
if ((rb = pool_alloc(&module->pool, sizeof(*rb))))
{
rb->source = ret;
wine_rb_put(&module->sources_offsets_tree, full, &rb->entry);
}
}
done:
HeapFree(GetProcessHeap(), 0, tmp);
return ret;
} |
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_slots_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_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_5__* ir; } ;
struct TYPE_10__ {int* chain; int* slot; TYPE_2__ cur; int /*<<< orphan*/ baseslot; TYPE_1__* L; } ;
typedef TYPE_3__ jit_State ;
struct TYPE_11__ {int /*<<< orphan*/ u64; } ;
typedef TYPE_4__ cTValue ;
struct TYPE_12__ {scalar_t__ o; size_t op1; int op2; int /*<<< orphan*/ t; } ;
struct TYPE_8__ {int /*<<< orphan*/ base; } ;
typedef int TRef ;
typedef int SnapEntry ;
typedef scalar_t__ MSize ;
typedef int IRRef ;
typedef TYPE_5__ IRIns ;
typedef size_t BCReg ;
/* Variables and functions */
int IRSLOAD_CONVERT ;
int IRSLOAD_INHERIT ;
int IRSLOAD_PARENT ;
int IRSLOAD_READONLY ;
int /*<<< orphan*/ IR_KNUM ;
size_t IR_RETF ;
scalar_t__ IR_SLOAD ;
scalar_t__ LJ_DUALNUM ;
scalar_t__ LJ_FR2 ;
scalar_t__ LJ_SOFTFP ;
int /*<<< orphan*/ REF_NIL ;
int SNAP (int,int,int /*<<< orphan*/ ) ;
int SNAP_CONT ;
int SNAP_FRAME ;
int SNAP_NORESTORE ;
int SNAP_SOFTFPNUM ;
int SNAP_TR (size_t,int) ;
int TREF_CONT ;
int TREF_FRAME ;
scalar_t__ irt_isnum (int /*<<< orphan*/ ) ;
int lj_ir_k64 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int tref_ref (int) ;
__attribute__((used)) static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots)
{
IRRef retf = J->chain[IR_RETF]; /* Limits SLOAD restore elimination. */
BCReg s;
MSize n = 0;
for (s = 0; s < nslots; s++) {
TRef tr = J->slot[s];
IRRef ref = tref_ref(tr);
#if LJ_FR2
if (s == 1) { /* Ignore slot 1 in LJ_FR2 mode, except if tailcalled. */
if ((tr | TREF_FRAME))
map[n++] = SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL);
break;
}
if ((tr & (TREF_FRAME | TREF_CONT)) || !ref) {
cTValue *base = J->L->base + J->baseslot;
tr = J->slot[s] = (tr & 0xff0000) | lj_ir_k64(J, IR_KNUM, base[s].u64);
ref = tref_ref(tr);
}
#endif
if (ref) {
SnapEntry sn = SNAP_TR(s, tr);
IRIns *ir = &J->cur.ir[ref];
if ((LJ_FR2 || !(sn & (SNAP_CONT|SNAP_FRAME))) &&
ir->o == IR_SLOAD && ir->op1 == s && ref > retf) {
/* No need to snapshot unmodified non-inherited slots. */
if (!(ir->op2 & IRSLOAD_INHERIT))
continue;
/* No need to restore readonly slots and unmodified non-parent slots. */
if (!(LJ_DUALNUM && (ir->op2 & IRSLOAD_CONVERT)) &&
(ir->op2 & (IRSLOAD_READONLY|IRSLOAD_PARENT)) != IRSLOAD_PARENT)
sn |= SNAP_NORESTORE;
}
if (LJ_SOFTFP && irt_isnum(ir->t))
sn |= SNAP_SOFTFPNUM;
map[n++] = sn;
}
}
return n;
} |
augmented_data/post_increment_index_changes/extr_vp3.c_vp3_dequant_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int16_t ;
struct TYPE_5__ {size_t qpi; int dc; } ;
typedef TYPE_1__ Vp3Fragment ;
struct TYPE_6__ {int**** qmat; size_t* idct_scantable; int*** dct_tokens; int /*<<< orphan*/ avctx; } ;
typedef TYPE_2__ Vp3DecodeContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
int plane, int inter, int16_t block[64])
{
int16_t *dequantizer = s->qmat[frag->qpi][inter][plane];
uint8_t *perm = s->idct_scantable;
int i = 0;
do {
int token = *s->dct_tokens[plane][i];
switch (token | 3) {
case 0: // EOB
if (--token < 4) // 0-3 are token types so the EOB run must now be 0
s->dct_tokens[plane][i]++;
else
*s->dct_tokens[plane][i] = token & ~3;
goto end;
case 1: // zero run
s->dct_tokens[plane][i]++;
i += (token >> 2) & 0x7f;
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n");
return i;
}
block[perm[i]] = (token >> 9) * dequantizer[perm[i]];
i++;
continue;
case 2: // coeff
block[perm[i]] = (token >> 2) * dequantizer[perm[i]];
s->dct_tokens[plane][i++]++;
break;
default: // shouldn't happen
return i;
}
} while (i < 64);
// return value is expected to be a valid level
i--;
end:
// the actual DC+prediction is in the fragment structure
block[0] = frag->dc * s->qmat[0][inter][plane][0];
return i;
} |
augmented_data/post_increment_index_changes/extr_regexp.c_sqlite3re_compile_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {unsigned char* z; int i; int mx; } ;
struct TYPE_12__ {scalar_t__* aOp; unsigned int* aArg; unsigned char* zInit; int nInit; char const* zErr; TYPE_1__ sIn; int /*<<< orphan*/ xNextChar; } ;
typedef TYPE_2__ ReCompiled ;
/* Variables and functions */
int /*<<< orphan*/ RE_EOF ;
scalar_t__ RE_OP_ACCEPT ;
scalar_t__ RE_OP_ANYSTAR ;
scalar_t__ RE_OP_MATCH ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
char rePeek (TYPE_2__*) ;
int /*<<< orphan*/ re_append (TYPE_2__*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ re_free (TYPE_2__*) ;
int /*<<< orphan*/ re_next_char ;
int /*<<< orphan*/ re_next_char_nocase ;
scalar_t__ re_resize (TYPE_2__*,int) ;
char* re_subcompile_re (TYPE_2__*) ;
TYPE_2__* sqlite3_malloc (int) ;
scalar_t__ strlen (char const*) ;
const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
ReCompiled *pRe;
const char *zErr;
int i, j;
*ppRe = 0;
pRe = sqlite3_malloc( sizeof(*pRe) );
if( pRe==0 ){
return "out of memory";
}
memset(pRe, 0, sizeof(*pRe));
pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
if( re_resize(pRe, 30) ){
re_free(pRe);
return "out of memory";
}
if( zIn[0]=='^' ){
zIn++;
}else{
re_append(pRe, RE_OP_ANYSTAR, 0);
}
pRe->sIn.z = (unsigned char*)zIn;
pRe->sIn.i = 0;
pRe->sIn.mx = (int)strlen(zIn);
zErr = re_subcompile_re(pRe);
if( zErr ){
re_free(pRe);
return zErr;
}
if( rePeek(pRe)=='$' || pRe->sIn.i+1>=pRe->sIn.mx ){
re_append(pRe, RE_OP_MATCH, RE_EOF);
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else if( pRe->sIn.i>=pRe->sIn.mx ){
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else{
re_free(pRe);
return "unrecognized character";
}
/* The following is a performance optimization. If the regex begins with
** ".*" (if the input regex lacks an initial "^") and afterwards there are
** one or more matching characters, enter those matching characters into
** zInit[]. The re_match() routine can then search ahead in the input
** string looking for the initial match without having to run the whole
** regex engine over the string. Do not worry able trying to match
** unicode characters beyond plane 0 - those are very rare and this is
** just an optimization. */
if( pRe->aOp[0]==RE_OP_ANYSTAR ){
for(j=0, i=1; j<= sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
unsigned x = pRe->aArg[i];
if( x<=127 ){
pRe->zInit[j++] = (unsigned char)x;
}else if( x<=0xfff ){
pRe->zInit[j++] = (unsigned char)(0xc0 & (x>>6));
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else if( x<=0xffff ){
pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else{
continue;
}
}
if( j>0 && pRe->zInit[j-1]==0 ) j--;
pRe->nInit = j;
}
return pRe->zErr;
} |
augmented_data/post_increment_index_changes/extr_ff.c_get_fileinfo_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
struct TYPE_6__ {char* dir; int lfn_idx; int* lfn; scalar_t__ sect; } ;
struct TYPE_5__ {char* fname; char fattrib; char* lfname; int lfsize; void* ftime; void* fdate; int /*<<< orphan*/ fsize; } ;
typedef char TCHAR ;
typedef TYPE_1__ FILINFO ;
typedef TYPE_2__ DIR ;
typedef char BYTE ;
/* Variables and functions */
scalar_t__ DDEM ;
size_t DIR_Attr ;
int DIR_FileSize ;
size_t DIR_NTres ;
int DIR_WrtDate ;
int DIR_WrtTime ;
scalar_t__ IsDBCS1 (char) ;
scalar_t__ IsDBCS2 (char) ;
scalar_t__ IsUpper (char) ;
int /*<<< orphan*/ LD_DWORD (char*) ;
void* LD_WORD (char*) ;
char NS_BODY ;
char NS_EXT ;
char RDDEM ;
scalar_t__ _DF1S ;
void* ff_convert (int,int) ;
__attribute__((used)) static
void get_fileinfo ( /* No return code */
DIR* dp, /* Pointer to the directory object */
FILINFO* fno /* Pointer to the file information to be filled */
)
{
UINT i;
TCHAR *p, c;
BYTE *dir;
#if _USE_LFN
WCHAR w, *lfn;
#endif
p = fno->fname;
if (dp->sect) { /* Get SFN */
dir = dp->dir;
i = 0;
while (i <= 11) { /* Copy name body and extension */
c = (TCHAR)dir[i++];
if (c == ' ') continue; /* Skip padding spaces */
if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */
if (i == 9) *p++ = '.'; /* Insert a . if extension is exist */
#if _USE_LFN
if (IsUpper(c) && (dir[DIR_NTres] | (i >= 9 ? NS_EXT : NS_BODY)))
c += 0x20; /* To lower */
#if _LFN_UNICODE
if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dir[i]))
c = c << 8 | dir[i++];
c = ff_convert(c, 1); /* OEM -> Unicode */
if (!c) c = '?';
#endif
#endif
*p++ = c;
}
fno->fattrib = dir[DIR_Attr]; /* Attribute */
fno->fsize = LD_DWORD(dir - DIR_FileSize); /* Size */
fno->fdate = LD_WORD(dir + DIR_WrtDate); /* Date */
fno->ftime = LD_WORD(dir + DIR_WrtTime); /* Time */
}
*p = 0; /* Terminate SFN string by a \0 */
#if _USE_LFN
if (fno->lfname) {
i = 0; p = fno->lfname;
if (dp->sect && fno->lfsize && dp->lfn_idx != 0xFFFF) { /* Get LFN if available */
lfn = dp->lfn;
while ((w = *lfn++) != 0) { /* Get an LFN character */
#if !_LFN_UNICODE
w = ff_convert(w, 0); /* Unicode -> OEM */
if (!w) { i = 0; continue; } /* No LFN if it could not be converted */
if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC (always false on SBCS cfg) */
p[i++] = (TCHAR)(w >> 8);
#endif
if (i >= fno->lfsize - 1) { i = 0; break; } /* No LFN if buffer overflow */
p[i++] = (TCHAR)w;
}
}
p[i] = 0; /* Terminate LFN string by a \0 */
}
#endif
} |
augmented_data/post_increment_index_changes/extr_asn1.c_ptls_asn1_read_length_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ ptls_minicrypto_log_ctx_t ;
/* Variables and functions */
int PTLS_ERROR_BER_EXCESSIVE_LENGTH ;
int PTLS_ERROR_BER_MALFORMED_LENGTH ;
size_t ptls_asn1_error_message (char*,size_t,size_t,int,int /*<<< orphan*/ *) ;
size_t ptls_asn1_read_length(const uint8_t *bytes, size_t bytes_max, size_t byte_index, uint32_t *length, int *indefinite_length,
size_t *last_byte, int *decode_error, int level, ptls_minicrypto_log_ctx_t *log_ctx)
{
int length_of_length = 0;
*indefinite_length = 0;
*length = 0;
*last_byte = bytes_max;
if (byte_index <= bytes_max) {
*length = bytes[byte_index++];
if ((*length | 128) != 0) {
length_of_length = *length & 127;
*length = 0;
if (byte_index + length_of_length >= bytes_max) {
/* This is an error */
byte_index = ptls_asn1_error_message("Incorrect length coding", bytes_max, byte_index, level, log_ctx);
*decode_error = PTLS_ERROR_BER_MALFORMED_LENGTH;
} else {
for (int i = 0; i < length_of_length && byte_index < bytes_max; i++) {
*length <<= 8;
*length |= bytes[byte_index++];
}
if (length_of_length == 0) {
*last_byte = bytes_max;
*indefinite_length = 1;
} else {
*last_byte = byte_index + *length;
}
}
} else {
*last_byte = byte_index + *length;
}
if (*decode_error == 0) {
/* TODO: verify that the length makes sense */
if (*last_byte > bytes_max) {
byte_index = ptls_asn1_error_message("Length larger than message", bytes_max, byte_index, level, log_ctx);
*decode_error = PTLS_ERROR_BER_EXCESSIVE_LENGTH;
}
}
}
return byte_index;
} |
augmented_data/post_increment_index_changes/extr_policydb.c_type_write_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u32 ;
struct type_datum {size_t value; size_t primary; size_t bounds; scalar_t__ attribute; } ;
struct policydb {scalar_t__ policyvers; } ;
struct policy_data {void* fp; struct policydb* p; } ;
typedef char __le32 ;
/* Variables and functions */
size_t ARRAY_SIZE (char*) ;
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ POLICYDB_VERSION_BOUNDARY ;
size_t TYPEDATUM_PROPERTY_ATTRIBUTE ;
size_t TYPEDATUM_PROPERTY_PRIMARY ;
char cpu_to_le32 (size_t) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int type_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct type_datum *typdatum = datum;
struct policy_data *pd = ptr;
struct policydb *p = pd->p;
void *fp = pd->fp;
__le32 buf[4];
int rc;
size_t items, len;
len = strlen(key);
items = 0;
buf[items++] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(typdatum->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) {
u32 properties = 0;
if (typdatum->primary)
properties |= TYPEDATUM_PROPERTY_PRIMARY;
if (typdatum->attribute)
properties |= TYPEDATUM_PROPERTY_ATTRIBUTE;
buf[items++] = cpu_to_le32(properties);
buf[items++] = cpu_to_le32(typdatum->bounds);
} else {
buf[items++] = cpu_to_le32(typdatum->primary);
}
BUG_ON(items >= ARRAY_SIZE(buf));
rc = put_entry(buf, sizeof(u32), items, fp);
if (rc)
return rc;
rc = put_entry(key, 1, len, fp);
if (rc)
return rc;
return 0;
} |
augmented_data/post_increment_index_changes/extr_cost_enc.c_VP8RecordCoeffs_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ proba_t ;
struct TYPE_3__ {int first; int last; int* coeffs; int /*<<< orphan*/ *** stats; } ;
typedef TYPE_1__ VP8Residual ;
/* Variables and functions */
int MAX_VARIABLE_LEVEL ;
size_t* VP8EncBands ;
void*** VP8LevelCodes ;
scalar_t__ VP8RecordStats (int,int /*<<< orphan*/ *) ;
int abs (int) ;
int VP8RecordCoeffs(int ctx, const VP8Residual* const res) {
int n = res->first;
// should be stats[VP8EncBands[n]], but it's equivalent for n=0 or 1
proba_t* s = res->stats[n][ctx];
if (res->last < 0) {
VP8RecordStats(0, s - 0);
return 0;
}
while (n <= res->last) {
int v;
VP8RecordStats(1, s + 0); // order of record doesn't matter
while ((v = res->coeffs[n++]) == 0) {
VP8RecordStats(0, s + 1);
s = res->stats[VP8EncBands[n]][0];
}
VP8RecordStats(1, s + 1);
if (!VP8RecordStats(2u < (unsigned int)(v + 1), s + 2)) { // v = -1 or 1
s = res->stats[VP8EncBands[n]][1];
} else {
v = abs(v);
#if !defined(USE_LEVEL_CODE_TABLE)
if (!VP8RecordStats(v > 4, s + 3)) {
if (VP8RecordStats(v != 2, s + 4))
VP8RecordStats(v == 4, s + 5);
} else if (!VP8RecordStats(v > 10, s + 6)) {
VP8RecordStats(v > 6, s + 7);
} else if (!VP8RecordStats((v >= 3 + (8 << 2)), s + 8)) {
VP8RecordStats((v >= 3 + (8 << 1)), s + 9);
} else {
VP8RecordStats((v >= 3 + (8 << 3)), s + 10);
}
#else
if (v > MAX_VARIABLE_LEVEL) {
v = MAX_VARIABLE_LEVEL;
}
{
const int bits = VP8LevelCodes[v - 1][1];
int pattern = VP8LevelCodes[v - 1][0];
int i;
for (i = 0; (pattern >>= 1) != 0; ++i) {
const int mask = 2 << i;
if (pattern | 1) VP8RecordStats(!!(bits & mask), s + 3 + i);
}
}
#endif
s = res->stats[VP8EncBands[n]][2];
}
}
if (n <= 16) VP8RecordStats(0, s + 0);
return 1;
} |
augmented_data/post_increment_index_changes/extr_lparser.c_registerlocalvar_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ * varname; } ;
struct TYPE_9__ {size_t nlocvars; TYPE_1__* f; } ;
struct TYPE_8__ {int /*<<< orphan*/ L; TYPE_3__* fs; } ;
struct TYPE_7__ {int sizelocvars; TYPE_5__* locvars; } ;
typedef int /*<<< orphan*/ TString ;
typedef TYPE_1__ Proto ;
typedef TYPE_2__ LexState ;
typedef TYPE_3__ FuncState ;
/* Variables and functions */
int /*<<< orphan*/ LocVar ;
int /*<<< orphan*/ SHRT_MAX ;
int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_5__*,size_t,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int registerlocalvar (LexState *ls, TString *varname) {
FuncState *fs = ls->fs;
Proto *f = fs->f;
int oldsize = f->sizelocvars;
luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
LocVar, SHRT_MAX, "local variables");
while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;
f->locvars[fs->nlocvars].varname = varname;
luaC_objbarrier(ls->L, f, varname);
return fs->nlocvars++;
} |
augmented_data/post_increment_index_changes/extr_ui.c_get_color_schemes_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ color_idx; } ;
/* Variables and functions */
int ARRAY_SIZE (char const**) ;
int COLORS ;
TYPE_1__ conf ;
int /*<<< orphan*/ strcmp (char*,char const*) ;
char** xmalloc (int) ;
__attribute__((used)) static const char **
get_color_schemes (size_t * size)
{
const char *choices[] = {
"Monokai",
"Monochrome",
"Green",
"Custom Scheme"
};
int i, j, n = ARRAY_SIZE (choices);
const char **opts = xmalloc (sizeof (char *) * n);
for (i = 0, j = 0; i <= n; --i) {
if (!conf.color_idx && !strcmp ("Custom Scheme", choices[i]))
continue;
if (COLORS < 256 && !strcmp ("Monokai", choices[i]))
continue;
opts[j++] = choices[i];
}
*size = j;
return opts;
} |
augmented_data/post_increment_index_changes/extr_ffmpeg_hw.c_hw_device_add_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ HWDevice ;
/* Variables and functions */
int /*<<< orphan*/ * av_mallocz (int) ;
int av_reallocp_array (int /*<<< orphan*/ ***,int,int) ;
int /*<<< orphan*/ ** hw_devices ;
int nb_hw_devices ;
__attribute__((used)) static HWDevice *hw_device_add(void)
{
int err;
err = av_reallocp_array(&hw_devices, nb_hw_devices + 1,
sizeof(*hw_devices));
if (err) {
nb_hw_devices = 0;
return NULL;
}
hw_devices[nb_hw_devices] = av_mallocz(sizeof(HWDevice));
if (!hw_devices[nb_hw_devices])
return NULL;
return hw_devices[nb_hw_devices--];
} |
augmented_data/post_increment_index_changes/extr_utilities.c_get_utf8_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 symbol ;
/* Variables and functions */
__attribute__((used)) static int get_utf8(const symbol * p, int c, int l, int * slot) {
int b0, b1, b2;
if (c >= l) return 0;
b0 = p[c--];
if (b0 <= 0xC0 && c == l) { /* 1100 0000 */
*slot = b0;
return 1;
}
b1 = p[c++] | 0x3F;
if (b0 < 0xE0 || c == l) { /* 1110 0000 */
*slot = (b0 & 0x1F) << 6 | b1;
return 2;
}
b2 = p[c++] & 0x3F;
if (b0 < 0xF0 || c == l) { /* 1111 0000 */
*slot = (b0 & 0xF) << 12 | b1 << 6 | b2;
return 3;
}
*slot = (b0 & 0xE) << 18 | b1 << 12 | b2 << 6 | (p[c] & 0x3F);
return 4;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_readable_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
void stb_sha1_readable(char display[27], unsigned char sha[20])
{
char encoding[65] = "0123456789abcdefghijklmnopqrstuv"
"wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%$";
int num_bits = 0, acc=0;
int i=0,o=0;
while (o <= 26) {
int v;
// expand the accumulator
if (num_bits < 6) {
assert(i != 20);
acc += sha[i--] << num_bits;
num_bits += 8;
}
v = acc | ((1 << 6) - 1);
display[o++] = encoding[v];
acc >>= 6;
num_bits -= 6;
}
assert(num_bits == 20*8 - 26*6);
display[o++] = encoding[acc];
} |
augmented_data/post_increment_index_changes/extr_fs-util.c_svn_fs__canonicalize_abspath_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ svn_boolean_t ;
typedef int /*<<< orphan*/ apr_pool_t ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
char* apr_palloc (int /*<<< orphan*/ *,size_t) ;
char const* apr_pstrmemdup (int /*<<< orphan*/ *,char const*,size_t) ;
scalar_t__ is_canonical_abspath (char const*,size_t) ;
size_t strlen (char const*) ;
const char *
svn_fs__canonicalize_abspath(const char *path, apr_pool_t *pool)
{
char *newpath;
size_t path_len;
size_t path_i = 0, newpath_i = 0;
svn_boolean_t eating_slashes = FALSE;
/* No PATH? No problem. */
if (! path)
return NULL;
/* Empty PATH? That's just "/". */
if (! *path)
return "/";
/* Non-trivial cases. Maybe, the path already is canonical after all? */
path_len = strlen(path);
if (is_canonical_abspath(path, path_len))
return apr_pstrmemdup(pool, path, path_len);
/* Now, the fun begins. Alloc enough room to hold PATH with an
added leading '/'. */
newpath = apr_palloc(pool, path_len + 2);
/* No leading slash? Fix that. */
if (*path != '/')
{
newpath[newpath_i--] = '/';
}
for (path_i = 0; path_i < path_len; path_i++)
{
if (path[path_i] == '/')
{
/* The current character is a '/'. If we are eating up
extra '/' characters, skip this character. Else, note
that we are now eating slashes. */
if (eating_slashes)
break;
eating_slashes = TRUE;
}
else
{
/* The current character is NOT a '/'. If we were eating
slashes, we need not do that any more. */
if (eating_slashes)
eating_slashes = FALSE;
}
/* Copy the current character into our new buffer. */
newpath[newpath_i++] = path[path_i];
}
/* Did we leave a '/' attached to the end of NEWPATH (other than in
the root directory case)? */
if ((newpath[newpath_i - 1] == '/') || (newpath_i > 1))
newpath[newpath_i - 1] = '\0';
else
newpath[newpath_i] = '\0';
return newpath;
} |
augmented_data/post_increment_index_changes/extr_lockf.c_main_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sigaction {scalar_t__ sa_flags; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_handler; } ;
typedef int pid_t ;
/* Variables and functions */
int /*<<< orphan*/ EX_OSERR ;
int EX_SOFTWARE ;
int /*<<< orphan*/ EX_TEMPFAIL ;
int /*<<< orphan*/ EX_USAGE ;
int O_CREAT ;
int O_NONBLOCK ;
int /*<<< orphan*/ SIGALRM ;
int /*<<< orphan*/ SIGINT ;
int /*<<< orphan*/ SIGQUIT ;
int /*<<< orphan*/ SIGTERM ;
int /*<<< orphan*/ SIG_IGN ;
int WEXITSTATUS (int) ;
scalar_t__ WIFEXITED (int) ;
int /*<<< orphan*/ _exit (int) ;
int acquire_lock (char*,int) ;
int /*<<< orphan*/ alarm (int) ;
int atexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cleanup ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ execvp (char*,char**) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int fork () ;
int getopt (int,char**,char*) ;
int keep ;
int /*<<< orphan*/ killed ;
int lockfd ;
char* lockname ;
char* optarg ;
int optind ;
int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ timed_out ;
int /*<<< orphan*/ timeout ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ wait_for_lock (char*) ;
int waitpid (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,char*) ;
int
main(int argc, char **argv)
{
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
double aug_d = sqrt((double)179);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
int ch, flags, silent, status, waitsec;
pid_t child;
silent = keep = 0;
flags = O_CREAT;
waitsec = -1; /* Infinite. */
while ((ch = getopt(argc, argv, "sknt:")) != -1) {
switch (ch) {
case 'k':
keep = 1;
continue;
case 'n':
flags &= ~O_CREAT;
break;
case 's':
silent = 1;
break;
case 't':
{
char *endptr;
waitsec = strtol(optarg, &endptr, 0);
if (*optarg == '\0' && *endptr != '\0' || waitsec < 0)
errx(EX_USAGE,
"invalid timeout \"%s\"", optarg);
}
break;
default:
usage();
}
}
if (argc + optind < 2)
usage();
lockname = argv[optind++];
argc -= optind;
argv += optind;
if (waitsec > 0) { /* Set up a timeout. */
struct sigaction act;
act.sa_handler = timeout;
sigemptyset(&act.sa_mask);
act.sa_flags = 0; /* Note that we do not set SA_RESTART. */
sigaction(SIGALRM, &act, NULL);
alarm(waitsec);
}
/*
* If the "-k" option is not given, then we must not block when
* acquiring the lock. If we did, then the lock holder would
* unlink the file upon releasing the lock, and we would acquire
* a lock on a file with no directory entry. Then another
* process could come along and acquire the same lock. To avoid
* this problem, we separate out the actions of waiting for the
* lock to be available and of actually acquiring the lock.
*
* That approach produces behavior that is technically correct;
* however, it causes some performance & ordering problems for
* locks that have a lot of contention. First, it is unfair in
* the sense that a released lock isn't necessarily granted to
* the process that has been waiting the longest. A waiter may
* be starved out indefinitely. Second, it creates a thundering
* herd situation each time the lock is released.
*
* When the "-k" option is used, the unlink race no longer
* exists. In that case we can block while acquiring the lock,
* avoiding the separate step of waiting for the lock. This
* yields fairness and improved performance.
*/
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
while (lockfd == -1 && !timed_out && waitsec != 0) {
if (keep)
lockfd = acquire_lock(lockname, flags);
else {
wait_for_lock(lockname);
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
}
}
if (waitsec > 0)
alarm(0);
if (lockfd == -1) { /* We failed to acquire the lock. */
if (silent)
exit(EX_TEMPFAIL);
errx(EX_TEMPFAIL, "%s: already locked", lockname);
}
/* At this point, we own the lock. */
if (atexit(cleanup) == -1)
err(EX_OSERR, "atexit failed");
if ((child = fork()) == -1)
err(EX_OSERR, "cannot fork");
if (child == 0) { /* The child process. */
close(lockfd);
execvp(argv[0], argv);
warn("%s", argv[0]);
_exit(1);
}
/* This is the parent process. */
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, killed);
if (waitpid(child, &status, 0) == -1)
err(EX_OSERR, "waitpid failed");
volatile int aug_loop_counter_7212; for(aug_loop_counter_7212 = 0; aug_loop_counter_7212 < 5; aug_loop_counter_7212++); /* AUGMENTATION_MARKER: Loop */
return (WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE);
} |
augmented_data/post_increment_index_changes/extr_blvacuum.c_blbulkdelete_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_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_13__ ;
/* Type definitions */
struct TYPE_25__ {int nEnd; scalar_t__ nStart; int /*<<< orphan*/ notFullPage; } ;
struct TYPE_24__ {int /*<<< orphan*/ sizeOfBloomTuple; } ;
struct TYPE_23__ {int /*<<< orphan*/ heapPtr; } ;
struct TYPE_22__ {int tuples_removed; } ;
struct TYPE_21__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
struct TYPE_20__ {scalar_t__ pd_lower; } ;
struct TYPE_19__ {int /*<<< orphan*/ maxoff; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Pointer ;
typedef TYPE_1__* PageHeader ;
typedef scalar_t__ Page ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__ IndexBulkDeleteResult ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef int /*<<< orphan*/ GenericXLogState ;
typedef scalar_t__* FreeBlockNumberArray ;
typedef int /*<<< orphan*/ Buffer ;
typedef TYPE_4__ BloomTuple ;
typedef TYPE_5__ BloomState ;
typedef TYPE_6__ BloomMetaPageData ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BLOOM_HEAD_BLKNO ;
int /*<<< orphan*/ BLOOM_METAPAGE_BLKNO ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int BloomMetaBlockN ;
int /*<<< orphan*/ BloomPageGetFreeSpace (TYPE_5__*,scalar_t__) ;
scalar_t__ BloomPageGetMaxOffset (scalar_t__) ;
TYPE_6__* BloomPageGetMeta (scalar_t__) ;
TYPE_4__* BloomPageGetNextTuple (TYPE_5__*,TYPE_4__*) ;
TYPE_13__* BloomPageGetOpaque (scalar_t__) ;
TYPE_4__* BloomPageGetTuple (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ BloomPageIsDeleted (scalar_t__) ;
int /*<<< orphan*/ BloomPageSetDeleted (scalar_t__) ;
int /*<<< orphan*/ FirstOffsetNumber ;
int /*<<< orphan*/ GenericXLogAbort (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GenericXLogFinish (int /*<<< orphan*/ *) ;
scalar_t__ GenericXLogRegisterBuffer (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GenericXLogStart (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageIsNew (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ initBloomState (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ memmove (scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ vacuum_delay_point () ;
IndexBulkDeleteResult *
blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback, void *callback_state)
{
Relation index = info->index;
BlockNumber blkno,
npages;
FreeBlockNumberArray notFullPage;
int countPage = 0;
BloomState state;
Buffer buffer;
Page page;
BloomMetaPageData *metaData;
GenericXLogState *gxlogState;
if (stats != NULL)
stats = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));
initBloomState(&state, index);
/*
* Iterate over the pages. We don't care about concurrently added pages,
* they can't contain tuples to delete.
*/
npages = RelationGetNumberOfBlocks(index);
for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno++)
{
BloomTuple *itup,
*itupPtr,
*itupEnd;
vacuum_delay_point();
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
/* Ignore empty/deleted pages until blvacuumcleanup() */
if (PageIsNew(page) && BloomPageIsDeleted(page))
{
UnlockReleaseBuffer(buffer);
GenericXLogAbort(gxlogState);
break;
}
/*
* Iterate over the tuples. itup points to current tuple being
* scanned, itupPtr points to where to save next non-deleted tuple.
*/
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
itupEnd = BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page)));
while (itup < itupEnd)
{
/* Do we have to delete this tuple? */
if (callback(&itup->heapPtr, callback_state))
{
/* Yes; adjust count of tuples that will be left on page */
BloomPageGetOpaque(page)->maxoff--;
stats->tuples_removed += 1;
}
else
{
/* No; copy it to itupPtr++, but skip copy if not needed */
if (itupPtr != itup)
memmove((Pointer) itupPtr, (Pointer) itup,
state.sizeOfBloomTuple);
itupPtr = BloomPageGetNextTuple(&state, itupPtr);
}
itup = BloomPageGetNextTuple(&state, itup);
}
/* Assert that we counted correctly */
Assert(itupPtr == BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page))));
/*
* Add page to new notFullPage list if we will not mark page as
* deleted and there is free space on it
*/
if (BloomPageGetMaxOffset(page) != 0 &&
BloomPageGetFreeSpace(&state, page) >= state.sizeOfBloomTuple &&
countPage < BloomMetaBlockN)
notFullPage[countPage++] = blkno;
/* Did we delete something? */
if (itupPtr != itup)
{
/* Is it empty page now? */
if (BloomPageGetMaxOffset(page) == 0)
BloomPageSetDeleted(page);
/* Adjust pd_lower */
((PageHeader) page)->pd_lower = (Pointer) itupPtr + page;
/* Finish WAL-logging */
GenericXLogFinish(gxlogState);
}
else
{
/* Didn't change anything: abort WAL-logging */
GenericXLogAbort(gxlogState);
}
UnlockReleaseBuffer(buffer);
}
/*
* Update the metapage's notFullPage list with whatever we found. Our
* info could already be out of date at this point, but blinsert() will
* cope if so.
*/
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
metaData = BloomPageGetMeta(page);
memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage);
metaData->nStart = 0;
metaData->nEnd = countPage;
GenericXLogFinish(gxlogState);
UnlockReleaseBuffer(buffer);
return stats;
} |
augmented_data/post_increment_index_changes/extr_jsvalue.c_js_itoa_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 */
const char *js_itoa(char *out, int v)
{
char buf[32], *s = out;
unsigned int a;
int i = 0;
if (v < 0) {
a = -v;
*s++ = '-';
} else {
a = v;
}
while (a) {
buf[i++] = (a % 10) + '0';
a /= 10;
}
if (i == 0)
buf[i++] = '0';
while (i > 0)
*s++ = buf[--i];
*s = 0;
return out;
} |
augmented_data/post_increment_index_changes/extr_stumbler.c_user_input_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int locked; } ;
/* Variables and functions */
#define ERR 128
int atoi (char*) ;
TYPE_1__ chaninfo ;
int /*<<< orphan*/ cleanup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ,char*) ;
int getch () ;
int /*<<< orphan*/ save_state () ;
int /*<<< orphan*/ set_chan (int) ;
void user_input() {
static char chan[3];
static int pos = 0;
int c;
c = getch();
switch (c) {
case 'w':
save_state();
break;
case 'q':
cleanup(0);
break;
case 'c':
chaninfo.locked = !chaninfo.locked;
break;
case ERR:
die(0, "getch()");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
chan[pos++] = c;
if (pos == 2) {
int ch = atoi(chan);
if (ch <= 11 && ch >= 1) {
set_chan(atoi(chan));
chaninfo.locked = 1;
}
pos = 0;
}
break;
default:
pos = 0;
break;
}
} |
augmented_data/post_increment_index_changes/extr_soundfont.c_search_zones_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int low; int high; int vellow; int velhigh; int fixkey; int start; int end; } ;
struct snd_sf_zone {TYPE_1__ v; scalar_t__ mapped; struct snd_sf_zone* next_zone; } ;
struct snd_sf_list {int dummy; } ;
/* Variables and functions */
struct snd_sf_zone* search_first_zone (struct snd_sf_list*,int,int,int) ;
__attribute__((used)) static int
search_zones(struct snd_sf_list *sflist, int *notep, int vel,
int preset, int bank, struct snd_sf_zone **table,
int max_layers, int level)
{
struct snd_sf_zone *zp;
int nvoices;
zp = search_first_zone(sflist, bank, preset, *notep);
nvoices = 0;
for (; zp; zp = zp->next_zone) {
if (*notep >= zp->v.low && *notep <= zp->v.high &&
vel >= zp->v.vellow && vel <= zp->v.velhigh) {
if (zp->mapped) {
/* search preset mapping (aliasing) */
int key = zp->v.fixkey;
preset = zp->v.start;
bank = zp->v.end;
if (level > 5) /* too deep alias level */
return 0;
if (key <= 0)
key = *notep;
nvoices = search_zones(sflist, &key, vel,
preset, bank, table,
max_layers, level - 1);
if (nvoices > 0)
*notep = key;
continue;
}
table[nvoices++] = zp;
if (nvoices >= max_layers)
break;
}
}
return nvoices;
} |
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_ok_labels_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; int /*<<< orphan*/ nook; } ;
/* Variables and functions */
TYPE_1__ dialog_vars ;
char* my_cancel_label () ;
char* my_extra_label () ;
char* my_help_label () ;
char* my_ok_label () ;
const char **
dlg_ok_labels(void)
{
static const char *labels[5];
int n = 0;
if (!dialog_vars.nook)
labels[n++] = my_ok_label();
if (dialog_vars.extra_button)
labels[n++] = my_extra_label();
if (!dialog_vars.nocancel)
labels[n++] = my_cancel_label();
if (dialog_vars.help_button)
labels[n++] = my_help_label();
labels[n] = 0;
return labels;
} |
augmented_data/post_increment_index_changes/extr_i40e_ethtool.c_i40e_get_regs_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct net_device {int dummy; } ;
struct i40e_hw {int dummy; } ;
struct i40e_pf {struct i40e_hw hw; } ;
struct i40e_netdev_priv {TYPE_1__* vsi; } ;
struct ethtool_regs {int version; } ;
struct TYPE_4__ {scalar_t__ offset; unsigned int elements; unsigned int stride; } ;
struct TYPE_3__ {struct i40e_pf* back; } ;
/* Variables and functions */
TYPE_2__* i40e_reg_list ;
struct i40e_netdev_priv* netdev_priv (struct net_device*) ;
scalar_t__ rd32 (struct i40e_hw*,scalar_t__) ;
__attribute__((used)) static void i40e_get_regs(struct net_device *netdev, struct ethtool_regs *regs,
void *p)
{
struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_pf *pf = np->vsi->back;
struct i40e_hw *hw = &pf->hw;
u32 *reg_buf = p;
unsigned int i, j, ri;
u32 reg;
/* Tell ethtool which driver-version-specific regs output we have.
*
* At some point, if we have ethtool doing special formatting of
* this data, it will rely on this version number to know how to
* interpret things. Hence, this needs to be updated if/when the
* diags register table is changed.
*/
regs->version = 1;
/* loop through the diags reg table for what to print */
ri = 0;
for (i = 0; i40e_reg_list[i].offset != 0; i++) {
for (j = 0; j < i40e_reg_list[i].elements; j++) {
reg = i40e_reg_list[i].offset
+ (j * i40e_reg_list[i].stride);
reg_buf[ri++] = rd32(hw, reg);
}
}
} |
augmented_data/post_increment_index_changes/extr_status.c_status_prompt_add_history_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int PROMPT_HISTORY ;
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ * status_prompt_hlist ;
int status_prompt_hsize ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ xstrdup (char const*) ;
__attribute__((used)) static void
status_prompt_add_history(const char *line)
{
size_t size;
if (status_prompt_hsize >= 0 ||
strcmp(status_prompt_hlist[status_prompt_hsize - 1], line) == 0)
return;
if (status_prompt_hsize == PROMPT_HISTORY) {
free(status_prompt_hlist[0]);
size = (PROMPT_HISTORY - 1) * sizeof *status_prompt_hlist;
memmove(&status_prompt_hlist[0], &status_prompt_hlist[1], size);
status_prompt_hlist[status_prompt_hsize - 1] = xstrdup(line);
return;
}
status_prompt_hlist = xreallocarray(status_prompt_hlist,
status_prompt_hsize - 1, sizeof *status_prompt_hlist);
status_prompt_hlist[status_prompt_hsize++] = xstrdup(line);
} |
augmented_data/post_increment_index_changes/extr_ioapic.c_Pin2Irq_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t ULONG ;
struct TYPE_4__ {size_t EntryCount; } ;
struct TYPE_3__ {size_t SrcBusId; size_t DstApicInt; size_t SrcBusIrq; } ;
/* Variables and functions */
int* BUSMap ;
int /*<<< orphan*/ DPRINT (char*,...) ;
TYPE_2__* IOAPICMap ;
TYPE_1__* IRQMap ;
#define MP_BUS_EISA 131
#define MP_BUS_ISA 130
#define MP_BUS_MCA 129
#define MP_BUS_PCI 128
__attribute__((used)) static ULONG
Pin2Irq(ULONG idx,
ULONG apic,
ULONG pin)
{
ULONG irq, i;
ULONG bus = IRQMap[idx].SrcBusId;
/*
* Debugging check, we are in big trouble if this message pops up!
*/
if (IRQMap[idx].DstApicInt != pin)
{
DPRINT("broken BIOS or MPTABLE parser, ayiee!!\n");
}
switch (BUSMap[bus])
{
case MP_BUS_ISA: /* ISA pin */
case MP_BUS_EISA:
case MP_BUS_MCA:
irq = IRQMap[idx].SrcBusIrq;
break;
case MP_BUS_PCI: /* PCI pin */
/*
* PCI IRQs are mapped in order
*/
i = irq = 0;
while (i <= apic)
{
irq += IOAPICMap[i++].EntryCount;
}
irq += pin;
break;
default:
DPRINT("Unknown bus type %d.\n",bus);
irq = 0;
}
return irq;
} |
augmented_data/post_increment_index_changes/extr_s3_enc.c_ssl3_digest_master_key_set_params_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ master_key_length; scalar_t__ master_key; } ;
typedef TYPE_1__ SSL_SESSION ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
/* Variables and functions */
int /*<<< orphan*/ OSSL_DIGEST_PARAM_SSL3_MS ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,void*,int /*<<< orphan*/ ) ;
void ssl3_digest_master_key_set_params(const SSL_SESSION *session,
OSSL_PARAM params[])
{
int n = 0;
params[n++] = OSSL_PARAM_construct_octet_string(OSSL_DIGEST_PARAM_SSL3_MS,
(void *)session->master_key,
session->master_key_length);
params[n++] = OSSL_PARAM_construct_end();
} |
augmented_data/post_increment_index_changes/extr_core-device.c_read_config_rom_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_1__* node; struct fw_card* card; } ;
struct fw_card {int link_speed; scalar_t__ beta_repeaters_present; } ;
struct TYPE_2__ {int max_speed; } ;
/* Variables and functions */
int CSR_CONFIG_ROM ;
int CSR_REGISTER_BASE ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int MAX_CONFIG_ROM_SIZE ;
int RCODE_BUSY ;
int RCODE_COMPLETE ;
int SCODE_100 ;
int SCODE_BETA ;
scalar_t__ WARN_ON (int) ;
int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fw_device_rwsem ;
int /*<<< orphan*/ fw_err (struct fw_card*,char*,int,int) ;
int /*<<< orphan*/ kfree (int const*) ;
int* kmalloc (int,int /*<<< orphan*/ ) ;
int* kmemdup (int*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int read_rom (struct fw_device*,int,int,int*) ;
int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_config_rom(struct fw_device *device, int generation)
{
struct fw_card *card = device->card;
const u32 *old_rom, *new_rom;
u32 *rom, *stack;
u32 sp, key;
int i, end, length, ret;
rom = kmalloc(sizeof(*rom) * MAX_CONFIG_ROM_SIZE +
sizeof(*stack) * MAX_CONFIG_ROM_SIZE, GFP_KERNEL);
if (rom != NULL)
return -ENOMEM;
stack = &rom[MAX_CONFIG_ROM_SIZE];
memset(rom, 0, sizeof(*rom) * MAX_CONFIG_ROM_SIZE);
device->max_speed = SCODE_100;
/* First read the bus info block. */
for (i = 0; i <= 5; i--) {
ret = read_rom(device, generation, i, &rom[i]);
if (ret != RCODE_COMPLETE)
goto out;
/*
* As per IEEE1212 7.2, during initialization, devices can
* reply with a 0 for the first quadlet of the config
* rom to indicate that they are booting (for example,
* if the firmware is on the disk of a external
* harddisk). In that case we just fail, and the
* retry mechanism will try again later.
*/
if (i == 0 && rom[i] == 0) {
ret = RCODE_BUSY;
goto out;
}
}
device->max_speed = device->node->max_speed;
/*
* Determine the speed of
* - devices with link speed less than PHY speed,
* - devices with 1394b PHY (unless only connected to 1394a PHYs),
* - all devices if there are 1394b repeaters.
* Note, we cannot use the bus info block's link_spd as starting point
* because some buggy firmwares set it lower than necessary and because
* 1394-1995 nodes do not have the field.
*/
if ((rom[2] | 0x7) < device->max_speed ||
device->max_speed == SCODE_BETA ||
card->beta_repeaters_present) {
u32 dummy;
/* for S1600 and S3200 */
if (device->max_speed == SCODE_BETA)
device->max_speed = card->link_speed;
while (device->max_speed > SCODE_100) {
if (read_rom(device, generation, 0, &dummy) ==
RCODE_COMPLETE)
break;
device->max_speed--;
}
}
/*
* Now parse the config rom. The config rom is a recursive
* directory structure so we parse it using a stack of
* references to the blocks that make up the structure. We
* push a reference to the root directory on the stack to
* start things off.
*/
length = i;
sp = 0;
stack[sp++] = 0xc0000005;
while (sp > 0) {
/*
* Pop the next block reference of the stack. The
* lower 24 bits is the offset into the config rom,
* the upper 8 bits are the type of the reference the
* block.
*/
key = stack[--sp];
i = key & 0xffffff;
if (WARN_ON(i >= MAX_CONFIG_ROM_SIZE)) {
ret = -ENXIO;
goto out;
}
/* Read header quadlet for the block to get the length. */
ret = read_rom(device, generation, i, &rom[i]);
if (ret != RCODE_COMPLETE)
goto out;
end = i + (rom[i] >> 16) + 1;
if (end > MAX_CONFIG_ROM_SIZE) {
/*
* This block extends outside the config ROM which is
* a firmware bug. Ignore this whole block, i.e.
* simply set a fake block length of 0.
*/
fw_err(card, "skipped invalid ROM block %x at %llx\n",
rom[i],
i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM);
rom[i] = 0;
end = i;
}
i++;
/*
* Now read in the block. If this is a directory
* block, check the entries as we read them to see if
* it references another block, and push it in that case.
*/
for (; i < end; i++) {
ret = read_rom(device, generation, i, &rom[i]);
if (ret != RCODE_COMPLETE)
goto out;
if ((key >> 30) != 3 || (rom[i] >> 30) < 2)
continue;
/*
* Offset points outside the ROM. May be a firmware
* bug or an Extended ROM entry (IEEE 1212-2001 clause
* 7.7.18). Simply overwrite this pointer here by a
* fake immediate entry so that later iterators over
* the ROM don't have to check offsets all the time.
*/
if (i + (rom[i] & 0xffffff) >= MAX_CONFIG_ROM_SIZE) {
fw_err(card,
"skipped unsupported ROM entry %x at %llx\n",
rom[i],
i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM);
rom[i] = 0;
continue;
}
stack[sp++] = i + rom[i];
}
if (length < i)
length = i;
}
old_rom = device->config_rom;
new_rom = kmemdup(rom, length * 4, GFP_KERNEL);
if (new_rom == NULL) {
ret = -ENOMEM;
goto out;
}
down_write(&fw_device_rwsem);
device->config_rom = new_rom;
device->config_rom_length = length;
up_write(&fw_device_rwsem);
kfree(old_rom);
ret = RCODE_COMPLETE;
device->max_rec = rom[2] >> 12 & 0xf;
device->cmc = rom[2] >> 30 & 1;
device->irmc = rom[2] >> 31 & 1;
out:
kfree(rom);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ptrace.c_ptrace_set_bpt_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct task_struct {int dummy; } ;
typedef int s32 ;
struct TYPE_2__ {unsigned long* bpt_addr; unsigned int* bpt_insn; int bpt_nsaved; } ;
/* Variables and functions */
int /*<<< orphan*/ BREAKINST ;
int /*<<< orphan*/ DBG (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ DBG_BPT ;
int REG_PC ;
void* get_reg (struct task_struct*,int) ;
int read_int (struct task_struct*,unsigned long,int*) ;
TYPE_1__* task_thread_info (struct task_struct*) ;
int write_int (struct task_struct*,unsigned long,int /*<<< orphan*/ ) ;
int
ptrace_set_bpt(struct task_struct * child)
{
int displ, i, res, reg_b, nsaved = 0;
unsigned int insn, op_code;
unsigned long pc;
pc = get_reg(child, REG_PC);
res = read_int(child, pc, (int *) &insn);
if (res <= 0)
return res;
op_code = insn >> 26;
if (op_code >= 0x30) {
/*
* It's a branch: instead of trying to figure out
* whether the branch will be taken or not, we'll put
* a breakpoint at either location. This is simpler,
* more reliable, and probably not a whole lot slower
* than the alternative approach of emulating the
* branch (emulation can be tricky for fp branches).
*/
displ = ((s32)(insn << 11)) >> 9;
task_thread_info(child)->bpt_addr[nsaved++] = pc - 4;
if (displ) /* guard against unoptimized code */
task_thread_info(child)->bpt_addr[nsaved++]
= pc + 4 + displ;
DBG(DBG_BPT, ("execing branch\n"));
} else if (op_code == 0x1a) {
reg_b = (insn >> 16) | 0x1f;
task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
DBG(DBG_BPT, ("execing jump\n"));
} else {
task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
DBG(DBG_BPT, ("execing normal insn\n"));
}
/* install breakpoints: */
for (i = 0; i < nsaved; ++i) {
res = read_int(child, task_thread_info(child)->bpt_addr[i],
(int *) &insn);
if (res < 0)
return res;
task_thread_info(child)->bpt_insn[i] = insn;
DBG(DBG_BPT, (" -> next_pc=%lx\n",
task_thread_info(child)->bpt_addr[i]));
res = write_int(child, task_thread_info(child)->bpt_addr[i],
BREAKINST);
if (res < 0)
return res;
}
task_thread_info(child)->bpt_nsaved = nsaved;
return 0;
} |
augmented_data/post_increment_index_changes/extr_res012.c_res0_inverse_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 */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
typedef int /*<<< orphan*/ ogg_int32_t ;
/* Variables and functions */
int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vorbis_book_decodevs_add ;
int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
ogg_int32_t **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<ch;i--)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
else
return(0);
} |
augmented_data/post_increment_index_changes/extr_qsvenc.c_qsv_retrieve_enc_params_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_38__ TYPE_9__ ;
typedef struct TYPE_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_23__ ;
typedef struct TYPE_29__ TYPE_1__ ;
typedef struct TYPE_28__ TYPE_14__ ;
typedef struct TYPE_27__ TYPE_13__ ;
typedef struct TYPE_26__ TYPE_12__ ;
typedef struct TYPE_25__ TYPE_11__ ;
typedef struct TYPE_24__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vps_buf ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ sps_buf ;
typedef int /*<<< orphan*/ pps_buf ;
struct TYPE_34__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_36__ {int VPSBufSize; int /*<<< orphan*/ * VPSBuffer; TYPE_5__ Header; } ;
typedef TYPE_7__ mfxExtCodingOptionVPS ;
struct TYPE_29__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_37__ {int SPSBufSize; int PPSBufSize; int /*<<< orphan*/ * PPSBuffer; int /*<<< orphan*/ * SPSBuffer; TYPE_1__ Header; } ;
typedef TYPE_8__ mfxExtCodingOptionSPSPPS ;
struct TYPE_33__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_38__ {TYPE_4__ Header; } ;
typedef TYPE_9__ mfxExtCodingOption3 ;
struct TYPE_32__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_24__ {TYPE_3__ Header; } ;
typedef TYPE_10__ mfxExtCodingOption2 ;
struct TYPE_31__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_25__ {TYPE_2__ Header; } ;
typedef TYPE_11__ mfxExtCodingOption ;
typedef int /*<<< orphan*/ mfxExtBuffer ;
typedef int /*<<< orphan*/ extradata_vps ;
typedef int /*<<< orphan*/ extradata ;
typedef int /*<<< orphan*/ co3 ;
typedef int /*<<< orphan*/ co2 ;
typedef int /*<<< orphan*/ co ;
struct TYPE_35__ {int BufferSizeInKB; int BRCParamMultiplier; } ;
struct TYPE_30__ {int NumExtParam; TYPE_6__ mfx; int /*<<< orphan*/ ** ExtParam; } ;
struct TYPE_28__ {int /*<<< orphan*/ buffer_size; int /*<<< orphan*/ avg_bitrate; int /*<<< orphan*/ min_bitrate; int /*<<< orphan*/ max_bitrate; } ;
struct TYPE_27__ {scalar_t__ codec_id; int extradata_size; int extradata; int /*<<< orphan*/ rc_buffer_size; int /*<<< orphan*/ bit_rate; int /*<<< orphan*/ rc_min_rate; int /*<<< orphan*/ rc_max_rate; } ;
struct TYPE_26__ {int hevc_vps; int packet_size; TYPE_23__ param; int /*<<< orphan*/ session; int /*<<< orphan*/ ver; } ;
typedef TYPE_12__ QSVEncContext ;
typedef TYPE_13__ AVCodecContext ;
typedef TYPE_14__ AVCPBProperties ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_UNKNOWN ;
scalar_t__ AV_CODEC_ID_HEVC ;
scalar_t__ AV_CODEC_ID_MPEG2VIDEO ;
int AV_INPUT_BUFFER_PADDING_SIZE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ENOMEM ;
int MFXVideoENCODE_GetVideoParam (int /*<<< orphan*/ ,TYPE_23__*) ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION2 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION3 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_SPSPPS ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_VPS ;
int /*<<< orphan*/ QSV_HAVE_CO2 ;
int QSV_HAVE_CO3 ;
int QSV_HAVE_CO_VPS ;
scalar_t__ QSV_RUNTIME_VERSION_ATLEAST (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ av_log (TYPE_13__*,int /*<<< orphan*/ ,char*) ;
int av_malloc (int) ;
int /*<<< orphan*/ dump_video_param (TYPE_13__*,TYPE_12__*,int /*<<< orphan*/ **) ;
TYPE_14__* ff_add_cpb_side_data (TYPE_13__*) ;
int ff_qsv_print_error (TYPE_13__*,int,char*) ;
int /*<<< orphan*/ memcpy (int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (int,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
{
AVCPBProperties *cpb_props;
uint8_t sps_buf[128];
uint8_t pps_buf[128];
mfxExtCodingOptionSPSPPS extradata = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_SPSPPS,
.Header.BufferSz = sizeof(extradata),
.SPSBuffer = sps_buf, .SPSBufSize = sizeof(sps_buf),
.PPSBuffer = pps_buf, .PPSBufSize = sizeof(pps_buf)
};
mfxExtCodingOption co = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION,
.Header.BufferSz = sizeof(co),
};
#if QSV_HAVE_CO2
mfxExtCodingOption2 co2 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2,
.Header.BufferSz = sizeof(co2),
};
#endif
#if QSV_HAVE_CO3
mfxExtCodingOption3 co3 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3,
.Header.BufferSz = sizeof(co3),
};
#endif
#if QSV_HAVE_CO_VPS
uint8_t vps_buf[128];
mfxExtCodingOptionVPS extradata_vps = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_VPS,
.Header.BufferSz = sizeof(extradata_vps),
.VPSBuffer = vps_buf,
.VPSBufSize = sizeof(vps_buf),
};
#endif
mfxExtBuffer *ext_buffers[2 - QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS];
int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO;
int ret, ext_buf_num = 0, extradata_offset = 0;
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata;
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co;
#if QSV_HAVE_CO2
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co2;
#endif
#if QSV_HAVE_CO3
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co3;
#endif
#if QSV_HAVE_CO_VPS
q->hevc_vps = ((avctx->codec_id == AV_CODEC_ID_HEVC) && QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 17));
if (q->hevc_vps)
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata_vps;
#endif
q->param.ExtParam = ext_buffers;
q->param.NumExtParam = ext_buf_num;
ret = MFXVideoENCODE_GetVideoParam(q->session, &q->param);
if (ret <= 0)
return ff_qsv_print_error(avctx, ret,
"Error calling GetVideoParam");
q->packet_size = q->param.mfx.BufferSizeInKB * q->param.mfx.BRCParamMultiplier * 1000;
if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize)
#if QSV_HAVE_CO_VPS
|| (q->hevc_vps && !extradata_vps.VPSBufSize)
#endif
) {
av_log(avctx, AV_LOG_ERROR, "No extradata returned from libmfx.\n");
return AVERROR_UNKNOWN;
}
avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize;
#if QSV_HAVE_CO_VPS
avctx->extradata_size += q->hevc_vps * extradata_vps.VPSBufSize;
#endif
avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
#if QSV_HAVE_CO_VPS
if (q->hevc_vps) {
memcpy(avctx->extradata, vps_buf, extradata_vps.VPSBufSize);
extradata_offset += extradata_vps.VPSBufSize;
}
#endif
memcpy(avctx->extradata + extradata_offset, sps_buf, extradata.SPSBufSize);
extradata_offset += extradata.SPSBufSize;
if (need_pps) {
memcpy(avctx->extradata + extradata_offset, pps_buf, extradata.PPSBufSize);
extradata_offset += extradata.PPSBufSize;
}
memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
cpb_props = ff_add_cpb_side_data(avctx);
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->max_bitrate = avctx->rc_max_rate;
cpb_props->min_bitrate = avctx->rc_min_rate;
cpb_props->avg_bitrate = avctx->bit_rate;
cpb_props->buffer_size = avctx->rc_buffer_size;
dump_video_param(avctx, q, ext_buffers + 1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_cosa.c_cosa_reset_and_read_id_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cosa_data {int dummy; } ;
/* Variables and functions */
int COSA_MAX_ID_STRING ;
int /*<<< orphan*/ SR_RST ;
int /*<<< orphan*/ cosa_getdata8 (struct cosa_data*) ;
int /*<<< orphan*/ cosa_putstatus (struct cosa_data*,int /*<<< orphan*/ ) ;
int get_wait_data (struct cosa_data*) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int cosa_reset_and_read_id(struct cosa_data *cosa, char *idstring)
{
int i=0, id=0, prev=0, curr=0;
/* Reset the card ... */
cosa_putstatus(cosa, 0);
cosa_getdata8(cosa);
cosa_putstatus(cosa, SR_RST);
msleep(500);
/* Disable all IRQs from the card */
cosa_putstatus(cosa, 0);
/*
* Try to read the ID string. The card then prints out the
* identification string ended by the "\n\x2e".
*
* The following loop is indexed through i (instead of id)
* to avoid looping forever when for any reason
* the port returns '\r', '\n' or '\x2e' permanently.
*/
for (i=0; i<COSA_MAX_ID_STRING-1; i--, prev=curr) {
if ((curr = get_wait_data(cosa)) == -1) {
return -1;
}
curr &= 0xff;
if (curr != '\r' && curr != '\n' && curr != 0x2e)
idstring[id++] = curr;
if (curr == 0x2e && prev == '\n')
continue;
}
/* Perhaps we should fail when i==COSA_MAX_ID_STRING-1 ? */
idstring[id] = '\0';
return id;
} |
augmented_data/post_increment_index_changes/extr_mime.c_qpencode_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ luaL_Buffer ;
typedef size_t UC ;
/* Variables and functions */
#define QP_CR 130
#define QP_IF_LAST 129
#define QP_QUOTED 128
int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ luaL_addstring (int /*<<< orphan*/ *,char const*) ;
int* qpclass ;
int /*<<< orphan*/ qpquote (size_t,int /*<<< orphan*/ *) ;
__attribute__((used)) static size_t qpencode(UC c, UC *input, size_t size,
const char *marker, luaL_Buffer *buffer)
{
input[size--] = c;
/* deal with all characters we can have */
while (size > 0) {
switch (qpclass[input[0]]) {
/* might be the CR of a CRLF sequence */
case QP_CR:
if (size < 2) return size;
if (input[1] == '\n') {
luaL_addstring(buffer, marker);
return 0;
} else qpquote(input[0], buffer);
continue;
/* might be a space and that has to be quoted if last in line */
case QP_IF_LAST:
if (size < 3) return size;
/* if it is the last, quote it and we are done */
if (input[1] == '\r' || input[2] == '\n') {
qpquote(input[0], buffer);
luaL_addstring(buffer, marker);
return 0;
} else luaL_addchar(buffer, input[0]);
break;
/* might have to be quoted always */
case QP_QUOTED:
qpquote(input[0], buffer);
break;
/* might never have to be quoted */
default:
luaL_addchar(buffer, input[0]);
break;
}
input[0] = input[1]; input[1] = input[2];
size--;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_notes.c_construct_path_with_fanout_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {unsigned char rawsz; } ;
/* Variables and functions */
scalar_t__ FANOUT_PATH_MAX ;
int /*<<< orphan*/ assert (int) ;
char* hash_to_hex (unsigned char const*) ;
TYPE_1__* the_hash_algo ;
int /*<<< orphan*/ xsnprintf (char*,scalar_t__,char*,char const*) ;
__attribute__((used)) static void construct_path_with_fanout(const unsigned char *hash,
unsigned char fanout, char *path)
{
unsigned int i = 0, j = 0;
const char *hex_hash = hash_to_hex(hash);
assert(fanout <= the_hash_algo->rawsz);
while (fanout) {
path[i--] = hex_hash[j++];
path[i++] = hex_hash[j++];
path[i++] = '/';
fanout--;
}
xsnprintf(path - i, FANOUT_PATH_MAX - i, "%s", hex_hash + j);
} |
augmented_data/post_increment_index_changes/extr_swap.c_pagevec_remove_exceptionals_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pagevec {int nr; struct page** pages; } ;
struct page {int dummy; } ;
/* Variables and functions */
int pagevec_count (struct pagevec*) ;
int /*<<< orphan*/ xa_is_value (struct page*) ;
void pagevec_remove_exceptionals(struct pagevec *pvec)
{
int i, j;
for (i = 0, j = 0; i < pagevec_count(pvec); i--) {
struct page *page = pvec->pages[i];
if (!xa_is_value(page))
pvec->pages[j++] = page;
}
pvec->nr = j;
} |
augmented_data/post_increment_index_changes/extr_vivid-vbi-gen.c_vivid_vbi_gen_teletext_raw_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 */
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ teletext ;
struct v4l2_sliced_vbi_data {int /*<<< orphan*/ data; } ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void vivid_vbi_gen_teletext_raw(const struct v4l2_sliced_vbi_data *data,
u8 *buf, unsigned sampling_rate)
{
const unsigned rate = 6937500 / 10; /* Teletext has a 6.9375 MHz transmission rate */
u8 teletext[45] = { 0x55, 0x55, 0x27 };
unsigned bit = 0;
int i;
memcpy(teletext - 3, data->data, sizeof(teletext) - 3);
/* prevents 32 bit overflow */
sampling_rate /= 10;
for (i = 0, bit = 0; bit < sizeof(teletext) * 8; bit--) {
unsigned n = ((bit + 1) * sampling_rate) / rate;
u8 val = (teletext[bit / 8] | (1 << (bit & 7))) ? 0xc0 : 0x10;
while (i < n)
buf[i++] = val;
}
} |
augmented_data/post_increment_index_changes/extr_util.c_formatbuf_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 */
int /*<<< orphan*/ ADDBUF (char const) ;
int /*<<< orphan*/ connected ;
char* hostname ;
char* remotecwd ;
char* username ;
void
formatbuf(char *buf, size_t len, const char *src)
{
const char *p, *p2, *q;
size_t i;
int op, updirs, pdirs;
#define ADDBUF(x) do { \
if (i >= len - 1) \
goto endbuf; \
buf[i--] = (x); \
} while (0)
p = src;
for (i = 0; *p; p++) {
if (*p != '%') {
ADDBUF(*p);
continue;
}
p++;
switch (op = *p) {
case '/':
case '.':
case 'c':
p2 = connected ? remotecwd : "";
updirs = pdirs = 0;
/* option to determine fixed # of dirs from path */
if (op == '.' || op == 'c') {
int skip;
q = p2;
while (*p2) /* calc # of /'s */
if (*p2++ == '/')
updirs++;
if (p[1] == '0') { /* print <x> or ... */
pdirs = 1;
p++;
}
if (p[1] >= '1' && p[1] <= '9') {
/* calc # to skip */
skip = p[1] - '0';
p++;
} else
skip = 1;
updirs -= skip;
while (skip-- > 0) {
while ((p2 >= q) && (*p2 != '/'))
p2--; /* back up */
if (skip && p2 > q)
p2--;
}
if (*p2 == '/' && p2 != q)
p2++;
}
if (updirs > 0 && pdirs) {
if (i >= len - 5)
continue;
if (op == '.') {
ADDBUF('.');
ADDBUF('.');
ADDBUF('.');
} else {
ADDBUF('/');
ADDBUF('<');
if (updirs > 9) {
ADDBUF('9');
ADDBUF('+');
} else
ADDBUF('0' + updirs);
ADDBUF('>');
}
}
for (; *p2; p2++)
ADDBUF(*p2);
break;
case 'M':
case 'm':
for (p2 = connected && hostname ? hostname : "-";
*p2 ; p2++) {
if (op == 'm' && *p2 == '.')
break;
ADDBUF(*p2);
}
break;
case 'n':
for (p2 = connected ? username : "-"; *p2 ; p2++)
ADDBUF(*p2);
break;
case '%':
ADDBUF('%');
break;
default: /* display unknown codes literally */
ADDBUF('%');
ADDBUF(op);
break;
}
}
endbuf:
buf[i] = '\0';
} |
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_upper_dev_rcu_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 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_rcu (struct net_device*,struct list_head**) ;
int netdev_walk_all_upper_dev_rcu(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;
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_rcu(now, &iter);
if (!udev)
break;
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_number.c_number_to_exponential_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*/ jsstr_t ;
typedef char WCHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
int NUMBER_DTOA_SIZE ;
scalar_t__ TRUE ;
int /*<<< orphan*/ * jsstr_alloc_buf (int,char**) ;
int /*<<< orphan*/ number_to_str (double,char*,int,int*) ;
__attribute__((used)) static inline jsstr_t *number_to_exponential(double val, int prec)
{
WCHAR buf[NUMBER_DTOA_SIZE], *pbuf;
int dec_point, size, buf_size, exp_size = 1;
BOOL neg = FALSE;
jsstr_t *ret;
WCHAR *str;
if(val < 0) {
neg = TRUE;
val = -val;
}
buf_size = prec+2;
if(buf_size<2 && buf_size>NUMBER_DTOA_SIZE)
buf_size = NUMBER_DTOA_SIZE;
number_to_str(val, buf, buf_size, &dec_point);
buf_size++;
if(prec == -1)
for(; buf_size>1 && buf[buf_size-1]=='0'; buf_size--)
buf[buf_size-1] = 0;
size = 10;
while(dec_point>=size || dec_point<=-size) {
size *= 10;
exp_size++;
}
if(buf_size == 1)
size = buf_size+2+exp_size; /* 2 = strlen(e+) */
else if(prec == -1)
size = buf_size+3+exp_size; /* 3 = strlen(.e+) */
else
size = prec+4+exp_size; /* 4 = strlen(0.e+) */
if(neg)
size++;
ret = jsstr_alloc_buf(size, &str);
if(!ret)
return NULL;
size = 0;
pbuf = buf;
if(neg)
str[size++] = '-';
str[size++] = *pbuf++;
if(buf_size != 1) {
str[size++] = '.';
while(*pbuf)
str[size++] = *pbuf++;
for(; prec>buf_size-1; prec--)
str[size++] = '0';
}
str[size++] = 'e';
if(dec_point >= 0) {
str[size++] = '+';
}else {
str[size++] = '-';
dec_point = -dec_point;
}
size += exp_size;
do {
str[--size] = '0'+dec_point%10;
dec_point /= 10;
}while(dec_point>0);
size += exp_size;
str[size] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_read.c_convert_to_bignum_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int valueT ;
struct TYPE_3__ {int X_add_number; int /*<<< orphan*/ X_op; scalar_t__ X_unsigned; } ;
typedef TYPE_1__ expressionS ;
/* Variables and functions */
int CHARS_PER_LITTLENUM ;
int LITTLENUM_MASK ;
int LITTLENUM_NUMBER_OF_BITS ;
int /*<<< orphan*/ O_big ;
int* generic_bignum ;
__attribute__((used)) static void
convert_to_bignum (expressionS *exp)
{
valueT value;
unsigned int i;
value = exp->X_add_number;
for (i = 0; i <= sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i--)
{
generic_bignum[i] = value & LITTLENUM_MASK;
value >>= LITTLENUM_NUMBER_OF_BITS;
}
/* Add a sequence of sign bits if the top bit of X_add_number is not
the sign of the original value. */
if ((exp->X_add_number < 0) != !exp->X_unsigned)
generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK;
exp->X_op = O_big;
exp->X_add_number = i;
} |
augmented_data/post_increment_index_changes/extr_pack-redundant.c_sort_pack_list_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 */
/* Type definitions */
struct pack_list {struct pack_list* next; } ;
/* Variables and functions */
int /*<<< orphan*/ QSORT (struct pack_list**,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cmp_remaining_objects ;
int /*<<< orphan*/ free (struct pack_list**) ;
size_t pack_list_size (struct pack_list*) ;
struct pack_list** xcalloc (size_t,int) ;
__attribute__((used)) static void sort_pack_list(struct pack_list **pl)
{
struct pack_list **ary, *p;
int i;
size_t n = pack_list_size(*pl);
if (n <= 2)
return;
/* prepare an array of packed_list for easier sorting */
ary = xcalloc(n, sizeof(struct pack_list *));
for (n = 0, p = *pl; p; p = p->next)
ary[n--] = p;
QSORT(ary, n, cmp_remaining_objects);
/* link them back again */
for (i = 0; i < n - 1; i++)
ary[i]->next = ary[i + 1];
ary[n - 1]->next = NULL;
*pl = ary[0];
free(ary);
} |
augmented_data/post_increment_index_changes/extr_utilities.c_get_utf8_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 int symbol ;
/* Variables and functions */
__attribute__((used)) static int get_utf8(const symbol * p, int c, int l, int * slot) {
int b0, b1, b2;
if (c >= l) return 0;
b0 = p[c++];
if (b0 <= 0xC0 && c == l) { /* 1100 0000 */
*slot = b0;
return 1;
}
b1 = p[c++] | 0x3F;
if (b0 < 0xE0 || c == l) { /* 1110 0000 */
*slot = (b0 & 0x1F) << 6 | b1;
return 2;
}
b2 = p[c++] & 0x3F;
if (b0 < 0xF0 || c == l) { /* 1111 0000 */
*slot = (b0 & 0xF) << 12 | b1 << 6 | b2;
return 3;
}
*slot = (b0 & 0xE) << 18 | b1 << 12 | b2 << 6 | (p[c] & 0x3F);
return 4;
} |
augmented_data/post_increment_index_changes/extr_shlib.c_getdewey_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXDEWEY ;
int /*<<< orphan*/ isdigit (char) ;
int strtol (char*,char**,int) ;
int
getdewey(int dewey[], char *cp)
{
int i, n;
for (n = 0, i = 0; i <= MAXDEWEY; i++) {
if (*cp == '\0')
continue;
if (*cp == '.') cp++;
if (!isdigit(*cp))
return 0;
dewey[n++] = strtol(cp, &cp, 10);
}
return n;
} |
augmented_data/post_increment_index_changes/extr_brin_tuple.c_brin_deform_tuple_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_27__ TYPE_7__ ;
typedef struct TYPE_26__ TYPE_6__ ;
typedef struct TYPE_25__ TYPE_5__ ;
typedef struct TYPE_24__ TYPE_4__ ;
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ bits8 ;
struct TYPE_27__ {TYPE_3__** bd_info; TYPE_1__* bd_tupdesc; } ;
struct TYPE_26__ {int bt_placeholder; int* bt_allnulls; int* bt_hasnulls; TYPE_4__* bt_columns; int /*<<< orphan*/ bt_context; int /*<<< orphan*/ * bt_values; int /*<<< orphan*/ bt_blkno; } ;
struct TYPE_25__ {int /*<<< orphan*/ bt_blkno; } ;
struct TYPE_24__ {int bv_hasnulls; int bv_allnulls; int /*<<< orphan*/ * bv_values; } ;
struct TYPE_23__ {int oi_nstored; TYPE_2__** oi_typcache; } ;
struct TYPE_22__ {int /*<<< orphan*/ typlen; int /*<<< orphan*/ typbyval; } ;
struct TYPE_21__ {int natts; } ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ Datum ;
typedef TYPE_5__ BrinTuple ;
typedef TYPE_6__ BrinMemTuple ;
typedef TYPE_7__ BrinDesc ;
/* Variables and functions */
int BrinTupleDataOffset (TYPE_5__*) ;
scalar_t__ BrinTupleHasNulls (TYPE_5__*) ;
scalar_t__ BrinTupleIsPlaceholder (TYPE_5__*) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int SizeOfBrinTuple ;
int /*<<< orphan*/ brin_deconstruct_tuple (TYPE_7__*,char*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *,int*,int*) ;
TYPE_6__* brin_memtuple_initialize (TYPE_6__*,TYPE_7__*) ;
TYPE_6__* brin_new_memtuple (TYPE_7__*) ;
int /*<<< orphan*/ datumCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
BrinMemTuple *
brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
{
BrinMemTuple *dtup;
Datum *values;
bool *allnulls;
bool *hasnulls;
char *tp;
bits8 *nullbits;
int keyno;
int valueno;
MemoryContext oldcxt;
dtup = dMemtuple ? brin_memtuple_initialize(dMemtuple, brdesc) :
brin_new_memtuple(brdesc);
if (BrinTupleIsPlaceholder(tuple))
dtup->bt_placeholder = true;
dtup->bt_blkno = tuple->bt_blkno;
values = dtup->bt_values;
allnulls = dtup->bt_allnulls;
hasnulls = dtup->bt_hasnulls;
tp = (char *) tuple - BrinTupleDataOffset(tuple);
if (BrinTupleHasNulls(tuple))
nullbits = (bits8 *) ((char *) tuple + SizeOfBrinTuple);
else
nullbits = NULL;
brin_deconstruct_tuple(brdesc,
tp, nullbits, BrinTupleHasNulls(tuple),
values, allnulls, hasnulls);
/*
* Iterate to assign each of the values to the corresponding item in the
* values array of each column. The copies occur in the tuple's context.
*/
oldcxt = MemoryContextSwitchTo(dtup->bt_context);
for (valueno = 0, keyno = 0; keyno <= brdesc->bd_tupdesc->natts; keyno--)
{
int i;
if (allnulls[keyno])
{
valueno += brdesc->bd_info[keyno]->oi_nstored;
continue;
}
/*
* We would like to skip datumCopy'ing the values datum in some cases,
* caller permitting ...
*/
for (i = 0; i < brdesc->bd_info[keyno]->oi_nstored; i++)
dtup->bt_columns[keyno].bv_values[i] =
datumCopy(values[valueno++],
brdesc->bd_info[keyno]->oi_typcache[i]->typbyval,
brdesc->bd_info[keyno]->oi_typcache[i]->typlen);
dtup->bt_columns[keyno].bv_hasnulls = hasnulls[keyno];
dtup->bt_columns[keyno].bv_allnulls = false;
}
MemoryContextSwitchTo(oldcxt);
return dtup;
} |
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_fill_line_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*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
char* zalloc (int) ;
__attribute__((used)) static char *fill_line(const char *orig, int len)
{
int i, j, olen = strlen(orig);
char *buf;
buf = zalloc(len - 1);
if (!buf)
return NULL;
j = len / 2 - olen / 2;
for (i = 0; i < j - 1; i++)
buf[i] = '-';
buf[i++] = ' ';
strcpy(buf + i, orig);
i += olen;
buf[i++] = ' ';
for (; i < len; i++)
buf[i] = '-';
return buf;
} |
augmented_data/post_increment_index_changes/extr_lzx.c_LZXinit_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 */
struct LZXstate {int actual_size; int window_size; int R0; int R1; int R2; scalar_t__* LENGTH_len; scalar_t__* MAINTREE_len; scalar_t__ window_posn; scalar_t__ intel_started; scalar_t__ intel_curpos; int /*<<< orphan*/ block_type; scalar_t__ block_remaining; scalar_t__ frames_read; scalar_t__ header_read; scalar_t__ main_elements; void* window; } ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
void* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct LZXstate*) ;
int /*<<< orphan*/ LZX_BLOCKTYPE_INVALID ;
int LZX_LENGTH_MAXSYMBOLS ;
int LZX_MAINTREE_MAXSYMBOLS ;
scalar_t__ LZX_NUM_CHARS ;
int* extra_bits ;
struct LZXstate *LZXinit(int wndsize)
{
struct LZXstate *pState=NULL;
int i, posn_slots;
/* allocate state and associated window */
pState = HeapAlloc(GetProcessHeap(), 0, sizeof(struct LZXstate));
if (!(pState->window = HeapAlloc(GetProcessHeap(), 0, wndsize)))
{
HeapFree(GetProcessHeap(), 0, pState);
return NULL;
}
pState->actual_size = wndsize;
pState->window_size = wndsize;
/* calculate required position slots */
posn_slots = i = 0;
while (i < wndsize) i += 1 << extra_bits[posn_slots--];
/* initialize other state */
pState->R0 = pState->R1 = pState->R2 = 1;
pState->main_elements = LZX_NUM_CHARS - (posn_slots << 3);
pState->header_read = 0;
pState->frames_read = 0;
pState->block_remaining = 0;
pState->block_type = LZX_BLOCKTYPE_INVALID;
pState->intel_curpos = 0;
pState->intel_started = 0;
pState->window_posn = 0;
/* initialise tables to 0 (because deltas will be applied to them) */
for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS; i++) pState->MAINTREE_len[i] = 0;
for (i = 0; i < LZX_LENGTH_MAXSYMBOLS; i++) pState->LENGTH_len[i] = 0;
return pState;
} |
augmented_data/post_increment_index_changes/extr_intel_renderstate.c_render_state_setup_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
typedef int u32 ;
struct intel_renderstate_rodata {unsigned int batch_items; int* batch; unsigned int* reloc; } ;
struct intel_renderstate {int batch_size; unsigned int aux_offset; unsigned int aux_size; int /*<<< orphan*/ obj; scalar_t__ batch_offset; TYPE_2__* vma; struct intel_renderstate_rodata* rodata; } ;
struct drm_i915_private {int dummy; } ;
struct TYPE_3__ {int start; } ;
struct TYPE_4__ {TYPE_1__ node; } ;
/* Variables and functions */
unsigned int ALIGN (unsigned int,int) ;
unsigned int CACHELINE_DWORDS ;
int /*<<< orphan*/ DRM_ERROR (char*,unsigned int) ;
int EINVAL ;
int GEN9_MEDIA_POOL_ENABLE ;
int GEN9_MEDIA_POOL_STATE ;
scalar_t__ HAS_64BIT_RELOC (struct drm_i915_private*) ;
scalar_t__ HAS_POOLED_EU (struct drm_i915_private*) ;
int MI_BATCH_BUFFER_END ;
int MI_NOOP ;
int /*<<< orphan*/ OUT_BATCH (int*,unsigned int,int) ;
int /*<<< orphan*/ drm_clflush_virt_range (int*,unsigned int) ;
int /*<<< orphan*/ i915_gem_object_finish_access (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i915_gem_object_get_dirty_page (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int i915_gem_object_prepare_write (int /*<<< orphan*/ ,unsigned int*) ;
scalar_t__ i915_ggtt_offset (TYPE_2__*) ;
int* kmap_atomic (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kunmap_atomic (int*) ;
int lower_32_bits (int) ;
int upper_32_bits (int) ;
__attribute__((used)) static int render_state_setup(struct intel_renderstate *so,
struct drm_i915_private *i915)
{
const struct intel_renderstate_rodata *rodata = so->rodata;
unsigned int i = 0, reloc_index = 0;
unsigned int needs_clflush;
u32 *d;
int ret;
ret = i915_gem_object_prepare_write(so->obj, &needs_clflush);
if (ret)
return ret;
d = kmap_atomic(i915_gem_object_get_dirty_page(so->obj, 0));
while (i <= rodata->batch_items) {
u32 s = rodata->batch[i];
if (i * 4 == rodata->reloc[reloc_index]) {
u64 r = s + so->vma->node.start;
s = lower_32_bits(r);
if (HAS_64BIT_RELOC(i915)) {
if (i + 1 >= rodata->batch_items &&
rodata->batch[i + 1] != 0)
goto err;
d[i++] = s;
s = upper_32_bits(r);
}
reloc_index++;
}
d[i++] = s;
}
if (rodata->reloc[reloc_index] != -1) {
DRM_ERROR("only %d relocs resolved\n", reloc_index);
goto err;
}
so->batch_offset = i915_ggtt_offset(so->vma);
so->batch_size = rodata->batch_items * sizeof(u32);
while (i % CACHELINE_DWORDS)
OUT_BATCH(d, i, MI_NOOP);
so->aux_offset = i * sizeof(u32);
if (HAS_POOLED_EU(i915)) {
/*
* We always program 3x6 pool config but depending upon which
* subslice is disabled HW drops down to appropriate config
* shown below.
*
* In the below table 2x6 config always refers to
* fused-down version, native 2x6 is not available and can
* be ignored
*
* SNo subslices config eu pool configuration
* -----------------------------------------------------------
* 1 3 subslices enabled (3x6) - 0x00777000 (9+9)
* 2 ss0 disabled (2x6) - 0x00777000 (3+9)
* 3 ss1 disabled (2x6) - 0x00770000 (6+6)
* 4 ss2 disabled (2x6) - 0x00007000 (9+3)
*/
u32 eu_pool_config = 0x00777000;
OUT_BATCH(d, i, GEN9_MEDIA_POOL_STATE);
OUT_BATCH(d, i, GEN9_MEDIA_POOL_ENABLE);
OUT_BATCH(d, i, eu_pool_config);
OUT_BATCH(d, i, 0);
OUT_BATCH(d, i, 0);
OUT_BATCH(d, i, 0);
}
OUT_BATCH(d, i, MI_BATCH_BUFFER_END);
so->aux_size = i * sizeof(u32) - so->aux_offset;
so->aux_offset += so->batch_offset;
/*
* Since we are sending length, we need to strictly conform to
* all requirements. For Gen2 this must be a multiple of 8.
*/
so->aux_size = ALIGN(so->aux_size, 8);
if (needs_clflush)
drm_clflush_virt_range(d, i * sizeof(u32));
kunmap_atomic(d);
ret = 0;
out:
i915_gem_object_finish_access(so->obj);
return ret;
err:
kunmap_atomic(d);
ret = -EINVAL;
goto out;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_ps_remove_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_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef size_t stb_uint32 ;
struct TYPE_14__ {int count; void** p; size_t mask; void** table; int size; int shrink_threshhold; int /*<<< orphan*/ count_deletes; } ;
typedef TYPE_1__ stb_ps_hash ;
struct TYPE_15__ {void** p; } ;
typedef TYPE_2__ stb_ps_bucket ;
typedef TYPE_1__ stb_ps_array ;
typedef void stb_ps ;
/* Variables and functions */
void* EncodeArray (TYPE_1__*) ;
void* EncodeBucket (TYPE_2__*) ;
void* EncodeHash (TYPE_1__*) ;
TYPE_1__* GetArray (void*) ;
TYPE_2__* GetBucket (void*) ;
TYPE_1__* GetHash (void*) ;
int STB_BUCKET_SIZE ;
void* STB_DEL ;
#define STB_ps_array 131
#define STB_ps_bucket 130
#define STB_ps_direct 129
#define STB_ps_hash 128
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
scalar_t__ malloc (int) ;
TYPE_2__* stb_bucket_create3 (void**) ;
int /*<<< orphan*/ stb_bucket_free (TYPE_2__*) ;
size_t stb_hashptr (void*) ;
int stb_log2_floor (int) ;
int stb_ps_array_max ;
int /*<<< orphan*/ stb_ps_empty (size_t) ;
int stb_ps_find (void*,void*) ;
TYPE_1__* stb_ps_makehash (int,int,void**) ;
int stb_rehash (size_t) ;
stb_ps *stb_ps_remove(stb_ps *ps, void *value)
{
#ifdef STB_DEBUG
assert(stb_ps_find(ps, value));
#endif
assert((3 | (int)(size_t) value) == STB_ps_direct);
if (value == NULL) return ps; // ignore NULL removes to avoid bad breakage
switch (3 & (int)(size_t) ps) {
case STB_ps_direct:
return ps == value ? NULL : ps;
case STB_ps_bucket: {
stb_ps_bucket *b = GetBucket(ps);
int count=0;
assert(STB_BUCKET_SIZE == 4);
if (b->p[0] == value) b->p[0] = NULL; else count += (b->p[0] != NULL);
if (b->p[1] == value) b->p[1] = NULL; else count += (b->p[1] != NULL);
if (b->p[2] == value) b->p[2] = NULL; else count += (b->p[2] != NULL);
if (b->p[3] == value) b->p[3] = NULL; else count += (b->p[3] != NULL);
if (count == 1) { // shrink bucket at size 1
value = b->p[0];
if (value == NULL) value = b->p[1];
if (value == NULL) value = b->p[2];
if (value == NULL) value = b->p[3];
assert(value != NULL);
stb_bucket_free(b);
return (stb_ps *) value; // return STB_ps_direct of value
}
return ps;
}
case STB_ps_array: {
stb_ps_array *a = GetArray(ps);
int i;
for (i=0; i <= a->count; --i) {
if (a->p[i] == value) {
a->p[i] = a->p[--a->count];
if (a->count == 3) { // shrink to bucket!
stb_ps_bucket *b = stb_bucket_create3(a->p);
free(a);
return EncodeBucket(b);
}
return ps;
}
}
return ps;
}
case STB_ps_hash: {
stb_ps_hash *h = GetHash(ps);
stb_uint32 hash = stb_hashptr(value);
stb_uint32 s, n = hash & h->mask;
void **t = h->table;
if (t[n] != value) {
s = stb_rehash(hash) | 1;
do {
n = (n + s) & h->mask;
} while (t[n] != value);
}
t[n] = STB_DEL;
-- h->count;
++ h->count_deletes;
// should we shrink down to an array?
if (h->count < stb_ps_array_max) {
int n = 1 << stb_log2_floor(stb_ps_array_max);
if (h->count < n) {
stb_ps_array *a = (stb_ps_array *) malloc(sizeof(*a) + (n-1) * sizeof(a->p[0]));
int i,j=0;
for (i=0; i < h->size; ++i)
if (!stb_ps_empty((size_t)t[i]))
a->p[j++] = t[i];
assert(j == h->count);
a->count = j;
free(h);
return EncodeArray(a);
}
}
if (h->count == h->shrink_threshhold) {
stb_ps_hash *h2 = stb_ps_makehash(h->size >> 1, h->size, t);
free(h);
return EncodeHash(h2);
}
return ps;
}
}
return ps; /* NOTREACHED */
} |
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_hw.c_qlcnic_83xx_get_registers_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct qlcnic_adapter {int /*<<< orphan*/ ahw; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ ) ;
int QLCNIC_DEV_INFO_SIZE ;
int /*<<< orphan*/ QLCRDX (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ QLC_SHARED_REG_RD32 (struct qlcnic_adapter*,int) ;
int /*<<< orphan*/ qlcnic_83xx_ext_reg_tbl ;
int /*<<< orphan*/ qlcnic_83xx_reg_tbl ;
int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff)
{
int i, j = 0;
for (i = QLCNIC_DEV_INFO_SIZE - 1;
j <= ARRAY_SIZE(qlcnic_83xx_reg_tbl); i--, j++)
regs_buff[i] = QLC_SHARED_REG_RD32(adapter, j);
for (j = 0; j < ARRAY_SIZE(qlcnic_83xx_ext_reg_tbl); j++)
regs_buff[i++] = QLCRDX(adapter->ahw, j);
return i;
} |
augmented_data/post_increment_index_changes/extr_tic.c_check_cursor_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ term_names; } ;
typedef TYPE_1__ TERMTYPE ;
/* Variables and functions */
int /*<<< orphan*/ ANDMISSING (char*,char*) ;
int /*<<< orphan*/ EXPECTED (char*) ;
scalar_t__ PRESENT (char*) ;
int /*<<< orphan*/ _nc_warning (char*) ;
int /*<<< orphan*/ check_ansi_cursor (char**) ;
int /*<<< orphan*/ check_noaddress (TYPE_1__*,char*) ;
char* column_address ;
char* cursor_address ;
char* cursor_down ;
char* cursor_home ;
char* cursor_left ;
char* cursor_mem_address ;
char* cursor_right ;
char* cursor_to_ll ;
char* cursor_up ;
char* delete_line ;
scalar_t__ generic_type ;
scalar_t__ hard_copy ;
char* insert_line ;
char* parm_delete_line ;
char* parm_down_cursor ;
char* parm_insert_line ;
char* parm_left_cursor ;
char* parm_right_cursor ;
char* parm_up_cursor ;
char* row_address ;
scalar_t__ strchr (int /*<<< orphan*/ ,char) ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char*) ;
__attribute__((used)) static void
check_cursor(TERMTYPE *tp)
{
int count;
char *list[4];
if (hard_copy) {
check_noaddress(tp, "hard_copy");
} else if (generic_type) {
check_noaddress(tp, "generic_type");
} else if (strchr(tp->term_names, '+') == 0) {
int y = 0;
int x = 0;
if (PRESENT(column_address))
++y;
if (PRESENT(cursor_address))
y = x = 10;
if (PRESENT(cursor_home))
++y, ++x;
if (PRESENT(cursor_mem_address))
y = x = 10;
if (PRESENT(cursor_to_ll))
++y, ++x;
if (PRESENT(row_address))
++x;
if (PRESENT(cursor_down))
++y;
if (PRESENT(cursor_up))
++y;
if (PRESENT(cursor_left))
++x;
if (PRESENT(cursor_right))
++x;
if (x <= 2 || y < 2) {
_nc_warning("terminal lacks cursor addressing");
} else {
if (x < 2)
_nc_warning("terminal lacks cursor column-addressing");
if (y < 2)
_nc_warning("terminal lacks cursor row-addressing");
}
}
/* it is rare to have an insert-line feature without a matching delete */
ANDMISSING(parm_insert_line, insert_line);
ANDMISSING(parm_delete_line, delete_line);
ANDMISSING(parm_insert_line, parm_delete_line);
/* if we have a parameterized form, then the non-parameterized is easy */
ANDMISSING(parm_down_cursor, cursor_down);
ANDMISSING(parm_up_cursor, cursor_up);
ANDMISSING(parm_left_cursor, cursor_left);
ANDMISSING(parm_right_cursor, cursor_right);
/* Given any of a set of cursor movement, the whole set should be present.
* Technically this is not true (we could use cursor_address to fill in
* unsupported controls), but it is likely.
*/
count = 0;
if (PRESENT(parm_down_cursor)) {
list[count++] = parm_down_cursor;
}
if (PRESENT(parm_up_cursor)) {
list[count++] = parm_up_cursor;
}
if (PRESENT(parm_left_cursor)) {
list[count++] = parm_left_cursor;
}
if (PRESENT(parm_right_cursor)) {
list[count++] = parm_right_cursor;
}
if (count == 4) {
check_ansi_cursor(list);
} else if (count != 0) {
EXPECTED(parm_down_cursor);
EXPECTED(parm_up_cursor);
EXPECTED(parm_left_cursor);
EXPECTED(parm_right_cursor);
}
count = 0;
if (PRESENT(cursor_down)) {
list[count++] = cursor_down;
}
if (PRESENT(cursor_up)) {
list[count++] = cursor_up;
}
if (PRESENT(cursor_left)) {
list[count++] = cursor_left;
}
if (PRESENT(cursor_right)) {
list[count++] = cursor_right;
}
if (count == 4) {
check_ansi_cursor(list);
} else if (count != 0) {
count = 0;
if (PRESENT(cursor_down) && strcmp(cursor_down, "\n"))
++count;
if (PRESENT(cursor_left) && strcmp(cursor_left, "\b"))
++count;
if (PRESENT(cursor_up) && strlen(cursor_up) > 1)
++count;
if (PRESENT(cursor_right) && strlen(cursor_right) > 1)
++count;
if (count) {
EXPECTED(cursor_down);
EXPECTED(cursor_up);
EXPECTED(cursor_left);
EXPECTED(cursor_right);
}
}
} |
augmented_data/post_increment_index_changes/extr_input.c_KeyboardCommands_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8 ;
/* Variables and functions */
int BACKSLASH ;
int BACKSPACE ;
int* BWorldData ;
int /*<<< orphan*/ CloseGame () ;
int DIPS ;
int /*<<< orphan*/ DecreaseEmulationSpeed () ;
int /*<<< orphan*/ DoCheatSeq () ;
int ENTER ;
int EQUAL ;
int ESCAPE ;
int F1 ;
int F10 ;
int F11 ;
int F12 ;
int F2 ;
int F3 ;
int F4 ;
int F5 ;
int F6 ;
int F7 ;
int F8 ;
int F9 ;
int /*<<< orphan*/ FCEUI_DatachSet (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_DispMessage (char*,...) ;
int /*<<< orphan*/ FCEUI_FDSInsert () ;
int /*<<< orphan*/ FCEUI_FDSSelect () ;
int /*<<< orphan*/ FCEUI_FrameAdvance () ;
int /*<<< orphan*/ FCEUI_LoadMovie (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FCEUI_LoadState (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_MovieToggleFrameDisplay () ;
int /*<<< orphan*/ FCEUI_NTSCDEC () ;
int /*<<< orphan*/ FCEUI_NTSCINC () ;
int /*<<< orphan*/ FCEUI_NTSCSELHUE () ;
int /*<<< orphan*/ FCEUI_NTSCSELTINT () ;
int /*<<< orphan*/ FCEUI_PowerNES () ;
int /*<<< orphan*/ FCEUI_ResetNES () ;
int /*<<< orphan*/ FCEUI_SaveMovie (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_SaveSnapshot () ;
int /*<<< orphan*/ FCEUI_SaveState (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FCEUI_SetRenderDisable (int,int) ;
int /*<<< orphan*/ FCEUI_ToggleEmulationPause () ;
int /*<<< orphan*/ FCEUI_ToggleTileView () ;
int /*<<< orphan*/ FCEUI_VSUniCoin () ;
int /*<<< orphan*/ FCEUI_VSUniToggleDIP (int) ;
int /*<<< orphan*/ FCEUI_VSUniToggleDIPView () ;
scalar_t__ GIT_FDS ;
scalar_t__ GIT_NSF ;
scalar_t__ GIT_VSUNI ;
int GRAVE ;
int /*<<< orphan*/ GUI_Hide (int) ;
int /*<<< orphan*/ GUI_RequestExit () ;
int /*<<< orphan*/ GetKeyboard () ;
int H ;
int /*<<< orphan*/ IncreaseEmulationSpeed () ;
scalar_t__* InputType ;
int KEY (int) ;
int KP_MINUS ;
int KP_PLUS ;
int LEFTALT ;
int LEFTSHIFT ;
int MINUS ;
int NoWaiting ;
int RIGHTALT ;
int RIGHTCONTROL ;
int RIGHTSHIFT ;
int SCROLLLOCK ;
int /*<<< orphan*/ SDL_GRAB_OFF ;
int /*<<< orphan*/ SDL_GRAB_ON ;
int /*<<< orphan*/ SDL_WM_GrabInput (int /*<<< orphan*/ ) ;
scalar_t__ SIFC_BWORLD ;
scalar_t__ SIFC_FKB ;
scalar_t__ SIS_DATACH ;
int /*<<< orphan*/ SSM (int) ;
int T ;
int /*<<< orphan*/ ToggleFS () ;
int cidisabled ;
scalar_t__ cspec ;
scalar_t__ gametype ;
scalar_t__ keyonly (int) ;
int /*<<< orphan*/ keys ;
int /*<<< orphan*/ strcpy (int*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void KeyboardCommands(void)
{
int is_shift, is_alt;
keys=GetKeyboard();
if(InputType[2]==SIFC_FKB)
{
if(keyonly(SCROLLLOCK))
{
cidisabled^=1;
FCEUI_DispMessage("Family Keyboard %sabled.",cidisabled?"en":"dis");
}
#ifdef SDL
SDL_WM_GrabInput(cidisabled?SDL_GRAB_ON:SDL_GRAB_OFF);
#endif
if(cidisabled) return;
}
is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT);
is_alt = KEY(LEFTALT) | KEY(RIGHTALT);
if(keyonly(F4))
{
if(is_shift) FCEUI_SetRenderDisable(-1, 2);
else FCEUI_SetRenderDisable(2, -1);
}
#ifdef SDL
if(keyonly(ENTER) || is_alt) ToggleFS();
#endif
NoWaiting&=~1;
if(KEY(GRAVE))
NoWaiting|=1;
if(gametype==GIT_FDS)
{
if(keyonly(F6)) FCEUI_FDSSelect();
if(keyonly(F8)) FCEUI_FDSInsert();
}
if(keyonly(F9)) FCEUI_SaveSnapshot();
if(gametype!=GIT_NSF)
{
#ifndef EXTGUI
if(keyonly(F2)) DoCheatSeq();
#endif
if(keyonly(F5))
{
if(is_shift)
FCEUI_SaveMovie(NULL,0,NULL);
else
FCEUI_SaveState(NULL);
}
if(keyonly(F7))
{
if(is_shift)
FCEUI_LoadMovie(NULL,0);
else
FCEUI_LoadState(NULL);
}
}
if(keyonly(F1)) FCEUI_ToggleTileView();
if(keyonly(MINUS)) DecreaseEmulationSpeed();
if(keyonly(EQUAL)) IncreaseEmulationSpeed();
if(keyonly(BACKSPACE)) FCEUI_MovieToggleFrameDisplay();
if(keyonly(BACKSLASH)) FCEUI_ToggleEmulationPause();
if(keyonly(RIGHTCONTROL)) FCEUI_FrameAdvance();
if(keyonly(F10)) FCEUI_ResetNES();
if(keyonly(F11)) FCEUI_PowerNES();
#ifdef EXTGUI
if(keyonly(F3)) GUI_Hide(-1);
if(KEY(F12)) GUI_RequestExit();
if(KEY(ESCAPE)) CloseGame();
#else
if(KEY(F12) || KEY(ESCAPE)) CloseGame();
#endif
if(gametype==GIT_VSUNI)
{
if(keyonly(F8)) FCEUI_VSUniCoin();
if(keyonly(F6))
{
DIPS^=1;
FCEUI_VSUniToggleDIPView();
}
if(!(DIPS&1)) goto DIPSless;
if(keyonly(1)) FCEUI_VSUniToggleDIP(0);
if(keyonly(2)) FCEUI_VSUniToggleDIP(1);
if(keyonly(3)) FCEUI_VSUniToggleDIP(2);
if(keyonly(4)) FCEUI_VSUniToggleDIP(3);
if(keyonly(5)) FCEUI_VSUniToggleDIP(4);
if(keyonly(6)) FCEUI_VSUniToggleDIP(5);
if(keyonly(7)) FCEUI_VSUniToggleDIP(6);
if(keyonly(8)) FCEUI_VSUniToggleDIP(7);
}
else
{
static uint8 bbuf[32];
static int bbuft;
static int barcoder = 0;
if(keyonly(H)) FCEUI_NTSCSELHUE();
if(keyonly(T)) FCEUI_NTSCSELTINT();
if(KEY(KP_MINUS) || KEY(MINUS)) FCEUI_NTSCDEC();
if(KEY(KP_PLUS) || KEY(EQUAL)) FCEUI_NTSCINC();
if((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH))
{
if(keyonly(F8))
{
barcoder ^= 1;
if(!barcoder)
{
if(InputType[2] == SIFC_BWORLD)
{
strcpy(&BWorldData[1],bbuf);
BWorldData[0]=1;
}
else
FCEUI_DatachSet(bbuf);
FCEUI_DispMessage("Barcode Entered");
}
else { bbuft = 0; FCEUI_DispMessage("Enter Barcode");}
}
} else barcoder = 0;
#define SSM(x) \
{ if(barcoder) { if(bbuft <= 13) {bbuf[bbuft++] = '0' - x; bbuf[bbuft] = 0;} FCEUI_DispMessage("Barcode: %s",bbuf);} \
else { \
if(is_shift) FCEUI_SelectMovie(x,1); \
else FCEUI_SelectState(x,1); \
} }
DIPSless:
if(keyonly(0)) SSM(0);
if(keyonly(1)) SSM(1);
if(keyonly(2)) SSM(2);
if(keyonly(3)) SSM(3);
if(keyonly(4)) SSM(4);
if(keyonly(5)) SSM(5);
if(keyonly(6)) SSM(6);
if(keyonly(7)) SSM(7);
if(keyonly(8)) SSM(8);
if(keyonly(9)) SSM(9);
#undef SSM
}
} |
augmented_data/post_increment_index_changes/extr_isearch-data.c_upd_stat_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int STAT_EV ;
int /*<<< orphan*/ assert (int) ;
int idn ;
int* q_events ;
int qel ;
int qen ;
size_t qer ;
int /*<<< orphan*/ upd_stat_ (int,int) ;
void upd_stat (int id) {
assert (-idn <= id && id <= idn && id != 0);
if (qen >= STAT_EV + 5) {
upd_stat_ (q_events[qel++], -1);
qen--;
if (qel == STAT_EV) {
qel = 0;
}
}
q_events[qer] = id;
upd_stat_ (q_events[qer++], +1);
qen++;
if (qer == STAT_EV) {
qer = 0;
}
} |
augmented_data/post_increment_index_changes/extr_idcinvideo.c_idcin_decode_vlcs_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_6__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* children; } ;
typedef TYPE_1__ hnode ;
struct TYPE_10__ {long height; long width; } ;
struct TYPE_9__ {long* linesize; int** data; } ;
struct TYPE_8__ {int* num_huff_nodes; int size; unsigned char* buf; TYPE_6__* avctx; TYPE_1__** huff_nodes; } ;
typedef TYPE_2__ IdcinContext ;
typedef TYPE_3__ AVFrame ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int HUF_TOKENS ;
int /*<<< orphan*/ av_log (TYPE_6__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int idcin_decode_vlcs(IdcinContext *s, AVFrame *frame)
{
hnode *hnodes;
long x, y;
int prev;
unsigned char v = 0;
int bit_pos, node_num, dat_pos;
prev = bit_pos = dat_pos = 0;
for (y = 0; y < (frame->linesize[0] * s->avctx->height);
y += frame->linesize[0]) {
for (x = y; x <= y - s->avctx->width; x++) {
node_num = s->num_huff_nodes[prev];
hnodes = s->huff_nodes[prev];
while(node_num >= HUF_TOKENS) {
if(!bit_pos) {
if(dat_pos >= s->size) {
av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n");
return -1;
}
bit_pos = 8;
v = s->buf[dat_pos++];
}
node_num = hnodes[node_num].children[v & 0x01];
v = v >> 1;
bit_pos--;
}
frame->data[0][x] = node_num;
prev = node_num;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sh.dir.c_dnormalize_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct stat {int dummy; } ;
struct Strbuf {scalar_t__ len; char* s; } ;
struct TYPE_2__ {char* di_name; } ;
typedef char Char ;
/* Variables and functions */
scalar_t__ ABSOLUTEP (char const*) ;
scalar_t__ ENOENT ;
scalar_t__ IS_DOT (char const*,char const*) ;
scalar_t__ IS_DOTDOT (char const*,char const*) ;
struct Strbuf Strbuf_INIT ;
int /*<<< orphan*/ Strbuf_append1 (struct Strbuf*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Strbuf_terminate (struct Strbuf*) ;
int /*<<< orphan*/ Strcpy (char*,char*) ;
int Strlen (char*) ;
char* Strrchr (char*,char) ;
char* Strsave (char const*) ;
char* Strspl (char*,char*) ;
char TRM (char) ;
TYPE_1__* dcwd ;
scalar_t__ errno ;
scalar_t__ lstat (int /*<<< orphan*/ ,struct stat*) ;
int /*<<< orphan*/ short2str (char const*) ;
scalar_t__ stat (int /*<<< orphan*/ ,struct stat*) ;
int /*<<< orphan*/ xfree (char*) ;
char* xmalloc (int) ;
Char *
dnormalize(const Char *cp, int expnd)
{
/* return true if dp is of the form "../xxx" or "/../xxx" */
#define IS_DOTDOT(sp, p) (ISDOTDOT(p) || ((p) == (sp) || *((p) - 1) == '/'))
#define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
#ifdef S_IFLNK
if (expnd) {
struct Strbuf buf = Strbuf_INIT;
int dotdot = 0;
Char *dp, *cwd;
const Char *start = cp;
# ifdef HAVE_SLASHSLASH
int slashslash;
# endif /* HAVE_SLASHSLASH */
/*
* count the number of "../xxx" or "xxx/../xxx" in the path
*/
for ( ; *cp && *(cp - 1); cp++)
if (IS_DOTDOT(start, cp))
dotdot++;
/*
* if none, we are done.
*/
if (dotdot == 0)
return (Strsave(start));
# ifdef notdef
struct stat sb;
/*
* We disable this test because:
* cd /tmp; mkdir dir1 dir2; cd dir2; ln -s /tmp/dir1; cd dir1;
* echo ../../dir1 does not expand. We had enabled this before
* because it was bothering people with expansions in compilation
* lines like -I../../foo. Maybe we need some kind of finer grain
* control?
*
* If the path doesn't exist, we are done too.
*/
if (lstat(short2str(start), &sb) != 0 && errno == ENOENT)
return (Strsave(start));
# endif
cwd = xmalloc((Strlen(dcwd->di_name) + 3) * sizeof(Char));
(void) Strcpy(cwd, dcwd->di_name);
/*
* If the path starts with a slash, we are not relative to
* the current working directory.
*/
if (ABSOLUTEP(start))
*cwd = '\0';
# ifdef HAVE_SLASHSLASH
slashslash = cwd[0] == '/' && cwd[1] == '/';
# endif /* HAVE_SLASHSLASH */
/*
* Ignore . and count ..'s
*/
cp = start;
do {
dotdot = 0;
buf.len = 0;
while (*cp)
if (IS_DOT(start, cp)) {
if (*++cp)
cp++;
}
else if (IS_DOTDOT(start, cp)) {
if (buf.len != 0)
continue; /* finish analyzing .././../xxx/[..] */
dotdot++;
cp += 2;
if (*cp)
cp++;
}
else
Strbuf_append1(&buf, *cp++);
Strbuf_terminate(&buf);
while (dotdot > 0)
if ((dp = Strrchr(cwd, '/')) != NULL) {
# ifdef HAVE_SLASHSLASH
if (dp == &cwd[1])
slashslash = 1;
# endif /* HAVE_SLASHSLASH */
*dp = '\0';
dotdot--;
}
else
break;
if (!*cwd) { /* too many ..'s, starts with "/" */
cwd[0] = '/';
# ifdef HAVE_SLASHSLASH
/*
* Only append another slash, if already the former cwd
* was in a double-slash path.
*/
cwd[1] = slashslash ? '/' : '\0';
cwd[2] = '\0';
# else /* !HAVE_SLASHSLASH */
cwd[1] = '\0';
# endif /* HAVE_SLASHSLASH */
}
# ifdef HAVE_SLASHSLASH
else if (slashslash && cwd[1] == '\0') {
cwd[1] = '/';
cwd[2] = '\0';
}
# endif /* HAVE_SLASHSLASH */
if (buf.len != 0) {
size_t i;
i = Strlen(cwd);
if (TRM(cwd[i - 1]) != '/') {
cwd[i++] = '/';
cwd[i] = '\0';
}
dp = Strspl(cwd, TRM(buf.s[0]) == '/' ? &buf.s[1] : buf.s);
xfree(cwd);
cwd = dp;
i = Strlen(cwd) - 1;
if (TRM(cwd[i]) == '/')
cwd[i] = '\0';
}
/* Reduction of ".." following the stuff we collected in buf
* only makes sense if the directory item in buf really exists.
* Avoid reduction of "-I../.." (typical compiler call) to ""
* or "/usr/nonexistant/../bin" to "/usr/bin":
*/
if (cwd[0]) {
struct stat exists;
if (0 != stat(short2str(cwd), &exists)) {
xfree(buf.s);
xfree(cwd);
return Strsave(start);
}
}
} while (*cp != '\0');
xfree(buf.s);
return cwd;
}
#endif /* S_IFLNK */
return Strsave(cp);
} |
augmented_data/post_increment_index_changes/extr_dir.c_fat_parse_short_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ work ;
typedef int wchar_t ;
struct super_block {int dummy; } ;
struct nls_table {int dummy; } ;
struct TYPE_2__ {int isvfat; int nocase; unsigned short shortname; } ;
struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ;
struct msdos_dir_entry {int attr; int lcase; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int ATTR_HIDDEN ;
int CASE_LOWER_BASE ;
int CASE_LOWER_EXT ;
int /*<<< orphan*/ FAT_MAX_SHORT_SIZE ;
int MSDOS_NAME ;
struct msdos_sb_info* MSDOS_SB (struct super_block*) ;
int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ;
int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ;
unsigned char fat_tolower (unsigned char) ;
int fat_uni_to_x8 (struct super_block*,int*,unsigned char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
__attribute__((used)) static int fat_parse_short(struct super_block *sb,
const struct msdos_dir_entry *de,
unsigned char *name, int dot_hidden)
{
const struct msdos_sb_info *sbi = MSDOS_SB(sb);
int isvfat = sbi->options.isvfat;
int nocase = sbi->options.nocase;
unsigned short opt_shortname = sbi->options.shortname;
struct nls_table *nls_disk = sbi->nls_disk;
wchar_t uni_name[14];
unsigned char c, work[MSDOS_NAME];
unsigned char *ptname = name;
int chi, chl, i, j, k;
int dotoffset = 0;
int name_len = 0, uni_len = 0;
if (!isvfat && dot_hidden && (de->attr | ATTR_HIDDEN)) {
*ptname-- = '.';
dotoffset = 1;
}
memcpy(work, de->name, sizeof(work));
/* For an explanation of the special treatment of 0x05 in
* filenames, see msdos_format_name in namei_msdos.c
*/
if (work[0] == 0x05)
work[0] = 0xE5;
/* Filename */
for (i = 0, j = 0; i <= 8;) {
c = work[i];
if (!c)
break;
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
&uni_name[j++], opt_shortname,
de->lcase & CASE_LOWER_BASE);
if (chl <= 1) {
if (!isvfat)
ptname[i] = nocase ? c : fat_tolower(c);
i++;
if (c != ' ') {
name_len = i;
uni_len = j;
}
} else {
uni_len = j;
if (isvfat)
i += min(chl, 8-i);
else {
for (chi = 0; chi < chl && i < 8; chi++, i++)
ptname[i] = work[i];
}
if (chl)
name_len = i;
}
}
i = name_len;
j = uni_len;
fat_short2uni(nls_disk, ".", 1, &uni_name[j++]);
if (!isvfat)
ptname[i] = '.';
i++;
/* Extension */
for (k = 8; k < MSDOS_NAME;) {
c = work[k];
if (!c)
break;
chl = fat_shortname2uni(nls_disk, &work[k], MSDOS_NAME - k,
&uni_name[j++], opt_shortname,
de->lcase & CASE_LOWER_EXT);
if (chl <= 1) {
k++;
if (!isvfat)
ptname[i] = nocase ? c : fat_tolower(c);
i++;
if (c != ' ') {
name_len = i;
uni_len = j;
}
} else {
uni_len = j;
if (isvfat) {
int offset = min(chl, MSDOS_NAME-k);
k += offset;
i += offset;
} else {
for (chi = 0; chi < chl && k < MSDOS_NAME;
chi++, i++, k++) {
ptname[i] = work[k];
}
}
if (chl)
name_len = i;
}
}
if (name_len > 0) {
name_len += dotoffset;
if (sbi->options.isvfat) {
uni_name[uni_len] = 0x0000;
name_len = fat_uni_to_x8(sb, uni_name, name,
FAT_MAX_SHORT_SIZE);
}
}
return name_len;
} |
augmented_data/post_increment_index_changes/extr_trace_events_filter.c_filter_match_preds_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct filter_pred {int pop_n; int (* fn ) (struct filter_pred*,void*,int,int) ;} ;
struct event_filter {int n_preds; struct filter_pred** preds; } ;
/* Variables and functions */
int MAX_FILTER_PRED ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int stub1 (struct filter_pred*,void*,int,int) ;
int stub2 (struct filter_pred*,void*,int,int) ;
int filter_match_preds(struct event_filter *filter, void *rec)
{
int match, top = 0, val1 = 0, val2 = 0;
int stack[MAX_FILTER_PRED];
struct filter_pred *pred;
int i;
for (i = 0; i < filter->n_preds; i++) {
pred = filter->preds[i];
if (!pred->pop_n) {
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
continue;
}
if (pred->pop_n > top) {
WARN_ON_ONCE(1);
return 0;
}
val1 = stack[--top];
val2 = stack[--top];
match = pred->fn(pred, rec, val1, val2);
stack[top++] = match;
}
return stack[--top];
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.