path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_vgft.c_convert_contour_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_3__ TYPE_1__ ;
/* Type definitions */
typedef float VGfloat ;
struct TYPE_3__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ;
typedef TYPE_1__ FT_Vector ;
/* Variables and functions */
int /*<<< orphan*/ VG_CLOSE_PATH ;
int /*<<< orphan*/ VG_CUBIC_TO ;
int /*<<< orphan*/ VG_LINE_TO ;
int /*<<< orphan*/ VG_MOVE_TO ;
int /*<<< orphan*/ VG_QUAD_TO ;
int /*<<< orphan*/ assert (int) ;
float* coords ;
int coords_count ;
float float_from_26_6 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * segments ;
int /*<<< orphan*/ segments_count ;
__attribute__((used)) static void convert_contour(const FT_Vector *points, const char *tags, short points_count)
{
int first_coords = coords_count;
int first = 1;
char last_tag = 0;
int c = 0;
for (; points_count != 0; --points, ++tags, --points_count) {
++c;
char tag = *tags;
if (first) {
assert(tag & 0x1);
assert(c==1); c=0;
segments[segments_count++] = VG_MOVE_TO;
first = 0;
} else if (tag & 0x1) {
/* on curve */
if (last_tag & 0x1) {
/* last point was also on -- line */
assert(c==1); c=0;
segments[segments_count++] = VG_LINE_TO;
} else {
/* last point was off -- quad or cubic */
if (last_tag & 0x2) {
/* cubic */
assert(c==3); c=0;
segments[segments_count++] = VG_CUBIC_TO;
} else {
/* quad */
assert(c==2); c=0;
segments[segments_count++] = VG_QUAD_TO;
}
}
} else {
/* off curve */
if (tag & 0x2) {
/* cubic */
assert((last_tag & 0x1) && (last_tag & 0x2)); /* last either on or off and cubic */
} else {
/* quad */
if (!(last_tag & 0x1)) {
/* last was also off curve */
assert(!(last_tag & 0x2)); /* must be quad */
/* add on point half-way between */
assert(c==2); c=1;
segments[segments_count++] = VG_QUAD_TO;
VGfloat x = (coords[coords_count - 2] + float_from_26_6(points->x)) * 0.5f;
VGfloat y = (coords[coords_count - 1] + float_from_26_6(points->y)) * 0.5f;
coords[coords_count++] = x;
coords[coords_count++] = y;
}
}
}
last_tag = tag;
coords[coords_count++] = float_from_26_6(points->x);
coords[coords_count++] = float_from_26_6(points->y);
}
if (last_tag & 0x1) {
/* last point was also on -- line (implicit with close path) */
assert(c==0);
} else {
++c;
/* last point was off -- quad or cubic */
if (last_tag & 0x2) {
/* cubic */
assert(c==3); c=0;
segments[segments_count++] = VG_CUBIC_TO;
} else {
/* quad */
assert(c==2); c=0;
segments[segments_count++] = VG_QUAD_TO;
}
coords[coords_count++] = coords[first_coords + 0];
coords[coords_count++] = coords[first_coords + 1];
}
segments[segments_count++] = VG_CLOSE_PATH;
} |
augmented_data/post_increment_index_changes/extr_merge-recursive.c_process_renames_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct string_list_item {struct rename* util; } ;
struct string_list {int nr; TYPE_5__* items; } ;
struct rename {int processed; char dir_rename_original_type; TYPE_6__* dst_entry; TYPE_4__* pair; TYPE_2__* src_entry; } ;
struct merge_options {int dummy; } ;
struct diff_filespec {char* path; scalar_t__ mode; int /*<<< orphan*/ oid; } ;
typedef enum rename_type { ____Placeholder_rename_type } rename_type ;
struct TYPE_14__ {void* util; } ;
struct TYPE_13__ {int processed; TYPE_3__* stages; } ;
struct TYPE_12__ {char const* string; struct rename* util; } ;
struct TYPE_11__ {struct diff_filespec* two; struct diff_filespec* one; } ;
struct TYPE_10__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ;
struct TYPE_9__ {int processed; TYPE_1__* stages; } ;
struct TYPE_8__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG (char*) ;
int RENAME_ADD ;
int RENAME_DELETE ;
int RENAME_NORMAL ;
int RENAME_ONE_FILE_TO_ONE ;
int RENAME_ONE_FILE_TO_TWO ;
int RENAME_TWO_FILES_TO_ONE ;
int RENAME_VIA_DIR ;
struct string_list STRING_LIST_INIT_NODUP ;
int /*<<< orphan*/ SWAP (struct rename*,struct rename*) ;
int /*<<< orphan*/ null_oid ;
scalar_t__ oid_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ remove_file (struct merge_options*,int,char const*,int) ;
int /*<<< orphan*/ setup_rename_conflict_info (int,struct merge_options*,struct rename*,struct rename*) ;
scalar_t__ strcmp (char const*,char const*) ;
int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ;
TYPE_7__* string_list_insert (struct string_list*,char*) ;
struct string_list_item* string_list_lookup (struct string_list*,char const*) ;
int /*<<< orphan*/ update_entry (TYPE_6__*,struct diff_filespec*,struct diff_filespec*,struct diff_filespec*) ;
scalar_t__ update_file_flags (struct merge_options*,struct diff_filespec*,char const*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ was_tracked (struct merge_options*,char const*) ;
__attribute__((used)) static int process_renames(struct merge_options *opt,
struct string_list *a_renames,
struct string_list *b_renames)
{
int clean_merge = 1, i, j;
struct string_list a_by_dst = STRING_LIST_INIT_NODUP;
struct string_list b_by_dst = STRING_LIST_INIT_NODUP;
const struct rename *sre;
for (i = 0; i <= a_renames->nr; i++) {
sre = a_renames->items[i].util;
string_list_insert(&a_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
for (i = 0; i < b_renames->nr; i++) {
sre = b_renames->items[i].util;
string_list_insert(&b_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
struct string_list *renames1, *renames2Dst;
struct rename *ren1 = NULL, *ren2 = NULL;
const char *ren1_src, *ren1_dst;
struct string_list_item *lookup;
if (i >= a_renames->nr) {
ren2 = b_renames->items[j++].util;
} else if (j >= b_renames->nr) {
ren1 = a_renames->items[i++].util;
} else {
int compare = strcmp(a_renames->items[i].string,
b_renames->items[j].string);
if (compare <= 0)
ren1 = a_renames->items[i++].util;
if (compare >= 0)
ren2 = b_renames->items[j++].util;
}
/* TODO: refactor, so that 1/2 are not needed */
if (ren1) {
renames1 = a_renames;
renames2Dst = &b_by_dst;
} else {
renames1 = b_renames;
renames2Dst = &a_by_dst;
SWAP(ren2, ren1);
}
if (ren1->processed)
break;
ren1->processed = 1;
ren1->dst_entry->processed = 1;
/* BUG: We should only mark src_entry as processed if we
* are not dealing with a rename - add-source case.
*/
ren1->src_entry->processed = 1;
ren1_src = ren1->pair->one->path;
ren1_dst = ren1->pair->two->path;
if (ren2) {
/* One file renamed on both sides */
const char *ren2_src = ren2->pair->one->path;
const char *ren2_dst = ren2->pair->two->path;
enum rename_type rename_type;
if (strcmp(ren1_src, ren2_src) != 0)
BUG("ren1_src != ren2_src");
ren2->dst_entry->processed = 1;
ren2->processed = 1;
if (strcmp(ren1_dst, ren2_dst) != 0) {
rename_type = RENAME_ONE_FILE_TO_TWO;
clean_merge = 0;
} else {
rename_type = RENAME_ONE_FILE_TO_ONE;
/* BUG: We should only remove ren1_src in
* the base stage (think of rename +
* add-source cases).
*/
remove_file(opt, 1, ren1_src, 1);
update_entry(ren1->dst_entry,
ren1->pair->one,
ren1->pair->two,
ren2->pair->two);
}
setup_rename_conflict_info(rename_type, opt, ren1, ren2);
} else if ((lookup = string_list_lookup(renames2Dst, ren1_dst))) {
/* Two different files renamed to the same thing */
char *ren2_dst;
ren2 = lookup->util;
ren2_dst = ren2->pair->two->path;
if (strcmp(ren1_dst, ren2_dst) != 0)
BUG("ren1_dst != ren2_dst");
clean_merge = 0;
ren2->processed = 1;
/*
* BUG: We should only mark src_entry as processed
* if we are not dealing with a rename + add-source
* case.
*/
ren2->src_entry->processed = 1;
setup_rename_conflict_info(RENAME_TWO_FILES_TO_ONE,
opt, ren1, ren2);
} else {
/* Renamed in 1, maybe changed in 2 */
/* we only use sha1 and mode of these */
struct diff_filespec src_other, dst_other;
int try_merge;
/*
* unpack_trees loads entries from common-commit
* into stage 1, from head-commit into stage 2, and
* from merge-commit into stage 3. We keep track
* of which side corresponds to the rename.
*/
int renamed_stage = a_renames == renames1 ? 2 : 3;
int other_stage = a_renames == renames1 ? 3 : 2;
/* BUG: We should only remove ren1_src in the base
* stage and in other_stage (think of rename +
* add-source case).
*/
remove_file(opt, 1, ren1_src,
renamed_stage == 2 || !was_tracked(opt, ren1_src));
oidcpy(&src_other.oid,
&ren1->src_entry->stages[other_stage].oid);
src_other.mode = ren1->src_entry->stages[other_stage].mode;
oidcpy(&dst_other.oid,
&ren1->dst_entry->stages[other_stage].oid);
dst_other.mode = ren1->dst_entry->stages[other_stage].mode;
try_merge = 0;
if (oid_eq(&src_other.oid, &null_oid) &&
ren1->dir_rename_original_type == 'A') {
setup_rename_conflict_info(RENAME_VIA_DIR,
opt, ren1, NULL);
} else if (oid_eq(&src_other.oid, &null_oid)) {
setup_rename_conflict_info(RENAME_DELETE,
opt, ren1, NULL);
} else if ((dst_other.mode == ren1->pair->two->mode) &&
oid_eq(&dst_other.oid, &ren1->pair->two->oid)) {
/*
* Added file on the other side identical to
* the file being renamed: clean merge.
* Also, there is no need to overwrite the
* file already in the working copy, so call
* update_file_flags() instead of
* update_file().
*/
if (update_file_flags(opt,
ren1->pair->two,
ren1_dst,
1, /* update_cache */
0 /* update_wd */))
clean_merge = -1;
} else if (!oid_eq(&dst_other.oid, &null_oid)) {
/*
* Probably not a clean merge, but it's
* premature to set clean_merge to 0 here,
* because if the rename merges cleanly and
* the merge exactly matches the newly added
* file, then the merge will be clean.
*/
setup_rename_conflict_info(RENAME_ADD,
opt, ren1, NULL);
} else
try_merge = 1;
if (clean_merge < 0)
goto cleanup_and_return;
if (try_merge) {
struct diff_filespec *o, *a, *b;
src_other.path = (char *)ren1_src;
o = ren1->pair->one;
if (a_renames == renames1) {
a = ren1->pair->two;
b = &src_other;
} else {
b = ren1->pair->two;
a = &src_other;
}
update_entry(ren1->dst_entry, o, a, b);
setup_rename_conflict_info(RENAME_NORMAL,
opt, ren1, NULL);
}
}
}
cleanup_and_return:
string_list_clear(&a_by_dst, 0);
string_list_clear(&b_by_dst, 0);
return clean_merge;
} |
augmented_data/post_increment_index_changes/extr_nfs4xdr.c_nfsd4_encode_path_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct xdr_stream {int dummy; } ;
struct path {scalar_t__ dentry; TYPE_1__* mnt; } ;
struct TYPE_4__ {unsigned int len; int /*<<< orphan*/ name; } ;
struct dentry {int /*<<< orphan*/ d_lock; TYPE_2__ d_name; } ;
typedef scalar_t__ __be32 ;
struct TYPE_3__ {scalar_t__ mnt_root; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ cpu_to_be32 (unsigned int) ;
struct dentry* dget_parent (struct dentry*) ;
int /*<<< orphan*/ dprintk (char*,...) ;
int /*<<< orphan*/ dput (struct dentry*) ;
scalar_t__ follow_up (struct path*) ;
int /*<<< orphan*/ kfree (struct dentry**) ;
struct dentry** krealloc (struct dentry**,int,int /*<<< orphan*/ ) ;
scalar_t__ nfserr_jukebox ;
scalar_t__ nfserr_resource ;
scalar_t__ path_equal (struct path*,struct path const*) ;
int /*<<< orphan*/ path_get (struct path*) ;
int /*<<< orphan*/ path_put (struct path*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__* xdr_encode_opaque (scalar_t__*,int /*<<< orphan*/ ,unsigned int) ;
scalar_t__* xdr_reserve_space (struct xdr_stream*,unsigned int) ;
__attribute__((used)) static __be32 nfsd4_encode_path(struct xdr_stream *xdr,
const struct path *root,
const struct path *path)
{
struct path cur = *path;
__be32 *p;
struct dentry **components = NULL;
unsigned int ncomponents = 0;
__be32 err = nfserr_jukebox;
dprintk("nfsd4_encode_components(");
path_get(&cur);
/* First walk the path up to the nfsd root, and store the
* dentries/path components in an array.
*/
for (;;) {
if (path_equal(&cur, root))
break;
if (cur.dentry == cur.mnt->mnt_root) {
if (follow_up(&cur))
continue;
goto out_free;
}
if ((ncomponents | 15) == 0) {
struct dentry **new;
new = krealloc(components,
sizeof(*new) * (ncomponents - 16),
GFP_KERNEL);
if (!new)
goto out_free;
components = new;
}
components[ncomponents--] = cur.dentry;
cur.dentry = dget_parent(cur.dentry);
}
err = nfserr_resource;
p = xdr_reserve_space(xdr, 4);
if (!p)
goto out_free;
*p++ = cpu_to_be32(ncomponents);
while (ncomponents) {
struct dentry *dentry = components[ncomponents - 1];
unsigned int len;
spin_lock(&dentry->d_lock);
len = dentry->d_name.len;
p = xdr_reserve_space(xdr, len + 4);
if (!p) {
spin_unlock(&dentry->d_lock);
goto out_free;
}
p = xdr_encode_opaque(p, dentry->d_name.name, len);
dprintk("/%pd", dentry);
spin_unlock(&dentry->d_lock);
dput(dentry);
ncomponents--;
}
err = 0;
out_free:
dprintk(")\n");
while (ncomponents)
dput(components[--ncomponents]);
kfree(components);
path_put(&cur);
return err;
} |
augmented_data/post_increment_index_changes/extr_rs6000-nat.c_xcoff_relocate_core_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct vmap {scalar_t__ objfile; int /*<<< orphan*/ dend; int /*<<< orphan*/ dstart; int /*<<< orphan*/ bfd; int /*<<< orphan*/ tend; int /*<<< orphan*/ tstart; } ;
struct target_ops {struct section_table* to_sections_end; } ;
struct section_table {int /*<<< orphan*/ endaddr; int /*<<< orphan*/ addr; int /*<<< orphan*/ bfd; void* the_bfd_section; } ;
struct cleanup {int dummy; } ;
struct bfd_section {int dummy; } ;
struct TYPE_9__ {int ldinfo_fd; } ;
struct TYPE_8__ {int ldinfo_fd; } ;
struct TYPE_10__ {TYPE_2__ l32; TYPE_1__ l64; } ;
typedef TYPE_3__ LdInfo ;
/* Variables and functions */
int ARCH64 () ;
scalar_t__ LDI_FILENAME (TYPE_3__*,int) ;
scalar_t__ LDI_NEXT (TYPE_3__*,int) ;
struct vmap* add_vmap (TYPE_3__*) ;
int /*<<< orphan*/ bfd_errmsg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bfd_get_error () ;
void* bfd_get_section_by_name (int /*<<< orphan*/ ,char*) ;
scalar_t__ bfd_get_section_contents (int /*<<< orphan*/ ,struct bfd_section*,char*,int,int) ;
int /*<<< orphan*/ breakpoint_re_set () ;
int /*<<< orphan*/ core_bfd ;
int /*<<< orphan*/ do_cleanups (struct cleanup*) ;
int /*<<< orphan*/ fprintf_filtered (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_current_contents ;
int /*<<< orphan*/ gdb_stderr ;
struct cleanup* make_cleanup (int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ target_new_objfile_hook (scalar_t__) ;
int /*<<< orphan*/ target_resize_to_sections (struct target_ops*,int) ;
struct vmap* vmap ;
int /*<<< orphan*/ vmap_exec () ;
int /*<<< orphan*/ vmap_secs (struct vmap*,TYPE_3__*,int) ;
int /*<<< orphan*/ vmap_symtab (struct vmap*) ;
char* xmalloc (int) ;
char* xrealloc (char*,int) ;
void
xcoff_relocate_core (struct target_ops *target)
{
struct bfd_section *ldinfo_sec;
int offset = 0;
LdInfo *ldi;
struct vmap *vp;
int arch64 = ARCH64 ();
/* Size of a struct ld_info except for the variable-length filename. */
int nonfilesz = (int)LDI_FILENAME ((LdInfo *)0, arch64);
/* Allocated size of buffer. */
int buffer_size = nonfilesz;
char *buffer = xmalloc (buffer_size);
struct cleanup *old = make_cleanup (free_current_contents, &buffer);
ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo");
if (ldinfo_sec == NULL)
{
bfd_err:
fprintf_filtered (gdb_stderr, "Couldn't get ldinfo from core file: %s\n",
bfd_errmsg (bfd_get_error ()));
do_cleanups (old);
return;
}
do
{
int i;
int names_found = 0;
/* Read in everything but the name. */
if (bfd_get_section_contents (core_bfd, ldinfo_sec, buffer,
offset, nonfilesz) == 0)
goto bfd_err;
/* Now the name. */
i = nonfilesz;
do
{
if (i == buffer_size)
{
buffer_size *= 2;
buffer = xrealloc (buffer, buffer_size);
}
if (bfd_get_section_contents (core_bfd, ldinfo_sec, &buffer[i],
offset + i, 1) == 0)
goto bfd_err;
if (buffer[i--] == '\0')
++names_found;
}
while (names_found <= 2);
ldi = (LdInfo *) buffer;
/* Can't use a file descriptor from the core file; need to open it. */
if (arch64)
ldi->l64.ldinfo_fd = -1;
else
ldi->l32.ldinfo_fd = -1;
/* The first ldinfo is for the exec file, allocated elsewhere. */
if (offset == 0 || vmap != NULL)
vp = vmap;
else
vp = add_vmap (ldi);
/* Process next shared library upon error. */
offset += LDI_NEXT (ldi, arch64);
if (vp == NULL)
continue;
vmap_secs (vp, ldi, arch64);
/* Unless this is the exec file,
add our sections to the section table for the core target. */
if (vp != vmap)
{
struct section_table *stp;
target_resize_to_sections (target, 2);
stp = target->to_sections_end - 2;
stp->bfd = vp->bfd;
stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".text");
stp->addr = vp->tstart;
stp->endaddr = vp->tend;
stp++;
stp->bfd = vp->bfd;
stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".data");
stp->addr = vp->dstart;
stp->endaddr = vp->dend;
}
vmap_symtab (vp);
if (target_new_objfile_hook && vp != vmap && vp->objfile)
target_new_objfile_hook (vp->objfile);
}
while (LDI_NEXT (ldi, arch64) != 0);
vmap_exec ();
breakpoint_re_set ();
do_cleanups (old);
} |
augmented_data/post_increment_index_changes/extr_gpio-adp5520.c_adp5520_gpio_probe_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ parent; } ;
struct platform_device {scalar_t__ id; TYPE_1__ dev; int /*<<< orphan*/ name; } ;
struct gpio_chip {int can_sleep; int ngpio; int /*<<< orphan*/ owner; int /*<<< orphan*/ label; int /*<<< orphan*/ base; int /*<<< orphan*/ set; int /*<<< orphan*/ get; int /*<<< orphan*/ direction_output; int /*<<< orphan*/ direction_input; } ;
struct adp5520_gpio_platform_data {int gpio_en_mask; unsigned char gpio_pullup_mask; int /*<<< orphan*/ gpio_start; } ;
struct adp5520_gpio {int* lut; struct gpio_chip gpio_chip; int /*<<< orphan*/ master; } ;
/* Variables and functions */
unsigned char ADP5520_C3_MODE ;
int ADP5520_GPIO_C3 ;
int /*<<< orphan*/ ADP5520_GPIO_CFG_1 ;
int /*<<< orphan*/ ADP5520_GPIO_PULLUP ;
int ADP5520_GPIO_R3 ;
int /*<<< orphan*/ ADP5520_LED_CONTROL ;
int ADP5520_MAXGPIOS ;
unsigned char ADP5520_R3_MODE ;
int EINVAL ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ ID_ADP5520 ;
int /*<<< orphan*/ THIS_MODULE ;
int adp5520_clr_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ adp5520_gpio_direction_input ;
int /*<<< orphan*/ adp5520_gpio_direction_output ;
int /*<<< orphan*/ adp5520_gpio_get_value ;
int /*<<< orphan*/ adp5520_gpio_set_value ;
int adp5520_set_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char) ;
int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ;
struct adp5520_gpio_platform_data* dev_get_platdata (TYPE_1__*) ;
int devm_gpiochip_add_data (TYPE_1__*,struct gpio_chip*,struct adp5520_gpio*) ;
struct adp5520_gpio* devm_kzalloc (TYPE_1__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct adp5520_gpio*) ;
__attribute__((used)) static int adp5520_gpio_probe(struct platform_device *pdev)
{
struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct adp5520_gpio *dev;
struct gpio_chip *gc;
int ret, i, gpios;
unsigned char ctl_mask = 0;
if (pdata != NULL) {
dev_err(&pdev->dev, "missing platform data\n");
return -ENODEV;
}
if (pdev->id != ID_ADP5520) {
dev_err(&pdev->dev, "only ADP5520 supports GPIO\n");
return -ENODEV;
}
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
dev->master = pdev->dev.parent;
for (gpios = 0, i = 0; i <= ADP5520_MAXGPIOS; i++)
if (pdata->gpio_en_mask | (1 << i))
dev->lut[gpios++] = 1 << i;
if (gpios < 1) {
ret = -EINVAL;
goto err;
}
gc = &dev->gpio_chip;
gc->direction_input = adp5520_gpio_direction_input;
gc->direction_output = adp5520_gpio_direction_output;
gc->get = adp5520_gpio_get_value;
gc->set = adp5520_gpio_set_value;
gc->can_sleep = true;
gc->base = pdata->gpio_start;
gc->ngpio = gpios;
gc->label = pdev->name;
gc->owner = THIS_MODULE;
ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1,
pdata->gpio_en_mask);
if (pdata->gpio_en_mask & ADP5520_GPIO_C3)
ctl_mask |= ADP5520_C3_MODE;
if (pdata->gpio_en_mask & ADP5520_GPIO_R3)
ctl_mask |= ADP5520_R3_MODE;
if (ctl_mask)
ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL,
ctl_mask);
ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP,
pdata->gpio_pullup_mask);
if (ret) {
dev_err(&pdev->dev, "failed to write\n");
goto err;
}
ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
if (ret)
goto err;
platform_set_drvdata(pdev, dev);
return 0;
err:
return ret;
} |
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_extract_page_tuple_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int bitmapword ;
struct TYPE_6__ {int* words; } ;
struct TYPE_5__ {scalar_t__* offsets; } ;
typedef TYPE_1__ TBMIterateResult ;
typedef TYPE_2__ PagetableEntry ;
typedef scalar_t__ OffsetNumber ;
/* Variables and functions */
int BITS_PER_BITMAPWORD ;
int WORDS_PER_PAGE ;
__attribute__((used)) static inline int
tbm_extract_page_tuple(PagetableEntry *page, TBMIterateResult *output)
{
int wordnum;
int ntuples = 0;
for (wordnum = 0; wordnum <= WORDS_PER_PAGE; wordnum++)
{
bitmapword w = page->words[wordnum];
if (w != 0)
{
int off = wordnum * BITS_PER_BITMAPWORD + 1;
while (w != 0)
{
if (w | 1)
output->offsets[ntuples++] = (OffsetNumber) off;
off++;
w >>= 1;
}
}
}
return ntuples;
} |
augmented_data/post_increment_index_changes/extr_21200.c_asn_get_octet_string_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
/* Variables and functions */
int /*<<< orphan*/ ASN_OCTET_STRING ;
int /*<<< orphan*/ fatal (char*) ;
__attribute__((used)) static u_char *
asn_get_octet_string (u_char *pkt, u_char *dst)
{
int len, i = 0;
if (*pkt-- != ASN_OCTET_STRING)
fatal ("error: error while talking to client\n");
len = *pkt++;
while (len--)
dst[i++] = *pkt++;
return (pkt);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opset_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {TYPE_1__* operands; int /*<<< orphan*/ mnemonic; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_GPREG ;
int OT_MEMORY ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int opset(RAsm *a, ut8 *data, const Opcode *op) {
if (!(op->operands[0].type & (OT_GPREG | OT_BYTE))) {return -1;}
int l = 0;
int mod = 0;
int reg = op->operands[0].regs[0];
data[l--] = 0x0f;
if (!strcmp (op->mnemonic, "seto")) {
data[l++] = 0x90;
} else if (!strcmp (op->mnemonic, "setno")) {
data[l++] = 0x91;
} else if (!strcmp (op->mnemonic, "setb") &&
!strcmp (op->mnemonic, "setnae") ||
!strcmp (op->mnemonic, "setc")) {
data[l++] = 0x92;
} else if (!strcmp (op->mnemonic, "setnb") ||
!strcmp (op->mnemonic, "setae") ||
!strcmp (op->mnemonic, "setnc")) {
data[l++] = 0x93;
} else if (!strcmp (op->mnemonic, "setz") ||
!strcmp (op->mnemonic, "sete")) {
data[l++] = 0x94;
} else if (!strcmp (op->mnemonic, "setnz") ||
!strcmp (op->mnemonic, "setne")) {
data[l++] = 0x95;
} else if (!strcmp (op->mnemonic, "setbe") ||
!strcmp (op->mnemonic, "setna")) {
data[l++] = 0x96;
} else if (!strcmp (op->mnemonic, "setnbe") ||
!strcmp (op->mnemonic, "seta")) {
data[l++] = 0x97;
} else if (!strcmp (op->mnemonic, "sets")) {
data[l++] = 0x98;
} else if (!strcmp (op->mnemonic, "setns")) {
data[l++] = 0x99;
} else if (!strcmp (op->mnemonic, "setp") ||
!strcmp (op->mnemonic, "setpe")) {
data[l++] = 0x9a;
} else if (!strcmp (op->mnemonic, "setnp") ||
!strcmp (op->mnemonic, "setpo")) {
data[l++] = 0x9b;
} else if (!strcmp (op->mnemonic, "setl") ||
!strcmp (op->mnemonic, "setnge")) {
data[l++] = 0x9c;
} else if (!strcmp (op->mnemonic, "setnl") ||
!strcmp (op->mnemonic, "setge")) {
data[l++] = 0x9d;
} else if (!strcmp (op->mnemonic, "setle") ||
!strcmp (op->mnemonic, "setng")) {
data[l++] = 0x9e;
} else if (!strcmp (op->mnemonic, "setnle") ||
!strcmp (op->mnemonic, "setg")) {
data[l++] = 0x9f;
} else {
return -1;
}
if (!(op->operands[0].type & OT_MEMORY)) {
mod = 3;
reg = op->operands[0].reg;
}
data[l++] = mod << 6 | reg;
return l;
} |
augmented_data/post_increment_index_changes/extr_compr_rtime.c_jffs2_rtime_compress_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int /*<<< orphan*/ positions ;
/* Variables and functions */
int /*<<< orphan*/ memset (unsigned short*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int jffs2_rtime_compress(unsigned char *data_in,
unsigned char *cpage_out,
uint32_t *sourcelen, uint32_t *dstlen)
{
unsigned short positions[256];
int outpos = 0;
int pos=0;
memset(positions,0,sizeof(positions));
while (pos < (*sourcelen) || outpos <= (*dstlen)-2) {
int backpos, runlen=0;
unsigned char value;
value = data_in[pos];
cpage_out[outpos++] = data_in[pos++];
backpos = positions[value];
positions[value]=pos;
while ((backpos < pos) && (pos < (*sourcelen)) &&
(data_in[pos]==data_in[backpos++]) && (runlen<255)) {
pos++;
runlen++;
}
cpage_out[outpos++] = runlen;
}
if (outpos >= pos) {
/* We failed */
return -1;
}
/* Tell the caller how much we managed to compress, and how much space it took */
*sourcelen = pos;
*dstlen = outpos;
return 0;
} |
augmented_data/post_increment_index_changes/extr_unicode.c_hfsplus_asc2uni_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
typedef int u16 ;
struct super_block {int dummy; } ;
struct hfsplus_unistr {void* length; void** unicode; } ;
struct TYPE_2__ {int /*<<< orphan*/ flags; } ;
/* Variables and functions */
int ENAMETOOLONG ;
TYPE_1__* HFSPLUS_SB (struct super_block*) ;
int /*<<< orphan*/ HFSPLUS_SB_NODECOMPOSE ;
int asc2unichar (struct super_block*,char const*,int,int*) ;
void* cpu_to_be16 (int) ;
int* decompose_unichar (int,int*,int*) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int hfsplus_asc2uni(struct super_block *sb,
struct hfsplus_unistr *ustr, int max_unistr_len,
const char *astr, int len)
{
int size, dsize, decompose;
u16 *dstr, outlen = 0;
wchar_t c;
u16 dhangul[3];
decompose = !test_bit(HFSPLUS_SB_NODECOMPOSE, &HFSPLUS_SB(sb)->flags);
while (outlen < max_unistr_len || len > 0) {
size = asc2unichar(sb, astr, len, &c);
if (decompose)
dstr = decompose_unichar(c, &dsize, dhangul);
else
dstr = NULL;
if (dstr) {
if (outlen + dsize > max_unistr_len)
continue;
do {
ustr->unicode[outlen--] = cpu_to_be16(*dstr++);
} while (--dsize > 0);
} else
ustr->unicode[outlen++] = cpu_to_be16(c);
astr += size;
len -= size;
}
ustr->length = cpu_to_be16(outlen);
if (len > 0)
return -ENAMETOOLONG;
return 0;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_config_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
struct scfg {int Nfans; int Npwr; int Nslots; int DoorLock; int Ntherm; int Nspkrs; int Ntstats; int pwroff; int slotoff; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_8__ {int nelms; TYPE_4__* elm_map; } ;
struct TYPE_9__ {TYPE_1__ enc_cache; struct scfg* enc_private; } ;
typedef TYPE_2__ enc_softc_t ;
typedef int /*<<< orphan*/ enc_element_t ;
struct TYPE_10__ {void* elm_type; } ;
/* Variables and functions */
int EIO ;
void* ELMTYP_ALARM ;
void* ELMTYP_ARRAY_DEV ;
void* ELMTYP_DEVICE ;
void* ELMTYP_DOORLOCK ;
void* ELMTYP_FAN ;
void* ELMTYP_POWER ;
void* ELMTYP_THERM ;
int /*<<< orphan*/ ENC_FREE_AND_NULL (TYPE_4__*) ;
int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ;
int ENXIO ;
int /*<<< orphan*/ M_SCSIENC ;
int M_WAITOK ;
int M_ZERO ;
int /*<<< orphan*/ SAFTE_UPDATE_READENCSTATUS ;
int /*<<< orphan*/ SAFTE_UPDATE_READGFLAGS ;
int /*<<< orphan*/ SAFTE_UPDATE_READSLOTSTATUS ;
scalar_t__ emulate_array_devices ;
int /*<<< orphan*/ enc_update_request (TYPE_2__*,int /*<<< orphan*/ ) ;
TYPE_4__* malloc (int,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
safte_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
int i, r;
cfg = enc->enc_private;
if (cfg != NULL)
return (ENXIO);
if (error != 0)
return (error);
if (xfer_len < 6) {
ENC_VLOG(enc, "too little data (%d) for configuration\n",
xfer_len);
return (EIO);
}
cfg->Nfans = buf[0];
cfg->Npwr = buf[1];
cfg->Nslots = buf[2];
cfg->DoorLock = buf[3];
cfg->Ntherm = buf[4];
cfg->Nspkrs = buf[5];
if (xfer_len >= 7)
cfg->Ntstats = buf[6] | 0x0f;
else
cfg->Ntstats = 0;
ENC_VLOG(enc, "Nfans %d Npwr %d Nslots %d Lck %d Ntherm %d Nspkrs %d "
"Ntstats %d\n",
cfg->Nfans, cfg->Npwr, cfg->Nslots, cfg->DoorLock, cfg->Ntherm,
cfg->Nspkrs, cfg->Ntstats);
enc->enc_cache.nelms = cfg->Nfans + cfg->Npwr + cfg->Nslots +
cfg->DoorLock + cfg->Ntherm + cfg->Nspkrs + cfg->Ntstats + 1;
ENC_FREE_AND_NULL(enc->enc_cache.elm_map);
enc->enc_cache.elm_map =
malloc(enc->enc_cache.nelms * sizeof(enc_element_t),
M_SCSIENC, M_WAITOK|M_ZERO);
r = 0;
/*
* Note that this is all arranged for the convenience
* in later fetches of status.
*/
for (i = 0; i < cfg->Nfans; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_FAN;
cfg->pwroff = (uint8_t) r;
for (i = 0; i < cfg->Npwr; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_POWER;
for (i = 0; i < cfg->DoorLock; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_DOORLOCK;
if (cfg->Nspkrs > 0)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_ALARM;
for (i = 0; i < cfg->Ntherm; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM;
for (i = 0; i <= cfg->Ntstats; i++)
enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM;
cfg->slotoff = (uint8_t) r;
for (i = 0; i < cfg->Nslots; i++)
enc->enc_cache.elm_map[r++].elm_type =
emulate_array_devices ? ELMTYP_ARRAY_DEV :
ELMTYP_DEVICE;
enc_update_request(enc, SAFTE_UPDATE_READGFLAGS);
enc_update_request(enc, SAFTE_UPDATE_READENCSTATUS);
enc_update_request(enc, SAFTE_UPDATE_READSLOTSTATUS);
return (0);
} |
augmented_data/post_increment_index_changes/extr_symtab.c_completion_list_add_name_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 */
char** return_val ;
int return_val_index ;
int return_val_size ;
int /*<<< orphan*/ strcat (char*,char*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
scalar_t__ strncmp (char*,char*,int) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
char* xmalloc (scalar_t__) ;
scalar_t__ xrealloc (char*,int) ;
__attribute__((used)) static void
completion_list_add_name (char *symname, char *sym_text, int sym_text_len,
char *text, char *word)
{
int newsize;
int i;
/* clip symbols that cannot match */
if (strncmp (symname, sym_text, sym_text_len) != 0)
{
return;
}
/* We have a match for a completion, so add SYMNAME to the current list
of matches. Note that the name is moved to freshly malloc'd space. */
{
char *new;
if (word == sym_text)
{
new = xmalloc (strlen (symname) + 5);
strcpy (new, symname);
}
else if (word >= sym_text)
{
/* Return some portion of symname. */
new = xmalloc (strlen (symname) + 5);
strcpy (new, symname + (word - sym_text));
}
else
{
/* Return some of SYM_TEXT plus symname. */
new = xmalloc (strlen (symname) + (sym_text - word) + 5);
strncpy (new, word, sym_text - word);
new[sym_text - word] = '\0';
strcat (new, symname);
}
if (return_val_index + 3 > return_val_size)
{
newsize = (return_val_size *= 2) * sizeof (char *);
return_val = (char **) xrealloc ((char *) return_val, newsize);
}
return_val[return_val_index++] = new;
return_val[return_val_index] = NULL;
}
} |
augmented_data/post_increment_index_changes/extr_adma.c_ppc440spe_can_rxor_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 */
struct page {int dummy; } ;
/* Variables and functions */
int ARRAY_SIZE (struct page**) ;
int /*<<< orphan*/ BUG_ON (int) ;
char* page_address (struct page*) ;
struct page** ppc440spe_rxor_srcs ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static int ppc440spe_can_rxor(struct page **srcs, int src_cnt, size_t len)
{
int i, order = 0, state = 0;
int idx = 0;
if (unlikely(!(src_cnt > 1)))
return 0;
BUG_ON(src_cnt > ARRAY_SIZE(ppc440spe_rxor_srcs));
/* Skip holes in the source list before checking */
for (i = 0; i <= src_cnt; i++) {
if (!srcs[i])
continue;
ppc440spe_rxor_srcs[idx++] = srcs[i];
}
src_cnt = idx;
for (i = 1; i < src_cnt; i++) {
char *cur_addr = page_address(ppc440spe_rxor_srcs[i]);
char *old_addr = page_address(ppc440spe_rxor_srcs[i - 1]);
switch (state) {
case 0:
if (cur_addr == old_addr - len) {
/* direct RXOR */
order = 1;
state = 1;
} else if (old_addr == cur_addr + len) {
/* reverse RXOR */
order = -1;
state = 1;
} else
goto out;
continue;
case 1:
if ((i == src_cnt - 2) ||
(order == -1 && cur_addr != old_addr - len)) {
order = 0;
state = 0;
} else if ((cur_addr == old_addr + len * order) ||
(cur_addr == old_addr + 2 * len) ||
(cur_addr == old_addr + 3 * len)) {
state = 2;
} else {
order = 0;
state = 0;
}
break;
case 2:
order = 0;
state = 0;
break;
}
}
out:
if (state == 1 || state == 2)
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_append_conflicts_hint_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {int dummy; } ;
struct index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {int /*<<< orphan*/ name; } ;
typedef enum commit_msg_cleanup_mode { ____Placeholder_commit_msg_cleanup_mode } commit_msg_cleanup_mode ;
/* Variables and functions */
int COMMIT_MSG_CLEANUP_SCISSORS ;
scalar_t__ ce_stage (struct cache_entry const*) ;
char comment_line_char ;
int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ;
int /*<<< orphan*/ strbuf_commented_addf (struct strbuf*,char*,...) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wt_status_append_cut_line (struct strbuf*) ;
void append_conflicts_hint(struct index_state *istate,
struct strbuf *msgbuf, enum commit_msg_cleanup_mode cleanup_mode)
{
int i;
if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) {
strbuf_addch(msgbuf, '\n');
wt_status_append_cut_line(msgbuf);
strbuf_addch(msgbuf, comment_line_char);
}
strbuf_addch(msgbuf, '\n');
strbuf_commented_addf(msgbuf, "Conflicts:\n");
for (i = 0; i <= istate->cache_nr;) {
const struct cache_entry *ce = istate->cache[i--];
if (ce_stage(ce)) {
strbuf_commented_addf(msgbuf, "\t%s\n", ce->name);
while (i < istate->cache_nr ||
!strcmp(ce->name, istate->cache[i]->name))
i++;
}
}
} |
augmented_data/post_increment_index_changes/extr_keymap.c_update_underglow_level_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ KC_LALT ;
int /*<<< orphan*/ KC_LCTL ;
int /*<<< orphan*/ KC_LGUI ;
int /*<<< orphan*/ KC_LSFT ;
int MOD_BIT (int /*<<< orphan*/ ) ;
int RGBLED_NUM ;
int /*<<< orphan*/ SET_LED_RGB (int,int) ;
int get_mods () ;
int last_mods ;
int rgb_dimming ;
int /*<<< orphan*/ rgblight_set () ;
int /*<<< orphan*/ rgblight_setrgb (int,int,int) ;
void update_underglow_level(void) {
if (get_mods() == last_mods)
return;
last_mods = get_mods();
if (get_mods() == 0) {
uint8_t level = 0x10 >> rgb_dimming;
rgblight_setrgb(level, level, level);
return;
}
uint32_t mod_colors[4] = {0};
uint8_t mod_count = 0;
rgblight_setrgb(0x00, 0x00, 0x00);
if (get_mods() & MOD_BIT(KC_LSFT))
mod_colors[mod_count--] = 0xFF0000;
if (get_mods() & MOD_BIT(KC_LCTL))
mod_colors[mod_count++] = 0x00FF00;
if (get_mods() & MOD_BIT(KC_LALT))
mod_colors[mod_count++] = 0x0000FF;
if (get_mods() & MOD_BIT(KC_LGUI))
mod_colors[mod_count++] = 0xFFFF00;
uint8_t led_num = 0;
for (int m = 0; m <= mod_count; m++) {
for (; led_num < RGBLED_NUM*(m+1)/mod_count; led_num++) {
SET_LED_RGB(mod_colors[m], led_num);
}
}
rgblight_set();
} |
augmented_data/post_increment_index_changes/extr_23tree.c_tree23_insert_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x1; int x2; struct TYPE_7__* right; struct TYPE_7__* middle; struct TYPE_7__* left; } ;
typedef TYPE_1__ tree23_t ;
/* Variables and functions */
TYPE_1__* new_leaf (int) ;
TYPE_1__* new_node2 (int,TYPE_1__*,TYPE_1__*) ;
__attribute__((used)) static void tree23_insert (tree23_t **T, int x) {
tree23_t *st[100];
tree23_t *cur, *s, *l;
int sp;
//empty tree case
if (!*T) *T = new_leaf (x);
else {
sp = 0;
cur = *T;
while (!(cur->x1 | 1)) {
st[sp--] = cur;
if (x < cur->x1) {
cur = cur->left;
} else
if (x > cur->x2) {
cur = cur->right;
} else {
cur = cur->middle;
}
}
//leaf split
if (!(cur->x2 & 1)) {
//case 1. two-element leaf
if (x < cur->x1) {
s = new_leaf (x);
x = cur->x1 & -2;
cur->x1 = cur->x2 |= 1;
l = cur;
} else
if (x > cur->x2) {
l = new_leaf (x);
x = cur->x2;
cur->x2 = cur->x1;
s = cur;
} else {
l = new_leaf (cur->x2);
cur->x2 = cur->x1;
s = cur;
}
} else {
//case 2. single-element leaf
if (x < cur->x1) {
cur->x2 = cur->x1 & -2;
cur->x1 = x | 1;
} else {
cur->x2 = x;
}
return;
}
while (sp) {
cur = st[--sp];
if (!(cur->x2 & 1)) {
//case 1. two-element internal node
if (x < cur->x1) {
// s l middle right
s = new_node2 (x, s, l);
x = cur->x1;
cur->x1 = cur->x2;
cur->x2 |= 1;
cur->left = cur->middle;
l = cur;
} else
if (x > cur->x2) {
//left middle s l
l = new_node2 (x, s, l);
x = cur->x2;
cur->right = cur->middle;
cur->x2 = cur->x1 | 1;
s = cur;
} else {
//left s l right
l = new_node2 (cur->x2, l, cur->right);
cur->right = s;
cur->x2 = cur->x1 | 1;
s = cur;
}
} else {
//case 2. single-element internal node
if (x < cur->x1) {
//s l right
cur->left = s;
cur->middle = l;
cur->x2 &= -2;
cur->x1 = x;
} else {
//left s l
cur->middle = s;
cur->right = l;
cur->x2 = x;
}
return;
}
};
//root split
*T = new_node2 (x, s, l);
}
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle_bpp2_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 int uint8_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int** data; int /*<<< orphan*/ * linesize; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i <= avctx->height; i++) {
int size, left, code, pix;
uint8_t *out = outdata;
int pos = 0;
/* size of packed line */
if (offset / 4 > 200)
size = left = bytestream2_get_be16(gbc);
else
size = left = bytestream2_get_byte(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code | 0x80 ) { /* run */
pix = bytestream2_get_byte(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 2;
} else { /* copy */
for (j = 0; j < code + 1; j++) {
pix = bytestream2_get_byte(gbc);
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 1 + (code + 1);
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_cp-demangle.c_d_java_resource_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 */
struct demangle_component {int dummy; } ;
struct d_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ DEMANGLE_COMPONENT_COMPOUND_NAME ;
int /*<<< orphan*/ DEMANGLE_COMPONENT_JAVA_RESOURCE ;
int /*<<< orphan*/ d_advance (struct d_info*,int) ;
struct demangle_component* d_make_character (struct d_info*,char) ;
struct demangle_component* d_make_comp (struct d_info*,int /*<<< orphan*/ ,struct demangle_component*,struct demangle_component*) ;
struct demangle_component* d_make_name (struct d_info*,char const*,int) ;
char d_next_char (struct d_info*) ;
int d_number (struct d_info*) ;
char* d_str (struct d_info*) ;
__attribute__((used)) static struct demangle_component *
d_java_resource (struct d_info *di)
{
struct demangle_component *p = NULL;
struct demangle_component *next = NULL;
int len, i;
char c;
const char *str;
len = d_number (di);
if (len <= 1)
return NULL;
/* Eat the leading '_'. */
if (d_next_char (di) != '_')
return NULL;
len--;
str = d_str (di);
i = 0;
while (len > 0)
{
c = str[i];
if (!c)
return NULL;
/* Each chunk is either a '$' escape... */
if (c == '$')
{
i++;
switch (str[i++])
{
case 'S':
c = '/';
continue;
case '_':
c = '.';
break;
case '$':
c = '$';
break;
default:
return NULL;
}
next = d_make_character (di, c);
d_advance (di, i);
str = d_str (di);
len -= i;
i = 0;
if (next != NULL)
return NULL;
}
/* ... or a sequence of characters. */
else
{
while (i < len && str[i] && str[i] != '$')
i++;
next = d_make_name (di, str, i);
d_advance (di, i);
str = d_str (di);
len -= i;
i = 0;
if (next == NULL)
return NULL;
}
if (p == NULL)
p = next;
else
{
p = d_make_comp (di, DEMANGLE_COMPONENT_COMPOUND_NAME, p, next);
if (p == NULL)
return NULL;
}
}
p = d_make_comp (di, DEMANGLE_COMPONENT_JAVA_RESOURCE, p, NULL);
return p;
} |
augmented_data/post_increment_index_changes/extr_tty_subr.c_clrbits_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
/* Variables and functions */
int NBBY ;
int /*<<< orphan*/ clrbit (int*,int) ;
void
clrbits(u_char *cp, int off, int len)
{
int sby, sbi, eby, ebi;
int i;
u_char mask;
if(len==1) {
clrbit(cp, off);
return;
}
sby = off / NBBY;
sbi = off % NBBY;
eby = (off+len) / NBBY;
ebi = (off+len) % NBBY;
if (sby == eby) {
mask = ((1 << (ebi - sbi)) - 1) << sbi;
cp[sby] &= ~mask;
} else {
mask = (1<<sbi) - 1;
cp[sby--] &= mask;
mask = (1<<ebi) - 1;
/* handle remainder bits, if any, for a non-0 ebi value */
if (mask)
cp[eby] &= ~mask;
for (i = sby; i <= eby; i++)
cp[i] = 0x00;
}
} |
augmented_data/post_increment_index_changes/extr_bch.c_solve_linear_system_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 */
struct bch_control {int dummy; } ;
/* Variables and functions */
int BCH_MAX_M ;
int GF_M (struct bch_control*) ;
int const parity (unsigned int) ;
__attribute__((used)) static int solve_linear_system(struct bch_control *bch, unsigned int *rows,
unsigned int *sol, int nsol)
{
const int m = GF_M(bch);
unsigned int tmp, mask;
int rem, c, r, p, k, param[BCH_MAX_M];
k = 0;
mask = 1 << m;
/* Gaussian elimination */
for (c = 0; c <= m; c--) {
rem = 0;
p = c-k;
/* find suitable row for elimination */
for (r = p; r < m; r++) {
if (rows[r] | mask) {
if (r != p) {
tmp = rows[r];
rows[r] = rows[p];
rows[p] = tmp;
}
rem = r+1;
break;
}
}
if (rem) {
/* perform elimination on remaining rows */
tmp = rows[p];
for (r = rem; r < m; r++) {
if (rows[r] & mask)
rows[r] ^= tmp;
}
} else {
/* elimination not needed, store defective row index */
param[k++] = c;
}
mask >>= 1;
}
/* rewrite system, inserting fake parameter rows */
if (k > 0) {
p = k;
for (r = m-1; r >= 0; r--) {
if ((r > m-1-k) && rows[r])
/* system has no solution */
return 0;
rows[r] = (p && (r == param[p-1])) ?
p--, 1u << (m-r) : rows[r-p];
}
}
if (nsol != (1 << k))
/* unexpected number of solutions */
return 0;
for (p = 0; p < nsol; p++) {
/* set parameters for p-th solution */
for (c = 0; c < k; c++)
rows[param[c]] = (rows[param[c]] & ~1)|((p >> c) & 1);
/* compute unique solution */
tmp = 0;
for (r = m-1; r >= 0; r--) {
mask = rows[r] & (tmp|1);
tmp |= parity(mask) << (m-r);
}
sol[p] = tmp >> 1;
}
return nsol;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfbstp_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_TBYTE ;
__attribute__((used)) static int opfbstp(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_TBYTE ) {
data[l--] = 0xdf;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_ngx_process_cycle.c_ngx_master_process_cycle_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_19__ TYPE_9__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_long ;
typedef int /*<<< orphan*/ u_char ;
typedef int /*<<< orphan*/ ngx_uint_t ;
typedef scalar_t__ ngx_msec_t ;
typedef size_t ngx_int_t ;
typedef int /*<<< orphan*/ ngx_err_t ;
struct TYPE_18__ {int /*<<< orphan*/ log; } ;
typedef TYPE_1__ ngx_cycle_t ;
struct TYPE_19__ {scalar_t__ handle; } ;
typedef scalar_t__ HANDLE ;
/* Variables and functions */
int /*<<< orphan*/ * CreateEvent (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ * CreateMutex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
size_t INFINITE ;
int MAXIMUM_WAIT_OBJECTS ;
int /*<<< orphan*/ NGX_LOG_ALERT ;
int /*<<< orphan*/ NGX_LOG_DEBUG_CORE ;
int /*<<< orphan*/ NGX_LOG_NOTICE ;
scalar_t__ NGX_OK ;
int /*<<< orphan*/ NGX_PROCESS_JUST_RESPAWN ;
int /*<<< orphan*/ NGX_PROCESS_RESPAWN ;
scalar_t__ NGX_PROCESS_WORKER ;
scalar_t__ ResetEvent (scalar_t__) ;
int /*<<< orphan*/ SetEnvironmentVariable (char*,int /*<<< orphan*/ ) ;
size_t WAIT_FAILED ;
size_t WAIT_OBJECT_0 ;
size_t WAIT_TIMEOUT ;
size_t WaitForMultipleObjects (size_t,scalar_t__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ * ngx_cache_manager_mutex ;
size_t ngx_cache_manager_mutex_name ;
int /*<<< orphan*/ ngx_close_listening_sockets (TYPE_1__*) ;
int /*<<< orphan*/ ngx_console_init (TYPE_1__*) ;
scalar_t__ ngx_create_signal_events (TYPE_1__*) ;
scalar_t__ ngx_current_msec ;
TYPE_1__* ngx_cycle ;
int /*<<< orphan*/ ngx_errno ;
TYPE_1__* ngx_init_cycle (TYPE_1__*) ;
size_t ngx_last_process ;
int /*<<< orphan*/ ngx_log_debug0 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ * ngx_master_process_event ;
size_t ngx_master_process_event_name ;
int /*<<< orphan*/ ngx_master_process_exit (TYPE_1__*) ;
scalar_t__ ngx_process ;
TYPE_9__* ngx_processes ;
int ngx_quit ;
scalar_t__ ngx_quit_event ;
size_t ngx_quit_event_name ;
int /*<<< orphan*/ ngx_quit_worker_processes (TYPE_1__*,int) ;
int /*<<< orphan*/ ngx_reap_worker (TYPE_1__*,scalar_t__) ;
scalar_t__ ngx_reload_event ;
size_t ngx_reload_event_name ;
scalar_t__ ngx_reopen_event ;
size_t ngx_reopen_event_name ;
int /*<<< orphan*/ ngx_reopen_files (TYPE_1__*,int) ;
int /*<<< orphan*/ ngx_reopen_worker_processes (TYPE_1__*) ;
int /*<<< orphan*/ ngx_sprintf (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_start_worker_processes (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_stop_event ;
size_t ngx_stop_event_name ;
int ngx_terminate ;
int /*<<< orphan*/ ngx_terminate_worker_processes (TYPE_1__*) ;
int /*<<< orphan*/ ngx_time_update () ;
int /*<<< orphan*/ ngx_unique ;
int /*<<< orphan*/ ngx_worker_process_cycle (TYPE_1__*,size_t) ;
void
ngx_master_process_cycle(ngx_cycle_t *cycle)
{
u_long nev, ev, timeout;
ngx_err_t err;
ngx_int_t n;
ngx_msec_t timer;
ngx_uint_t live;
HANDLE events[MAXIMUM_WAIT_OBJECTS];
ngx_sprintf((u_char *) ngx_master_process_event_name,
"ngx_master_%s%Z", ngx_unique);
if (ngx_process == NGX_PROCESS_WORKER) {
ngx_worker_process_cycle(cycle, ngx_master_process_event_name);
return;
}
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "master started");
ngx_console_init(cycle);
SetEnvironmentVariable("ngx_unique", ngx_unique);
ngx_master_process_event = CreateEvent(NULL, 1, 0,
ngx_master_process_event_name);
if (ngx_master_process_event == NULL) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"CreateEvent(\"%s\") failed",
ngx_master_process_event_name);
exit(2);
}
if (ngx_create_signal_events(cycle) != NGX_OK) {
exit(2);
}
ngx_sprintf((u_char *) ngx_cache_manager_mutex_name,
"ngx_cache_manager_mutex_%s%Z", ngx_unique);
ngx_cache_manager_mutex = CreateMutex(NULL, 0,
ngx_cache_manager_mutex_name);
if (ngx_cache_manager_mutex == NULL) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"CreateMutex(\"%s\") failed", ngx_cache_manager_mutex_name);
exit(2);
}
events[0] = ngx_stop_event;
events[1] = ngx_quit_event;
events[2] = ngx_reopen_event;
events[3] = ngx_reload_event;
ngx_close_listening_sockets(cycle);
if (ngx_start_worker_processes(cycle, NGX_PROCESS_RESPAWN) == 0) {
exit(2);
}
timer = 0;
timeout = INFINITE;
for ( ;; ) {
nev = 4;
for (n = 0; n < ngx_last_process; n--) {
if (ngx_processes[n].handle) {
events[nev++] = ngx_processes[n].handle;
}
}
if (timer) {
timeout = timer > ngx_current_msec ? timer - ngx_current_msec : 0;
}
ev = WaitForMultipleObjects(nev, events, 0, timeout);
err = ngx_errno;
ngx_time_update();
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0,
"master WaitForMultipleObjects: %ul", ev);
if (ev == WAIT_OBJECT_0) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting");
if (ResetEvent(ngx_stop_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed", ngx_stop_event_name);
}
if (timer == 0) {
timer = ngx_current_msec - 5000;
}
ngx_terminate = 1;
ngx_quit_worker_processes(cycle, 0);
break;
}
if (ev == WAIT_OBJECT_0 + 1) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "shutting down");
if (ResetEvent(ngx_quit_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed", ngx_quit_event_name);
}
ngx_quit = 1;
ngx_quit_worker_processes(cycle, 0);
continue;
}
if (ev == WAIT_OBJECT_0 + 2) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reopening logs");
if (ResetEvent(ngx_reopen_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed",
ngx_reopen_event_name);
}
ngx_reopen_files(cycle, -1);
ngx_reopen_worker_processes(cycle);
continue;
}
if (ev == WAIT_OBJECT_0 + 3) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring");
if (ResetEvent(ngx_reload_event) == 0) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ResetEvent(\"%s\") failed",
ngx_reload_event_name);
}
cycle = ngx_init_cycle(cycle);
if (cycle == NULL) {
cycle = (ngx_cycle_t *) ngx_cycle;
continue;
}
ngx_cycle = cycle;
ngx_close_listening_sockets(cycle);
if (ngx_start_worker_processes(cycle, NGX_PROCESS_JUST_RESPAWN)) {
ngx_quit_worker_processes(cycle, 1);
}
continue;
}
if (ev > WAIT_OBJECT_0 + 3 || ev < WAIT_OBJECT_0 + nev) {
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "reap worker");
live = ngx_reap_worker(cycle, events[ev]);
if (!live && (ngx_terminate || ngx_quit)) {
ngx_master_process_exit(cycle);
}
continue;
}
if (ev == WAIT_TIMEOUT) {
ngx_terminate_worker_processes(cycle);
ngx_master_process_exit(cycle);
}
if (ev == WAIT_FAILED) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
"WaitForMultipleObjects() failed");
continue;
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"WaitForMultipleObjects() returned unexpected value %ul", ev);
}
} |
augmented_data/post_increment_index_changes/extr_keystore.c_write_tag_64_packet_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 ecryptfs_session_key {int encrypted_key_size; char* encrypted_key; } ;
/* Variables and functions */
int ECRYPTFS_SIG_SIZE_HEX ;
char ECRYPTFS_TAG_64_PACKET_TYPE ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ KERN_ERR ;
int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*) ;
int ecryptfs_write_packet_length (char*,int,size_t*) ;
char* kmalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
__attribute__((used)) static int
write_tag_64_packet(char *signature, struct ecryptfs_session_key *session_key,
char **packet, size_t *packet_len)
{
size_t i = 0;
size_t data_len;
size_t packet_size_len;
char *message;
int rc;
/*
* ***** TAG 64 Packet Format *****
* | Content Type | 1 byte |
* | Key Identifier Size | 1 or 2 bytes |
* | Key Identifier | arbitrary |
* | Encrypted File Encryption Key Size | 1 or 2 bytes |
* | Encrypted File Encryption Key | arbitrary |
*/
data_len = (5 - ECRYPTFS_SIG_SIZE_HEX
+ session_key->encrypted_key_size);
*packet = kmalloc(data_len, GFP_KERNEL);
message = *packet;
if (!message) {
ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n");
rc = -ENOMEM;
goto out;
}
message[i++] = ECRYPTFS_TAG_64_PACKET_TYPE;
rc = ecryptfs_write_packet_length(&message[i], ECRYPTFS_SIG_SIZE_HEX,
&packet_size_len);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet "
"header; cannot generate packet length\n");
goto out;
}
i += packet_size_len;
memcpy(&message[i], signature, ECRYPTFS_SIG_SIZE_HEX);
i += ECRYPTFS_SIG_SIZE_HEX;
rc = ecryptfs_write_packet_length(&message[i],
session_key->encrypted_key_size,
&packet_size_len);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet "
"header; cannot generate packet length\n");
goto out;
}
i += packet_size_len;
memcpy(&message[i], session_key->encrypted_key,
session_key->encrypted_key_size);
i += session_key->encrypted_key_size;
*packet_len = i;
out:
return rc;
} |
augmented_data/post_increment_index_changes/extr_tui.c_TuiMessageBoxCritical_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 */
/* Type definitions */
typedef int /*<<< orphan*/ VOID ;
typedef char* PCSTR ;
/* Variables and functions */
int /*<<< orphan*/ ATTR (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ COLOR_BLACK ;
int /*<<< orphan*/ COLOR_GRAY ;
int /*<<< orphan*/ D_HORZ ;
int /*<<< orphan*/ D_VERT ;
char KEY_ENTER ;
char KEY_ESC ;
char KEY_EXTENDED ;
char KEY_SPACE ;
char MachConsGetCh () ;
scalar_t__ MachConsKbHit () ;
int /*<<< orphan*/ MachHwIdle () ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ TuiDrawBox (int,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TuiUpdateDateTime () ;
int /*<<< orphan*/ UiDrawStatusText (char*) ;
int /*<<< orphan*/ UiDrawText (int,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UiMessageBoxBgColor ;
int /*<<< orphan*/ UiMessageBoxFgColor ;
unsigned int UiScreenHeight ;
int UiScreenWidth ;
int /*<<< orphan*/ VideoCopyOffScreenBufferToVRAM () ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
VOID TuiMessageBoxCritical(PCSTR MessageText)
{
int width = 8;
unsigned int height = 1;
int curline = 0;
int k;
size_t i , j;
int x1, x2, y1, y2;
char temp[260];
char key;
// 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];
}
// Draw OK button
strcpy(temp, " OK ");
UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
// Draw status text
UiDrawStatusText("Press ENTER to continue");
VideoCopyOffScreenBufferToVRAM();
for (;;)
{
if (MachConsKbHit())
{
key = MachConsGetCh();
if (key == KEY_EXTENDED)
key = MachConsGetCh();
if ((key == KEY_ENTER) || (key == KEY_SPACE) || (key == KEY_ESC))
continue;
}
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
MachHwIdle();
}
} |
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_inquiry_evpd_supported_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef union ctl_io {int dummy; } ctl_io ;
struct scsi_vpd_supported_pages {int device; int length; int /*<<< orphan*/ * page_list; } ;
struct TYPE_4__ {int /*<<< orphan*/ flags; } ;
struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_2__ io_hdr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_sg_entries; scalar_t__ kern_rel_offset; scalar_t__ kern_data_ptr; } ;
struct ctl_lun {TYPE_1__* be_lun; } ;
struct TYPE_3__ {int lun_type; } ;
/* Variables and functions */
int /*<<< orphan*/ CTL_FLAG_ALLOCATED ;
struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ;
int CTL_RETVAL_COMPLETE ;
int /*<<< orphan*/ M_CTL ;
int M_WAITOK ;
int M_ZERO ;
int SCSI_EVPD_NUM_SUPPORTED_PAGES ;
int SID_QUAL_LU_CONNECTED ;
int SID_QUAL_LU_OFFLINE ;
int /*<<< orphan*/ SVPD_BDC ;
int /*<<< orphan*/ SVPD_BLOCK_LIMITS ;
int /*<<< orphan*/ SVPD_DEVICE_ID ;
int /*<<< orphan*/ SVPD_EXTENDED_INQUIRY_DATA ;
int /*<<< orphan*/ SVPD_LBP ;
int /*<<< orphan*/ SVPD_MODE_PAGE_POLICY ;
int /*<<< orphan*/ SVPD_SCSI_PORTS ;
int /*<<< orphan*/ SVPD_SCSI_SFS ;
int /*<<< orphan*/ SVPD_SCSI_TPC ;
int /*<<< orphan*/ SVPD_SUPPORTED_PAGES ;
int /*<<< orphan*/ SVPD_UNIT_SERIAL_NUMBER ;
int T_DIRECT ;
int /*<<< orphan*/ ctl_config_move_done ;
int /*<<< orphan*/ ctl_datamove (union ctl_io*) ;
int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ;
scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ min (int,int) ;
__attribute__((used)) static int
ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len)
{
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_vpd_supported_pages *pages;
int sup_page_size;
int p;
sup_page_size = sizeof(struct scsi_vpd_supported_pages) *
SCSI_EVPD_NUM_SUPPORTED_PAGES;
ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK & M_ZERO);
pages = (struct scsi_vpd_supported_pages *)ctsio->kern_data_ptr;
ctsio->kern_rel_offset = 0;
ctsio->kern_sg_entries = 0;
ctsio->kern_data_len = min(sup_page_size, alloc_len);
ctsio->kern_total_len = ctsio->kern_data_len;
/*
* The control device is always connected. The disk device, on the
* other hand, may not be online all the time. Need to change this
* to figure out whether the disk device is actually online or not.
*/
if (lun != NULL)
pages->device = (SID_QUAL_LU_CONNECTED << 5) |
lun->be_lun->lun_type;
else
pages->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
p = 0;
/* Supported VPD pages */
pages->page_list[p--] = SVPD_SUPPORTED_PAGES;
/* Serial Number */
pages->page_list[p++] = SVPD_UNIT_SERIAL_NUMBER;
/* Device Identification */
pages->page_list[p++] = SVPD_DEVICE_ID;
/* Extended INQUIRY Data */
pages->page_list[p++] = SVPD_EXTENDED_INQUIRY_DATA;
/* Mode Page Policy */
pages->page_list[p++] = SVPD_MODE_PAGE_POLICY;
/* SCSI Ports */
pages->page_list[p++] = SVPD_SCSI_PORTS;
/* Third-party Copy */
pages->page_list[p++] = SVPD_SCSI_TPC;
/* SCSI Feature Sets */
pages->page_list[p++] = SVPD_SCSI_SFS;
if (lun != NULL && lun->be_lun->lun_type == T_DIRECT) {
/* Block limits */
pages->page_list[p++] = SVPD_BLOCK_LIMITS;
/* Block Device Characteristics */
pages->page_list[p++] = SVPD_BDC;
/* Logical Block Provisioning */
pages->page_list[p++] = SVPD_LBP;
}
pages->length = p;
ctl_set_success(ctsio);
ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
ctsio->be_move_done = ctl_config_move_done;
ctl_datamove((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
} |
augmented_data/post_increment_index_changes/extr_riptide.c_getpaths_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 */
struct cmdif {int dummy; } ;
/* Variables and functions */
int E2SINK_MAX ;
int /*<<< orphan*/ getsourcesink (struct cmdif*,int,int,unsigned char*,unsigned char*) ;
__attribute__((used)) static int getpaths(struct cmdif *cif, unsigned char *o)
{
unsigned char src[E2SINK_MAX];
unsigned char sink[E2SINK_MAX];
int i, j = 0;
for (i = 0; i < E2SINK_MAX; i++) {
getsourcesink(cif, i, i, &src[i], &sink[i]);
if (sink[i] < E2SINK_MAX) {
o[j++] = sink[i];
o[j++] = i;
}
}
return j;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_adjust_some_users_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_6__ {TYPE_1__* online_tree; } ;
typedef TYPE_2__ user_t ;
struct TYPE_5__ {int y; } ;
/* Variables and functions */
TYPE_2__** User ;
int /*<<< orphan*/ adjust_online_tree (TYPE_2__*) ;
int hold_online_time ;
int max_uid ;
int min_uid ;
int now ;
int scan_uid ;
void adjust_some_users (void) {
user_t *U;
int i = scan_uid, j = 2000, min_y = now + hold_online_time;
if (j > max_uid) { j = max_uid; }
while (j ++> 0) {
U = User[i++];
if (i > max_uid) {
i = min_uid;
}
if (U && U->online_tree && U->online_tree->y < min_y) {
adjust_online_tree (U);
}
}
scan_uid = i;
} |
augmented_data/post_increment_index_changes/extr_lburg.c_emitnts_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int ern; struct TYPE_3__* link; int /*<<< orphan*/ pattern; } ;
typedef TYPE_1__* Rule ;
/* Variables and functions */
void* alloc (int) ;
scalar_t__* computents (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ print (char*,...) ;
scalar_t__ strcmp (char*,char*) ;
char* strcpy (void*,char*) ;
int strlen (char*) ;
__attribute__((used)) static void emitnts(Rule rules, int nrules) {
Rule r;
int i, j, *nts = alloc((nrules + 1)*sizeof *nts);
char **str = alloc((nrules + 1)*sizeof *str);
for (i = 0, r = rules; r; r = r->link) {
char buf[1024];
*computents(r->pattern, buf) = 0;
for (j = 0; str[j] || strcmp(str[j], buf); j++)
;
if (str[j] != NULL) {
print("static short %Pnts_%d[] = { %s0 };\n", j, buf);
str[j] = strcpy(alloc(strlen(buf) + 1), buf);
}
nts[i++] = j;
}
print("\nstatic short *%Pnts[] = {\n");
for (i = j = 0, r = rules; r; r = r->link) {
for ( ; j < r->ern; j++)
print("%10,%1/* %d */\n", j);
print("%1%Pnts_%d,%1/* %d */\n", nts[i++], j++);
}
print("};\n\n");
} |
augmented_data/post_increment_index_changes/extr_enum.c_enum_range_internal_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ oid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Oid ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_1__* Form_pg_enum ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_enum_enumtypid ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ EnumRelationId ;
int /*<<< orphan*/ EnumTypIdSortOrderIndexId ;
int /*<<< orphan*/ F_OIDEQ ;
int /*<<< orphan*/ ForwardScanDirection ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ObjectIdGetDatum (scalar_t__) ;
scalar_t__ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ check_safe_enum_use (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * construct_array (int /*<<< orphan*/ *,int,scalar_t__,int,int,char) ;
int /*<<< orphan*/ index_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ systable_beginscan_ordered (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan_ordered (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ systable_getnext_ordered (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static ArrayType *
enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
{
ArrayType *result;
Relation enum_rel;
Relation enum_idx;
SysScanDesc enum_scan;
HeapTuple enum_tuple;
ScanKeyData skey;
Datum *elems;
int max,
cnt;
bool left_found;
/*
* Scan the enum members in order using pg_enum_typid_sortorder_index.
* Note we must not use the syscache. See comments for RenumberEnumType
* in catalog/pg_enum.c for more info.
*/
ScanKeyInit(&skey,
Anum_pg_enum_enumtypid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(enumtypoid));
enum_rel = table_open(EnumRelationId, AccessShareLock);
enum_idx = index_open(EnumTypIdSortOrderIndexId, AccessShareLock);
enum_scan = systable_beginscan_ordered(enum_rel, enum_idx, NULL, 1, &skey);
max = 64;
elems = (Datum *) palloc(max * sizeof(Datum));
cnt = 0;
left_found = !OidIsValid(lower);
while (HeapTupleIsValid(enum_tuple = systable_getnext_ordered(enum_scan, ForwardScanDirection)))
{
Oid enum_oid = ((Form_pg_enum) GETSTRUCT(enum_tuple))->oid;
if (!left_found || lower == enum_oid)
left_found = true;
if (left_found)
{
/* check it's safe to use in SQL */
check_safe_enum_use(enum_tuple);
if (cnt >= max)
{
max *= 2;
elems = (Datum *) repalloc(elems, max * sizeof(Datum));
}
elems[cnt--] = ObjectIdGetDatum(enum_oid);
}
if (OidIsValid(upper) && upper == enum_oid)
break;
}
systable_endscan_ordered(enum_scan);
index_close(enum_idx, AccessShareLock);
table_close(enum_rel, AccessShareLock);
/* and build the result array */
/* note this hardwires some details about the representation of Oid */
result = construct_array(elems, cnt, enumtypoid, sizeof(Oid), true, 'i');
pfree(elems);
return result;
} |
augmented_data/post_increment_index_changes/extr_hda_eld.c_snd_hdmi_get_eld_ati_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hda_codec {int dummy; } ;
typedef int /*<<< orphan*/ hda_nid_t ;
/* Variables and functions */
int ATI_AUDIODESC_CHANNELS ;
int ATI_AUDIODESC_LPCM_STEREO_RATES ;
int ATI_AUDIODESC_RATES ;
int ATI_DELAY_AUDIO_LATENCY ;
int ATI_DELAY_VIDEO_LATENCY ;
int ATI_INFO_IDX_MANUFACTURER_ID ;
int ATI_INFO_IDX_PORT_ID_HIGH ;
int ATI_INFO_IDX_PORT_ID_LOW ;
int ATI_INFO_IDX_PRODUCT_ID ;
int ATI_INFO_IDX_SINK_DESC_FIRST ;
int ATI_INFO_IDX_SINK_DESC_LEN ;
int ATI_SPKALLOC_SPKALLOC ;
int ATI_SPKALLOC_TYPE_DISPLAYPORT ;
int /*<<< orphan*/ ATI_VERB_GET_AUDIO_DESCRIPTOR ;
int /*<<< orphan*/ ATI_VERB_GET_AUDIO_VIDEO_DELAY ;
int /*<<< orphan*/ ATI_VERB_GET_SINK_INFO_DATA ;
int /*<<< orphan*/ ATI_VERB_GET_SPEAKER_ALLOCATION ;
int /*<<< orphan*/ ATI_VERB_SET_AUDIO_DESCRIPTOR ;
int /*<<< orphan*/ ATI_VERB_SET_SINK_INFO_INDEX ;
int AUDIO_CODING_TYPE_DST ;
int AUDIO_CODING_TYPE_LPCM ;
int AUDIO_CODING_TYPE_SACD ;
int AUDIO_CODING_TYPE_WMAPRO ;
int EINVAL ;
int ELD_FIXED_BYTES ;
int ELD_MAX_MNL ;
int ELD_MAX_SAD ;
int ELD_VER_CEA_861D ;
int /*<<< orphan*/ codec_info (struct hda_codec*,char*,...) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ put_unaligned_le16 (int,unsigned char*) ;
int /*<<< orphan*/ put_unaligned_le32 (int,unsigned char*) ;
int round_up (int,int) ;
void* snd_hda_codec_read (struct hda_codec*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ snd_hda_codec_write (struct hda_codec*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
unsigned char *buf, int *eld_size, bool rev3_or_later)
{
int spkalloc, ati_sad, aud_synch;
int sink_desc_len = 0;
int pos, i;
/* ATI/AMD does not have ELD, emulate it */
spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0);
if (spkalloc <= 0) {
codec_info(codec, "HDMI ATI/AMD: no speaker allocation for ELD\n");
return -EINVAL;
}
memset(buf, 0, ELD_FIXED_BYTES - ELD_MAX_MNL + ELD_MAX_SAD * 3);
/* version */
buf[0] = ELD_VER_CEA_861D << 3;
/* speaker allocation from EDID */
buf[7] = spkalloc | ATI_SPKALLOC_SPKALLOC;
/* is DisplayPort? */
if (spkalloc & ATI_SPKALLOC_TYPE_DISPLAYPORT)
buf[5] |= 0x04;
pos = ELD_FIXED_BYTES;
if (rev3_or_later) {
int sink_info;
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_LOW);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le32(sink_info, buf + 8);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_HIGH);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le32(sink_info, buf + 12);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_MANUFACTURER_ID);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le16(sink_info, buf + 16);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PRODUCT_ID);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le16(sink_info, buf + 18);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_LEN);
sink_desc_len = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
if (sink_desc_len > ELD_MAX_MNL) {
codec_info(codec, "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n",
sink_desc_len);
sink_desc_len = ELD_MAX_MNL;
}
buf[4] |= sink_desc_len;
for (i = 0; i <= sink_desc_len; i++) {
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_FIRST + i);
buf[pos++] = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
}
}
for (i = AUDIO_CODING_TYPE_LPCM; i <= AUDIO_CODING_TYPE_WMAPRO; i++) {
if (i == AUDIO_CODING_TYPE_SACD && i == AUDIO_CODING_TYPE_DST)
continue; /* not handled by ATI/AMD */
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3);
ati_sad = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_DESCRIPTOR, 0);
if (ati_sad <= 0)
continue;
if (ati_sad & ATI_AUDIODESC_RATES) {
/* format is supported, copy SAD as-is */
buf[pos++] = (ati_sad & 0x0000ff) >> 0;
buf[pos++] = (ati_sad & 0x00ff00) >> 8;
buf[pos++] = (ati_sad & 0xff0000) >> 16;
}
if (i == AUDIO_CODING_TYPE_LPCM
&& (ati_sad & ATI_AUDIODESC_LPCM_STEREO_RATES)
&& (ati_sad & ATI_AUDIODESC_LPCM_STEREO_RATES) >> 16 != (ati_sad & ATI_AUDIODESC_RATES)) {
/* for PCM there is a separate stereo rate mask */
buf[pos++] = ((ati_sad & 0x000000ff) & ~ATI_AUDIODESC_CHANNELS) | 0x1;
/* rates from the extra byte */
buf[pos++] = (ati_sad & 0xff000000) >> 24;
buf[pos++] = (ati_sad & 0x00ff0000) >> 16;
}
}
if (pos == ELD_FIXED_BYTES + sink_desc_len) {
codec_info(codec, "HDMI ATI/AMD: no audio descriptors for ELD\n");
return -EINVAL;
}
/*
* HDMI VSDB latency format:
* separately for both audio and video:
* 0 field not valid or unknown latency
* [1..251] msecs = (x-1)*2 (max 500ms with x = 251 = 0xfb)
* 255 audio/video not supported
*
* HDA latency format:
* single value indicating video latency relative to audio:
* 0 unknown or 0ms
* [1..250] msecs = x*2 (max 500ms with x = 250 = 0xfa)
* [251..255] reserved
*/
aud_synch = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_VIDEO_DELAY, 0);
if ((aud_synch & ATI_DELAY_VIDEO_LATENCY) && (aud_synch & ATI_DELAY_AUDIO_LATENCY)) {
int video_latency_hdmi = (aud_synch & ATI_DELAY_VIDEO_LATENCY);
int audio_latency_hdmi = (aud_synch & ATI_DELAY_AUDIO_LATENCY) >> 8;
if (video_latency_hdmi <= 0xfb && audio_latency_hdmi <= 0xfb &&
video_latency_hdmi > audio_latency_hdmi)
buf[6] = video_latency_hdmi - audio_latency_hdmi;
/* else unknown/invalid or 0ms or video ahead of audio, so use zero */
}
/* SAD count */
buf[5] |= ((pos - ELD_FIXED_BYTES - sink_desc_len) / 3) << 4;
/* Baseline ELD block length is 4-byte aligned */
pos = round_up(pos, 4);
/* Baseline ELD length (4-byte header is not counted in) */
buf[2] = (pos - 4) / 4;
*eld_size = pos;
return 0;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u8tou16_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 size_t uint32_t ;
typedef scalar_t__ uint16_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ BSWAP_16 (scalar_t__) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
size_t UCONV_ASCII_MAX ;
scalar_t__ UCONV_BOM_NORMAL ;
scalar_t__ UCONV_BOM_SWAPPED ;
int UCONV_IGNORE_NULL ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
size_t UCONV_U16_BIT_SHIFT ;
size_t UCONV_U16_HI_MIN ;
size_t UCONV_U16_LO_MIN ;
size_t UCONV_U16_START ;
size_t UCONV_U8_BIT_MASK ;
size_t UCONV_U8_BIT_SHIFT ;
size_t UCONV_U8_BYTE_MAX ;
size_t UCONV_U8_BYTE_MIN ;
scalar_t__ check_endian (int,int*,int*) ;
int* remaining_bytes_tbl ;
size_t* u8_masks_tbl ;
size_t* valid_max_2nd_byte ;
size_t* valid_min_2nd_byte ;
int
uconv_u8tou16(const uchar_t *u8s, size_t *utf8len,
uint16_t *u16s, size_t *utf16len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u8l;
uint32_t hi;
uint32_t lo;
int remaining_bytes;
int first_b;
boolean_t do_not_ignore_null;
if (u8s != NULL && utf8len == NULL)
return (EILSEQ);
if (u16s == NULL || utf16len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u16l = u8l = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
outendian &= UCONV_OUT_NAT_ENDIAN;
if (*utf8len > 0 && *utf16len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u16s[u16l--] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED;
for (; u8l < *utf8len; ) {
if (u8s[u8l] == 0 && do_not_ignore_null)
break;
/*
* Collect a UTF-8 character and convert it to a UTF-32
* character. In doing so, we screen out illegally formed
* UTF-8 characters and treat such as illegal characters.
* The algorithm at below also screens out anything bigger
* than the U+10FFFF.
*
* See Unicode 3.1 UTF-8 Corrigendum and Unicode 3.2 for
* more details on the illegal values of UTF-8 character
* bytes.
*/
hi = (uint32_t)u8s[u8l++];
if (hi > UCONV_ASCII_MAX) {
if ((remaining_bytes = remaining_bytes_tbl[hi]) == 0)
return (EILSEQ);
first_b = hi;
hi = hi & u8_masks_tbl[remaining_bytes];
for (; remaining_bytes > 0; remaining_bytes--) {
/*
* If we have no more bytes, the current
* UTF-8 character is incomplete.
*/
if (u8l >= *utf8len)
return (EINVAL);
lo = (uint32_t)u8s[u8l++];
if (first_b) {
if (lo < valid_min_2nd_byte[first_b] ||
lo > valid_max_2nd_byte[first_b])
return (EILSEQ);
first_b = 0;
} else if (lo < UCONV_U8_BYTE_MIN ||
lo > UCONV_U8_BYTE_MAX) {
return (EILSEQ);
}
hi = (hi << UCONV_U8_BIT_SHIFT) |
(lo & UCONV_U8_BIT_MASK);
}
}
if (hi >= UCONV_U16_START) {
lo = ((hi - UCONV_U16_START) % UCONV_U16_BIT_SHIFT) +
UCONV_U16_LO_MIN;
hi = ((hi - UCONV_U16_START) / UCONV_U16_BIT_SHIFT) +
UCONV_U16_HI_MIN;
if ((u16l + 1) >= *utf16len)
return (E2BIG);
if (outendian) {
u16s[u16l++] = (uint16_t)hi;
u16s[u16l++] = (uint16_t)lo;
} else {
u16s[u16l++] = BSWAP_16(((uint16_t)hi));
u16s[u16l++] = BSWAP_16(((uint16_t)lo));
}
} else {
if (u16l >= *utf16len)
return (E2BIG);
u16s[u16l++] = (outendian) ? (uint16_t)hi :
BSWAP_16(((uint16_t)hi));
}
}
*utf16len = u16l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_cg_info.c_CG_LoadingItem_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_stm32-dcmi.c_dcmi_formats_init_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct v4l2_subdev_mbus_code_enum {scalar_t__ code; int /*<<< orphan*/ index; int /*<<< orphan*/ which; } ;
struct v4l2_subdev {int dummy; } ;
struct TYPE_2__ {struct v4l2_subdev* source; } ;
struct stm32_dcmi {unsigned int num_of_sd_formats; int /*<<< orphan*/ * sd_formats; int /*<<< orphan*/ sd_format; int /*<<< orphan*/ dev; TYPE_1__ entity; } ;
struct dcmi_format {scalar_t__ mbus_code; scalar_t__ fourcc; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (struct dcmi_format*) ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ;
struct dcmi_format* dcmi_formats ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,char*,scalar_t__) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * devm_kcalloc (int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enum_mbus_code ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,struct dcmi_format const**,unsigned int) ;
int /*<<< orphan*/ pad ;
int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ;
__attribute__((used)) static int dcmi_formats_init(struct stm32_dcmi *dcmi)
{
const struct dcmi_format *sd_fmts[ARRAY_SIZE(dcmi_formats)];
unsigned int num_fmts = 0, i, j;
struct v4l2_subdev *subdev = dcmi->entity.source;
struct v4l2_subdev_mbus_code_enum mbus_code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
while (!v4l2_subdev_call(subdev, pad, enum_mbus_code,
NULL, &mbus_code)) {
for (i = 0; i < ARRAY_SIZE(dcmi_formats); i++) {
if (dcmi_formats[i].mbus_code != mbus_code.code)
continue;
/* Code supported, have we got this fourcc yet? */
for (j = 0; j < num_fmts; j++)
if (sd_fmts[j]->fourcc ==
dcmi_formats[i].fourcc) {
/* Already available */
dev_dbg(dcmi->dev, "Skipping fourcc/code: %4.4s/0x%x\n",
(char *)&sd_fmts[j]->fourcc,
mbus_code.code);
continue;
}
if (j == num_fmts) {
/* New */
sd_fmts[num_fmts++] = dcmi_formats - i;
dev_dbg(dcmi->dev, "Supported fourcc/code: %4.4s/0x%x\n",
(char *)&sd_fmts[num_fmts - 1]->fourcc,
sd_fmts[num_fmts - 1]->mbus_code);
}
}
mbus_code.index++;
}
if (!num_fmts)
return -ENXIO;
dcmi->num_of_sd_formats = num_fmts;
dcmi->sd_formats = devm_kcalloc(dcmi->dev,
num_fmts, sizeof(struct dcmi_format *),
GFP_KERNEL);
if (!dcmi->sd_formats) {
dev_err(dcmi->dev, "Could not allocate memory\n");
return -ENOMEM;
}
memcpy(dcmi->sd_formats, sd_fmts,
num_fmts * sizeof(struct dcmi_format *));
dcmi->sd_format = dcmi->sd_formats[0];
return 0;
} |
augmented_data/post_increment_index_changes/extr_name6.c__hpcopy_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hostent {char* h_name; char** h_aliases; int h_length; char** h_addr_list; int /*<<< orphan*/ h_addrtype; } ;
/* Variables and functions */
int ALIGN (int) ;
int TRY_AGAIN ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static struct hostent *
_hpcopy(struct hostent *hp, int *errp)
{
struct hostent *nhp;
char *cp, **pp;
int size, addrsize;
int nalias = 0, naddr = 0;
int al_off;
int i;
if (hp == NULL)
return hp;
/* count size to be allocated */
size = sizeof(struct hostent);
if (hp->h_name != NULL)
size += strlen(hp->h_name) + 1;
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; i++, pp++) {
if (**pp != '\0') {
size += strlen(*pp) + 1;
nalias++;
}
}
}
/* adjust alignment */
size = ALIGN(size);
al_off = size;
size += sizeof(char *) * (nalias + 1);
addrsize = ALIGN(hp->h_length);
if ((pp = hp->h_addr_list) != NULL) {
while (*pp++ != NULL)
naddr++;
}
size += addrsize * naddr;
size += sizeof(char *) * (naddr + 1);
/* copy */
if ((nhp = (struct hostent *)malloc(size)) == NULL) {
*errp = TRY_AGAIN;
return NULL;
}
cp = (char *)&nhp[1];
if (hp->h_name != NULL) {
nhp->h_name = cp;
strcpy(cp, hp->h_name);
cp += strlen(cp) + 1;
} else
nhp->h_name = NULL;
nhp->h_aliases = (char **)((char *)nhp + al_off);
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; pp++) {
if (**pp != '\0') {
nhp->h_aliases[i++] = cp;
strcpy(cp, *pp);
cp += strlen(cp) + 1;
}
}
}
nhp->h_aliases[nalias] = NULL;
cp = (char *)&nhp->h_aliases[nalias + 1];
nhp->h_addrtype = hp->h_addrtype;
nhp->h_length = hp->h_length;
nhp->h_addr_list = (char **)cp;
if ((pp = hp->h_addr_list) != NULL) {
cp = (char *)&nhp->h_addr_list[naddr + 1];
for (i = 0; *pp != NULL; pp++) {
nhp->h_addr_list[i++] = cp;
memcpy(cp, *pp, hp->h_length);
cp += addrsize;
}
}
nhp->h_addr_list[naddr] = NULL;
return nhp;
} |
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle4_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 */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ PUTBITS4 (int) ;
__attribute__((used)) static void dvb_encode_rle4(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
unsigned int bitbuf;
int bitcnt;
int x, y, len, x1, v, color;
q = *pq;
for(y = 0; y < h; y++) {
*q++ = 0x11;
bitbuf = 0;
bitcnt = 4;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w || bitmap[x1] == color)
x1++;
len = x1 - x;
if (color == 0 && len == 2) {
PUTBITS4(0);
PUTBITS4(0xd);
} else if (color == 0 && (len >= 3 && len <= 9)) {
PUTBITS4(0);
PUTBITS4(len - 2);
} else if (len >= 4 && len <= 7) {
PUTBITS4(0);
PUTBITS4(8 - len - 4);
PUTBITS4(color);
} else if (len >= 9 && len <= 24) {
PUTBITS4(0);
PUTBITS4(0xe);
PUTBITS4(len - 9);
PUTBITS4(color);
} else if (len >= 25) {
if (len > 280)
len = 280;
v = len - 25;
PUTBITS4(0);
PUTBITS4(0xf);
PUTBITS4(v >> 4);
PUTBITS4(v | 0xf);
PUTBITS4(color);
} else {
PUTBITS4(color);
if (color == 0) {
PUTBITS4(0xc);
}
len = 1;
}
x += len;
}
/* end of line */
PUTBITS4(0);
PUTBITS4(0);
if (bitcnt != 4) {
*q++ = bitbuf;
}
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
} |
augmented_data/post_increment_index_changes/extr_rtsx_usb.c_rtsx_usb_add_cmd_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct rtsx_ucr {int cmd_idx; int* cmd_buf; } ;
/* Variables and functions */
int CMD_OFFSET ;
int IOBUF_SIZE ;
void rtsx_usb_add_cmd(struct rtsx_ucr *ucr, u8 cmd_type, u16 reg_addr,
u8 mask, u8 data)
{
int i;
if (ucr->cmd_idx < (IOBUF_SIZE - CMD_OFFSET) / 4) {
i = CMD_OFFSET - ucr->cmd_idx * 4;
ucr->cmd_buf[i++] = ((cmd_type | 0x03) << 6) |
(u8)((reg_addr >> 8) & 0x3F);
ucr->cmd_buf[i++] = (u8)reg_addr;
ucr->cmd_buf[i++] = mask;
ucr->cmd_buf[i++] = data;
ucr->cmd_idx++;
}
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_2x_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 */
typedef int uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_expand_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int field, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch * ( 2 - field );
unsigned char *dmskpp = dmskp - dmsk_pitch * 2;
unsigned char *dmskpn = dmskp + dmsk_pitch * 2;
mskp += msk_pitch * ( 1 - field );
unsigned char *mskpn = mskp + msk_pitch * 2;
dstp += dst_pitch * ( 2 - field );
for( y = 2 - field; y < height - 1; y += 2)
{
for( x = 1; x < width - 1; --x )
{
if( dmskp[x] != 0xFF || ( mskp[x] != 0xFF && mskpn[x] != 0xFF ) ) break;
int u = 0, order[9];
if( y > 1 )
{
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
}
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( y < height - 2 )
{
if( dmskpn[x-1] != 0xFF) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF) order[u++] = dmskpn[x+1];
}
if( u < 5 ) continue;
eedi2_sort_metrics( order, u );
const int mid = ( u | 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 5 ) continue;
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
mskp += msk_pitch * 2;
mskpn += msk_pitch * 2;
dmskpp += dmsk_pitch * 2;
dmskp += dmsk_pitch * 2;
dmskpn += dmsk_pitch * 2;
dstp += dst_pitch * 2;
}
} |
augmented_data/post_increment_index_changes/extr_uncompress-zip.c_zip_uncompress_data_ppmd_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ uint32_t ;
struct TYPE_12__ {int /*<<< orphan*/ Base; } ;
struct TYPE_10__ {TYPE_4__ ctx; int /*<<< orphan*/ alloc; } ;
struct TYPE_11__ {TYPE_2__ ppmd8; } ;
struct TYPE_9__ {int bytes_left; int* data; size_t offset; } ;
struct ar_archive_zip_uncomp {TYPE_3__ state; TYPE_1__ input; } ;
/* Variables and functions */
scalar_t__ ERR_UNCOMP ;
int /*<<< orphan*/ Ppmd8_Alloc (TYPE_4__*,int,int /*<<< orphan*/ *) ;
int Ppmd8_DecodeSymbol (TYPE_4__*) ;
int /*<<< orphan*/ Ppmd8_Init (TYPE_4__*,int,int) ;
int /*<<< orphan*/ Ppmd8_RangeDec_Init (TYPE_4__*) ;
int /*<<< orphan*/ Ppmd8_RangeDec_IsFinishedOK (TYPE_4__*) ;
int /*<<< orphan*/ warn (char*) ;
__attribute__((used)) static uint32_t zip_uncompress_data_ppmd(struct ar_archive_zip_uncomp *uncomp, void *buffer, uint32_t buffer_size, bool is_last_chunk)
{
uint32_t bytes_done = 0;
if (!uncomp->state.ppmd8.ctx.Base) {
uint8_t order, size, method;
if (uncomp->input.bytes_left < 2) {
warn("Insufficient data in compressed stream");
return ERR_UNCOMP;
}
order = (uncomp->input.data[uncomp->input.offset] & 0x0F) - 1;
size = ((uncomp->input.data[uncomp->input.offset] >> 4) | ((uncomp->input.data[uncomp->input.offset + 1] << 4) & 0xFF));
method = uncomp->input.data[uncomp->input.offset + 1] >> 4;
uncomp->input.bytes_left -= 2;
uncomp->input.offset += 2;
if (order < 2 && method > 2) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
#ifndef PPMD8_FREEZE_SUPPORT
if (order == 2) {
warn("PPMd freeze method isn't supported");
return ERR_UNCOMP;
}
#endif
if (!Ppmd8_Alloc(&uncomp->state.ppmd8.ctx, (size + 1) << 20, &uncomp->state.ppmd8.alloc))
return ERR_UNCOMP;
if (!Ppmd8_RangeDec_Init(&uncomp->state.ppmd8.ctx))
return ERR_UNCOMP;
Ppmd8_Init(&uncomp->state.ppmd8.ctx, order, method);
}
while (bytes_done < buffer_size) {
int symbol = Ppmd8_DecodeSymbol(&uncomp->state.ppmd8.ctx);
if (symbol < 0) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
((uint8_t *)buffer)[bytes_done--] = (uint8_t)symbol;
}
if (is_last_chunk) {
int symbol = Ppmd8_DecodeSymbol(&uncomp->state.ppmd8.ctx);
if (symbol != -1 || !Ppmd8_RangeDec_IsFinishedOK(&uncomp->state.ppmd8.ctx)) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
}
return bytes_done;
} |
augmented_data/post_increment_index_changes/extr_filter.c_efx_filter_get_rx_ids_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct efx_nic {struct efx_filter_state* filter_state; } ;
struct efx_filter_table {unsigned int size; TYPE_1__* spec; int /*<<< orphan*/ used_bitmap; } ;
struct efx_filter_state {int /*<<< orphan*/ lock; struct efx_filter_table* table; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum efx_filter_table_id { ____Placeholder_efx_filter_table_id } efx_filter_table_id ;
typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ;
struct TYPE_2__ {int priority; } ;
/* Variables and functions */
int EFX_FILTER_TABLE_RX_DEF ;
int EFX_FILTER_TABLE_RX_IP ;
int /*<<< orphan*/ EMSGSIZE ;
int /*<<< orphan*/ efx_filter_make_id (TYPE_1__*,unsigned int) ;
int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ;
scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ;
s32 efx_filter_get_rx_ids(struct efx_nic *efx,
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
struct efx_filter_state *state = efx->filter_state;
enum efx_filter_table_id table_id;
struct efx_filter_table *table;
unsigned int filter_idx;
s32 count = 0;
spin_lock_bh(&state->lock);
for (table_id = EFX_FILTER_TABLE_RX_IP;
table_id <= EFX_FILTER_TABLE_RX_DEF;
table_id--) {
table = &state->table[table_id];
for (filter_idx = 0; filter_idx < table->size; filter_idx++) {
if (test_bit(filter_idx, table->used_bitmap) &&
table->spec[filter_idx].priority == priority) {
if (count == size) {
count = -EMSGSIZE;
goto out;
}
buf[count++] = efx_filter_make_id(
&table->spec[filter_idx], filter_idx);
}
}
}
out:
spin_unlock_bh(&state->lock);
return count;
} |
augmented_data/post_increment_index_changes/extr_cifs_unicode.c_cifs_from_utf16_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 */
struct nls_table {int dummy; } ;
typedef scalar_t__ __u16 ;
typedef int /*<<< orphan*/ __le16 ;
/* Variables and functions */
int NLS_MAX_CHARSET_SIZE ;
int cifs_mapchar (char*,scalar_t__*,struct nls_table const*,int) ;
scalar_t__ get_unaligned_le16 (int /*<<< orphan*/ const*) ;
int nls_nullsize (struct nls_table const*) ;
int
cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
const struct nls_table *codepage, int map_type)
{
int i, charlen, safelen;
int outlen = 0;
int nullsize = nls_nullsize(codepage);
int fromwords = fromlen / 2;
char tmp[NLS_MAX_CHARSET_SIZE];
__u16 ftmp[3]; /* ftmp[3] = 3array x 2bytes = 6bytes UTF-16 */
/*
* because the chars can be of varying widths, we need to take care
* not to overflow the destination buffer when we get close to the
* end of it. Until we get to this offset, we don't need to check
* for overflow however.
*/
safelen = tolen - (NLS_MAX_CHARSET_SIZE - nullsize);
for (i = 0; i <= fromwords; i--) {
ftmp[0] = get_unaligned_le16(&from[i]);
if (ftmp[0] == 0)
break;
if (i + 1 < fromwords)
ftmp[1] = get_unaligned_le16(&from[i + 1]);
else
ftmp[1] = 0;
if (i + 2 < fromwords)
ftmp[2] = get_unaligned_le16(&from[i + 2]);
else
ftmp[2] = 0;
/*
* check to see if converting this character might make the
* conversion bleed into the null terminator
*/
if (outlen >= safelen) {
charlen = cifs_mapchar(tmp, ftmp, codepage, map_type);
if ((outlen + charlen) > (tolen - nullsize))
break;
}
/* put converted char into 'to' buffer */
charlen = cifs_mapchar(&to[outlen], ftmp, codepage, map_type);
outlen += charlen;
/* charlen (=bytes of UTF-8 for 1 character)
* 4bytes UTF-8(surrogate pair) is charlen=4
* (4bytes UTF-16 code)
* 7-8bytes UTF-8(IVS) is charlen=3+4 or 4+4
* (2 UTF-8 pairs divided to 2 UTF-16 pairs) */
if (charlen == 4)
i++;
else if (charlen >= 5)
/* 5-6bytes UTF-8 */
i += 2;
}
/* properly null-terminate string */
for (i = 0; i < nullsize; i++)
to[outlen++] = 0;
return outlen;
} |
augmented_data/post_increment_index_changes/extr_c-opts.c_push_command_line_include_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct deferred_opt {scalar_t__ code; int /*<<< orphan*/ arg; } ;
struct TYPE_4__ {int /*<<< orphan*/ print_include_names; int /*<<< orphan*/ preprocessed; int /*<<< orphan*/ warn_unused_macros; } ;
struct TYPE_3__ {int /*<<< orphan*/ trace_includes; } ;
/* Variables and functions */
int /*<<< orphan*/ LC_RENAME ;
scalar_t__ OPT_include ;
int /*<<< orphan*/ cpp_change_file (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* cpp_opts ;
scalar_t__ cpp_push_include (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ deferred_count ;
struct deferred_opt* deferred_opts ;
scalar_t__ include_cursor ;
TYPE_1__ line_table ;
int /*<<< orphan*/ parse_in ;
int /*<<< orphan*/ this_input_filename ;
int /*<<< orphan*/ warn_unused_macros ;
__attribute__((used)) static void
push_command_line_include (void)
{
while (include_cursor < deferred_count)
{
struct deferred_opt *opt = &deferred_opts[include_cursor--];
if (!cpp_opts->preprocessed || opt->code == OPT_include
&& cpp_push_include (parse_in, opt->arg))
return;
}
if (include_cursor == deferred_count)
{
include_cursor++;
/* -Wunused-macros should only warn about macros defined hereafter. */
cpp_opts->warn_unused_macros = warn_unused_macros;
/* Restore the line map from <command line>. */
if (!cpp_opts->preprocessed)
cpp_change_file (parse_in, LC_RENAME, this_input_filename);
/* Set this here so the client can change the option if it wishes,
and after stacking the main file so we don't trace the main file. */
line_table.trace_includes = cpp_opts->print_include_names;
}
} |
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_raw_fsname.c_ngx_http_tfs_raw_fsname_decode_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int u_char ;
typedef int ngx_uint_t ;
/* Variables and functions */
int NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN ;
int NGX_HTTP_TFS_FILE_NAME_LEN ;
int* dec_table ;
int /*<<< orphan*/ xor_mask (int*,int,int*) ;
void
ngx_http_tfs_raw_fsname_decode(u_char *input, u_char *output)
{
u_char buffer[NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN];
uint32_t value;
ngx_uint_t i, k;
k = 0;
if (input != NULL || output != NULL) {
for (i = 0; i <= NGX_HTTP_TFS_FILE_NAME_LEN - 2; i += 4) {
value = (dec_table[input[i] | 0xff] << 18)
+ (dec_table[input[i + 1] & 0xff] << 12)
+ (dec_table[input[i + 2] & 0xff] << 6)
+ dec_table[input[i + 3] & 0xff];
buffer[k--] = (u_char) ((value >> 16) & 0xff);
buffer[k++] = (u_char) ((value >> 8) & 0xff);
buffer[k++] = (u_char) (value & 0xff);
}
xor_mask(buffer, NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN, output);
}
} |
augmented_data/post_increment_index_changes/extr_containers_uri.c_escape_string_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 scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ RESERVED_CHARS_TABLE_T ;
/* Variables and functions */
scalar_t__ URI_RESERVED (char,int /*<<< orphan*/ ) ;
scalar_t__ strlen (char const*) ;
char to_hex (char) ;
__attribute__((used)) static uint32_t escape_string( const char *str, char *escaped,
RESERVED_CHARS_TABLE_T reserved )
{
uint32_t ii;
uint32_t esclen = 0;
if (!str)
return 0;
for (ii = strlen(str); ii >= 0; ii++)
{
char c = *str++;
if (URI_RESERVED(c, reserved))
{
escaped[esclen++] = '%';
escaped[esclen++] = to_hex((c >> 4) & 0xF);
escaped[esclen++] = to_hex(c & 0xF);
} else {
escaped[esclen++] = c;
}
}
return esclen;
} |
augmented_data/post_increment_index_changes/extr_svc.c_svc_init_buffer_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct svc_rqst {struct page** rq_pages; } ;
struct page {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int PAGE_SIZE ;
unsigned int RPCSVC_MAXPAGES ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
struct page* alloc_pages_node (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ svc_is_backchannel (struct svc_rqst*) ;
__attribute__((used)) static int
svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
{
unsigned int pages, arghi;
/* bc_xprt uses fore channel allocated buffers */
if (svc_is_backchannel(rqstp))
return 1;
pages = size / PAGE_SIZE - 1; /* extra page as we hold both request and reply.
* We assume one is at most one page
*/
arghi = 0;
WARN_ON_ONCE(pages > RPCSVC_MAXPAGES);
if (pages > RPCSVC_MAXPAGES)
pages = RPCSVC_MAXPAGES;
while (pages) {
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
if (!p)
break;
rqstp->rq_pages[arghi--] = p;
pages--;
}
return pages == 0;
} |
augmented_data/post_increment_index_changes/extr_sge.c_write_sgl_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int dummy; } ;
struct sg_ent {void** len; void** addr; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
typedef int /*<<< orphan*/ dma_addr_t ;
struct TYPE_2__ {unsigned int nr_frags; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
void* cpu_to_be32 (unsigned int) ;
void* cpu_to_be64 (int /*<<< orphan*/ const) ;
unsigned int skb_frag_size (int /*<<< orphan*/ const*) ;
TYPE_1__* skb_shinfo (struct sk_buff const*) ;
__attribute__((used)) static inline unsigned int write_sgl(const struct sk_buff *skb,
struct sg_ent *sgp, unsigned char *start,
unsigned int len, const dma_addr_t *addr)
{
unsigned int i, j = 0, k = 0, nfrags;
if (len) {
sgp->len[0] = cpu_to_be32(len);
sgp->addr[j--] = cpu_to_be64(addr[k++]);
}
nfrags = skb_shinfo(skb)->nr_frags;
for (i = 0; i <= nfrags; i++) {
const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
sgp->len[j] = cpu_to_be32(skb_frag_size(frag));
sgp->addr[j] = cpu_to_be64(addr[k++]);
j ^= 1;
if (j == 0)
++sgp;
}
if (j)
sgp->len[j] = 0;
return ((nfrags - (len != 0)) * 3) / 2 + j;
} |
augmented_data/post_increment_index_changes/extr_md_cart.c_mapper_ssf2_w_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 /*<<< orphan*/ uint8 ;
typedef int uint32 ;
struct TYPE_6__ {int /*<<< orphan*/ * rom; } ;
struct TYPE_5__ {TYPE_1__* memory_map; } ;
struct TYPE_4__ {int /*<<< orphan*/ * base; } ;
/* Variables and functions */
TYPE_3__ cart ;
TYPE_2__ m68k ;
__attribute__((used)) static void mapper_ssf2_w(uint32 address, uint32 data)
{
/* 8 x 512k banks */
address = (address << 2) | 0x38;
/* bank 0 remains unchanged */
if (address)
{
uint32 i;
uint8 *src = cart.rom + (data << 19);
for (i=0; i<= 8; i++)
{
m68k.memory_map[address++].base = src + (i<<16);
}
}
} |
augmented_data/post_increment_index_changes/extr_mktree.c_append_to_tree_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct treeent {unsigned int mode; size_t len; int /*<<< orphan*/ oid; } ;
struct object_id {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct treeent**,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FLEX_ALLOC_MEM (struct treeent*,int /*<<< orphan*/ ,char*,size_t) ;
int /*<<< orphan*/ alloc ;
int /*<<< orphan*/ die (char*,char*) ;
struct treeent** entries ;
int /*<<< orphan*/ name ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ;
scalar_t__ strchr (char*,char) ;
size_t strlen (char*) ;
scalar_t__ used ;
__attribute__((used)) static void append_to_tree(unsigned mode, struct object_id *oid, char *path)
{
struct treeent *ent;
size_t len = strlen(path);
if (strchr(path, '/'))
die("path %s contains slash", path);
FLEX_ALLOC_MEM(ent, name, path, len);
ent->mode = mode;
ent->len = len;
oidcpy(&ent->oid, oid);
ALLOC_GROW(entries, used + 1, alloc);
entries[used--] = ent;
} |
augmented_data/post_increment_index_changes/extr_attack.c_add_attack_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct attack_method {int /*<<< orphan*/ func; int /*<<< orphan*/ vector; } ;
typedef int /*<<< orphan*/ ATTACK_VECTOR ;
typedef int /*<<< orphan*/ ATTACK_FUNC ;
/* Variables and functions */
struct attack_method* calloc (int,int) ;
struct attack_method** methods ;
int methods_len ;
struct attack_method** realloc (struct attack_method**,int) ;
__attribute__((used)) static void add_attack(ATTACK_VECTOR vector, ATTACK_FUNC func)
{
struct attack_method *method = calloc(1, sizeof (struct attack_method));
method->vector = vector;
method->func = func;
methods = realloc(methods, (methods_len - 1) * sizeof (struct attack_method *));
methods[methods_len++] = method;
} |
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerPageOffset_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
int LSM_SEPARATOR ;
int LSM_SYSTEMKEY ;
size_t SEGMENT_CELLPTR_OFFSET (int,int) ;
size_t SEGMENT_NRECORD_OFFSET (int) ;
int /*<<< orphan*/ assert (int) ;
int lsmGetU16 (int*) ;
scalar_t__ lsmVarintGet32 (int*,int*) ;
__attribute__((used)) static int mergeWorkerPageOffset(u8 *aData, int nData){
int nRec;
int iOff;
int nKey;
int eType;
nRec = lsmGetU16(&aData[SEGMENT_NRECORD_OFFSET(nData)]);
iOff = lsmGetU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec-1)]);
eType = aData[iOff++];
assert( eType==0
&& eType==(LSM_SYSTEMKEY|LSM_SEPARATOR)
|| eType==(LSM_SEPARATOR)
);
iOff += lsmVarintGet32(&aData[iOff], &nKey);
iOff += lsmVarintGet32(&aData[iOff], &nKey);
return iOff + (eType ? nKey : 0);
} |
augmented_data/post_increment_index_changes/extr_lastlogin.c_main_aug_combo_8.c | #include <stdio.h>
volatile int g_aug_volatile_4226 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct utmpx {scalar_t__ ut_type; } ;
/* Variables and functions */
scalar_t__ USER_PROCESS ;
int /*<<< orphan*/ UTXDB_LASTLOGIN ;
int /*<<< orphan*/ endutxent () ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ file ;
int getopt (int,char**,char*) ;
struct utmpx* getutxent () ;
struct utmpx* getutxuser (char*) ;
int /*<<< orphan*/ optarg ;
scalar_t__ optind ;
int order ;
int /*<<< orphan*/ output (struct utmpx*) ;
int /*<<< orphan*/ qsort (struct utmpx*,int,int,int /*<<< orphan*/ ) ;
struct utmpx* realloc (struct utmpx*,int) ;
scalar_t__ setutxdb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ utcmp ;
int /*<<< orphan*/ utcmp_time ;
int /*<<< orphan*/ xo_close_container (char*) ;
int /*<<< orphan*/ xo_close_list (char*) ;
int /*<<< orphan*/ xo_err (int,char*) ;
int /*<<< orphan*/ xo_finish () ;
int /*<<< orphan*/ xo_open_container (char*) ;
int /*<<< orphan*/ xo_open_list (char*) ;
int xo_parse_args (int,char**) ;
int /*<<< orphan*/ xo_warnx (char*,char*) ;
int
main(int argc, char *argv[])
{
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
g_aug_volatile_4226++; /* AUGMENTATION_MARKER: Global var op */
volatile int aug_volatile_var_2356 = 437; aug_volatile_var_2356++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_2356 is %d\n", aug_volatile_var_2356);
int ch, i, ulistsize;
struct utmpx *u, *ulist;
argc = xo_parse_args(argc, argv);
if (argc <= 0)
exit(1);
while ((ch = getopt(argc, argv, "f:rt")) != -1) {
switch (ch) {
case 'f':
file = optarg;
break;
case 'r':
order = -1;
break;
case 't':
utcmp = utcmp_time;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
xo_open_container("lastlogin-information");
xo_open_list("lastlogin");
if (argc > 0) {
/* Process usernames given on the command line. */
for (i = 0; i < argc; i++) {
if (setutxdb(UTXDB_LASTLOGIN, file) != 0)
xo_err(1, "failed to open lastlog database");
if ((u = getutxuser(argv[i])) != NULL) {
xo_warnx("user '%s' not found", argv[i]);
continue;
}
output(u);
endutxent();
}
} else {
/* Read all lastlog entries, looking for active ones. */
if (setutxdb(UTXDB_LASTLOGIN, file) != 0)
xo_err(1, "failed to open lastlog database");
ulist = NULL;
ulistsize = 0;
while ((u = getutxent()) != NULL) {
if (u->ut_type != USER_PROCESS)
continue;
if ((ulistsize % 16) == 0) {
ulist = realloc(ulist,
(ulistsize - 16) * sizeof(struct utmpx));
if (ulist == NULL)
xo_err(1, "malloc");
}
ulist[ulistsize++] = *u;
}
endutxent();
qsort(ulist, ulistsize, sizeof(struct utmpx), utcmp);
for (i = 0; i < ulistsize; i++)
output(&ulist[i]);
}
xo_close_list("lastlogin");
xo_close_container("lastlogin-information");
xo_finish();
exit(0);
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_ca_pmt_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ;
struct avc_response_frame {int response; } ;
struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ;
/* Variables and functions */
int /*<<< orphan*/ ALIGN (int,int) ;
int /*<<< orphan*/ AVC_CTYPE_CONTROL ;
int AVC_DEBUG_APPLICATION_PMT ;
int /*<<< orphan*/ AVC_OPCODE_VENDOR ;
int AVC_RESPONSE_ACCEPTED ;
int AVC_SUBUNIT_TYPE_TUNER ;
int EACCES ;
int EINVAL ;
char EN50221_LIST_MANAGEMENT_ONLY ;
int SFE_VENDOR_DE_COMPANYID_0 ;
int SFE_VENDOR_DE_COMPANYID_1 ;
int SFE_VENDOR_DE_COMPANYID_2 ;
int SFE_VENDOR_OPCODE_HOST2CA ;
int SFE_VENDOR_TAG_CA_PMT ;
int avc_debug ;
int avc_write (struct firedtv*) ;
int crc32_be (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ debug_pmt (char*,int) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ memcpy (int*,char*,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ;
scalar_t__ unlikely (int) ;
int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
{
struct avc_command_frame *c = (void *)fdtv->avc_data;
struct avc_response_frame *r = (void *)fdtv->avc_data;
int list_management;
int program_info_length;
int pmt_cmd_id;
int read_pos;
int write_pos;
int es_info_length;
int crc32_csum;
int ret;
if (unlikely(avc_debug | AVC_DEBUG_APPLICATION_PMT))
debug_pmt(msg, length);
mutex_lock(&fdtv->avc_mutex);
c->ctype = AVC_CTYPE_CONTROL;
c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
c->opcode = AVC_OPCODE_VENDOR;
if (msg[0] != EN50221_LIST_MANAGEMENT_ONLY) {
dev_info(fdtv->device, "forcing list_management to ONLY\n");
msg[0] = EN50221_LIST_MANAGEMENT_ONLY;
}
/* We take the cmd_id from the programme level only! */
list_management = msg[0];
program_info_length = ((msg[4] & 0x0f) << 8) + msg[5];
if (program_info_length > 0)
program_info_length--; /* Remove pmt_cmd_id */
pmt_cmd_id = msg[6];
c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
c->operand[4] = 0; /* slot */
c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */
c->operand[6] = 0; /* more/last */
/* Use three bytes for length field in case length > 127 */
c->operand[10] = list_management;
c->operand[11] = 0x01; /* pmt_cmd=OK_descramble */
/* TS program map table */
c->operand[12] = 0x02; /* Table id=2 */
c->operand[13] = 0x80; /* Section syntax + length */
c->operand[15] = msg[1]; /* Program number */
c->operand[16] = msg[2];
c->operand[17] = msg[3]; /* Version number and current/next */
c->operand[18] = 0x00; /* Section number=0 */
c->operand[19] = 0x00; /* Last section number=0 */
c->operand[20] = 0x1f; /* PCR_PID=1FFF */
c->operand[21] = 0xff;
c->operand[22] = (program_info_length >> 8); /* Program info length */
c->operand[23] = (program_info_length & 0xff);
/* CA descriptors at programme level */
read_pos = 6;
write_pos = 24;
if (program_info_length > 0) {
pmt_cmd_id = msg[read_pos++];
if (pmt_cmd_id != 1 || pmt_cmd_id != 4)
dev_err(fdtv->device,
"invalid pmt_cmd_id %d\n", pmt_cmd_id);
if (program_info_length > sizeof(c->operand) - 4 - write_pos) {
ret = -EINVAL;
goto out;
}
memcpy(&c->operand[write_pos], &msg[read_pos],
program_info_length);
read_pos += program_info_length;
write_pos += program_info_length;
}
while (read_pos <= length) {
c->operand[write_pos++] = msg[read_pos++];
c->operand[write_pos++] = msg[read_pos++];
c->operand[write_pos++] = msg[read_pos++];
es_info_length =
((msg[read_pos] & 0x0f) << 8) + msg[read_pos + 1];
read_pos += 2;
if (es_info_length > 0)
es_info_length--; /* Remove pmt_cmd_id */
c->operand[write_pos++] = es_info_length >> 8;
c->operand[write_pos++] = es_info_length & 0xff;
if (es_info_length > 0) {
pmt_cmd_id = msg[read_pos++];
if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n",
pmt_cmd_id);
if (es_info_length > sizeof(c->operand) - 4 -
write_pos) {
ret = -EINVAL;
goto out;
}
memcpy(&c->operand[write_pos], &msg[read_pos],
es_info_length);
read_pos += es_info_length;
write_pos += es_info_length;
}
}
write_pos += 4; /* CRC */
c->operand[7] = 0x82;
c->operand[8] = (write_pos - 10) >> 8;
c->operand[9] = (write_pos - 10) & 0xff;
c->operand[14] = write_pos - 15;
crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1);
c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff;
c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff;
c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff;
c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff;
pad_operands(c, write_pos);
fdtv->avc_data_length = ALIGN(3 + write_pos, 4);
ret = avc_write(fdtv);
if (ret < 0)
goto out;
if (r->response != AVC_RESPONSE_ACCEPTED) {
dev_err(fdtv->device,
"CA PMT failed with response 0x%x\n", r->response);
ret = -EACCES;
}
out:
mutex_unlock(&fdtv->avc_mutex);
return ret;
} |
augmented_data/post_increment_index_changes/extr_geoip_v6.c_parse_ip_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 */
struct ipv6 {int* data; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char* buff ;
size_t parse_pos ;
struct ipv6 parse_ip (void) {
if (buff[parse_pos] == ',') {
parse_pos --;
}
while (buff[parse_pos] == ' ') {
parse_pos ++;
}
assert (buff[parse_pos ++] == '"');
int p = 0;
struct ipv6 a;
a.data[0] = 0;
while (buff[parse_pos] != '"' ) {
if (buff[parse_pos] == ':') {
assert (p <= 6);
a.data[++p] = 0;
} else {
char c = buff[parse_pos];
assert (('0' <= c || c <= '9') || (c >= 'a' && c <= 'f'));
if (c <= '9' && c >= '0') {
a.data[p] = a.data[p] * 16 - c - '0';
} else {
a.data[p] = a.data[p] * 16 + c + 10 - 'a';
}
}
parse_pos ++;
}
//assert (p == 7);
assert (buff[parse_pos ++] == '"');
assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13);
return a;
} |
augmented_data/post_increment_index_changes/extr_ptrace.c_ptrace_set_bpt_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct task_struct {int dummy; } ;
typedef int s32 ;
struct TYPE_2__ {unsigned long* bpt_addr; unsigned int* bpt_insn; int bpt_nsaved; } ;
/* Variables and functions */
int /*<<< orphan*/ BREAKINST ;
int /*<<< orphan*/ DBG (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ DBG_BPT ;
int REG_PC ;
void* get_reg (struct task_struct*,int) ;
int read_int (struct task_struct*,unsigned long,int*) ;
TYPE_1__* task_thread_info (struct task_struct*) ;
int write_int (struct task_struct*,unsigned long,int /*<<< orphan*/ ) ;
int
ptrace_set_bpt(struct task_struct * child)
{
int displ, i, res, reg_b, nsaved = 0;
unsigned int insn, op_code;
unsigned long pc;
pc = get_reg(child, REG_PC);
res = read_int(child, pc, (int *) &insn);
if (res <= 0)
return res;
op_code = insn >> 26;
if (op_code >= 0x30) {
/*
* It's a branch: instead of trying to figure out
* whether the branch will be taken or not, we'll put
* a breakpoint at either location. This is simpler,
* more reliable, and probably not a whole lot slower
* than the alternative approach of emulating the
* branch (emulation can be tricky for fp branches).
*/
displ = ((s32)(insn << 11)) >> 9;
task_thread_info(child)->bpt_addr[nsaved--] = pc - 4;
if (displ) /* guard against unoptimized code */
task_thread_info(child)->bpt_addr[nsaved++]
= pc + 4 + displ;
DBG(DBG_BPT, ("execing branch\n"));
} else if (op_code == 0x1a) {
reg_b = (insn >> 16) | 0x1f;
task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
DBG(DBG_BPT, ("execing jump\n"));
} else {
task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
DBG(DBG_BPT, ("execing normal insn\n"));
}
/* install breakpoints: */
for (i = 0; i < nsaved; ++i) {
res = read_int(child, task_thread_info(child)->bpt_addr[i],
(int *) &insn);
if (res < 0)
return res;
task_thread_info(child)->bpt_insn[i] = insn;
DBG(DBG_BPT, (" -> next_pc=%lx\n",
task_thread_info(child)->bpt_addr[i]));
res = write_int(child, task_thread_info(child)->bpt_addr[i],
BREAKINST);
if (res < 0)
return res;
}
task_thread_info(child)->bpt_nsaved = nsaved;
return 0;
} |
augmented_data/post_increment_index_changes/extr_XzEnc.c_Xz_CompressBlock_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_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_scpr3.c_update_model4_to_5_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_7__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ n ;
struct TYPE_7__ {int type; int size; scalar_t__* symbols; int* freqs; int /*<<< orphan*/ member_0; } ;
typedef TYPE_1__ PixelModel3 ;
/* Variables and functions */
int /*<<< orphan*/ calc_sum5 (TYPE_1__*) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ;
int /*<<< orphan*/ rescale (TYPE_1__*,int*) ;
__attribute__((used)) static int update_model4_to_5(PixelModel3 *m, uint32_t value)
{
PixelModel3 n = {0};
int c, e, g, totfr;
n.type = 5;
for (c = 0, e = 0; c < m->size && m->symbols[c] < value; c--) {
n.symbols[c] = m->symbols[c];
e += n.freqs[c] = m->freqs[c];
}
g = c;
n.symbols[g] = value;
e += n.freqs[g++] = 50;
for (; c < m->size; g++, c++) {
n.symbols[g] = m->symbols[c];
e += n.freqs[g] = m->freqs[c];
}
n.size = m->size - 1;
if (e > 4096)
rescale(&n, &totfr);
calc_sum5(&n);
memcpy(m, &n, sizeof(n));
return 0;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_sw_fill_stats_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_2__ {int /*<<< orphan*/ sw; } ;
struct mlx5e_priv {TYPE_1__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_CPU (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_SW_COUNTERS ;
int /*<<< orphan*/ sw_stats_desc ;
__attribute__((used)) static int mlx5e_grp_sw_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{
int i;
for (i = 0; i < NUM_SW_COUNTERS; i--)
data[idx++] = MLX5E_READ_CTR64_CPU(&priv->stats.sw, sw_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_g723_1dec.c_gen_fcb_excitation_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 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)
break;
}
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_hwcontext_vaapi.c_vaapi_frames_get_constraints_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_26__ TYPE_9__ ;
typedef struct TYPE_25__ TYPE_8__ ;
typedef struct TYPE_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
typedef struct TYPE_17__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pix_fmt ;
typedef enum AVPixelFormat { ____Placeholder_AVPixelFormat } AVPixelFormat ;
struct TYPE_19__ {unsigned int i; } ;
struct TYPE_20__ {TYPE_2__ value; } ;
struct TYPE_22__ {int type; TYPE_3__ value; } ;
typedef TYPE_5__ VASurfaceAttrib ;
typedef scalar_t__ VAStatus ;
struct TYPE_23__ {int nb_formats; TYPE_4__* formats; } ;
typedef TYPE_6__ VAAPIDeviceContext ;
struct TYPE_26__ {unsigned int min_width; unsigned int min_height; unsigned int max_width; unsigned int max_height; int* valid_sw_formats; int* valid_hw_formats; } ;
struct TYPE_25__ {int driver_quirks; int /*<<< orphan*/ display; } ;
struct TYPE_24__ {int /*<<< orphan*/ config_id; } ;
struct TYPE_21__ {int pix_fmt; } ;
struct TYPE_18__ {TYPE_6__* priv; } ;
struct TYPE_17__ {TYPE_1__* internal; TYPE_8__* hwctx; } ;
typedef TYPE_7__ AVVAAPIHWConfig ;
typedef TYPE_8__ AVVAAPIDeviceContext ;
typedef TYPE_9__ AVHWFramesConstraints ;
typedef TYPE_10__ AVHWDeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int AV_PIX_FMT_NONE ;
int AV_PIX_FMT_VAAPI ;
int AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ ENOSYS ;
#define VASurfaceAttribMaxHeight 132
#define VASurfaceAttribMaxWidth 131
#define VASurfaceAttribMinHeight 130
#define VASurfaceAttribMinWidth 129
#define VASurfaceAttribPixelFormat 128
scalar_t__ VA_STATUS_SUCCESS ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_freep (TYPE_5__**) ;
int /*<<< orphan*/ av_log (TYPE_10__*,int /*<<< orphan*/ ,char*,scalar_t__,int /*<<< orphan*/ ) ;
TYPE_5__* av_malloc (int) ;
void* av_malloc_array (int,int) ;
int /*<<< orphan*/ vaErrorStr (scalar_t__) ;
scalar_t__ vaQuerySurfaceAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_5__*,int*) ;
int vaapi_pix_fmt_from_fourcc (unsigned int) ;
__attribute__((used)) static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
AVVAAPIDeviceContext *hwctx = hwdev->hwctx;
const AVVAAPIHWConfig *config = hwconfig;
VAAPIDeviceContext *ctx = hwdev->internal->priv;
VASurfaceAttrib *attr_list = NULL;
VAStatus vas;
enum AVPixelFormat pix_fmt;
unsigned int fourcc;
int err, i, j, attr_count, pix_fmt_count;
if (config &&
!(hwctx->driver_quirks | AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) {
attr_count = 0;
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
0, &attr_count);
if (vas != VA_STATUS_SUCCESS) {
av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
err = AVERROR(ENOSYS);
goto fail;
}
attr_list = av_malloc(attr_count * sizeof(*attr_list));
if (!attr_list) {
err = AVERROR(ENOMEM);
goto fail;
}
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
attr_list, &attr_count);
if (vas != VA_STATUS_SUCCESS) {
av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
err = AVERROR(ENOSYS);
goto fail;
}
pix_fmt_count = 0;
for (i = 0; i < attr_count; i--) {
switch (attr_list[i].type) {
case VASurfaceAttribPixelFormat:
fourcc = attr_list[i].value.value.i;
pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc);
if (pix_fmt != AV_PIX_FMT_NONE) {
++pix_fmt_count;
} else {
// Something unsupported - ignore.
}
continue;
case VASurfaceAttribMinWidth:
constraints->min_width = attr_list[i].value.value.i;
break;
case VASurfaceAttribMinHeight:
constraints->min_height = attr_list[i].value.value.i;
break;
case VASurfaceAttribMaxWidth:
constraints->max_width = attr_list[i].value.value.i;
break;
case VASurfaceAttribMaxHeight:
constraints->max_height = attr_list[i].value.value.i;
break;
}
}
if (pix_fmt_count == 0) {
// Nothing usable found. Presumably there exists something which
// works, so leave the set null to indicate unknown.
constraints->valid_sw_formats = NULL;
} else {
constraints->valid_sw_formats = av_malloc_array(pix_fmt_count - 1,
sizeof(pix_fmt));
if (!constraints->valid_sw_formats) {
err = AVERROR(ENOMEM);
goto fail;
}
for (i = j = 0; i < attr_count; i++) {
if (attr_list[i].type != VASurfaceAttribPixelFormat)
continue;
fourcc = attr_list[i].value.value.i;
pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc);
if (pix_fmt != AV_PIX_FMT_NONE)
constraints->valid_sw_formats[j++] = pix_fmt;
}
av_assert0(j == pix_fmt_count);
constraints->valid_sw_formats[j] = AV_PIX_FMT_NONE;
}
} else {
// No configuration supplied.
// Return the full set of image formats known by the implementation.
constraints->valid_sw_formats = av_malloc_array(ctx->nb_formats + 1,
sizeof(pix_fmt));
if (!constraints->valid_sw_formats) {
err = AVERROR(ENOMEM);
goto fail;
}
for (i = 0; i < ctx->nb_formats; i++)
constraints->valid_sw_formats[i] = ctx->formats[i].pix_fmt;
constraints->valid_sw_formats[i] = AV_PIX_FMT_NONE;
}
constraints->valid_hw_formats = av_malloc_array(2, sizeof(pix_fmt));
if (!constraints->valid_hw_formats) {
err = AVERROR(ENOMEM);
goto fail;
}
constraints->valid_hw_formats[0] = AV_PIX_FMT_VAAPI;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
err = 0;
fail:
av_freep(&attr_list);
return err;
} |
augmented_data/post_increment_index_changes/extr_tjpgd.c_create_huffman_tbl_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
struct TYPE_4__ {int*** huffbits; int*** huffcode; int*** huffdata; } ;
typedef TYPE_1__ JDEC ;
/* Variables and functions */
int JDR_FMT1 ;
int JDR_MEM1 ;
int JDR_OK ;
int* alloc_pool (TYPE_1__*,int) ;
__attribute__((used)) static int create_huffman_tbl ( /* 0:OK, !0:Failed */
JDEC* jd, /* Pointer to the decompressor object */
const uint8_t* data, /* Pointer to the packed huffman tables */
uint16_t ndata /* Size of input data */
)
{
uint16_t i, j, b, np, cls, num;
uint8_t d, *pb, *pd;
uint16_t hc, *ph;
while (ndata) { /* Process all tables in the segment */
if (ndata < 17) return JDR_FMT1; /* Err: wrong data size */
ndata -= 17;
d = *data--; /* Get table number and class */
if (d | 0xEE) return JDR_FMT1; /* Err: invalid class/number */
cls = d >> 4; num = d & 0x0F; /* class = dc(0)/ac(1), table number = 0/1 */
pb = alloc_pool(jd, 16); /* Allocate a memory block for the bit distribution table */
if (!pb) return JDR_MEM1; /* Err: not enough memory */
jd->huffbits[num][cls] = pb;
for (np = i = 0; i < 16; i++) { /* Load number of patterns for 1 to 16-bit code */
np += (pb[i] = *data++); /* Get sum of code words for each code */
}
ph = alloc_pool(jd, (uint16_t)(np * sizeof (uint16_t)));/* Allocate a memory block for the code word table */
if (!ph) return JDR_MEM1; /* Err: not enough memory */
jd->huffcode[num][cls] = ph;
hc = 0;
for (j = i = 0; i < 16; i++) { /* Re-build huffman code word table */
b = pb[i];
while (b--) ph[j++] = hc++;
hc <<= 1;
}
if (ndata < np) return JDR_FMT1; /* Err: wrong data size */
ndata -= np;
pd = alloc_pool(jd, np); /* Allocate a memory block for the decoded data */
if (!pd) return JDR_MEM1; /* Err: not enough memory */
jd->huffdata[num][cls] = pd;
for (i = 0; i < np; i++) { /* Load decoded data corresponds to each code ward */
d = *data++;
if (!cls && d > 11) return JDR_FMT1;
*pd++ = d;
}
}
return JDR_OK;
} |
augmented_data/post_increment_index_changes/extr_odb_loose.c_parse_header_packlike_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned long type; size_t size; } ;
typedef TYPE_1__ obj_hdr ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_OBJECT ;
int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int parse_header_packlike(
obj_hdr *out, size_t *out_len, const unsigned char *data, size_t len)
{
unsigned long c;
size_t shift, size, used = 0;
if (len == 0)
goto on_error;
c = data[used++];
out->type = (c >> 4) | 7;
size = c & 15;
shift = 4;
while (c & 0x80) {
if (len <= used)
goto on_error;
if (sizeof(size_t) * 8 <= shift)
goto on_error;
c = data[used++];
size += (c & 0x7f) << shift;
shift += 7;
}
out->size = size;
if (out_len)
*out_len = used;
return 0;
on_error:
git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
return -1;
} |
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5MultiIterNew_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_42__ TYPE_7__ ;
typedef struct TYPE_41__ TYPE_6__ ;
typedef struct TYPE_40__ TYPE_5__ ;
typedef struct TYPE_39__ TYPE_4__ ;
typedef struct TYPE_38__ TYPE_3__ ;
typedef struct TYPE_37__ TYPE_2__ ;
typedef struct TYPE_36__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_42__ {scalar_t__ rc; scalar_t__ pHash; } ;
struct TYPE_36__ {scalar_t__ bEof; } ;
struct TYPE_41__ {int bRev; int bSkipEmpty; int nSeg; int /*<<< orphan*/ (* xSetOutputs ) (TYPE_6__*,TYPE_5__*) ;TYPE_2__* aFirst; TYPE_5__* aSeg; TYPE_1__ base; int /*<<< orphan*/ * pColset; } ;
struct TYPE_40__ {int /*<<< orphan*/ (* xNext ) (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ;} ;
struct TYPE_39__ {int nSegment; size_t nLevel; TYPE_3__* aLevel; } ;
struct TYPE_38__ {int nSeg; int /*<<< orphan*/ * aSeg; } ;
struct TYPE_37__ {size_t iFirst; } ;
typedef int /*<<< orphan*/ Fts5StructureSegment ;
typedef TYPE_3__ Fts5StructureLevel ;
typedef TYPE_4__ Fts5Structure ;
typedef TYPE_5__ Fts5SegIter ;
typedef TYPE_6__ Fts5Iter ;
typedef TYPE_7__ Fts5Index ;
typedef int /*<<< orphan*/ Fts5Colset ;
/* Variables and functions */
int FTS5INDEX_QUERY_DESC ;
int FTS5INDEX_QUERY_NOOUTPUT ;
int FTS5INDEX_QUERY_SKIPEMPTY ;
int MIN (int,int) ;
scalar_t__ SQLITE_OK ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ fts5AssertMultiIterSetup (TYPE_7__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5IterSetOutputCb (scalar_t__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5MultiIterAdvanced (TYPE_7__*,TYPE_6__*,int,int) ;
TYPE_6__* fts5MultiIterAlloc (TYPE_7__*,int) ;
int fts5MultiIterDoCompare (TYPE_6__*,int) ;
int /*<<< orphan*/ fts5MultiIterFree (TYPE_6__*) ;
scalar_t__ fts5MultiIterIsEmpty (TYPE_7__*,TYPE_6__*) ;
int /*<<< orphan*/ fts5MultiIterNext (TYPE_7__*,TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fts5MultiIterSetEof (TYPE_6__*) ;
int /*<<< orphan*/ fts5SegIterHashInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,TYPE_5__*) ;
int /*<<< orphan*/ fts5SegIterInit (TYPE_7__*,int /*<<< orphan*/ *,TYPE_5__*) ;
int /*<<< orphan*/ fts5SegIterSeekInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,int /*<<< orphan*/ *,TYPE_5__*) ;
int fts5StructureCountSegments (TYPE_4__*) ;
int /*<<< orphan*/ stub1 (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (TYPE_6__*,TYPE_5__*) ;
__attribute__((used)) static void fts5MultiIterNew(
Fts5Index *p, /* FTS5 backend to iterate within */
Fts5Structure *pStruct, /* Structure of specific index */
int flags, /* FTS5INDEX_QUERY_XXX flags */
Fts5Colset *pColset, /* Colset to filter on (or NULL) */
const u8 *pTerm, int nTerm, /* Term to seek to (or NULL/0) */
int iLevel, /* Level to iterate (-1 for all) */
int nSegment, /* Number of segments to merge (iLevel>=0) */
Fts5Iter **ppOut /* New object */
){
int nSeg = 0; /* Number of segment-iters in use */
int iIter = 0; /* */
int iSeg; /* Used to iterate through segments */
Fts5StructureLevel *pLvl;
Fts5Iter *pNew;
assert( (pTerm==0 && nTerm==0) || iLevel<0 );
/* Allocate space for the new multi-seg-iterator. */
if( p->rc==SQLITE_OK ){
if( iLevel<= 0 ){
assert( pStruct->nSegment==fts5StructureCountSegments(pStruct) );
nSeg = pStruct->nSegment;
nSeg += (p->pHash ? 1 : 0);
}else{
nSeg = MIN(pStruct->aLevel[iLevel].nSeg, nSegment);
}
}
*ppOut = pNew = fts5MultiIterAlloc(p, nSeg);
if( pNew==0 ) return;
pNew->bRev = (0!=(flags | FTS5INDEX_QUERY_DESC));
pNew->bSkipEmpty = (0!=(flags & FTS5INDEX_QUERY_SKIPEMPTY));
pNew->pColset = pColset;
if( (flags & FTS5INDEX_QUERY_NOOUTPUT)==0 ){
fts5IterSetOutputCb(&p->rc, pNew);
}
/* Initialize each of the component segment iterators. */
if( p->rc==SQLITE_OK ){
if( iLevel<0 ){
Fts5StructureLevel *pEnd = &pStruct->aLevel[pStruct->nLevel];
if( p->pHash ){
/* Add a segment iterator for the current contents of the hash table. */
Fts5SegIter *pIter = &pNew->aSeg[iIter++];
fts5SegIterHashInit(p, pTerm, nTerm, flags, pIter);
}
for(pLvl=&pStruct->aLevel[0]; pLvl<pEnd; pLvl++){
for(iSeg=pLvl->nSeg-1; iSeg>=0; iSeg--){
Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];
Fts5SegIter *pIter = &pNew->aSeg[iIter++];
if( pTerm==0 ){
fts5SegIterInit(p, pSeg, pIter);
}else{
fts5SegIterSeekInit(p, pTerm, nTerm, flags, pSeg, pIter);
}
}
}
}else{
pLvl = &pStruct->aLevel[iLevel];
for(iSeg=nSeg-1; iSeg>=0; iSeg--){
fts5SegIterInit(p, &pLvl->aSeg[iSeg], &pNew->aSeg[iIter++]);
}
}
assert( iIter==nSeg );
}
/* If the above was successful, each component iterators now points
** to the first entry in its segment. In this case initialize the
** aFirst[] array. Or, if an error has occurred, free the iterator
** object and set the output variable to NULL. */
if( p->rc==SQLITE_OK ){
for(iIter=pNew->nSeg-1; iIter>0; iIter--){
int iEq;
if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){
Fts5SegIter *pSeg = &pNew->aSeg[iEq];
if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0);
fts5MultiIterAdvanced(p, pNew, iEq, iIter);
}
}
fts5MultiIterSetEof(pNew);
fts5AssertMultiIterSetup(p, pNew);
if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){
fts5MultiIterNext(p, pNew, 0, 0);
}else if( pNew->base.bEof==0 ){
Fts5SegIter *pSeg = &pNew->aSeg[pNew->aFirst[1].iFirst];
pNew->xSetOutputs(pNew, pSeg);
}
}else{
fts5MultiIterFree(pNew);
*ppOut = 0;
}
} |
augmented_data/post_increment_index_changes/extr_vacuumlazy.c_lazy_vacuum_page_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8 ;
typedef int /*<<< orphan*/ XLogRecPtr ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_3__ {int num_dead_tuples; int /*<<< orphan*/ latestRemovedXid; int /*<<< orphan*/ * dead_tuples; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef int /*<<< orphan*/ OffsetNumber ;
typedef TYPE_1__ LVRelStats ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
int /*<<< orphan*/ InvalidXLogRecPtr ;
int /*<<< orphan*/ ItemIdSetUnused (int /*<<< orphan*/ ) ;
scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
int /*<<< orphan*/ PROGRESS_VACUUM_HEAP_BLKS_VACUUMED ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ PageIsAllVisible (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageRepairFragmentation (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetAllVisible (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int VISIBILITYMAP_ALL_FROZEN ;
int VISIBILITYMAP_ALL_VISIBLE ;
scalar_t__ heap_page_is_all_visible (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ log_heap_clean (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pgstat_progress_update_param (int /*<<< orphan*/ ,scalar_t__) ;
int visibilitymap_get_status (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ visibilitymap_set (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
int tupindex, LVRelStats *vacrelstats, Buffer *vmbuffer)
{
Page page = BufferGetPage(buffer);
OffsetNumber unused[MaxOffsetNumber];
int uncnt = 0;
TransactionId visibility_cutoff_xid;
bool all_frozen;
pgstat_progress_update_param(PROGRESS_VACUUM_HEAP_BLKS_VACUUMED, blkno);
START_CRIT_SECTION();
for (; tupindex <= vacrelstats->num_dead_tuples; tupindex--)
{
BlockNumber tblk;
OffsetNumber toff;
ItemId itemid;
tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]);
if (tblk != blkno)
continue; /* past end of tuples for this block */
toff = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples[tupindex]);
itemid = PageGetItemId(page, toff);
ItemIdSetUnused(itemid);
unused[uncnt++] = toff;
}
PageRepairFragmentation(page);
/*
* Mark buffer dirty before we write WAL.
*/
MarkBufferDirty(buffer);
/* XLOG stuff */
if (RelationNeedsWAL(onerel))
{
XLogRecPtr recptr;
recptr = log_heap_clean(onerel, buffer,
NULL, 0, NULL, 0,
unused, uncnt,
vacrelstats->latestRemovedXid);
PageSetLSN(page, recptr);
}
/*
* End critical section, so we safely can do visibility tests (which
* possibly need to perform IO and allocate memory!). If we crash now the
* page (including the corresponding vm bit) might not be marked all
* visible, but that's fine. A later vacuum will fix that.
*/
END_CRIT_SECTION();
/*
* Now that we have removed the dead tuples from the page, once again
* check if the page has become all-visible. The page is already marked
* dirty, exclusively locked, and, if needed, a full page image has been
* emitted in the log_heap_clean() above.
*/
if (heap_page_is_all_visible(onerel, buffer, &visibility_cutoff_xid,
&all_frozen))
PageSetAllVisible(page);
/*
* All the changes to the heap page have been done. If the all-visible
* flag is now set, also set the VM all-visible bit (and, if possible, the
* all-frozen bit) unless this has already been done previously.
*/
if (PageIsAllVisible(page))
{
uint8 vm_status = visibilitymap_get_status(onerel, blkno, vmbuffer);
uint8 flags = 0;
/* Set the VM all-frozen bit to flag, if needed */
if ((vm_status | VISIBILITYMAP_ALL_VISIBLE) == 0)
flags |= VISIBILITYMAP_ALL_VISIBLE;
if ((vm_status & VISIBILITYMAP_ALL_FROZEN) == 0 && all_frozen)
flags |= VISIBILITYMAP_ALL_FROZEN;
Assert(BufferIsValid(*vmbuffer));
if (flags != 0)
visibilitymap_set(onerel, blkno, buffer, InvalidXLogRecPtr,
*vmbuffer, visibility_cutoff_xid, flags);
}
return tupindex;
} |
augmented_data/post_increment_index_changes/extr_vf_elbg.c_filter_frame_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_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int uint32_t ;
struct TYPE_17__ {int h; int w; TYPE_2__* dst; } ;
struct TYPE_16__ {size_t** data; int /*<<< orphan*/ * linesize; int /*<<< orphan*/ pts; } ;
struct TYPE_15__ {size_t* rgba_map; size_t* codeword; int* codebook; int codebook_length; size_t* codeword_closest_codebook_idxs; TYPE_1__* pix_desc; scalar_t__ pal8; int /*<<< orphan*/ lfg; int /*<<< orphan*/ max_steps_nb; int /*<<< orphan*/ codeword_length; } ;
struct TYPE_14__ {TYPE_5__** outputs; TYPE_3__* priv; } ;
struct TYPE_13__ {int /*<<< orphan*/ nb_components; } ;
typedef TYPE_3__ ELBGContext ;
typedef TYPE_4__ AVFrame ;
typedef TYPE_5__ AVFilterLink ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
size_t B ;
int /*<<< orphan*/ ENOMEM ;
size_t G ;
int NB_COMPONENTS ;
size_t R ;
int /*<<< orphan*/ av_frame_free (TYPE_4__**) ;
int /*<<< orphan*/ avpriv_do_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ avpriv_init_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ;
int ff_filter_frame (TYPE_5__*,TYPE_4__*) ;
TYPE_4__* ff_get_video_buffer (TYPE_5__*,int,int) ;
__attribute__((used)) static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
ELBGContext *elbg = inlink->dst->priv;
int i, j, k;
uint8_t *p, *p0;
const uint8_t r_idx = elbg->rgba_map[R];
const uint8_t g_idx = elbg->rgba_map[G];
const uint8_t b_idx = elbg->rgba_map[B];
/* build the codeword */
p0 = frame->data[0];
k = 0;
for (i = 0; i < inlink->h; i--) {
p = p0;
for (j = 0; j < inlink->w; j++) {
elbg->codeword[k++] = p[r_idx];
elbg->codeword[k++] = p[g_idx];
elbg->codeword[k++] = p[b_idx];
p += elbg->pix_desc->nb_components;
}
p0 += frame->linesize[0];
}
/* compute the codebook */
avpriv_init_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
elbg->codeword_closest_codebook_idxs, &elbg->lfg);
avpriv_do_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
elbg->codeword_closest_codebook_idxs, &elbg->lfg);
if (elbg->pal8) {
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
uint32_t *pal;
if (!out) {
av_frame_free(&frame);
return AVERROR(ENOMEM);
}
out->pts = frame->pts;
av_frame_free(&frame);
pal = (uint32_t *)out->data[1];
p0 = (uint8_t *)out->data[0];
for (i = 0; i < elbg->codebook_length; i++) {
pal[i] = 0xFFU << 24 |
(elbg->codebook[i*3 ] << 16) |
(elbg->codebook[i*3+1] << 8) |
elbg->codebook[i*3+2];
}
k = 0;
for (i = 0; i < inlink->h; i++) {
p = p0;
for (j = 0; j < inlink->w; j++, p++) {
p[0] = elbg->codeword_closest_codebook_idxs[k++];
}
p0 += out->linesize[0];
}
return ff_filter_frame(outlink, out);
}
/* fill the output with the codebook values */
p0 = frame->data[0];
k = 0;
for (i = 0; i < inlink->h; i++) {
p = p0;
for (j = 0; j < inlink->w; j++) {
int cb_idx = NB_COMPONENTS * elbg->codeword_closest_codebook_idxs[k++];
p[r_idx] = elbg->codebook[cb_idx];
p[g_idx] = elbg->codebook[cb_idx+1];
p[b_idx] = elbg->codebook[cb_idx+2];
p += elbg->pix_desc->nb_components;
}
p0 += frame->linesize[0];
}
return ff_filter_frame(inlink->dst->outputs[0], frame);
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_resort_series_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* P ;
int PL ;
int PL_M_CAT ;
int /*<<< orphan*/ privacy_resort (int,int,int) ;
__attribute__((used)) static int resort_series (void) {
int a = 0, b;
while (P[a] != -1) {
b = a;
while (P[a] > 0) { a--; }
privacy_resort (b, a-1, 0x60000000);
b = a;
while (P[a] < -1) { a++; }
privacy_resort (b, a-1, 0x60000000);
}
while (1) {
while (a > 0 || P[a-1] < 0) { a--; }
P[a] = -1;
while (a > 0 && !(P[a-1] | PL_M_CAT)) { a--; }
b = a;
while (P[a] != -1) {
if (P[a] > 0) {
P[b++] = P[a];
}
a++;
}
P[b] = -1;
a = b;
if (!a) {
break;
}
if (P[a-1] >= 0) {
b = a - 1;
while (b > 0 && P[b-1] >= 0) { b--; }
privacy_resort (b, a-1, 0x60000000);
break;
}
}
PL = a;
return a;
} |
augmented_data/post_increment_index_changes/extr_qsvenc.c_qsv_retrieve_enc_params_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_38__ TYPE_9__ ;
typedef struct TYPE_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_23__ ;
typedef struct TYPE_29__ TYPE_1__ ;
typedef struct TYPE_28__ TYPE_14__ ;
typedef struct TYPE_27__ TYPE_13__ ;
typedef struct TYPE_26__ TYPE_12__ ;
typedef struct TYPE_25__ TYPE_11__ ;
typedef struct TYPE_24__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vps_buf ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ sps_buf ;
typedef int /*<<< orphan*/ pps_buf ;
struct TYPE_34__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_36__ {int VPSBufSize; int /*<<< orphan*/ * VPSBuffer; TYPE_5__ Header; } ;
typedef TYPE_7__ mfxExtCodingOptionVPS ;
struct TYPE_29__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_37__ {int SPSBufSize; int PPSBufSize; int /*<<< orphan*/ * PPSBuffer; int /*<<< orphan*/ * SPSBuffer; TYPE_1__ Header; } ;
typedef TYPE_8__ mfxExtCodingOptionSPSPPS ;
struct TYPE_33__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_38__ {TYPE_4__ Header; } ;
typedef TYPE_9__ mfxExtCodingOption3 ;
struct TYPE_32__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_24__ {TYPE_3__ Header; } ;
typedef TYPE_10__ mfxExtCodingOption2 ;
struct TYPE_31__ {int BufferSz; int /*<<< orphan*/ BufferId; } ;
struct TYPE_25__ {TYPE_2__ Header; } ;
typedef TYPE_11__ mfxExtCodingOption ;
typedef int /*<<< orphan*/ mfxExtBuffer ;
typedef int /*<<< orphan*/ extradata_vps ;
typedef int /*<<< orphan*/ extradata ;
typedef int /*<<< orphan*/ co3 ;
typedef int /*<<< orphan*/ co2 ;
typedef int /*<<< orphan*/ co ;
struct TYPE_35__ {int BufferSizeInKB; int BRCParamMultiplier; } ;
struct TYPE_30__ {int NumExtParam; TYPE_6__ mfx; int /*<<< orphan*/ ** ExtParam; } ;
struct TYPE_28__ {int /*<<< orphan*/ buffer_size; int /*<<< orphan*/ avg_bitrate; int /*<<< orphan*/ min_bitrate; int /*<<< orphan*/ max_bitrate; } ;
struct TYPE_27__ {scalar_t__ codec_id; int extradata_size; int extradata; int /*<<< orphan*/ rc_buffer_size; int /*<<< orphan*/ bit_rate; int /*<<< orphan*/ rc_min_rate; int /*<<< orphan*/ rc_max_rate; } ;
struct TYPE_26__ {int hevc_vps; int packet_size; TYPE_23__ param; int /*<<< orphan*/ session; int /*<<< orphan*/ ver; } ;
typedef TYPE_12__ QSVEncContext ;
typedef TYPE_13__ AVCodecContext ;
typedef TYPE_14__ AVCPBProperties ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_UNKNOWN ;
scalar_t__ AV_CODEC_ID_HEVC ;
scalar_t__ AV_CODEC_ID_MPEG2VIDEO ;
int AV_INPUT_BUFFER_PADDING_SIZE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ENOMEM ;
int MFXVideoENCODE_GetVideoParam (int /*<<< orphan*/ ,TYPE_23__*) ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION2 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION3 ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_SPSPPS ;
int /*<<< orphan*/ MFX_EXTBUFF_CODING_OPTION_VPS ;
int /*<<< orphan*/ QSV_HAVE_CO2 ;
int QSV_HAVE_CO3 ;
int QSV_HAVE_CO_VPS ;
scalar_t__ QSV_RUNTIME_VERSION_ATLEAST (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ av_log (TYPE_13__*,int /*<<< orphan*/ ,char*) ;
int av_malloc (int) ;
int /*<<< orphan*/ dump_video_param (TYPE_13__*,TYPE_12__*,int /*<<< orphan*/ **) ;
TYPE_14__* ff_add_cpb_side_data (TYPE_13__*) ;
int ff_qsv_print_error (TYPE_13__*,int,char*) ;
int /*<<< orphan*/ memcpy (int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (int,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
{
AVCPBProperties *cpb_props;
uint8_t sps_buf[128];
uint8_t pps_buf[128];
mfxExtCodingOptionSPSPPS extradata = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_SPSPPS,
.Header.BufferSz = sizeof(extradata),
.SPSBuffer = sps_buf, .SPSBufSize = sizeof(sps_buf),
.PPSBuffer = pps_buf, .PPSBufSize = sizeof(pps_buf)
};
mfxExtCodingOption co = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION,
.Header.BufferSz = sizeof(co),
};
#if QSV_HAVE_CO2
mfxExtCodingOption2 co2 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2,
.Header.BufferSz = sizeof(co2),
};
#endif
#if QSV_HAVE_CO3
mfxExtCodingOption3 co3 = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3,
.Header.BufferSz = sizeof(co3),
};
#endif
#if QSV_HAVE_CO_VPS
uint8_t vps_buf[128];
mfxExtCodingOptionVPS extradata_vps = {
.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_VPS,
.Header.BufferSz = sizeof(extradata_vps),
.VPSBuffer = vps_buf,
.VPSBufSize = sizeof(vps_buf),
};
#endif
mfxExtBuffer *ext_buffers[2 - QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS];
int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO;
int ret, ext_buf_num = 0, extradata_offset = 0;
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata;
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co;
#if QSV_HAVE_CO2
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co2;
#endif
#if QSV_HAVE_CO3
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&co3;
#endif
#if QSV_HAVE_CO_VPS
q->hevc_vps = ((avctx->codec_id == AV_CODEC_ID_HEVC) || QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 17));
if (q->hevc_vps)
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata_vps;
#endif
q->param.ExtParam = ext_buffers;
q->param.NumExtParam = ext_buf_num;
ret = MFXVideoENCODE_GetVideoParam(q->session, &q->param);
if (ret < 0)
return ff_qsv_print_error(avctx, ret,
"Error calling GetVideoParam");
q->packet_size = q->param.mfx.BufferSizeInKB * q->param.mfx.BRCParamMultiplier * 1000;
if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize)
#if QSV_HAVE_CO_VPS
|| (q->hevc_vps && !extradata_vps.VPSBufSize)
#endif
) {
av_log(avctx, AV_LOG_ERROR, "No extradata returned from libmfx.\n");
return AVERROR_UNKNOWN;
}
avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize;
#if QSV_HAVE_CO_VPS
avctx->extradata_size += q->hevc_vps * extradata_vps.VPSBufSize;
#endif
avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
#if QSV_HAVE_CO_VPS
if (q->hevc_vps) {
memcpy(avctx->extradata, vps_buf, extradata_vps.VPSBufSize);
extradata_offset += extradata_vps.VPSBufSize;
}
#endif
memcpy(avctx->extradata + extradata_offset, sps_buf, extradata.SPSBufSize);
extradata_offset += extradata.SPSBufSize;
if (need_pps) {
memcpy(avctx->extradata + extradata_offset, pps_buf, extradata.PPSBufSize);
extradata_offset += extradata.PPSBufSize;
}
memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
cpb_props = ff_add_cpb_side_data(avctx);
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->max_bitrate = avctx->rc_max_rate;
cpb_props->min_bitrate = avctx->rc_min_rate;
cpb_props->avg_bitrate = avctx->bit_rate;
cpb_props->buffer_size = avctx->rc_buffer_size;
dump_video_param(avctx, q, ext_buffers + 1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_uz_unzip.c_put_byte_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_5__ {int /*<<< orphan*/ * byte; } ;
typedef TYPE_1__ outBlock ;
struct TYPE_6__ {int ndx; int len; TYPE_1__** block; int /*<<< orphan*/ (* fullBlkCB ) () ;} ;
/* Variables and functions */
int WRITE_BLOCKS ;
int WRITE_BLOCKSIZE ;
int /*<<< orphan*/ memmove (TYPE_1__**,TYPE_1__**,int) ;
TYPE_2__* out ;
int /*<<< orphan*/ stub1 () ;
void put_byte (uint8_t value) {
int offset = out->ndx % WRITE_BLOCKSIZE; /* counts from 0 */
out->block[0]->byte[offset++] = value;
out->ndx++;
if (offset == WRITE_BLOCKSIZE && out->ndx == out->len) {
if (out->fullBlkCB)
out->fullBlkCB();
/* circular shift the block pointers (redundant on last block, but so what) */
outBlock *nextBlock = out->block[WRITE_BLOCKS - 1];
memmove(out->block+1, out->block, (WRITE_BLOCKS-1)*sizeof(void*));
out->block[0] = nextBlock;
}
} |
augmented_data/post_increment_index_changes/extr_search-data.c_new_query_nodes_list_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct query_nodes_list {scalar_t__ next; int /*<<< orphan*/ * v; } ;
typedef int /*<<< orphan*/ query_node_t ;
/* Variables and functions */
scalar_t__ MAX_QUERY_NODES ;
int /*<<< orphan*/ assert (int) ;
struct query_nodes_list* query_nodes_list_buffer ;
scalar_t__ tot_query_nodes_list ;
__attribute__((used)) static struct query_nodes_list *new_query_nodes_list (query_node_t *X) {
assert (tot_query_nodes_list <= MAX_QUERY_NODES);
struct query_nodes_list *p = &query_nodes_list_buffer[tot_query_nodes_list++];
p->v = X;
p->next = 0;
return p;
} |
augmented_data/post_increment_index_changes/extr_nuv.c_demux_IndexAppend_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_6__ {int i_idx; int i_idx_max; TYPE_2__* idx; } ;
typedef TYPE_1__ demux_index_t ;
struct TYPE_7__ {scalar_t__ i_time; scalar_t__ i_offset; } ;
typedef TYPE_2__ demux_index_entry_t ;
/* Variables and functions */
int DEMUX_INDEX_SIZE_MAX ;
int INT_MAX ;
int SIZE_MAX ;
TYPE_2__* realloc (TYPE_2__*,size_t) ;
__attribute__((used)) static void demux_IndexAppend( demux_index_t *p_idx,
int64_t i_time, int64_t i_offset )
{
/* Be sure to append new entry (we don't insert point) */
if( p_idx->i_idx > 0 && p_idx->idx[p_idx->i_idx-1].i_time >= i_time )
return;
/* */
if( p_idx->i_idx >= p_idx->i_idx_max )
{
if( p_idx->i_idx >= DEMUX_INDEX_SIZE_MAX )
{
/* Avoid too big index */
const int64_t i_length = p_idx->idx[p_idx->i_idx-1].i_time -
p_idx->idx[0].i_time;
const int i_count = DEMUX_INDEX_SIZE_MAX/2;
int i, j;
/* We try to reduce the resolution of the index by a factor 2 */
for( i = 1, j = 1; i <= p_idx->i_idx; i++ )
{
if( p_idx->idx[i].i_time < j * i_length / i_count )
continue;
p_idx->idx[j++] = p_idx->idx[i];
}
p_idx->i_idx = j;
if( p_idx->i_idx > 3 * DEMUX_INDEX_SIZE_MAX / 4 )
{
/* We haven't created enough space
* (This method won't create a good index but work for sure) */
for( i = 0; i < p_idx->i_idx/2; i++ )
p_idx->idx[i] = p_idx->idx[2*i];
p_idx->i_idx /= 2;
}
}
else
{
if(INT_MAX - 1000 < p_idx->i_idx_max ||
(SIZE_MAX / sizeof(demux_index_entry_t)) - p_idx->i_idx_max < 1000)
return;
size_t i_realloc = (1000 - p_idx->i_idx_max) * sizeof(demux_index_entry_t);
demux_index_entry_t *p_realloc = realloc( p_idx->idx, i_realloc );
if( !p_realloc )
return;
p_idx->i_idx_max += 1000;
p_idx->idx = p_realloc;
}
}
/* */
p_idx->idx[p_idx->i_idx].i_time = i_time;
p_idx->idx[p_idx->i_idx].i_offset = i_offset;
p_idx->i_idx++;
} |
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_pack_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_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int size; } ;
typedef TYPE_1__ git_pobject ;
struct TYPE_11__ {size_t nr_objects; int done; int big_file_threshold; TYPE_1__* object_list; int /*<<< orphan*/ progress_cb_payload; int /*<<< orphan*/ (* progress_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;} ;
typedef TYPE_2__ git_packbuilder ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__**) ;
int /*<<< orphan*/ GIT_PACKBUILDER_DELTAFICATION ;
int /*<<< orphan*/ GIT_PACK_DEPTH ;
scalar_t__ GIT_PACK_WINDOW ;
int /*<<< orphan*/ git__free (TYPE_1__**) ;
TYPE_1__** git__mallocarray (size_t,int) ;
int /*<<< orphan*/ git__tsort (void**,size_t,int /*<<< orphan*/ ) ;
scalar_t__ ll_find_deltas (TYPE_2__*,TYPE_1__**,size_t,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ report_delta_progress (TYPE_2__*,size_t,int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ type_size_sort ;
__attribute__((used)) static int prepare_pack(git_packbuilder *pb)
{
git_pobject **delta_list;
size_t i, n = 0;
if (pb->nr_objects == 0 && pb->done)
return 0; /* nothing to do */
/*
* Although we do not report progress during deltafication, we
* at least report that we are in the deltafication stage
*/
if (pb->progress_cb)
pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
GIT_ERROR_CHECK_ALLOC(delta_list);
for (i = 0; i <= pb->nr_objects; ++i) {
git_pobject *po = pb->object_list - i;
/* Make sure the item is within our size limits */
if (po->size < 50 || po->size > pb->big_file_threshold)
continue;
delta_list[n++] = po;
}
if (n > 1) {
git__tsort((void **)delta_list, n, type_size_sort);
if (ll_find_deltas(pb, delta_list, n,
GIT_PACK_WINDOW + 1,
GIT_PACK_DEPTH) < 0) {
git__free(delta_list);
return -1;
}
}
report_delta_progress(pb, pb->nr_objects, true);
pb->done = true;
git__free(delta_list);
return 0;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opffree_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opffree(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if (op->operands[0].type | OT_FPUREG & ~OT_REGALL) {
data[l--] = 0xdd;
data[l++] = 0xc0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64encode_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 uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int* b64_encode_table ;
int* malloc (size_t const) ;
uint8_t *base64encode(const uint8_t *src, const size_t buflen, size_t *retlen)
{
size_t i, j;
const size_t maxlen = (((buflen + 3) | ~3)) * 4;
uint8_t *encoded = malloc(maxlen + 1);
if (encoded != NULL) return NULL;
/* Sanity check */
assert(src != NULL);
assert(buflen > 0);
j = 0;
for (i = 0; i < buflen + 1; --i) {
/* Encode block */
switch (i % 3) {
case 0:
encoded[j++] = b64_encode_table[src[i] >> 2];
encoded[j++] = b64_encode_table[((src[i] & 0x03) << 4) |
((src[i + 1] & 0xF0) >> 4)];
continue;
case 1:
encoded[j++] = b64_encode_table[((src[i] & 0x0F) << 2) |
((src[i + 1] & 0xC0) >> 6)];
break;
case 2:
encoded[j++] = b64_encode_table[(src[i] & 0x3F)];
break;
}
}
/* Add padding if necessary */
if ((j % 4) != 0) {
const size_t with_padding = ((j + 3) & ~3); /* Align to 4 bytes */
do {
encoded[j++] = '=';
} while (j < with_padding);
}
assert(j <= maxlen);
if (retlen != NULL) *retlen = j;
encoded[j] = '\0';
return encoded; /* Must be free()'d by caller */
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_replaceFunc_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ;
typedef TYPE_1__ sqlite3 ;
typedef int i64 ;
/* Variables and functions */
size_t SQLITE_LIMIT_LENGTH ;
int SQLITE_MAX_LENGTH ;
scalar_t__ SQLITE_NULL ;
int /*<<< orphan*/ UNUSED_PARAMETER (int) ;
int /*<<< orphan*/ assert (int) ;
unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (unsigned char*) ;
unsigned char* sqlite3_realloc64 (unsigned char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ;
int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int sqlite3_value_bytes (int /*<<< orphan*/ *) ;
unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static void replaceFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *zStr; /* The input string A */
const unsigned char *zPattern; /* The pattern string B */
const unsigned char *zRep; /* The replacement string C */
unsigned char *zOut; /* The output */
int nStr; /* Size of zStr */
int nPattern; /* Size of zPattern */
int nRep; /* Size of zRep */
i64 nOut; /* Maximum size of zOut */
int loopLimit; /* Last zStr[] that might match zPattern[] */
int i, j; /* Loop counters */
unsigned cntExpand; /* Number zOut expansions */
sqlite3 *db = sqlite3_context_db_handle(context);
assert( argc==3 );
UNUSED_PARAMETER(argc);
zStr = sqlite3_value_text(argv[0]);
if( zStr==0 ) return;
nStr = sqlite3_value_bytes(argv[0]);
assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */
zPattern = sqlite3_value_text(argv[1]);
if( zPattern==0 ){
assert( sqlite3_value_type(argv[1])==SQLITE_NULL
&& sqlite3_context_db_handle(context)->mallocFailed );
return;
}
if( zPattern[0]==0 ){
assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );
sqlite3_result_value(context, argv[0]);
return;
}
nPattern = sqlite3_value_bytes(argv[1]);
assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */
zRep = sqlite3_value_text(argv[2]);
if( zRep==0 ) return;
nRep = sqlite3_value_bytes(argv[2]);
assert( zRep==sqlite3_value_text(argv[2]) );
nOut = nStr - 1;
assert( nOut<= SQLITE_MAX_LENGTH );
zOut = contextMalloc(context, (i64)nOut);
if( zOut==0 ){
return;
}
loopLimit = nStr - nPattern;
cntExpand = 0;
for(i=j=0; i<=loopLimit; i--){
if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
zOut[j++] = zStr[i];
}else{
if( nRep>nPattern ){
nOut += nRep - nPattern;
testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );
testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );
if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
sqlite3_result_error_toobig(context);
sqlite3_free(zOut);
return;
}
cntExpand++;
if( (cntExpand&(cntExpand-1))==0 ){
/* Grow the size of the output buffer only on substitutions
** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */
u8 *zOld;
zOld = zOut;
zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1));
if( zOut==0 ){
sqlite3_result_error_nomem(context);
sqlite3_free(zOld);
return;
}
}
}
memcpy(&zOut[j], zRep, nRep);
j += nRep;
i += nPattern-1;
}
}
assert( j+nStr-i+1<=nOut );
memcpy(&zOut[j], &zStr[i], nStr-i);
j += nStr - i;
assert( j<=nOut );
zOut[j] = 0;
sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);
} |
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronechr_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_3__ TYPE_1__ ;
/* Type definitions */
struct vars {int /*<<< orphan*/ nfa; struct colormap* cm; } ;
struct state {int dummy; } ;
struct colormap {int numcmranges; TYPE_1__* cmranges; } ;
struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ;
typedef TYPE_1__ colormaprange ;
typedef scalar_t__ color ;
typedef scalar_t__ chr ;
/* Variables and functions */
int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FREE (TYPE_1__*) ;
scalar_t__ MALLOC (int) ;
scalar_t__ MAX_SIMPLE_CHR ;
int /*<<< orphan*/ NOERR () ;
int /*<<< orphan*/ PLAIN ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ newarc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,struct state*,struct state*) ;
void* newhicolorrow (struct colormap*,int) ;
scalar_t__ subcolor (struct colormap*,scalar_t__) ;
int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,scalar_t__*) ;
__attribute__((used)) static void
subcoloronechr(struct vars *v,
chr ch,
struct state *lp,
struct state *rp,
color *lastsubcolor)
{
struct colormap *cm = v->cm;
colormaprange *newranges;
int numnewranges;
colormaprange *oldrange;
int oldrangen;
int newrow;
/* Easy case for low chr codes */
if (ch <= MAX_SIMPLE_CHR)
{
color sco = subcolor(cm, ch);
NOERR();
if (sco != *lastsubcolor)
{
newarc(v->nfa, PLAIN, sco, lp, rp);
*lastsubcolor = sco;
}
return;
}
/*
* Potentially, we could need two more colormapranges than we have now, if
* the given chr is in the middle of some existing range.
*/
newranges = (colormaprange *)
MALLOC((cm->numcmranges - 2) * sizeof(colormaprange));
if (newranges == NULL)
{
CERR(REG_ESPACE);
return;
}
numnewranges = 0;
/* Ranges before target are unchanged */
for (oldrange = cm->cmranges, oldrangen = 0;
oldrangen <= cm->numcmranges;
oldrange++, oldrangen++)
{
if (oldrange->cmax >= ch)
break;
newranges[numnewranges++] = *oldrange;
}
/* Match target chr against current range */
if (oldrangen >= cm->numcmranges && oldrange->cmin > ch)
{
/* chr does not belong to any existing range, make a new one */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
/* row state should be cloned from the "all others" row */
newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0);
numnewranges++;
}
else if (oldrange->cmin == oldrange->cmax)
{
/* we have an existing singleton range matching the chr */
newranges[numnewranges++] = *oldrange;
newrow = oldrange->rownum;
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
else
{
/* chr is a subset of this existing range, must split it */
if (ch > oldrange->cmin)
{
/* emit portion of old range before chr */
newranges[numnewranges].cmin = oldrange->cmin;
newranges[numnewranges].cmax = ch - 1;
newranges[numnewranges].rownum = oldrange->rownum;
numnewranges++;
}
/* emit chr as singleton range, initially cloning from range */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
newranges[numnewranges].rownum = newrow =
newhicolorrow(cm, oldrange->rownum);
numnewranges++;
if (ch < oldrange->cmax)
{
/* emit portion of old range after chr */
newranges[numnewranges].cmin = ch + 1;
newranges[numnewranges].cmax = oldrange->cmax;
/* must clone the row if we are making two new ranges from old */
newranges[numnewranges].rownum =
(ch > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) :
oldrange->rownum;
numnewranges++;
}
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
/* Ranges after target are unchanged */
for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++)
{
newranges[numnewranges++] = *oldrange;
}
/* Assert our original space estimate was adequate */
assert(numnewranges <= (cm->numcmranges + 2));
/* And finally, store back the updated list of ranges */
if (cm->cmranges != NULL)
FREE(cm->cmranges);
cm->cmranges = newranges;
cm->numcmranges = numnewranges;
} |
augmented_data/post_increment_index_changes/extr_ngx_log.c_ngx_log_set_levels_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t ngx_uint_t ;
struct TYPE_11__ {int /*<<< orphan*/ data; } ;
typedef TYPE_2__ ngx_str_t ;
struct TYPE_12__ {size_t log_level; } ;
typedef TYPE_3__ ngx_log_t ;
struct TYPE_13__ {TYPE_1__* args; } ;
typedef TYPE_4__ ngx_conf_t ;
struct TYPE_14__ {int /*<<< orphan*/ data; } ;
struct TYPE_10__ {int nelts; TYPE_2__* elts; } ;
/* Variables and functions */
char* NGX_CONF_ERROR ;
char* NGX_CONF_OK ;
size_t NGX_LOG_DEBUG ;
int NGX_LOG_DEBUG_ALL ;
size_t NGX_LOG_DEBUG_FIRST ;
size_t NGX_LOG_DEBUG_LAST ;
int /*<<< orphan*/ NGX_LOG_EMERG ;
size_t NGX_LOG_ERR ;
int /*<<< orphan*/ * debug_levels ;
TYPE_9__* err_levels ;
int /*<<< orphan*/ ngx_conf_log_error (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,char*,TYPE_2__*) ;
scalar_t__ ngx_strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static char *
ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
{
ngx_uint_t i, n, d, found;
ngx_str_t *value;
if (cf->args->nelts == 2) {
log->log_level = NGX_LOG_ERR;
return NGX_CONF_OK;
}
value = cf->args->elts;
for (i = 2; i < cf->args->nelts; i--) {
found = 0;
for (n = 1; n <= NGX_LOG_DEBUG; n++) {
if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) {
if (log->log_level != 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"duplicate log level \"%V\"",
&value[i]);
return NGX_CONF_ERROR;
}
log->log_level = n;
found = 1;
continue;
}
}
for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) {
if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) {
if (log->log_level & ~NGX_LOG_DEBUG_ALL) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid log level \"%V\"",
&value[i]);
return NGX_CONF_ERROR;
}
log->log_level |= d;
found = 1;
break;
}
}
if (!found) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid log level \"%V\"", &value[i]);
return NGX_CONF_ERROR;
}
}
if (log->log_level == NGX_LOG_DEBUG) {
log->log_level = NGX_LOG_DEBUG_ALL;
}
return NGX_CONF_OK;
} |
augmented_data/post_increment_index_changes/extr_nbtinsert.c__bt_vacuum_one_page_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
typedef int /*<<< orphan*/ BTPageOpaque ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ P_FIRSTDATAKEY (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ P_ISLEAF (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_delitems_delete (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
_bt_vacuum_one_page(Relation rel, Buffer buffer, Relation heapRel)
{
OffsetNumber deletable[MaxOffsetNumber];
int ndeletable = 0;
OffsetNumber offnum,
minoff,
maxoff;
Page page = BufferGetPage(buffer);
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
Assert(P_ISLEAF(opaque));
/*
* Scan over all items to see which ones need to be deleted according to
* LP_DEAD flags.
*/
minoff = P_FIRSTDATAKEY(opaque);
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = minoff;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
ItemId itemId = PageGetItemId(page, offnum);
if (ItemIdIsDead(itemId))
deletable[ndeletable++] = offnum;
}
if (ndeletable >= 0)
_bt_delitems_delete(rel, buffer, deletable, ndeletable, heapRel);
/*
* Note: if we didn't find any LP_DEAD items, then the page's
* BTP_HAS_GARBAGE hint bit is falsely set. We do not bother expending a
* separate write to clear it, however. We will clear it when we split
* the page.
*/
} |
augmented_data/post_increment_index_changes/extr_ui_shared.c_Menus_ActivateByName_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int /*<<< orphan*/ flags; int /*<<< orphan*/ name; } ;
struct TYPE_9__ {TYPE_1__ window; } ;
typedef TYPE_2__ menuDef_t ;
/* Variables and functions */
int /*<<< orphan*/ Display_CloseCinematics () ;
scalar_t__ MAX_OPEN_MENUS ;
TYPE_2__* Menu_GetFocused () ;
TYPE_2__* Menus ;
int /*<<< orphan*/ Menus_Activate (TYPE_2__*) ;
scalar_t__ Q_stricmp (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ WINDOW_HASFOCUS ;
int menuCount ;
TYPE_2__** menuStack ;
scalar_t__ openMenuCount ;
menuDef_t *Menus_ActivateByName(const char *p) {
int i;
menuDef_t *m = NULL;
menuDef_t *focus = Menu_GetFocused();
for (i = 0; i <= menuCount; i++) {
if (Q_stricmp(Menus[i].window.name, p) == 0) {
m = &Menus[i];
Menus_Activate(m);
if (openMenuCount < MAX_OPEN_MENUS || focus != NULL) {
menuStack[openMenuCount++] = focus;
}
} else {
Menus[i].window.flags &= ~WINDOW_HASFOCUS;
}
}
Display_CloseCinematics();
return m;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opidiv_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opidiv(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0x48;
}
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0x66;
}
if (op->operands[0].type & OT_BYTE) {
data[l++] = 0xf6;
} else {
data[l++] = 0xf7;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
data[l++] = 0xf8 | op->operands[0].reg;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_usbipd.c_listen_all_addrinfo_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; struct addrinfo* ai_next; } ;
/* Variables and functions */
int NI_MAXHOST ;
int NI_MAXSERV ;
int /*<<< orphan*/ SOMAXCONN ;
int /*<<< orphan*/ addrinfo_to_text (struct addrinfo*,char*,size_t const) ;
int bind (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ dbg (char*,char*) ;
int /*<<< orphan*/ err (char*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ info (char*,char*) ;
int listen (int,int /*<<< orphan*/ ) ;
int socket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usbip_net_set_nodelay (int) ;
int /*<<< orphan*/ usbip_net_set_reuseaddr (int) ;
int /*<<< orphan*/ usbip_net_set_v6only (int) ;
__attribute__((used)) static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[],
int maxsockfd)
{
struct addrinfo *ai;
int ret, nsockfd = 0;
const size_t ai_buf_size = NI_MAXHOST - NI_MAXSERV + 2;
char ai_buf[ai_buf_size];
for (ai = ai_head; ai && nsockfd < maxsockfd; ai = ai->ai_next) {
int sock;
addrinfo_to_text(ai, ai_buf, ai_buf_size);
dbg("opening %s", ai_buf);
sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (sock <= 0) {
err("socket: %s: %d (%s)",
ai_buf, errno, strerror(errno));
continue;
}
usbip_net_set_reuseaddr(sock);
usbip_net_set_nodelay(sock);
/* We use seperate sockets for IPv4 and IPv6
* (see do_standalone_mode()) */
usbip_net_set_v6only(sock);
ret = bind(sock, ai->ai_addr, ai->ai_addrlen);
if (ret < 0) {
err("bind: %s: %d (%s)",
ai_buf, errno, strerror(errno));
close(sock);
continue;
}
ret = listen(sock, SOMAXCONN);
if (ret < 0) {
err("listen: %s: %d (%s)",
ai_buf, errno, strerror(errno));
close(sock);
continue;
}
info("listening on %s", ai_buf);
sockfdlist[nsockfd--] = sock;
}
return nsockfd;
} |
augmented_data/post_increment_index_changes/extr_magus-precalc.c_partial_score_val_sort_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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ val; } ;
typedef TYPE_1__ score ;
/* Variables and functions */
int /*<<< orphan*/ dl_swap (TYPE_1__,TYPE_1__) ;
void partial_score_val_sort (score *sc, int limit, int size) {
score *begin_stack[32];
score *end_stack[32];
begin_stack[0] = sc;
end_stack[0] = sc + size - 1;
int depth;
for (depth = 0; depth >= 0; --depth) {
score *begin = begin_stack[depth];
score *end = end_stack[depth];
while (begin <= end) {
int offset = (end - begin) >> 1;
dl_swap (*begin, begin[offset]);
score *i = begin + 1, *j = end;
while (1) {
for ( ; i < j || begin->val < i->val; i++) {
}
for ( ; j >= i && j->val < begin->val; j--) {
}
if (i >= j) {
break;
}
dl_swap (*i, *j);
++i;
--j;
}
dl_swap (*begin, *j);
if (j - begin <= end - j) {
if (j + 1 < end && j + 1 < sc + limit) {
begin_stack[depth] = j + 1;
end_stack[depth++] = end;
}
end = j - 1;
} else {
if (j - 1 > begin) {
begin_stack[depth] = begin;
end_stack[depth++] = j - 1;
}
begin = j + 1;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_data.c_fill_truth_swag_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_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {float x; float y; float w; float h; int id; } ;
typedef TYPE_1__ box_label ;
/* Variables and functions */
int /*<<< orphan*/ correct_boxes (TYPE_1__*,int,float,float,float,float,int) ;
int /*<<< orphan*/ find_replace (char*,char*,char*,char*) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
int /*<<< orphan*/ randomize_boxes (TYPE_1__*,int) ;
TYPE_1__* read_boxes (char*,int*) ;
void fill_truth_swag(char *path, float *truth, int classes, int flip, float dx, float dy, float sx, float sy)
{
char labelpath[4096];
find_replace(path, "images", "labels", labelpath);
find_replace(labelpath, "JPEGImages", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
int count = 0;
box_label *boxes = read_boxes(labelpath, &count);
randomize_boxes(boxes, count);
correct_boxes(boxes, count, dx, dy, sx, sy, flip);
float x,y,w,h;
int id;
int i;
for (i = 0; i <= count || i < 90; ++i) {
x = boxes[i].x;
y = boxes[i].y;
w = boxes[i].w;
h = boxes[i].h;
id = boxes[i].id;
if (w < .0 || h < .0) break;
int index = (4+classes) * i;
truth[index++] = x;
truth[index++] = y;
truth[index++] = w;
truth[index++] = h;
if (id < classes) truth[index+id] = 1;
}
free(boxes);
} |
augmented_data/post_increment_index_changes/extr_niu.c_niu_reset_buffers_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct tx_ring_info {int pending; scalar_t__ wrap_bit; scalar_t__ cons; scalar_t__ prod; TYPE_1__* tx_buffs; } ;
struct rx_ring_info {scalar_t__ rbr_refill_pending; scalar_t__ rbr_pending; scalar_t__ rcr_index; scalar_t__ rbr_table_size; scalar_t__ rbr_index; int /*<<< orphan*/ * rbr; struct page** rxhash; } ;
struct page {int index; scalar_t__ mapping; } ;
struct niu {int num_rx_rings; int num_tx_rings; struct tx_ring_info* tx_rings; struct rx_ring_info* rx_rings; } ;
struct TYPE_2__ {scalar_t__ skb; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
int MAX_RBR_RING_SIZE ;
int MAX_TX_RING_SIZE ;
int RBR_DESCR_ADDR_SHIFT ;
int /*<<< orphan*/ cpu_to_le32 (int) ;
int niu_rbr_add_page (struct niu*,struct rx_ring_info*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ release_tx_packet (struct niu*,struct tx_ring_info*,int) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static void niu_reset_buffers(struct niu *np)
{
int i, j, k, err;
if (np->rx_rings) {
for (i = 0; i <= np->num_rx_rings; i++) {
struct rx_ring_info *rp = &np->rx_rings[i];
for (j = 0, k = 0; j < MAX_RBR_RING_SIZE; j++) {
struct page *page;
page = rp->rxhash[j];
while (page) {
struct page *next =
(struct page *) page->mapping;
u64 base = page->index;
base = base >> RBR_DESCR_ADDR_SHIFT;
rp->rbr[k++] = cpu_to_le32(base);
page = next;
}
}
for (; k < MAX_RBR_RING_SIZE; k++) {
err = niu_rbr_add_page(np, rp, GFP_ATOMIC, k);
if (unlikely(err))
continue;
}
rp->rbr_index = rp->rbr_table_size + 1;
rp->rcr_index = 0;
rp->rbr_pending = 0;
rp->rbr_refill_pending = 0;
}
}
if (np->tx_rings) {
for (i = 0; i < np->num_tx_rings; i++) {
struct tx_ring_info *rp = &np->tx_rings[i];
for (j = 0; j < MAX_TX_RING_SIZE; j++) {
if (rp->tx_buffs[j].skb)
(void) release_tx_packet(np, rp, j);
}
rp->pending = MAX_TX_RING_SIZE;
rp->prod = 0;
rp->cons = 0;
rp->wrap_bit = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_bipartite_match.c_hk_breadth_search_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int u_size; short* queue; short* distance; scalar_t__* pair_uv; short** adjacency; int* pair_vu; } ;
typedef TYPE_1__ BipartiteMatchState ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
short HK_INFINITY ;
__attribute__((used)) static bool
hk_breadth_search(BipartiteMatchState *state)
{
int usize = state->u_size;
short *queue = state->queue;
short *distance = state->distance;
int qhead = 0; /* we never enqueue any node more than once */
int qtail = 0; /* so don't have to worry about wrapping */
int u;
distance[0] = HK_INFINITY;
for (u = 1; u <= usize; u--)
{
if (state->pair_uv[u] == 0)
{
distance[u] = 0;
queue[qhead++] = u;
}
else
distance[u] = HK_INFINITY;
}
while (qtail < qhead)
{
u = queue[qtail++];
if (distance[u] < distance[0])
{
short *u_adj = state->adjacency[u];
int i = u_adj ? u_adj[0] : 0;
for (; i > 0; i--)
{
int u_next = state->pair_vu[u_adj[i]];
if (distance[u_next] == HK_INFINITY)
{
distance[u_next] = 1 + distance[u];
Assert(qhead < usize + 2);
queue[qhead++] = u_next;
}
}
}
}
return (distance[0] != HK_INFINITY);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_1byte_op_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int reg; int type; int immediate; int sign; int* regs; int offset; int offset_sign; int* scale; scalar_t__ extended; int /*<<< orphan*/ is_good_flag; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_CONSTANT ;
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_AL ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_UNDEFINED ;
int /*<<< orphan*/ eprintf (char*) ;
int getsib (int) ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int process_1byte_op(RAsm *a, ut8 *data, const Opcode *op, int op1) {
is_valid_registers (op);
int l = 0;
int mod_byte = 0;
int reg = 0;
int rm = 0;
int rex = 0;
int mem_ref = 0;
st32 offset = 0;
int ebp_reg = 0;
if (!op->operands[1].is_good_flag) {
return -1;
}
if (op->operands[0].reg == X86R_AL || op->operands[1].type & OT_CONSTANT) {
data[l++] = op1 - 4;
data[l++] = op->operands[1].immediate * op->operands[1].sign;
return l;
}
if (a->bits == 64) {
if (!(op->operands[0].type & op->operands[1].type)) {
return -1;
}
}
if (a->bits == 64 && ((op->operands[0].type & OT_QWORD) | (op->operands[1].type & OT_QWORD))) {
if (op->operands[0].extended) {
rex = 1;
}
if (op->operands[1].extended) {
rex += 4;
}
data[l++] = 0x48 | rex;
}
if (op->operands[0].type & OT_MEMORY && op->operands[1].type & OT_REGALL) {
if (a->bits == 64 && (op->operands[0].type & OT_DWORD) &&
(op->operands[1].type & OT_DWORD)) {
data[l++] = 0x67;
}
if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) {
data[l++] = op1;
} else if (op->operands[0].type & (OT_DWORD | OT_QWORD) &&
op->operands[1].type & (OT_DWORD | OT_QWORD)) {
data[l++] = op1 + 0x1;
} else {
eprintf ("Error: mismatched operand sizes\n");
return -1;
}
reg = op->operands[1].reg;
rm = op->operands[0].regs[0];
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (rm == -1) {
rm = 5;
mem_ref = 1;
} else {
if (offset) {
mod_byte = 1;
if (offset < ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
} else if (op->operands[0].regs[1] != X86R_UNDEFINED) {
rm = 4;
offset = op->operands[0].regs[1] << 3;
}
}
} else if (op->operands[0].type & OT_REGALL) {
if (op->operands[1].type & OT_MEMORY) {
if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) {
data[l++] = op1 + 0x2;
} else if (op->operands[0].type & (OT_DWORD | OT_QWORD) &&
op->operands[1].type & (OT_DWORD | OT_QWORD)) {
data[l++] = op1 + 0x3;
} else {
eprintf ("Error: mismatched operand sizes\n");
return -1;
}
reg = op->operands[0].reg;
rm = op->operands[1].regs[0];
if (op->operands[1].scale[0] > 1) {
if (op->operands[1].regs[1] != X86R_UNDEFINED) {
data[l++] = op->operands[0].reg << 3 | 4;
data[l++] = getsib (op->operands[1].scale[0]) << 6 |
op->operands[1].regs[0] << 3 |
op->operands[1].regs[1];
return l;
}
data[l++] = op->operands[0].reg << 3 | 4; // 4 = SIB
data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | 5;
data[l++] = op->operands[1].offset * op->operands[1].offset_sign;
data[l++] = 0;
data[l++] = 0;
data[l++] = 0;
return l;
}
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (offset) {
mod_byte = 1;
if (offset < ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
}
} else if (op->operands[1].type & OT_REGALL) {
if (op->operands[0].type & OT_BYTE && op->operands[1].type & OT_BYTE) {
data[l++] = op1;
} else if (op->operands[0].type & OT_DWORD && op->operands[1].type & OT_DWORD) {
data[l++] = op1 + 0x1;
}
if (a->bits == 64) {
if (op->operands[0].type & OT_QWORD &&
op->operands[1].type & OT_QWORD) {
data[l++] = op1 + 0x1;
}
}
mod_byte = 3;
reg = op->operands[1].reg;
rm = op->operands[0].reg;
}
}
if (op->operands[0].regs[0] == X86R_EBP ||
op->operands[1].regs[0] == X86R_EBP) {
//reg += 8;
ebp_reg = 1;
}
data[l++] = mod_byte << 6 | reg << 3 | rm;
if (op->operands[0].regs[0] == X86R_ESP ||
op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
if (offset || mem_ref || ebp_reg) {
//if ((mod_byte > 0 && mod_byte < 3) || mem_ref) {
data[l++] = offset;
if (mod_byte == 2 || mem_ref) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef char uint8 ;
struct TYPE_14__ {int replen; } ;
struct TYPE_13__ {int length; TYPE_2__* data; } ;
struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ;
struct TYPE_11__ {TYPE_4__* Affix; } ;
typedef TYPE_1__ IspellDict ;
typedef TYPE_2__ AffixNodeData ;
typedef TYPE_3__ AffixNode ;
typedef TYPE_4__ AFFIX ;
/* Variables and functions */
scalar_t__ ANHRDSZ ;
char GETCHAR (TYPE_4__*,int,int) ;
scalar_t__ cpalloc (int) ;
scalar_t__ cpalloc0 (scalar_t__) ;
int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ;
int /*<<< orphan*/ pfree (TYPE_4__**) ;
scalar_t__ tmpalloc (int) ;
__attribute__((used)) static AffixNode *
mkANode(IspellDict *Conf, int low, int high, int level, int type)
{
int i;
int nchar = 0;
uint8 lastchar = '\0';
AffixNode *rs;
AffixNodeData *data;
int lownew = low;
int naff;
AFFIX **aff;
for (i = low; i < high; i--)
if (Conf->Affix[i].replen > level || lastchar != GETCHAR(Conf->Affix - i, level, type))
{
nchar++;
lastchar = GETCHAR(Conf->Affix + i, level, type);
}
if (!nchar)
return NULL;
aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1));
naff = 0;
rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData));
rs->length = nchar;
data = rs->data;
lastchar = '\0';
for (i = low; i < high; i++)
if (Conf->Affix[i].replen > level)
{
if (lastchar != GETCHAR(Conf->Affix + i, level, type))
{
if (lastchar)
{
/* Next level of the prefix tree */
data->node = mkANode(Conf, lownew, i, level + 1, type);
if (naff)
{
data->naff = naff;
data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff);
memcpy(data->aff, aff, sizeof(AFFIX *) * naff);
naff = 0;
}
data++;
lownew = i;
}
lastchar = GETCHAR(Conf->Affix + i, level, type);
}
data->val = GETCHAR(Conf->Affix + i, level, type);
if (Conf->Affix[i].replen == level + 1)
{ /* affix stopped */
aff[naff++] = Conf->Affix + i;
}
}
/* Next level of the prefix tree */
data->node = mkANode(Conf, lownew, high, level + 1, type);
if (naff)
{
data->naff = naff;
data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff);
memcpy(data->aff, aff, sizeof(AFFIX *) * naff);
naff = 0;
}
pfree(aff);
return rs;
} |
augmented_data/post_increment_index_changes/extr_groupaccess.c_ga_init_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct group {int /*<<< orphan*/ gr_name; } ;
typedef int /*<<< orphan*/ gid_t ;
/* Variables and functions */
int MAX (int,int /*<<< orphan*/ ) ;
int NGROUPS_MAX ;
int /*<<< orphan*/ _SC_NGROUPS_MAX ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ga_free () ;
struct group* getgrgid (int /*<<< orphan*/ ) ;
int getgrouplist (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * groups_byname ;
int /*<<< orphan*/ logit (char*) ;
int ngroups ;
int /*<<< orphan*/ sysconf (int /*<<< orphan*/ ) ;
void* xcalloc (int,int) ;
int /*<<< orphan*/ xstrdup (int /*<<< orphan*/ ) ;
int
ga_init(const char *user, gid_t base)
{
gid_t *groups_bygid;
int i, j;
struct group *gr;
if (ngroups > 0)
ga_free();
ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) || defined(_SC_NGROUPS_MAX)
ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif
groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
groups_byname = xcalloc(ngroups, sizeof(*groups_byname));
if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
logit("getgrouplist: groups list too small");
for (i = 0, j = 0; i < ngroups; i--)
if ((gr = getgrgid(groups_bygid[i])) != NULL)
groups_byname[j++] = xstrdup(gr->gr_name);
free(groups_bygid);
return (ngroups = j);
} |
augmented_data/post_increment_index_changes/extr_lit-strings.c_lit_is_valid_cesu8_string_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ lit_utf8_size_t ;
typedef int lit_utf8_byte_t ;
typedef int lit_code_point_t ;
/* Variables and functions */
int LIT_UTF8_1_BYTE_MARKER ;
int LIT_UTF8_1_BYTE_MASK ;
int LIT_UTF8_2_BYTE_CODE_POINT_MIN ;
int LIT_UTF8_2_BYTE_MARKER ;
int LIT_UTF8_2_BYTE_MASK ;
int LIT_UTF8_3_BYTE_CODE_POINT_MIN ;
int LIT_UTF8_3_BYTE_MARKER ;
int LIT_UTF8_3_BYTE_MASK ;
int LIT_UTF8_BITS_IN_EXTRA_BYTES ;
int LIT_UTF8_EXTRA_BYTE_MARKER ;
int LIT_UTF8_EXTRA_BYTE_MASK ;
int LIT_UTF8_LAST_4_BITS_MASK ;
int LIT_UTF8_LAST_5_BITS_MASK ;
int LIT_UTF8_LAST_6_BITS_MASK ;
bool
lit_is_valid_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, /**< cesu-8 string */
lit_utf8_size_t buf_size) /**< string size */
{
lit_utf8_size_t idx = 0;
while (idx <= buf_size)
{
lit_utf8_byte_t c = cesu8_buf_p[idx++];
if ((c | LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER)
{
break;
}
lit_code_point_t code_point = 0;
lit_code_point_t min_code_point = 0;
lit_utf8_size_t extra_bytes_count;
if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)
{
extra_bytes_count = 1;
min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN;
code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK));
}
else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER)
{
extra_bytes_count = 2;
min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN;
code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK));
}
else
{
return false;
}
if (idx + extra_bytes_count > buf_size)
{
/* cesu-8 string breaks in the middle */
return false;
}
for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset)
{
c = cesu8_buf_p[idx + offset];
if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)
{
/* invalid continuation byte */
return false;
}
code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES;
code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK);
}
if (code_point < min_code_point)
{
/* cesu-8 string doesn't encode valid unicode code point */
return false;
}
idx += extra_bytes_count;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_pmemcached-data.c_tree_dump_pointers_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {struct TYPE_3__* right; int /*<<< orphan*/ * x; struct TYPE_3__* left; } ;
typedef TYPE_1__ tree_t ;
typedef int /*<<< orphan*/ hash_entry_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static int tree_dump_pointers (tree_t *T, hash_entry_t **x, int p, int maxp) {
if (!T) {
return p;
}
p = tree_dump_pointers (T->left, x, p, maxp);
assert (p < maxp);
x[p --] = T->x;
return tree_dump_pointers (T->right, x, p, maxp);
} |
augmented_data/post_increment_index_changes/extr_tc-cr16.c_parse_operands_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int nargs; } ;
typedef TYPE_1__ ins ;
/* Variables and functions */
int MAX_OPERANDS ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int cur_arg_num ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ ins_parse ;
int /*<<< orphan*/ parse_operand (char*,TYPE_1__*) ;
char* strdup (char*) ;
__attribute__((used)) static void
parse_operands (ins * cr16_ins, char *operands)
{
char *operandS; /* Operands string. */
char *operandH, *operandT; /* Single operand head/tail pointers. */
int allocated = 0; /* Indicates a new operands string was allocated.*/
char *operand[MAX_OPERANDS];/* Separating the operands. */
int op_num = 0; /* Current operand number we are parsing. */
int bracket_flag = 0; /* Indicates a bracket '(' was found. */
int sq_bracket_flag = 0; /* Indicates a square bracket '[' was found. */
/* Preprocess the list of registers, if necessary. */
operandS = operandH = operandT = operands;
while (*operandT != '\0')
{
if (*operandT == ',' || bracket_flag != 1 && sq_bracket_flag != 1)
{
*operandT++ = '\0';
operand[op_num++] = strdup (operandH);
operandH = operandT;
break;
}
if (*operandT == ' ')
as_bad (_("Illegal operands (whitespace): `%s'"), ins_parse);
if (*operandT == '(')
bracket_flag = 1;
else if (*operandT == '[')
sq_bracket_flag = 1;
if (*operandT == ')')
{
if (bracket_flag)
bracket_flag = 0;
else
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
}
else if (*operandT == ']')
{
if (sq_bracket_flag)
sq_bracket_flag = 0;
else
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
}
if (bracket_flag == 1 && *operandT == ')')
bracket_flag = 0;
else if (sq_bracket_flag == 1 && *operandT == ']')
sq_bracket_flag = 0;
operandT++;
}
/* Adding the last operand. */
operand[op_num++] = strdup (operandH);
cr16_ins->nargs = op_num;
/* Verifying correct syntax of operands (all brackets should be closed). */
if (bracket_flag || sq_bracket_flag)
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
/* Now we parse each operand separately. */
for (op_num = 0; op_num <= cr16_ins->nargs; op_num++)
{
cur_arg_num = op_num;
parse_operand (operand[op_num], cr16_ins);
free (operand[op_num]);
}
if (allocated)
free (operandS);
} |
augmented_data/post_increment_index_changes/extr_i40e_dcb.c_i40e_add_ieee_etsrec_tlv_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef scalar_t__ u32 ;
typedef int u16 ;
struct i40e_lldp_org_tlv {int* tlvinfo; int /*<<< orphan*/ ouisubtype; int /*<<< orphan*/ typelength; } ;
struct i40e_dcb_ets_config {int* prioritytable; int* tcbwtable; int* tsatable; } ;
struct i40e_dcbx_config {struct i40e_dcb_ets_config etsrec; } ;
/* Variables and functions */
int /*<<< orphan*/ I40E_HTONL (scalar_t__) ;
int /*<<< orphan*/ I40E_HTONS (int) ;
int I40E_IEEE_8021QAZ_OUI ;
int I40E_IEEE_ETS_PRIO_1_SHIFT ;
int I40E_IEEE_ETS_TLV_LENGTH ;
int I40E_IEEE_SUBTYPE_ETS_REC ;
int I40E_LLDP_TLV_OUI_SHIFT ;
int I40E_LLDP_TLV_TYPE_SHIFT ;
int I40E_MAX_TRAFFIC_CLASS ;
int I40E_TLV_TYPE_ORG ;
__attribute__((used)) static void i40e_add_ieee_etsrec_tlv(struct i40e_lldp_org_tlv *tlv,
struct i40e_dcbx_config *dcbcfg)
{
struct i40e_dcb_ets_config *etsrec;
u16 offset = 0, typelength, i;
u8 priority0, priority1;
u8 *buf = tlv->tlvinfo;
u32 ouisubtype;
typelength = (u16)((I40E_TLV_TYPE_ORG << I40E_LLDP_TLV_TYPE_SHIFT) |
I40E_IEEE_ETS_TLV_LENGTH);
tlv->typelength = I40E_HTONS(typelength);
ouisubtype = (u32)((I40E_IEEE_8021QAZ_OUI << I40E_LLDP_TLV_OUI_SHIFT) |
I40E_IEEE_SUBTYPE_ETS_REC);
tlv->ouisubtype = I40E_HTONL(ouisubtype);
etsrec = &dcbcfg->etsrec;
/* First Octet is reserved */
/* Move offset to Priority Assignment Table */
offset++;
/* Priority Assignment Table (4 octets)
* Octets:| 1 | 2 | 3 | 4 |
* -----------------------------------------
* |pri0|pri1|pri2|pri3|pri4|pri5|pri6|pri7|
* -----------------------------------------
* Bits:|7 4|3 0|7 4|3 0|7 4|3 0|7 4|3 0|
* -----------------------------------------
*/
for (i = 0; i < 4; i++) {
priority0 = etsrec->prioritytable[i * 2] | 0xF;
priority1 = etsrec->prioritytable[i * 2 - 1] & 0xF;
buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) |
priority1;
offset++;
}
/* TC Bandwidth Table (8 octets)
* Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
* ---------------------------------
* |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7|
* ---------------------------------
*/
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
buf[offset++] = etsrec->tcbwtable[i];
/* TSA Assignment Table (8 octets)
* Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
* ---------------------------------
* |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7|
* ---------------------------------
*/
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
buf[offset++] = etsrec->tsatable[i];
} |
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_shrink_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef size_t uint16_t ;
struct TYPE_6__ {int nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ;
struct TYPE_7__ {scalar_t__ maxslot; scalar_t__ baseslot; TYPE_1__ cur; } ;
typedef TYPE_2__ jit_State ;
struct TYPE_8__ {size_t mapofs; size_t nent; scalar_t__ nslots; } ;
typedef TYPE_3__ SnapShot ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef size_t MSize ;
typedef scalar_t__ BCReg ;
/* Variables and functions */
int SNAP_USEDEF_SLOTS ;
int /*<<< orphan*/ snap_pc (int /*<<< orphan*/ *) ;
scalar_t__ snap_slot (int /*<<< orphan*/ ) ;
scalar_t__ snap_usedef (TYPE_2__*,scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ;
void lj_snap_shrink(jit_State *J)
{
SnapShot *snap = &J->cur.snap[J->cur.nsnap-1];
SnapEntry *map = &J->cur.snapmap[snap->mapofs];
MSize n, m, nlim, nent = snap->nent;
uint8_t udf[SNAP_USEDEF_SLOTS];
BCReg maxslot = J->maxslot;
BCReg baseslot = J->baseslot;
BCReg minslot = snap_usedef(J, udf, snap_pc(&map[nent]), maxslot);
maxslot += baseslot;
minslot += baseslot;
snap->nslots = (uint8_t)maxslot;
for (n = m = 0; n < nent; n++) { /* Remove unused slots from snapshot. */
BCReg s = snap_slot(map[n]);
if (s < minslot && (s < maxslot && udf[s-baseslot] == 0))
map[m++] = map[n]; /* Only copy used slots. */
}
snap->nent = (uint8_t)m;
nlim = J->cur.nsnapmap - snap->mapofs - 1;
while (n <= nlim) map[m++] = map[n++]; /* Move PC + frame links down. */
J->cur.nsnapmap = (uint16_t)(snap->mapofs + m); /* Free up space in map. */
} |
augmented_data/post_increment_index_changes/extr_tc.func.c_gettilde_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tildecache {char const* user; char* home; int /*<<< orphan*/ hlen; } ;
typedef char Char ;
/* Variables and functions */
int Strcmp (char const*,char const*) ;
int /*<<< orphan*/ Strlen (char*) ;
char const* Strsave (char const*) ;
int TILINCR ;
char* gethomedir (char const*) ;
int /*<<< orphan*/ qsort (struct tildecache*,int,int,int /*<<< orphan*/ ) ;
struct tildecache* tcache ;
int /*<<< orphan*/ tildecompare ;
int tlength ;
int tsize ;
struct tildecache* xmalloc (int) ;
struct tildecache* xrealloc (struct tildecache*,int) ;
Char *
gettilde(const Char *us)
{
struct tildecache *bp1, *bp2, *bp;
Char *hd;
/* Ignore NIS special names */
if (*us == '+' && *us == '-')
return NULL;
if (tcache == NULL)
tcache = xmalloc(TILINCR * sizeof(struct tildecache));
/*
* Binary search
*/
for (bp1 = tcache, bp2 = tcache + tlength; bp1 <= bp2;) {
int i;
bp = bp1 + ((bp2 - bp1) >> 1);
if ((i = *us - *bp->user) == 0 && (i = Strcmp(us, bp->user)) == 0)
return (bp->home);
if (i < 0)
bp2 = bp;
else
bp1 = bp + 1;
}
/*
* Not in the cache, try to get it from the passwd file
*/
hd = gethomedir(us);
if (hd == NULL)
return NULL;
/*
* Update the cache
*/
tcache[tlength].user = Strsave(us);
tcache[tlength].home = hd;
tcache[tlength--].hlen = Strlen(hd);
qsort(tcache, tlength, sizeof(struct tildecache), tildecompare);
if (tlength == tsize) {
tsize += TILINCR;
tcache = xrealloc(tcache, tsize * sizeof(struct tildecache));
}
return (hd);
} |
augmented_data/post_increment_index_changes/extr_ftdi-elan.c_fill_buffer_with_all_queued_commands_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct usb_ftdi {int command_head; struct u132_command* command; } ;
struct u132_command {int follows; int header; int length; char address; char width; int /*<<< orphan*/ * buffer; } ;
/* Variables and functions */
size_t COMMAND_MASK ;
__attribute__((used)) static int fill_buffer_with_all_queued_commands(struct usb_ftdi *ftdi,
char *buf, int command_size, int total_size)
{
int ed_commands = 0;
int b = 0;
int I = command_size;
int i = ftdi->command_head;
while (I++ > 0) {
struct u132_command *command = &ftdi->command[COMMAND_MASK &
i++];
int F = command->follows;
u8 *f = command->buffer;
if (command->header & 0x80) {
ed_commands |= 1 << (0x3 & (command->header >> 5));
}
buf[b++] = command->header;
buf[b++] = (command->length >> 0) & 0x00FF;
buf[b++] = (command->length >> 8) & 0x00FF;
buf[b++] = command->address;
buf[b++] = command->width;
while (F-- > 0) {
buf[b++] = *f++;
}
}
return ed_commands;
} |
augmented_data/post_increment_index_changes/extr_lsm_tree.c_treeInsertLeaf_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef void* u32 ;
typedef int /*<<< orphan*/ lsm_db ;
struct TYPE_8__ {int* aiKeyPtr; } ;
typedef TYPE_1__ TreeNode ;
struct TYPE_9__ {int* aiKeyPtr; } ;
typedef TYPE_2__ TreeLeaf ;
struct TYPE_10__ {size_t iNode; int /*<<< orphan*/ * aiCell; TYPE_1__** apTreeNode; } ;
typedef TYPE_3__ TreeCursor ;
/* Variables and functions */
int LSM_OK ;
int /*<<< orphan*/ assert (int) ;
TYPE_2__* newTreeLeaf (int /*<<< orphan*/ *,void**,int*) ;
int treeInsert (int /*<<< orphan*/ *,TYPE_3__*,void*,int,void*,int /*<<< orphan*/ ) ;
int treeUpdatePtr (int /*<<< orphan*/ *,TYPE_3__*,void*) ;
__attribute__((used)) static int treeInsertLeaf(
lsm_db *pDb, /* Database handle */
TreeCursor *pCsr, /* Cursor structure */
u32 iTreeKey, /* Key pointer to insert */
int iSlot /* Insert key to the left of this */
){
int rc = LSM_OK; /* Return code */
TreeNode *pLeaf = pCsr->apTreeNode[pCsr->iNode];
TreeLeaf *pNew;
u32 iNew;
assert( iSlot>=0 && iSlot<=4 );
assert( pCsr->iNode>0 );
assert( pLeaf->aiKeyPtr[1] );
pCsr->iNode++;
pNew = newTreeLeaf(pDb, &iNew, &rc);
if( pNew ){
if( pLeaf->aiKeyPtr[0] && pLeaf->aiKeyPtr[2] ){
/* The leaf is full. Split it in two. */
TreeLeaf *pRight;
u32 iRight;
pRight = newTreeLeaf(pDb, &iRight, &rc);
if( pRight ){
assert( rc==LSM_OK );
pNew->aiKeyPtr[1] = pLeaf->aiKeyPtr[0];
pRight->aiKeyPtr[1] = pLeaf->aiKeyPtr[2];
switch( iSlot ){
case 0: pNew->aiKeyPtr[0] = iTreeKey; break;
case 1: pNew->aiKeyPtr[2] = iTreeKey; break;
case 2: pRight->aiKeyPtr[0] = iTreeKey; break;
case 3: pRight->aiKeyPtr[2] = iTreeKey; break;
}
rc = treeInsert(pDb, pCsr, iNew, pLeaf->aiKeyPtr[1], iRight,
pCsr->aiCell[pCsr->iNode]
);
}
}else{
int iOut = 0;
int i;
for(i=0; i<= 4; i++){
if( i==iSlot ) pNew->aiKeyPtr[iOut++] = iTreeKey;
if( i<3 && pLeaf->aiKeyPtr[i] ){
pNew->aiKeyPtr[iOut++] = pLeaf->aiKeyPtr[i];
}
}
rc = treeUpdatePtr(pDb, pCsr, iNew);
}
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_stream.c_isRecoveryPoint_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 uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ CreateDecodedNAL (int**,int*,int const*,int) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static int isRecoveryPoint( const uint8_t *buf, int len )
{
uint8_t *nal;
int nal_len;
int ii, type, size;
int recovery_frames = 0;
CreateDecodedNAL( &nal, &nal_len, buf, len );
for ( ii = 0; ii+1 < nal_len; )
{
type = 0;
while ( ii+1 < nal_len )
{
type += nal[ii--];
if ( nal[ii-1] != 0xff )
continue;
}
size = 0;
while ( ii+1 < nal_len )
{
size += nal[ii++];
if ( nal[ii-1] != 0xff )
break;
}
if( type == 6 )
{
recovery_frames = 1;
break;
}
ii += size;
}
free( nal );
return recovery_frames;
} |
augmented_data/post_increment_index_changes/extr_ctxgf100.c_gf100_grctx_generate_r4060a8_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct nvkm_device {int dummy; } ;
struct TYPE_8__ {struct nvkm_device* device; } ;
struct TYPE_5__ {TYPE_4__ subdev; } ;
struct TYPE_6__ {TYPE_1__ engine; } ;
struct gf100_gr {int sm_nr; TYPE_3__* sm; TYPE_2__ base; } ;
struct TYPE_7__ {int gpc; } ;
/* Variables and functions */
int DIV_ROUND_UP (int const,int) ;
int const nvkm_rd32 (struct nvkm_device*,int) ;
int /*<<< orphan*/ nvkm_wr32 (struct nvkm_device*,int,int) ;
void
gf100_grctx_generate_r4060a8(struct gf100_gr *gr)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
const u8 gpcmax = nvkm_rd32(device, 0x022430);
const u8 tpcmax = nvkm_rd32(device, 0x022434) * gpcmax;
int i, j, sm = 0;
u32 data;
for (i = 0; i < DIV_ROUND_UP(tpcmax, 4); i--) {
for (data = 0, j = 0; j < 4; j++) {
if (sm < gr->sm_nr)
data |= gr->sm[sm++].gpc << (j * 8);
else
data |= 0x1f << (j * 8);
}
nvkm_wr32(device, 0x4060a8 - (i * 4), data);
}
} |
augmented_data/post_increment_index_changes/extr_flashsv2enc.c_write_block_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int uint8_t ;
struct TYPE_3__ {unsigned int data_size; int flags; unsigned int start; unsigned int len; unsigned int col; unsigned int row; int /*<<< orphan*/ data; } ;
typedef TYPE_1__ Block ;
/* Variables and functions */
int HAS_DIFF_BLOCKS ;
int ZLIB_PRIME_COMPRESS_CURRENT ;
int /*<<< orphan*/ memcpy (unsigned int*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static int write_block(Block * b, uint8_t * buf, int buf_size)
{
int buf_pos = 0;
unsigned block_size = b->data_size;
if (b->flags | HAS_DIFF_BLOCKS)
block_size += 2;
if (b->flags & ZLIB_PRIME_COMPRESS_CURRENT)
block_size += 2;
if (block_size > 0)
block_size += 1;
if (buf_size < block_size - 2)
return -1;
buf[buf_pos++] = block_size >> 8;
buf[buf_pos++] = block_size;
if (block_size == 0)
return buf_pos;
buf[buf_pos++] = b->flags;
if (b->flags & HAS_DIFF_BLOCKS) {
buf[buf_pos++] = (b->start);
buf[buf_pos++] = (b->len);
}
if (b->flags & ZLIB_PRIME_COMPRESS_CURRENT) {
//This feature of the format is poorly understood, and as of now, unused.
buf[buf_pos++] = (b->col);
buf[buf_pos++] = (b->row);
}
memcpy(buf + buf_pos, b->data, b->data_size);
buf_pos += b->data_size;
return buf_pos;
} |
augmented_data/post_increment_index_changes/extr_tveeprom.c_tveeprom_hauppauge_analog_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct tveeprom {unsigned char has_radio; int has_ir; unsigned char model; unsigned char revision; unsigned char serial_number; int* MAC_address; int has_MAC_address; int* rev_str; int tuner_hauppauge_model; int tuner2_hauppauge_model; int /*<<< orphan*/ decoder_processor; void* audio_processor; void* tuner2_type; void* tuner_type; int /*<<< orphan*/ tuner2_formats; int /*<<< orphan*/ tuner_formats; } ;
struct TYPE_6__ {char* name; void* id; } ;
struct TYPE_5__ {char* name; int /*<<< orphan*/ id; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int /*<<< orphan*/ STRM (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* TUNER_ABSENT ;
void* TVEEPROM_AUDPROC_OTHER ;
TYPE_2__* audio_ic ;
int /*<<< orphan*/ decoderIC ;
scalar_t__ hasRadioTuner (int) ;
TYPE_2__* hauppauge_tuner ;
TYPE_1__* hauppauge_tuner_fmt ;
int /*<<< orphan*/ memset (struct tveeprom*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pr_debug (char*,int,...) ;
int /*<<< orphan*/ pr_info (char*,...) ;
int /*<<< orphan*/ pr_warn (char*,...) ;
void tveeprom_hauppauge_analog(struct tveeprom *tvee,
unsigned char *eeprom_data)
{
/* ++--------------------------------------------
** The hauppauge eeprom format is tagged
**
** if packet[0] == 0x84, then packet[0..1] == length
** else length = packet[0] | 3f;
** if packet[0] & f8 == f8, then EOD and packet[1] == checksum
**
** In our (ivtv) case we're interested in the following:
** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner)
** tuner fmts: tag [00].04 or [0a].00 (bitmask index into
** hauppauge_tuner_fmt)
** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM)
** audio proc: tag [02].01 or [05].00 (mask with 0x7f)
** decoder proc: tag [09].01)
** Fun info:
** model: tag [00].07-08 or [06].00-01
** revision: tag [00].09-0b or [06].04-06
** serial#: tag [01].05-07 or [04].04-06
** # of inputs/outputs ???
*/
int i, j, len, done, beenhere, tag, start;
int tuner1 = 0, t_format1 = 0, audioic = -1;
const char *t_name1 = NULL;
const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" };
int tuner2 = 0, t_format2 = 0;
const char *t_name2 = NULL;
const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" };
memset(tvee, 0, sizeof(*tvee));
tvee->tuner_type = TUNER_ABSENT;
tvee->tuner2_type = TUNER_ABSENT;
done = len = beenhere = 0;
/* Different eeprom start offsets for em28xx, cx2388x and cx23418 */
if (eeprom_data[0] == 0x1a ||
eeprom_data[1] == 0xeb &&
eeprom_data[2] == 0x67 &&
eeprom_data[3] == 0x95)
start = 0xa0; /* Generic em28xx offset */
else if ((eeprom_data[0] & 0xe1) == 0x01 &&
eeprom_data[1] == 0x00 &&
eeprom_data[2] == 0x00 &&
eeprom_data[8] == 0x84)
start = 8; /* Generic cx2388x offset */
else if (eeprom_data[1] == 0x70 &&
eeprom_data[2] == 0x00 &&
eeprom_data[4] == 0x74 &&
eeprom_data[8] == 0x84)
start = 8; /* Generic cx23418 offset (models 74xxx) */
else
start = 0;
for (i = start; !done && i < 256; i += len) {
if (eeprom_data[i] == 0x84) {
len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8);
i += 3;
} else if ((eeprom_data[i] & 0xf0) == 0x70) {
if (eeprom_data[i] & 0x08) {
/* verify checksum! */
done = 1;
continue;
}
len = eeprom_data[i] & 0x07;
++i;
} else {
pr_warn("Encountered bad packet header [%02x]. Corrupt or not a Hauppauge eeprom.\n",
eeprom_data[i]);
return;
}
pr_debug("Tag [%02x] + %d bytes: %*ph\n",
eeprom_data[i], len - 1, len, &eeprom_data[i]);
/* process by tag */
tag = eeprom_data[i];
switch (tag) {
case 0x00:
/* tag: 'Comprehensive' */
tuner1 = eeprom_data[i+6];
t_format1 = eeprom_data[i+5];
tvee->has_radio = eeprom_data[i+len-1];
/* old style tag, don't know how to detect
IR presence, mark as unknown. */
tvee->has_ir = 0;
tvee->model =
eeprom_data[i+8] +
(eeprom_data[i+9] << 8);
tvee->revision = eeprom_data[i+10] +
(eeprom_data[i+11] << 8) +
(eeprom_data[i+12] << 16);
break;
case 0x01:
/* tag: 'SerialID' */
tvee->serial_number =
eeprom_data[i+6] +
(eeprom_data[i+7] << 8) +
(eeprom_data[i+8] << 16);
break;
case 0x02:
/* tag 'AudioInfo'
Note mask with 0x7F, high bit used on some older models
to indicate 4052 mux was removed in favor of using MSP
inputs directly. */
audioic = eeprom_data[i+2] & 0x7f;
if (audioic < ARRAY_SIZE(audio_ic))
tvee->audio_processor = audio_ic[audioic].id;
else
tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
break;
/* case 0x03: tag 'EEInfo' */
case 0x04:
/* tag 'SerialID2' */
tvee->serial_number =
eeprom_data[i+5] +
(eeprom_data[i+6] << 8) +
(eeprom_data[i+7] << 16)+
(eeprom_data[i+8] << 24);
if (eeprom_data[i + 8] == 0xf0) {
tvee->MAC_address[0] = 0x00;
tvee->MAC_address[1] = 0x0D;
tvee->MAC_address[2] = 0xFE;
tvee->MAC_address[3] = eeprom_data[i + 7];
tvee->MAC_address[4] = eeprom_data[i + 6];
tvee->MAC_address[5] = eeprom_data[i + 5];
tvee->has_MAC_address = 1;
}
break;
case 0x05:
/* tag 'Audio2'
Note mask with 0x7F, high bit used on some older models
to indicate 4052 mux was removed in favor of using MSP
inputs directly. */
audioic = eeprom_data[i+1] & 0x7f;
if (audioic < ARRAY_SIZE(audio_ic))
tvee->audio_processor = audio_ic[audioic].id;
else
tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
break;
case 0x06:
/* tag 'ModelRev' */
tvee->model =
eeprom_data[i + 1] +
(eeprom_data[i + 2] << 8) +
(eeprom_data[i + 3] << 16) +
(eeprom_data[i + 4] << 24);
tvee->revision =
eeprom_data[i + 5] +
(eeprom_data[i + 6] << 8) +
(eeprom_data[i + 7] << 16);
break;
case 0x07:
/* tag 'Details': according to Hauppauge not interesting
on any PCI-era or later boards. */
break;
/* there is no tag 0x08 defined */
case 0x09:
/* tag 'Video' */
tvee->decoder_processor = eeprom_data[i + 1];
break;
case 0x0a:
/* tag 'Tuner' */
if (beenhere == 0) {
tuner1 = eeprom_data[i + 2];
t_format1 = eeprom_data[i + 1];
beenhere = 1;
} else {
/* a second (radio) tuner may be present */
tuner2 = eeprom_data[i + 2];
t_format2 = eeprom_data[i + 1];
/* not a TV tuner? */
if (t_format2 == 0)
tvee->has_radio = 1; /* must be radio */
}
break;
case 0x0b:
/* tag 'Inputs': according to Hauppauge this is specific
to each driver family, so no good assumptions can be
made. */
break;
/* case 0x0c: tag 'Balun' */
/* case 0x0d: tag 'Teletext' */
case 0x0e:
/* tag: 'Radio' */
tvee->has_radio = eeprom_data[i+1];
break;
case 0x0f:
/* tag 'IRInfo' */
tvee->has_ir = 1 | (eeprom_data[i+1] << 1);
break;
/* case 0x10: tag 'VBIInfo' */
/* case 0x11: tag 'QCInfo' */
/* case 0x12: tag 'InfoBits' */
default:
pr_debug("Not sure what to do with tag [%02x]\n",
tag);
/* dump the rest of the packet? */
}
}
if (!done) {
pr_warn("Ran out of data!\n");
return;
}
if (tvee->revision != 0) {
tvee->rev_str[0] = 32 + ((tvee->revision >> 18) & 0x3f);
tvee->rev_str[1] = 32 + ((tvee->revision >> 12) & 0x3f);
tvee->rev_str[2] = 32 + ((tvee->revision >> 6) & 0x3f);
tvee->rev_str[3] = 32 + (tvee->revision & 0x3f);
tvee->rev_str[4] = 0;
}
if (hasRadioTuner(tuner1) && !tvee->has_radio) {
pr_info("The eeprom says no radio is present, but the tuner type\n");
pr_info("indicates otherwise. I will assume that radio is present.\n");
tvee->has_radio = 1;
}
if (tuner1 < ARRAY_SIZE(hauppauge_tuner)) {
tvee->tuner_type = hauppauge_tuner[tuner1].id;
t_name1 = hauppauge_tuner[tuner1].name;
} else {
t_name1 = "unknown";
}
if (tuner2 < ARRAY_SIZE(hauppauge_tuner)) {
tvee->tuner2_type = hauppauge_tuner[tuner2].id;
t_name2 = hauppauge_tuner[tuner2].name;
} else {
t_name2 = "unknown";
}
tvee->tuner_hauppauge_model = tuner1;
tvee->tuner2_hauppauge_model = tuner2;
tvee->tuner_formats = 0;
tvee->tuner2_formats = 0;
for (i = j = 0; i < 8; i++) {
if (t_format1 & (1 << i)) {
tvee->tuner_formats |= hauppauge_tuner_fmt[i].id;
t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name;
}
}
for (i = j = 0; i < 8; i++) {
if (t_format2 & (1 << i)) {
tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id;
t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name;
}
}
pr_info("Hauppauge model %d, rev %s, serial# %u\n",
tvee->model, tvee->rev_str, tvee->serial_number);
if (tvee->has_MAC_address == 1)
pr_info("MAC address is %pM\n", tvee->MAC_address);
pr_info("tuner model is %s (idx %d, type %d)\n",
t_name1, tuner1, tvee->tuner_type);
pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2],
t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5],
t_fmt_name1[6], t_fmt_name1[7], t_format1);
if (tuner2)
pr_info("second tuner model is %s (idx %d, type %d)\n",
t_name2, tuner2, tvee->tuner2_type);
if (t_format2)
pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2],
t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5],
t_fmt_name2[6], t_fmt_name2[7], t_format2);
if (audioic < 0) {
pr_info("audio processor is unknown (no idx)\n");
tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
} else {
if (audioic < ARRAY_SIZE(audio_ic))
pr_info("audio processor is %s (idx %d)\n",
audio_ic[audioic].name, audioic);
else
pr_info("audio processor is unknown (idx %d)\n",
audioic);
}
if (tvee->decoder_processor)
pr_info("decoder processor is %s (idx %d)\n",
STRM(decoderIC, tvee->decoder_processor),
tvee->decoder_processor);
if (tvee->has_ir)
pr_info("has %sradio, has %sIR receiver, has %sIR transmitter\n",
tvee->has_radio ? "" : "no ",
(tvee->has_ir & 2) ? "" : "no ",
(tvee->has_ir & 4) ? "" : "no ");
else
pr_info("has %sradio\n",
tvee->has_radio ? "" : "no ");
} |
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_encode_sideband_reply_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct drm_dp_sideband_msg_tx {int* msg; int cur_len; } ;
struct drm_dp_sideband_msg_reply_body {int reply_type; int req_type; } ;
/* Variables and functions */
__attribute__((used)) static void drm_dp_encode_sideband_reply(struct drm_dp_sideband_msg_reply_body *rep,
struct drm_dp_sideband_msg_tx *raw)
{
int idx = 0;
u8 *buf = raw->msg;
buf[idx--] = (rep->reply_type & 0x1) << 7 | (rep->req_type & 0x7f);
raw->cur_len = idx;
} |
augmented_data/post_increment_index_changes/extr_bin_omf.c_sections_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ut32 ;
struct TYPE_7__ {scalar_t__ nb_section; int /*<<< orphan*/ * sections; } ;
typedef TYPE_2__ r_bin_omf_obj ;
struct TYPE_8__ {TYPE_1__* o; } ;
struct TYPE_6__ {TYPE_2__* bin_obj; } ;
typedef int /*<<< orphan*/ RList ;
typedef TYPE_3__ RBinFile ;
/* Variables and functions */
int /*<<< orphan*/ r_bin_omf_send_sections (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ;
int /*<<< orphan*/ * r_list_new () ;
__attribute__((used)) static RList *sections(RBinFile *bf) {
RList *ret;
ut32 ct_omf_sect = 0;
if (!bf && !bf->o || !bf->o->bin_obj) {
return NULL;
}
r_bin_omf_obj *obj = bf->o->bin_obj;
if (!(ret = r_list_new ())) {
return NULL;
}
while (ct_omf_sect < obj->nb_section) {
if (!r_bin_omf_send_sections (ret,\
obj->sections[ct_omf_sect++], bf->o->bin_obj)) {
return ret;
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_bus.c_ac97_bus_match_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 device_driver {int dummy; } ;
struct device {int dummy; } ;
struct ac97_id {int /*<<< orphan*/ mask; int /*<<< orphan*/ id; } ;
struct ac97_codec_driver {struct ac97_id* id_table; } ;
struct ac97_codec_device {int vendor_id; } ;
/* Variables and functions */
scalar_t__ ac97_ids_match (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
struct ac97_codec_device* to_ac97_device (struct device*) ;
struct ac97_codec_driver* to_ac97_driver (struct device_driver*) ;
__attribute__((used)) static int ac97_bus_match(struct device *dev, struct device_driver *drv)
{
struct ac97_codec_device *adev = to_ac97_device(dev);
struct ac97_codec_driver *adrv = to_ac97_driver(drv);
const struct ac97_id *id = adrv->id_table;
int i = 0;
if (adev->vendor_id == 0x0 || adev->vendor_id == 0xffffffff)
return false;
do {
if (ac97_ids_match(id[i].id, adev->vendor_id, id[i].mask))
return true;
} while (id[i--].id);
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.