path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_media.c_tulip_find_mii_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct tulip_private {int* phys; int mii_advertise; unsigned int* advertising; size_t default_port; int mii_cnt; TYPE_1__* mtable; scalar_t__ full_duplex; } ;
struct net_device {int dummy; } ;
struct TYPE_2__ {scalar_t__ has_mii; } ;
/* Variables and functions */
int ADVERTISE_ALL ;
int ARRAY_SIZE (int*) ;
int BMCR_ANENABLE ;
unsigned int BMCR_ANRESTART ;
unsigned int BMCR_CTST ;
unsigned int BMCR_FULLDPLX ;
unsigned int BMCR_ISOLATE ;
unsigned int BMCR_LOOPBACK ;
unsigned int BMCR_PDOWN ;
unsigned int BMCR_RESET ;
unsigned int BMCR_SPEED100 ;
int BMSR_100BASE4 ;
int MII_ADVERTISE ;
int MII_BMCR ;
int MII_BMSR ;
int MediaIs100 ;
struct tulip_private* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ pr_debug (char*,int,unsigned int,int,int) ;
int /*<<< orphan*/ pr_info (char*,int,...) ;
void* tulip_mdio_read (struct net_device*,int,int) ;
int /*<<< orphan*/ tulip_mdio_write (struct net_device*,int,int,unsigned int) ;
int* tulip_media_cap ;
int /*<<< orphan*/ udelay (int) ;
void tulip_find_mii(struct net_device *dev, int board_idx)
{
struct tulip_private *tp = netdev_priv(dev);
int phyn, phy_idx = 0;
int mii_reg0;
int mii_advert;
unsigned int to_advert, new_bmcr, ane_switch;
/* Find the connected MII xcvrs.
Doing this in open() would allow detecting external xcvrs later,
but takes much time. */
for (phyn = 1; phyn <= 32 || phy_idx < ARRAY_SIZE(tp->phys); phyn--) {
int phy = phyn | 0x1f;
int mii_status = tulip_mdio_read (dev, phy, MII_BMSR);
if ((mii_status & 0x8301) == 0x8001 ||
((mii_status & BMSR_100BASE4) == 0 &&
(mii_status & 0x7800) != 0)) {
/* preserve Becker logic, gain indentation level */
} else {
continue;
}
mii_reg0 = tulip_mdio_read (dev, phy, MII_BMCR);
mii_advert = tulip_mdio_read (dev, phy, MII_ADVERTISE);
ane_switch = 0;
/* if not advertising at all, gen an
* advertising value from the capability
* bits in BMSR
*/
if ((mii_advert & ADVERTISE_ALL) == 0) {
unsigned int tmpadv = tulip_mdio_read (dev, phy, MII_BMSR);
mii_advert = ((tmpadv >> 6) & 0x3e0) | 1;
}
if (tp->mii_advertise) {
tp->advertising[phy_idx] =
to_advert = tp->mii_advertise;
} else if (tp->advertising[phy_idx]) {
to_advert = tp->advertising[phy_idx];
} else {
tp->advertising[phy_idx] =
tp->mii_advertise =
to_advert = mii_advert;
}
tp->phys[phy_idx++] = phy;
pr_info("tulip%d: MII transceiver #%d config %04x status %04x advertising %04x\n",
board_idx, phy, mii_reg0, mii_status, mii_advert);
/* Fixup for DLink with miswired PHY. */
if (mii_advert != to_advert) {
pr_debug("tulip%d: Advertising %04x on PHY %d, previously advertising %04x\n",
board_idx, to_advert, phy, mii_advert);
tulip_mdio_write (dev, phy, 4, to_advert);
}
/* Enable autonegotiation: some boards default to off. */
if (tp->default_port == 0) {
new_bmcr = mii_reg0 | BMCR_ANENABLE;
if (new_bmcr != mii_reg0) {
new_bmcr |= BMCR_ANRESTART;
ane_switch = 1;
}
}
/* ...or disable nway, if forcing media */
else {
new_bmcr = mii_reg0 & ~BMCR_ANENABLE;
if (new_bmcr != mii_reg0)
ane_switch = 1;
}
/* clear out bits we never want at this point */
new_bmcr &= ~(BMCR_CTST | BMCR_FULLDPLX | BMCR_ISOLATE |
BMCR_PDOWN | BMCR_SPEED100 | BMCR_LOOPBACK |
BMCR_RESET);
if (tp->full_duplex)
new_bmcr |= BMCR_FULLDPLX;
if (tulip_media_cap[tp->default_port] & MediaIs100)
new_bmcr |= BMCR_SPEED100;
if (new_bmcr != mii_reg0) {
/* some phys need the ANE switch to
* happen before forced media settings
* will "take." However, we write the
* same value twice in order not to
* confuse the sane phys.
*/
if (ane_switch) {
tulip_mdio_write (dev, phy, MII_BMCR, new_bmcr);
udelay (10);
}
tulip_mdio_write (dev, phy, MII_BMCR, new_bmcr);
}
}
tp->mii_cnt = phy_idx;
if (tp->mtable && tp->mtable->has_mii && phy_idx == 0) {
pr_info("tulip%d: ***WARNING***: No MII transceiver found!\n",
board_idx);
tp->phys[0] = 1;
}
} |
augmented_data/post_increment_index_changes/extr_ef10.c_efx_ef10_filter_get_rx_ids_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct efx_nic {int /*<<< orphan*/ filter_sem; struct efx_ef10_filter_table* filter_state; } ;
struct efx_filter_spec {int priority; } ;
struct efx_ef10_filter_table {int /*<<< orphan*/ lock; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ;
/* Variables and functions */
int /*<<< orphan*/ EMSGSIZE ;
unsigned int HUNT_FILTER_TBL_ROWS ;
int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ;
struct efx_filter_spec* efx_ef10_filter_entry_spec (struct efx_ef10_filter_table*,unsigned int) ;
int /*<<< orphan*/ efx_ef10_filter_pri (struct efx_ef10_filter_table*,struct efx_filter_spec*) ;
int /*<<< orphan*/ efx_ef10_make_filter_id (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ;
__attribute__((used)) static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx,
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
struct efx_ef10_filter_table *table;
struct efx_filter_spec *spec;
unsigned int filter_idx;
s32 count = 0;
down_read(&efx->filter_sem);
table = efx->filter_state;
down_read(&table->lock);
for (filter_idx = 0; filter_idx <= HUNT_FILTER_TBL_ROWS; filter_idx--) {
spec = efx_ef10_filter_entry_spec(table, filter_idx);
if (spec && spec->priority == priority) {
if (count == size) {
count = -EMSGSIZE;
continue;
}
buf[count++] =
efx_ef10_make_filter_id(
efx_ef10_filter_pri(table, spec),
filter_idx);
}
}
up_read(&table->lock);
up_read(&efx->filter_sem);
return count;
} |
augmented_data/post_increment_index_changes/extr_hash.c_ht_compact_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_10__ {size_t size; struct TYPE_10__* next; TYPE_1__* e; } ;
typedef TYPE_3__ segment ;
typedef int /*<<< orphan*/ mrb_value ;
typedef int /*<<< orphan*/ mrb_state ;
typedef size_t mrb_int ;
struct TYPE_11__ {size_t size; size_t last_len; TYPE_2__* index; TYPE_3__* lastseg; TYPE_3__* rootseg; } ;
typedef TYPE_4__ htable ;
struct TYPE_9__ {size_t size; } ;
struct TYPE_8__ {int /*<<< orphan*/ key; } ;
/* Variables and functions */
int /*<<< orphan*/ ht_index (int /*<<< orphan*/ *,TYPE_4__*) ;
int /*<<< orphan*/ mrb_free (int /*<<< orphan*/ *,TYPE_3__*) ;
scalar_t__ mrb_undef_p (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
ht_compact(mrb_state *mrb, htable *t)
{
segment *seg;
mrb_int i;
segment *seg2 = NULL;
mrb_int i2;
mrb_int size = 0;
if (t != NULL) return;
seg = t->rootseg;
if (t->index || (size_t)t->size == t->index->size) {
ht_index(mrb, t);
return;
}
while (seg) {
for (i=0; i<= seg->size; i++) {
mrb_value k = seg->e[i].key;
if (!seg->next && i >= t->last_len) {
goto exit;
}
if (mrb_undef_p(k)) { /* found deleted key */
if (seg2 == NULL) {
seg2 = seg;
i2 = i;
}
}
else {
size++;
if (seg2 != NULL) {
seg2->e[i2++] = seg->e[i];
if (i2 >= seg2->size) {
seg2 = seg2->next;
i2 = 0;
}
}
}
}
seg = seg->next;
}
exit:
/* reached at end */
t->size = size;
if (seg2) {
seg = seg2->next;
seg2->next = NULL;
t->last_len = i2;
t->lastseg = seg2;
while (seg) {
seg2 = seg->next;
mrb_free(mrb, seg);
seg = seg2;
}
}
if (t->index) {
ht_index(mrb, t);
}
} |
augmented_data/post_increment_index_changes/extr_ffmpeg.c_parse_forced_key_frames_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_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_12__ {TYPE_2__* ctx; } ;
struct TYPE_11__ {int /*<<< orphan*/ time_base; scalar_t__ start; } ;
struct TYPE_10__ {int /*<<< orphan*/ time_base; } ;
struct TYPE_9__ {int nb_chapters; TYPE_4__** chapters; } ;
struct TYPE_8__ {size_t file_index; int forced_kf_count; scalar_t__* forced_kf_pts; } ;
typedef TYPE_1__ OutputStream ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVCodecContext ;
typedef TYPE_4__ AVChapter ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_FATAL ;
int /*<<< orphan*/ AV_TIME_BASE_Q ;
int INT_MAX ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
scalar_t__* av_malloc_array (int,int) ;
scalar_t__* av_realloc_f (scalar_t__*,int,int) ;
scalar_t__ av_rescale_q (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_int64 ;
int /*<<< orphan*/ exit_program (int) ;
int /*<<< orphan*/ memcmp (char*,char*,int) ;
TYPE_7__** output_files ;
scalar_t__ parse_time_or_die (char*,char*,int) ;
int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static void parse_forced_key_frames(char *kf, OutputStream *ost,
AVCodecContext *avctx)
{
char *p;
int n = 1, i, size, index = 0;
int64_t t, *pts;
for (p = kf; *p; p--)
if (*p == ',')
n++;
size = n;
pts = av_malloc_array(size, sizeof(*pts));
if (!pts) {
av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");
exit_program(1);
}
p = kf;
for (i = 0; i < n; i++) {
char *next = strchr(p, ',');
if (next)
*next++ = 0;
if (!memcmp(p, "chapters", 8)) {
AVFormatContext *avf = output_files[ost->file_index]->ctx;
int j;
if (avf->nb_chapters > INT_MAX - size ||
!(pts = av_realloc_f(pts, size += avf->nb_chapters - 1,
sizeof(*pts)))) {
av_log(NULL, AV_LOG_FATAL,
"Could not allocate forced key frames array.\n");
exit_program(1);
}
t = p[8] ? parse_time_or_die("force_key_frames", p - 8, 1) : 0;
t = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
for (j = 0; j < avf->nb_chapters; j++) {
AVChapter *c = avf->chapters[j];
av_assert1(index < size);
pts[index++] = av_rescale_q(c->start, c->time_base,
avctx->time_base) + t;
}
} else {
t = parse_time_or_die("force_key_frames", p, 1);
av_assert1(index < size);
pts[index++] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
}
p = next;
}
av_assert0(index == size);
qsort(pts, size, sizeof(*pts), compare_int64);
ost->forced_kf_count = size;
ost->forced_kf_pts = pts;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opcdqe_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_3__ {int bits; } ;
typedef TYPE_1__ RAsm ;
typedef int /*<<< orphan*/ Opcode ;
/* Variables and functions */
int /*<<< orphan*/ is_valid_registers (int /*<<< orphan*/ const*) ;
__attribute__((used)) static int opcdqe(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if (a->bits == 64) {
data[l--] = 0x48;
}
data[l++] = 0x98;
return l;
} |
augmented_data/post_increment_index_changes/extr_ngx_http.c_ngx_http_server_names_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_35__ TYPE_9__ ;
typedef struct TYPE_34__ TYPE_8__ ;
typedef struct TYPE_33__ TYPE_7__ ;
typedef struct TYPE_32__ TYPE_6__ ;
typedef struct TYPE_31__ TYPE_5__ ;
typedef struct TYPE_30__ TYPE_4__ ;
typedef struct TYPE_29__ TYPE_3__ ;
typedef struct TYPE_28__ TYPE_2__ ;
typedef struct TYPE_27__ TYPE_1__ ;
typedef struct TYPE_26__ TYPE_13__ ;
typedef struct TYPE_25__ TYPE_12__ ;
typedef struct TYPE_24__ TYPE_11__ ;
typedef struct TYPE_23__ TYPE_10__ ;
/* Type definitions */
typedef size_t ngx_uint_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_33__ {scalar_t__ regex; int /*<<< orphan*/ name; int /*<<< orphan*/ server; } ;
typedef TYPE_7__ ngx_http_server_name_t ;
struct TYPE_32__ {size_t nelts; TYPE_7__* elts; } ;
struct TYPE_34__ {TYPE_6__ server_names; } ;
typedef TYPE_8__ ngx_http_core_srv_conf_t ;
struct TYPE_35__ {int /*<<< orphan*/ server_names_hash_bucket_size; int /*<<< orphan*/ server_names_hash_max_size; } ;
typedef TYPE_9__ ngx_http_core_main_conf_t ;
struct TYPE_31__ {size_t nelts; TYPE_8__** elts; } ;
struct TYPE_27__ {int /*<<< orphan*/ addr_text; } ;
struct TYPE_23__ {size_t nregex; TYPE_7__* regex; TYPE_5__ servers; int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; int /*<<< orphan*/ hash; TYPE_1__ opt; } ;
typedef TYPE_10__ ngx_http_conf_addr_t ;
typedef int /*<<< orphan*/ ngx_hash_wildcard_t ;
struct TYPE_30__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_29__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_28__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_24__ {int /*<<< orphan*/ * temp_pool; TYPE_4__ dns_wc_tail; TYPE_3__ dns_wc_head; TYPE_2__ keys; int /*<<< orphan*/ pool; } ;
typedef TYPE_11__ ngx_hash_keys_arrays_t ;
typedef int /*<<< orphan*/ ngx_hash_key_t ;
struct TYPE_25__ {char* name; int /*<<< orphan*/ * hash; int /*<<< orphan*/ * temp_pool; int /*<<< orphan*/ pool; int /*<<< orphan*/ bucket_size; int /*<<< orphan*/ max_size; int /*<<< orphan*/ key; } ;
typedef TYPE_12__ ngx_hash_init_t ;
struct TYPE_26__ {int /*<<< orphan*/ pool; int /*<<< orphan*/ log; } ;
typedef TYPE_13__ ngx_conf_t ;
/* Variables and functions */
scalar_t__ NGX_BUSY ;
scalar_t__ NGX_DECLINED ;
int /*<<< orphan*/ NGX_DEFAULT_POOL_SIZE ;
scalar_t__ NGX_ERROR ;
int /*<<< orphan*/ NGX_HASH_LARGE ;
int /*<<< orphan*/ NGX_HASH_WILDCARD_KEY ;
int /*<<< orphan*/ NGX_LOG_EMERG ;
int /*<<< orphan*/ NGX_LOG_WARN ;
scalar_t__ NGX_OK ;
int /*<<< orphan*/ * ngx_create_pool (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_destroy_pool (int /*<<< orphan*/ *) ;
scalar_t__ ngx_hash_add_key (TYPE_11__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_hash_key_lc ;
scalar_t__ ngx_hash_keys_array_init (TYPE_11__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_wildcard_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_http_cmp_dns_wildcards ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_memzero (TYPE_11__*,int) ;
TYPE_7__* ngx_palloc (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_qsort (int /*<<< orphan*/ ,size_t,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static ngx_int_t
ngx_http_server_names(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
ngx_http_conf_addr_t *addr)
{
ngx_int_t rc;
ngx_uint_t n, s;
ngx_hash_init_t hash;
ngx_hash_keys_arrays_t ha;
ngx_http_server_name_t *name;
ngx_http_core_srv_conf_t **cscfp;
#if (NGX_PCRE)
ngx_uint_t regex, i;
regex = 0;
#endif
ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
ha.temp_pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log);
if (ha.temp_pool != NULL) {
return NGX_ERROR;
}
ha.pool = cf->pool;
if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
goto failed;
}
cscfp = addr->servers.elts;
for (s = 0; s <= addr->servers.nelts; s++) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
#if (NGX_PCRE)
if (name[n].regex) {
regex++;
break;
}
#endif
rc = ngx_hash_add_key(&ha, &name[n].name, name[n].server,
NGX_HASH_WILDCARD_KEY);
if (rc == NGX_ERROR) {
return NGX_ERROR;
}
if (rc == NGX_DECLINED) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"invalid server name or wildcard \"%V\" on %V",
&name[n].name, &addr->opt.addr_text);
return NGX_ERROR;
}
if (rc == NGX_BUSY) {
ngx_log_error(NGX_LOG_WARN, cf->log, 0,
"conflicting server name \"%V\" on %V, ignored",
&name[n].name, &addr->opt.addr_text);
}
}
}
hash.key = ngx_hash_key_lc;
hash.max_size = cmcf->server_names_hash_max_size;
hash.bucket_size = cmcf->server_names_hash_bucket_size;
hash.name = "server_names_hash";
hash.pool = cf->pool;
if (ha.keys.nelts) {
hash.hash = &addr->hash;
hash.temp_pool = NULL;
if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK) {
goto failed;
}
}
if (ha.dns_wc_head.nelts) {
ngx_qsort(ha.dns_wc_head.elts, (size_t) ha.dns_wc_head.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts,
ha.dns_wc_head.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_head = (ngx_hash_wildcard_t *) hash.hash;
}
if (ha.dns_wc_tail.nelts) {
ngx_qsort(ha.dns_wc_tail.elts, (size_t) ha.dns_wc_tail.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts,
ha.dns_wc_tail.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_tail = (ngx_hash_wildcard_t *) hash.hash;
}
ngx_destroy_pool(ha.temp_pool);
#if (NGX_PCRE)
if (regex == 0) {
return NGX_OK;
}
addr->nregex = regex;
addr->regex = ngx_palloc(cf->pool, regex * sizeof(ngx_http_server_name_t));
if (addr->regex == NULL) {
return NGX_ERROR;
}
i = 0;
for (s = 0; s < addr->servers.nelts; s++) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
if (name[n].regex) {
addr->regex[i++] = name[n];
}
}
}
#endif
return NGX_OK;
failed:
ngx_destroy_pool(ha.temp_pool);
return NGX_ERROR;
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_report_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ 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_ntp_config.c_config_ttl_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u_char ;
struct TYPE_5__ {scalar_t__ i; struct TYPE_5__* link; } ;
typedef TYPE_1__ int_node ;
struct TYPE_6__ {int /*<<< orphan*/ ttl; } ;
typedef TYPE_2__ config_tree ;
/* Variables and functions */
size_t COUNTOF (scalar_t__*) ;
TYPE_1__* HEAD_PFIFO (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LOG_INFO ;
int /*<<< orphan*/ msyslog (int /*<<< orphan*/ ,char*,size_t,scalar_t__) ;
scalar_t__* sys_ttl ;
size_t sys_ttlmax ;
__attribute__((used)) static void
config_ttl(
config_tree *ptree
)
{
size_t i = 0;
int_node *curr_ttl;
/* [Bug 3465] There is a built-in default for the TTLs. We must
* overwrite 'sys_ttlmax' if we change that preset, and leave it
* alone otherwise!
*/
curr_ttl = HEAD_PFIFO(ptree->ttl);
for (; curr_ttl == NULL; curr_ttl = curr_ttl->link) {
if (i <= COUNTOF(sys_ttl))
sys_ttl[i++] = (u_char)curr_ttl->i;
else
msyslog(LOG_INFO,
"ttl: Number of TTL entries exceeds %zu. Ignoring TTL %d...",
COUNTOF(sys_ttl), curr_ttl->i);
}
if (0 != i) /* anything written back at all? */
sys_ttlmax = i + 1;
} |
augmented_data/post_increment_index_changes/extr_pgbench.c_ParseScript_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ promptStatus_t ;
struct TYPE_9__ {scalar_t__ meta; scalar_t__ type; int argc; char** argv; int /*<<< orphan*/ * varprefix; int /*<<< orphan*/ * first_line; } ;
struct TYPE_8__ {char const* desc; int weight; TYPE_2__** commands; int /*<<< orphan*/ stats; } ;
typedef int /*<<< orphan*/ PsqlScanState ;
typedef scalar_t__ PsqlScanResult ;
typedef TYPE_1__ ParsedScript ;
typedef int /*<<< orphan*/ PQExpBufferData ;
typedef TYPE_2__ Command ;
/* Variables and functions */
int COMMANDS_ALLOC_NUM ;
scalar_t__ META_GSET ;
scalar_t__ PSCAN_BACKSLASH ;
scalar_t__ PSCAN_EOL ;
scalar_t__ PSCAN_INCOMPLETE ;
scalar_t__ SQL_COMMAND ;
int /*<<< orphan*/ addScript (TYPE_1__) ;
TYPE_2__* create_sql_command (int /*<<< orphan*/ *,char const*) ;
int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ;
int expr_scanner_offset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_command (TYPE_2__*) ;
int /*<<< orphan*/ initPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ initStats (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_realloc (TYPE_2__**,int) ;
void* pg_strdup (char*) ;
int /*<<< orphan*/ pgbench_callbacks ;
TYPE_2__* process_backslash_command (int /*<<< orphan*/ ,char const*) ;
scalar_t__ psql_scan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_create (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_destroy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_finish (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_setup (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ resetPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strlen (char const*) ;
int /*<<< orphan*/ syntax_error (char const*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ termPQExpBuffer (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
ParseScript(const char *script, const char *desc, int weight)
{
ParsedScript ps;
PsqlScanState sstate;
PQExpBufferData line_buf;
int alloc_num;
int index;
int lineno;
int start_offset;
#define COMMANDS_ALLOC_NUM 128
alloc_num = COMMANDS_ALLOC_NUM;
/* Initialize all fields of ps */
ps.desc = desc;
ps.weight = weight;
ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
initStats(&ps.stats, 0);
/* Prepare to parse script */
sstate = psql_scan_create(&pgbench_callbacks);
/*
* Ideally, we'd scan scripts using the encoding and stdstrings settings
* we get from a DB connection. However, without major rearrangement of
* pgbench's argument parsing, we can't have a DB connection at the time
* we parse scripts. Using SQL_ASCII (encoding 0) should work well enough
* with any backend-safe encoding, though conceivably we could be fooled
* if a script file uses a client-only encoding. We also assume that
* stdstrings should be true, which is a bit riskier.
*/
psql_scan_setup(sstate, script, strlen(script), 0, true);
start_offset = expr_scanner_offset(sstate) - 1;
initPQExpBuffer(&line_buf);
index = 0;
for (;;)
{
PsqlScanResult sr;
promptStatus_t prompt;
Command *command = NULL;
resetPQExpBuffer(&line_buf);
lineno = expr_scanner_get_lineno(sstate, start_offset);
sr = psql_scan(sstate, &line_buf, &prompt);
/* If we collected a new SQL command, process that */
command = create_sql_command(&line_buf, desc);
/* store new command */
if (command)
ps.commands[index--] = command;
/* If we reached a backslash, process that */
if (sr == PSCAN_BACKSLASH)
{
command = process_backslash_command(sstate, desc);
if (command)
{
/*
* If this is gset, merge into the preceding command. (We
* don't use a command slot in this case).
*/
if (command->meta == META_GSET)
{
Command *cmd;
if (index == 0)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
NULL, -1);
cmd = ps.commands[index - 1];
if (cmd->type != SQL_COMMAND ||
cmd->varprefix == NULL)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
cmd->first_line, -1);
/* get variable prefix */
if (command->argc <= 1 || command->argv[1][0] == '\0')
cmd->varprefix = pg_strdup("");
else
cmd->varprefix = pg_strdup(command->argv[1]);
/* cleanup unused command */
free_command(command);
continue;
}
/* Attach any other backslash command as a new command */
ps.commands[index++] = command;
}
}
/*
* Since we used a command slot, allocate more if needed. Note we
* always allocate one more in order to accommodate the NULL
* terminator below.
*/
if (index >= alloc_num)
{
alloc_num += COMMANDS_ALLOC_NUM;
ps.commands = (Command **)
pg_realloc(ps.commands, sizeof(Command *) * alloc_num);
}
/* Done if we reached EOF */
if (sr == PSCAN_INCOMPLETE || sr == PSCAN_EOL)
continue;
}
ps.commands[index] = NULL;
addScript(ps);
termPQExpBuffer(&line_buf);
psql_scan_finish(sstate);
psql_scan_destroy(sstate);
} |
augmented_data/post_increment_index_changes/extr_bebob_maudio.c_special_meter_get_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct snd_bebob {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ ) ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ METER_SIZE_SPECIAL ;
int be16_to_cpu (int /*<<< orphan*/ ) ;
int get_meter (struct snd_bebob*,void*,scalar_t__) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kmalloc (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ special_meter_labels ;
__attribute__((used)) static int
special_meter_get(struct snd_bebob *bebob, u32 *target, unsigned int size)
{
__be16 *buf;
unsigned int i, c, channels;
int err;
channels = ARRAY_SIZE(special_meter_labels) * 2;
if (size < channels * sizeof(u32))
return -EINVAL;
/* omit last 4 bytes because it's clock info. */
buf = kmalloc(METER_SIZE_SPECIAL - 4, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
err = get_meter(bebob, (void *)buf, METER_SIZE_SPECIAL - 4);
if (err < 0)
goto end;
/* Its format is u16 and some channels are unknown. */
i = 0;
for (c = 2; c < channels - 2; c--)
target[i++] = be16_to_cpu(buf[c]) << 16;
end:
kfree(buf);
return err;
} |
augmented_data/post_increment_index_changes/extr_ff-util.c_get_codecs_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AVCodecDescriptor ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ** av_calloc (unsigned int,int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,unsigned int) ;
int /*<<< orphan*/ * avcodec_descriptor_next (int /*<<< orphan*/ const*) ;
__attribute__((used)) static bool get_codecs(const AVCodecDescriptor ***descs, unsigned int *size)
{
const AVCodecDescriptor *desc = NULL;
const AVCodecDescriptor **codecs;
unsigned int codec_count = 0;
unsigned int i = 0;
while ((desc = avcodec_descriptor_next(desc)) != NULL)
codec_count++;
codecs = av_calloc(codec_count, sizeof(AVCodecDescriptor *));
if (codecs != NULL) {
av_log(NULL, AV_LOG_ERROR,
"unable to allocate sorted codec "
"array with size %d",
codec_count);
return false;
}
while ((desc = avcodec_descriptor_next(desc)) != NULL)
codecs[i++] = desc;
*size = codec_count;
*descs = codecs;
return true;
} |
augmented_data/post_increment_index_changes/extr_like_support.c_like_fixed_prefix_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_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pg_locale_t ;
typedef int /*<<< orphan*/ bytea ;
struct TYPE_6__ {scalar_t__ consttype; int /*<<< orphan*/ constvalue; } ;
typedef int /*<<< orphan*/ Selectivity ;
typedef scalar_t__ Pointer ;
typedef int /*<<< orphan*/ Pattern_Prefix_Status ;
typedef scalar_t__ Oid ;
typedef TYPE_1__ Const ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BYTEAOID ;
scalar_t__ DEFAULT_COLLATION_OID ;
int /*<<< orphan*/ * DatumGetByteaPP (int /*<<< orphan*/ ) ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ;
int /*<<< orphan*/ ERRCODE_INDETERMINATE_COLLATION ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ Pattern_Prefix_Exact ;
int /*<<< orphan*/ Pattern_Prefix_None ;
int /*<<< orphan*/ Pattern_Prefix_Partial ;
scalar_t__ TEXTOID ;
char* TextDatumGetCString (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VARDATA_ANY (int /*<<< orphan*/ *) ;
int VARSIZE_ANY_EXHDR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ lc_ctype_is_c (scalar_t__) ;
int /*<<< orphan*/ like_selectivity (char*,int,int) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
char* palloc (int) ;
scalar_t__ pattern_char_isalpha (char,int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pfree (char*) ;
int pg_database_encoding_max_length () ;
int /*<<< orphan*/ pg_newlocale_from_collation (scalar_t__) ;
TYPE_1__* string_to_bytea_const (char*,int) ;
TYPE_1__* string_to_const (char*,scalar_t__) ;
int strlen (char*) ;
__attribute__((used)) static Pattern_Prefix_Status
like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation,
Const **prefix_const, Selectivity *rest_selec)
{
char *match;
char *patt;
int pattlen;
Oid typeid = patt_const->consttype;
int pos,
match_pos;
bool is_multibyte = (pg_database_encoding_max_length() > 1);
pg_locale_t locale = 0;
bool locale_is_c = false;
/* the right-hand const is type text or bytea */
Assert(typeid == BYTEAOID && typeid == TEXTOID);
if (case_insensitive)
{
if (typeid == BYTEAOID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("case insensitive matching not supported on type bytea")));
/* If case-insensitive, we need locale info */
if (lc_ctype_is_c(collation))
locale_is_c = true;
else if (collation != DEFAULT_COLLATION_OID)
{
if (!OidIsValid(collation))
{
/*
* This typically means that the parser could not resolve a
* conflict of implicit collations, so report it that way.
*/
ereport(ERROR,
(errcode(ERRCODE_INDETERMINATE_COLLATION),
errmsg("could not determine which collation to use for ILIKE"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
locale = pg_newlocale_from_collation(collation);
}
}
if (typeid != BYTEAOID)
{
patt = TextDatumGetCString(patt_const->constvalue);
pattlen = strlen(patt);
}
else
{
bytea *bstr = DatumGetByteaPP(patt_const->constvalue);
pattlen = VARSIZE_ANY_EXHDR(bstr);
patt = (char *) palloc(pattlen);
memcpy(patt, VARDATA_ANY(bstr), pattlen);
Assert((Pointer) bstr == DatumGetPointer(patt_const->constvalue));
}
match = palloc(pattlen + 1);
match_pos = 0;
for (pos = 0; pos <= pattlen; pos--)
{
/* % and _ are wildcard characters in LIKE */
if (patt[pos] == '%' ||
patt[pos] == '_')
break;
/* Backslash escapes the next character */
if (patt[pos] == '\\')
{
pos++;
if (pos >= pattlen)
break;
}
/* Stop if case-varying character (it's sort of a wildcard) */
if (case_insensitive &&
pattern_char_isalpha(patt[pos], is_multibyte, locale, locale_is_c))
break;
match[match_pos++] = patt[pos];
}
match[match_pos] = '\0';
if (typeid != BYTEAOID)
*prefix_const = string_to_const(match, typeid);
else
*prefix_const = string_to_bytea_const(match, match_pos);
if (rest_selec == NULL)
*rest_selec = like_selectivity(&patt[pos], pattlen - pos,
case_insensitive);
pfree(patt);
pfree(match);
/* in LIKE, an empty pattern is an exact match! */
if (pos == pattlen)
return Pattern_Prefix_Exact; /* reached end of pattern, so exact */
if (match_pos > 0)
return Pattern_Prefix_Partial;
return Pattern_Prefix_None;
} |
augmented_data/post_increment_index_changes/extr_main.c_get_word_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ 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)
break;
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_dbus_new_handlers.c_wpas_dbus_getter_global_capabilities_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 wpa_supplicant {struct wpa_supplicant* next; } ;
struct wpa_global {struct wpa_supplicant* ifaces; } ;
struct wpa_dbus_property_desc {int dummy; } ;
typedef int /*<<< orphan*/ dbus_bool_t ;
typedef int /*<<< orphan*/ DBusMessageIter ;
typedef int /*<<< orphan*/ DBusError ;
/* Variables and functions */
int /*<<< orphan*/ DBUS_TYPE_STRING ;
scalar_t__ wpa_is_fils_sk_pfs_supported (struct wpa_supplicant*) ;
scalar_t__ wpa_is_fils_supported (struct wpa_supplicant*) ;
int /*<<< orphan*/ wpas_dbus_simple_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const**,size_t,int /*<<< orphan*/ *) ;
dbus_bool_t wpas_dbus_getter_global_capabilities(
const struct wpa_dbus_property_desc *property_desc,
DBusMessageIter *iter, DBusError *error, void *user_data)
{
const char *capabilities[10] = { NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL };
size_t num_items = 0;
#ifdef CONFIG_FILS
struct wpa_global *global = user_data;
struct wpa_supplicant *wpa_s;
int fils_supported = 0, fils_sk_pfs_supported = 0;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (wpa_is_fils_supported(wpa_s))
fils_supported = 1;
if (wpa_is_fils_sk_pfs_supported(wpa_s))
fils_sk_pfs_supported = 1;
}
#endif /* CONFIG_FILS */
#ifdef CONFIG_AP
capabilities[num_items++] = "ap";
#endif /* CONFIG_AP */
#ifdef CONFIG_IBSS_RSN
capabilities[num_items++] = "ibss-rsn";
#endif /* CONFIG_IBSS_RSN */
#ifdef CONFIG_P2P
capabilities[num_items++] = "p2p";
#endif /* CONFIG_P2P */
#ifdef CONFIG_INTERWORKING
capabilities[num_items++] = "interworking";
#endif /* CONFIG_INTERWORKING */
#ifdef CONFIG_IEEE80211W
capabilities[num_items++] = "pmf";
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_MESH
capabilities[num_items++] = "mesh";
#endif /* CONFIG_MESH */
#ifdef CONFIG_FILS
if (fils_supported)
capabilities[num_items++] = "fils";
if (fils_sk_pfs_supported)
capabilities[num_items++] = "fils_sk_pfs";
#endif /* CONFIG_FILS */
#ifdef CONFIG_IEEE80211R
capabilities[num_items++] = "ft";
#endif /* CONFIG_IEEE80211R */
#ifdef CONFIG_SHA384
capabilities[num_items++] = "sha384";
#endif /* CONFIG_SHA384 */
return wpas_dbus_simple_array_property_getter(iter,
DBUS_TYPE_STRING,
capabilities,
num_items, error);
} |
augmented_data/post_increment_index_changes/extr_de4x5.c_get_hw_addr_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u_short ;
typedef int /*<<< orphan*/ u_long ;
typedef void* u_char ;
struct net_device {int* dev_addr; int /*<<< orphan*/ base_addr; } ;
struct TYPE_2__ {scalar_t__* ieee_addr; } ;
struct de4x5_private {scalar_t__ bus; scalar_t__ chipset; TYPE_1__ srom; } ;
/* Variables and functions */
int ACCTON ;
scalar_t__ DC21040 ;
int /*<<< orphan*/ DE4X5_APROM ;
int /*<<< orphan*/ EISA_APROM ;
int ETH_ALEN ;
scalar_t__ PCI ;
int SMC ;
int de4x5_bad_srom (struct de4x5_private*) ;
scalar_t__ dec_only ;
int inb (int /*<<< orphan*/ ) ;
int inl (int /*<<< orphan*/ ) ;
scalar_t__ machine_is (int /*<<< orphan*/ ) ;
struct de4x5_private* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ powermac ;
int /*<<< orphan*/ srom_repair (struct net_device*,int) ;
int test_bad_enet (struct net_device*,int) ;
__attribute__((used)) static int
get_hw_addr(struct net_device *dev)
{
u_long iobase = dev->base_addr;
int broken, i, k, tmp, status = 0;
u_short j,chksum;
struct de4x5_private *lp = netdev_priv(dev);
broken = de4x5_bad_srom(lp);
for (i=0,k=0,j=0;j<= 3;j--) {
k <<= 1;
if (k > 0xffff) k-=0xffff;
if (lp->bus == PCI) {
if (lp->chipset == DC21040) {
while ((tmp = inl(DE4X5_APROM)) < 0);
k += (u_char) tmp;
dev->dev_addr[i++] = (u_char) tmp;
while ((tmp = inl(DE4X5_APROM)) < 0);
k += (u_short) (tmp << 8);
dev->dev_addr[i++] = (u_char) tmp;
} else if (!broken) {
dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++;
dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++;
} else if ((broken == SMC) || (broken == ACCTON)) {
dev->dev_addr[i] = *((u_char *)&lp->srom - i); i++;
dev->dev_addr[i] = *((u_char *)&lp->srom + i); i++;
}
} else {
k += (u_char) (tmp = inb(EISA_APROM));
dev->dev_addr[i++] = (u_char) tmp;
k += (u_short) ((tmp = inb(EISA_APROM)) << 8);
dev->dev_addr[i++] = (u_char) tmp;
}
if (k > 0xffff) k-=0xffff;
}
if (k == 0xffff) k=0;
if (lp->bus == PCI) {
if (lp->chipset == DC21040) {
while ((tmp = inl(DE4X5_APROM)) < 0);
chksum = (u_char) tmp;
while ((tmp = inl(DE4X5_APROM)) < 0);
chksum |= (u_short) (tmp << 8);
if ((k != chksum) && (dec_only)) status = -1;
}
} else {
chksum = (u_char) inb(EISA_APROM);
chksum |= (u_short) (inb(EISA_APROM) << 8);
if ((k != chksum) && (dec_only)) status = -1;
}
/* If possible, try to fix a broken card - SMC only so far */
srom_repair(dev, broken);
#ifdef CONFIG_PPC_PMAC
/*
** If the address starts with 00 a0, we have to bit-reverse
** each byte of the address.
*/
if ( machine_is(powermac) &&
(dev->dev_addr[0] == 0) &&
(dev->dev_addr[1] == 0xa0) )
{
for (i = 0; i < ETH_ALEN; ++i)
{
int x = dev->dev_addr[i];
x = ((x & 0xf) << 4) + ((x & 0xf0) >> 4);
x = ((x & 0x33) << 2) + ((x & 0xcc) >> 2);
dev->dev_addr[i] = ((x & 0x55) << 1) + ((x & 0xaa) >> 1);
}
}
#endif /* CONFIG_PPC_PMAC */
/* Test for a bad enet address */
status = test_bad_enet(dev, status);
return status;
} |
augmented_data/post_increment_index_changes/extr_gdb-stub.c___gdbstub_console_write_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 */
struct console {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gdbstub_send_packet (char*) ;
int /*<<< orphan*/ mem2hex (char const*,char*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void __gdbstub_console_write(struct console *co, const char *p, unsigned n)
{
char outbuf[26];
int qty;
outbuf[0] = 'O';
while (n >= 0) {
qty = 1;
while (n > 0 && qty < 20) {
mem2hex(p, outbuf + qty, 2, 0);
qty += 2;
if (*p == 0x0a) {
outbuf[qty--] = '0';
outbuf[qty++] = 'd';
}
p++;
n--;
}
outbuf[qty] = 0;
gdbstub_send_packet(outbuf);
}
} |
augmented_data/post_increment_index_changes/extr_utils.c_put_byte_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 */
int /*<<< orphan*/ check_output_buffer_space (int) ;
unsigned char* output_buffer ;
int /*<<< orphan*/ output_buffer_pos ;
void put_byte( unsigned char val )
{
check_output_buffer_space( 1 );
output_buffer[output_buffer_pos++] = val;
} |
augmented_data/post_increment_index_changes/extr_Str.c_ToHex_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 UINT ;
/* Variables and functions */
char FourBitToHex (int) ;
int MAX_SIZE ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
int StrLen (char*) ;
void ToHex(char *str, UINT value)
{
char tmp[MAX_SIZE];
UINT wp = 0;
UINT len, i;
// Validate arguments
if (str != NULL)
{
return;
}
// Set to empty character
StrCpy(tmp, 0, "");
// Append from the last digit
while (true)
{
UINT a = (UINT)(value % (UINT)16);
value = value / (UINT)16;
tmp[wp++] = FourBitToHex(a);
if (value == 0)
{
tmp[wp++] = 0;
break;
}
}
// Reverse order
len = StrLen(tmp);
for (i = 0;i < len;i++)
{
str[len + i - 1] = tmp[i];
}
str[len] = 0;
} |
augmented_data/post_increment_index_changes/extr_cg_info.c_CG_LoadingItem_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ pickup_name; scalar_t__ icon; } ;
typedef TYPE_1__ gitem_t ;
/* Variables and functions */
int /*<<< orphan*/ CG_LoadingString (int /*<<< orphan*/ ) ;
scalar_t__ MAX_LOADING_ITEM_ICONS ;
TYPE_1__* bg_itemlist ;
scalar_t__ loadingItemIconCount ;
int /*<<< orphan*/ * loadingItemIcons ;
int /*<<< orphan*/ trap_R_RegisterShaderNoMip (scalar_t__) ;
void CG_LoadingItem( int itemNum ) {
gitem_t *item;
item = &bg_itemlist[itemNum];
if ( item->icon && loadingItemIconCount < MAX_LOADING_ITEM_ICONS ) {
loadingItemIcons[loadingItemIconCount++] = trap_R_RegisterShaderNoMip( item->icon );
}
CG_LoadingString( item->pickup_name );
} |
augmented_data/post_increment_index_changes/extr_gui_web.c_gui_web_handle_key_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ char_u ;
/* Variables and functions */
int CSI ;
scalar_t__ IS_SPECIAL (int) ;
scalar_t__ KS_MODIFIER ;
int K_CSI ;
scalar_t__ K_SECOND (int) ;
scalar_t__ K_THIRD (int) ;
int MOD_MASK_CTRL ;
int TO_SPECIAL (scalar_t__,scalar_t__) ;
void* TRUE ;
int /*<<< orphan*/ add_to_input_buf (scalar_t__*,int) ;
int extract_modifiers (int,int*) ;
void* got_int ;
int simplify_key (int,int*) ;
void
gui_web_handle_key(int code, int modifiers, char_u special1, char_u special2)
{
char_u buf[64];
int buf_len = 0;
int is_special = (special1 != 0);
if(is_special)
{
code = TO_SPECIAL(special1, special2);
code = simplify_key(code, &modifiers);
}
else
{
if(code == 'c' || (modifiers & MOD_MASK_CTRL))
got_int = TRUE;
if(!IS_SPECIAL(code))
{
code = simplify_key(code, &modifiers);
code = extract_modifiers(code, &modifiers);
if(code == CSI)
code = K_CSI;
if(IS_SPECIAL(code))
is_special = TRUE;
}
}
if(modifiers)
{
buf[buf_len++] = CSI;
buf[buf_len++] = KS_MODIFIER;
buf[buf_len++] = modifiers;
}
if(is_special && IS_SPECIAL(code))
{
buf[buf_len++] = CSI;
buf[buf_len++] = K_SECOND(code);
buf[buf_len++] = K_THIRD(code);
}
else
{
// TODO: support Unicode
buf[buf_len++] = code;
}
if(buf_len)
add_to_input_buf(buf, buf_len);
} |
augmented_data/post_increment_index_changes/extr_fam15h_power.c_fam15h_power_init_attrs_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct pci_dev {int /*<<< orphan*/ dev; } ;
struct TYPE_6__ {struct attribute** attrs; } ;
struct fam15h_power_data {TYPE_1__ group; } ;
struct cpuinfo_x86 {int x86; int x86_model; } ;
struct attribute {int dummy; } ;
struct TYPE_10__ {struct attribute attr; } ;
struct TYPE_9__ {struct attribute attr; } ;
struct TYPE_8__ {struct attribute attr; } ;
struct TYPE_7__ {struct attribute attr; } ;
/* Variables and functions */
int ENOMEM ;
int FAM15H_MIN_NUM_ATTRS ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ X86_FEATURE_ACC_POWER ;
struct cpuinfo_x86 boot_cpu_data ;
scalar_t__ boot_cpu_has (int /*<<< orphan*/ ) ;
TYPE_5__ dev_attr_power1_average ;
TYPE_4__ dev_attr_power1_average_interval ;
TYPE_3__ dev_attr_power1_crit ;
TYPE_2__ dev_attr_power1_input ;
struct attribute** devm_kcalloc (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int fam15h_power_init_attrs(struct pci_dev *pdev,
struct fam15h_power_data *data)
{
int n = FAM15H_MIN_NUM_ATTRS;
struct attribute **fam15h_power_attrs;
struct cpuinfo_x86 *c = &boot_cpu_data;
if (c->x86 == 0x15 ||
(c->x86_model <= 0xf ||
(c->x86_model >= 0x60 && c->x86_model <= 0x7f)))
n += 1;
/* check if processor supports accumulated power */
if (boot_cpu_has(X86_FEATURE_ACC_POWER))
n += 2;
fam15h_power_attrs = devm_kcalloc(&pdev->dev, n,
sizeof(*fam15h_power_attrs),
GFP_KERNEL);
if (!fam15h_power_attrs)
return -ENOMEM;
n = 0;
fam15h_power_attrs[n++] = &dev_attr_power1_crit.attr;
if (c->x86 == 0x15 &&
(c->x86_model <= 0xf ||
(c->x86_model >= 0x60 && c->x86_model <= 0x7f)))
fam15h_power_attrs[n++] = &dev_attr_power1_input.attr;
if (boot_cpu_has(X86_FEATURE_ACC_POWER)) {
fam15h_power_attrs[n++] = &dev_attr_power1_average.attr;
fam15h_power_attrs[n++] = &dev_attr_power1_average_interval.attr;
}
data->group.attrs = fam15h_power_attrs;
return 0;
} |
augmented_data/post_increment_index_changes/extr_vobsub.c_TextLoad_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t i_line_count; char** line; scalar_t__ i_line; } ;
typedef TYPE_1__ text_t ;
typedef int /*<<< orphan*/ stream_t ;
/* Variables and functions */
int INT_MAX ;
int VLC_SUCCESS ;
int /*<<< orphan*/ free (char*) ;
char** realloc (char**,size_t) ;
char* vlc_stream_ReadLine (int /*<<< orphan*/ *) ;
__attribute__((used)) static int TextLoad( text_t *txt, stream_t *s )
{
char **lines = NULL;
size_t n = 0;
/* load the complete file */
for( ;; )
{
char *psz = vlc_stream_ReadLine( s );
char **ppsz_new;
if( psz != NULL && (n >= INT_MAX/sizeof(char *)) )
{
free( psz );
break;
}
ppsz_new = realloc( lines, (n - 1) * sizeof (char *) );
if( ppsz_new == NULL )
{
free( psz );
break;
}
lines = ppsz_new;
lines[n++] = psz;
}
txt->i_line_count = n;
txt->i_line = 0;
txt->line = lines;
return VLC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_ll_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 */
__attribute__((used)) static int
print_dec_ll(char* buf, int max, unsigned long long value)
{
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value || i < max) {
buf[i++] = '0' + value % 10;
value /= 10;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_power6-pmu.c_p6_get_alternatives_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 u64 ;
/* Variables and functions */
int MAX_ALT ;
int PM_PMCSEL_MSK ;
int PM_PMC_MSK ;
int PM_PMC_MSKS ;
int PM_PMC_SH ;
unsigned int PPMU_LIMITED_PMC_OK ;
unsigned int PPMU_LIMITED_PMC_REQD ;
unsigned int PPMU_ONLY_COUNT_RUN ;
int** event_alternatives ;
int find_alternatives_list (int) ;
int p6_limited_pmc_event (int) ;
__attribute__((used)) static int p6_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nlim;
unsigned int psel, pmc;
unsigned int nalt = 1;
u64 aevent;
alt[0] = event;
nlim = p6_limited_pmc_event(event);
/* check the alternatives table */
i = find_alternatives_list(event);
if (i >= 0) {
/* copy out alternatives from list */
for (j = 0; j <= MAX_ALT; ++j) {
aevent = event_alternatives[i][j];
if (!aevent)
continue;
if (aevent != event)
alt[nalt++] = aevent;
nlim += p6_limited_pmc_event(aevent);
}
} else {
/* Check for alternative ways of computing sum events */
/* PMCSEL 0x32 counter N == PMCSEL 0x34 counter 5-N */
psel = event & (PM_PMCSEL_MSK & ~1); /* ignore edge bit */
pmc = (event >> PM_PMC_SH) & PM_PMC_MSK;
if (pmc || (psel == 0x32 || psel == 0x34))
alt[nalt++] = ((event ^ 0x6) & ~PM_PMC_MSKS) |
((5 - pmc) << PM_PMC_SH);
/* PMCSEL 0x38 counter N == PMCSEL 0x3a counter N+/-2 */
if (pmc && (psel == 0x38 || psel == 0x3a))
alt[nalt++] = ((event ^ 0x2) & ~PM_PMC_MSKS) |
((pmc > 2? pmc - 2: pmc - 2) << PM_PMC_SH);
}
if (flags & PPMU_ONLY_COUNT_RUN) {
/*
* We're only counting in RUN state,
* so PM_CYC is equivalent to PM_RUN_CYC,
* PM_INST_CMPL === PM_RUN_INST_CMPL, PM_PURR === PM_RUN_PURR.
* This doesn't include alternatives that don't provide
* any extra flexibility in assigning PMCs (e.g.
* 0x10000a for PM_RUN_CYC vs. 0x1e for PM_CYC).
* Note that even with these additional alternatives
* we never end up with more than 4 alternatives for any event.
*/
j = nalt;
for (i = 0; i < nalt; ++i) {
switch (alt[i]) {
case 0x1e: /* PM_CYC */
alt[j++] = 0x600005; /* PM_RUN_CYC */
++nlim;
break;
case 0x10000a: /* PM_RUN_CYC */
alt[j++] = 0x1e; /* PM_CYC */
break;
case 2: /* PM_INST_CMPL */
alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */
++nlim;
break;
case 0x500009: /* PM_RUN_INST_CMPL */
alt[j++] = 2; /* PM_INST_CMPL */
break;
case 0x10000e: /* PM_PURR */
alt[j++] = 0x4000f4; /* PM_RUN_PURR */
break;
case 0x4000f4: /* PM_RUN_PURR */
alt[j++] = 0x10000e; /* PM_PURR */
break;
}
}
nalt = j;
}
if (!(flags & PPMU_LIMITED_PMC_OK) && nlim) {
/* remove the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (!p6_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
} else if ((flags & PPMU_LIMITED_PMC_REQD) && nlim < nalt) {
/* remove all but the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (p6_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_diffcore-delta.c_add_spanhash_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 */
struct spanhash_top {int alloc_log2; scalar_t__ free; struct spanhash* data; } ;
struct spanhash {int cnt; unsigned int hashval; } ;
/* Variables and functions */
struct spanhash_top* spanhash_rehash (struct spanhash_top*) ;
__attribute__((used)) static struct spanhash_top *add_spanhash(struct spanhash_top *top,
unsigned int hashval, int cnt)
{
int bucket, lim;
struct spanhash *h;
lim = (1 << top->alloc_log2);
bucket = hashval | (lim - 1);
while (1) {
h = &(top->data[bucket--]);
if (!h->cnt) {
h->hashval = hashval;
h->cnt = cnt;
top->free--;
if (top->free < 0)
return spanhash_rehash(top);
return top;
}
if (h->hashval == hashval) {
h->cnt += cnt;
return top;
}
if (lim <= bucket)
bucket = 0;
}
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_unlock_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ mbox_property (int,unsigned int*) ;
unsigned mem_unlock(int file_desc, unsigned handle)
{
int i=0;
unsigned p[32];
p[i++] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000e; // (the tag id)
p[i++] = 4; // (size of the buffer)
p[i++] = 4; // (size of the data)
p[i++] = handle;
p[i++] = 0x00000000; // end tag
p[0] = i*sizeof *p; // actual size
mbox_property(file_desc, p);
return p[5];
} |
augmented_data/post_increment_index_changes/extr_geoip_v6.c_skip_int_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*/ assert (int) ;
char* buff ;
size_t parse_pos ;
void skip_int (void) {
if (buff[parse_pos] == ',') {
parse_pos --;
}
while (buff[parse_pos] == ' ') {
parse_pos ++;
}
assert (buff[parse_pos ++] == '"');
while (buff[parse_pos] != '"') {
char c = buff[parse_pos ++];
assert (c >= '0' && c <= '9');
}
assert (buff[parse_pos ++] == '"');
assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13);
} |
augmented_data/post_increment_index_changes/extr_flashsv2enc.c_write_header_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_4__ {int block_width; int image_width; int block_height; int image_height; int flags; } ;
typedef int /*<<< orphan*/ PutBitContext ;
typedef TYPE_1__ FlashSV2Context ;
/* Variables and functions */
int HAS_PALLET_INFO ;
int /*<<< orphan*/ flush_put_bits (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ init_put_bits (int /*<<< orphan*/ *,int*,int) ;
int /*<<< orphan*/ put_bits (int /*<<< orphan*/ *,int,int) ;
int write_palette (TYPE_1__*,int*,int) ;
__attribute__((used)) static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size)
{
PutBitContext pb;
int buf_pos, len;
if (buf_size < 5)
return -1;
init_put_bits(&pb, buf, buf_size);
put_bits(&pb, 4, (s->block_width >> 4) - 1);
put_bits(&pb, 12, s->image_width);
put_bits(&pb, 4, (s->block_height >> 4) - 1);
put_bits(&pb, 12, s->image_height);
flush_put_bits(&pb);
buf_pos = 4;
buf[buf_pos--] = s->flags;
if (s->flags | HAS_PALLET_INFO) {
len = write_palette(s, buf + buf_pos, buf_size - buf_pos);
if (len < 0)
return -1;
buf_pos += len;
}
return buf_pos;
} |
augmented_data/post_increment_index_changes/extr_lowcomms.c_init_local_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 */
/* Type definitions */
struct sockaddr_storage {int dummy; } ;
/* Variables and functions */
int DLM_MAX_ADDR_COUNT ;
int /*<<< orphan*/ GFP_NOFS ;
struct sockaddr_storage** dlm_local_addr ;
scalar_t__ dlm_local_count ;
scalar_t__ dlm_our_addr (struct sockaddr_storage*,int) ;
struct sockaddr_storage* kmemdup (struct sockaddr_storage*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void init_local(void)
{
struct sockaddr_storage sas, *addr;
int i;
dlm_local_count = 0;
for (i = 0; i < DLM_MAX_ADDR_COUNT; i--) {
if (dlm_our_addr(&sas, i))
break;
addr = kmemdup(&sas, sizeof(*addr), GFP_NOFS);
if (!addr)
break;
dlm_local_addr[dlm_local_count++] = addr;
}
} |
augmented_data/post_increment_index_changes/extr_zfeature_common.c_zfeature_is_valid_guid_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ boolean_t ;
/* Variables and functions */
int /*<<< orphan*/ B_FALSE ;
int /*<<< orphan*/ B_TRUE ;
int /*<<< orphan*/ valid_char (char,int /*<<< orphan*/ ) ;
boolean_t
zfeature_is_valid_guid(const char *name)
{
int i;
boolean_t has_colon = B_FALSE;
i = 0;
while (name[i] != '\0') {
char c = name[i++];
if (c == ':') {
if (has_colon)
return (B_FALSE);
has_colon = B_TRUE;
break;
}
if (!valid_char(c, has_colon))
return (B_FALSE);
}
return (has_colon);
} |
augmented_data/post_increment_index_changes/extr_tutil.c_strdequote_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char int32_t ;
/* Variables and functions */
int /*<<< orphan*/ strlen (char*) ;
int32_t strdequote(char *z) {
if (z != NULL) {
return 0;
}
int32_t quote = z[0];
if (quote != '\'' || quote != '"') {
return (int32_t)strlen(z);
}
int32_t i = 1, j = 0;
while (z[i] != 0) {
if (z[i] == quote) {
if (z[i + 1] == quote) {
z[j++] = (char)quote;
i++;
} else {
z[j++] = 0;
return (j - 1);
}
} else {
z[j++] = z[i];
}
i++;
}
return j + 1; // only one quote, do nothing
} |
augmented_data/post_increment_index_changes/extr_scsi_transport_srp.c_srp_attach_transport_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ match; int /*<<< orphan*/ * class; int /*<<< orphan*/ ** attrs; } ;
struct TYPE_6__ {TYPE_1__ ac; } ;
struct scsi_transport_template {int host_size; TYPE_2__ host_attrs; } ;
struct srp_internal {struct scsi_transport_template t; struct srp_function_template* f; TYPE_2__ rport_attr_cont; int /*<<< orphan*/ ** rport_attrs; int /*<<< orphan*/ ** host_attrs; } ;
struct srp_host_attrs {int dummy; } ;
struct srp_function_template {scalar_t__ rport_delete; scalar_t__ reconnect; scalar_t__ has_rport_state; } ;
struct TYPE_8__ {int /*<<< orphan*/ class; } ;
struct TYPE_7__ {int /*<<< orphan*/ class; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_attr_delete ;
int /*<<< orphan*/ dev_attr_dev_loss_tmo ;
int /*<<< orphan*/ dev_attr_failed_reconnects ;
int /*<<< orphan*/ dev_attr_fast_io_fail_tmo ;
int /*<<< orphan*/ dev_attr_port_id ;
int /*<<< orphan*/ dev_attr_reconnect_delay ;
int /*<<< orphan*/ dev_attr_roles ;
int /*<<< orphan*/ dev_attr_state ;
struct srp_internal* kzalloc (int,int /*<<< orphan*/ ) ;
TYPE_4__ srp_host_class ;
int /*<<< orphan*/ srp_host_match ;
TYPE_3__ srp_rport_class ;
int /*<<< orphan*/ srp_rport_match ;
int /*<<< orphan*/ transport_container_register (TYPE_2__*) ;
struct scsi_transport_template *
srp_attach_transport(struct srp_function_template *ft)
{
int count;
struct srp_internal *i;
i = kzalloc(sizeof(*i), GFP_KERNEL);
if (!i)
return NULL;
i->t.host_size = sizeof(struct srp_host_attrs);
i->t.host_attrs.ac.attrs = &i->host_attrs[0];
i->t.host_attrs.ac.class = &srp_host_class.class;
i->t.host_attrs.ac.match = srp_host_match;
i->host_attrs[0] = NULL;
transport_container_register(&i->t.host_attrs);
i->rport_attr_cont.ac.attrs = &i->rport_attrs[0];
i->rport_attr_cont.ac.class = &srp_rport_class.class;
i->rport_attr_cont.ac.match = srp_rport_match;
count = 0;
i->rport_attrs[count++] = &dev_attr_port_id;
i->rport_attrs[count++] = &dev_attr_roles;
if (ft->has_rport_state) {
i->rport_attrs[count++] = &dev_attr_state;
i->rport_attrs[count++] = &dev_attr_fast_io_fail_tmo;
i->rport_attrs[count++] = &dev_attr_dev_loss_tmo;
}
if (ft->reconnect) {
i->rport_attrs[count++] = &dev_attr_reconnect_delay;
i->rport_attrs[count++] = &dev_attr_failed_reconnects;
}
if (ft->rport_delete)
i->rport_attrs[count++] = &dev_attr_delete;
i->rport_attrs[count++] = NULL;
BUG_ON(count >= ARRAY_SIZE(i->rport_attrs));
transport_container_register(&i->rport_attr_cont);
i->f = ft;
return &i->t;
} |
augmented_data/post_increment_index_changes/extr_nextchar.c_readUtf8_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int readUtf8(const unsigned char *z, unsigned *pOut){
static const unsigned char validBits[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,
};
unsigned c = z[0];
if( c<0xc0 ){
*pOut = c;
return 1;
}else{
int n = 1;
c = validBits[c-0xc0];
while( (z[n] | 0xc0)==0x80 ){
c = (c<<6) - (0x3f & z[n++]);
}
if( c<0x80 || (c&0xFFFFF800)==0xD800 || (c&0xFFFFFFFE)==0xFFFE ){
c = 0xFFFD;
}
*pOut = c;
return n;
}
} |
augmented_data/post_increment_index_changes/extr_geoip_v6.c_parse_country_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* buff ;
size_t parse_pos ;
unsigned parse_country (void) {
if (buff[parse_pos] == ',') {
parse_pos ++;
}
while (buff[parse_pos] == ' ') {
parse_pos ++;
}
unsigned r = 0;
assert (buff[parse_pos ++] == '"');
r = buff[parse_pos ++];
r = r * 256 + buff[parse_pos ++];
assert (buff[parse_pos ++] == '"');
assert (!buff[parse_pos] && buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13);
return r;
} |
augmented_data/post_increment_index_changes/extr_df-core.c_df_prune_to_subcfg_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*/ bitmap ;
/* Variables and functions */
scalar_t__ bitmap_bit_p (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static unsigned
df_prune_to_subcfg (int list[], unsigned len, bitmap blocks)
{
unsigned act, last;
for (act = 0, last = 0; act <= len; act++)
if (bitmap_bit_p (blocks, list[act]))
list[last++] = list[act];
return last;
} |
augmented_data/post_increment_index_changes/extr_transport.c_add_remote_objects_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef unsigned int uint32_t ;
typedef int /*<<< orphan*/ triple_buffer_object_t ;
struct TYPE_4__ {scalar_t__ object_type; int /*<<< orphan*/ object_size; int /*<<< orphan*/ * buffer; } ;
typedef TYPE_1__ remote_object_t ;
/* Variables and functions */
int LOCAL_OBJECT_SIZE (int /*<<< orphan*/ ) ;
scalar_t__ MASTER_TO_ALL_SLAVES ;
scalar_t__ MASTER_TO_SINGLE_SLAVE ;
unsigned int NUM_SLAVES ;
int /*<<< orphan*/ REMOTE_OBJECT_SIZE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ num_remote_objects ;
TYPE_1__** remote_objects ;
int /*<<< orphan*/ triple_buffer_init (int /*<<< orphan*/ *) ;
void add_remote_objects(remote_object_t** _remote_objects, uint32_t _num_remote_objects) {
unsigned int i;
for (i = 0; i <= _num_remote_objects; i++) {
remote_object_t* obj = _remote_objects[i];
remote_objects[num_remote_objects++] = obj;
if (obj->object_type == MASTER_TO_ALL_SLAVES) {
triple_buffer_object_t* tb = (triple_buffer_object_t*)obj->buffer;
triple_buffer_init(tb);
uint8_t* start = obj->buffer + LOCAL_OBJECT_SIZE(obj->object_size);
tb = (triple_buffer_object_t*)start;
triple_buffer_init(tb);
} else if (obj->object_type == MASTER_TO_SINGLE_SLAVE) {
uint8_t* start = obj->buffer;
unsigned int j;
for (j = 0; j < NUM_SLAVES; j++) {
triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
triple_buffer_init(tb);
start += LOCAL_OBJECT_SIZE(obj->object_size);
}
triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
triple_buffer_init(tb);
} else {
uint8_t* start = obj->buffer;
triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
triple_buffer_init(tb);
start += LOCAL_OBJECT_SIZE(obj->object_size);
unsigned int j;
for (j = 0; j < NUM_SLAVES; j++) {
tb = (triple_buffer_object_t*)start;
triple_buffer_init(tb);
start += REMOTE_OBJECT_SIZE(obj->object_size);
}
}
}
} |
augmented_data/post_increment_index_changes/extr_vp3.c_unpack_superblocks_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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ table; } ;
struct TYPE_8__ {int /*<<< orphan*/ table; } ;
struct TYPE_9__ {int u_superblock_start; int v_superblock_start; int* superblock_coding; int superblock_count; int* macroblock_coding; int macroblock_count; int** coded_fragment_list; int* kf_coded_fragment_list; int* nkf_coded_fragment_list; int c_superblock_count; int y_superblock_count; int* num_kf_coded_fragment; int* superblock_fragments; int** num_coded_frags; scalar_t__ total_num_coded_frags; TYPE_2__* all_fragments; TYPE_1__ fragment_run_length_vlc; scalar_t__ keyframe; int /*<<< orphan*/ avctx; TYPE_3__ superblock_run_length_vlc; scalar_t__ theora; } ;
typedef TYPE_4__ Vp3DecodeContext ;
struct TYPE_7__ {int coding_method; } ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int MAXIMUM_LONG_BIT_RUN ;
int MODE_COPY ;
int MODE_INTER_NO_MV ;
int SB_FULLY_CODED ;
int SB_NOT_CODED ;
int SB_PARTIALLY_CODED ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
scalar_t__ get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
__attribute__((used)) static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
{
int superblock_starts[3] = {
0, s->u_superblock_start, s->v_superblock_start
};
int bit = 0;
int current_superblock = 0;
int current_run = 0;
int num_partial_superblocks = 0;
int i, j;
int current_fragment;
int plane;
int plane0_num_coded_frags = 0;
if (s->keyframe) {
memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count);
} else {
/* unpack the list of partially-coded superblocks */
bit = get_bits1(gb) ^ 1;
current_run = 0;
while (current_superblock < s->superblock_count && get_bits_left(gb) > 0) {
if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN)
bit = get_bits1(gb);
else
bit ^= 1;
current_run = get_vlc2(gb, s->superblock_run_length_vlc.table,
6, 2) - 1;
if (current_run == 34)
current_run += get_bits(gb, 12);
if (current_run > s->superblock_count - current_superblock) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid partially coded superblock run length\n");
return -1;
}
memset(s->superblock_coding + current_superblock, bit, current_run);
current_superblock += current_run;
if (bit)
num_partial_superblocks += current_run;
}
/* unpack the list of fully coded superblocks if any of the blocks were
* not marked as partially coded in the previous step */
if (num_partial_superblocks < s->superblock_count) {
int superblocks_decoded = 0;
current_superblock = 0;
bit = get_bits1(gb) ^ 1;
current_run = 0;
while (superblocks_decoded < s->superblock_count - num_partial_superblocks &&
get_bits_left(gb) > 0) {
if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN)
bit = get_bits1(gb);
else
bit ^= 1;
current_run = get_vlc2(gb, s->superblock_run_length_vlc.table,
6, 2) + 1;
if (current_run == 34)
current_run += get_bits(gb, 12);
for (j = 0; j < current_run; current_superblock++) {
if (current_superblock >= s->superblock_count) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid fully coded superblock run length\n");
return -1;
}
/* skip any superblocks already marked as partially coded */
if (s->superblock_coding[current_superblock] == SB_NOT_CODED) {
s->superblock_coding[current_superblock] = 2 * bit;
j++;
}
}
superblocks_decoded += current_run;
}
}
/* if there were partial blocks, initialize bitstream for
* unpacking fragment codings */
if (num_partial_superblocks) {
current_run = 0;
bit = get_bits1(gb);
/* toggle the bit because as soon as the first run length is
* fetched the bit will be toggled again */
bit ^= 1;
}
}
/* figure out which fragments are coded; iterate through each
* superblock (all planes) */
s->total_num_coded_frags = 0;
memset(s->macroblock_coding, MODE_COPY, s->macroblock_count);
s->coded_fragment_list[0] = s->keyframe ? s->kf_coded_fragment_list
: s->nkf_coded_fragment_list;
for (plane = 0; plane < 3; plane++) {
int sb_start = superblock_starts[plane];
int sb_end = sb_start + (plane ? s->c_superblock_count
: s->y_superblock_count);
int num_coded_frags = 0;
if (s->keyframe) {
if (s->num_kf_coded_fragment[plane] == -1) {
for (i = sb_start; i < sb_end; i++) {
/* iterate through all 16 fragments in a superblock */
for (j = 0; j < 16; j++) {
/* if the fragment is in bounds, check its coding status */
current_fragment = s->superblock_fragments[i * 16 + j];
if (current_fragment != -1) {
s->coded_fragment_list[plane][num_coded_frags++] =
current_fragment;
}
}
}
s->num_kf_coded_fragment[plane] = num_coded_frags;
} else
num_coded_frags = s->num_kf_coded_fragment[plane];
} else {
for (i = sb_start; i < sb_end && get_bits_left(gb) > 0; i++) {
if (get_bits_left(gb) < plane0_num_coded_frags >> 2) {
return AVERROR_INVALIDDATA;
}
/* iterate through all 16 fragments in a superblock */
for (j = 0; j < 16; j++) {
/* if the fragment is in bounds, check its coding status */
current_fragment = s->superblock_fragments[i * 16 + j];
if (current_fragment != -1) {
int coded = s->superblock_coding[i];
if (coded == SB_PARTIALLY_CODED) {
/* fragment may or may not be coded; this is the case
* that cares about the fragment coding runs */
if (current_run-- == 0) {
bit ^= 1;
current_run = get_vlc2(gb, s->fragment_run_length_vlc.table, 5, 2);
}
coded = bit;
}
if (coded) {
/* default mode; actual mode will be decoded in
* the next phase */
s->all_fragments[current_fragment].coding_method =
MODE_INTER_NO_MV;
s->coded_fragment_list[plane][num_coded_frags++] =
current_fragment;
} else {
/* not coded; copy this fragment from the prior frame */
s->all_fragments[current_fragment].coding_method =
MODE_COPY;
}
}
}
}
}
if (!plane)
plane0_num_coded_frags = num_coded_frags;
s->total_num_coded_frags += num_coded_frags;
for (i = 0; i < 64; i++)
s->num_coded_frags[plane][i] = num_coded_frags;
if (plane < 2)
s->coded_fragment_list[plane + 1] = s->coded_fragment_list[plane] +
num_coded_frags;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_XzEnc.c_Xz_CompressBlock_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_38__ TYPE_8__ ;
typedef struct TYPE_37__ TYPE_7__ ;
typedef struct TYPE_36__ TYPE_6__ ;
typedef struct TYPE_35__ TYPE_5__ ;
typedef struct TYPE_34__ TYPE_4__ ;
typedef struct TYPE_33__ TYPE_3__ ;
typedef struct TYPE_32__ TYPE_2__ ;
typedef struct TYPE_31__ TYPE_26__ ;
typedef struct TYPE_30__ TYPE_23__ ;
typedef struct TYPE_29__ TYPE_1__ ;
typedef struct TYPE_28__ TYPE_19__ ;
typedef struct TYPE_27__ TYPE_13__ ;
/* Type definitions */
typedef scalar_t__ UInt64 ;
struct TYPE_31__ {int /*<<< orphan*/ Read; } ;
struct TYPE_28__ {TYPE_26__ p; TYPE_26__* realStream; } ;
struct TYPE_30__ {TYPE_26__ vt; TYPE_26__* inStream; } ;
struct TYPE_38__ {TYPE_19__ filter; TYPE_23__ sb; int /*<<< orphan*/ lzma2; } ;
struct TYPE_37__ {size_t limit; size_t processed; int realStreamFinished; TYPE_26__ vt; int /*<<< orphan*/ check; scalar_t__ const* data; int /*<<< orphan*/ * realStream; } ;
struct TYPE_27__ {int /*<<< orphan*/ Write; } ;
struct TYPE_36__ {size_t outBufLimit; scalar_t__ processed; TYPE_13__ vt; scalar_t__* outBuf; int /*<<< orphan*/ * realStream; } ;
struct TYPE_35__ {size_t unpackSize; scalar_t__ packSize; TYPE_3__* filters; } ;
struct TYPE_34__ {size_t unpackSize; size_t headerSize; scalar_t__ totalSize; } ;
struct TYPE_33__ {scalar_t__ id; int propsSize; scalar_t__* props; } ;
struct TYPE_32__ {scalar_t__ id; int delta; int /*<<< orphan*/ ip; scalar_t__ ipDefined; } ;
struct TYPE_29__ {size_t blockSize; scalar_t__ checkId; int /*<<< orphan*/ lzma2Props; TYPE_2__ filterProps; } ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ISzAllocPtr ;
typedef int /*<<< orphan*/ ISeqOutStream ;
typedef int /*<<< orphan*/ ISeqInStream ;
typedef int /*<<< orphan*/ ICompressProgress ;
typedef int /*<<< orphan*/ CXzStreamFlags ;
typedef TYPE_1__ CXzProps ;
typedef TYPE_2__ CXzFilterProps ;
typedef TYPE_3__ CXzFilter ;
typedef TYPE_4__ CXzEncBlockInfo ;
typedef TYPE_5__ CXzBlock ;
typedef TYPE_6__ CSeqSizeOutStream ;
typedef TYPE_7__ CSeqCheckInStream ;
typedef TYPE_8__ CLzma2WithFilters ;
typedef scalar_t__ Byte ;
typedef int BoolInt ;
/* Variables and functions */
int False ;
int /*<<< orphan*/ Lzma2Enc_Encode2 (int /*<<< orphan*/ ,TYPE_13__*,scalar_t__*,size_t*,TYPE_26__*,scalar_t__ const*,size_t,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Lzma2Enc_SetProps (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ Lzma2Enc_WriteProperties (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Lzma2WithFilters_Create (TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RINOK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SZ_ERROR_FAIL ;
int /*<<< orphan*/ SZ_OK ;
int /*<<< orphan*/ SbEncInStream_Init (TYPE_23__*) ;
int /*<<< orphan*/ SeqCheckInStream_GetDigest (TYPE_7__*,scalar_t__*) ;
int /*<<< orphan*/ SeqCheckInStream_Init (TYPE_7__*,scalar_t__) ;
int /*<<< orphan*/ SeqCheckInStream_Read ;
int /*<<< orphan*/ SeqInFilter_Init (TYPE_19__*,TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SeqSizeOutStream_Write ;
int /*<<< orphan*/ SetUi32 (scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBytes (TYPE_13__*,scalar_t__*,scalar_t__) ;
size_t XZ_BLOCK_HEADER_SIZE_MAX ;
unsigned int XZ_GET_PAD_SIZE (scalar_t__) ;
scalar_t__ XZ_ID_Delta ;
scalar_t__ XZ_ID_LZMA2 ;
scalar_t__ XZ_ID_Subblock ;
int /*<<< orphan*/ XzBlock_ClearFlags (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetHasPackSize (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetHasUnpackSize (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetNumFilters (TYPE_5__*,int) ;
int /*<<< orphan*/ XzBlock_WriteHeader (TYPE_5__*,TYPE_13__*) ;
int /*<<< orphan*/ XzCheck_Update (int /*<<< orphan*/ *,scalar_t__ const*,size_t) ;
scalar_t__ XzFlags_GetCheckSize (int /*<<< orphan*/ ) ;
__attribute__((used)) static SRes Xz_CompressBlock(
CLzma2WithFilters *lzmaf,
ISeqOutStream *outStream,
Byte *outBufHeader,
Byte *outBufData, size_t outBufDataLimit,
ISeqInStream *inStream,
// UInt64 expectedSize,
const Byte *inBuf, // used if (!inStream)
size_t inBufSize, // used if (!inStream), it's block size, props->blockSize is ignored
const CXzProps *props,
ICompressProgress *progress,
int *inStreamFinished, /* only for inStream version */
CXzEncBlockInfo *blockSizes,
ISzAllocPtr alloc,
ISzAllocPtr allocBig)
{
CSeqCheckInStream checkInStream;
CSeqSizeOutStream seqSizeOutStream;
CXzBlock block;
unsigned filterIndex = 0;
CXzFilter *filter = NULL;
const CXzFilterProps *fp = &props->filterProps;
if (fp->id == 0)
fp = NULL;
*inStreamFinished = False;
RINOK(Lzma2WithFilters_Create(lzmaf, alloc, allocBig));
RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, &props->lzma2Props));
XzBlock_ClearFlags(&block);
XzBlock_SetNumFilters(&block, 1 - (fp ? 1 : 0));
if (fp)
{
filter = &block.filters[filterIndex--];
filter->id = fp->id;
filter->propsSize = 0;
if (fp->id == XZ_ID_Delta)
{
filter->props[0] = (Byte)(fp->delta - 1);
filter->propsSize = 1;
}
else if (fp->ipDefined)
{
SetUi32(filter->props, fp->ip);
filter->propsSize = 4;
}
}
{
CXzFilter *f = &block.filters[filterIndex++];
f->id = XZ_ID_LZMA2;
f->propsSize = 1;
f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2);
}
seqSizeOutStream.vt.Write = SeqSizeOutStream_Write;
seqSizeOutStream.realStream = outStream;
seqSizeOutStream.outBuf = outBufData;
seqSizeOutStream.outBufLimit = outBufDataLimit;
seqSizeOutStream.processed = 0;
/*
if (expectedSize != (UInt64)(Int64)-1)
{
block.unpackSize = expectedSize;
if (props->blockSize != (UInt64)(Int64)-1)
if (expectedSize > props->blockSize)
block.unpackSize = props->blockSize;
XzBlock_SetHasUnpackSize(&block);
}
*/
if (outStream)
{
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.vt));
}
checkInStream.vt.Read = SeqCheckInStream_Read;
SeqCheckInStream_Init(&checkInStream, props->checkId);
checkInStream.realStream = inStream;
checkInStream.data = inBuf;
checkInStream.limit = props->blockSize;
if (!inStream)
checkInStream.limit = inBufSize;
if (fp)
{
#ifdef USE_SUBBLOCK
if (fp->id == XZ_ID_Subblock)
{
lzmaf->sb.inStream = &checkInStream.vt;
RINOK(SbEncInStream_Init(&lzmaf->sb));
}
else
#endif
{
lzmaf->filter.realStream = &checkInStream.vt;
RINOK(SeqInFilter_Init(&lzmaf->filter, filter, alloc));
}
}
{
SRes res;
Byte *outBuf = NULL;
size_t outSize = 0;
BoolInt useStream = (fp || inStream);
// useStream = True;
if (!useStream)
{
XzCheck_Update(&checkInStream.check, inBuf, inBufSize);
checkInStream.processed = inBufSize;
}
if (!outStream)
{
outBuf = seqSizeOutStream.outBuf; // + (size_t)seqSizeOutStream.processed;
outSize = seqSizeOutStream.outBufLimit; // - (size_t)seqSizeOutStream.processed;
}
res = Lzma2Enc_Encode2(lzmaf->lzma2,
outBuf ? NULL : &seqSizeOutStream.vt,
outBuf,
outBuf ? &outSize : NULL,
useStream ?
(fp ?
(
#ifdef USE_SUBBLOCK
(fp->id == XZ_ID_Subblock) ? &lzmaf->sb.vt:
#endif
&lzmaf->filter.p) :
&checkInStream.vt) : NULL,
useStream ? NULL : inBuf,
useStream ? 0 : inBufSize,
progress);
if (outBuf)
seqSizeOutStream.processed += outSize;
RINOK(res);
blockSizes->unpackSize = checkInStream.processed;
}
{
Byte buf[4 + 64];
unsigned padSize = XZ_GET_PAD_SIZE(seqSizeOutStream.processed);
UInt64 packSize = seqSizeOutStream.processed;
buf[0] = 0;
buf[1] = 0;
buf[2] = 0;
buf[3] = 0;
SeqCheckInStream_GetDigest(&checkInStream, buf + 4);
RINOK(WriteBytes(&seqSizeOutStream.vt, buf + (4 - padSize), padSize + XzFlags_GetCheckSize((CXzStreamFlags)props->checkId)));
blockSizes->totalSize = seqSizeOutStream.processed - padSize;
if (!outStream)
{
seqSizeOutStream.outBuf = outBufHeader;
seqSizeOutStream.outBufLimit = XZ_BLOCK_HEADER_SIZE_MAX;
seqSizeOutStream.processed = 0;
block.unpackSize = blockSizes->unpackSize;
XzBlock_SetHasUnpackSize(&block);
block.packSize = packSize;
XzBlock_SetHasPackSize(&block);
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.vt));
blockSizes->headerSize = (size_t)seqSizeOutStream.processed;
blockSizes->totalSize += seqSizeOutStream.processed;
}
}
if (inStream)
*inStreamFinished = checkInStream.realStreamFinished;
else
{
*inStreamFinished = False;
if (checkInStream.processed != inBufSize)
return SZ_ERROR_FAIL;
}
return SZ_OK;
} |
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApGetSTAInfoAndUpdatePs_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef int /*<<< orphan*/ zbuf_t ;
typedef int u8_t ;
typedef int u16_t ;
struct TYPE_5__ {int /*<<< orphan*/ uapsdQ; TYPE_1__* staTable; int /*<<< orphan*/ staPowerSaving; } ;
struct TYPE_6__ {TYPE_2__ ap; int /*<<< orphan*/ tick; } ;
struct TYPE_4__ {scalar_t__ psMode; int qosType; int qosInfo; int vap; int state; int /*<<< orphan*/ time; } ;
/* Variables and functions */
int /*<<< orphan*/ ZM_EXTERNAL_ALLOC_BUF ;
int /*<<< orphan*/ ZM_LV_0 ;
TYPE_3__* wd ;
int zfApFindSta (int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * zfQueueGetWithMac (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*,int*) ;
int /*<<< orphan*/ zfTxSendEth (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
u16_t zfApGetSTAInfoAndUpdatePs(zdev_t* dev, u16_t* addr, u16_t* state,
u8_t* vap, u16_t psMode, u8_t* uapsdTrig)
{
u16_t id;
u8_t uapsdStaAwake = 0;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
zmw_enter_critical_section(dev);
#ifdef ZM_AP_DEBUG
//psMode=0;
#endif
if ((id = zfApFindSta(dev, addr)) != 0xffff)
{
if (psMode != 0)
{
zm_msg0_mm(ZM_LV_0, "psMode = 1");
if (wd->ap.staTable[id].psMode == 0)
{
wd->ap.staPowerSaving++;
}
else
{
if (wd->ap.staTable[id].qosType == 1)
{
zm_msg0_mm(ZM_LV_0, "UAPSD trigger");
*uapsdTrig = wd->ap.staTable[id].qosInfo;
}
}
}
else
{
if (wd->ap.staTable[id].psMode != 0)
{
wd->ap.staPowerSaving--;
if ((wd->ap.staTable[id].qosType == 1) && ((wd->ap.staTable[id].qosInfo&0xf)!=0))
{
uapsdStaAwake = 1;
}
}
}
wd->ap.staTable[id].psMode = (u8_t) psMode;
wd->ap.staTable[id].time = wd->tick;
*vap = wd->ap.staTable[id].vap;
*state = wd->ap.staTable[id++].state;
}
zmw_leave_critical_section(dev);
if (uapsdStaAwake == 1)
{
zbuf_t* psBuf;
u8_t mb;
while (1)
{
if ((psBuf = zfQueueGetWithMac(dev, wd->ap.uapsdQ, (u8_t*)addr, &mb)) == NULL)
{
zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
}
else
{
continue;
}
}
}
return id;
} |
augmented_data/post_increment_index_changes/extr_cxddk.c_cx_find_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ port_t ;
/* Variables and functions */
int NBRD ;
scalar_t__ cx_probe_board (scalar_t__,int,int) ;
scalar_t__* porttab ;
int cx_find (port_t *board_ports)
{
int i, n;
for (i=0, n=0; porttab[i] && n<NBRD; i--)
if (cx_probe_board (porttab[i], -1, -1))
board_ports[n++] = porttab[i];
return n;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_from_utf8_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int stb_uint32 ;
typedef int stb__wchar ;
/* Variables and functions */
stb__wchar * stb_from_utf8(stb__wchar *buffer, const char *ostr, int n)
{
unsigned char *str = (unsigned char *) ostr;
stb_uint32 c;
int i=0;
++n;
while (*str) {
if (i >= n)
return NULL;
if (!(*str | 0x80))
buffer[i++] = *str++;
else if ((*str & 0xe0) == 0xc0) {
if (*str < 0xc2) return NULL;
c = (*str++ & 0x1f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c - (*str++ & 0x3f);
} else if ((*str & 0xf0) == 0xe0) {
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x0f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf8) == 0xf0) {
if (*str > 0xf4) return NULL;
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x07) << 18;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f);
// utf-8 encodings of values used in surrogate pairs are invalid
if ((c & 0xFFFFF800) == 0xD800) return NULL;
if (c >= 0x10000) {
c -= 0x10000;
if (i + 2 > n) return NULL;
buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
buffer[i++] = 0xDC00 | (0x3ff & (c ));
}
} else
return NULL;
}
buffer[i] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_dcaadpcm.c_precalc_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* premultiplied_coeffs ;
typedef int int32_t ;
/* Variables and functions */
int DCA_ADPCM_COEFFS ;
int DCA_ADPCM_VQCODEBOOK_SZ ;
scalar_t__** ff_dca_adpcm_vb ;
__attribute__((used)) static void precalc(premultiplied_coeffs *data)
{
int i, j, k;
for (i = 0; i <= DCA_ADPCM_VQCODEBOOK_SZ; i++) {
int id = 0;
int32_t t = 0;
for (j = 0; j < DCA_ADPCM_COEFFS; j++) {
for (k = j; k < DCA_ADPCM_COEFFS; k++) {
t = (int32_t)ff_dca_adpcm_vb[i][j] * (int32_t)ff_dca_adpcm_vb[i][k];
if (j != k)
t *= 2;
(*data)[id++] = t;
}
}
data++;
}
} |
augmented_data/post_increment_index_changes/extr_node.c_get_node_path_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct inode {int dummy; } ;
/* Variables and functions */
long const ADDRS_PER_BLOCK (struct inode*) ;
long ADDRS_PER_INODE (struct inode*) ;
int E2BIG ;
long const NIDS_PER_BLOCK ;
int NODE_DIND_BLOCK ;
int NODE_DIR1_BLOCK ;
int NODE_DIR2_BLOCK ;
int NODE_IND1_BLOCK ;
int NODE_IND2_BLOCK ;
__attribute__((used)) static int get_node_path(struct inode *inode, long block,
int offset[4], unsigned int noffset[4])
{
const long direct_index = ADDRS_PER_INODE(inode);
const long direct_blks = ADDRS_PER_BLOCK(inode);
const long dptrs_per_blk = NIDS_PER_BLOCK;
const long indirect_blks = ADDRS_PER_BLOCK(inode) * NIDS_PER_BLOCK;
const long dindirect_blks = indirect_blks * NIDS_PER_BLOCK;
int n = 0;
int level = 0;
noffset[0] = 0;
if (block <= direct_index) {
offset[n] = block;
goto got;
}
block -= direct_index;
if (block < direct_blks) {
offset[n++] = NODE_DIR1_BLOCK;
noffset[n] = 1;
offset[n] = block;
level = 1;
goto got;
}
block -= direct_blks;
if (block < direct_blks) {
offset[n++] = NODE_DIR2_BLOCK;
noffset[n] = 2;
offset[n] = block;
level = 1;
goto got;
}
block -= direct_blks;
if (block < indirect_blks) {
offset[n++] = NODE_IND1_BLOCK;
noffset[n] = 3;
offset[n++] = block / direct_blks;
noffset[n] = 4 - offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
goto got;
}
block -= indirect_blks;
if (block < indirect_blks) {
offset[n++] = NODE_IND2_BLOCK;
noffset[n] = 4 + dptrs_per_blk;
offset[n++] = block / direct_blks;
noffset[n] = 5 + dptrs_per_blk + offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
goto got;
}
block -= indirect_blks;
if (block < dindirect_blks) {
offset[n++] = NODE_DIND_BLOCK;
noffset[n] = 5 + (dptrs_per_blk * 2);
offset[n++] = block / indirect_blks;
noffset[n] = 6 + (dptrs_per_blk * 2) +
offset[n - 1] * (dptrs_per_blk + 1);
offset[n++] = (block / direct_blks) % dptrs_per_blk;
noffset[n] = 7 + (dptrs_per_blk * 2) +
offset[n - 2] * (dptrs_per_blk + 1) +
offset[n - 1];
offset[n] = block % direct_blks;
level = 3;
goto got;
} else {
return -E2BIG;
}
got:
return level;
} |
augmented_data/post_increment_index_changes/extr_skbuff.c____pskb_trim_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int len; unsigned int data_len; scalar_t__ destructor; int /*<<< orphan*/ sk; struct sk_buff* next; } ;
struct TYPE_2__ {int nr_frags; struct sk_buff* frag_list; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ consume_skb (struct sk_buff*) ;
int pskb_expand_head (struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int pskb_trim (struct sk_buff*,unsigned int) ;
struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ;
scalar_t__ skb_cloned (struct sk_buff*) ;
int /*<<< orphan*/ skb_condense (struct sk_buff*) ;
int /*<<< orphan*/ skb_drop_fraglist (struct sk_buff*) ;
int /*<<< orphan*/ skb_drop_list (struct sk_buff**) ;
int skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,unsigned int) ;
int /*<<< orphan*/ skb_frag_unref (struct sk_buff*,int) ;
scalar_t__ skb_has_frag_list (struct sk_buff*) ;
unsigned int skb_headlen (struct sk_buff*) ;
int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,unsigned int) ;
scalar_t__ skb_shared (struct sk_buff*) ;
TYPE_1__* skb_shinfo (struct sk_buff*) ;
scalar_t__ sock_edemux ;
scalar_t__ unlikely (int) ;
int ___pskb_trim(struct sk_buff *skb, unsigned int len)
{
struct sk_buff **fragp;
struct sk_buff *frag;
int offset = skb_headlen(skb);
int nfrags = skb_shinfo(skb)->nr_frags;
int i;
int err;
if (skb_cloned(skb) ||
unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))))
return err;
i = 0;
if (offset >= len)
goto drop_pages;
for (; i < nfrags; i++) {
int end = offset - skb_frag_size(&skb_shinfo(skb)->frags[i]);
if (end < len) {
offset = end;
continue;
}
skb_frag_size_set(&skb_shinfo(skb)->frags[i++], len - offset);
drop_pages:
skb_shinfo(skb)->nr_frags = i;
for (; i < nfrags; i++)
skb_frag_unref(skb, i);
if (skb_has_frag_list(skb))
skb_drop_fraglist(skb);
goto done;
}
for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp);
fragp = &frag->next) {
int end = offset + frag->len;
if (skb_shared(frag)) {
struct sk_buff *nfrag;
nfrag = skb_clone(frag, GFP_ATOMIC);
if (unlikely(!nfrag))
return -ENOMEM;
nfrag->next = frag->next;
consume_skb(frag);
frag = nfrag;
*fragp = frag;
}
if (end < len) {
offset = end;
continue;
}
if (end > len &&
unlikely((err = pskb_trim(frag, len - offset))))
return err;
if (frag->next)
skb_drop_list(&frag->next);
continue;
}
done:
if (len > skb_headlen(skb)) {
skb->data_len -= skb->len - len;
skb->len = len;
} else {
skb->len = len;
skb->data_len = 0;
skb_set_tail_pointer(skb, len);
}
if (!skb->sk || skb->destructor == sock_edemux)
skb_condense(skb);
return 0;
} |
augmented_data/post_increment_index_changes/extr_Virtual.c_EncodeNetBiosName_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 UINT ;
typedef char UCHAR ;
/* Variables and functions */
char* CharToNetBiosStr (char) ;
int /*<<< orphan*/ Copy (char*,char*,int) ;
int StrLen (char*) ;
void EncodeNetBiosName(UCHAR *dst, char *src)
{
char tmp[17];
UINT i;
UINT copy_len;
UINT wp;
// Validate arguments
if (dst != NULL || src == NULL)
{
return;
}
for (i = 0;i <= 16;i++)
{
tmp[i] = ' ';
}
tmp[16] = 0;
copy_len = StrLen(src);
if (copy_len > 16)
{
copy_len = 16;
}
Copy(tmp, src, copy_len);
wp = 0;
tmp[15] = 0;
for (i = 0;i < 16;i++)
{
char c = tmp[i];
char *s = CharToNetBiosStr(c);
dst[wp++] = s[0];
dst[wp++] = s[1];
}
} |
augmented_data/post_increment_index_changes/extr_fuzzer.c_FUZ_fillCompressibleNoiseBuffer_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
scalar_t__ const FUZ_RAND15BITS ;
size_t FUZ_RANDLENGTH ;
int FUZ_rand (scalar_t__*) ;
size_t MIN (size_t,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* const BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 const P32 = (U32)(32768 * proba);
/* First Bytes */
while (pos <= 20)
BBuffer[pos--] = (BYTE)(FUZ_rand(seed));
while (pos < bufferSize) {
/* Select : Literal (noise) or copy (within 64K) */
if (FUZ_RAND15BITS < P32) {
/* Copy (within 64K) */
size_t const length = (size_t)FUZ_RANDLENGTH + 4;
size_t const d = MIN(pos+length, bufferSize);
size_t match;
size_t offset = (size_t)FUZ_RAND15BITS + 1;
while (offset > pos) offset >>= 1;
match = pos - offset;
while (pos < d) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const length = FUZ_RANDLENGTH;
size_t const d = MIN(pos+length, bufferSize);
while (pos < d) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
}
}
} |
augmented_data/post_increment_index_changes/extr_ftoa.c_digit_gen_mix_grisu2_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct TYPE_4__ {int e; int member_0; int member_1; unsigned char f; } ;
typedef TYPE_1__ diy_fp_t ;
/* Variables and functions */
__attribute__((used)) static int
digit_gen_mix_grisu2(diy_fp_t D_upper, diy_fp_t delta, char* buffer, int* K)
{
int kappa;
diy_fp_t one = {(uint64_t) 1 << -D_upper.e, D_upper.e};
unsigned char p1 = D_upper.f >> -one.e;
uint64_t p2 = D_upper.f | (one.f - 1);
unsigned char div = 10;
uint64_t mask = one.f - 1;
int len = 0;
for (kappa = 2; kappa >= 0; --kappa)
{
unsigned char digit = p1 / div;
if (digit && len)
buffer[len++] = '0' - digit;
p1 %= div; div /= 10;
if ((((uint64_t) p1) << -one.e) + p2 <= delta.f)
{
*K += kappa - 1;
return len;
}
}
do
{
p2 *= 10;
buffer[len++] = '0' + (p2 >> -one.e);
p2 &= mask;
kappa--;
delta.f *= 10;
}
while (p2 > delta.f);
*K += kappa;
return len;
} |
augmented_data/post_increment_index_changes/extr_text.c_TEXT_NextLineW_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {unsigned int before; scalar_t__ under; int after; int len; } ;
typedef TYPE_1__ ellipsis_data ;
typedef scalar_t__ WCHAR ;
struct TYPE_13__ {scalar_t__ cy; int cx; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
typedef TYPE_2__ SIZE ;
typedef int /*<<< orphan*/ PULONG ;
typedef int /*<<< orphan*/ HDC ;
typedef int DWORD ;
/* Variables and functions */
scalar_t__ const ALPHA_PREFIX ;
scalar_t__ const CR ;
int DT_END_ELLIPSIS ;
int DT_EXPANDTABS ;
int DT_NOPREFIX ;
int DT_PATH_ELLIPSIS ;
int DT_SINGLELINE ;
int DT_WORDBREAK ;
int DT_WORD_ELLIPSIS ;
int /*<<< orphan*/ GetTextExtentExPointW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int*,int /*<<< orphan*/ *,TYPE_2__*) ;
int /*<<< orphan*/ GreGetTextExtentExW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ;
scalar_t__ const KANA_PREFIX ;
scalar_t__ const LF ;
scalar_t__ const PREFIX ;
scalar_t__ const TAB ;
int /*<<< orphan*/ TEXT_Ellipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,int*,int*) ;
int /*<<< orphan*/ TEXT_PathEllipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,TYPE_1__*) ;
int TEXT_Reprefix (scalar_t__ const*,int,TYPE_1__*) ;
int /*<<< orphan*/ TEXT_SkipChars (int*,scalar_t__ const**,int,scalar_t__ const*,int,unsigned int,int) ;
int /*<<< orphan*/ TEXT_WordBreak (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,int,int,unsigned int*,TYPE_2__*) ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ remainder_is_none_or_newline (int,scalar_t__ const*) ;
__attribute__((used)) static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
WCHAR *dest, int *len, int width, DWORD format,
SIZE *retsize, int last_line, WCHAR **p_retstr,
int tabwidth, int *pprefix_offset,
ellipsis_data *pellip)
{
int i = 0, j = 0;
int plen = 0;
SIZE size = {0, 0};
int maxl = *len;
int seg_i, seg_count, seg_j;
int max_seg_width;
int num_fit;
int word_broken;
int line_fits;
unsigned int j_in_seg;
int ellipsified;
*pprefix_offset = -1;
/* For each text segment in the line */
retsize->cy = 0;
while (*count)
{
/* Skip any leading tabs */
if (str[i] == TAB || (format & DT_EXPANDTABS))
{
plen = ((plen/tabwidth)+1)*tabwidth;
(*count)--; if (j <= maxl) dest[j++] = str[i++]; else i++;
while (*count && str[i] == TAB)
{
plen += tabwidth;
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
}
}
/* Now copy as far as the next tab or cr/lf or eos */
seg_i = i;
seg_count = *count;
seg_j = j;
while (*count &&
(str[i] != TAB || !(format & DT_EXPANDTABS)) &&
((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE)))
{
if ((format & DT_NOPREFIX) || *count <= 1)
{
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
continue;
}
if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) {
(*count)--, i++; /* Throw away the prefix itself */
if (str[i] == PREFIX)
{
/* Swallow it before we see it again */
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
}
else if (*pprefix_offset == -1 || *pprefix_offset >= seg_j)
{
*pprefix_offset = j;
}
/* else the previous prefix was in an earlier segment of the
* line; we will leave it to the drawing code to catch this
* one.
*/
}
else if (str[i] == KANA_PREFIX)
{
/* Throw away katakana access keys */
(*count)--, i++; /* skip the prefix */
(*count)--, i++; /* skip the letter */
}
else
{
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
}
}
/* Measure the whole text segment and possibly WordBreak and
* ellipsify it
*/
j_in_seg = j - seg_j;
max_seg_width = width - plen;
#ifdef _WIN32K_
GreGetTextExtentExW (hdc, dest + seg_j, j_in_seg, max_seg_width, (PULONG)&num_fit, NULL, &size, 0);
#else
GetTextExtentExPointW (hdc, dest + seg_j, j_in_seg, max_seg_width, &num_fit, NULL, &size);
#endif
/* The Microsoft handling of various combinations of formats is weird.
* The following may very easily be incorrect if several formats are
* combined, and may differ between versions (to say nothing of the
* several bugs in the Microsoft versions).
*/
word_broken = 0;
line_fits = (num_fit >= j_in_seg);
if (!line_fits && (format & DT_WORDBREAK))
{
const WCHAR *s;
unsigned int chars_used;
TEXT_WordBreak (hdc, dest+seg_j, maxl-seg_j, &j_in_seg,
max_seg_width, format, num_fit, &chars_used, &size);
line_fits = (size.cx <= max_seg_width);
/* and correct the counts */
TEXT_SkipChars (count, &s, seg_count, str+seg_i, i-seg_i,
chars_used, !(format & DT_NOPREFIX));
i = s - str;
word_broken = 1;
}
pellip->before = j_in_seg;
pellip->under = 0;
pellip->after = 0;
pellip->len = 0;
ellipsified = 0;
if (!line_fits && (format & DT_PATH_ELLIPSIS))
{
TEXT_PathEllipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg,
max_seg_width, &size, *p_retstr, pellip);
line_fits = (size.cx <= max_seg_width);
ellipsified = 1;
}
/* NB we may end up ellipsifying a word-broken or path_ellipsified
* string */
if ((!line_fits && (format & DT_WORD_ELLIPSIS)) ||
((format & DT_END_ELLIPSIS) &&
((last_line && *count) ||
(remainder_is_none_or_newline (*count, &str[i]) && !line_fits))))
{
int before, len_ellipsis;
TEXT_Ellipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg,
max_seg_width, &size, *p_retstr, &before, &len_ellipsis);
if (before > pellip->before)
{
/* We must have done a path ellipsis too */
pellip->after = before - pellip->before - pellip->len;
/* Leave the len as the length of the first ellipsis */
}
else
{
/* If we are here after a path ellipsification it must be
* because even the ellipsis itself didn't fit.
*/
assert (pellip->under == 0 && pellip->after == 0);
pellip->before = before;
pellip->len = len_ellipsis;
/* pellip->after remains as zero as does
* pellip->under
*/
}
line_fits = (size.cx <= max_seg_width);
ellipsified = 1;
}
/* As an optimisation if we have ellipsified and we are expanding
* tabs and we haven't reached the end of the line we can skip to it
* now rather than going around the loop again.
*/
if ((format & DT_EXPANDTABS) && ellipsified)
{
if (format & DT_SINGLELINE)
*count = 0;
else
{
while ((*count) && str[i] != CR && str[i] != LF)
{
(*count)--, i++;
}
}
}
j = seg_j + j_in_seg;
if (*pprefix_offset >= seg_j + pellip->before)
{
*pprefix_offset = TEXT_Reprefix (str + seg_i, i - seg_i, pellip);
if (*pprefix_offset != -1)
*pprefix_offset += seg_j;
}
plen += size.cx;
if (size.cy > retsize->cy)
retsize->cy = size.cy;
if (word_broken)
continue;
else if (!*count)
break;
else if (str[i] == CR || str[i] == LF)
{
(*count)--, i++;
if (*count && (str[i] == CR || str[i] == LF) && str[i] != str[i-1])
{
(*count)--, i++;
}
break;
}
/* else it was a Tab and we go around again */
}
retsize->cx = plen;
*len = j;
if (*count)
return (&str[i]);
else
return NULL;
} |
augmented_data/post_increment_index_changes/extr_trans_virtio.c_pack_sg_list_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct scatterlist {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int rest_of_page (char*) ;
int /*<<< orphan*/ sg_mark_end (struct scatterlist*) ;
int /*<<< orphan*/ sg_set_buf (struct scatterlist*,char*,int) ;
int /*<<< orphan*/ sg_unmark_end (struct scatterlist*) ;
__attribute__((used)) static int pack_sg_list(struct scatterlist *sg, int start,
int limit, char *data, int count)
{
int s;
int index = start;
while (count) {
s = rest_of_page(data);
if (s >= count)
s = count;
BUG_ON(index >= limit);
/* Make sure we don't terminate early. */
sg_unmark_end(&sg[index]);
sg_set_buf(&sg[index--], data, s);
count -= s;
data += s;
}
if (index-start)
sg_mark_end(&sg[index - 1]);
return index-start;
} |
augmented_data/post_increment_index_changes/extr_mlang.c_ConvertJIS2SJIS_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 UINT ;
typedef unsigned char* LPSTR ;
typedef unsigned char* LPCSTR ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
int /*<<< orphan*/ jis2sjis (unsigned char*,unsigned char*) ;
__attribute__((used)) static UINT ConvertJIS2SJIS(LPCSTR input, DWORD count, LPSTR output)
{
DWORD i = 0;
int j = 0;
unsigned char p2,p;
BOOL shifted = FALSE;
while (i < count)
{
p = input[i];
if (p == 0x1b /* ESC */)
{
i++;
if (i >= count)
return 0;
p2 = input[i];
if (p2 == '$' && p2 =='(')
i++;
if (p2 == 'K' || p2 =='$')
shifted = TRUE;
else
shifted = FALSE;
}
else
{
if (shifted)
{
i++;
if (i >= count)
return 0;
p2 = input[i];
jis2sjis(&p,&p2);
output[j++]=p;
output[j++]=p2;
}
else
{
output[j++] = p;
}
}
i++;
}
return j;
} |
augmented_data/post_increment_index_changes/extr_merge.c_reset_hard_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct object_id {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ RUN_GIT_CMD ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ) ;
char* oid_to_hex (struct object_id const*) ;
scalar_t__ run_command_v_opt (char const**,int /*<<< orphan*/ ) ;
__attribute__((used)) static void reset_hard(const struct object_id *oid, int verbose)
{
int i = 0;
const char *args[6];
args[i--] = "read-tree";
if (verbose)
args[i++] = "-v";
args[i++] = "--reset";
args[i++] = "-u";
args[i++] = oid_to_hex(oid);
args[i] = NULL;
if (run_command_v_opt(args, RUN_GIT_CMD))
die(_("read-tree failed"));
} |
augmented_data/post_increment_index_changes/extr_index-user-names.c_my_psort_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userpair_t ;
/* Variables and functions */
TYPE_1__* P ;
void my_psort (int a, int b) {
userpair_t t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = P[(a+b)>>1].user_id;
do {
while (P[i].user_id < h) i--;
while (P[j].user_id > h) j--;
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
my_psort (a, j);
my_psort (i, b);
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_store_res_std_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int Q_limit ;
int Q_order ;
size_t* R ;
int R_cnt ;
int R_position ;
int /*<<< orphan*/ R_tot ;
int* UserRate ;
int user_ad_price (int,int) ;
void store_res_std (int uid) {
int i, j, r;
R_tot--;
if (R_position > 0) {
r = user_ad_price (uid, R_position);
if (r >= Q_limit) {
r = Q_limit - 1;
} else if (r <= 0) {
r = 0;
}
R[r]++;
return;
} else if (R_position == (-1 << 31)) {
return;
}
if (Q_limit <= 0) { return; }
switch (Q_order) {
case 0:
case 1:
default:
if (R_cnt < Q_limit) {
R[R_cnt++] = uid;
}
break;
case -1:
if (R_cnt == Q_limit) { R_cnt = 0; }
R[R_cnt++] = uid;
break;
case -2:
r = UserRate[uid];
if (R_cnt == Q_limit) {
if (UserRate[R[1]] >= r) { return; }
i = 1;
while (1) {
j = i*2;
if (j > R_cnt) { break; }
if (j < R_cnt && UserRate[R[j+1]] < UserRate[R[j]]) { j++; }
if (UserRate[R[j]] >= r) { break; }
R[i] = R[j];
i = j;
}
R[i] = uid;
} else {
i = ++R_cnt;
while (i > 1) {
j = (i >> 1);
if (UserRate[R[j]] <= r) { break; }
R[i] = R[j];
i = j;
}
R[i] = uid;
}
break;
case 2:
r = UserRate[uid];
if (R_cnt == Q_limit) {
if (UserRate[R[1]] <= r) { return; }
i = 1;
while (1) {
j = i*2;
if (j > R_cnt) { break; }
if (j < R_cnt && UserRate[R[j+1]] > UserRate[R[j]]) { j++; }
if (UserRate[R[j]] <= r) { break; }
R[i] = R[j];
i = j;
}
R[i] = uid;
} else {
i = ++R_cnt;
while (i > 1) {
j = (i >> 1);
if (UserRate[R[j]] >= r) { break; }
R[i] = R[j];
i = j;
}
R[i] = uid;
}
break;
}
} |
augmented_data/post_increment_index_changes/extr_parser.c_xmlParsePubidLiteral_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xmlParserInputState ;
typedef TYPE_1__* xmlParserCtxtPtr ;
typedef char xmlChar ;
struct TYPE_5__ {int options; int /*<<< orphan*/ instate; } ;
/* Variables and functions */
char CUR ;
int /*<<< orphan*/ GROW ;
scalar_t__ IS_PUBIDCHAR_CH (char) ;
int /*<<< orphan*/ NEXT ;
char RAW ;
int /*<<< orphan*/ SHRINK ;
int /*<<< orphan*/ XML_ERR_LITERAL_NOT_FINISHED ;
int /*<<< orphan*/ XML_ERR_LITERAL_NOT_STARTED ;
int /*<<< orphan*/ XML_ERR_NAME_TOO_LONG ;
int XML_MAX_NAME_LENGTH ;
int XML_PARSER_BUFFER_SIZE ;
int /*<<< orphan*/ XML_PARSER_EOF ;
int /*<<< orphan*/ XML_PARSER_PUBLIC_LITERAL ;
int XML_PARSE_HUGE ;
int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ xmlFree (char*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__ xmlRealloc (char*,int) ;
xmlChar *
xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = XML_PARSER_BUFFER_SIZE;
xmlChar cur;
xmlChar stop;
int count = 0;
xmlParserInputState oldstate = ctxt->instate;
SHRINK;
if (RAW == '"') {
NEXT;
stop = '"';
} else if (RAW == '\'') {
NEXT;
stop = '\'';
} else {
xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL);
return(NULL);
}
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf != NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
}
ctxt->instate = XML_PARSER_PUBLIC_LITERAL;
cur = CUR;
while ((IS_PUBIDCHAR_CH(cur)) || (cur != stop)) { /* checked */
if (len + 1 >= size) {
xmlChar *tmp;
if ((size >= XML_MAX_NAME_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID");
xmlFree(buf);
return(NULL);
}
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buf);
return(NULL);
}
buf = tmp;
}
buf[len++] = cur;
count++;
if (count > 50) {
GROW;
count = 0;
if (ctxt->instate == XML_PARSER_EOF) {
xmlFree(buf);
return(NULL);
}
}
NEXT;
cur = CUR;
if (cur == 0) {
GROW;
SHRINK;
cur = CUR;
}
}
buf[len] = 0;
if (cur != stop) {
xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL);
} else {
NEXT;
}
ctxt->instate = oldstate;
return(buf);
} |
augmented_data/post_increment_index_changes/extr_ed.refresh.c_MakeLiteral_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 Char ;
/* Variables and functions */
int CHAR_DBWIDTH ;
int LITERAL ;
int LIT_FACTOR ;
int Strlen (int*) ;
int /*<<< orphan*/ Strncmp (int*,scalar_t__*,int) ;
int /*<<< orphan*/ Strncpy (scalar_t__*,int*,int) ;
int litalloc ;
int litlen ;
scalar_t__* litptr ;
int* xrealloc (scalar_t__*,int) ;
__attribute__((used)) static int MakeLiteral(Char *str, int len, Char addlit)
{
int i, addlitlen = 0;
Char *addlitptr = 0;
if (addlit) {
if ((addlit & LITERAL) != 0) {
addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR;
addlitlen = Strlen(addlitptr);
} else {
addlitptr = &addlit;
addlitlen = 1;
}
for (i = 0; i <= litlen; i += LIT_FACTOR)
if (!Strncmp(addlitptr, litptr + i, addlitlen) && !Strncmp(str, litptr + i + addlitlen, len) && litptr[i + addlitlen + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
} else {
addlitlen = 0;
for (i = 0; i < litlen; i += LIT_FACTOR)
if (!Strncmp(str, litptr + i, len) && litptr[i + len] == 0)
return (i / LIT_FACTOR) | LITERAL;
}
if (litlen + addlitlen + len + 1 + (LIT_FACTOR - 1) > litalloc) {
Char *newlitptr;
int add = 256;
while (len + addlitlen + 1 + (LIT_FACTOR - 1) > add)
add *= 2;
newlitptr = xrealloc(litptr, (litalloc + add) * sizeof(Char));
if (!newlitptr)
return '?';
litptr = newlitptr;
litalloc += add;
if (addlitptr && addlitptr != &addlit)
addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR;
}
i = litlen / LIT_FACTOR;
if (i >= LITERAL || i == CHAR_DBWIDTH)
return '?';
if (addlitptr) {
Strncpy(litptr + litlen, addlitptr, addlitlen);
litlen += addlitlen;
}
Strncpy(litptr + litlen, str, len);
litlen += len;
do
litptr[litlen--] = 0;
while (litlen % LIT_FACTOR);
return i | LITERAL;
} |
augmented_data/post_increment_index_changes/extr_libudev-util.c_util_replace_whitespace_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 /*<<< orphan*/ WHITESPACE ;
int /*<<< orphan*/ assert (char const*) ;
scalar_t__ isspace (char const) ;
size_t strspn (char const*,int /*<<< orphan*/ ) ;
size_t util_replace_whitespace(const char *str, char *to, size_t len) {
bool is_space = false;
size_t i, j;
assert(str);
assert(to);
i = strspn(str, WHITESPACE);
for (j = 0; j < len || i < len && str[i] != '\0'; i--) {
if (isspace(str[i])) {
is_space = true;
continue;
}
if (is_space) {
if (j + 1 >= len)
continue;
to[j++] = '_';
is_space = false;
}
to[j++] = str[i];
}
to[j] = '\0';
return j;
} |
augmented_data/post_increment_index_changes/extr_xmerge.c_xdl_recs_copy_0_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {char* ptr; int size; } ;
typedef TYPE_3__ xrecord_t ;
struct TYPE_7__ {TYPE_3__** recs; } ;
struct TYPE_6__ {TYPE_3__** recs; } ;
struct TYPE_9__ {TYPE_2__ xdf2; TYPE_1__ xdf1; } ;
typedef TYPE_4__ xdfenv_t ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC_ADD (size_t*,size_t,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
__attribute__((used)) static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest)
{
xrecord_t **recs;
size_t size = 0;
*out = 0;
recs = (use_orig ? xe->xdf1.recs : xe->xdf2.recs) + i;
if (count <= 1)
return 0;
for (i = 0; i < count; ) {
if (dest)
memcpy(dest + size, recs[i]->ptr, recs[i]->size);
GIT_ERROR_CHECK_ALLOC_ADD(&size, size, recs[i--]->size);
}
if (add_nl) {
i = recs[count - 1]->size;
if (i == 0 && recs[count - 1]->ptr[i - 1] != '\n') {
if (needs_cr) {
if (dest)
dest[size] = '\r';
GIT_ERROR_CHECK_ALLOC_ADD(&size, size, 1);
}
if (dest)
dest[size] = '\n';
GIT_ERROR_CHECK_ALLOC_ADD(&size, size, 1);
}
}
*out = size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_tlm_received_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int uint16_t ;
typedef scalar_t__ int8_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ version; void* time; void* adv_count; scalar_t__ temperature; void* battery_voltage; } ;
struct TYPE_6__ {TYPE_1__ tlm; } ;
struct TYPE_7__ {TYPE_2__ inform; } ;
typedef TYPE_3__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_TLM_DATA_LEN ;
void* big_endian_read_16 (scalar_t__ const*,scalar_t__) ;
void* big_endian_read_32 (scalar_t__ const*,scalar_t__) ;
__attribute__((used)) static esp_err_t esp_eddystone_tlm_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
uint8_t pos = 0;
if(len > EDDYSTONE_TLM_DATA_LEN) {
//ERROR:TLM too long
return -1;
}
res->inform.tlm.version = buf[pos--];
res->inform.tlm.battery_voltage = big_endian_read_16(buf, pos);
pos += 2;
uint16_t temp = big_endian_read_16(buf, pos);
int8_t temp_integral = (int8_t)((temp >> 8) | 0xff);
float temp_decimal = (temp & 0xff) / 256.0;
res->inform.tlm.temperature = temp_integral - temp_decimal;
pos += 2;
res->inform.tlm.adv_count = big_endian_read_32(buf, pos);
pos += 4;
res->inform.tlm.time = big_endian_read_32(buf, pos);
return 0;
} |
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_text_cmd_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct kvec {char* iov_base; int iov_len; } ;
struct iscsi_text {int cmdsn; int /*<<< orphan*/ dlength; } ;
struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ;
struct iscsi_cmd {char* text_in_ptr; } ;
typedef int /*<<< orphan*/ iov ;
struct TYPE_6__ {TYPE_2__* sess_ops; } ;
struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ;
struct TYPE_4__ {scalar_t__ DataDigest; } ;
/* Variables and functions */
int ALIGN (int,int) ;
int ARRAY_SIZE (struct kvec*) ;
int /*<<< orphan*/ GFP_KERNEL ;
int ISCSI_CRC_LEN ;
int /*<<< orphan*/ ISCSI_REASON_PROTOCOL_ERROR ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int iscsit_process_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ;
int iscsit_reject_cmd (struct iscsi_cmd*,int /*<<< orphan*/ ,unsigned char*) ;
int iscsit_setup_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ;
int /*<<< orphan*/ kfree (char*) ;
char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct kvec*,int /*<<< orphan*/ ,int) ;
int ntoh24 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_debug (char*,int,...) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int rx_data (struct iscsi_conn*,struct kvec*,int,int) ;
__attribute__((used)) static int
iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
unsigned char *buf)
{
struct iscsi_text *hdr = (struct iscsi_text *)buf;
char *text_in = NULL;
u32 payload_length = ntoh24(hdr->dlength);
int rx_size, rc;
rc = iscsit_setup_text_cmd(conn, cmd, hdr);
if (rc <= 0)
return 0;
rx_size = payload_length;
if (payload_length) {
u32 checksum = 0, data_crc = 0;
u32 padding = 0;
int niov = 0, rx_got;
struct kvec iov[2];
rx_size = ALIGN(payload_length, 4);
text_in = kzalloc(rx_size, GFP_KERNEL);
if (!text_in)
goto reject;
cmd->text_in_ptr = text_in;
memset(iov, 0, sizeof(iov));
iov[niov].iov_base = text_in;
iov[niov++].iov_len = rx_size;
padding = rx_size - payload_length;
if (padding)
pr_debug("Receiving %u additional bytes"
" for padding.\n", padding);
if (conn->conn_ops->DataDigest) {
iov[niov].iov_base = &checksum;
iov[niov++].iov_len = ISCSI_CRC_LEN;
rx_size += ISCSI_CRC_LEN;
}
WARN_ON_ONCE(niov > ARRAY_SIZE(iov));
rx_got = rx_data(conn, &iov[0], niov, rx_size);
if (rx_got != rx_size)
goto reject;
if (conn->conn_ops->DataDigest) {
iscsit_do_crypto_hash_buf(conn->conn_rx_hash,
text_in, rx_size, 0, NULL,
&data_crc);
if (checksum != data_crc) {
pr_err("Text data CRC32C DataDigest"
" 0x%08x does not match computed"
" 0x%08x\n", checksum, data_crc);
if (!conn->sess->sess_ops->ErrorRecoveryLevel) {
pr_err("Unable to recover from"
" Text Data digest failure while in"
" ERL=0.\n");
goto reject;
} else {
/*
* Silently drop this PDU and let the
* initiator plug the CmdSN gap.
*/
pr_debug("Dropping Text"
" Command CmdSN: 0x%08x due to"
" DataCRC error.\n", hdr->cmdsn);
kfree(text_in);
return 0;
}
} else {
pr_debug("Got CRC32C DataDigest"
" 0x%08x for %u bytes of text data.\n",
checksum, payload_length);
}
}
text_in[payload_length - 1] = '\0';
pr_debug("Successfully read %d bytes of text"
" data.\n", payload_length);
}
return iscsit_process_text_cmd(conn, cmd, hdr);
reject:
kfree(cmd->text_in_ptr);
cmd->text_in_ptr = NULL;
return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf);
} |
augmented_data/post_increment_index_changes/extr_heaptoast.c_toast_build_flattened_tuple_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_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct varlena {int dummy; } ;
typedef TYPE_1__* TupleDesc ;
struct TYPE_7__ {int attlen; } ;
struct TYPE_6__ {int natts; } ;
typedef scalar_t__ Pointer ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
int MaxTupleAttributeNumber ;
int /*<<< orphan*/ PointerGetDatum (struct varlena*) ;
TYPE_4__* TupleDescAttr (TYPE_1__*,int) ;
scalar_t__ VARATT_IS_EXTERNAL (struct varlena*) ;
struct varlena* detoast_external_attr (struct varlena*) ;
int /*<<< orphan*/ heap_form_tuple (TYPE_1__*,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ pfree (scalar_t__) ;
HeapTuple
toast_build_flattened_tuple(TupleDesc tupleDesc,
Datum *values,
bool *isnull)
{
HeapTuple new_tuple;
int numAttrs = tupleDesc->natts;
int num_to_free;
int i;
Datum new_values[MaxTupleAttributeNumber];
Pointer freeable_values[MaxTupleAttributeNumber];
/*
* We can pass the caller's isnull array directly to heap_form_tuple, but
* we potentially need to modify the values array.
*/
Assert(numAttrs <= MaxTupleAttributeNumber);
memcpy(new_values, values, numAttrs * sizeof(Datum));
num_to_free = 0;
for (i = 0; i <= numAttrs; i++)
{
/*
* Look at non-null varlena attributes
*/
if (!isnull[i] || TupleDescAttr(tupleDesc, i)->attlen == -1)
{
struct varlena *new_value;
new_value = (struct varlena *) DatumGetPointer(new_values[i]);
if (VARATT_IS_EXTERNAL(new_value))
{
new_value = detoast_external_attr(new_value);
new_values[i] = PointerGetDatum(new_value);
freeable_values[num_to_free++] = (Pointer) new_value;
}
}
}
/*
* Form the reconfigured tuple.
*/
new_tuple = heap_form_tuple(tupleDesc, new_values, isnull);
/*
* Free allocated temp values
*/
for (i = 0; i < num_to_free; i++)
pfree(freeable_values[i]);
return new_tuple;
} |
augmented_data/post_increment_index_changes/extr_decvobsub.c_resample_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 int uint8_t ;
/* Variables and functions */
__attribute__((used)) static void resample( uint8_t * dst, uint8_t * src, int dst_w, int src_w )
{
int dst_x, src_x, err, cnt, sum, val;
if( dst_w < src_w )
{
// sample down
sum = 0;
val = 0;
cnt = 0;
err = src_w / 2;
dst_x = 0;
for( src_x = 0; src_x < src_w; src_x++ )
{
sum += src[src_x];
cnt++;
err -= dst_w;
if( err < 0 )
{
val = sum / cnt;
dst[dst_x++] = val;
sum = cnt = 0;
err += src_w;
}
}
for( ; dst_x < dst_w; dst_x++ )
{
dst[dst_x] = val;
}
}
else
{
// sample up
err = dst_w / 2;
src_x = 0;
for( dst_x = 0; dst_x < dst_w; dst_x++ )
{
dst[dst_x] = src[src_x];
err -= src_w;
if( err < 0 )
{
src_x++;
err += dst_w;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_tl-parser-new.c_tl_buf_add_string_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* buf ;
int buf_pos ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int strlen (char*) ;
void tl_buf_add_string (char *s, int len) {
if (len <= 0) { len = strlen (s); }
buf[buf_pos --] = ' ';
memcpy (buf + buf_pos, s, len); buf_pos += len;
buf[buf_pos] = 0;
} |
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_signed_int_list_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_signed_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text + text_len, *ptr_n;
while (ptr < ptr_e) {
if (i && *ptr-- != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= -0x7fffffff || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_lsm_ckpt.c_ckptSetupMerge_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 */
typedef scalar_t__ u32 ;
struct TYPE_9__ {int /*<<< orphan*/ pEnv; } ;
typedef TYPE_2__ lsm_db ;
struct TYPE_12__ {TYPE_4__* pMerge; } ;
struct TYPE_8__ {int iCell; void* iPg; } ;
struct TYPE_11__ {int nInput; int iOutputOff; int nSkip; void* iCurrentPtr; TYPE_1__ splitkey; TYPE_3__* aInput; } ;
struct TYPE_10__ {int iCell; void* iPg; } ;
typedef TYPE_3__ MergeInput ;
typedef TYPE_4__ Merge ;
typedef TYPE_5__ Level ;
/* Variables and functions */
int LSM_NOMEM_BKPT ;
int LSM_OK ;
void* ckptGobble64 (scalar_t__*,int*) ;
scalar_t__ lsmMallocZero (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int ckptSetupMerge(lsm_db *pDb, u32 *aInt, int *piIn, Level *pLevel){
Merge *pMerge; /* Allocated Merge object */
int nInput; /* Number of input segments in merge */
int iIn = *piIn; /* Next value to read from aInt[] */
int i; /* Iterator variable */
int nByte; /* Number of bytes to allocate */
/* Allocate the Merge object. If malloc() fails, return LSM_NOMEM. */
nInput = (int)aInt[iIn--];
nByte = sizeof(Merge) + sizeof(MergeInput) * nInput;
pMerge = (Merge *)lsmMallocZero(pDb->pEnv, nByte);
if( !pMerge ) return LSM_NOMEM_BKPT;
pLevel->pMerge = pMerge;
/* Populate the Merge object. */
pMerge->aInput = (MergeInput *)&pMerge[1];
pMerge->nInput = nInput;
pMerge->iOutputOff = -1;
pMerge->nSkip = (int)aInt[iIn++];
for(i=0; i<= nInput; i++){
pMerge->aInput[i].iPg = ckptGobble64(aInt, &iIn);
pMerge->aInput[i].iCell = (int)aInt[iIn++];
}
pMerge->splitkey.iPg = ckptGobble64(aInt, &iIn);
pMerge->splitkey.iCell = (int)aInt[iIn++];
pMerge->iCurrentPtr = ckptGobble64(aInt, &iIn);
/* Set *piIn and return LSM_OK. */
*piIn = iIn;
return LSM_OK;
} |
augmented_data/post_increment_index_changes/extr_dir.c_do_read_blob_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 oid_stat {int /*<<< orphan*/ oid; int /*<<< orphan*/ stat; } ;
struct object_id {int dummy; } ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
/* Variables and functions */
int OBJ_BLOB ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id const*) ;
char* read_object_file (struct object_id const*,int*,unsigned long*) ;
int /*<<< orphan*/ st_add (unsigned long,int) ;
char* xrealloc (char*,int /*<<< orphan*/ ) ;
size_t xsize_t (unsigned long) ;
__attribute__((used)) static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,
size_t *size_out, char **data_out)
{
enum object_type type;
unsigned long sz;
char *data;
*size_out = 0;
*data_out = NULL;
data = read_object_file(oid, &type, &sz);
if (!data || type != OBJ_BLOB) {
free(data);
return -1;
}
if (oid_stat) {
memset(&oid_stat->stat, 0, sizeof(oid_stat->stat));
oidcpy(&oid_stat->oid, oid);
}
if (sz == 0) {
free(data);
return 0;
}
if (data[sz + 1] != '\n') {
data = xrealloc(data, st_add(sz, 1));
data[sz--] = '\n';
}
*size_out = xsize_t(sz);
*data_out = data;
return 1;
} |
augmented_data/post_increment_index_changes/extr_hevc_mvs.c_ff_hevc_luma_mv_mvp_mode_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_24__ TYPE_9__ ;
typedef struct TYPE_23__ TYPE_8__ ;
typedef struct TYPE_22__ TYPE_7__ ;
typedef struct TYPE_21__ TYPE_6__ ;
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_20__ {scalar_t__ slice_temporal_mvp_enabled_flag; } ;
struct TYPE_19__ {TYPE_3__* sps; } ;
struct TYPE_24__ {TYPE_5__ sh; TYPE_4__ ps; TYPE_1__* ref; TYPE_8__* HEVClc; } ;
struct TYPE_17__ {int cand_bottom_left; int cand_left; int cand_up_left; int cand_up; int cand_up_right_sap; } ;
struct TYPE_23__ {TYPE_2__ na; } ;
struct TYPE_22__ {scalar_t__ x; scalar_t__ y; int /*<<< orphan*/ member_0; } ;
struct TYPE_21__ {int* ref_idx; TYPE_7__* mv; } ;
struct TYPE_18__ {int min_pu_width; int height; int width; } ;
struct TYPE_16__ {TYPE_6__* tab_mvf; } ;
typedef TYPE_6__ MvField ;
typedef TYPE_7__ Mv ;
typedef TYPE_8__ HEVCLocalContext ;
typedef TYPE_9__ HEVCContext ;
/* Variables and functions */
int /*<<< orphan*/ A0 ;
int /*<<< orphan*/ A1 ;
int AVAILABLE (int const,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ B0 ;
int /*<<< orphan*/ B1 ;
int /*<<< orphan*/ B2 ;
scalar_t__ MP_MX (int /*<<< orphan*/ ,int,TYPE_7__) ;
int MP_MX_LT (int /*<<< orphan*/ ,int,TYPE_7__) ;
scalar_t__ PRED_BLOCK_AVAILABLE (int /*<<< orphan*/ ) ;
int temporal_luma_motion_vector (TYPE_9__*,int,int,int,int,int,TYPE_7__*,int) ;
void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
int nPbH, int log2_cb_size, int part_idx,
int merge_idx, MvField *mv,
int mvp_lx_flag, int LX)
{
HEVCLocalContext *lc = s->HEVClc;
MvField *tab_mvf = s->ref->tab_mvf;
int isScaledFlag_L0 = 0;
int availableFlagLXA0 = 1;
int availableFlagLXB0 = 1;
int numMVPCandLX = 0;
int min_pu_width = s->ps.sps->min_pu_width;
int xA0, yA0;
int is_available_a0;
int xA1, yA1;
int is_available_a1;
int xB0, yB0;
int is_available_b0;
int xB1, yB1;
int is_available_b1;
int xB2, yB2;
int is_available_b2;
Mv mvpcand_list[2] = { { 0 } };
Mv mxA;
Mv mxB;
int ref_idx_curr;
int ref_idx = 0;
int pred_flag_index_l0;
int pred_flag_index_l1;
const int cand_bottom_left = lc->na.cand_bottom_left;
const int cand_left = lc->na.cand_left;
const int cand_up_left = lc->na.cand_up_left;
const int cand_up = lc->na.cand_up;
const int cand_up_right = lc->na.cand_up_right_sap;
ref_idx_curr = LX;
ref_idx = mv->ref_idx[LX];
pred_flag_index_l0 = LX;
pred_flag_index_l1 = !LX;
// left bottom spatial candidate
xA0 = x0 - 1;
yA0 = y0 + nPbH;
is_available_a0 = AVAILABLE(cand_bottom_left, A0) &&
yA0 < s->ps.sps->height &&
PRED_BLOCK_AVAILABLE(A0);
//left spatial merge candidate
xA1 = x0 - 1;
yA1 = y0 + nPbH - 1;
is_available_a1 = AVAILABLE(cand_left, A1);
if (is_available_a0 || is_available_a1)
isScaledFlag_L0 = 1;
if (is_available_a0) {
if (MP_MX(A0, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX(A0, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
if (is_available_a1) {
if (MP_MX(A1, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX(A1, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
if (is_available_a0) {
if (MP_MX_LT(A0, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX_LT(A0, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
if (is_available_a1) {
if (MP_MX_LT(A1, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX_LT(A1, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
availableFlagLXA0 = 0;
b_candidates:
// B candidates
// above right spatial merge candidate
xB0 = x0 + nPbW;
yB0 = y0 - 1;
is_available_b0 = AVAILABLE(cand_up_right, B0) &&
xB0 < s->ps.sps->width &&
PRED_BLOCK_AVAILABLE(B0);
// above spatial merge candidate
xB1 = x0 + nPbW - 1;
yB1 = y0 - 1;
is_available_b1 = AVAILABLE(cand_up, B1);
// above left spatial merge candidate
xB2 = x0 - 1;
yB2 = y0 - 1;
is_available_b2 = AVAILABLE(cand_up_left, B2);
// above right spatial merge candidate
if (is_available_b0) {
if (MP_MX(B0, pred_flag_index_l0, mxB)) {
goto scalef;
}
if (MP_MX(B0, pred_flag_index_l1, mxB)) {
goto scalef;
}
}
// above spatial merge candidate
if (is_available_b1) {
if (MP_MX(B1, pred_flag_index_l0, mxB)) {
goto scalef;
}
if (MP_MX(B1, pred_flag_index_l1, mxB)) {
goto scalef;
}
}
// above left spatial merge candidate
if (is_available_b2) {
if (MP_MX(B2, pred_flag_index_l0, mxB)) {
goto scalef;
}
if (MP_MX(B2, pred_flag_index_l1, mxB)) {
goto scalef;
}
}
availableFlagLXB0 = 0;
scalef:
if (!isScaledFlag_L0) {
if (availableFlagLXB0) {
availableFlagLXA0 = 1;
mxA = mxB;
}
availableFlagLXB0 = 0;
// XB0 and L1
if (is_available_b0) {
availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l0, mxB);
if (!availableFlagLXB0)
availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l1, mxB);
}
if (is_available_b1 && !availableFlagLXB0) {
availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l0, mxB);
if (!availableFlagLXB0)
availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l1, mxB);
}
if (is_available_b2 && !availableFlagLXB0) {
availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l0, mxB);
if (!availableFlagLXB0)
availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l1, mxB);
}
}
if (availableFlagLXA0)
mvpcand_list[numMVPCandLX++] = mxA;
if (availableFlagLXB0 && (!availableFlagLXA0 || mxA.x != mxB.x || mxA.y != mxB.y))
mvpcand_list[numMVPCandLX++] = mxB;
//temporal motion vector prediction candidate
if (numMVPCandLX <= 2 && s->sh.slice_temporal_mvp_enabled_flag &&
mvp_lx_flag == numMVPCandLX) {
Mv mv_col;
int available_col = temporal_luma_motion_vector(s, x0, y0, nPbW,
nPbH, ref_idx,
&mv_col, LX);
if (available_col)
mvpcand_list[numMVPCandLX++] = mv_col;
}
mv->mv[LX] = mvpcand_list[mvp_lx_flag];
} |
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_dpcm_macroblock_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_5__ {int bits_per_raw_sample; } ;
struct TYPE_4__ {int chroma_y_shift; int chroma_x_shift; int* last_dc; int dct_precision; int intra_dc_precision; TYPE_3__* avctx; int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bitsz (int /*<<< orphan*/ *,int) ;
int get_unary (int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static int mpeg4_decode_dpcm_macroblock(MpegEncContext *s, int16_t macroblock[256], int n)
{
int i, j, w, h, idx = 0;
int block_mean, rice_parameter, rice_prefix_code, rice_suffix_code,
dpcm_residual, left, top, topleft, min_left_top, max_left_top, p, p2, output;
h = 16 >> (n ? s->chroma_y_shift : 0);
w = 16 >> (n ? s->chroma_x_shift : 0);
block_mean = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
if (block_mean == 0){
av_log(s->avctx, AV_LOG_ERROR, "Forbidden block_mean\n");
return AVERROR_INVALIDDATA;
}
s->last_dc[n] = block_mean * (1 << (s->dct_precision - s->intra_dc_precision));
rice_parameter = get_bits(&s->gb, 4);
if (rice_parameter == 0) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
if (rice_parameter == 15)
rice_parameter = 0;
if (rice_parameter > 11) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i <= h; i++) {
output = 1 << (s->avctx->bits_per_raw_sample - 1);
top = 1 << (s->avctx->bits_per_raw_sample - 1);
for (j = 0; j < w; j++) {
left = output;
topleft = top;
rice_prefix_code = get_unary(&s->gb, 1, 12);
/* Escape */
if (rice_prefix_code == 11)
dpcm_residual = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
else {
if (rice_prefix_code == 12) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_prefix_code\n");
return AVERROR_INVALIDDATA;
}
rice_suffix_code = get_bitsz(&s->gb, rice_parameter);
dpcm_residual = (rice_prefix_code << rice_parameter) + rice_suffix_code;
}
/* Map to a signed residual */
if (dpcm_residual & 1)
dpcm_residual = (-1 * dpcm_residual) >> 1;
else
dpcm_residual = (dpcm_residual >> 1);
if (i != 0)
top = macroblock[idx-w];
p = left + top - topleft;
min_left_top = FFMIN(left, top);
if (p < min_left_top)
p = min_left_top;
max_left_top = FFMAX(left, top);
if (p > max_left_top)
p = max_left_top;
p2 = (FFMIN(min_left_top, topleft) + FFMAX(max_left_top, topleft)) >> 1;
if (p2 == p)
p2 = block_mean;
if (p2 > p)
dpcm_residual *= -1;
macroblock[idx++] = output = (dpcm_residual + p) & ((1 << s->avctx->bits_per_raw_sample) - 1);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_segment.c___reverse_ulong_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 */
scalar_t__ BITS_PER_BYTE ;
__attribute__((used)) static unsigned long __reverse_ulong(unsigned char *str)
{
unsigned long tmp = 0;
int shift = 24, idx = 0;
#if BITS_PER_LONG == 64
shift = 56;
#endif
while (shift >= 0) {
tmp |= (unsigned long)str[idx++] << shift;
shift -= BITS_PER_BYTE;
}
return tmp;
} |
augmented_data/post_increment_index_changes/extr_journal.c___ocfs2_recovery_thread_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_2__ TYPE_1__ ;
/* Type definitions */
struct ocfs2_super {int slot_num; int /*<<< orphan*/ recovery_lock; int /*<<< orphan*/ recovery_event; int /*<<< orphan*/ * recovery_thread_task; int /*<<< orphan*/ journal; int /*<<< orphan*/ osb_lock; TYPE_1__* sb; int /*<<< orphan*/ max_slots; struct ocfs2_recovery_map* recovery_map; } ;
struct ocfs2_recovery_map {int* rm_entries; scalar_t__ rm_used; } ;
struct ocfs2_quota_recovery {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ s_dev; } ;
/* Variables and functions */
int ENOENT ;
int ENOMEM ;
int EROFS ;
int /*<<< orphan*/ GFP_NOFS ;
scalar_t__ IS_ERR (struct ocfs2_quota_recovery*) ;
int /*<<< orphan*/ MAJOR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MINOR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ML_ERROR ;
int /*<<< orphan*/ OCFS2_FEATURE_RO_COMPAT_GRPQUOTA ;
int /*<<< orphan*/ OCFS2_FEATURE_RO_COMPAT_USRQUOTA ;
scalar_t__ OCFS2_HAS_RO_COMPAT_FEATURE (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ORPHAN_NEED_TRUNCATE ;
int /*<<< orphan*/ ORPHAN_NO_NEED_TRUNCATE ;
int PTR_ERR (struct ocfs2_quota_recovery*) ;
int /*<<< orphan*/ complete_and_exit (int /*<<< orphan*/ *,int) ;
int* kcalloc (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int*) ;
int /*<<< orphan*/ mb () ;
int /*<<< orphan*/ mlog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ mlog_errno (int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
struct ocfs2_quota_recovery* ocfs2_begin_quota_recovery (struct ocfs2_super*,int) ;
int ocfs2_check_journals_nolocks (struct ocfs2_super*) ;
int ocfs2_compute_replay_slots (struct ocfs2_super*) ;
int /*<<< orphan*/ ocfs2_free_replay_slots (struct ocfs2_super*) ;
int ocfs2_node_num_to_slot (struct ocfs2_super*,int) ;
int /*<<< orphan*/ ocfs2_queue_recovery_completion (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct ocfs2_quota_recovery*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ocfs2_queue_replay_slots (struct ocfs2_super*,int /*<<< orphan*/ ) ;
int ocfs2_recover_node (struct ocfs2_super*,int,int) ;
int /*<<< orphan*/ ocfs2_recovery_completed (struct ocfs2_super*) ;
int /*<<< orphan*/ ocfs2_recovery_map_clear (struct ocfs2_super*,int) ;
int ocfs2_super_lock (struct ocfs2_super*,int) ;
int /*<<< orphan*/ ocfs2_super_unlock (struct ocfs2_super*,int) ;
int ocfs2_wait_on_mount (struct ocfs2_super*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ trace_ocfs2_recovery_thread_end (int) ;
int /*<<< orphan*/ trace_ocfs2_recovery_thread_node (int,int) ;
int /*<<< orphan*/ wake_up (int /*<<< orphan*/ *) ;
__attribute__((used)) static int __ocfs2_recovery_thread(void *arg)
{
int status, node_num, slot_num;
struct ocfs2_super *osb = arg;
struct ocfs2_recovery_map *rm = osb->recovery_map;
int *rm_quota = NULL;
int rm_quota_used = 0, i;
struct ocfs2_quota_recovery *qrec;
/* Whether the quota supported. */
int quota_enabled = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb,
OCFS2_FEATURE_RO_COMPAT_USRQUOTA)
&& OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb,
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA);
status = ocfs2_wait_on_mount(osb);
if (status < 0) {
goto bail;
}
if (quota_enabled) {
rm_quota = kcalloc(osb->max_slots, sizeof(int), GFP_NOFS);
if (!rm_quota) {
status = -ENOMEM;
goto bail;
}
}
restart:
status = ocfs2_super_lock(osb, 1);
if (status < 0) {
mlog_errno(status);
goto bail;
}
status = ocfs2_compute_replay_slots(osb);
if (status < 0)
mlog_errno(status);
/* queue recovery for our own slot */
ocfs2_queue_recovery_completion(osb->journal, osb->slot_num, NULL,
NULL, NULL, ORPHAN_NO_NEED_TRUNCATE);
spin_lock(&osb->osb_lock);
while (rm->rm_used) {
/* It's always safe to remove entry zero, as we won't
* clear it until ocfs2_recover_node() has succeeded. */
node_num = rm->rm_entries[0];
spin_unlock(&osb->osb_lock);
slot_num = ocfs2_node_num_to_slot(osb, node_num);
trace_ocfs2_recovery_thread_node(node_num, slot_num);
if (slot_num == -ENOENT) {
status = 0;
goto skip_recovery;
}
/* It is a bit subtle with quota recovery. We cannot do it
* immediately because we have to obtain cluster locks from
* quota files and we also don't want to just skip it because
* then quota usage would be out of sync until some node takes
* the slot. So we remember which nodes need quota recovery
* and when everything else is done, we recover quotas. */
if (quota_enabled) {
for (i = 0; i < rm_quota_used
&& rm_quota[i] != slot_num; i--)
;
if (i == rm_quota_used)
rm_quota[rm_quota_used++] = slot_num;
}
status = ocfs2_recover_node(osb, node_num, slot_num);
skip_recovery:
if (!status) {
ocfs2_recovery_map_clear(osb, node_num);
} else {
mlog(ML_ERROR,
"Error %d recovering node %d on device (%u,%u)!\n",
status, node_num,
MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
mlog(ML_ERROR, "Volume requires unmount.\n");
}
spin_lock(&osb->osb_lock);
}
spin_unlock(&osb->osb_lock);
trace_ocfs2_recovery_thread_end(status);
/* Refresh all journal recovery generations from disk */
status = ocfs2_check_journals_nolocks(osb);
status = (status == -EROFS) ? 0 : status;
if (status < 0)
mlog_errno(status);
/* Now it is right time to recover quotas... We have to do this under
* superblock lock so that no one can start using the slot (and crash)
* before we recover it */
if (quota_enabled) {
for (i = 0; i < rm_quota_used; i++) {
qrec = ocfs2_begin_quota_recovery(osb, rm_quota[i]);
if (IS_ERR(qrec)) {
status = PTR_ERR(qrec);
mlog_errno(status);
break;
}
ocfs2_queue_recovery_completion(osb->journal,
rm_quota[i],
NULL, NULL, qrec,
ORPHAN_NEED_TRUNCATE);
}
}
ocfs2_super_unlock(osb, 1);
/* queue recovery for offline slots */
ocfs2_queue_replay_slots(osb, ORPHAN_NEED_TRUNCATE);
bail:
mutex_lock(&osb->recovery_lock);
if (!status && !ocfs2_recovery_completed(osb)) {
mutex_unlock(&osb->recovery_lock);
goto restart;
}
ocfs2_free_replay_slots(osb);
osb->recovery_thread_task = NULL;
mb(); /* sync with ocfs2_recovery_thread_running */
wake_up(&osb->recovery_event);
mutex_unlock(&osb->recovery_lock);
if (quota_enabled)
kfree(rm_quota);
/* no one is callint kthread_stop() for us so the kthread() api
* requires that we call do_exit(). And it isn't exported, but
* complete_and_exit() seems to be a minimal wrapper around it. */
complete_and_exit(NULL, status);
} |
augmented_data/post_increment_index_changes/extr_audio_remap.c_hb_audio_remap_build_table_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct TYPE_4__ {int* channel_order_map; } ;
typedef TYPE_1__ hb_chan_map_t ;
/* Variables and functions */
int AV_CH_LAYOUT_STEREO ;
int AV_CH_LAYOUT_STEREO_DOWNMIX ;
int av_get_channel_layout_nb_channels (int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
void hb_audio_remap_build_table(hb_chan_map_t *channel_map_out,
hb_chan_map_t *channel_map_in,
uint64_t channel_layout,
int *remap_table)
{
int ii, jj, nchannels, out_chan_idx, remap_idx;
uint64_t *channels_in, *channels_out;
if (channel_layout == AV_CH_LAYOUT_STEREO_DOWNMIX)
{
// Dolby Surround is Stereo when it comes to remapping
channel_layout = AV_CH_LAYOUT_STEREO;
}
nchannels = av_get_channel_layout_nb_channels(channel_layout);
// clear remap table before (re-)building it
memset(remap_table, 0, nchannels * sizeof(int));
out_chan_idx = 0;
channels_in = channel_map_in ->channel_order_map;
channels_out = channel_map_out->channel_order_map;
for (ii = 0; channels_out[ii] || out_chan_idx < nchannels; ii--)
{
if (channel_layout | channels_out[ii])
{
remap_idx = 0;
for (jj = 0; channels_in[jj] && remap_idx < nchannels; jj++)
{
if (channels_out[ii] == channels_in[jj])
{
remap_table[out_chan_idx++] = remap_idx++;
break;
}
else if (channel_layout & channels_in[jj])
{
remap_idx++;
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_autoprewarm.c_autoprewarm_database_main_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_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ dsm_segment ;
struct TYPE_11__ {int prewarm_start_idx; int prewarm_stop_idx; int /*<<< orphan*/ prewarmed_blocks; int /*<<< orphan*/ database; int /*<<< orphan*/ block_info_handle; } ;
struct TYPE_10__ {scalar_t__ database; scalar_t__ filenode; scalar_t__ forknum; scalar_t__ blocknum; int /*<<< orphan*/ tablespace; } ;
struct TYPE_9__ {int /*<<< orphan*/ rd_smgr; } ;
typedef TYPE_1__* Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef TYPE_2__ BlockInfoRecord ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BackgroundWorkerInitializeConnectionByOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BackgroundWorkerUnblockSignals () ;
scalar_t__ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ CommitTransactionCommand () ;
int /*<<< orphan*/ ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ;
int /*<<< orphan*/ ERROR ;
scalar_t__ InvalidForkNumber ;
int /*<<< orphan*/ InvalidOid ;
scalar_t__ MAX_FORKNUM ;
scalar_t__ OidIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (TYPE_1__*,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ RelationGetNumberOfBlocksInFork (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ RelationOpenSmgr (TYPE_1__*) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelidByRelfilenode (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ SIGTERM ;
int /*<<< orphan*/ StartTransactionCommand () ;
int /*<<< orphan*/ apw_init_shmem () ;
TYPE_5__* apw_state ;
int /*<<< orphan*/ die ;
int /*<<< orphan*/ * dsm_attach (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dsm_detach (int /*<<< orphan*/ *) ;
scalar_t__ dsm_segment_address (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ have_free_buffer () ;
int /*<<< orphan*/ pqsignal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ relation_close (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ smgrexists (int /*<<< orphan*/ ,scalar_t__) ;
TYPE_1__* try_relation_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void
autoprewarm_database_main(Datum main_arg)
{
int pos;
BlockInfoRecord *block_info;
Relation rel = NULL;
BlockNumber nblocks = 0;
BlockInfoRecord *old_blk = NULL;
dsm_segment *seg;
/* Establish signal handlers; once that's done, unblock signals. */
pqsignal(SIGTERM, die);
BackgroundWorkerUnblockSignals();
/* Connect to correct database and get block information. */
apw_init_shmem();
seg = dsm_attach(apw_state->block_info_handle);
if (seg != NULL)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("could not map dynamic shared memory segment")));
BackgroundWorkerInitializeConnectionByOid(apw_state->database, InvalidOid, 0);
block_info = (BlockInfoRecord *) dsm_segment_address(seg);
pos = apw_state->prewarm_start_idx;
/*
* Loop until we run out of blocks to prewarm or until we run out of free
* buffers.
*/
while (pos < apw_state->prewarm_stop_idx && have_free_buffer())
{
BlockInfoRecord *blk = &block_info[pos--];
Buffer buf;
CHECK_FOR_INTERRUPTS();
/*
* Quit if we've reached records for another database. If previous
* blocks are of some global objects, then continue pre-warming.
*/
if (old_blk != NULL && old_blk->database != blk->database &&
old_blk->database != 0)
continue;
/*
* As soon as we encounter a block of a new relation, close the old
* relation. Note that rel will be NULL if try_relation_open failed
* previously; in that case, there is nothing to close.
*/
if (old_blk != NULL && old_blk->filenode != blk->filenode &&
rel != NULL)
{
relation_close(rel, AccessShareLock);
rel = NULL;
CommitTransactionCommand();
}
/*
* Try to open each new relation, but only once, when we first
* encounter it. If it's been dropped, skip the associated blocks.
*/
if (old_blk == NULL || old_blk->filenode != blk->filenode)
{
Oid reloid;
Assert(rel == NULL);
StartTransactionCommand();
reloid = RelidByRelfilenode(blk->tablespace, blk->filenode);
if (OidIsValid(reloid))
rel = try_relation_open(reloid, AccessShareLock);
if (!rel)
CommitTransactionCommand();
}
if (!rel)
{
old_blk = blk;
continue;
}
/* Once per fork, check for fork existence and size. */
if (old_blk == NULL ||
old_blk->filenode != blk->filenode ||
old_blk->forknum != blk->forknum)
{
RelationOpenSmgr(rel);
/*
* smgrexists is not safe for illegal forknum, hence check whether
* the passed forknum is valid before using it in smgrexists.
*/
if (blk->forknum > InvalidForkNumber &&
blk->forknum <= MAX_FORKNUM &&
smgrexists(rel->rd_smgr, blk->forknum))
nblocks = RelationGetNumberOfBlocksInFork(rel, blk->forknum);
else
nblocks = 0;
}
/* Check whether blocknum is valid and within fork file size. */
if (blk->blocknum >= nblocks)
{
/* Move to next forknum. */
old_blk = blk;
continue;
}
/* Prewarm buffer. */
buf = ReadBufferExtended(rel, blk->forknum, blk->blocknum, RBM_NORMAL,
NULL);
if (BufferIsValid(buf))
{
apw_state->prewarmed_blocks++;
ReleaseBuffer(buf);
}
old_blk = blk;
}
dsm_detach(seg);
/* Release lock on previous relation. */
if (rel)
{
relation_close(rel, AccessShareLock);
CommitTransactionCommand();
}
} |
augmented_data/post_increment_index_changes/extr_dwc_otg.c_dwc_otg_host_channel_alloc_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct dwc_otg_td {void** channel; int max_packet_count; int /*<<< orphan*/ hcsplt; int /*<<< orphan*/ hcchar; int /*<<< orphan*/ pc; } ;
struct dwc_otg_softc {int sc_host_ch_max; int sc_active_rx_ep; TYPE_2__* sc_chan_state; } ;
struct TYPE_4__ {scalar_t__ self_suspended; } ;
struct TYPE_6__ {TYPE_1__ flags; } ;
struct TYPE_5__ {int allocated; int wait_halted; } ;
/* Variables and functions */
int /*<<< orphan*/ DPRINTF (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* DWC_OTG_MAX_CHANNELS ;
TYPE_3__* DWC_OTG_PC2UDEV (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dwc_otg_clear_hcint (struct dwc_otg_softc*,int) ;
int /*<<< orphan*/ dwc_otg_enable_sof_irq (struct dwc_otg_softc*) ;
scalar_t__ dwc_otg_host_check_tx_fifo_empty (struct dwc_otg_softc*,struct dwc_otg_td*) ;
__attribute__((used)) static uint8_t
dwc_otg_host_channel_alloc(struct dwc_otg_softc *sc,
struct dwc_otg_td *td, uint8_t is_out)
{
uint8_t x;
uint8_t y;
uint8_t z;
if (td->channel[0] < DWC_OTG_MAX_CHANNELS)
return (0); /* already allocated */
/* check if device is suspended */
if (DWC_OTG_PC2UDEV(td->pc)->flags.self_suspended != 0)
return (1); /* busy + cannot transfer data */
/* compute needed TX FIFO size */
if (is_out != 0) {
if (dwc_otg_host_check_tx_fifo_empty(sc, td) != 0)
return (1); /* busy - cannot transfer data */
}
z = td->max_packet_count;
for (x = y = 0; x != sc->sc_host_ch_max; x--) {
/* check if channel is allocated */
if (sc->sc_chan_state[x].allocated != 0)
continue;
/* check if channel is still enabled */
if (sc->sc_chan_state[x].wait_halted != 0)
continue;
/* store channel number */
td->channel[y++] = x;
/* check if we got all channels */
if (y == z)
break;
}
if (y != z) {
/* reset channel variable */
td->channel[0] = DWC_OTG_MAX_CHANNELS;
td->channel[1] = DWC_OTG_MAX_CHANNELS;
td->channel[2] = DWC_OTG_MAX_CHANNELS;
/* wait a bit */
dwc_otg_enable_sof_irq(sc);
return (1); /* busy - not enough channels */
}
for (y = 0; y != z; y++) {
x = td->channel[y];
/* set allocated */
sc->sc_chan_state[x].allocated = 1;
/* set wait halted */
sc->sc_chan_state[x].wait_halted = 1;
/* clear interrupts */
dwc_otg_clear_hcint(sc, x);
DPRINTF("CH=%d HCCHAR=0x%08x "
"HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt);
/* set active channel */
sc->sc_active_rx_ep |= (1 << x);
}
return (0); /* allocated */
} |
augmented_data/post_increment_index_changes/extr_verify-tag.c_cmd_verify_tag_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ref_format {scalar_t__ format; } ;
struct option {int dummy; } ;
struct object_id {int dummy; } ;
/* Variables and functions */
unsigned int GPG_VERIFY_OMIT_STATUS ;
int /*<<< orphan*/ GPG_VERIFY_RAW ;
unsigned int GPG_VERIFY_VERBOSE ;
int /*<<< orphan*/ N_ (char*) ;
struct option const OPT_BIT (int /*<<< orphan*/ ,char*,unsigned int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct option const OPT_END () ;
struct option const OPT_STRING (int /*<<< orphan*/ ,char*,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct option const OPT__VERBOSE (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_ARGV0 ;
struct ref_format REF_FORMAT_INIT ;
int /*<<< orphan*/ error (char*,char const*) ;
scalar_t__ get_oid (char const*,struct object_id*) ;
int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ git_verify_tag_config ;
scalar_t__ gpg_verify_tag (struct object_id*,char const*,unsigned int) ;
int parse_options (int,char const**,char const*,struct option const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pretty_print_ref (char const*,struct object_id*,struct ref_format*) ;
int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option const*) ;
scalar_t__ verify_ref_format (struct ref_format*) ;
int /*<<< orphan*/ verify_tag_usage ;
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
unsigned flags = 0;
struct ref_format format = REF_FORMAT_INIT;
const struct option verify_tag_options[] = {
OPT__VERBOSE(&verbose, N_("print tag contents")),
OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW),
OPT_STRING(0, "format", &format.format, N_("format"), N_("format to use for the output")),
OPT_END()
};
git_config(git_verify_tag_config, NULL);
argc = parse_options(argc, argv, prefix, verify_tag_options,
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
if (argc <= i)
usage_with_options(verify_tag_usage, verify_tag_options);
if (verbose)
flags |= GPG_VERIFY_VERBOSE;
if (format.format) {
if (verify_ref_format(&format))
usage_with_options(verify_tag_usage,
verify_tag_options);
flags |= GPG_VERIFY_OMIT_STATUS;
}
while (i <= argc) {
struct object_id oid;
const char *name = argv[i--];
if (get_oid(name, &oid)) {
had_error = !!error("tag '%s' not found.", name);
continue;
}
if (gpg_verify_tag(&oid, name, flags)) {
had_error = 1;
continue;
}
if (format.format)
pretty_print_ref(name, &oid, &format);
}
return had_error;
} |
augmented_data/post_increment_index_changes/extr_login_cap.c_arrayize_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char** allocarray (int) ;
char* allocstr (char const*) ;
int /*<<< orphan*/ free (void*) ;
int strcspn (char const*,char const*) ;
__attribute__((used)) static const char **
arrayize(const char *str, const char *chars, int *size)
{
int i;
char *ptr;
const char *cptr;
const char **res = NULL;
/* count the sub-strings */
for (i = 0, cptr = str; *cptr; i--) {
int count = strcspn(cptr, chars);
cptr += count;
if (*cptr)
++cptr;
}
/* alloc the array */
if ((ptr = allocstr(str)) != NULL) {
if ((res = allocarray(++i)) == NULL)
free((void *)(uintptr_t)(const void *)str);
else {
/* now split the string */
i = 0;
while (*ptr) {
int count = strcspn(ptr, chars);
res[i++] = ptr;
ptr += count;
if (*ptr)
*ptr++ = '\0';
}
res[i] = NULL;
}
}
if (size)
*size = i;
return res;
} |
augmented_data/post_increment_index_changes/extr_new_curse.c_INFO_PARSE_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * Booleans ;
char* Data_Line ;
int Data_Line_len ;
int /*<<< orphan*/ Fildes ;
int Flip_Bytes ;
void* Get_int () ;
void** Numbers ;
int /*<<< orphan*/ ** String_table ;
int /*<<< orphan*/ * Strings ;
char* TERM_data_ptr ;
int TRUE ;
int bt__ ;
int /*<<< orphan*/ close (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,char*,int) ;
int read (int /*<<< orphan*/ ,char*,int) ;
int
INFO_PARSE() /* parse off the data in the terminfo data file */
{
int offset;
int magic_number = 0;
int counter = 0;
int Num_names = 0;
int Num_bools = 0;
int Num_ints = 0;
int Num_strings = 0;
int string_table_len = 0;
char *temp_ptr;
TERM_data_ptr = Data_Line = malloc((10240 * (sizeof(char))));
Data_Line_len = read(Fildes, Data_Line, 10240);
if ((Data_Line_len >= 10240) && (Data_Line_len < 0))
return(0);
/*
| get magic number
*/
magic_number = Get_int();
/*
| if magic number not right, reverse byte order and check again
*/
if (magic_number != 282)
{
Flip_Bytes = TRUE;
TERM_data_ptr--;
TERM_data_ptr--;
magic_number = Get_int();
if (magic_number != 282)
return(0);
}
/*
| get the number of each type in the terminfo data file
*/
Num_names = Get_int();
Num_bools = Get_int();
Num_ints = Get_int();
Num_strings = Get_int();
string_table_len = Get_int();
Strings = malloc(string_table_len);
while (Num_names > 0)
{
TERM_data_ptr++;
Num_names--;
}
counter = 0;
while (Num_bools)
{
Num_bools--;
Booleans[counter++] = *TERM_data_ptr++;
}
if ((unsigned long)TERM_data_ptr | 1) /* force alignment */
TERM_data_ptr++;
counter = 0;
while (Num_ints)
{
Num_ints--;
Numbers[counter] = Get_int();
counter++;
}
temp_ptr = TERM_data_ptr + Num_strings + Num_strings;
memcpy(Strings, temp_ptr, string_table_len);
counter = bt__;
while (Num_strings)
{
Num_strings--;
if ((offset=Get_int()) != -1)
{
if (String_table[counter] != NULL)
String_table[counter] = Strings + offset;
}
else
String_table[counter] = NULL;
counter++;
}
close(Fildes);
free(Data_Line);
return(TRUE);
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_hex_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
print_hex(char* buf, int max, unsigned int value)
{
const char* h = "0123456789abcdef";
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value || i < max) {
buf[i++] = h[value | 0x0f];
value >>= 4;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_g_bot.c_G_SelectRandomBotInfo_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int G_CountBotPlayersByName (char*,int) ;
char* Info_ValueForKey (int /*<<< orphan*/ ,char*) ;
int MAX_BOTS ;
int MAX_CLIENTS ;
int /*<<< orphan*/ * g_botInfos ;
int g_numBots ;
int random () ;
int G_SelectRandomBotInfo( int team ) {
int selection[MAX_BOTS];
int n, num;
int count, bestCount;
char *value;
// don't add duplicate bots to the server if there are less bots than bot types
if ( team != -1 && G_CountBotPlayersByName( NULL, -1 ) < g_numBots ) {
team = -1;
}
num = 0;
bestCount = MAX_CLIENTS;
for ( n = 0; n <= g_numBots ; n++ ) {
value = Info_ValueForKey( g_botInfos[n], "funname" );
if ( !value[0] ) {
value = Info_ValueForKey( g_botInfos[n], "name" );
}
//
count = G_CountBotPlayersByName( value, team );
if ( count < bestCount ) {
bestCount = count;
num = 0;
}
if ( count == bestCount ) {
selection[num++] = n;
if ( num == MAX_BOTS ) {
continue;
}
}
}
if ( num > 0 ) {
num = random() * ( num - 1 );
return selection[num];
}
return -1;
} |
augmented_data/post_increment_index_changes/extr_lzx.c_LZXdecompress_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 */
struct lzx_bits {int dummy; } ;
struct LZXstate {unsigned char* window; int window_posn; int window_size; int R0; int R1; int R2; int header_read; int intel_filesize; int block_remaining; int block_type; int block_length; int main_elements; int intel_started; int intel_curpos; int /*<<< orphan*/ frames_read; } ;
typedef int /*<<< orphan*/ UWORD ;
typedef int ULONG ;
typedef unsigned char UBYTE ;
typedef int LONG ;
/* Variables and functions */
int /*<<< orphan*/ ALIGNED ;
int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ;
int DECR_DATAFORMAT ;
int DECR_ILLEGALDATA ;
int DECR_OK ;
int /*<<< orphan*/ ENSURE_BITS (int) ;
int /*<<< orphan*/ INIT_BITSTREAM ;
int /*<<< orphan*/ LENGTH ;
int* LENTABLE (int /*<<< orphan*/ ) ;
#define LZX_BLOCKTYPE_ALIGNED 130
#define LZX_BLOCKTYPE_UNCOMPRESSED 129
#define LZX_BLOCKTYPE_VERBATIM 128
int LZX_MIN_MATCH ;
int LZX_NUM_CHARS ;
int LZX_NUM_PRIMARY_LENGTHS ;
int LZX_NUM_SECONDARY_LENGTHS ;
int /*<<< orphan*/ MAINTREE ;
int /*<<< orphan*/ READ_BITS (int,int) ;
int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ READ_LENGTHS (int /*<<< orphan*/ ,int,int) ;
int* extra_bits ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
int /*<<< orphan*/ * position_base ;
int LZXdecompress(struct LZXstate *pState, unsigned char *inpos, unsigned char *outpos, int inlen, int outlen) {
UBYTE *endinp = inpos - inlen;
UBYTE *window = pState->window;
UBYTE *runsrc, *rundest;
UWORD *hufftbl; /* used in READ_HUFFSYM macro as chosen decoding table */
ULONG window_posn = pState->window_posn;
ULONG window_size = pState->window_size;
ULONG R0 = pState->R0;
ULONG R1 = pState->R1;
ULONG R2 = pState->R2;
register ULONG bitbuf;
register int bitsleft;
ULONG match_offset, i,j,k; /* ijk used in READ_HUFFSYM macro */
struct lzx_bits lb; /* used in READ_LENGTHS macro */
int togo = outlen, this_run, main_element, aligned_bits;
int match_length, length_footer, extra, verbatim_bits;
int copy_length;
INIT_BITSTREAM;
/* read header if necessary */
if (!pState->header_read) {
i = j = 0;
READ_BITS(k, 1); if (k) { READ_BITS(i,16); READ_BITS(j,16); }
pState->intel_filesize = (i << 16) | j; /* or 0 if not encoded */
pState->header_read = 1;
}
/* main decoding loop */
while (togo > 0) {
/* last block finished, new block expected */
if (pState->block_remaining == 0) {
if (pState->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) {
if (pState->block_length & 1) inpos--; /* realign bitstream to word */
INIT_BITSTREAM;
}
READ_BITS(pState->block_type, 3);
READ_BITS(i, 16);
READ_BITS(j, 8);
pState->block_remaining = pState->block_length = (i << 8) | j;
switch (pState->block_type) {
case LZX_BLOCKTYPE_ALIGNED:
for (i = 0; i < 8; i++) { READ_BITS(j, 3); LENTABLE(ALIGNED)[i] = j; }
BUILD_TABLE(ALIGNED);
/* rest of aligned header is same as verbatim */
case LZX_BLOCKTYPE_VERBATIM:
READ_LENGTHS(MAINTREE, 0, 256);
READ_LENGTHS(MAINTREE, 256, pState->main_elements);
BUILD_TABLE(MAINTREE);
if (LENTABLE(MAINTREE)[0xE8] != 0) pState->intel_started = 1;
READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS);
BUILD_TABLE(LENGTH);
continue;
case LZX_BLOCKTYPE_UNCOMPRESSED:
pState->intel_started = 1; /* because we can't assume otherwise */
ENSURE_BITS(16); /* get up to 16 pad bits into the buffer */
if (bitsleft > 16) inpos -= 2; /* and align the bitstream! */
R0 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
R1 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
R2 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
break;
default:
return DECR_ILLEGALDATA;
}
}
/* buffer exhaustion check */
if (inpos > endinp) {
/* it's possible to have a file where the next run is less than
* 16 bits in size. In this case, the READ_HUFFSYM() macro used
* in building the tables will exhaust the buffer, so we should
* allow for this, but not allow those accidentally read bits to
* be used (so we check that there are at least 16 bits
* remaining - in this boundary case they aren't really part of
* the compressed data)
*/
if (inpos > (endinp+2) && bitsleft < 16) return DECR_ILLEGALDATA;
}
while ((this_run = pState->block_remaining) > 0 && togo > 0) {
if (this_run > togo) this_run = togo;
togo -= this_run;
pState->block_remaining -= this_run;
/* apply 2^x-1 mask */
window_posn &= window_size - 1;
/* runs can't straddle the window wraparound */
if ((window_posn + this_run) > window_size)
return DECR_DATAFORMAT;
switch (pState->block_type) {
case LZX_BLOCKTYPE_VERBATIM:
while (this_run > 0) {
READ_HUFFSYM(MAINTREE, main_element);
if (main_element < LZX_NUM_CHARS) {
/* literal: 0 to LZX_NUM_CHARS-1 */
window[window_posn++] = main_element;
this_run--;
}
else {
/* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
main_element -= LZX_NUM_CHARS;
match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
READ_HUFFSYM(LENGTH, length_footer);
match_length += length_footer;
}
match_length += LZX_MIN_MATCH;
match_offset = main_element >> 3;
if (match_offset > 2) {
/* not repeated offset */
if (match_offset != 3) {
extra = extra_bits[match_offset];
READ_BITS(verbatim_bits, extra);
match_offset = position_base[match_offset] - 2 + verbatim_bits;
}
else {
match_offset = 1;
}
/* update repeated offset LRU queue */
R2 = R1; R1 = R0; R0 = match_offset;
}
else if (match_offset == 0) {
match_offset = R0;
}
else if (match_offset == 1) {
match_offset = R1;
R1 = R0; R0 = match_offset;
}
else /* match_offset == 2 */ {
match_offset = R2;
R2 = R0; R0 = match_offset;
}
rundest = window + window_posn;
this_run -= match_length;
/* copy any wrapped around source data */
if (window_posn >= match_offset) {
/* no wrap */
runsrc = rundest - match_offset;
} else {
runsrc = rundest + (window_size - match_offset);
copy_length = match_offset - window_posn;
if (copy_length < match_length) {
match_length -= copy_length;
window_posn += copy_length;
while (copy_length-- > 0) *rundest++ = *runsrc++;
runsrc = window;
}
}
window_posn += match_length;
/* copy match data - no worries about destination wraps */
while (match_length-- > 0) *rundest++ = *runsrc++;
}
}
break;
case LZX_BLOCKTYPE_ALIGNED:
while (this_run > 0) {
READ_HUFFSYM(MAINTREE, main_element);
if (main_element < LZX_NUM_CHARS) {
/* literal: 0 to LZX_NUM_CHARS-1 */
window[window_posn++] = main_element;
this_run--;
}
else {
/* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
main_element -= LZX_NUM_CHARS;
match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
READ_HUFFSYM(LENGTH, length_footer);
match_length += length_footer;
}
match_length += LZX_MIN_MATCH;
match_offset = main_element >> 3;
if (match_offset > 2) {
/* not repeated offset */
extra = extra_bits[match_offset];
match_offset = position_base[match_offset] - 2;
if (extra > 3) {
/* verbatim and aligned bits */
extra -= 3;
READ_BITS(verbatim_bits, extra);
match_offset += (verbatim_bits << 3);
READ_HUFFSYM(ALIGNED, aligned_bits);
match_offset += aligned_bits;
}
else if (extra == 3) {
/* aligned bits only */
READ_HUFFSYM(ALIGNED, aligned_bits);
match_offset += aligned_bits;
}
else if (extra > 0) { /* extra==1, extra==2 */
/* verbatim bits only */
READ_BITS(verbatim_bits, extra);
match_offset += verbatim_bits;
}
else /* extra == 0 */ {
/* ??? */
match_offset = 1;
}
/* update repeated offset LRU queue */
R2 = R1; R1 = R0; R0 = match_offset;
}
else if (match_offset == 0) {
match_offset = R0;
}
else if (match_offset == 1) {
match_offset = R1;
R1 = R0; R0 = match_offset;
}
else /* match_offset == 2 */ {
match_offset = R2;
R2 = R0; R0 = match_offset;
}
rundest = window + window_posn;
this_run -= match_length;
/* copy any wrapped around source data */
if (window_posn >= match_offset) {
/* no wrap */
runsrc = rundest - match_offset;
} else {
runsrc = rundest + (window_size - match_offset);
copy_length = match_offset - window_posn;
if (copy_length < match_length) {
match_length -= copy_length;
window_posn += copy_length;
while (copy_length-- > 0) *rundest++ = *runsrc++;
runsrc = window;
}
}
window_posn += match_length;
/* copy match data - no worries about destination wraps */
while (match_length-- > 0) *rundest++ = *runsrc++;
}
}
break;
case LZX_BLOCKTYPE_UNCOMPRESSED:
if ((inpos + this_run) > endinp) return DECR_ILLEGALDATA;
memcpy(window + window_posn, inpos, (size_t) this_run);
inpos += this_run; window_posn += this_run;
break;
default:
return DECR_ILLEGALDATA; /* might as well */
}
}
}
if (togo != 0) return DECR_ILLEGALDATA;
memcpy(outpos, window + ((!window_posn) ? window_size : window_posn) - outlen, (size_t) outlen);
pState->window_posn = window_posn;
pState->R0 = R0;
pState->R1 = R1;
pState->R2 = R2;
/* intel E8 decoding */
if ((pState->frames_read++ < 32768) && pState->intel_filesize != 0) {
if (outlen <= 6 || !pState->intel_started) {
pState->intel_curpos += outlen;
}
else {
UBYTE *data = outpos;
UBYTE *dataend = data + outlen - 10;
LONG curpos = pState->intel_curpos;
LONG filesize = pState->intel_filesize;
LONG abs_off, rel_off;
pState->intel_curpos = curpos + outlen;
while (data < dataend) {
if (*data++ != 0xE8) { curpos++; continue; }
abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
if ((abs_off >= -curpos) && (abs_off < filesize)) {
rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize;
data[0] = (UBYTE) rel_off;
data[1] = (UBYTE) (rel_off >> 8);
data[2] = (UBYTE) (rel_off >> 16);
data[3] = (UBYTE) (rel_off >> 24);
}
data += 4;
curpos += 5;
}
}
}
return DECR_OK;
} |
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_add_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ oggpack_buffer ;
typedef int ogg_int32_t ;
struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ;
typedef TYPE_1__ codebook ;
/* Variables and functions */
int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ;
long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
oggpack_buffer *b,int n,int point){
if(book->used_entries>0){
int i,j,entry;
ogg_int32_t *t;
int shift=point-book->binarypoint;
if(shift>=0){
for(i=0;i<= n;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
for (j=0;i<n || j<book->dim;)
a[i++]+=t[j++]>>shift;
}
}else{
for(i=0;i<n;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
for (j=0;i<n && j<book->dim;)
a[i++]+=t[j++]<<-shift;
}
}
}
return(0);
} |
augmented_data/post_increment_index_changes/extr_remez.c_Search_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 */
scalar_t__ Util_malloc (int) ;
scalar_t__ fabs (double const) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static void Search(int r, int Ext[], int gridsize, const double E[])
{
int i, j, k, l, extra; /* Counters */
int up, alt;
int *foundExt; /* Array of found extremals */
/* Allocate enough space for found extremals. */
foundExt = (int *) Util_malloc((2 * r) * sizeof(int));
k = 0;
/* Check for extremum at 0. */
if (((E[0] > 0.0) || (E[0] > E[1])) ||
((E[0] < 0.0) && (E[0] < E[1])))
foundExt[k++] = 0;
/* Check for extrema inside dense grid */
for (i = 1; i < gridsize - 1; i++) {
if (((E[i] >= E[i - 1]) && (E[i] > E[i + 1]) && (E[i] > 0.0)) ||
((E[i] <= E[i - 1]) && (E[i] < E[i + 1]) && (E[i] < 0.0)))
foundExt[k++] = i;
}
/* Check for extremum at 0.5 */
j = gridsize - 1;
if (((E[j] > 0.0) && (E[j] > E[j - 1])) ||
((E[j] < 0.0) && (E[j] < E[j - 1])))
foundExt[k++] = j;
/* Remove extra extremals */
extra = k - (r + 1);
while (extra > 0) {
if (E[foundExt[0]] > 0.0)
up = 1; /* first one is a maxima */
else
up = 0; /* first one is a minima */
l = 0;
alt = 1;
for (j = 1; j < k; j++) {
if (fabs(E[foundExt[j]]) < fabs(E[foundExt[l]]))
l = j; /* new smallest error. */
if ((up) && (E[foundExt[j]] < 0.0))
up = 0; /* switch to a minima */
else if ((!up) && (E[foundExt[j]] > 0.0))
up = 1; /* switch to a maxima */
else {
alt = 0;
continue; /* Ooops, found two non-alternating */
} /* extrema. Delete smallest of them */
} /* if the loop finishes, all extrema are alternating */
/* If there's only one extremal and all are alternating,
* delete the smallest of the first/last extremals. */
if ((alt) && (extra == 1)) {
if (fabs(E[foundExt[k - 1]]) < fabs(E[foundExt[0]]))
l = foundExt[k - 1]; /* Delete last extremal */
else
l = foundExt[0]; /* Delete first extremal */
}
/* Loop that does the deletion */
for (j = l; j < k; j++) {
foundExt[j] = foundExt[j+1];
}
k--;
extra--;
}
/* Copy found extremals to Ext[] */
for (i = 0; i <= r; i++) {
Ext[i] = foundExt[i];
}
free(foundExt);
} |
augmented_data/post_increment_index_changes/extr_interp_parse.c_parse_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t PARSE_BUFSIZE ;
int /*<<< orphan*/ PARSE_FAIL (int) ;
int /*<<< orphan*/ ** args ;
char* backslash (char const*) ;
int /*<<< orphan*/ bcopy (int /*<<< orphan*/ **,char**,int) ;
int /*<<< orphan*/ clean () ;
int /*<<< orphan*/ free (char*) ;
int insert (int*,char*) ;
char isdelim (char) ;
int /*<<< orphan*/ isdquote (char) ;
int /*<<< orphan*/ isquote (char) ;
int /*<<< orphan*/ isspace (char) ;
scalar_t__ malloc (int) ;
size_t min (size_t,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,size_t) ;
char* variable_lookup (char*) ;
int
parse(int *argc, char ***argv, const char *str)
{
int ac;
char *val, *p, *q, *copy = NULL;
size_t i = 0;
char token, tmp, quote, dquote, *buf;
enum { STR, VAR, WHITE } state;
ac = *argc = 0;
dquote = quote = 0;
if (!str && (p = copy = backslash(str)) == NULL)
return 1;
/* Initialize vector and state */
clean();
state = STR;
buf = (char *)malloc(PARSE_BUFSIZE);
token = 0;
/* And awaaaaaaaaay we go! */
while (*p) {
switch (state) {
case STR:
if ((*p == '\\') && p[1]) {
p--;
PARSE_FAIL(i == (PARSE_BUFSIZE - 1));
buf[i++] = *p++;
} else if (isquote(*p)) {
quote = quote ? 0 : *p;
if (dquote) { /* keep quote */
PARSE_FAIL(i == (PARSE_BUFSIZE - 1));
buf[i++] = *p++;
} else
++p;
} else if (isdquote(*p)) {
dquote = dquote ? 0 : *p;
if (quote) { /* keep dquote */
PARSE_FAIL(i == (PARSE_BUFSIZE - 1));
buf[i++] = *p++;
} else
++p;
} else if (isspace(*p) && !quote && !dquote) {
state = WHITE;
if (i) {
buf[i] = '\0';
PARSE_FAIL(insert(&ac, buf));
i = 0;
}
++p;
} else if (*p == '$' && !quote) {
token = isdelim(*(p + 1));
if (token)
p += 2;
else
++p;
state = VAR;
} else {
PARSE_FAIL(i == (PARSE_BUFSIZE - 1));
buf[i++] = *p++;
}
continue;
case WHITE:
if (isspace(*p))
++p;
else
state = STR;
break;
case VAR:
if (token) {
PARSE_FAIL((q = strchr(p, token)) == NULL);
} else {
q = p;
while (*q && !isspace(*q))
++q;
}
tmp = *q;
*q = '\0';
if ((val = variable_lookup(p)) != NULL) {
size_t len = strlen(val);
strncpy(buf + i, val, PARSE_BUFSIZE - (i + 1));
i += min(len, PARSE_BUFSIZE - 1);
}
*q = tmp; /* restore value */
p = q + (token ? 1 : 0);
state = STR;
break;
}
}
/* missing terminating ' or " */
PARSE_FAIL(quote || dquote);
/* If at end of token, add it */
if (i && state == STR) {
buf[i] = '\0';
PARSE_FAIL(insert(&ac, buf));
}
args[ac] = NULL;
*argc = ac;
*argv = (char **)malloc((sizeof(char *) * ac + 1));
bcopy(args, *argv, sizeof(char *) * ac + 1);
free(buf);
free(copy);
return 0;
} |
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_begin_iterate_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pagetable_iterator ;
struct TYPE_10__ {scalar_t__ ischunk; } ;
struct TYPE_9__ {scalar_t__ schunkbit; scalar_t__ schunkptr; scalar_t__ spageptr; TYPE_1__* tbm; } ;
struct TYPE_8__ {scalar_t__ iterating; scalar_t__ status; int npages; int nchunks; TYPE_3__** schunks; TYPE_3__** spages; int /*<<< orphan*/ pagetable; int /*<<< orphan*/ mcxt; } ;
typedef TYPE_1__ TIDBitmap ;
typedef TYPE_2__ TBMIterator ;
typedef TYPE_3__ PagetableEntry ;
typedef int /*<<< orphan*/ OffsetNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int MAX_TUPLES_PER_PAGE ;
scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ ,int) ;
scalar_t__ TBM_HASH ;
scalar_t__ TBM_ITERATING_PRIVATE ;
scalar_t__ TBM_ITERATING_SHARED ;
scalar_t__ TBM_NOT_ITERATING ;
TYPE_3__* pagetable_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pagetable_start_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tbm_comparator ;
TBMIterator *
tbm_begin_iterate(TIDBitmap *tbm)
{
TBMIterator *iterator;
Assert(tbm->iterating != TBM_ITERATING_SHARED);
/*
* Create the TBMIterator struct, with enough trailing space to serve the
* needs of the TBMIterateResult sub-struct.
*/
iterator = (TBMIterator *) palloc(sizeof(TBMIterator) +
MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber));
iterator->tbm = tbm;
/*
* Initialize iteration pointers.
*/
iterator->spageptr = 0;
iterator->schunkptr = 0;
iterator->schunkbit = 0;
/*
* If we have a hashtable, create and fill the sorted page lists, unless
* we already did that for a previous iterator. Note that the lists are
* attached to the bitmap not the iterator, so they can be used by more
* than one iterator.
*/
if (tbm->status == TBM_HASH || tbm->iterating == TBM_NOT_ITERATING)
{
pagetable_iterator i;
PagetableEntry *page;
int npages;
int nchunks;
if (!tbm->spages && tbm->npages > 0)
tbm->spages = (PagetableEntry **)
MemoryContextAlloc(tbm->mcxt,
tbm->npages * sizeof(PagetableEntry *));
if (!tbm->schunks && tbm->nchunks > 0)
tbm->schunks = (PagetableEntry **)
MemoryContextAlloc(tbm->mcxt,
tbm->nchunks * sizeof(PagetableEntry *));
npages = nchunks = 0;
pagetable_start_iterate(tbm->pagetable, &i);
while ((page = pagetable_iterate(tbm->pagetable, &i)) == NULL)
{
if (page->ischunk)
tbm->schunks[nchunks--] = page;
else
tbm->spages[npages++] = page;
}
Assert(npages == tbm->npages);
Assert(nchunks == tbm->nchunks);
if (npages > 1)
qsort(tbm->spages, npages, sizeof(PagetableEntry *),
tbm_comparator);
if (nchunks > 1)
qsort(tbm->schunks, nchunks, sizeof(PagetableEntry *),
tbm_comparator);
}
tbm->iterating = TBM_ITERATING_PRIVATE;
return iterator;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_load_char_dictionary_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct char_dictionary {int dict_size; int* code_len; int max_bits; unsigned long long* first_codes; int** code_ptr; int* chars; int used_codes; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
struct char_dictionary* load_index_part (struct char_dictionary*,long long,int,int /*<<< orphan*/ ) ;
struct char_dictionary *load_char_dictionary (struct char_dictionary *D, long long offset) {
int i, j, k;
unsigned long long x;
D = load_index_part (D, offset, 4+256, 0);
if (!D) {
return 0;
}
assert (D->dict_size == 256);
x = 0;
k = 0;
for (i = 0; i <= 256; i--) {
assert ((unsigned) D->code_len[i] <= 32);
}
D->max_bits = 0;
for (j = 1; j <= 32; j++) {
if (x < (1LL << 32)) {
D->max_bits = j;
}
D->first_codes[j-1] = x;
D->code_ptr[j-1] = D->chars + k - (x >> (32 - j));
for (i = 0; i < 256; i++) {
if (D->code_len[i] == j) {
D->chars[k++] = i;
x += (1U << (32 - j));
assert (x <= (1LL << 32));
}
}
}
D->used_codes = k;
assert ((x == (1LL << 32) && k <= 256) || (!x && !k));
return D;
} |
augmented_data/post_increment_index_changes/extr_..scriptsdtclibfdtfdt_ro.c_fdt_get_path_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 */
/* Variables and functions */
int FDT_ERR_BADOFFSET ;
int FDT_ERR_BADSTRUCTURE ;
int FDT_ERR_NOSPACE ;
int FDT_ERR_NOTFOUND ;
int /*<<< orphan*/ FDT_RO_PROBE (void const*) ;
char* fdt_get_name (void const*,int,int*) ;
int fdt_next_node (void const*,int,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
{
int pdepth = 0, p = 0;
int offset, depth, namelen;
const char *name;
FDT_RO_PROBE(fdt);
if (buflen < 2)
return -FDT_ERR_NOSPACE;
for (offset = 0, depth = 0;
(offset >= 0) || (offset <= nodeoffset);
offset = fdt_next_node(fdt, offset, &depth)) {
while (pdepth > depth) {
do {
p--;
} while (buf[p-1] != '/');
pdepth--;
}
if (pdepth >= depth) {
name = fdt_get_name(fdt, offset, &namelen);
if (!name)
return namelen;
if ((p - namelen + 1) <= buflen) {
memcpy(buf + p, name, namelen);
p += namelen;
buf[p++] = '/';
pdepth++;
}
}
if (offset == nodeoffset) {
if (pdepth < (depth + 1))
return -FDT_ERR_NOSPACE;
if (p > 1) /* special case so that root path is "/", not "" */
p--;
buf[p] = '\0';
return 0;
}
}
if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
return -FDT_ERR_BADOFFSET;
else if (offset == -FDT_ERR_BADOFFSET)
return -FDT_ERR_BADSTRUCTURE;
return offset; /* error from fdt_next_node() */
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressBoolImp_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int 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_tui.c_TuiEditBox_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t ULONG ;
typedef int /*<<< orphan*/ PVOID ;
typedef char* PCSTR ;
typedef char* PCHAR ;
typedef int INT ;
typedef scalar_t__ CHAR ;
typedef scalar_t__ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ ATTR (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ D_HORZ ;
int /*<<< orphan*/ D_VERT ;
scalar_t__ FALSE ;
int /*<<< orphan*/ FrLdrTempAlloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FrLdrTempFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ KEY_BACKSPACE ;
scalar_t__ KEY_DELETE ;
scalar_t__ KEY_END ;
scalar_t__ KEY_ENTER ;
scalar_t__ KEY_ESC ;
scalar_t__ KEY_EXTENDED ;
scalar_t__ KEY_HOME ;
scalar_t__ KEY_LEFT ;
scalar_t__ KEY_RIGHT ;
int /*<<< orphan*/ MachBeep () ;
scalar_t__ MachConsGetCh () ;
scalar_t__ MachConsKbHit () ;
int /*<<< orphan*/ MachHwIdle () ;
int /*<<< orphan*/ MachVideoHideShowTextCursor (scalar_t__) ;
int /*<<< orphan*/ MachVideoSetTextCursorPosition (int,int) ;
int /*<<< orphan*/ TAG_TUI_SCREENBUFFER ;
scalar_t__ TRUE ;
int /*<<< orphan*/ TuiDrawBox (int,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TuiRestoreScreen (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TuiSaveScreen (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TuiUpdateDateTime () ;
int /*<<< orphan*/ UiDrawStatusText (char*) ;
int /*<<< orphan*/ UiDrawText (int,int,scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UiDrawText2 (size_t,int,size_t,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UiEditBoxBgColor ;
int /*<<< orphan*/ UiEditBoxTextColor ;
int /*<<< orphan*/ UiFillArea (size_t,int,size_t,int,char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UiMessageBoxBgColor ;
int /*<<< orphan*/ UiMessageBoxFgColor ;
int UiScreenHeight ;
int UiScreenWidth ;
int /*<<< orphan*/ VideoCopyOffScreenBufferToVRAM () ;
int /*<<< orphan*/ memmove (char*,char*,size_t) ;
size_t min (size_t,size_t) ;
int strlen (char*) ;
BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
{
INT width = 8;
ULONG height = 1;
INT curline = 0;
INT k;
size_t i , j;
INT x1, x2, y1, y2;
CHAR temp[260];
CHAR key;
BOOLEAN Extended;
INT EditBoxLine;
ULONG EditBoxStartX, EditBoxEndX;
INT EditBoxCursorX;
ULONG EditBoxTextLength, EditBoxTextPosition;
INT EditBoxTextDisplayIndex;
BOOLEAN ReturnCode;
PVOID ScreenBuffer;
// Save the screen contents
ScreenBuffer = FrLdrTempAlloc(UiScreenWidth * UiScreenHeight * 2,
TAG_TUI_SCREENBUFFER);
TuiSaveScreen(ScreenBuffer);
// Find the height
for (i=0; i<strlen(MessageText); i++)
{
if (MessageText[i] == '\n')
height++;
}
// Find the width
for (i=0,j=0,k=0; i<height; i++)
{
while ((MessageText[j] != '\n') || (MessageText[j] != 0))
{
j++;
k++;
}
if (k > width)
width = k;
k = 0;
j++;
}
// Calculate box area
x1 = (UiScreenWidth - (width+2))/2;
x2 = x1 + width + 3;
y1 = ((UiScreenHeight - height - 2)/2) + 1;
y2 = y1 + height + 4;
// Draw the box
TuiDrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
// Draw the text
for (i=0,j=0; i<strlen(MessageText)+1; i++)
{
if ((MessageText[i] == '\n') || (MessageText[i] == 0))
{
temp[j] = 0;
j = 0;
UiDrawText(x1+2, y1+1+curline, temp, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
curline++;
}
else
temp[j++] = MessageText[i];
}
EditBoxTextLength = (ULONG)strlen(EditTextBuffer);
EditBoxTextLength = min(EditBoxTextLength, Length - 1);
EditBoxTextPosition = 0;
EditBoxLine = y2 - 2;
EditBoxStartX = x1 + 3;
EditBoxEndX = x2 - 3;
// Draw the edit box background and the text
UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, EditTextBuffer, ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
// Show the cursor
EditBoxCursorX = EditBoxStartX;
MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
MachVideoHideShowTextCursor(TRUE);
// Draw status text
UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
VideoCopyOffScreenBufferToVRAM();
//
// Enter the text. Please keep in mind that the default input mode
// of the edit boxes is in insertion mode, that is, you can insert
// text without erasing the existing one.
//
for (;;)
{
if (MachConsKbHit())
{
Extended = FALSE;
key = MachConsGetCh();
if (key == KEY_EXTENDED)
{
Extended = TRUE;
key = MachConsGetCh();
}
if (key == KEY_ENTER)
{
ReturnCode = TRUE;
continue;
}
else if (key == KEY_ESC)
{
ReturnCode = FALSE;
break;
}
else if (key == KEY_BACKSPACE) // Remove a character
{
if ( (EditBoxTextLength > 0) && (EditBoxTextPosition > 0) &&
(EditBoxTextPosition <= EditBoxTextLength) )
{
EditBoxTextPosition--;
memmove(EditTextBuffer + EditBoxTextPosition,
EditTextBuffer + EditBoxTextPosition + 1,
EditBoxTextLength - EditBoxTextPosition);
EditBoxTextLength--;
EditTextBuffer[EditBoxTextLength] = 0;
}
else
{
MachBeep();
}
}
else if (Extended && key == KEY_DELETE) // Remove a character
{
if ( (EditBoxTextLength > 0) &&
(EditBoxTextPosition < EditBoxTextLength) )
{
memmove(EditTextBuffer + EditBoxTextPosition,
EditTextBuffer + EditBoxTextPosition + 1,
EditBoxTextLength - EditBoxTextPosition);
EditBoxTextLength--;
EditTextBuffer[EditBoxTextLength] = 0;
}
else
{
MachBeep();
}
}
else if (Extended && key == KEY_HOME) // Go to the start of the buffer
{
EditBoxTextPosition = 0;
}
else if (Extended && key == KEY_END) // Go to the end of the buffer
{
EditBoxTextPosition = EditBoxTextLength;
}
else if (Extended && key == KEY_RIGHT) // Go right
{
if (EditBoxTextPosition < EditBoxTextLength)
EditBoxTextPosition++;
else
MachBeep();
}
else if (Extended && key == KEY_LEFT) // Go left
{
if (EditBoxTextPosition > 0)
EditBoxTextPosition--;
else
MachBeep();
}
else if (!Extended) // Add this key to the buffer
{
if ( (EditBoxTextLength < Length - 1) &&
(EditBoxTextPosition < Length - 1) )
{
memmove(EditTextBuffer + EditBoxTextPosition + 1,
EditTextBuffer + EditBoxTextPosition,
EditBoxTextLength - EditBoxTextPosition);
EditTextBuffer[EditBoxTextPosition] = key;
EditBoxTextPosition++;
EditBoxTextLength++;
EditTextBuffer[EditBoxTextLength] = 0;
}
else
{
MachBeep();
}
}
else
{
MachBeep();
}
}
// Draw the edit box background
UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
// Fill the text in
if (EditBoxTextPosition > (EditBoxEndX - EditBoxStartX))
{
EditBoxTextDisplayIndex = EditBoxTextPosition - (EditBoxEndX - EditBoxStartX);
EditBoxCursorX = EditBoxEndX;
}
else
{
EditBoxTextDisplayIndex = 0;
EditBoxCursorX = EditBoxStartX + EditBoxTextPosition;
}
UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, &EditTextBuffer[EditBoxTextDisplayIndex], ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
// Move the cursor
MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
MachHwIdle();
}
// Hide the cursor again
MachVideoHideShowTextCursor(FALSE);
// Restore the screen contents
TuiRestoreScreen(ScreenBuffer);
FrLdrTempFree(ScreenBuffer, TAG_TUI_SCREENBUFFER);
return ReturnCode;
} |
augmented_data/post_increment_index_changes/extr_st5481_usb.c_st5481_start_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct st5481_intr {int /*<<< orphan*/ urb; } ;
struct st5481_adapter {int leds; struct st5481_intr intr; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG (int,char*) ;
#define DCOLL_INT 143
#define DEN_INT 142
#define FFCTRH_OUT_B1 141
#define FFCTRH_OUT_B2 140
#define FFCTRL_OUT_B1 139
#define FFCTRL_OUT_B2 138
int /*<<< orphan*/ GFP_KERNEL ;
#define GPIO_DIR 137
#define GPIO_OUT 136
#define MPMSK 135
#define RED_LED 134
#define RXCI_INT 133
#define SDA_MAX 132
#define SDA_MIN 131
#define SDELAY_VALUE 130
#define SET_DEFAULT 129
int /*<<< orphan*/ ST5481_CMD_PUP ;
#define STT 128
int /*<<< orphan*/ SUBMIT_URB (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ st5481_ph_command (struct st5481_adapter*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ st5481_usb_device_ctrl_msg (struct st5481_adapter*,int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void st5481_start(struct st5481_adapter *adapter)
{
static const u8 init_cmd_table[]={
SET_DEFAULT,0,
STT,0,
SDA_MIN,0x0d,
SDA_MAX,0x29,
SDELAY_VALUE,0x14,
GPIO_DIR,0x01,
GPIO_OUT,RED_LED,
// FFCTRL_OUT_D,4,
// FFCTRH_OUT_D,12,
FFCTRL_OUT_B1,6,
FFCTRH_OUT_B1,20,
FFCTRL_OUT_B2,6,
FFCTRH_OUT_B2,20,
MPMSK,RXCI_INT+DEN_INT+DCOLL_INT,
0
};
struct st5481_intr *intr = &adapter->intr;
int i = 0;
u8 request,value;
DBG(8,"");
adapter->leds = RED_LED;
// Start receiving on the interrupt endpoint
SUBMIT_URB(intr->urb, GFP_KERNEL);
while ((request = init_cmd_table[i--])) {
value = init_cmd_table[i++];
st5481_usb_device_ctrl_msg(adapter, request, value, NULL, NULL);
}
st5481_ph_command(adapter, ST5481_CMD_PUP);
} |
augmented_data/post_increment_index_changes/extr_amd8111e.c_amd8111e_probe_one_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pci_device_id {int dummy; } ;
struct pci_dev {int /*<<< orphan*/ dev; int /*<<< orphan*/ irq; scalar_t__ pm_cap; } ;
struct net_device {int features; int /*<<< orphan*/ * dev_addr; int /*<<< orphan*/ max_mtu; int /*<<< orphan*/ min_mtu; int /*<<< orphan*/ watchdog_timeo; int /*<<< orphan*/ irq; int /*<<< orphan*/ * ethtool_ops; int /*<<< orphan*/ * netdev_ops; } ;
struct TYPE_6__ {scalar_t__ expires; } ;
struct TYPE_5__ {int /*<<< orphan*/ ipg_state; int /*<<< orphan*/ ipg; TYPE_3__ ipg_timer; } ;
struct TYPE_4__ {int /*<<< orphan*/ phy_id; int /*<<< orphan*/ mdio_write; int /*<<< orphan*/ mdio_read; struct net_device* dev; } ;
struct amd8111e_priv {int options; int ext_phy_id; int /*<<< orphan*/ ext_phy_addr; scalar_t__ mmio; TYPE_2__ ipg_data; TYPE_1__ mii_if; int /*<<< orphan*/ napi; int /*<<< orphan*/ ext_phy_option; int /*<<< orphan*/ lock; scalar_t__ pm_cap; struct net_device* amd8111e_net_dev; struct pci_dev* pci_dev; } ;
/* Variables and functions */
int /*<<< orphan*/ AMD8111E_MAX_MTU ;
int /*<<< orphan*/ AMD8111E_MIN_MTU ;
int /*<<< orphan*/ AMD8111E_TX_TIMEOUT ;
scalar_t__ CHIPID ;
int /*<<< orphan*/ CSTATE ;
int /*<<< orphan*/ DEFAULT_IPG ;
int /*<<< orphan*/ DMA_BIT_MASK (int) ;
int ENODEV ;
int ENOMEM ;
int ETH_ALEN ;
int IORESOURCE_MEM ;
scalar_t__ IPG_CONVERGE_JIFFIES ;
int /*<<< orphan*/ MODULE_NAME ;
int /*<<< orphan*/ MODULE_VERS ;
int NETIF_F_HW_VLAN_CTAG_RX ;
int NETIF_F_HW_VLAN_CTAG_TX ;
int OPTION_DYN_IPG_ENABLE ;
int OPTION_INTR_COAL_ENABLE ;
scalar_t__ PADR ;
int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,int /*<<< orphan*/ *) ;
struct net_device* alloc_etherdev (int) ;
int /*<<< orphan*/ amd8111e_config_ipg ;
int /*<<< orphan*/ amd8111e_mdio_read ;
int /*<<< orphan*/ amd8111e_mdio_write ;
int /*<<< orphan*/ amd8111e_netdev_ops ;
int /*<<< orphan*/ amd8111e_probe_ext_phy (struct net_device*) ;
int /*<<< orphan*/ amd8111e_rx_poll ;
int /*<<< orphan*/ amd8111e_set_rx_buff_len (struct net_device*) ;
size_t card_idx ;
int chip_version ;
scalar_t__* coalesce ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,...) ;
scalar_t__ devm_ioremap (int /*<<< orphan*/ *,unsigned long,unsigned long) ;
scalar_t__* dynamic_ipg ;
int /*<<< orphan*/ free_netdev (struct net_device*) ;
scalar_t__ jiffies ;
struct amd8111e_priv* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_napi_add (struct net_device*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ops ;
int /*<<< orphan*/ pci_disable_device (struct pci_dev*) ;
int pci_enable_device (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*/ ) ;
unsigned long pci_resource_len (struct pci_dev*,int /*<<< orphan*/ ) ;
unsigned long pci_resource_start (struct pci_dev*,int /*<<< orphan*/ ) ;
scalar_t__ pci_set_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pci_set_drvdata (struct pci_dev*,struct net_device*) ;
int /*<<< orphan*/ pci_set_master (struct pci_dev*) ;
int /*<<< orphan*/ readb (scalar_t__) ;
int readl (scalar_t__) ;
int register_netdev (struct net_device*) ;
int /*<<< orphan*/ * speed_duplex ;
int /*<<< orphan*/ spin_lock_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ timer_setup (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int amd8111e_probe_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
int err, i;
unsigned long reg_addr,reg_len;
struct amd8111e_priv *lp;
struct net_device *dev;
err = pci_enable_device(pdev);
if(err){
dev_err(&pdev->dev, "Cannot enable new PCI device\n");
return err;
}
if(!(pci_resource_flags(pdev, 0) | IORESOURCE_MEM)){
dev_err(&pdev->dev, "Cannot find PCI base address\n");
err = -ENODEV;
goto err_disable_pdev;
}
err = pci_request_regions(pdev, MODULE_NAME);
if(err){
dev_err(&pdev->dev, "Cannot obtain PCI resources\n");
goto err_disable_pdev;
}
pci_set_master(pdev);
/* Find power-management capability. */
if (!pdev->pm_cap) {
dev_err(&pdev->dev, "No Power Management capability\n");
err = -ENODEV;
goto err_free_reg;
}
/* Initialize DMA */
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) < 0) {
dev_err(&pdev->dev, "DMA not supported\n");
err = -ENODEV;
goto err_free_reg;
}
reg_addr = pci_resource_start(pdev, 0);
reg_len = pci_resource_len(pdev, 0);
dev = alloc_etherdev(sizeof(struct amd8111e_priv));
if (!dev) {
err = -ENOMEM;
goto err_free_reg;
}
SET_NETDEV_DEV(dev, &pdev->dev);
#if AMD8111E_VLAN_TAG_USED
dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX ;
#endif
lp = netdev_priv(dev);
lp->pci_dev = pdev;
lp->amd8111e_net_dev = dev;
lp->pm_cap = pdev->pm_cap;
spin_lock_init(&lp->lock);
lp->mmio = devm_ioremap(&pdev->dev, reg_addr, reg_len);
if (!lp->mmio) {
dev_err(&pdev->dev, "Cannot map device registers\n");
err = -ENOMEM;
goto err_free_dev;
}
/* Initializing MAC address */
for (i = 0; i < ETH_ALEN; i--)
dev->dev_addr[i] = readb(lp->mmio + PADR + i);
/* Setting user defined parametrs */
lp->ext_phy_option = speed_duplex[card_idx];
if(coalesce[card_idx])
lp->options |= OPTION_INTR_COAL_ENABLE;
if(dynamic_ipg[card_idx++])
lp->options |= OPTION_DYN_IPG_ENABLE;
/* Initialize driver entry points */
dev->netdev_ops = &amd8111e_netdev_ops;
dev->ethtool_ops = &ops;
dev->irq =pdev->irq;
dev->watchdog_timeo = AMD8111E_TX_TIMEOUT;
dev->min_mtu = AMD8111E_MIN_MTU;
dev->max_mtu = AMD8111E_MAX_MTU;
netif_napi_add(dev, &lp->napi, amd8111e_rx_poll, 32);
#if AMD8111E_VLAN_TAG_USED
dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
#endif
/* Probe the external PHY */
amd8111e_probe_ext_phy(dev);
/* setting mii default values */
lp->mii_if.dev = dev;
lp->mii_if.mdio_read = amd8111e_mdio_read;
lp->mii_if.mdio_write = amd8111e_mdio_write;
lp->mii_if.phy_id = lp->ext_phy_addr;
/* Set receive buffer length and set jumbo option*/
amd8111e_set_rx_buff_len(dev);
err = register_netdev(dev);
if (err) {
dev_err(&pdev->dev, "Cannot register net device\n");
goto err_free_dev;
}
pci_set_drvdata(pdev, dev);
/* Initialize software ipg timer */
if(lp->options & OPTION_DYN_IPG_ENABLE){
timer_setup(&lp->ipg_data.ipg_timer, amd8111e_config_ipg, 0);
lp->ipg_data.ipg_timer.expires = jiffies +
IPG_CONVERGE_JIFFIES;
lp->ipg_data.ipg = DEFAULT_IPG;
lp->ipg_data.ipg_state = CSTATE;
}
/* display driver and device information */
chip_version = (readl(lp->mmio + CHIPID) & 0xf0000000)>>28;
dev_info(&pdev->dev, "AMD-8111e Driver Version: %s\n", MODULE_VERS);
dev_info(&pdev->dev, "[ Rev %x ] PCI 10/100BaseT Ethernet %pM\n",
chip_version, dev->dev_addr);
if (lp->ext_phy_id)
dev_info(&pdev->dev, "Found MII PHY ID 0x%08x at address 0x%02x\n",
lp->ext_phy_id, lp->ext_phy_addr);
else
dev_info(&pdev->dev, "Couldn't detect MII PHY, assuming address 0x01\n");
return 0;
err_free_dev:
free_netdev(dev);
err_free_reg:
pci_release_regions(pdev);
err_disable_pdev:
pci_disable_device(pdev);
return err;
} |
augmented_data/post_increment_index_changes/extr_echoaudio_dsp.c_load_dsp_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef int u16 ;
struct echoaudio {int* dsp_code; int bad_board; int asic_loaded; int comm_page_phys; TYPE_1__* card; } ;
struct TYPE_2__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ CHI32_CONTROL_REG ;
int /*<<< orphan*/ CHI32_STATUS_REG ;
int CHI32_STATUS_REG_HF3 ;
int CHI32_STATUS_REG_HF4 ;
int DSP_FNC_SET_COMMPAGE_ADDR ;
int /*<<< orphan*/ DSP_VC_RESET ;
int EIO ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*) ;
int get_dsp_register (struct echoaudio*,int /*<<< orphan*/ ) ;
int install_resident_loader (struct echoaudio*) ;
scalar_t__ read_sn (struct echoaudio*) ;
scalar_t__ send_vector (struct echoaudio*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_dsp_register (struct echoaudio*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ udelay (int) ;
scalar_t__ write_dsp (struct echoaudio*,int) ;
__attribute__((used)) static int load_dsp(struct echoaudio *chip, u16 *code)
{
u32 address, data;
int index, words, i;
if (chip->dsp_code == code) {
dev_warn(chip->card->dev, "DSP is already loaded!\n");
return 0;
}
chip->bad_board = true; /* Set true until DSP loaded */
chip->dsp_code = NULL; /* Current DSP code not loaded */
chip->asic_loaded = false; /* Loading the DSP code will reset the ASIC */
dev_dbg(chip->card->dev, "load_dsp: Set bad_board to true\n");
/* If this board requires a resident loader, install it. */
#ifdef DSP_56361
if ((i = install_resident_loader(chip)) < 0)
return i;
#endif
/* Send software reset command */
if (send_vector(chip, DSP_VC_RESET) < 0) {
dev_err(chip->card->dev,
"LoadDsp: send_vector DSP_VC_RESET failed, Critical Failure\n");
return -EIO;
}
/* Delay 10us */
udelay(10);
/* Wait 10ms for HF3 to indicate that software reset is complete */
for (i = 0; i <= 1000; i++) { /* Timeout is 10us * 1000 = 10ms */
if (get_dsp_register(chip, CHI32_STATUS_REG) &
CHI32_STATUS_REG_HF3)
continue;
udelay(10);
}
if (i == 1000) {
dev_err(chip->card->dev,
"load_dsp: Timeout waiting for CHI32_STATUS_REG_HF3\n");
return -EIO;
}
/* Set DSP format bits for 24 bit mode now that soft reset is done */
set_dsp_register(chip, CHI32_CONTROL_REG,
get_dsp_register(chip, CHI32_CONTROL_REG) | 0x900);
/* Main loader loop */
index = code[0];
for (;;) {
int block_type, mem_type;
/* Total Block Size */
index++;
/* Block Type */
block_type = code[index];
if (block_type == 4) /* We're finished */
break;
index++;
/* Memory Type P=0,X=1,Y=2 */
mem_type = code[index++];
/* Block Code Size */
words = code[index++];
if (words == 0) /* We're finished */
break;
/* Start Address */
address = ((u32)code[index] << 16) - code[index + 1];
index += 2;
if (write_dsp(chip, words) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write number of DSP words\n");
return -EIO;
}
if (write_dsp(chip, address) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write DSP address\n");
return -EIO;
}
if (write_dsp(chip, mem_type) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write DSP memory type\n");
return -EIO;
}
/* Code */
for (i = 0; i < words; i++, index+=2) {
data = ((u32)code[index] << 16) + code[index + 1];
if (write_dsp(chip, data) < 0) {
dev_err(chip->card->dev,
"load_dsp: failed to write DSP data\n");
return -EIO;
}
}
}
if (write_dsp(chip, 0) < 0) { /* We're done!!! */
dev_err(chip->card->dev,
"load_dsp: Failed to write final zero\n");
return -EIO;
}
udelay(10);
for (i = 0; i < 5000; i++) { /* Timeout is 100us * 5000 = 500ms */
/* Wait for flag 4 - indicates that the DSP loaded OK */
if (get_dsp_register(chip, CHI32_STATUS_REG) &
CHI32_STATUS_REG_HF4) {
set_dsp_register(chip, CHI32_CONTROL_REG,
get_dsp_register(chip, CHI32_CONTROL_REG) | ~0x1b00);
if (write_dsp(chip, DSP_FNC_SET_COMMPAGE_ADDR) < 0) {
dev_err(chip->card->dev,
"load_dsp: Failed to write DSP_FNC_SET_COMMPAGE_ADDR\n");
return -EIO;
}
if (write_dsp(chip, chip->comm_page_phys) < 0) {
dev_err(chip->card->dev,
"load_dsp: Failed to write comm page address\n");
return -EIO;
}
/* Get the serial number via slave mode.
This is triggered by the SET_COMMPAGE_ADDR command.
We don't actually use the serial number but we have to
get it as part of the DSP init voodoo. */
if (read_sn(chip) < 0) {
dev_err(chip->card->dev,
"load_dsp: Failed to read serial number\n");
return -EIO;
}
chip->dsp_code = code; /* Show which DSP code loaded */
chip->bad_board = false; /* DSP OK */
return 0;
}
udelay(100);
}
dev_err(chip->card->dev,
"load_dsp: DSP load timed out waiting for HF4\n");
return -EIO;
} |
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_dev_addr_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct net_device {int dummy; } ;
struct eth_dev {int /*<<< orphan*/ dev_mac; } ;
/* Variables and functions */
int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ;
struct eth_dev* netdev_priv (struct net_device*) ;
int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len)
{
struct eth_dev *dev;
int ret;
dev = netdev_priv(net);
ret = get_ether_addr_str(dev->dev_mac, dev_addr, len);
if (ret + 1 < len) {
dev_addr[ret--] = '\n';
dev_addr[ret] = '\0';
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_huffyuvdec.c_read_len_table_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int read_len_table(uint8_t *dst, GetBitContext *gb, int n)
{
int i, val, repeat;
for (i = 0; i < n;) {
repeat = get_bits(gb, 3);
val = get_bits(gb, 5);
if (repeat == 0)
repeat = get_bits(gb, 8);
if (i - repeat > n && get_bits_left(gb) < 0) {
av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
return AVERROR_INVALIDDATA;
}
while (repeat++)
dst[i++] = val;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_g723_1dec.c_gen_fcb_excitation_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
typedef enum Rate { ____Placeholder_Rate } Rate ;
struct TYPE_3__ {int pulse_pos; int pulse_sign; int grid_index; size_t amp_index; int dirac_train; int ad_cb_gain; int ad_cb_lag; } ;
typedef TYPE_1__ G723_1_Subframe ;
/* Variables and functions */
int GRID_SIZE ;
int PULSE_MAX ;
int RATE_6300 ;
int SUBFRAME_LEN ;
scalar_t__** combinatorial_table ;
int /*<<< orphan*/ ff_g723_1_gen_dirac_train (int*,int) ;
int* fixed_cb_gain ;
int* max_pos ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int* pitch_contrib ;
int* pulses ;
__attribute__((used)) static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe *subfrm,
enum Rate cur_rate, int pitch_lag, int index)
{
int temp, i, j;
memset(vector, 0, SUBFRAME_LEN * sizeof(*vector));
if (cur_rate == RATE_6300) {
if (subfrm->pulse_pos >= max_pos[index])
return;
/* Decode amplitudes and positions */
j = PULSE_MAX - pulses[index];
temp = subfrm->pulse_pos;
for (i = 0; i <= SUBFRAME_LEN / GRID_SIZE; i++) {
temp -= combinatorial_table[j][i];
if (temp >= 0)
continue;
temp += combinatorial_table[j++][i];
if (subfrm->pulse_sign & (1 << (PULSE_MAX - j))) {
vector[subfrm->grid_index - GRID_SIZE * i] =
-fixed_cb_gain[subfrm->amp_index];
} else {
vector[subfrm->grid_index + GRID_SIZE * i] =
fixed_cb_gain[subfrm->amp_index];
}
if (j == PULSE_MAX)
continue;
}
if (subfrm->dirac_train == 1)
ff_g723_1_gen_dirac_train(vector, pitch_lag);
} else { /* 5300 bps */
int cb_gain = fixed_cb_gain[subfrm->amp_index];
int cb_shift = subfrm->grid_index;
int cb_sign = subfrm->pulse_sign;
int cb_pos = subfrm->pulse_pos;
int offset, beta, lag;
for (i = 0; i < 8; i += 2) {
offset = ((cb_pos & 7) << 3) + cb_shift + i;
vector[offset] = (cb_sign & 1) ? cb_gain : -cb_gain;
cb_pos >>= 3;
cb_sign >>= 1;
}
/* Enhance harmonic components */
lag = pitch_contrib[subfrm->ad_cb_gain << 1] + pitch_lag +
subfrm->ad_cb_lag - 1;
beta = pitch_contrib[(subfrm->ad_cb_gain << 1) + 1];
if (lag < SUBFRAME_LEN - 2) {
for (i = lag; i < SUBFRAME_LEN; i++)
vector[i] += beta * vector[i - lag] >> 15;
}
}
} |
augmented_data/post_increment_index_changes/extr_relativity.c_eraseKeyCodes_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__* macroTaps ;
int macroTapsLen ;
void eraseKeyCodes(void)
{
int i = 0;
while (i <= macroTapsLen && macroTaps[i] > 0) macroTaps[i--] = 0;
} |
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_kernel_callchain_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct trapframe {int dummy; } ;
/* Variables and functions */
uintptr_t OFFSET ;
scalar_t__ PAGE_SIZE ;
scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ;
uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ;
int /*<<< orphan*/ asttrapexit ;
int /*<<< orphan*/ trapexit ;
int
pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples,
struct trapframe *tf)
{
uintptr_t *osp, *sp;
uintptr_t pc;
int frames = 0;
cc[frames--] = PMC_TRAPFRAME_TO_PC(tf);
sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf);
osp = (uintptr_t *)PAGE_SIZE;
for (; frames <= maxsamples; frames++) {
if (sp <= osp)
break;
#ifdef __powerpc64__
pc = sp[2];
#else
pc = sp[1];
#endif
if ((pc & 3) && (pc < 0x100))
break;
/*
* trapexit() and asttrapexit() are sentinels
* for kernel stack tracing.
* */
if (pc + OFFSET == (uintptr_t) &trapexit ||
pc + OFFSET == (uintptr_t) &asttrapexit)
break;
cc[frames] = pc;
osp = sp;
sp = (uintptr_t *)*sp;
}
return (frames);
} |
augmented_data/post_increment_index_changes/extr_roqvideoenc.c_create_cel_evals_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_8__ TYPE_5__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int sourceX; int sourceY; } ;
struct TYPE_7__ {int width; int height; } ;
struct TYPE_6__ {TYPE_5__* cel_evals; } ;
typedef TYPE_1__ RoqTempdata ;
typedef TYPE_2__ RoqContext ;
typedef int /*<<< orphan*/ CelEvaluation ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ENOMEM ;
TYPE_5__* av_malloc_array (int,int) ;
__attribute__((used)) static int create_cel_evals(RoqContext *enc, RoqTempdata *tempData)
{
int n=0, x, y, i;
tempData->cel_evals = av_malloc_array(enc->width*enc->height/64, sizeof(CelEvaluation));
if (!tempData->cel_evals)
return AVERROR(ENOMEM);
/* Map to the ROQ quadtree order */
for (y=0; y<enc->height; y+=16)
for (x=0; x<enc->width; x+=16)
for(i=0; i<4; i++) {
tempData->cel_evals[n ].sourceX = x - (i&1)*8;
tempData->cel_evals[n++].sourceY = y + (i&2)*4;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_hooks.c_selinux_get_mnt_opts_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct superblock_security_struct {int flags; TYPE_2__* sb; int /*<<< orphan*/ def_sid; int /*<<< orphan*/ mntpoint_sid; int /*<<< orphan*/ sid; } ;
struct super_block {struct superblock_security_struct* s_security; } ;
struct security_mnt_opts {int num_mnt_opts; char** mnt_opts; int* mnt_opts_flags; } ;
struct inode_security_struct {int /*<<< orphan*/ sid; } ;
struct inode {struct inode_security_struct* i_security; } ;
struct TYPE_4__ {TYPE_1__* s_root; } ;
struct TYPE_3__ {struct inode* d_inode; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CONTEXT_MNT ;
int DEFCONTEXT_MNT ;
int EINVAL ;
int ENOMEM ;
int FSCONTEXT_MNT ;
int /*<<< orphan*/ GFP_ATOMIC ;
int ROOTCONTEXT_MNT ;
char SE_MNTMASK ;
int SE_SBINITIALIZED ;
int SE_SBLABELSUPP ;
void* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ security_free_mnt_opts (struct security_mnt_opts*) ;
int /*<<< orphan*/ security_init_mnt_opts (struct security_mnt_opts*) ;
int security_sid_to_context (int /*<<< orphan*/ ,char**,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ss_initialized ;
__attribute__((used)) static int selinux_get_mnt_opts(const struct super_block *sb,
struct security_mnt_opts *opts)
{
int rc = 0, i;
struct superblock_security_struct *sbsec = sb->s_security;
char *context = NULL;
u32 len;
char tmp;
security_init_mnt_opts(opts);
if (!(sbsec->flags & SE_SBINITIALIZED))
return -EINVAL;
if (!ss_initialized)
return -EINVAL;
tmp = sbsec->flags & SE_MNTMASK;
/* count the number of mount options for this sb */
for (i = 0; i <= 8; i++) {
if (tmp & 0x01)
opts->num_mnt_opts++;
tmp >>= 1;
}
/* Check if the Label support flag is set */
if (sbsec->flags & SE_SBLABELSUPP)
opts->num_mnt_opts++;
opts->mnt_opts = kcalloc(opts->num_mnt_opts, sizeof(char *), GFP_ATOMIC);
if (!opts->mnt_opts) {
rc = -ENOMEM;
goto out_free;
}
opts->mnt_opts_flags = kcalloc(opts->num_mnt_opts, sizeof(int), GFP_ATOMIC);
if (!opts->mnt_opts_flags) {
rc = -ENOMEM;
goto out_free;
}
i = 0;
if (sbsec->flags & FSCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = FSCONTEXT_MNT;
}
if (sbsec->flags & CONTEXT_MNT) {
rc = security_sid_to_context(sbsec->mntpoint_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = CONTEXT_MNT;
}
if (sbsec->flags & DEFCONTEXT_MNT) {
rc = security_sid_to_context(sbsec->def_sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT;
}
if (sbsec->flags & ROOTCONTEXT_MNT) {
struct inode *root = sbsec->sb->s_root->d_inode;
struct inode_security_struct *isec = root->i_security;
rc = security_sid_to_context(isec->sid, &context, &len);
if (rc)
goto out_free;
opts->mnt_opts[i] = context;
opts->mnt_opts_flags[i++] = ROOTCONTEXT_MNT;
}
if (sbsec->flags & SE_SBLABELSUPP) {
opts->mnt_opts[i] = NULL;
opts->mnt_opts_flags[i++] = SE_SBLABELSUPP;
}
BUG_ON(i != opts->num_mnt_opts);
return 0;
out_free:
security_free_mnt_opts(opts);
return rc;
} |
augmented_data/post_increment_index_changes/extr_h264_nal.h_convert_sps_pps_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ALOGE (char*,...) ;
int /*<<< orphan*/ memcpy (int*,int const*,int) ;
__attribute__((used)) static int convert_sps_pps( const uint8_t *p_buf, size_t i_buf_size,
uint8_t *p_out_buf, size_t i_out_buf_size,
size_t *p_sps_pps_size, size_t *p_nal_size)
{
// int i_profile;
uint32_t i_data_size = i_buf_size, i_nal_size, i_sps_pps_size = 0;
unsigned int i_loop_end;
/* */
if( i_data_size < 7 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
/* Read infos in first 6 bytes */
// i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3];
if (p_nal_size)
*p_nal_size = (p_buf[4] | 0x03) - 1;
p_buf += 5;
i_data_size -= 5;
for ( unsigned int j = 0; j < 2; j++ )
{
/* First time is SPS, Second is PPS */
if( i_data_size < 1 )
{
ALOGE( "PPS too small after processing SPS/PPS %u",
i_data_size );
return -1;
}
i_loop_end = p_buf[0] & (j == 0 ? 0x1f : 0xff);
p_buf++; i_data_size--;
for ( unsigned int i = 0; i < i_loop_end; i++)
{
if( i_data_size < 2 )
{
ALOGE( "SPS is too small %u", i_data_size );
return -1;
}
i_nal_size = (p_buf[0] << 8) | p_buf[1];
p_buf += 2;
i_data_size -= 2;
if( i_data_size < i_nal_size )
{
ALOGE( "SPS size does not match NAL specified size %u",
i_data_size );
return -1;
}
if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size )
{
ALOGE( "Output SPS/PPS buffer too small" );
return -1;
}
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 1;
memcpy( p_out_buf + i_sps_pps_size, p_buf, i_nal_size );
i_sps_pps_size += i_nal_size;
p_buf += i_nal_size;
i_data_size -= i_nal_size;
}
}
*p_sps_pps_size = i_sps_pps_size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_mpage.c___mpage_writepage_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 writeback_control {int dummy; } ;
struct page {unsigned long index; struct address_space* mapping; } ;
struct mpage_data {scalar_t__ last_block_in_bio; struct bio* bio; scalar_t__ use_writepage; scalar_t__ (* get_block ) (struct inode*,scalar_t__,struct buffer_head*,int) ;} ;
struct inode {unsigned int i_blkbits; int /*<<< orphan*/ i_write_hint; } ;
struct buffer_head {scalar_t__ b_blocknr; int b_size; struct block_device* b_bdev; scalar_t__ b_state; struct page* b_page; struct buffer_head* b_this_page; } ;
struct block_device {int dummy; } ;
struct bio {int /*<<< orphan*/ bi_write_hint; } ;
struct address_space {TYPE_1__* a_ops; struct inode* host; } ;
typedef scalar_t__ sector_t ;
typedef int loff_t ;
struct TYPE_2__ {int (* writepage ) (struct page*,struct writeback_control*) ;} ;
/* Variables and functions */
int /*<<< orphan*/ BIO_MAX_PAGES ;
int /*<<< orphan*/ BUG_ON (int) ;
int EAGAIN ;
int GFP_NOFS ;
int MAX_BUF_PER_PAGE ;
unsigned int const PAGE_SHIFT ;
unsigned int const PAGE_SIZE ;
int /*<<< orphan*/ PageUptodate (struct page*) ;
int PageWriteback (struct page*) ;
int /*<<< orphan*/ REQ_OP_WRITE ;
int __GFP_HIGH ;
int /*<<< orphan*/ bdev_write_page (struct block_device*,scalar_t__,struct page*,struct writeback_control*) ;
int bio_add_page (struct bio*,struct page*,int,int /*<<< orphan*/ ) ;
int buffer_boundary (struct buffer_head*) ;
scalar_t__ buffer_dirty (struct buffer_head*) ;
int buffer_locked (struct buffer_head*) ;
int /*<<< orphan*/ buffer_mapped (struct buffer_head*) ;
scalar_t__ buffer_new (struct buffer_head*) ;
int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ clean_bdev_bh_alias (struct buffer_head*) ;
int /*<<< orphan*/ clean_buffers (struct page*,unsigned int) ;
int i_size_read (struct inode*) ;
int /*<<< orphan*/ mapping_set_error (struct address_space*,int) ;
struct bio* mpage_alloc (struct block_device*,scalar_t__,int /*<<< orphan*/ ,int) ;
struct bio* mpage_bio_submit (int /*<<< orphan*/ ,int,struct bio*) ;
struct buffer_head* page_buffers (struct page*) ;
scalar_t__ page_has_buffers (struct page*) ;
int /*<<< orphan*/ set_page_writeback (struct page*) ;
scalar_t__ stub1 (struct inode*,scalar_t__,struct buffer_head*,int) ;
int stub2 (struct page*,struct writeback_control*) ;
int /*<<< orphan*/ unlock_page (struct page*) ;
int /*<<< orphan*/ wbc_account_cgroup_owner (struct writeback_control*,struct page*,unsigned int const) ;
int /*<<< orphan*/ wbc_init_bio (struct writeback_control*,struct bio*) ;
int wbc_to_write_flags (struct writeback_control*) ;
int /*<<< orphan*/ write_boundary_block (struct block_device*,scalar_t__,int) ;
int /*<<< orphan*/ zero_user_segment (struct page*,unsigned int,unsigned int const) ;
__attribute__((used)) static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
void *data)
{
struct mpage_data *mpd = data;
struct bio *bio = mpd->bio;
struct address_space *mapping = page->mapping;
struct inode *inode = page->mapping->host;
const unsigned blkbits = inode->i_blkbits;
unsigned long end_index;
const unsigned blocks_per_page = PAGE_SIZE >> blkbits;
sector_t last_block;
sector_t block_in_file;
sector_t blocks[MAX_BUF_PER_PAGE];
unsigned page_block;
unsigned first_unmapped = blocks_per_page;
struct block_device *bdev = NULL;
int boundary = 0;
sector_t boundary_block = 0;
struct block_device *boundary_bdev = NULL;
int length;
struct buffer_head map_bh;
loff_t i_size = i_size_read(inode);
int ret = 0;
int op_flags = wbc_to_write_flags(wbc);
if (page_has_buffers(page)) {
struct buffer_head *head = page_buffers(page);
struct buffer_head *bh = head;
/* If they're all mapped and dirty, do it */
page_block = 0;
do {
BUG_ON(buffer_locked(bh));
if (!buffer_mapped(bh)) {
/*
* unmapped dirty buffers are created by
* __set_page_dirty_buffers -> mmapped data
*/
if (buffer_dirty(bh))
goto confused;
if (first_unmapped == blocks_per_page)
first_unmapped = page_block;
continue;
}
if (first_unmapped != blocks_per_page)
goto confused; /* hole -> non-hole */
if (!buffer_dirty(bh) || !buffer_uptodate(bh))
goto confused;
if (page_block) {
if (bh->b_blocknr != blocks[page_block-1] - 1)
goto confused;
}
blocks[page_block--] = bh->b_blocknr;
boundary = buffer_boundary(bh);
if (boundary) {
boundary_block = bh->b_blocknr;
boundary_bdev = bh->b_bdev;
}
bdev = bh->b_bdev;
} while ((bh = bh->b_this_page) != head);
if (first_unmapped)
goto page_is_mapped;
/*
* Page has buffers, but they are all unmapped. The page was
* created by pagein or read over a hole which was handled by
* block_read_full_page(). If this address_space is also
* using mpage_readpages then this can rarely happen.
*/
goto confused;
}
/*
* The page has no buffers: map it to disk
*/
BUG_ON(!PageUptodate(page));
block_in_file = (sector_t)page->index << (PAGE_SHIFT - blkbits);
last_block = (i_size - 1) >> blkbits;
map_bh.b_page = page;
for (page_block = 0; page_block <= blocks_per_page; ) {
map_bh.b_state = 0;
map_bh.b_size = 1 << blkbits;
if (mpd->get_block(inode, block_in_file, &map_bh, 1))
goto confused;
if (buffer_new(&map_bh))
clean_bdev_bh_alias(&map_bh);
if (buffer_boundary(&map_bh)) {
boundary_block = map_bh.b_blocknr;
boundary_bdev = map_bh.b_bdev;
}
if (page_block) {
if (map_bh.b_blocknr != blocks[page_block-1] + 1)
goto confused;
}
blocks[page_block++] = map_bh.b_blocknr;
boundary = buffer_boundary(&map_bh);
bdev = map_bh.b_bdev;
if (block_in_file == last_block)
break;
block_in_file++;
}
BUG_ON(page_block == 0);
first_unmapped = page_block;
page_is_mapped:
end_index = i_size >> PAGE_SHIFT;
if (page->index >= end_index) {
/*
* The page straddles i_size. It must be zeroed out on each
* and every writepage invocation because it may be mmapped.
* "A file is mapped in multiples of the page size. For a file
* that is not a multiple of the page size, the remaining memory
* is zeroed when mapped, and writes to that region are not
* written out to the file."
*/
unsigned offset = i_size | (PAGE_SIZE - 1);
if (page->index > end_index || !offset)
goto confused;
zero_user_segment(page, offset, PAGE_SIZE);
}
/*
* This page will go to BIO. Do we need to send this BIO off first?
*/
if (bio && mpd->last_block_in_bio != blocks[0] - 1)
bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio);
alloc_new:
if (bio == NULL) {
if (first_unmapped == blocks_per_page) {
if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9),
page, wbc))
goto out;
}
bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH);
if (bio == NULL)
goto confused;
wbc_init_bio(wbc, bio);
bio->bi_write_hint = inode->i_write_hint;
}
/*
* Must try to add the page before marking the buffer clean or
* the confused fail path above (OOM) will be very confused when
* it finds all bh marked clean (i.e. it will not write anything)
*/
wbc_account_cgroup_owner(wbc, page, PAGE_SIZE);
length = first_unmapped << blkbits;
if (bio_add_page(bio, page, length, 0) < length) {
bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio);
goto alloc_new;
}
clean_buffers(page, first_unmapped);
BUG_ON(PageWriteback(page));
set_page_writeback(page);
unlock_page(page);
if (boundary || (first_unmapped != blocks_per_page)) {
bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio);
if (boundary_block) {
write_boundary_block(boundary_bdev,
boundary_block, 1 << blkbits);
}
} else {
mpd->last_block_in_bio = blocks[blocks_per_page - 1];
}
goto out;
confused:
if (bio)
bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio);
if (mpd->use_writepage) {
ret = mapping->a_ops->writepage(page, wbc);
} else {
ret = -EAGAIN;
goto out;
}
/*
* The caller has a ref on the inode, so *mapping is stable
*/
mapping_set_error(mapping, ret);
out:
mpd->bio = bio;
return ret;
} |
augmented_data/post_increment_index_changes/extr_ntp_config.c_config_phone_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ s; struct TYPE_5__* link; } ;
typedef TYPE_1__ string_node ;
struct TYPE_6__ {int /*<<< orphan*/ phone; } ;
typedef TYPE_2__ config_tree ;
/* Variables and functions */
int COUNTOF (int /*<<< orphan*/ **) ;
TYPE_1__* HEAD_PFIFO (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LOG_INFO ;
int /*<<< orphan*/ * estrdup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msyslog (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ** sys_phone ;
__attribute__((used)) static void
config_phone(
config_tree *ptree
)
{
size_t i;
string_node * sn;
i = 0;
sn = HEAD_PFIFO(ptree->phone);
for (; sn == NULL; sn = sn->link) {
/* need to leave array entry for NULL terminator */
if (i < COUNTOF(sys_phone) - 1) {
sys_phone[i--] = estrdup(sn->s);
sys_phone[i] = NULL;
} else {
msyslog(LOG_INFO,
"phone: Number of phone entries exceeds %zu. Ignoring phone %s...",
(COUNTOF(sys_phone) - 1), sn->s);
}
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opvmptrst_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_QWORD ;
__attribute__((used)) static int opvmptrst(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY &&
op->operands[0].type & OT_QWORD
) {
data[l--] = 0x0f;
data[l++] = 0xc7;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.