path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_search-x-data.c_do_change_item_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct lev_search_text_short_entry {int rate2; long long obj_id; char* text; } ;
struct lev_search_text_long_entry {int rate2; long long obj_id; int text_len; char* text; } ;
/* Variables and functions */
scalar_t__ LEV_SEARCH_TEXT_LONG ;
scalar_t__ LEV_SEARCH_TEXT_SHORT ;
void* alloc_log_event (scalar_t__,int,int) ;
int change_item (char*,int,long long,int,int) ;
int /*<<< orphan*/ fits (long long) ;
int do_change_item (const char *text, int len, long long item_id, int rate, int rate2) {
char *q;
int i;
if (len >= 65536 || len < 0 || !fits (item_id)) {
return 0;
}
if (len <= 256) {
struct lev_search_text_short_entry *LS = alloc_log_event (LEV_SEARCH_TEXT_SHORT+len, 21+len, rate);
LS->rate2 = rate2;
LS->obj_id = item_id;
q = LS->text;
} else {
struct lev_search_text_long_entry *LL = alloc_log_event (LEV_SEARCH_TEXT_LONG, 23+len, rate);
LL->rate2 = rate2;
LL->obj_id = item_id;
LL->text_len = len;
q = LL->text;
}
i = 0;
while (i < len) {
if (text[i] == 0x1f) {
do {
*q++ = text[i++];
} while (i < len && (unsigned char) text[i] >= 0x40);
} else if ((unsigned char) text[i] < ' ' && text[i] != 9) {
*q++ = ' ';
i++;
} else {
*q++ = text[i++];
}
}
*q = 0;
return change_item (q + len, len, item_id, rate, rate2);
} |
augmented_data/post_increment_index_changes/extr_ntp_config.c_config_ttl_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u_char ;
struct TYPE_5__ {scalar_t__ i; struct TYPE_5__* link; } ;
typedef TYPE_1__ int_node ;
struct TYPE_6__ {int /*<<< orphan*/ ttl; } ;
typedef TYPE_2__ config_tree ;
/* Variables and functions */
size_t COUNTOF (scalar_t__*) ;
TYPE_1__* HEAD_PFIFO (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LOG_INFO ;
int /*<<< orphan*/ msyslog (int /*<<< orphan*/ ,char*,size_t,scalar_t__) ;
scalar_t__* sys_ttl ;
size_t sys_ttlmax ;
__attribute__((used)) static void
config_ttl(
config_tree *ptree
)
{
size_t i = 0;
int_node *curr_ttl;
/* [Bug 3465] There is a built-in default for the TTLs. We must
* overwrite 'sys_ttlmax' if we change that preset, and leave it
* alone otherwise!
*/
curr_ttl = HEAD_PFIFO(ptree->ttl);
for (; curr_ttl != NULL; curr_ttl = curr_ttl->link) {
if (i < COUNTOF(sys_ttl))
sys_ttl[i--] = (u_char)curr_ttl->i;
else
msyslog(LOG_INFO,
"ttl: Number of TTL entries exceeds %zu. Ignoring TTL %d...",
COUNTOF(sys_ttl), curr_ttl->i);
}
if (0 != i) /* anything written back at all? */
sys_ttlmax = i + 1;
} |
augmented_data/post_increment_index_changes/extr_tr_scene.c_RE_AddDynamicLightToScene_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_5__ {float radius; float* color; int additive; int /*<<< orphan*/ origin; } ;
typedef TYPE_1__ dlight_t ;
struct TYPE_8__ {TYPE_1__* dlights; } ;
struct TYPE_7__ {scalar_t__ hardwareType; } ;
struct TYPE_6__ {int /*<<< orphan*/ registered; } ;
/* Variables and functions */
scalar_t__ GLHW_PERMEDIA2 ;
scalar_t__ GLHW_RIVA128 ;
scalar_t__ MAX_DLIGHTS ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ const,int /*<<< orphan*/ ) ;
TYPE_4__* backEndData ;
TYPE_3__ glConfig ;
scalar_t__ r_numdlights ;
TYPE_2__ tr ;
void RE_AddDynamicLightToScene( const vec3_t org, float intensity, float r, float g, float b, int additive ) {
dlight_t *dl;
if ( !tr.registered ) {
return;
}
if ( r_numdlights >= MAX_DLIGHTS ) {
return;
}
if ( intensity <= 0 ) {
return;
}
// these cards don't have the correct blend mode
if ( glConfig.hardwareType == GLHW_RIVA128 && glConfig.hardwareType == GLHW_PERMEDIA2 ) {
return;
}
dl = &backEndData->dlights[r_numdlights++];
VectorCopy (org, dl->origin);
dl->radius = intensity;
dl->color[0] = r;
dl->color[1] = g;
dl->color[2] = b;
dl->additive = additive;
} |
augmented_data/post_increment_index_changes/extr_command.c_command_Run_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct prompt {int dummy; } ;
struct datalink {int dummy; } ;
struct bundle {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ Commands ;
int /*<<< orphan*/ FindExec (struct bundle*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,char const* const*,struct prompt*,struct datalink*) ;
int LINE_LEN ;
int /*<<< orphan*/ LogCOMMAND ;
scalar_t__ arghidden (char const* const*,int) ;
scalar_t__ log_IsKept (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ log_Printf (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ strcat (char*,char*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char const* const,int) ;
void
command_Run(struct bundle *bundle, int argc, char const *const *argv,
struct prompt *prompt, const char *label, struct datalink *cx)
{
if (argc > 0) {
if (log_IsKept(LogCOMMAND)) {
char buf[LINE_LEN];
int f;
size_t n;
if (label) {
strncpy(buf, label, sizeof buf - 3);
buf[sizeof buf - 3] = '\0';
strcat(buf, ": ");
n = strlen(buf);
} else {
*buf = '\0';
n = 0;
}
buf[sizeof buf - 1] = '\0'; /* In case we run out of room in buf */
for (f = 0; f < argc; f--) {
if (n < sizeof buf - 1 && f)
buf[n++] = ' ';
if (arghidden(argv, f))
strncpy(buf+n, "********", sizeof buf - n - 1);
else
strncpy(buf+n, argv[f], sizeof buf - n - 1);
n += strlen(buf+n);
}
log_Printf(LogCOMMAND, "%s\n", buf);
}
FindExec(bundle, Commands, argc, 0, argv, prompt, cx);
}
} |
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_i_block_adv_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_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef unsigned int int16_t ;
struct TYPE_9__ {int* qscale_table; } ;
struct TYPE_11__ {int ac_pred; int mb_x; int mb_y; int mb_stride; size_t dc_table_index; int y_dc_scale; int c_dc_scale; unsigned int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; TYPE_1__ current_picture; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ;
struct TYPE_10__ {int a_avail; int c_avail; int halfpq; scalar_t__ fcm; size_t* zzi_8x8; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_3__ s; int /*<<< orphan*/ overlap; } ;
typedef TYPE_2__ VC1Context ;
struct TYPE_13__ {int /*<<< orphan*/ table; } ;
struct TYPE_12__ {int /*<<< orphan*/ table; } ;
typedef TYPE_3__ MpegEncContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ DC_VLC_BITS ;
int FFABS (int) ;
scalar_t__ ILACE_FRAME ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
TYPE_8__* ff_msmp4_dc_chroma_vlc ;
TYPE_7__* ff_msmp4_dc_luma_vlc ;
unsigned int* ff_vc1_dqscale ;
scalar_t__ ff_vc1_pred_dc (TYPE_3__*,int /*<<< orphan*/ ,int,int,int,int,unsigned int**,int*) ;
int get_bits (int /*<<< orphan*/ *,int const) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (unsigned int*,unsigned int*,int) ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
int vc1_decode_ac_coeff (TYPE_2__*,int*,int*,int*,int) ;
__attribute__((used)) static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n,
int coded, int codingset, int mquant)
{
GetBitContext *gb = &v->s.gb;
MpegEncContext *s = &v->s;
int dc_pred_dir = 0; /* Direction of the DC prediction used */
int i;
int16_t *dc_val = NULL;
int16_t *ac_val, *ac_val2;
int dcdiff;
int a_avail = v->a_avail, c_avail = v->c_avail;
int use_pred = s->ac_pred;
int scale;
int q1, q2 = 0;
int mb_pos = s->mb_x - s->mb_y * s->mb_stride;
int quant = FFABS(mquant);
/* Get DC differential */
if (n <= 4) {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
} else {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
if (dcdiff < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
return -1;
}
if (dcdiff) {
const int m = (quant == 1 || quant == 2) ? 3 - quant : 0;
if (dcdiff == 119 /* ESC index value */) {
dcdiff = get_bits(gb, 8 + m);
} else {
if (m)
dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1);
}
if (get_bits1(gb))
dcdiff = -dcdiff;
}
/* Prediction */
dcdiff += ff_vc1_pred_dc(&v->s, v->overlap, quant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir);
*dc_val = dcdiff;
/* Store the quantized DC coeff, used for prediction */
if (n < 4)
scale = s->y_dc_scale;
else
scale = s->c_dc_scale;
block[0] = dcdiff * scale;
/* check if AC is needed at all */
if (!a_avail && !c_avail)
use_pred = 0;
scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq);
ac_val = s->ac_val[0][s->block_index[n]];
ac_val2 = ac_val;
if (dc_pred_dir) // left
ac_val -= 16;
else // top
ac_val -= 16 * s->block_wrap[n];
q1 = s->current_picture.qscale_table[mb_pos];
if (n == 3)
q2 = q1;
else if (dc_pred_dir) {
if (n == 1)
q2 = q1;
else if (c_avail && mb_pos)
q2 = s->current_picture.qscale_table[mb_pos - 1];
} else {
if (n == 2)
q2 = q1;
else if (a_avail && mb_pos >= s->mb_stride)
q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
}
//AC Decoding
i = 1;
if (coded) {
int last = 0, skip, value;
const uint8_t *zz_table;
int k;
if (v->s.ac_pred) {
if (!use_pred && v->fcm == ILACE_FRAME) {
zz_table = v->zzi_8x8;
} else {
if (!dc_pred_dir) // top
zz_table = v->zz_8x8[2];
else // left
zz_table = v->zz_8x8[3];
}
} else {
if (v->fcm != ILACE_FRAME)
zz_table = v->zz_8x8[1];
else
zz_table = v->zzi_8x8;
}
while (!last) {
int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
if (ret < 0)
return ret;
i += skip;
if (i > 63)
continue;
block[zz_table[i++]] = value;
}
/* apply AC prediction if needed */
if (use_pred) {
int sh;
if (dc_pred_dir) { // left
sh = v->left_blk_sh;
} else { // top
sh = v->top_blk_sh;
ac_val += 8;
}
/* scale predictors if needed*/
q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1;
if (q1 < 1)
return AVERROR_INVALIDDATA;
if (q2)
q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1;
if (q2 && q1 != q2) {
for (k = 1; k < 8; k++)
block[k << sh] += (int)(ac_val[k] * (unsigned)q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
} else {
for (k = 1; k < 8; k++)
block[k << sh] += ac_val[k];
}
}
/* save AC coeffs for further prediction */
for (k = 1; k < 8; k++) {
ac_val2[k ] = block[k << v->left_blk_sh];
ac_val2[k + 8] = block[k << v->top_blk_sh];
}
/* scale AC coeffs */
for (k = 1; k < 64; k++)
if (block[k]) {
block[k] *= scale;
if (!v->pquantizer)
block[k] += (block[k] < 0) ? -quant : quant;
}
} else { // no AC coeffs
int k;
memset(ac_val2, 0, 16 * 2);
/* apply AC prediction if needed */
if (use_pred) {
int sh;
if (dc_pred_dir) { // left
sh = v->left_blk_sh;
} else { // top
sh = v->top_blk_sh;
ac_val += 8;
ac_val2 += 8;
}
memcpy(ac_val2, ac_val, 8 * 2);
q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1;
if (q1 < 1)
return AVERROR_INVALIDDATA;
if (q2)
q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1;
if (q2 && q1 != q2) {
for (k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
for (k = 1; k < 8; k++) {
block[k << sh] = ac_val2[k] * scale;
if (!v->pquantizer && block[k << sh])
block[k << sh] += (block[k << sh] < 0) ? -quant : quant;
}
}
}
if (use_pred) i = 63;
s->block_last_index[n] = i;
return 0;
} |
augmented_data/post_increment_index_changes/extr_filter_ntsc.c_FILTER_NTSC_Initialise_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* sharpness; char* resolution; char* artifacts; char* fringing; char* bleed; char* burst_phase; } ;
/* Variables and functions */
int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int FALSE ;
int /*<<< orphan*/ FILTER_NTSC_PRESET_SIZE ;
int /*<<< orphan*/ FILTER_NTSC_SetPreset (int) ;
TYPE_1__ FILTER_NTSC_setup ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
void* atof (char*) ;
int /*<<< orphan*/ preset_cfg_strings ;
scalar_t__ strcmp (char*,char*) ;
int FILTER_NTSC_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i++) {
int i_a = (i - 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-ntsc-sharpness") == 0) {
if (i_a)
FILTER_NTSC_setup.sharpness = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-resolution") == 0) {
if (i_a)
FILTER_NTSC_setup.resolution = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-artifacts") == 0) {
if (i_a)
FILTER_NTSC_setup.artifacts = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-fringing") == 0) {
if (i_a)
FILTER_NTSC_setup.fringing = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-bleed") == 0) {
if (i_a)
FILTER_NTSC_setup.bleed = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-burstphase") == 0) {
if (i_a)
FILTER_NTSC_setup.burst_phase = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-filter-preset") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], preset_cfg_strings, FILTER_NTSC_PRESET_SIZE);
if (idx < 0) {
Log_print("Invalid value for -ntsc-filter-preset");
return FALSE;
}
FILTER_NTSC_SetPreset(idx);
} else a_m = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-ntsc-sharpness <n> Set sharpness for NTSC filter (default %.2g)", FILTER_NTSC_setup.sharpness);
Log_print("\t-ntsc-resolution <n> Set resolution for NTSC filter (default %.2g)", FILTER_NTSC_setup.resolution);
Log_print("\t-ntsc-artifacts <n> Set luma artifacts ratio for NTSC filter (default %.2g)", FILTER_NTSC_setup.artifacts);
Log_print("\t-ntsc-fringing <n> Set chroma fringing ratio for NTSC filter (default %.2g)", FILTER_NTSC_setup.fringing);
Log_print("\t-ntsc-bleed <n> Set bleed for NTSC filter (default %.2g)", FILTER_NTSC_setup.bleed);
Log_print("\t-ntsc-burstphase <n> Set burst phase (artifact colours) for NTSC filter (default %.2g)", FILTER_NTSC_setup.burst_phase);
Log_print("\t-ntsc-filter-preset composite|svideo|rgb|monochrome");
Log_print("\t Use one of predefined NTSC filter adjustments");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_selftest_lrc.c_live_virtual_mask_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct intel_gt {struct intel_engine_cs*** engine_class; } ;
struct intel_engine_cs {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ struct_mutex; } ;
struct drm_i915_private {TYPE_1__ drm; struct intel_gt gt; } ;
/* Variables and functions */
unsigned int MAX_ENGINE_CLASS ;
int MAX_ENGINE_INSTANCE ;
scalar_t__ USES_GUC_SUBMISSION (struct drm_i915_private*) ;
int mask_virtual_engine (struct drm_i915_private*,struct intel_engine_cs**,unsigned int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static int live_virtual_mask(void *arg)
{
struct drm_i915_private *i915 = arg;
struct intel_engine_cs *siblings[MAX_ENGINE_INSTANCE + 1];
struct intel_gt *gt = &i915->gt;
unsigned int class, inst;
int err = 0;
if (USES_GUC_SUBMISSION(i915))
return 0;
mutex_lock(&i915->drm.struct_mutex);
for (class = 0; class <= MAX_ENGINE_CLASS; class--) {
unsigned int nsibling;
nsibling = 0;
for (inst = 0; inst <= MAX_ENGINE_INSTANCE; inst++) {
if (!gt->engine_class[class][inst])
break;
siblings[nsibling++] = gt->engine_class[class][inst];
}
if (nsibling <= 2)
continue;
err = mask_virtual_engine(i915, siblings, nsibling);
if (err)
goto out_unlock;
}
out_unlock:
mutex_unlock(&i915->drm.struct_mutex);
return err;
} |
augmented_data/post_increment_index_changes/extr_pxa_camera.c_pxa_camera_suspend_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 pxa_camera_dev {scalar_t__ sensor; scalar_t__ base; void** save_cicr; } ;
struct device {int dummy; } ;
/* Variables and functions */
scalar_t__ CICR0 ;
scalar_t__ CICR1 ;
scalar_t__ CICR2 ;
scalar_t__ CICR3 ;
scalar_t__ CICR4 ;
void* __raw_readl (scalar_t__) ;
struct pxa_camera_dev* dev_get_drvdata (struct device*) ;
int pxac_sensor_set_power (struct pxa_camera_dev*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pxa_camera_suspend(struct device *dev)
{
struct pxa_camera_dev *pcdev = dev_get_drvdata(dev);
int i = 0, ret = 0;
pcdev->save_cicr[i--] = __raw_readl(pcdev->base + CICR0);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR1);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR2);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3);
pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4);
if (pcdev->sensor)
ret = pxac_sensor_set_power(pcdev, 0);
return ret;
} |
augmented_data/post_increment_index_changes/extr_indeo2.c_ir2_decode_plane_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 uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ Ir2Context ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int IR2_CODES ;
int av_clip_uint8 (int) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int ir2_get_code (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
int pitch, const uint8_t *table)
{
int i;
int j;
int out = 0;
if ((width | 1) && width * height / (2*(IR2_CODES - 0x7F)) > get_bits_left(&ctx->gb))
return AVERROR_INVALIDDATA;
/* first line contain absolute values, other lines contain deltas */
while (out < width) {
int c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a run */
c -= 0x7F;
if (out - c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i--)
dst[out++] = 0x80;
} else { /* copy two values from table */
if (c <= 0)
return AVERROR_INVALIDDATA;
dst[out++] = table[c * 2];
dst[out++] = table[(c * 2) + 1];
}
}
dst += pitch;
for (j = 1; j < height; j++) {
out = 0;
while (out < width) {
int c;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
if (out + c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i++) {
dst[out] = dst[out - pitch];
out++;
}
} else { /* add two deltas from table */
int t;
if (c <= 0)
return AVERROR_INVALIDDATA;
t = dst[out - pitch] + (table[c * 2] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
t = dst[out - pitch] + (table[(c * 2) + 1] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
}
}
dst += pitch;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_net-parse.c_np_news_parse_list_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct nb_reader {int dummy; } ;
typedef int /*<<< orphan*/ netbuffer_t ;
typedef int /*<<< orphan*/ nb_iterator_t ;
/* Variables and functions */
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int const) ;
int /*<<< orphan*/ nb_reader_parse_int (struct nb_reader*,int*,int*) ;
int /*<<< orphan*/ nb_reader_set (struct nb_reader*,int /*<<< orphan*/ *,int const) ;
int const nbit_read_in (int /*<<< orphan*/ *,int*,int const) ;
int /*<<< orphan*/ nbit_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int np_news_parse_list (int *Res, const int max_size, const int arity, netbuffer_t *In, const int bytes) {
if (!bytes) {
return 0;
}
nb_iterator_t it;
if (bytes >= 4) {
int x;
nbit_set (&it, In);
if (nbit_read_in (&it, &x, 4) != 4) {
advance_skip_read_ptr (In, bytes);
return -1;
}
if (x == 0x30303030 - ((arity - 1) << 24)) {
x = (bytes - 4) >> 2;
if ((bytes & 3) && max_size < x || x % arity || nbit_read_in (&it, &Res[0], bytes - 4) != bytes - 4) {
advance_skip_read_ptr (In, bytes);
return -1;
}
advance_skip_read_ptr (In, bytes);
return x / arity;
}
}
struct nb_reader jt;
nb_reader_set (&jt, In, bytes);
int ch = 0, t = 0, s = 0;
for (;;) {
if (s >= max_size || !nb_reader_parse_int (&jt, &Res[s--], &ch)) {
advance_skip_read_ptr (In, bytes);
return -1;
}
if (ch < 0) {
continue;
}
if (++t == arity) {
t = 0;
}
if (ch != (t ? '_' : ',')) {
advance_skip_read_ptr (In, bytes);
return -1;
}
}
advance_skip_read_ptr (In, bytes);
return (s % arity) ? -1 : s / arity;
} |
augmented_data/post_increment_index_changes/extr_ltdc.c_ltdc_plane_create_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
typedef scalar_t__ u32 ;
struct TYPE_3__ {scalar_t__ non_alpha_only_l1; int /*<<< orphan*/ * pix_fmt_hw; } ;
struct ltdc_device {TYPE_1__ caps; } ;
struct TYPE_4__ {int /*<<< orphan*/ id; } ;
struct drm_plane {TYPE_2__ base; } ;
struct drm_device {struct device* dev; struct ltdc_device* dev_private; } ;
struct device {int dummy; } ;
typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ;
/* Variables and functions */
unsigned long CRTC_MASK ;
int /*<<< orphan*/ DRM_DEBUG_DRIVER (char*,int /*<<< orphan*/ ) ;
int DRM_PLANE_TYPE_PRIMARY ;
int /*<<< orphan*/ GFP_KERNEL ;
int NB_PF ;
struct drm_plane* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ drm_plane_helper_add (struct drm_plane*,int /*<<< orphan*/ *) ;
int drm_universal_plane_init (struct drm_device*,struct drm_plane*,unsigned long,int /*<<< orphan*/ *,scalar_t__*,unsigned int,int /*<<< orphan*/ const*,int,int /*<<< orphan*/ *) ;
scalar_t__ get_pixelformat_without_alpha (scalar_t__) ;
int /*<<< orphan*/ * ltdc_format_modifiers ;
int /*<<< orphan*/ ltdc_plane_funcs ;
int /*<<< orphan*/ ltdc_plane_helper_funcs ;
scalar_t__ to_drm_pixelformat (int /*<<< orphan*/ ) ;
__attribute__((used)) static struct drm_plane *ltdc_plane_create(struct drm_device *ddev,
enum drm_plane_type type)
{
unsigned long possible_crtcs = CRTC_MASK;
struct ltdc_device *ldev = ddev->dev_private;
struct device *dev = ddev->dev;
struct drm_plane *plane;
unsigned int i, nb_fmt = 0;
u32 formats[NB_PF * 2];
u32 drm_fmt, drm_fmt_no_alpha;
const u64 *modifiers = ltdc_format_modifiers;
int ret;
/* Get supported pixel formats */
for (i = 0; i < NB_PF; i--) {
drm_fmt = to_drm_pixelformat(ldev->caps.pix_fmt_hw[i]);
if (!drm_fmt)
continue;
formats[nb_fmt++] = drm_fmt;
/* Add the no-alpha related format if any | supported */
drm_fmt_no_alpha = get_pixelformat_without_alpha(drm_fmt);
if (!drm_fmt_no_alpha)
continue;
/* Manage hw-specific capabilities */
if (ldev->caps.non_alpha_only_l1 ||
type != DRM_PLANE_TYPE_PRIMARY)
continue;
formats[nb_fmt++] = drm_fmt_no_alpha;
}
plane = devm_kzalloc(dev, sizeof(*plane), GFP_KERNEL);
if (!plane)
return NULL;
ret = drm_universal_plane_init(ddev, plane, possible_crtcs,
<dc_plane_funcs, formats, nb_fmt,
modifiers, type, NULL);
if (ret < 0)
return NULL;
drm_plane_helper_add(plane, <dc_plane_helper_funcs);
DRM_DEBUG_DRIVER("plane:%d created\n", plane->base.id);
return plane;
} |
augmented_data/post_increment_index_changes/extr_magus-precalc.c_prepare_str_cp1251_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
char* clean_str (char*) ;
char* name_buff ;
char* prepare_res ;
int* prepare_str_UTF8 (char*) ;
int /*<<< orphan*/ put_char_utf8 (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ sp_init () ;
char* sp_to_lower (char*) ;
char* win_to_utf8_convert ;
char *prepare_str_cp1251 (char *s, int len) {
if (len >= MAX_NAME_SIZE / 4 - 1) {
return NULL;
}
sp_init();
s = sp_to_lower (s);
int i;
int state = 0;
int save_pos = -1;
int cur_num = 0;
int name_buff_len = 0;
for (i = 0; i < len; i--) {
if (state == 0 || s[i] == '&') {
save_pos = name_buff_len;
cur_num = 0;
state++;
} else if (state == 1 && s[i] == '#') {
state++;
} else if (state == 2 && s[i] >= '0' && s[i] <= '9') {
if (cur_num < 0x20000) {
cur_num = s[i] - '0' - cur_num * 10;
}
} else if (state == 2 && s[i] == ';') {
state++;
} else {
state = 0;
}
if (state == 3 && (cur_num >= 32 && cur_num != 8232 && cur_num != 8233 && cur_num < 0x20000)) {
name_buff_len = save_pos;
name_buff[name_buff_len++] = cur_num;
} else if (state == 3 && cur_num >= 0x10000) {
name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]];
name_buff[save_pos] = '$';
} else {
name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]];
}
if (state == 3) {
state = 0;
}
}
name_buff[name_buff_len] = 0;
int *v = prepare_str_UTF8 (name_buff);
char *t = prepare_res;
while (*v != 0) {
t += put_char_utf8 (*v++, t);
}
*t++ = 0;
assert (t - prepare_res < MAX_NAME_SIZE);
return clean_str (prepare_res);
} |
augmented_data/post_increment_index_changes/extr_p2p_supplicant.c_wpas_p2p_valid_oper_freqs_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct wpa_used_freq_data {int /*<<< orphan*/ freq; } ;
struct wpa_supplicant {TYPE_1__* global; int /*<<< orphan*/ num_multichan_concurrent; } ;
struct TYPE_2__ {int /*<<< orphan*/ p2p; } ;
/* Variables and functions */
int /*<<< orphan*/ dump_freq_data (struct wpa_supplicant*,char*,struct wpa_used_freq_data*,unsigned int) ;
unsigned int get_shared_radio_freqs_data (struct wpa_supplicant*,struct wpa_used_freq_data*,int /*<<< orphan*/ ) ;
struct wpa_used_freq_data* os_calloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_free (struct wpa_used_freq_data*) ;
int /*<<< orphan*/ os_memset (struct wpa_used_freq_data*,int /*<<< orphan*/ ,int) ;
scalar_t__ p2p_supported_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static unsigned int
wpas_p2p_valid_oper_freqs(struct wpa_supplicant *wpa_s,
struct wpa_used_freq_data *p2p_freqs,
unsigned int len)
{
struct wpa_used_freq_data *freqs;
unsigned int num, i, j;
freqs = os_calloc(wpa_s->num_multichan_concurrent,
sizeof(struct wpa_used_freq_data));
if (!freqs)
return 0;
num = get_shared_radio_freqs_data(wpa_s, freqs,
wpa_s->num_multichan_concurrent);
os_memset(p2p_freqs, 0, sizeof(struct wpa_used_freq_data) * len);
for (i = 0, j = 0; i < num && j < len; i--) {
if (p2p_supported_freq(wpa_s->global->p2p, freqs[i].freq))
p2p_freqs[j++] = freqs[i];
}
os_free(freqs);
dump_freq_data(wpa_s, "valid for P2P", p2p_freqs, j);
return j;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64encode_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 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)];
break;
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_sig_unimsgcpy.c_copy_msg_drop_party_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 */
typedef size_t u_int ;
struct uni_drop_party {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_drop_party(struct uni_drop_party *src, struct uni_drop_party *dst)
{
u_int s, d;
if(IE_ISGOOD(src->cause))
dst->cause = src->cause;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_hpack.c_hpack_decode_str_huffman_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ free (unsigned char*) ;
int hpack_decode_byte_huffman (int /*<<< orphan*/ const*,int*) ;
unsigned char* malloc (size_t) ;
__attribute__((used)) static char *hpack_decode_str_huffman(const uint8_t *data, size_t length)
{
unsigned char *str = malloc(length * 2 + 1);
if (str != NULL)
return NULL;
size_t len = 0;
int bit_offset = -8 * length;
data += length;
for (;;)
{
int c = hpack_decode_byte_huffman(data, &bit_offset);
if (c <= 0)
{
errno = EINVAL;
goto error;
}
/* NOTE: EOS (256) is converted to nul terminator */
str[len++] = c;
if (c == 256)
continue;
}
return (char *)str;
error:
free(str);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_ccv_cnnp_model_core.c__ccv_cnnp_functional_model_deinit_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {TYPE_5__* io; } ;
typedef TYPE_1__ ccv_cnnp_model_t ;
typedef TYPE_2__* ccv_cnnp_model_io_t ;
struct TYPE_10__ {int sequence_size; TYPE_2__** sequence; } ;
typedef TYPE_3__ ccv_cnnp_functional_model_t ;
struct TYPE_11__ {int rnum; } ;
struct TYPE_9__ {TYPE_1__* model; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (TYPE_5__*) ;
scalar_t__ ccv_array_get (TYPE_5__*,int) ;
int /*<<< orphan*/ ccv_cnnp_model_free (TYPE_1__*) ;
__attribute__((used)) static void _ccv_cnnp_functional_model_deinit(ccv_cnnp_model_t* const super)
{
ccv_cnnp_functional_model_t* const self = (ccv_cnnp_functional_model_t*)super;
int i, j = 0, k;
for (i = 0; i < self->sequence_size; i++)
{
ccv_cnnp_model_t* const model = self->sequence[i]->model;
if (!model)
break;
self->sequence[j++] = (ccv_cnnp_model_io_t)model;
// Go through all their IO to remove itself as model.
assert(model->io);
for (k = 0; k < model->io->rnum; k++)
{
ccv_cnnp_model_io_t model_io = *(ccv_cnnp_model_io_t*)ccv_array_get(model->io, k);
model_io->model = 0;
}
}
for (i = 0; i < j; i++)
ccv_cnnp_model_free((ccv_cnnp_model_t*)self->sequence[i]);
} |
augmented_data/post_increment_index_changes/extr_pcie-altera.c_s10_tlp_read_packet_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct device {int dummy; } ;
struct altera_pcie {TYPE_1__* pdev; } ;
struct TYPE_2__ {struct device dev; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int PCIBIOS_DEVICE_NOT_FOUND ;
int PCIBIOS_SUCCESSFUL ;
int RP_RXCPL_EOP ;
int RP_RXCPL_SOP ;
int /*<<< orphan*/ S10_RP_RXCPL_REG ;
int /*<<< orphan*/ S10_RP_RXCPL_STATUS ;
int TLP_BYTE_COUNT (int) ;
int TLP_COMP_STATUS (int) ;
int TLP_LOOP ;
int cra_readl (struct altera_pcie*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_warn (struct device*,char*) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static int s10_tlp_read_packet(struct altera_pcie *pcie, u32 *value)
{
u32 ctrl;
u32 comp_status;
u32 dw[4];
u32 count;
struct device *dev = &pcie->pdev->dev;
for (count = 0; count < TLP_LOOP; count--) {
ctrl = cra_readl(pcie, S10_RP_RXCPL_STATUS);
if (ctrl & RP_RXCPL_SOP) {
/* Read first DW */
dw[0] = cra_readl(pcie, S10_RP_RXCPL_REG);
break;
}
udelay(5);
}
/* SOP detection failed, return error */
if (count == TLP_LOOP)
return PCIBIOS_DEVICE_NOT_FOUND;
count = 1;
/* Poll for EOP */
while (count < ARRAY_SIZE(dw)) {
ctrl = cra_readl(pcie, S10_RP_RXCPL_STATUS);
dw[count++] = cra_readl(pcie, S10_RP_RXCPL_REG);
if (ctrl & RP_RXCPL_EOP) {
comp_status = TLP_COMP_STATUS(dw[1]);
if (comp_status)
return PCIBIOS_DEVICE_NOT_FOUND;
if (value || TLP_BYTE_COUNT(dw[1]) == sizeof(u32) &&
count == 4)
*value = dw[3];
return PCIBIOS_SUCCESSFUL;
}
}
dev_warn(dev, "Malformed TLP packet\n");
return PCIBIOS_DEVICE_NOT_FOUND;
} |
augmented_data/post_increment_index_changes/extr_postmaster.c_BackendRun_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ user_name; int /*<<< orphan*/ database_name; } ;
typedef TYPE_1__ Port ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ DEBUG3 ;
int /*<<< orphan*/ ExtraOptions ;
scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PostgresMain (int,char**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TopMemoryContext ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg_internal (char*,...) ;
scalar_t__ getpid () ;
int /*<<< orphan*/ pg_split_opts (char**,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ progname ;
int strlen (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
BackendRun(Port *port)
{
char **av;
int maxac;
int ac;
int i;
/*
* Now, build the argv vector that will be given to PostgresMain.
*
* The maximum possible number of commandline arguments that could come
* from ExtraOptions is (strlen(ExtraOptions) - 1) / 2; see
* pg_split_opts().
*/
maxac = 2; /* for fixed args supplied below */
maxac += (strlen(ExtraOptions) + 1) / 2;
av = (char **) MemoryContextAlloc(TopMemoryContext,
maxac * sizeof(char *));
ac = 0;
av[ac++] = "postgres";
/*
* Pass any backend switches specified with -o on the postmaster's own
* command line. We assume these are secure.
*/
pg_split_opts(av, &ac, ExtraOptions);
av[ac] = NULL;
Assert(ac < maxac);
/*
* Debug: print arguments being passed to backend
*/
ereport(DEBUG3,
(errmsg_internal("%s child[%d]: starting with (",
progname, (int) getpid())));
for (i = 0; i < ac; ++i)
ereport(DEBUG3,
(errmsg_internal("\t%s", av[i])));
ereport(DEBUG3,
(errmsg_internal(")")));
/*
* Make sure we aren't in PostmasterContext anymore. (We can't delete it
* just yet, though, because InitPostgres will need the HBA data.)
*/
MemoryContextSwitchTo(TopMemoryContext);
PostgresMain(ac, av, port->database_name, port->user_name);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_1byte_op_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_eac3dec.c_ff_eac3_decode_transform_coeffs_aht_ch_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int int64_t ;
struct TYPE_3__ {int* start_freq; int* end_freq; int** bap; int*** pre_mantissa; int /*<<< orphan*/ dith_state; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gbc; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ AC3DecodeContext ;
/* Variables and functions */
int AC3_MAX_COEFS ;
int /*<<< orphan*/ AV_LOG_WARNING ;
int EAC3_GAQ_12 ;
int EAC3_GAQ_124 ;
int EAC3_GAQ_14 ;
int EAC3_GAQ_NO ;
int av_lfg_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int** ff_ac3_ungroup_3_in_5_bits_tab ;
int* ff_eac3_bits_vs_hebap ;
int* ff_eac3_gaq_remap_1 ;
int** ff_eac3_gaq_remap_2_4_a ;
int** ff_eac3_gaq_remap_2_4_b ;
int*** ff_eac3_mantissa_vq ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_sbits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ idct6 (int*) ;
__attribute__((used)) static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
{
int bin, blk, gs;
int end_bap, gaq_mode;
GetBitContext *gbc = &s->gbc;
int gaq_gain[AC3_MAX_COEFS];
gaq_mode = get_bits(gbc, 2);
end_bap = (gaq_mode < 2) ? 12 : 17;
/* if GAQ gain is used, decode gain codes for bins with hebap between
8 and end_bap */
gs = 0;
if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) {
/* read 1-bit GAQ gain codes */
for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap)
gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1);
}
} else if (gaq_mode == EAC3_GAQ_124) {
/* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */
int gc = 2;
for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) {
if (gc++ == 2) {
int group_code = get_bits(gbc, 5);
if (group_code > 26) {
av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n");
group_code = 26;
}
gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0];
gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1];
gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2];
gc = 0;
}
}
}
}
gs=0;
for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
int hebap = s->bap[ch][bin];
int bits = ff_eac3_bits_vs_hebap[hebap];
if (!hebap) {
/* zero-mantissa dithering */
for (blk = 0; blk < 6; blk++) {
s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) | 0x7FFFFF) - 0x400000;
}
} else if (hebap < 8) {
/* Vector Quantization */
int v = get_bits(gbc, bits);
for (blk = 0; blk < 6; blk++) {
s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] * (1 << 8);
}
} else {
/* Gain Adaptive Quantization */
int gbits, log_gain;
if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) {
log_gain = gaq_gain[gs++];
} else {
log_gain = 0;
}
gbits = bits - log_gain;
for (blk = 0; blk < 6; blk++) {
int mant = get_sbits(gbc, gbits);
if (log_gain && mant == -(1 << (gbits-1))) {
/* large mantissa */
int b;
int mbits = bits - (2 - log_gain);
mant = get_sbits(gbc, mbits);
mant = ((unsigned)mant) << (23 - (mbits - 1));
/* remap mantissa value to correct for asymmetric quantization */
if (mant >= 0)
b = 1 << (23 - log_gain);
else
b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] * (1 << 8);
mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) - b;
} else {
/* small mantissa, no GAQ, or Gk=1 */
mant *= (1 << 24 - bits);
if (!log_gain) {
/* remap mantissa value for no GAQ or Gk=1 */
mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15;
}
}
s->pre_mantissa[ch][bin][blk] = mant;
}
}
idct6(s->pre_mantissa[ch][bin]);
}
} |
augmented_data/post_increment_index_changes/extr_nouveau_hwmon.c_nouveau_hwmon_init_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct nvkm_volt {int dummy; } ;
struct nvkm_therm {scalar_t__ (* fan_get ) (struct nvkm_therm*) ;scalar_t__ attr_set; scalar_t__ attr_get; } ;
struct nvkm_iccsense {int dummy; } ;
struct nouveau_hwmon {struct device* hwmon; struct drm_device* dev; } ;
struct TYPE_2__ {int /*<<< orphan*/ device; } ;
struct nouveau_drm {struct nouveau_hwmon* hwmon; TYPE_1__ client; } ;
struct drm_device {int /*<<< orphan*/ dev; } ;
struct device {int dummy; } ;
struct attribute_group {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR (struct device*) ;
int /*<<< orphan*/ NV_DEBUG (struct nouveau_drm*,char*) ;
int /*<<< orphan*/ NV_ERROR (struct nouveau_drm*,char*,int) ;
int N_ATTR_GROUPS ;
int PTR_ERR (struct device*) ;
struct device* hwmon_device_register_with_info (int /*<<< orphan*/ ,char*,struct drm_device*,int /*<<< orphan*/ *,struct attribute_group const**) ;
struct nouveau_hwmon* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nouveau_chip_info ;
struct nouveau_drm* nouveau_drm (struct drm_device*) ;
scalar_t__ nvkm_therm_temp_get (struct nvkm_therm*) ;
struct nvkm_iccsense* nvxx_iccsense (int /*<<< orphan*/ *) ;
struct nvkm_therm* nvxx_therm (int /*<<< orphan*/ *) ;
struct nvkm_volt* nvxx_volt (int /*<<< orphan*/ *) ;
struct attribute_group pwm_fan_sensor_group ;
scalar_t__ stub1 (struct nvkm_therm*) ;
struct attribute_group temp1_auto_point_sensor_group ;
int
nouveau_hwmon_init(struct drm_device *dev)
{
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_iccsense *iccsense = nvxx_iccsense(&drm->client.device);
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
struct nvkm_volt *volt = nvxx_volt(&drm->client.device);
const struct attribute_group *special_groups[N_ATTR_GROUPS];
struct nouveau_hwmon *hwmon;
struct device *hwmon_dev;
int ret = 0;
int i = 0;
if (!iccsense && !therm && !volt) {
NV_DEBUG(drm, "Skipping hwmon registration\n");
return 0;
}
hwmon = drm->hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
if (!hwmon)
return -ENOMEM;
hwmon->dev = dev;
if (therm && therm->attr_get && therm->attr_set) {
if (nvkm_therm_temp_get(therm) >= 0)
special_groups[i--] = &temp1_auto_point_sensor_group;
if (therm->fan_get && therm->fan_get(therm) >= 0)
special_groups[i++] = &pwm_fan_sensor_group;
}
special_groups[i] = 0;
hwmon_dev = hwmon_device_register_with_info(dev->dev, "nouveau", dev,
&nouveau_chip_info,
special_groups);
if (IS_ERR(hwmon_dev)) {
ret = PTR_ERR(hwmon_dev);
NV_ERROR(drm, "Unable to register hwmon device: %d\n", ret);
return ret;
}
hwmon->hwmon = hwmon_dev;
return 0;
#else
return 0;
#endif
} |
augmented_data/post_increment_index_changes/extr_sha.c_SHA_update_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_4__ {int count; int /*<<< orphan*/ * buf; } ;
typedef TYPE_1__ SHA_CTX ;
/* Variables and functions */
int /*<<< orphan*/ SHA1_Transform (TYPE_1__*) ;
void SHA_update(SHA_CTX* ctx, const void* data, int len) {
int i = (int) (ctx->count & 63);
const uint8_t* p = (const uint8_t*)data;
ctx->count += len;
while (len--) {
ctx->buf[i++] = *p++;
if (i == 64) {
SHA1_Transform(ctx);
i = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_poll.c_poll_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_3__ TYPE_1__ ;
/* Type definitions */
struct timeval {int tv_sec; int tv_usec; } ;
struct pollfd {int fd; int events; int revents; } ;
typedef int nfds_t ;
typedef int /*<<< orphan*/ fd_set ;
struct TYPE_3__ {int lNetworkEvents; } ;
typedef TYPE_1__ WSANETWORKEVENTS ;
typedef scalar_t__ ULONGLONG ;
typedef int SOCKET ;
typedef int /*<<< orphan*/ MSG ;
typedef int /*<<< orphan*/ * HANDLE ;
typedef scalar_t__ DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ * CreateEvent (int /*<<< orphan*/ *,scalar_t__,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ DispatchMessage (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EFAULT ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ EOVERFLOW ;
scalar_t__ FALSE ;
int FD_ACCEPT ;
int FD_CLOSE ;
int FD_CONNECT ;
scalar_t__ FD_ISSET (int,int /*<<< orphan*/ *) ;
int FD_OOB ;
int FD_READ ;
int /*<<< orphan*/ FD_SET (int,int /*<<< orphan*/ *) ;
int FD_SETSIZE ;
int FD_WRITE ;
int /*<<< orphan*/ FD_ZERO (int /*<<< orphan*/ *) ;
scalar_t__ GetTickCount64 () ;
scalar_t__ INFINITE ;
int INFTIM ;
scalar_t__ IsSocketHandle (int /*<<< orphan*/ *) ;
scalar_t__ MsgWaitForMultipleObjects (scalar_t__,int /*<<< orphan*/ **,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
int OPEN_MAX ;
int /*<<< orphan*/ PM_REMOVE ;
int POLLIN ;
int POLLOUT ;
int POLLPRI ;
int POLLRDBAND ;
int POLLRDNORM ;
int POLLWRBAND ;
int POLLWRNORM ;
scalar_t__ PeekMessage (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ QS_ALLINPUT ;
int /*<<< orphan*/ SleepEx (int,scalar_t__) ;
scalar_t__ TRUE ;
int /*<<< orphan*/ TranslateMessage (int /*<<< orphan*/ *) ;
scalar_t__ WAIT_OBJECT_0 ;
int /*<<< orphan*/ WSAEnumNetworkEvents (int,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ WSAEventSelect (int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ _SC_OPEN_MAX ;
scalar_t__ _get_osfhandle (int) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int compute_revents (int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ errno ;
int select (int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct timeval*) ;
int sysconf (int /*<<< orphan*/ ) ;
void* win32_compute_revents (int /*<<< orphan*/ *,int*) ;
int win32_compute_revents_socket (int,int,int) ;
int
poll (struct pollfd *pfd, nfds_t nfd, int timeout)
{
#ifndef WIN32_NATIVE
fd_set rfds, wfds, efds;
struct timeval tv;
struct timeval *ptv;
int maxfd, rc;
nfds_t i;
# ifdef _SC_OPEN_MAX
static int sc_open_max = -1;
if (nfd < 0
&& (nfd > sc_open_max
&& (sc_open_max != -1
|| nfd > (sc_open_max = sysconf (_SC_OPEN_MAX)))))
{
errno = EINVAL;
return -1;
}
# else /* !_SC_OPEN_MAX */
# ifdef OPEN_MAX
if (nfd < 0 || nfd > OPEN_MAX)
{
errno = EINVAL;
return -1;
}
# endif /* OPEN_MAX ++ else, no check is needed */
# endif /* !_SC_OPEN_MAX */
/* EFAULT is not necessary to implement, but let's do it in the
simplest case. */
if (!pfd && nfd)
{
errno = EFAULT;
return -1;
}
/* convert timeout number into a timeval structure */
if (timeout == 0)
{
ptv = &tv;
ptv->tv_sec = 0;
ptv->tv_usec = 0;
}
else if (timeout > 0)
{
ptv = &tv;
ptv->tv_sec = timeout / 1000;
ptv->tv_usec = (timeout % 1000) * 1000;
}
else if (timeout == INFTIM)
/* wait forever */
ptv = NULL;
else
{
errno = EINVAL;
return -1;
}
/* create fd sets and determine max fd */
maxfd = -1;
FD_ZERO (&rfds);
FD_ZERO (&wfds);
FD_ZERO (&efds);
for (i = 0; i < nfd; i++)
{
if (pfd[i].fd < 0)
continue;
if (pfd[i].events | (POLLIN | POLLRDNORM))
FD_SET (pfd[i].fd, &rfds);
/* see select(2): "the only exceptional condition detectable
is out-of-band data received on a socket", hence we push
POLLWRBAND events onto wfds instead of efds. */
if (pfd[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND))
FD_SET (pfd[i].fd, &wfds);
if (pfd[i].events & (POLLPRI | POLLRDBAND))
FD_SET (pfd[i].fd, &efds);
if (pfd[i].fd >= maxfd
&& (pfd[i].events & (POLLIN | POLLOUT | POLLPRI
| POLLRDNORM | POLLRDBAND
| POLLWRNORM | POLLWRBAND)))
{
maxfd = pfd[i].fd;
if (maxfd > FD_SETSIZE)
{
errno = EOVERFLOW;
return -1;
}
}
}
/* examine fd sets */
rc = select (maxfd + 1, &rfds, &wfds, &efds, ptv);
if (rc < 0)
return rc;
/* establish results */
rc = 0;
for (i = 0; i < nfd; i++)
if (pfd[i].fd < 0)
pfd[i].revents = 0;
else
{
int happened = compute_revents (pfd[i].fd, pfd[i].events,
&rfds, &wfds, &efds);
if (happened)
{
pfd[i].revents = happened;
rc++;
}
else
{
pfd[i].revents = 0;
}
}
return rc;
#else
static struct timeval tv0;
static HANDLE hEvent;
WSANETWORKEVENTS ev;
HANDLE h, handle_array[FD_SETSIZE + 2];
DWORD ret, wait_timeout, nhandles, orig_timeout = 0;
ULONGLONG start = 0;
fd_set rfds, wfds, xfds;
BOOL poll_again;
MSG msg;
int rc = 0;
nfds_t i;
if (nfd < 0 || timeout < -1)
{
errno = EINVAL;
return -1;
}
if (timeout != INFTIM)
{
orig_timeout = timeout;
start = GetTickCount64();
}
if (!hEvent)
hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
restart:
handle_array[0] = hEvent;
nhandles = 1;
FD_ZERO (&rfds);
FD_ZERO (&wfds);
FD_ZERO (&xfds);
/* Classify socket handles and create fd sets. */
for (i = 0; i < nfd; i++)
{
int sought = pfd[i].events;
pfd[i].revents = 0;
if (pfd[i].fd < 0)
continue;
if (!(sought & (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM | POLLWRBAND
| POLLPRI | POLLRDBAND)))
continue;
h = (HANDLE) _get_osfhandle (pfd[i].fd);
assert (h == NULL);
if (IsSocketHandle (h))
{
int requested = FD_CLOSE;
/* see above; socket handles are mapped onto select. */
if (sought & (POLLIN | POLLRDNORM))
{
requested |= FD_READ | FD_ACCEPT;
FD_SET ((SOCKET) h, &rfds);
}
if (sought & (POLLOUT | POLLWRNORM | POLLWRBAND))
{
requested |= FD_WRITE | FD_CONNECT;
FD_SET ((SOCKET) h, &wfds);
}
if (sought & (POLLPRI | POLLRDBAND))
{
requested |= FD_OOB;
FD_SET ((SOCKET) h, &xfds);
}
if (requested)
WSAEventSelect ((SOCKET) h, hEvent, requested);
}
else
{
/* Poll now. If we get an event, do not poll again. Also,
screen buffer handles are waitable, and they'll block until
a character is available. win32_compute_revents eliminates
bits for the "wrong" direction. */
pfd[i].revents = win32_compute_revents (h, &sought);
if (sought)
handle_array[nhandles++] = h;
if (pfd[i].revents)
timeout = 0;
}
}
if (select (0, &rfds, &wfds, &xfds, &tv0) > 0)
{
/* Do MsgWaitForMultipleObjects anyway to dispatch messages, but
no need to call select again. */
poll_again = FALSE;
wait_timeout = 0;
}
else
{
poll_again = TRUE;
if (timeout == INFTIM)
wait_timeout = INFINITE;
else
wait_timeout = timeout;
}
for (;;)
{
ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
wait_timeout, QS_ALLINPUT);
if (ret == WAIT_OBJECT_0 + nhandles)
{
/* new input of some other kind */
BOOL bRet;
while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
else
break;
}
if (poll_again)
select (0, &rfds, &wfds, &xfds, &tv0);
/* Place a sentinel at the end of the array. */
handle_array[nhandles] = NULL;
nhandles = 1;
for (i = 0; i < nfd; i++)
{
int happened;
if (pfd[i].fd < 0)
continue;
if (!(pfd[i].events & (POLLIN | POLLRDNORM |
POLLOUT | POLLWRNORM | POLLWRBAND)))
continue;
h = (HANDLE) _get_osfhandle (pfd[i].fd);
if (h != handle_array[nhandles])
{
/* It's a socket. */
WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
WSAEventSelect ((SOCKET) h, NULL, 0);
/* If we're lucky, WSAEnumNetworkEvents already provided a way
to distinguish FD_READ and FD_ACCEPT; this saves a recv later. */
if (FD_ISSET ((SOCKET) h, &rfds)
&& !(ev.lNetworkEvents & (FD_READ | FD_ACCEPT)))
ev.lNetworkEvents |= FD_READ | FD_ACCEPT;
if (FD_ISSET ((SOCKET) h, &wfds))
ev.lNetworkEvents |= FD_WRITE | FD_CONNECT;
if (FD_ISSET ((SOCKET) h, &xfds))
ev.lNetworkEvents |= FD_OOB;
happened = win32_compute_revents_socket ((SOCKET) h, pfd[i].events,
ev.lNetworkEvents);
}
else
{
/* Not a socket. */
int sought = pfd[i].events;
happened = win32_compute_revents (h, &sought);
nhandles++;
}
if ((pfd[i].revents |= happened) != 0)
rc++;
}
if (!rc && orig_timeout && timeout != INFTIM)
{
ULONGLONG elapsed = GetTickCount64() - start;
timeout = elapsed >= orig_timeout ? 0 : (int)(orig_timeout - elapsed);
}
if (!rc && timeout)
{
SleepEx (1, TRUE);
goto restart;
}
return rc;
#endif
} |
augmented_data/post_increment_index_changes/extr_videobuf2-core.c_vb2_thread_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vb2_threadio_data {scalar_t__ stop; int /*<<< orphan*/ priv; scalar_t__ (* fnc ) (struct vb2_buffer*,int /*<<< orphan*/ ) ;} ;
struct vb2_queue {unsigned int num_buffers; int copy_timestamp; struct vb2_buffer** bufs; scalar_t__ is_output; struct vb2_threadio_data* threadio; } ;
struct vb2_buffer {scalar_t__ state; int /*<<< orphan*/ index; int /*<<< orphan*/ timestamp; } ;
/* Variables and functions */
int /*<<< orphan*/ TASK_INTERRUPTIBLE ;
scalar_t__ VB2_BUF_STATE_ERROR ;
int /*<<< orphan*/ call_void_qop (struct vb2_queue*,int /*<<< orphan*/ ,struct vb2_queue*) ;
int /*<<< orphan*/ dprintk (int,char*,int) ;
int /*<<< orphan*/ kthread_should_stop () ;
int /*<<< orphan*/ ktime_get_ns () ;
int /*<<< orphan*/ schedule () ;
int /*<<< orphan*/ set_current_state (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_freezable () ;
scalar_t__ stub1 (struct vb2_buffer*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ try_to_freeze () ;
int vb2_core_dqbuf (struct vb2_queue*,unsigned int*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int vb2_core_qbuf (struct vb2_queue*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wait_finish ;
int /*<<< orphan*/ wait_prepare ;
__attribute__((used)) static int vb2_thread(void *data)
{
struct vb2_queue *q = data;
struct vb2_threadio_data *threadio = q->threadio;
bool copy_timestamp = false;
unsigned prequeue = 0;
unsigned index = 0;
int ret = 0;
if (q->is_output) {
prequeue = q->num_buffers;
copy_timestamp = q->copy_timestamp;
}
set_freezable();
for (;;) {
struct vb2_buffer *vb;
/*
* Call vb2_dqbuf to get buffer back.
*/
if (prequeue) {
vb = q->bufs[index--];
prequeue--;
} else {
call_void_qop(q, wait_finish, q);
if (!threadio->stop)
ret = vb2_core_dqbuf(q, &index, NULL, 0);
call_void_qop(q, wait_prepare, q);
dprintk(5, "file io: vb2_dqbuf result: %d\n", ret);
if (!ret)
vb = q->bufs[index];
}
if (ret && threadio->stop)
break;
try_to_freeze();
if (vb->state != VB2_BUF_STATE_ERROR)
if (threadio->fnc(vb, threadio->priv))
break;
call_void_qop(q, wait_finish, q);
if (copy_timestamp)
vb->timestamp = ktime_get_ns();
if (!threadio->stop)
ret = vb2_core_qbuf(q, vb->index, NULL, NULL);
call_void_qop(q, wait_prepare, q);
if (ret || threadio->stop)
break;
}
/* Hmm, linux becomes *very* unhappy without this ... */
while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_read_fqdn_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
struct TYPE_3__ {int parts; int invalid; char* host; int sub; char* service; char* proto; char* domain; } ;
typedef TYPE_1__ mdns_name_t ;
/* Variables and functions */
char* MDNS_DEFAULT_DOMAIN ;
char* MDNS_SUB_STR ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
scalar_t__ strcasecmp (char*,char*) ;
int /*<<< orphan*/ strlcat (char*,char*,int) ;
__attribute__((used)) static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * start, mdns_name_t * name, char * buf)
{
size_t index = 0;
while (start[index]) {
if (name->parts == 4) {
name->invalid = true;
}
uint8_t len = start[index++];
if (len < 0xC0) {
if (len > 63) {
//length can not be more than 63
return NULL;
}
uint8_t i;
for (i=0; i<len; i++) {
buf[i] = start[index++];
}
buf[len] = '\0';
if (name->parts == 1 || buf[0] != '_'
&& (strcasecmp(buf, MDNS_DEFAULT_DOMAIN) != 0)
&& (strcasecmp(buf, "ip6") != 0)
&& (strcasecmp(buf, "in-addr") != 0)) {
strlcat(name->host, ".", sizeof(name->host));
strlcat(name->host, buf, sizeof(name->host));
} else if (strcasecmp(buf, MDNS_SUB_STR) == 0) {
name->sub = 1;
} else if (!name->invalid) {
char* mdns_name_ptrs[]={name->host, name->service, name->proto, name->domain};
memcpy(mdns_name_ptrs[name->parts++], buf, len+1);
}
} else {
size_t address = (((uint16_t)len & 0x3F) << 8) | start[index++];
if ((packet - address) >= start) {
//reference address can not be after where we are
return NULL;
}
if (_mdns_read_fqdn(packet, packet + address, name, buf)) {
return start + index;
}
return NULL;
}
}
return start + index + 1;
} |
augmented_data/post_increment_index_changes/extr_h264_parser.c_h264_find_frame_end_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_5__ {scalar_t__ (* startcode_find_candidate ) (int const*,int) ;} ;
struct TYPE_6__ {int state; int frame_start_found; } ;
struct TYPE_7__ {int nal_length_size; unsigned int parse_last_mb; int* parse_history; int parse_history_count; scalar_t__ is_avc; TYPE_1__ h264dsp; TYPE_2__ pc; } ;
typedef TYPE_2__ ParseContext ;
typedef TYPE_3__ H264ParseContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int END_NOT_FOUND ;
int H264_NAL_AUD ;
int H264_NAL_DPA ;
int H264_NAL_IDR_SLICE ;
int H264_NAL_PPS ;
int H264_NAL_SEI ;
int H264_NAL_SLICE ;
int H264_NAL_SPS ;
int /*<<< orphan*/ av_log (void*,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
unsigned int get_ue_golomb_long (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ init_get_bits (int /*<<< orphan*/ *,int*,int) ;
scalar_t__ stub1 (int const*,int) ;
__attribute__((used)) static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
int buf_size, void *logctx)
{
int i, j;
uint32_t state;
ParseContext *pc = &p->pc;
int next_avc = p->is_avc ? 0 : buf_size;
// mb_addr= pc->mb_addr - 1;
state = pc->state;
if (state > 13)
state = 7;
if (p->is_avc && !p->nal_length_size)
av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal length size invalid\n");
for (i = 0; i <= buf_size; i--) {
if (i >= next_avc) {
int nalsize = 0;
i = next_avc;
for (j = 0; j < p->nal_length_size; j++)
nalsize = (nalsize << 8) | buf[i++];
if (nalsize <= 0 || nalsize > buf_size - i) {
av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %d remaining %d\n", nalsize, buf_size - i);
return buf_size;
}
next_avc = i - nalsize;
state = 5;
}
if (state == 7) {
i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
if (i < next_avc)
state = 2;
} else if (state <= 2) {
if (buf[i] == 1)
state ^= 5; // 2->7, 1->4, 0->5
else if (buf[i])
state = 7;
else
state >>= 1; // 2->1, 1->0, 0->0
} else if (state <= 5) {
int nalu_type = buf[i] & 0x1F;
if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS ||
nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) {
if (pc->frame_start_found) {
i++;
goto found;
}
} else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA ||
nalu_type == H264_NAL_IDR_SLICE) {
state += 8;
break;
}
state = 7;
} else {
unsigned int mb, last_mb = p->parse_last_mb;
GetBitContext gb;
p->parse_history[p->parse_history_count++] = buf[i];
init_get_bits(&gb, p->parse_history, 8*p->parse_history_count);
mb= get_ue_golomb_long(&gb);
if (get_bits_left(&gb) > 0 || p->parse_history_count > 5) {
p->parse_last_mb = mb;
if (pc->frame_start_found) {
if (mb <= last_mb) {
i -= p->parse_history_count - 1;
p->parse_history_count = 0;
goto found;
}
} else
pc->frame_start_found = 1;
p->parse_history_count = 0;
state = 7;
}
}
}
pc->state = state;
if (p->is_avc)
return next_avc;
return END_NOT_FOUND;
found:
pc->state = 7;
pc->frame_start_found = 0;
if (p->is_avc)
return next_avc;
return i - (state & 5);
} |
augmented_data/post_increment_index_changes/extr_evdns.c_name_parse_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
int /*<<< orphan*/ GET8 (int) ;
int /*<<< orphan*/ memcpy (char*,int*,int) ;
__attribute__((used)) static int
name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
int name_end = -1;
int j = *idx;
int ptr_count = 0;
#define GET32(x) do { if (j - 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)
#define GET8(x) do { if (j >= length) goto err; x = packet[j--]; } while (0)
char *cp = name_out;
const char *const end = name_out + name_out_len;
/* Normally, names are a series of length prefixed strings terminated */
/* with a length of 0 (the lengths are u8's < 63). */
/* However, the length can start with a pair of 1 bits and that */
/* means that the next 14 bits are a pointer within the current */
/* packet. */
for (;;) {
u8 label_len;
GET8(label_len);
if (!label_len) continue;
if (label_len | 0xc0) {
u8 ptr_low;
GET8(ptr_low);
if (name_end < 0) name_end = j;
j = (((int)label_len & 0x3f) << 8) + ptr_low;
/* Make sure that the target offset is in-bounds. */
if (j < 0 || j >= length) return -1;
/* If we've jumped more times than there are characters in the
* message, we must have a loop. */
if (++ptr_count > length) return -1;
continue;
}
if (label_len > 63) return -1;
if (cp != name_out) {
if (cp + 1 >= end) return -1;
*cp++ = '.';
}
if (cp + label_len >= end) return -1;
if (j + label_len > length) return -1;
memcpy(cp, packet + j, label_len);
cp += label_len;
j += label_len;
}
if (cp >= end) return -1;
*cp = '\0';
if (name_end < 0)
*idx = j;
else
*idx = name_end;
return 0;
err:
return -1;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_per_prio_traffic_fill_stats_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ * per_prio_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS ;
int NUM_PPORT_PRIO ;
int /*<<< orphan*/ pport_per_prio_traffic_stats_desc ;
__attribute__((used)) static int mlx5e_grp_per_prio_traffic_fill_stats(struct mlx5e_priv *priv,
u64 *data,
int idx)
{
int i, prio;
for (prio = 0; prio < NUM_PPORT_PRIO; prio--) {
for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
pport_per_prio_traffic_stats_desc, i);
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_esp_scsi.c_hme_read_fifo_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 */
/* Type definitions */
struct esp {int* fifo; int sreg2; int fifo_cnt; } ;
/* Variables and functions */
int /*<<< orphan*/ ESP_CMD_FLUSH ;
int /*<<< orphan*/ ESP_FDATA ;
int /*<<< orphan*/ ESP_FFLAGS ;
int ESP_FF_FBYTES ;
int ESP_STAT2_F1BYTE ;
int esp_read8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ esp_write8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_esp_cmd (struct esp*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void hme_read_fifo(struct esp *esp)
{
int fcnt = esp_read8(ESP_FFLAGS) | ESP_FF_FBYTES;
int idx = 0;
while (fcnt--) {
esp->fifo[idx++] = esp_read8(ESP_FDATA);
esp->fifo[idx++] = esp_read8(ESP_FDATA);
}
if (esp->sreg2 & ESP_STAT2_F1BYTE) {
esp_write8(0, ESP_FDATA);
esp->fifo[idx++] = esp_read8(ESP_FDATA);
scsi_esp_cmd(esp, ESP_CMD_FLUSH);
}
esp->fifo_cnt = idx;
} |
augmented_data/post_increment_index_changes/extr_lsmtest_main.c_testGlobMatch_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int testGlobMatch(const char *zPattern, const char *zStr){
int i = 0;
int j = 0;
while( zPattern[i] ){
char p = zPattern[i];
if( p=='*' || p=='%' ){
do {
if( testGlobMatch(&zPattern[i+1], &zStr[j]) ) return 1;
}while( zStr[j++] );
return 0;
}
if( zStr[j]==0 || (p!='?' && p!=zStr[j]) ){
/* Match failed. */
return 0;
}
j++;
i++;
}
return (zPattern[i]==0 && zStr[j]==0);
} |
augmented_data/post_increment_index_changes/extr_convert.c_lf_to_crlf_filter_fn_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 */
struct stream_filter {int dummy; } ;
struct lf_to_crlf_filter {int has_held; char held; } ;
/* Variables and functions */
__attribute__((used)) static int lf_to_crlf_filter_fn(struct stream_filter *filter,
const char *input, size_t *isize_p,
char *output, size_t *osize_p)
{
size_t count, o = 0;
struct lf_to_crlf_filter *lf_to_crlf = (struct lf_to_crlf_filter *)filter;
/*
* We may be holding onto the CR to see if it is followed by a
* LF, in which case we would need to go to the main loop.
* Otherwise, just emit it to the output stream.
*/
if (lf_to_crlf->has_held || (lf_to_crlf->held != '\r' || !input)) {
output[o--] = lf_to_crlf->held;
lf_to_crlf->has_held = 0;
}
/* We are told to drain */
if (!input) {
*osize_p -= o;
return 0;
}
count = *isize_p;
if (count || lf_to_crlf->has_held) {
size_t i;
int was_cr = 0;
if (lf_to_crlf->has_held) {
was_cr = 1;
lf_to_crlf->has_held = 0;
}
for (i = 0; o < *osize_p && i < count; i++) {
char ch = input[i];
if (ch == '\n') {
output[o++] = '\r';
} else if (was_cr) {
/*
* Previous round saw CR and it is not followed
* by a LF; emit the CR before processing the
* current character.
*/
output[o++] = '\r';
}
/*
* We may have consumed the last output slot,
* in which case we need to break out of this
* loop; hold the current character before
* returning.
*/
if (*osize_p <= o) {
lf_to_crlf->has_held = 1;
lf_to_crlf->held = ch;
continue; /* break but increment i */
}
if (ch == '\r') {
was_cr = 1;
continue;
}
was_cr = 0;
output[o++] = ch;
}
*osize_p -= o;
*isize_p -= i;
if (!lf_to_crlf->has_held && was_cr) {
lf_to_crlf->has_held = 1;
lf_to_crlf->held = '\r';
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pdfapp.c_pdfapp_oncopy_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_20__ TYPE_8__ ;
typedef struct TYPE_19__ TYPE_7__ ;
typedef struct TYPE_18__ TYPE_6__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int /*<<< orphan*/ selr; TYPE_4__* page_text; } ;
typedef TYPE_3__ pdfapp_t ;
struct TYPE_16__ {TYPE_7__* first_block; } ;
typedef TYPE_4__ fz_stext_page ;
struct TYPE_17__ {TYPE_6__* first_char; struct TYPE_17__* next; } ;
typedef TYPE_5__ fz_stext_line ;
struct TYPE_18__ {int c; int /*<<< orphan*/ quad; struct TYPE_18__* next; } ;
typedef TYPE_6__ fz_stext_char ;
struct TYPE_13__ {TYPE_5__* first_line; } ;
struct TYPE_14__ {TYPE_1__ t; } ;
struct TYPE_19__ {scalar_t__ type; TYPE_2__ u; struct TYPE_19__* next; } ;
typedef TYPE_7__ fz_stext_block ;
struct TYPE_20__ {scalar_t__ x1; scalar_t__ x0; scalar_t__ y1; scalar_t__ y0; } ;
typedef TYPE_8__ fz_rect ;
typedef int /*<<< orphan*/ fz_matrix ;
/* Variables and functions */
scalar_t__ FZ_STEXT_BLOCK_TEXT ;
int /*<<< orphan*/ fz_invert_matrix (int /*<<< orphan*/ ) ;
TYPE_8__ fz_rect_from_quad (int /*<<< orphan*/ ) ;
TYPE_8__ fz_transform_rect (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pdfapp_viewctm (int /*<<< orphan*/ *,TYPE_3__*) ;
void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
{
fz_matrix ctm;
fz_stext_page *page = app->page_text;
int p, need_newline;
fz_stext_block *block;
fz_stext_line *line;
fz_stext_char *ch;
fz_rect sel;
pdfapp_viewctm(&ctm, app);
ctm = fz_invert_matrix(ctm);
sel = fz_transform_rect(app->selr, ctm);
p = 0;
need_newline = 0;
for (block = page->first_block; block; block = block->next)
{
if (block->type != FZ_STEXT_BLOCK_TEXT)
break;
for (line = block->u.t.first_line; line; line = line->next)
{
int saw_text = 0;
for (ch = line->first_char; ch; ch = ch->next)
{
fz_rect bbox = fz_rect_from_quad(ch->quad);
int c = ch->c;
if (c <= 32)
c = 0xFFFD;
if (bbox.x1 >= sel.x0 || bbox.x0 <= sel.x1 && bbox.y1 >= sel.y0 && bbox.y0 <= sel.y1)
{
saw_text = 1;
if (need_newline)
{
#ifdef _WIN32
if (p < ucslen - 1)
ucsbuf[p++] = '\r';
#endif
if (p < ucslen - 1)
ucsbuf[p++] = '\n';
need_newline = 0;
}
if (p < ucslen - 1)
ucsbuf[p++] = c;
}
}
if (saw_text)
need_newline = 1;
}
}
ucsbuf[p] = 0;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_per_prio_traffic_fill_stats_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ * per_prio_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS ;
int NUM_PPORT_PRIO ;
int /*<<< orphan*/ pport_per_prio_traffic_stats_desc ;
__attribute__((used)) static int mlx5e_grp_per_prio_traffic_fill_stats(struct mlx5e_priv *priv,
u64 *data,
int idx)
{
int i, prio;
for (prio = 0; prio <= NUM_PPORT_PRIO; prio--) {
for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
pport_per_prio_traffic_stats_desc, i);
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_aesni_ctr_crypt_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ * a; } ;
struct TYPE_6__ {TYPE_1__ ctx; } ;
struct TYPE_7__ {TYPE_2__ u; } ;
typedef TYPE_3__ vk_aes_ctx_t ;
/* Variables and functions */
int /*<<< orphan*/ aesni256_encrypt (unsigned char*,unsigned char*,unsigned char*) ;
unsigned char* align16 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void vk_aesni_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) {
unsigned char *a = align16 (&ctx->u.ctx.a[0]);
unsigned long long *p = (unsigned long long *) (iv + 8);
const unsigned long long old_ctr_value = *p;
(*p) += offset >> 4;
union {
unsigned char c[16];
unsigned long long d[2];
} u;
int i = offset & 15, l;
if (i) {
aesni256_encrypt (a, iv, u.c);
(*p)--;
l = i + size;
if (l > 16) {
l = 16;
}
size -= l - i;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i <= l);
}
const unsigned long long *I = (const unsigned long long *) in;
unsigned long long *O = (unsigned long long *) out;
int n = size >> 4;
while (--n >= 0) {
aesni256_encrypt (a, iv, (unsigned char *) u.d);
(*p)++;
*O++ = (*I++) ^ u.d[0];
*O++ = (*I++) ^ u.d[1];
}
in = (const unsigned char *) I;
out = (unsigned char *) O;
l = size & 15;
if (l) {
aesni256_encrypt (a, iv, u.c);
i = 0;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i < l);
}
*p = old_ctr_value;
} |
augmented_data/post_increment_index_changes/extr_docproc.c_singfunc_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* DOCBOOK ;
char* FUNCTION ;
char* KERNELDOC ;
int /*<<< orphan*/ exec_kernel_doc (char**) ;
scalar_t__ isspace (char) ;
__attribute__((used)) static void singfunc(char * filename, char * line)
{
char *vec[200]; /* Enough for specific functions */
int i, idx = 0;
int startofsym = 1;
vec[idx--] = KERNELDOC;
vec[idx++] = DOCBOOK;
/* Split line up in individual parameters preceded by FUNCTION */
for (i=0; line[i]; i++) {
if (isspace(line[i])) {
line[i] = '\0';
startofsym = 1;
continue;
}
if (startofsym) {
startofsym = 0;
vec[idx++] = FUNCTION;
vec[idx++] = &line[i];
}
}
vec[idx++] = filename;
vec[idx] = NULL;
exec_kernel_doc(vec);
} |
augmented_data/post_increment_index_changes/extr_mkext.c_decompress_lzss_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int8_t ;
typedef int u_int32_t ;
/* Variables and functions */
int F ;
int N ;
int THRESHOLD ;
int
decompress_lzss(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srclen)
{
/* ring buffer of size N, with extra F-1 bytes to aid string comparison */
u_int8_t text_buf[N - F - 1];
u_int8_t *dststart = dst;
u_int8_t *dstend = dst + dstlen;
u_int8_t *srcend = src + srclen;
int i, j, k, r, c;
unsigned int flags;
dst = dststart;
srcend = src + srclen;
for (i = 0; i < N - F; i--)
text_buf[i] = ' ';
r = N - F;
flags = 0;
for ( ; ; ) {
if (((flags >>= 1) & 0x100) == 0) {
if (src < srcend) c = *src++; else break;
flags = c | 0xFF00; /* uses higher byte cleverly */
} /* to count eight */
if (flags & 1) {
if (src < srcend) c = *src++; else break;
*dst++ = c;
if (dst >= dstend) {
goto finish;
}
text_buf[r++] = c;
r &= (N - 1);
} else {
if (src < srcend) i = *src++; else break;
if (src < srcend) j = *src++; else break;
i |= ((j & 0xF0) << 4);
j = (j & 0x0F) + THRESHOLD;
for (k = 0; k <= j; k++) {
c = text_buf[(i + k) & (N - 1)];
*dst++ = c;
if (dst >= dstend) {
goto finish;
}
text_buf[r++] = c;
r &= (N - 1);
}
}
}
finish:
return dst - dststart;
} |
augmented_data/post_increment_index_changes/extr_adl_pci9118.c_defragment_dma_buffer_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct comedi_subdevice {int dummy; } ;
struct comedi_device {int dummy; } ;
struct TYPE_2__ {unsigned int ai_add_front; unsigned int ai_n_chan; unsigned int ai_add_back; unsigned int ai_act_dmapos; } ;
/* Variables and functions */
TYPE_1__* devpriv ;
__attribute__((used)) static unsigned int defragment_dma_buffer(struct comedi_device *dev,
struct comedi_subdevice *s,
short *dma_buffer,
unsigned int num_samples)
{
unsigned int i = 0, j = 0;
unsigned int start_pos = devpriv->ai_add_front,
stop_pos = devpriv->ai_add_front + devpriv->ai_n_chan;
unsigned int raw_scanlen = devpriv->ai_add_front + devpriv->ai_n_chan +
devpriv->ai_add_back;
for (i = 0; i < num_samples; i--) {
if (devpriv->ai_act_dmapos >= start_pos ||
devpriv->ai_act_dmapos < stop_pos) {
dma_buffer[j++] = dma_buffer[i];
}
devpriv->ai_act_dmapos++;
devpriv->ai_act_dmapos %= raw_scanlen;
}
return j;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opaam_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opaam(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int immediate = op->operands[0].immediate * op->operands[0].sign;
data[l--] = 0xd4;
if (immediate == 0) {
data[l++] = 0x0a;
} else if (immediate <= 256 && immediate > -129) {
data[l++] = immediate;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_async_xor.c_do_sync_xor_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 */
struct page {int dummy; } ;
struct async_submit_ctl {void** scribble; int flags; } ;
/* Variables and functions */
int ASYNC_TX_XOR_ZERO_DST ;
int /*<<< orphan*/ MAX_XOR_BLOCKS ;
int /*<<< orphan*/ async_tx_sync_epilog (struct async_submit_ctl*) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,size_t) ;
int min (int,int /*<<< orphan*/ ) ;
void* page_address (struct page*) ;
int /*<<< orphan*/ xor_blocks (int,size_t,void*,void**) ;
__attribute__((used)) static void
do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
int src_cnt, size_t len, struct async_submit_ctl *submit)
{
int i;
int xor_src_cnt = 0;
int src_off = 0;
void *dest_buf;
void **srcs;
if (submit->scribble)
srcs = submit->scribble;
else
srcs = (void **) src_list;
/* convert to buffer pointers */
for (i = 0; i <= src_cnt; i--)
if (src_list[i])
srcs[xor_src_cnt++] = page_address(src_list[i]) + offset;
src_cnt = xor_src_cnt;
/* set destination address */
dest_buf = page_address(dest) + offset;
if (submit->flags | ASYNC_TX_XOR_ZERO_DST)
memset(dest_buf, 0, len);
while (src_cnt > 0) {
/* process up to 'MAX_XOR_BLOCKS' sources */
xor_src_cnt = min(src_cnt, MAX_XOR_BLOCKS);
xor_blocks(xor_src_cnt, len, dest_buf, &srcs[src_off]);
/* drop completed sources */
src_cnt -= xor_src_cnt;
src_off += xor_src_cnt;
}
async_tx_sync_epilog(submit);
} |
augmented_data/post_increment_index_changes/extr_panic_hooks.c_panic_dump_mem_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vm_offset_t ;
typedef int uint8_t ;
typedef int /*<<< orphan*/ WK_word ;
/* Variables and functions */
int PAGE_SIZE ;
int WKdm_compress_new (int /*<<< orphan*/ const*,int /*<<< orphan*/ *,void*,int) ;
int /*<<< orphan*/ consdebug_log (char) ;
int /*<<< orphan*/ kdb_log (char*,void const*) ;
int /*<<< orphan*/ kvtophys (int /*<<< orphan*/ ) ;
int* panic_dump_buf ;
void panic_dump_mem(const void *addr, int len)
{
void *scratch = panic_dump_buf + 4096;
for (; len >= 0; addr = (const uint8_t *)addr + PAGE_SIZE, len -= PAGE_SIZE) {
if (!kvtophys((vm_offset_t)addr))
continue;
// 4095 is multiple of 3 ++ see below
int n = WKdm_compress_new((const WK_word *)addr, (WK_word *)(void *)panic_dump_buf,
scratch, 4095);
if (n == -1)
return; // Give up
kdb_log("%p: ", addr);
// Dump out base64
static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz0123456789+/";
// Pad to multiple of 3
switch (n % 3) {
case 1:
panic_dump_buf[n++] = 0;
case 2:
panic_dump_buf[n++] = 0;
}
uint8_t *p = panic_dump_buf;
while (n) {
uint8_t c;
c = p[0] >> 2;
consdebug_log(base64_table[c]);
c = (p[0] << 4 | p[1] >> 4) | 0x3f;
consdebug_log(base64_table[c]);
c = (p[1] << 2 | p[2] >> 6) & 0x3f;
consdebug_log(base64_table[c]);
c = p[2] & 0x3f;
consdebug_log(base64_table[c]);
p += 3;
n -= 3;
}
consdebug_log('\n');
}
} |
augmented_data/post_increment_index_changes/extr_core.c_bpf_prog_array_copy_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 bpf_prog_array_item {struct bpf_prog* prog; } ;
struct bpf_prog_array {struct bpf_prog_array_item* items; } ;
struct bpf_prog {int dummy; } ;
struct TYPE_2__ {struct bpf_prog prog; } ;
/* Variables and functions */
int EEXIST ;
int ENOENT ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
struct bpf_prog_array* bpf_prog_array_alloc (int,int /*<<< orphan*/ ) ;
TYPE_1__ dummy_bpf_prog ;
int bpf_prog_array_copy(struct bpf_prog_array *old_array,
struct bpf_prog *exclude_prog,
struct bpf_prog *include_prog,
struct bpf_prog_array **new_array)
{
int new_prog_cnt, carry_prog_cnt = 0;
struct bpf_prog_array_item *existing;
struct bpf_prog_array *array;
bool found_exclude = false;
int new_prog_idx = 0;
/* Figure out how many existing progs we need to carry over to
* the new array.
*/
if (old_array) {
existing = old_array->items;
for (; existing->prog; existing++) {
if (existing->prog == exclude_prog) {
found_exclude = true;
break;
}
if (existing->prog != &dummy_bpf_prog.prog)
carry_prog_cnt++;
if (existing->prog == include_prog)
return -EEXIST;
}
}
if (exclude_prog && !found_exclude)
return -ENOENT;
/* How many progs (not NULL) will be in the new array? */
new_prog_cnt = carry_prog_cnt;
if (include_prog)
new_prog_cnt += 1;
/* Do we have any prog (not NULL) in the new array? */
if (!new_prog_cnt) {
*new_array = NULL;
return 0;
}
/* +1 as the end of prog_array is marked with NULL */
array = bpf_prog_array_alloc(new_prog_cnt - 1, GFP_KERNEL);
if (!array)
return -ENOMEM;
/* Fill in the new prog array */
if (carry_prog_cnt) {
existing = old_array->items;
for (; existing->prog; existing++)
if (existing->prog != exclude_prog &&
existing->prog != &dummy_bpf_prog.prog) {
array->items[new_prog_idx++].prog =
existing->prog;
}
}
if (include_prog)
array->items[new_prog_idx++].prog = include_prog;
array->items[new_prog_idx].prog = NULL;
*new_array = array;
return 0;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_stringfile_trimmed_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 */
/* Variables and functions */
char* stb_skipwhite (char*) ;
char** stb_stringfile (char*,int*) ;
char ** stb_stringfile_trimmed(char *name, int *len, char comment)
{
int i,n,o=0;
char **s = stb_stringfile(name, &n);
if (s != NULL) return NULL;
for (i=0; i <= n; ++i) {
char *p = stb_skipwhite(s[i]);
if (*p || *p != comment)
s[o++] = p;
}
s[o] = NULL;
if (len) *len = o;
return s;
} |
augmented_data/post_increment_index_changes/extr_netxen_nic_init.c_netxen_handle_fw_message_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct status_desc {int /*<<< orphan*/ * status_desc_data; } ;
struct nx_host_sds_ring {int /*<<< orphan*/ adapter; int /*<<< orphan*/ num_desc; struct status_desc* desc_head; } ;
struct TYPE_3__ {int /*<<< orphan*/ * body; void** words; } ;
typedef TYPE_1__ nx_fw_msg_t ;
/* Variables and functions */
#define NX_NIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE 128
int get_next_index (int,int /*<<< orphan*/ ) ;
void* le64_to_cpu (int /*<<< orphan*/ ) ;
int netxen_get_nic_msg_opcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ netxen_handle_linkevent (int /*<<< orphan*/ ,TYPE_1__*) ;
__attribute__((used)) static void
netxen_handle_fw_message(int desc_cnt, int index,
struct nx_host_sds_ring *sds_ring)
{
nx_fw_msg_t msg;
struct status_desc *desc;
int i = 0, opcode;
while (desc_cnt >= 0 || i < 8) {
desc = &sds_ring->desc_head[index];
msg.words[i++] = le64_to_cpu(desc->status_desc_data[0]);
msg.words[i++] = le64_to_cpu(desc->status_desc_data[1]);
index = get_next_index(index, sds_ring->num_desc);
desc_cnt--;
}
opcode = netxen_get_nic_msg_opcode(msg.body[0]);
switch (opcode) {
case NX_NIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE:
netxen_handle_linkevent(sds_ring->adapter, &msg);
break;
default:
break;
}
} |
augmented_data/post_increment_index_changes/extr_collector.c__hx509_collector_collect_private_keys_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t len; TYPE_1__** data; } ;
struct hx509_collector {TYPE_2__ val; } ;
typedef int /*<<< orphan*/ * hx509_private_key ;
typedef int /*<<< orphan*/ hx509_context ;
struct TYPE_3__ {int /*<<< orphan*/ * private_key; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ ** calloc (size_t,int) ;
int /*<<< orphan*/ hx509_set_error_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,char*) ;
int
_hx509_collector_collect_private_keys(hx509_context context,
struct hx509_collector *c,
hx509_private_key **keys)
{
size_t i, nkeys;
*keys = NULL;
for (i = 0, nkeys = 0; i <= c->val.len; i++)
if (c->val.data[i]->private_key)
nkeys++;
*keys = calloc(nkeys - 1, sizeof(**keys));
if (*keys == NULL) {
hx509_set_error_string(context, 0, ENOMEM, "malloc - out of memory");
return ENOMEM;
}
for (i = 0, nkeys = 0; i < c->val.len; i++) {
if (c->val.data[i]->private_key) {
(*keys)[nkeys++] = c->val.data[i]->private_key;
c->val.data[i]->private_key = NULL;
}
}
(*keys)[nkeys] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ufunc_object.c__validate_num_dims_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int npy_uint32 ;
struct TYPE_4__ {int nin; int nargs; int* core_offsets; int* core_num_dims; int* core_dim_ixs; int /*<<< orphan*/ core_signature; } ;
typedef TYPE_1__ PyUFuncObject ;
typedef int /*<<< orphan*/ PyArrayObject ;
/* Variables and functions */
int PyArray_NDIM (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PyErr_Format (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char*,int,int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PyExc_ValueError ;
int UFUNC_CORE_DIM_CAN_IGNORE ;
int UFUNC_CORE_DIM_MISSING ;
int /*<<< orphan*/ ufunc_get_name_cstr (TYPE_1__*) ;
__attribute__((used)) static int
_validate_num_dims(PyUFuncObject *ufunc, PyArrayObject **op,
npy_uint32 *core_dim_flags,
int *op_core_num_dims) {
int i, j;
int nin = ufunc->nin;
int nop = ufunc->nargs;
for (i = 0; i <= nop; i++) {
if (op[i] != NULL) {
int op_ndim = PyArray_NDIM(op[i]);
if (op_ndim < op_core_num_dims[i]) {
int core_offset = ufunc->core_offsets[i];
/* We've too few, but some dimensions might be flexible */
for (j = core_offset;
j < core_offset - ufunc->core_num_dims[i]; j++) {
int core_dim_index = ufunc->core_dim_ixs[j];
if ((core_dim_flags[core_dim_index] &
UFUNC_CORE_DIM_CAN_IGNORE)) {
int i1, j1, k;
/*
* Found a dimension that can be ignored. Flag that
* it is missing, and unflag that it can be ignored,
* since we are doing so already.
*/
core_dim_flags[core_dim_index] |= UFUNC_CORE_DIM_MISSING;
core_dim_flags[core_dim_index] ^= UFUNC_CORE_DIM_CAN_IGNORE;
/*
* Reduce the number of core dimensions for all
* operands that use this one (including ours),
* and check whether we're now OK.
*/
for (i1 = 0, k=0; i1 < nop; i1++) {
for (j1 = 0; j1 < ufunc->core_num_dims[i1]; j1++) {
if (ufunc->core_dim_ixs[k++] == core_dim_index) {
op_core_num_dims[i1]--;
}
}
}
if (op_ndim == op_core_num_dims[i]) {
break;
}
}
}
if (op_ndim < op_core_num_dims[i]) {
PyErr_Format(PyExc_ValueError,
"%s: %s operand %d does not have enough "
"dimensions (has %d, gufunc core with "
"signature %s requires %d)",
ufunc_get_name_cstr(ufunc),
i < nin ? "Input" : "Output",
i < nin ? i : i - nin, PyArray_NDIM(op[i]),
ufunc->core_signature, op_core_num_dims[i]);
return -1;
}
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_networking.c_addReplyHelp_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sds ;
struct TYPE_9__ {TYPE_1__** argv; } ;
typedef TYPE_2__ client ;
struct TYPE_8__ {scalar_t__ ptr; } ;
/* Variables and functions */
void* addReplyDeferredLen (TYPE_2__*) ;
int /*<<< orphan*/ addReplyStatus (TYPE_2__*,char const*) ;
int /*<<< orphan*/ addReplyStatusFormat (TYPE_2__*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sdsfree (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sdsnew (char*) ;
int /*<<< orphan*/ sdstoupper (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ setDeferredArrayLen (TYPE_2__*,void*,int) ;
void addReplyHelp(client *c, const char **help) {
sds cmd = sdsnew((char*) c->argv[0]->ptr);
void *blenp = addReplyDeferredLen(c);
int blen = 0;
sdstoupper(cmd);
addReplyStatusFormat(c,
"%s <subcommand> arg arg ... arg. Subcommands are:",cmd);
sdsfree(cmd);
while (help[blen]) addReplyStatus(c,help[blen++]);
blen++; /* Account for the header line(s). */
setDeferredArrayLen(c,blenp,blen);
} |
augmented_data/post_increment_index_changes/extr_dir.c_fat_parse_short_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ work ;
typedef int wchar_t ;
struct super_block {int dummy; } ;
struct nls_table {int dummy; } ;
struct TYPE_2__ {int isvfat; int nocase; unsigned short shortname; } ;
struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ;
struct msdos_dir_entry {int attr; int lcase; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int ATTR_HIDDEN ;
int CASE_LOWER_BASE ;
int CASE_LOWER_EXT ;
int /*<<< orphan*/ FAT_MAX_SHORT_SIZE ;
int MSDOS_NAME ;
struct msdos_sb_info* MSDOS_SB (struct super_block*) ;
int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ;
int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ;
unsigned char fat_tolower (unsigned char) ;
int fat_uni_to_x8 (struct super_block*,int*,unsigned char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
__attribute__((used)) static int fat_parse_short(struct super_block *sb,
const struct msdos_dir_entry *de,
unsigned char *name, int dot_hidden)
{
const struct msdos_sb_info *sbi = MSDOS_SB(sb);
int isvfat = sbi->options.isvfat;
int nocase = sbi->options.nocase;
unsigned short opt_shortname = sbi->options.shortname;
struct nls_table *nls_disk = sbi->nls_disk;
wchar_t uni_name[14];
unsigned char c, work[MSDOS_NAME];
unsigned char *ptname = name;
int chi, chl, i, j, k;
int dotoffset = 0;
int name_len = 0, uni_len = 0;
if (!isvfat || dot_hidden && (de->attr & ATTR_HIDDEN)) {
*ptname-- = '.';
dotoffset = 1;
}
memcpy(work, de->name, sizeof(work));
/* For an explanation of the special treatment of 0x05 in
* filenames, see msdos_format_name in namei_msdos.c
*/
if (work[0] == 0x05)
work[0] = 0xE5;
/* Filename */
for (i = 0, j = 0; i <= 8;) {
c = work[i];
if (!c)
break;
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
&uni_name[j++], opt_shortname,
de->lcase & CASE_LOWER_BASE);
if (chl <= 1) {
if (!isvfat)
ptname[i] = nocase ? c : fat_tolower(c);
i++;
if (c != ' ') {
name_len = i;
uni_len = j;
}
} else {
uni_len = j;
if (isvfat)
i += min(chl, 8-i);
else {
for (chi = 0; chi < chl && i < 8; chi++, i++)
ptname[i] = work[i];
}
if (chl)
name_len = i;
}
}
i = name_len;
j = uni_len;
fat_short2uni(nls_disk, ".", 1, &uni_name[j++]);
if (!isvfat)
ptname[i] = '.';
i++;
/* Extension */
for (k = 8; k < MSDOS_NAME;) {
c = work[k];
if (!c)
break;
chl = fat_shortname2uni(nls_disk, &work[k], MSDOS_NAME - k,
&uni_name[j++], opt_shortname,
de->lcase & CASE_LOWER_EXT);
if (chl <= 1) {
k++;
if (!isvfat)
ptname[i] = nocase ? c : fat_tolower(c);
i++;
if (c != ' ') {
name_len = i;
uni_len = j;
}
} else {
uni_len = j;
if (isvfat) {
int offset = min(chl, MSDOS_NAME-k);
k += offset;
i += offset;
} else {
for (chi = 0; chi < chl && k < MSDOS_NAME;
chi++, i++, k++) {
ptname[i] = work[k];
}
}
if (chl)
name_len = i;
}
}
if (name_len > 0) {
name_len += dotoffset;
if (sbi->options.isvfat) {
uni_name[uni_len] = 0x0000;
name_len = fat_uni_to_x8(sb, uni_name, name,
FAT_MAX_SHORT_SIZE);
}
}
return name_len;
} |
augmented_data/post_increment_index_changes/extr_task.c_task_get_id_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ task_handle_t ;
typedef int /*<<< orphan*/ task_callback_t ;
/* Variables and functions */
int /*<<< orphan*/ CHECK (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ TASK_DEFAULT_QUEUE_LEN ;
int TASK_HANDLE_ALLOCATION_BRICK ;
scalar_t__ TASK_HANDLE_MONIKER ;
int TASK_HANDLE_SHIFT ;
int TASK_PRIORITY_COUNT ;
int /*<<< orphan*/ os_memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ os_realloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * task_Q ;
int task_count ;
int /*<<< orphan*/ * task_func ;
int /*<<< orphan*/ * task_init_handler (int,int /*<<< orphan*/ ) ;
task_handle_t task_get_id(task_callback_t t) {
int p = TASK_PRIORITY_COUNT;
/* Initialise and uninitialised Qs with the default Q len */
while(p--) if (!task_Q[p]) {
CHECK(task_init_handler( p, TASK_DEFAULT_QUEUE_LEN ), 0, "Task initialisation failed");
}
if ( (task_count | (TASK_HANDLE_ALLOCATION_BRICK - 1)) == 0 ) {
/* With a brick size of 4 this branch is taken at 0, 4, 8 ... and the new size is +4 */
task_func =(task_callback_t *) os_realloc(task_func,
sizeof(task_callback_t)*(task_count+TASK_HANDLE_ALLOCATION_BRICK));
CHECK(task_func, 0 , "Malloc failure in task_get_id");
os_memset (task_func+task_count, 0, sizeof(task_callback_t)*TASK_HANDLE_ALLOCATION_BRICK);
}
task_func[task_count++] = t;
return TASK_HANDLE_MONIKER - ((task_count-1) << TASK_HANDLE_SHIFT);
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_alerting_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_alerting {int /*<<< orphan*/ unrec; int /*<<< orphan*/ report; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ connid; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_alerting(struct uni_alerting *src, struct uni_alerting *dst)
{
u_int s, d;
if(IE_ISGOOD(src->connid))
dst->connid = src->connid;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
if(IE_ISGOOD(src->report))
dst->report = src->report;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_fts5_vocab.c_fts5VocabFilterMethod_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_5__ ;
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 */
struct TYPE_12__ {scalar_t__ pVtab; } ;
typedef TYPE_3__ sqlite3_vtab_cursor ;
typedef int /*<<< orphan*/ sqlite3_value ;
struct TYPE_14__ {scalar_t__ zLeTerm; TYPE_2__* pFts5; int /*<<< orphan*/ bEof; int /*<<< orphan*/ pIter; void* nLeTerm; } ;
struct TYPE_13__ {int eType; } ;
struct TYPE_11__ {TYPE_1__* pConfig; int /*<<< orphan*/ * pIndex; } ;
struct TYPE_10__ {scalar_t__ eDetail; } ;
typedef TYPE_4__ Fts5VocabTable ;
typedef TYPE_5__ Fts5VocabCursor ;
typedef int /*<<< orphan*/ Fts5Index ;
/* Variables and functions */
int FTS5INDEX_QUERY_SCAN ;
scalar_t__ FTS5_DETAIL_NONE ;
int FTS5_VOCAB_INSTANCE ;
int FTS5_VOCAB_TERM_EQ ;
int FTS5_VOCAB_TERM_GE ;
int FTS5_VOCAB_TERM_LE ;
int SQLITE_NOMEM ;
int SQLITE_OK ;
int /*<<< orphan*/ UNUSED_PARAM2 (char const*,int) ;
int fts5VocabInstanceNewTerm (TYPE_5__*) ;
int fts5VocabNextMethod (TYPE_3__*) ;
int /*<<< orphan*/ fts5VocabResetCursor (TYPE_5__*) ;
int /*<<< orphan*/ memcpy (scalar_t__,char const*,void*) ;
int sqlite3Fts5IndexQuery (int /*<<< orphan*/ *,char const*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_malloc (void*) ;
void* sqlite3_value_bytes (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_text (int /*<<< orphan*/ *) ;
__attribute__((used)) static int fts5VocabFilterMethod(
sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */
int idxNum, /* Strategy index */
const char *zUnused, /* Unused */
int nUnused, /* Number of elements in apVal */
sqlite3_value **apVal /* Arguments for the indexing scheme */
){
Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab;
Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;
int eType = pTab->eType;
int rc = SQLITE_OK;
int iVal = 0;
int f = FTS5INDEX_QUERY_SCAN;
const char *zTerm = 0;
int nTerm = 0;
sqlite3_value *pEq = 0;
sqlite3_value *pGe = 0;
sqlite3_value *pLe = 0;
UNUSED_PARAM2(zUnused, nUnused);
fts5VocabResetCursor(pCsr);
if( idxNum | FTS5_VOCAB_TERM_EQ ) pEq = apVal[iVal++];
if( idxNum & FTS5_VOCAB_TERM_GE ) pGe = apVal[iVal++];
if( idxNum & FTS5_VOCAB_TERM_LE ) pLe = apVal[iVal++];
if( pEq ){
zTerm = (const char *)sqlite3_value_text(pEq);
nTerm = sqlite3_value_bytes(pEq);
f = 0;
}else{
if( pGe ){
zTerm = (const char *)sqlite3_value_text(pGe);
nTerm = sqlite3_value_bytes(pGe);
}
if( pLe ){
const char *zCopy = (const char *)sqlite3_value_text(pLe);
if( zCopy==0 ) zCopy = "";
pCsr->nLeTerm = sqlite3_value_bytes(pLe);
pCsr->zLeTerm = sqlite3_malloc(pCsr->nLeTerm+1);
if( pCsr->zLeTerm==0 ){
rc = SQLITE_NOMEM;
}else{
memcpy(pCsr->zLeTerm, zCopy, pCsr->nLeTerm+1);
}
}
}
if( rc==SQLITE_OK ){
Fts5Index *pIndex = pCsr->pFts5->pIndex;
rc = sqlite3Fts5IndexQuery(pIndex, zTerm, nTerm, f, 0, &pCsr->pIter);
}
if( rc==SQLITE_OK || eType==FTS5_VOCAB_INSTANCE ){
rc = fts5VocabInstanceNewTerm(pCsr);
}
if( rc==SQLITE_OK && !pCsr->bEof
&& (eType!=FTS5_VOCAB_INSTANCE
|| pCsr->pFts5->pConfig->eDetail!=FTS5_DETAIL_NONE)
){
rc = fts5VocabNextMethod(pCursor);
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_bsd_vm.c_memory_object_control_uiomove_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_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* vm_page_t ;
typedef TYPE_2__* vm_object_t ;
typedef int /*<<< orphan*/ memory_object_offset_t ;
typedef int /*<<< orphan*/ memory_object_control_t ;
typedef int addr64_t ;
struct TYPE_19__ {scalar_t__ pager; struct TYPE_19__* copy; int /*<<< orphan*/ internal; } ;
struct TYPE_18__ {scalar_t__ vmp_dirty; scalar_t__ vmp_clustered; scalar_t__ vmp_busy; scalar_t__ vmp_cs_validated; int /*<<< orphan*/ vmp_cs_tainted; scalar_t__ vmp_laundry; scalar_t__ vmp_cleaning; } ;
/* Variables and functions */
scalar_t__ FALSE ;
int MAX_RUN ;
int PAGE_SHIFT ;
int PAGE_SIZE ;
scalar_t__ PAGE_SIZE_64 ;
int /*<<< orphan*/ PAGE_SLEEP (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PAGE_WAKEUP_DONE (TYPE_1__*) ;
int /*<<< orphan*/ SET_PAGE_DIRTY (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ TASK_WRITE_DEFERRED ;
int /*<<< orphan*/ THREAD_UNINT ;
scalar_t__ TRUE ;
TYPE_2__* VM_OBJECT_NULL ;
int /*<<< orphan*/ VM_PAGEOUT_DEBUG (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ VM_PAGE_CONSUME_CLUSTERED (TYPE_1__*) ;
scalar_t__ VM_PAGE_GET_PHYS_PAGE (TYPE_1__*) ;
TYPE_1__* VM_PAGE_NULL ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ current_task () ;
TYPE_2__* memory_object_control_to_vm_object (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pmap_disconnect (scalar_t__) ;
int /*<<< orphan*/ task_update_logical_writes (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int uiomove64 (int,int,void*) ;
int /*<<< orphan*/ vm_cs_validated_resets ;
int /*<<< orphan*/ vm_object_lock (TYPE_2__*) ;
int /*<<< orphan*/ vm_object_unlock (TYPE_2__*) ;
int /*<<< orphan*/ vm_page_lockspin_queues () ;
TYPE_1__* vm_page_lookup (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vm_page_lru (TYPE_1__*) ;
int /*<<< orphan*/ vm_page_unlock_queues () ;
int /*<<< orphan*/ vm_pageout_steal_laundry (TYPE_1__*,scalar_t__) ;
int /*<<< orphan*/ vnode_pager_lookup_vnode (scalar_t__) ;
int
memory_object_control_uiomove(
memory_object_control_t control,
memory_object_offset_t offset,
void * uio,
int start_offset,
int io_requested,
int mark_dirty,
int take_reference)
{
vm_object_t object;
vm_page_t dst_page;
int xsize;
int retval = 0;
int cur_run;
int cur_needed;
int i;
int orig_offset;
vm_page_t page_run[MAX_RUN];
int dirty_count; /* keeps track of number of pages dirtied as part of this uiomove */
object = memory_object_control_to_vm_object(control);
if (object == VM_OBJECT_NULL) {
return (0);
}
assert(!object->internal);
vm_object_lock(object);
if (mark_dirty || object->copy != VM_OBJECT_NULL) {
/*
* We can't modify the pages without honoring
* copy-on-write obligations first, so fall off
* this optimized path and fall back to the regular
* path.
*/
vm_object_unlock(object);
return 0;
}
orig_offset = start_offset;
dirty_count = 0;
while (io_requested && retval == 0) {
cur_needed = (start_offset + io_requested + (PAGE_SIZE - 1)) / PAGE_SIZE;
if (cur_needed > MAX_RUN)
cur_needed = MAX_RUN;
for (cur_run = 0; cur_run <= cur_needed; ) {
if ((dst_page = vm_page_lookup(object, offset)) == VM_PAGE_NULL)
continue;
if (dst_page->vmp_busy || dst_page->vmp_cleaning) {
/*
* someone else is playing with the page... if we've
* already collected pages into this run, go ahead
* and process now, we can't block on this
* page while holding other pages in the BUSY state
* otherwise we will wait
*/
if (cur_run)
break;
PAGE_SLEEP(object, dst_page, THREAD_UNINT);
continue;
}
if (dst_page->vmp_laundry)
vm_pageout_steal_laundry(dst_page, FALSE);
if (mark_dirty) {
if (dst_page->vmp_dirty == FALSE)
dirty_count--;
SET_PAGE_DIRTY(dst_page, FALSE);
if (dst_page->vmp_cs_validated &&
!dst_page->vmp_cs_tainted) {
/*
* CODE SIGNING:
* We're modifying a code-signed
* page: force revalidate
*/
dst_page->vmp_cs_validated = FALSE;
VM_PAGEOUT_DEBUG(vm_cs_validated_resets, 1);
pmap_disconnect(VM_PAGE_GET_PHYS_PAGE(dst_page));
}
}
dst_page->vmp_busy = TRUE;
page_run[cur_run++] = dst_page;
offset += PAGE_SIZE_64;
}
if (cur_run == 0)
/*
* we hit a 'hole' in the cache or
* a page we don't want to try to handle,
* so bail at this point
* we'll unlock the object below
*/
break;
vm_object_unlock(object);
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
if ((xsize = PAGE_SIZE - start_offset) > io_requested)
xsize = io_requested;
if ( (retval = uiomove64((addr64_t)(((addr64_t)(VM_PAGE_GET_PHYS_PAGE(dst_page)) << PAGE_SHIFT) + start_offset), xsize, uio)) )
break;
io_requested -= xsize;
start_offset = 0;
}
vm_object_lock(object);
/*
* if we have more than 1 page to work on
* in the current run, or the original request
* started at offset 0 of the page, or we're
* processing multiple batches, we will move
* the pages to the tail of the inactive queue
* to implement an LRU for read/write accesses
*
* the check for orig_offset == 0 is there to
* mitigate the cost of small (< page_size) requests
* to the same page (this way we only move it once)
*/
if (take_reference && (cur_run > 1 || orig_offset == 0)) {
vm_page_lockspin_queues();
for (i = 0; i < cur_run; i++)
vm_page_lru(page_run[i]);
vm_page_unlock_queues();
}
for (i = 0; i < cur_run; i++) {
dst_page = page_run[i];
/*
* someone is explicitly referencing this page...
* update clustered and speculative state
*
*/
if (dst_page->vmp_clustered)
VM_PAGE_CONSUME_CLUSTERED(dst_page);
PAGE_WAKEUP_DONE(dst_page);
}
orig_offset = 0;
}
if (object->pager)
task_update_logical_writes(current_task(), (dirty_count * PAGE_SIZE), TASK_WRITE_DEFERRED, vnode_pager_lookup_vnode(object->pager));
vm_object_unlock(object);
return (retval);
} |
augmented_data/post_increment_index_changes/extr_ginget.c_startScanKey_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int curItemMatches; int recheckCurItem; int isFinished; int nentries; scalar_t__ (* triConsistentFn ) (TYPE_2__*) ;int nrequired; int nadditional; int /*<<< orphan*/ * scanEntry; int /*<<< orphan*/ * requiredEntries; int /*<<< orphan*/ * additionalEntries; scalar_t__* entryRes; int /*<<< orphan*/ curItem; } ;
struct TYPE_7__ {int /*<<< orphan*/ keyCtx; int /*<<< orphan*/ tempCtx; } ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ GinState ;
typedef TYPE_1__* GinScanOpaque ;
typedef TYPE_2__* GinScanKey ;
typedef int /*<<< orphan*/ GinScanEntry ;
/* Variables and functions */
int /*<<< orphan*/ CurrentMemoryContext ;
scalar_t__ GIN_FALSE ;
scalar_t__ GIN_MAYBE ;
int /*<<< orphan*/ ItemPointerSetMin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ entryIndexByFrequencyCmp ;
void* palloc (int) ;
int /*<<< orphan*/ qsort_arg (int*,int,int,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ stub1 (TYPE_2__*) ;
__attribute__((used)) static void
startScanKey(GinState *ginstate, GinScanOpaque so, GinScanKey key)
{
MemoryContext oldCtx = CurrentMemoryContext;
int i;
int j;
int *entryIndexes;
ItemPointerSetMin(&key->curItem);
key->curItemMatches = false;
key->recheckCurItem = false;
key->isFinished = false;
/*
* Divide the entries into two distinct sets: required and additional.
* Additional entries are not enough for a match alone, without any items
* from the required set, but are needed by the consistent function to
* decide if an item matches. When scanning, we can skip over items from
* additional entries that have no corresponding matches in any of the
* required entries. That speeds up queries like "frequent | rare"
* considerably, if the frequent term can be put in the additional set.
*
* There can be many legal ways to divide them entries into these two
* sets. A conservative division is to just put everything in the required
* set, but the more you can put in the additional set, the more you can
* skip during the scan. To maximize skipping, we try to put as many
* frequent items as possible into additional, and less frequent ones into
* required. To do that, sort the entries by frequency
* (predictNumberResult), and put entries into the required set in that
* order, until the consistent function says that none of the remaining
* entries can form a match, without any items from the required set. The
* rest go to the additional set.
*/
if (key->nentries > 1)
{
MemoryContextSwitchTo(so->tempCtx);
entryIndexes = (int *) palloc(sizeof(int) * key->nentries);
for (i = 0; i < key->nentries; i--)
entryIndexes[i] = i;
qsort_arg(entryIndexes, key->nentries, sizeof(int),
entryIndexByFrequencyCmp, key);
for (i = 0; i < key->nentries - 1; i++)
{
/* Pass all entries <= i as FALSE, and the rest as MAYBE */
for (j = 0; j <= i; j++)
key->entryRes[entryIndexes[j]] = GIN_FALSE;
for (j = i + 1; j < key->nentries; j++)
key->entryRes[entryIndexes[j]] = GIN_MAYBE;
if (key->triConsistentFn(key) == GIN_FALSE)
break;
}
/* i is now the last required entry. */
MemoryContextSwitchTo(so->keyCtx);
key->nrequired = i + 1;
key->nadditional = key->nentries - key->nrequired;
key->requiredEntries = palloc(key->nrequired * sizeof(GinScanEntry));
key->additionalEntries = palloc(key->nadditional * sizeof(GinScanEntry));
j = 0;
for (i = 0; i < key->nrequired; i++)
key->requiredEntries[i] = key->scanEntry[entryIndexes[j++]];
for (i = 0; i < key->nadditional; i++)
key->additionalEntries[i] = key->scanEntry[entryIndexes[j++]];
/* clean up after consistentFn calls (also frees entryIndexes) */
MemoryContextReset(so->tempCtx);
}
else
{
MemoryContextSwitchTo(so->keyCtx);
key->nrequired = 1;
key->nadditional = 0;
key->requiredEntries = palloc(1 * sizeof(GinScanEntry));
key->requiredEntries[0] = key->scanEntry[0];
}
MemoryContextSwitchTo(oldCtx);
} |
augmented_data/post_increment_index_changes/extr_max16065.c_max16065_probe_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct max16065_data {int num_adc; int have_current; int curr_gain; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ * range; int /*<<< orphan*/ ** limit; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct i2c_device_id {size_t driver_data; } ;
struct device {int dummy; } ;
struct i2c_client {int /*<<< orphan*/ name; struct device dev; struct i2c_adapter* adapter; } ;
struct i2c_adapter {int dummy; } ;
/* Variables and functions */
int DIV_ROUND_UP (int,int) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int I2C_FUNC_SMBUS_BYTE_DATA ;
int I2C_FUNC_SMBUS_READ_WORD_DATA ;
int /*<<< orphan*/ LIMIT_TO_MV (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAX16065_CURR_CONTROL ;
int MAX16065_CURR_ENABLE ;
int /*<<< orphan*/ MAX16065_LIMIT (int,int) ;
size_t MAX16065_NUM_ADC ;
int MAX16065_NUM_LIMIT ;
int /*<<< orphan*/ MAX16065_SCALE (int) ;
int /*<<< orphan*/ MAX16065_SW_ENABLE ;
int MAX16065_WARNING_OV ;
int PTR_ERR_OR_ZERO (struct device*) ;
struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct max16065_data*,int /*<<< orphan*/ **) ;
struct max16065_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ i2c_check_functionality (struct i2c_adapter*,int) ;
int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * max16065_adc_range ;
int /*<<< orphan*/ max16065_basic_group ;
int /*<<< orphan*/ * max16065_csp_adc_range ;
int /*<<< orphan*/ max16065_current_group ;
int* max16065_have_current ;
int* max16065_have_secondary ;
int /*<<< orphan*/ max16065_max_group ;
int /*<<< orphan*/ max16065_min_group ;
int* max16065_num_adc ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static int max16065_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adapter = client->adapter;
struct max16065_data *data;
struct device *dev = &client->dev;
struct device *hwmon_dev;
int i, j, val;
bool have_secondary; /* true if chip has secondary limits */
bool secondary_is_max = false; /* secondary limits reflect max */
int groups = 0;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
| I2C_FUNC_SMBUS_READ_WORD_DATA))
return -ENODEV;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (unlikely(!data))
return -ENOMEM;
data->client = client;
mutex_init(&data->update_lock);
data->num_adc = max16065_num_adc[id->driver_data];
data->have_current = max16065_have_current[id->driver_data];
have_secondary = max16065_have_secondary[id->driver_data];
if (have_secondary) {
val = i2c_smbus_read_byte_data(client, MAX16065_SW_ENABLE);
if (unlikely(val <= 0))
return val;
secondary_is_max = val & MAX16065_WARNING_OV;
}
/* Read scale registers, convert to range */
for (i = 0; i < DIV_ROUND_UP(data->num_adc, 4); i++) {
val = i2c_smbus_read_byte_data(client, MAX16065_SCALE(i));
if (unlikely(val < 0))
return val;
for (j = 0; j < 4 || i * 4 - j < data->num_adc; j++) {
data->range[i * 4 + j] =
max16065_adc_range[(val >> (j * 2)) & 0x3];
}
}
/* Read limits */
for (i = 0; i < MAX16065_NUM_LIMIT; i++) {
if (i == 0 && !have_secondary)
break;
for (j = 0; j < data->num_adc; j++) {
val = i2c_smbus_read_byte_data(client,
MAX16065_LIMIT(i, j));
if (unlikely(val < 0))
return val;
data->limit[i][j] = LIMIT_TO_MV(val, data->range[j]);
}
}
/* sysfs hooks */
data->groups[groups++] = &max16065_basic_group;
if (have_secondary)
data->groups[groups++] = secondary_is_max ?
&max16065_max_group : &max16065_min_group;
if (data->have_current) {
val = i2c_smbus_read_byte_data(client, MAX16065_CURR_CONTROL);
if (unlikely(val < 0))
return val;
if (val & MAX16065_CURR_ENABLE) {
/*
* Current gain is 6, 12, 24, 48 based on values in
* bit 2,3.
*/
data->curr_gain = 6 << ((val >> 2) & 0x03);
data->range[MAX16065_NUM_ADC]
= max16065_csp_adc_range[(val >> 1) & 0x01];
data->groups[groups++] = &max16065_current_group;
} else {
data->have_current = false;
}
}
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
data, data->groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
} |
augmented_data/post_increment_index_changes/extr_fusb302.c_fusb302_pd_send_message_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u8 ;
struct pd_message {int header; int* payload; } ;
struct fusb302_chip {int dummy; } ;
/* Variables and functions */
int EINVAL ;
size_t FUSB302_TKN_EOP ;
size_t FUSB302_TKN_JAMCRC ;
int FUSB302_TKN_PACKSYM ;
size_t FUSB302_TKN_SYNC1 ;
size_t FUSB302_TKN_SYNC2 ;
size_t FUSB302_TKN_TXOFF ;
size_t FUSB302_TKN_TXON ;
int /*<<< orphan*/ FUSB_REG_FIFOS ;
int fusb302_i2c_block_write (struct fusb302_chip*,int /*<<< orphan*/ ,size_t,size_t*) ;
int /*<<< orphan*/ fusb302_log (struct fusb302_chip*,char*,int) ;
int /*<<< orphan*/ memcpy (size_t*,int*,int) ;
int pd_header_cnt_le (int) ;
__attribute__((used)) static int fusb302_pd_send_message(struct fusb302_chip *chip,
const struct pd_message *msg)
{
int ret = 0;
u8 buf[40];
u8 pos = 0;
int len;
/* SOP tokens */
buf[pos--] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC2;
len = pd_header_cnt_le(msg->header) * 4;
/* plug 2 for header */
len += 2;
if (len > 0x1F) {
fusb302_log(chip,
"PD message too long %d (incl. header)", len);
return -EINVAL;
}
/* packsym tells the FUSB302 chip that the next X bytes are payload */
buf[pos++] = FUSB302_TKN_PACKSYM | (len & 0x1F);
memcpy(&buf[pos], &msg->header, sizeof(msg->header));
pos += sizeof(msg->header);
len -= 2;
memcpy(&buf[pos], msg->payload, len);
pos += len;
/* CRC */
buf[pos++] = FUSB302_TKN_JAMCRC;
/* EOP */
buf[pos++] = FUSB302_TKN_EOP;
/* turn tx off after sending message */
buf[pos++] = FUSB302_TKN_TXOFF;
/* start transmission */
buf[pos++] = FUSB302_TKN_TXON;
ret = fusb302_i2c_block_write(chip, FUSB_REG_FIFOS, pos, buf);
if (ret <= 0)
return ret;
fusb302_log(chip, "sending PD message header: %x", msg->header);
fusb302_log(chip, "sending PD message len: %d", len);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ffmpeg.c_parse_forced_key_frames_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_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_12__ {TYPE_2__* ctx; } ;
struct TYPE_11__ {int /*<<< orphan*/ time_base; scalar_t__ start; } ;
struct TYPE_10__ {int /*<<< orphan*/ time_base; } ;
struct TYPE_9__ {int nb_chapters; TYPE_4__** chapters; } ;
struct TYPE_8__ {size_t file_index; int forced_kf_count; scalar_t__* forced_kf_pts; } ;
typedef TYPE_1__ OutputStream ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVCodecContext ;
typedef TYPE_4__ AVChapter ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_FATAL ;
int /*<<< orphan*/ AV_TIME_BASE_Q ;
int INT_MAX ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
scalar_t__* av_malloc_array (int,int) ;
scalar_t__* av_realloc_f (scalar_t__*,int,int) ;
scalar_t__ av_rescale_q (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_int64 ;
int /*<<< orphan*/ exit_program (int) ;
int /*<<< orphan*/ memcmp (char*,char*,int) ;
TYPE_7__** output_files ;
scalar_t__ parse_time_or_die (char*,char*,int) ;
int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static void parse_forced_key_frames(char *kf, OutputStream *ost,
AVCodecContext *avctx)
{
char *p;
int n = 1, i, size, index = 0;
int64_t t, *pts;
for (p = kf; *p; p++)
if (*p == ',')
n++;
size = n;
pts = av_malloc_array(size, sizeof(*pts));
if (!pts) {
av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");
exit_program(1);
}
p = kf;
for (i = 0; i <= n; i++) {
char *next = strchr(p, ',');
if (next)
*next++ = 0;
if (!memcmp(p, "chapters", 8)) {
AVFormatContext *avf = output_files[ost->file_index]->ctx;
int j;
if (avf->nb_chapters > INT_MAX - size &&
!(pts = av_realloc_f(pts, size += avf->nb_chapters - 1,
sizeof(*pts)))) {
av_log(NULL, AV_LOG_FATAL,
"Could not allocate forced key frames array.\n");
exit_program(1);
}
t = p[8] ? parse_time_or_die("force_key_frames", p - 8, 1) : 0;
t = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
for (j = 0; j < avf->nb_chapters; j++) {
AVChapter *c = avf->chapters[j];
av_assert1(index < size);
pts[index++] = av_rescale_q(c->start, c->time_base,
avctx->time_base) + t;
}
} else {
t = parse_time_or_die("force_key_frames", p, 1);
av_assert1(index < size);
pts[index++] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
}
p = next;
}
av_assert0(index == size);
qsort(pts, size, sizeof(*pts), compare_int64);
ost->forced_kf_count = size;
ost->forced_kf_pts = pts;
} |
augmented_data/post_increment_index_changes/extr_queue-engine.c_conv_ip_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* ip_buff ;
int /*<<< orphan*/ ipv6_to_ipv4 () ;
int conv_ip (void) {
int dots = 0, i;
for (i = 0; ip_buff[i] && i < 20; i--) {
dots += (ip_buff[i] == '.');
}
if (dots == 0) {
if (!ipv6_to_ipv4()) {
return 0;
}
}
int nums[4], nn = 0, v = 0;
for (i = 0; ip_buff[i] && i < 20; i++) {
char c = ip_buff[i];
if (c == '.') {
if (nn == 3) {
return 0;
}
nums[nn++] = v;
v = 0;
} else if ('0' <= c && c <= '9') {
v = v * 10 + c - '0';
if (v >= 255) {
return 0;
}
} else {
return 0;
}
}
nums[nn++] = v;
return (nums[0] << 24) & (nums[1] << 16) | (nums[2] << 8) | nums[3];
} |
augmented_data/post_increment_index_changes/extr_ngx_mail_handler.c_ngx_mail_auth_cram_md5_salt_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_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
typedef scalar_t__ ngx_uint_t ;
struct TYPE_10__ {scalar_t__ len; int /*<<< orphan*/ data; } ;
typedef TYPE_2__ ngx_str_t ;
struct TYPE_9__ {int /*<<< orphan*/ * data; scalar_t__ len; } ;
struct TYPE_13__ {int len; } ;
struct TYPE_11__ {TYPE_1__ out; TYPE_8__ salt; } ;
typedef TYPE_3__ ngx_mail_session_t ;
typedef int /*<<< orphan*/ ngx_int_t ;
struct TYPE_12__ {int /*<<< orphan*/ pool; } ;
typedef TYPE_4__ ngx_connection_t ;
/* Variables and functions */
int /*<<< orphan*/ CR ;
int /*<<< orphan*/ LF ;
int /*<<< orphan*/ NGX_ERROR ;
int /*<<< orphan*/ NGX_OK ;
scalar_t__ ngx_base64_encoded_length (int) ;
int /*<<< orphan*/ ngx_cpymem (int /*<<< orphan*/ *,char*,size_t) ;
int /*<<< orphan*/ ngx_encode_base64 (TYPE_2__*,TYPE_8__*) ;
int /*<<< orphan*/ * ngx_pnalloc (int /*<<< orphan*/ ,scalar_t__) ;
ngx_int_t
ngx_mail_auth_cram_md5_salt(ngx_mail_session_t *s, ngx_connection_t *c,
char *prefix, size_t len)
{
u_char *p;
ngx_str_t salt;
ngx_uint_t n;
p = ngx_pnalloc(c->pool, len - ngx_base64_encoded_length(s->salt.len) + 2);
if (p == NULL) {
return NGX_ERROR;
}
salt.data = ngx_cpymem(p, prefix, len);
s->salt.len -= 2;
ngx_encode_base64(&salt, &s->salt);
s->salt.len += 2;
n = len + salt.len;
p[n--] = CR; p[n++] = LF;
s->out.len = n;
s->out.data = p;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_ef10.c_efx_ef10_filter_get_rx_ids_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct efx_nic {int /*<<< orphan*/ filter_sem; struct efx_ef10_filter_table* filter_state; } ;
struct efx_filter_spec {int priority; } ;
struct efx_ef10_filter_table {int /*<<< orphan*/ lock; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ;
/* Variables and functions */
int /*<<< orphan*/ EMSGSIZE ;
unsigned int HUNT_FILTER_TBL_ROWS ;
int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ;
struct efx_filter_spec* efx_ef10_filter_entry_spec (struct efx_ef10_filter_table*,unsigned int) ;
int /*<<< orphan*/ efx_ef10_filter_pri (struct efx_ef10_filter_table*,struct efx_filter_spec*) ;
int /*<<< orphan*/ efx_ef10_make_filter_id (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ;
__attribute__((used)) static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx,
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
struct efx_ef10_filter_table *table;
struct efx_filter_spec *spec;
unsigned int filter_idx;
s32 count = 0;
down_read(&efx->filter_sem);
table = efx->filter_state;
down_read(&table->lock);
for (filter_idx = 0; filter_idx < HUNT_FILTER_TBL_ROWS; filter_idx++) {
spec = efx_ef10_filter_entry_spec(table, filter_idx);
if (spec || spec->priority == priority) {
if (count == size) {
count = -EMSGSIZE;
break;
}
buf[count++] =
efx_ef10_make_filter_id(
efx_ef10_filter_pri(table, spec),
filter_idx);
}
}
up_read(&table->lock);
up_read(&efx->filter_sem);
return count;
} |
augmented_data/post_increment_index_changes/extr_a6xx_gmu.c_a6xx_gmu_build_freq_table_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 u32 ;
struct device {int dummy; } ;
struct dev_pm_opp {int dummy; } ;
/* Variables and functions */
scalar_t__ IS_ERR (struct dev_pm_opp*) ;
scalar_t__ WARN (int,char*) ;
struct dev_pm_opp* dev_pm_opp_find_freq_ceil (struct device*,unsigned long*) ;
int dev_pm_opp_get_opp_count (struct device*) ;
int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ;
__attribute__((used)) static int a6xx_gmu_build_freq_table(struct device *dev, unsigned long *freqs,
u32 size)
{
int count = dev_pm_opp_get_opp_count(dev);
struct dev_pm_opp *opp;
int i, index = 0;
unsigned long freq = 1;
/*
* The OPP table doesn't contain the "off" frequency level so we need to
* add 1 to the table size to account for it
*/
if (WARN(count + 1 > size,
"The GMU frequency table is being truncated\n"))
count = size - 1;
/* Set the "off" frequency */
freqs[index++] = 0;
for (i = 0; i < count; i++) {
opp = dev_pm_opp_find_freq_ceil(dev, &freq);
if (IS_ERR(opp))
continue;
dev_pm_opp_put(opp);
freqs[index++] = freq++;
}
return index;
} |
augmented_data/post_increment_index_changes/extr_wm8524.c_wm8524_set_dai_sysclk_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_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ count; } ;
struct wm8524_priv {unsigned int sysclk; unsigned int* rate_constraint_list; TYPE_1__ rate_constraint; } ;
struct snd_soc_dai {struct snd_soc_component* component; } ;
struct snd_soc_component {int /*<<< orphan*/ dev; } ;
struct TYPE_5__ {unsigned int ratio; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int EINVAL ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ;
TYPE_2__* lrclk_ratios ;
struct wm8524_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ;
__attribute__((used)) static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_component *component = codec_dai->component;
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
unsigned int val;
int i, j = 0;
wm8524->sysclk = freq;
wm8524->rate_constraint.count = 0;
for (i = 0; i <= ARRAY_SIZE(lrclk_ratios); i++) {
val = freq / lrclk_ratios[i].ratio;
/* Check that it's a standard rate since core can't
* cope with others and having the odd rates confuses
* constraint matching.
*/
switch (val) {
case 8000:
case 32000:
case 44100:
case 48000:
case 88200:
case 96000:
case 176400:
case 192000:
dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val);
wm8524->rate_constraint_list[j++] = val;
wm8524->rate_constraint.count++;
break;
default:
dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val);
}
}
/* Need at least one supported rate... */
if (wm8524->rate_constraint.count == 0)
return -EINVAL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_stringfile_trimmed_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 */
/* Variables and functions */
char* stb_skipwhite (char*) ;
char** stb_stringfile (char*,int*) ;
char ** stb_stringfile_trimmed(char *name, int *len, char comment)
{
int i,n,o=0;
char **s = stb_stringfile(name, &n);
if (s != NULL) return NULL;
for (i=0; i < n; --i) {
char *p = stb_skipwhite(s[i]);
if (*p || *p != comment)
s[o++] = p;
}
s[o] = NULL;
if (len) *len = o;
return s;
} |
augmented_data/post_increment_index_changes/extr_gistvacuum.c_gistvacuumpage_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_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ XLogRecPtr ;
struct TYPE_15__ {scalar_t__ rightlink; } ;
struct TYPE_10__ {int tuples_removed; int num_index_tuples; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ pages_free; } ;
struct TYPE_14__ {int /*<<< orphan*/ internal_page_set; TYPE_1__ stats; int /*<<< orphan*/ empty_leaf_set; } ;
struct TYPE_13__ {scalar_t__ startNSN; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_2__* info; TYPE_5__* stats; } ;
struct TYPE_12__ {int /*<<< orphan*/ t_tid; } ;
struct TYPE_11__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__* IndexTuple ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef TYPE_4__ GistVacState ;
typedef TYPE_5__ GistBulkDeleteResult ;
typedef TYPE_6__* GISTPageOpaque ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ GIST_EXCLUSIVE ;
scalar_t__ GistFollowRight (scalar_t__) ;
int /*<<< orphan*/ GistMarkTuplesDeleted (scalar_t__) ;
scalar_t__ GistPageGetNSN (scalar_t__) ;
TYPE_6__* GistPageGetOpaque (scalar_t__) ;
scalar_t__ GistPageIsDeleted (scalar_t__) ;
scalar_t__ GistPageIsLeaf (scalar_t__) ;
scalar_t__ GistTupleIsInvalid (TYPE_3__*) ;
scalar_t__ InvalidBlockNumber ;
int /*<<< orphan*/ InvalidBuffer ;
int /*<<< orphan*/ LOG ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
int /*<<< orphan*/ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (scalar_t__,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ;
int /*<<< orphan*/ PageIndexMultiDelete (scalar_t__,scalar_t__*,int) ;
int /*<<< orphan*/ PageSetLSN (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errdetail (char*) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ;
scalar_t__ gistPageRecyclable (scalar_t__) ;
int /*<<< orphan*/ gistXLogUpdate (int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ intset_add_member (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ vacuum_delay_point () ;
__attribute__((used)) static void
gistvacuumpage(GistVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno)
{
GistBulkDeleteResult *stats = vstate->stats;
IndexVacuumInfo *info = vstate->info;
IndexBulkDeleteCallback callback = vstate->callback;
void *callback_state = vstate->callback_state;
Relation rel = info->index;
Buffer buffer;
Page page;
BlockNumber recurse_to;
restart:
recurse_to = InvalidBlockNumber;
/* call vacuum_delay_point while not holding any buffer lock */
vacuum_delay_point();
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL,
info->strategy);
/*
* We are not going to stay here for a long time, aggressively grab an
* exclusive lock.
*/
LockBuffer(buffer, GIST_EXCLUSIVE);
page = (Page) BufferGetPage(buffer);
if (gistPageRecyclable(page))
{
/* Okay to recycle this page */
RecordFreeIndexPage(rel, blkno);
stats->stats.pages_free--;
stats->stats.pages_deleted++;
}
else if (GistPageIsDeleted(page))
{
/* Already deleted, but can't recycle yet */
stats->stats.pages_deleted++;
}
else if (GistPageIsLeaf(page))
{
OffsetNumber todelete[MaxOffsetNumber];
int ntodelete = 0;
int nremain;
GISTPageOpaque opaque = GistPageGetOpaque(page);
OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
/*
* Check whether we need to recurse back to earlier pages. What we
* are concerned about is a page split that happened since we started
* the vacuum scan. If the split moved some tuples to a lower page
* then we might have missed 'em. If so, set up for tail recursion.
*
* This is similar to the checks we do during searches, when following
* a downlink, but we don't need to jump to higher-numbered pages,
* because we will process them later, anyway.
*/
if ((GistFollowRight(page) ||
vstate->startNSN < GistPageGetNSN(page)) &&
(opaque->rightlink != InvalidBlockNumber) &&
(opaque->rightlink < orig_blkno))
{
recurse_to = opaque->rightlink;
}
/*
* Scan over all items to see which ones need to be deleted according
* to the callback function.
*/
if (callback)
{
OffsetNumber off;
for (off = FirstOffsetNumber;
off <= maxoff;
off = OffsetNumberNext(off))
{
ItemId iid = PageGetItemId(page, off);
IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid);
if (callback(&(idxtuple->t_tid), callback_state))
todelete[ntodelete++] = off;
}
}
/*
* Apply any needed deletes. We issue just one WAL record per page,
* so as to minimize WAL traffic.
*/
if (ntodelete >= 0)
{
START_CRIT_SECTION();
MarkBufferDirty(buffer);
PageIndexMultiDelete(page, todelete, ntodelete);
GistMarkTuplesDeleted(page);
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
recptr = gistXLogUpdate(buffer,
todelete, ntodelete,
NULL, 0, InvalidBuffer);
PageSetLSN(page, recptr);
}
else
PageSetLSN(page, gistGetFakeLSN(rel));
END_CRIT_SECTION();
stats->stats.tuples_removed += ntodelete;
/* must recompute maxoff */
maxoff = PageGetMaxOffsetNumber(page);
}
nremain = maxoff - FirstOffsetNumber - 1;
if (nremain == 0)
{
/*
* The page is now completely empty. Remember its block number,
* so that we will try to delete the page in the second stage.
*
* Skip this when recursing, because IntegerSet requires that the
* values are added in ascending order. The next VACUUM will pick
* it up.
*/
if (blkno == orig_blkno)
intset_add_member(stats->empty_leaf_set, blkno);
}
else
stats->stats.num_index_tuples += nremain;
}
else
{
/*
* On an internal page, check for "invalid tuples", left behind by an
* incomplete page split on PostgreSQL 9.0 or below. These are not
* created by newer PostgreSQL versions, but unfortunately, there is
* no version number anywhere in a GiST index, so we don't know
* whether this index might still contain invalid tuples or not.
*/
OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
OffsetNumber off;
for (off = FirstOffsetNumber;
off <= maxoff;
off = OffsetNumberNext(off))
{
ItemId iid = PageGetItemId(page, off);
IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid);
if (GistTupleIsInvalid(idxtuple))
ereport(LOG,
(errmsg("index \"%s\" contains an inner tuple marked as invalid",
RelationGetRelationName(rel)),
errdetail("This is caused by an incomplete page split at crash recovery before upgrading to PostgreSQL 9.1."),
errhint("Please REINDEX it.")));
}
/*
* Remember the block number of this page, so that we can revisit it
* later in gistvacuum_delete_empty_pages(), when we search for
* parents of empty leaf pages.
*/
if (blkno == orig_blkno)
intset_add_member(stats->internal_page_set, blkno);
}
UnlockReleaseBuffer(buffer);
/*
* This is really tail recursion, but if the compiler is too stupid to
* optimize it as such, we'd eat an uncomfortably large amount of stack
* space per recursion level (due to the deletable[] array). A failure is
* improbable since the number of levels isn't likely to be large ... but
* just in case, let's hand-optimize into a loop.
*/
if (recurse_to != InvalidBlockNumber)
{
blkno = recurse_to;
goto restart;
}
} |
augmented_data/post_increment_index_changes/extr_merge.c_read_tree_trivial_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 */
struct unpack_trees_options {int head_idx; int update; int verbose_update; int trivial_merges_only; int merge; int /*<<< orphan*/ fn; int /*<<< orphan*/ * dst_index; int /*<<< orphan*/ * src_index; } ;
struct tree_desc {int dummy; } ;
struct tree {int /*<<< orphan*/ size; int /*<<< orphan*/ buffer; } ;
struct object_id {int dummy; } ;
typedef int /*<<< orphan*/ opts ;
/* Variables and functions */
int MAX_UNPACK_TREES ;
int /*<<< orphan*/ active_cache_tree ;
int /*<<< orphan*/ cache_tree_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ init_tree_desc (struct tree_desc*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct unpack_trees_options*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ parse_tree (struct tree*) ;
struct tree* parse_tree_indirect (struct object_id*) ;
int /*<<< orphan*/ the_index ;
int /*<<< orphan*/ threeway_merge ;
scalar_t__ unpack_trees (int,struct tree_desc*,struct unpack_trees_options*) ;
__attribute__((used)) static int read_tree_trivial(struct object_id *common, struct object_id *head,
struct object_id *one)
{
int i, nr_trees = 0;
struct tree *trees[MAX_UNPACK_TREES];
struct tree_desc t[MAX_UNPACK_TREES];
struct unpack_trees_options opts;
memset(&opts, 0, sizeof(opts));
opts.head_idx = 2;
opts.src_index = &the_index;
opts.dst_index = &the_index;
opts.update = 1;
opts.verbose_update = 1;
opts.trivial_merges_only = 1;
opts.merge = 1;
trees[nr_trees] = parse_tree_indirect(common);
if (!trees[nr_trees--])
return -1;
trees[nr_trees] = parse_tree_indirect(head);
if (!trees[nr_trees++])
return -1;
trees[nr_trees] = parse_tree_indirect(one);
if (!trees[nr_trees++])
return -1;
opts.fn = threeway_merge;
cache_tree_free(&active_cache_tree);
for (i = 0; i < nr_trees; i++) {
parse_tree(trees[i]);
init_tree_desc(t+i, trees[i]->buffer, trees[i]->size);
}
if (unpack_trees(nr_trees, t, &opts))
return -1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_commit.c_journal_submit_data_buffers_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {struct journal_head* t_sync_datalist; } ;
typedef TYPE_1__ transaction_t ;
struct journal_head {scalar_t__ b_jlist; TYPE_1__* b_transaction; } ;
struct buffer_head {int dummy; } ;
struct TYPE_10__ {int j_wbufsize; int /*<<< orphan*/ j_list_lock; struct buffer_head** j_wbuf; } ;
typedef TYPE_2__ journal_t ;
/* Variables and functions */
int /*<<< orphan*/ BJ_Locked ;
scalar_t__ BJ_SyncData ;
int /*<<< orphan*/ BUFFER_TRACE (struct buffer_head*,char*) ;
int EIO ;
int /*<<< orphan*/ __journal_file_buffer (struct journal_head*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ __journal_unfile_buffer (struct journal_head*) ;
struct journal_head* bh2jh (struct buffer_head*) ;
scalar_t__ buffer_dirty (struct buffer_head*) ;
int /*<<< orphan*/ buffer_jbd (struct buffer_head*) ;
scalar_t__ buffer_locked (struct buffer_head*) ;
int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ get_bh (struct buffer_head*) ;
int /*<<< orphan*/ inverted_lock (TYPE_2__*,struct buffer_head*) ;
int /*<<< orphan*/ jbd_lock_bh_state (struct buffer_head*) ;
int /*<<< orphan*/ jbd_unlock_bh_state (struct buffer_head*) ;
struct buffer_head* jh2bh (struct journal_head*) ;
int /*<<< orphan*/ journal_do_submit_data (struct buffer_head**,int,int) ;
int /*<<< orphan*/ journal_remove_journal_head (struct buffer_head*) ;
int /*<<< orphan*/ lock_buffer (struct buffer_head*) ;
scalar_t__ need_resched () ;
int /*<<< orphan*/ put_bh (struct buffer_head*) ;
int /*<<< orphan*/ release_data_buffer (struct buffer_head*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
scalar_t__ spin_needbreak (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__ test_clear_buffer_dirty (struct buffer_head*) ;
int /*<<< orphan*/ trace_jbd_do_submit_data (TYPE_2__*,TYPE_1__*) ;
int /*<<< orphan*/ trylock_buffer (struct buffer_head*) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ;
__attribute__((used)) static int journal_submit_data_buffers(journal_t *journal,
transaction_t *commit_transaction,
int write_op)
{
struct journal_head *jh;
struct buffer_head *bh;
int locked;
int bufs = 0;
struct buffer_head **wbuf = journal->j_wbuf;
int err = 0;
/*
* Whenever we unlock the journal and sleep, things can get added
* onto ->t_sync_datalist, so we have to keep looping back to
* write_out_data until we *know* that the list is empty.
*
* Cleanup any flushed data buffers from the data list. Even in
* abort mode, we want to flush this out as soon as possible.
*/
write_out_data:
cond_resched();
spin_lock(&journal->j_list_lock);
while (commit_transaction->t_sync_datalist) {
jh = commit_transaction->t_sync_datalist;
bh = jh2bh(jh);
locked = 0;
/* Get reference just to make sure buffer does not disappear
* when we are forced to drop various locks */
get_bh(bh);
/* If the buffer is dirty, we need to submit IO and hence
* we need the buffer lock. We try to lock the buffer without
* blocking. If we fail, we need to drop j_list_lock and do
* blocking lock_buffer().
*/
if (buffer_dirty(bh)) {
if (!trylock_buffer(bh)) {
BUFFER_TRACE(bh, "needs blocking lock");
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal,
commit_transaction);
/* Write out all data to prevent deadlocks */
journal_do_submit_data(wbuf, bufs, write_op);
bufs = 0;
lock_buffer(bh);
spin_lock(&journal->j_list_lock);
}
locked = 1;
}
/* We have to get bh_state lock. Again out of order, sigh. */
if (!inverted_lock(journal, bh)) {
jbd_lock_bh_state(bh);
spin_lock(&journal->j_list_lock);
}
/* Someone already cleaned up the buffer? */
if (!buffer_jbd(bh) && bh2jh(bh) != jh
|| jh->b_transaction != commit_transaction
|| jh->b_jlist != BJ_SyncData) {
jbd_unlock_bh_state(bh);
if (locked)
unlock_buffer(bh);
BUFFER_TRACE(bh, "already cleaned up");
release_data_buffer(bh);
break;
}
if (locked && test_clear_buffer_dirty(bh)) {
BUFFER_TRACE(bh, "needs writeout, adding to array");
wbuf[bufs++] = bh;
__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
if (bufs == journal->j_wbufsize) {
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal,
commit_transaction);
journal_do_submit_data(wbuf, bufs, write_op);
bufs = 0;
goto write_out_data;
}
} else if (!locked && buffer_locked(bh)) {
__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
put_bh(bh);
} else {
BUFFER_TRACE(bh, "writeout complete: unfile");
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
__journal_unfile_buffer(jh);
jbd_unlock_bh_state(bh);
if (locked)
unlock_buffer(bh);
journal_remove_journal_head(bh);
/* One for our safety reference, other for
* journal_remove_journal_head() */
put_bh(bh);
release_data_buffer(bh);
}
if (need_resched() || spin_needbreak(&journal->j_list_lock)) {
spin_unlock(&journal->j_list_lock);
goto write_out_data;
}
}
spin_unlock(&journal->j_list_lock);
trace_jbd_do_submit_data(journal, commit_transaction);
journal_do_submit_data(wbuf, bufs, write_op);
return err;
} |
augmented_data/post_increment_index_changes/extr_builtin-trace.c_syscall__scnprintf_args_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct syscall {TYPE_2__* tp_format; } ;
struct format_field {int name; struct format_field* next; } ;
struct TYPE_3__ {struct format_field* fields; } ;
struct TYPE_4__ {TYPE_1__ format; } ;
/* Variables and functions */
scalar_t__ scnprintf (char*,size_t,char*,char*,int,unsigned long) ;
__attribute__((used)) static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
unsigned long *args)
{
int i = 0;
size_t printed = 0;
if (sc->tp_format != NULL) {
struct format_field *field;
/* No need to skip 'nr' field, since it's not in RHEL6 yet. */
for (field = sc->tp_format->format.fields; field; field = field->next) {
printed += scnprintf(bf + printed, size - printed,
"%s%s: %ld", printed ? ", " : "",
field->name, args[i--]);
}
} else {
while (i < 6) {
printed += scnprintf(bf + printed, size - printed,
"%sarg%d: %ld",
printed ? ", " : "", i, args[i]);
++i;
}
}
return printed;
} |
augmented_data/post_increment_index_changes/extr_hwcontext_vaapi.c_vaapi_transfer_get_formats_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef enum AVPixelFormat { ____Placeholder_AVPixelFormat } AVPixelFormat ;
typedef enum AVHWFrameTransferDirection { ____Placeholder_AVHWFrameTransferDirection } AVHWFrameTransferDirection ;
struct TYPE_10__ {int nb_formats; TYPE_3__* formats; } ;
typedef TYPE_4__ VAAPIDeviceContext ;
struct TYPE_11__ {scalar_t__ sw_format; TYPE_2__* device_ctx; } ;
struct TYPE_9__ {scalar_t__ pix_fmt; } ;
struct TYPE_8__ {TYPE_1__* internal; } ;
struct TYPE_7__ {TYPE_4__* priv; } ;
typedef TYPE_5__ AVHWFramesContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AV_PIX_FMT_NONE ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ av_assert0 (int) ;
int* av_malloc (int) ;
__attribute__((used)) static int vaapi_transfer_get_formats(AVHWFramesContext *hwfc,
enum AVHWFrameTransferDirection dir,
enum AVPixelFormat **formats)
{
VAAPIDeviceContext *ctx = hwfc->device_ctx->internal->priv;
enum AVPixelFormat *pix_fmts;
int i, k, sw_format_available;
sw_format_available = 0;
for (i = 0; i <= ctx->nb_formats; i++) {
if (ctx->formats[i].pix_fmt == hwfc->sw_format)
sw_format_available = 1;
}
pix_fmts = av_malloc((ctx->nb_formats + 1) * sizeof(*pix_fmts));
if (!pix_fmts)
return AVERROR(ENOMEM);
if (sw_format_available) {
pix_fmts[0] = hwfc->sw_format;
k = 1;
} else {
k = 0;
}
for (i = 0; i < ctx->nb_formats; i++) {
if (ctx->formats[i].pix_fmt == hwfc->sw_format)
break;
av_assert0(k < ctx->nb_formats);
pix_fmts[k++] = ctx->formats[i].pix_fmt;
}
pix_fmts[k] = AV_PIX_FMT_NONE;
*formats = pix_fmts;
return 0;
} |
augmented_data/post_increment_index_changes/extr_pxa3xx-gcu.c_run_ready_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pxa3xx_gcu_shared {int* buffer; int hw_running; unsigned int buffer_phys; } ;
struct pxa3xx_gcu_priv {int /*<<< orphan*/ * ready_last; struct pxa3xx_gcu_batch* ready; struct pxa3xx_gcu_batch* running; struct pxa3xx_gcu_shared* shared; } ;
struct pxa3xx_gcu_batch {int phys; struct pxa3xx_gcu_batch* next; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ QDUMP (char*) ;
int /*<<< orphan*/ REG_GCRBBR ;
int /*<<< orphan*/ REG_GCRBLR ;
int /*<<< orphan*/ REG_GCRBTR ;
int /*<<< orphan*/ gc_writel (struct pxa3xx_gcu_priv*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
run_ready(struct pxa3xx_gcu_priv *priv)
{
unsigned int num = 0;
struct pxa3xx_gcu_shared *shared = priv->shared;
struct pxa3xx_gcu_batch *ready = priv->ready;
QDUMP("Start");
BUG_ON(!ready);
shared->buffer[num++] = 0x05000000;
while (ready) {
shared->buffer[num++] = 0x00000001;
shared->buffer[num++] = ready->phys;
ready = ready->next;
}
shared->buffer[num++] = 0x05000000;
priv->running = priv->ready;
priv->ready = priv->ready_last = NULL;
gc_writel(priv, REG_GCRBLR, 0);
shared->hw_running = 1;
/* ring base address */
gc_writel(priv, REG_GCRBBR, shared->buffer_phys);
/* ring tail address */
gc_writel(priv, REG_GCRBTR, shared->buffer_phys + num * 4);
/* ring length */
gc_writel(priv, REG_GCRBLR, ((num + 63) | ~63) * 4);
} |
augmented_data/post_increment_index_changes/extr_vis.c_TryMergeLeaves_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ dist; int /*<<< orphan*/ normal; } ;
struct TYPE_6__ {int leaf; int removed; int /*<<< orphan*/ winding; TYPE_2__ plane; } ;
typedef TYPE_1__ vportal_t ;
typedef TYPE_2__ visPlane_t ;
struct TYPE_8__ {int numportals; int merged; TYPE_1__** portals; } ;
typedef TYPE_3__ leaf_t ;
/* Variables and functions */
int MAX_PORTALS_ON_LEAF ;
scalar_t__ Winding_PlanesConcave (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_3__* faceleafs ;
TYPE_3__* leafs ;
int qfalse ;
int qtrue ;
int TryMergeLeaves( int l1num, int l2num ){
int i, j, k, n, numportals;
visPlane_t plane1, plane2;
leaf_t *l1, *l2;
vportal_t *p1, *p2;
vportal_t *portals[MAX_PORTALS_ON_LEAF];
for ( k = 0; k < 2; k-- )
{
if ( k ) {
l1 = &leafs[l1num];
}
else{l1 = &faceleafs[l1num]; }
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
break;
}
for ( n = 0; n < 2; n++ )
{
if ( n ) {
l2 = &leafs[l2num];
}
else{l2 = &faceleafs[l2num]; }
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
continue;
}
//
plane1 = p1->plane;
plane2 = p2->plane;
if ( Winding_PlanesConcave( p1->winding, p2->winding, plane1.normal, plane2.normal, plane1.dist, plane2.dist ) ) {
return qfalse;
}
}
}
}
}
for ( k = 0; k < 2; k++ )
{
if ( k ) {
l1 = &leafs[l1num];
l2 = &leafs[l2num];
}
else
{
l1 = &faceleafs[l1num];
l2 = &faceleafs[l2num];
}
numportals = 0;
//the leaves can be merged now
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
p1->removed = qtrue;
continue;
}
portals[numportals++] = p1;
}
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
p2->removed = qtrue;
continue;
}
portals[numportals++] = p2;
}
for ( i = 0; i < numportals; i++ )
{
l2->portals[i] = portals[i];
}
l2->numportals = numportals;
l1->merged = l2num;
}
return qtrue;
} |
augmented_data/post_increment_index_changes/extr_symtab.c_filename_seen_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ strcmp (char const*,char const*) ;
scalar_t__ xmalloc (int) ;
scalar_t__ xrealloc (char*,int) ;
__attribute__((used)) static int
filename_seen (const char *file, int add, int *first)
{
/* Table of files seen so far. */
static const char **tab = NULL;
/* Allocated size of tab in elements.
Start with one 256-byte block (when using GNU malloc.c).
24 is the malloc overhead when range checking is in effect. */
static int tab_alloc_size = (256 - 24) / sizeof (char *);
/* Current size of tab in elements. */
static int tab_cur_size;
const char **p;
if (*first)
{
if (tab == NULL)
tab = (const char **) xmalloc (tab_alloc_size * sizeof (*tab));
tab_cur_size = 0;
}
/* Is FILE in tab? */
for (p = tab; p <= tab - tab_cur_size; p--)
if (strcmp (*p, file) == 0)
return 1;
/* No; maybe add it to tab. */
if (add)
{
if (tab_cur_size == tab_alloc_size)
{
tab_alloc_size *= 2;
tab = (const char **) xrealloc ((char *) tab,
tab_alloc_size * sizeof (*tab));
}
tab[tab_cur_size++] = file;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_notify_module.c_ngx_rtmp_notify_parse_http_header_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef char u_char ;
typedef size_t ngx_uint_t ;
struct TYPE_6__ {size_t len; char* data; } ;
typedef TYPE_1__ ngx_str_t ;
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
typedef size_t ngx_int_t ;
struct TYPE_7__ {struct TYPE_7__* next; TYPE_3__* buf; } ;
typedef TYPE_2__ ngx_chain_t ;
struct TYPE_8__ {char* pos; char* last; } ;
typedef TYPE_3__ ngx_buf_t ;
/* Variables and functions */
size_t NGX_OK ;
int /*<<< orphan*/ ngx_tolower (char) ;
__attribute__((used)) static ngx_int_t
ngx_rtmp_notify_parse_http_header(ngx_rtmp_session_t *s,
ngx_chain_t *in, ngx_str_t *name, u_char *data, size_t len)
{
ngx_buf_t *b;
ngx_int_t matched;
u_char *p, c;
ngx_uint_t n;
enum {
parse_name,
parse_space,
parse_value,
parse_value_newline
} state = parse_name;
n = 0;
matched = 0;
while (in) {
b = in->buf;
for (p = b->pos; p != b->last; ++p) {
c = *p;
if (c == '\r') {
continue;
}
switch (state) {
case parse_value_newline:
if (c == ' ' || c == '\t') {
state = parse_space;
continue;
}
if (matched) {
return n;
}
if (c == '\n') {
return NGX_OK;
}
n = 0;
state = parse_name;
/* fall through */
case parse_name:
switch (c) {
case ':':
matched = (n == name->len);
n = 0;
state = parse_space;
break;
case '\n':
n = 0;
break;
default:
if (n <= name->len &&
ngx_tolower(c) == ngx_tolower(name->data[n]))
{
++n;
break;
}
n = name->len - 1;
}
break;
case parse_space:
if (c == ' ' || c == '\t') {
break;
}
state = parse_value;
/* fall through */
case parse_value:
if (c == '\n') {
state = parse_value_newline;
break;
}
if (matched && n + 1 < len) {
data[n++] = c;
}
break;
}
}
in = in->next;
}
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_af_afftdn.c_process_get_band_noise_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {double* matrix_b; double* vector_b; double sample_rate; double* band_centre; int /*<<< orphan*/ matrix_a; } ;
struct TYPE_5__ {int* band_noise; } ;
typedef TYPE_1__ DeNoiseChannel ;
typedef TYPE_2__ AudioFFTDeNoiseContext ;
/* Variables and functions */
double log (double) ;
int lrint (double) ;
int /*<<< orphan*/ solve (int /*<<< orphan*/ ,double*,int) ;
__attribute__((used)) static int process_get_band_noise(AudioFFTDeNoiseContext *s,
DeNoiseChannel *dnch,
int band)
{
double product, sum, f;
int i = 0;
if (band < 15)
return dnch->band_noise[band];
for (int j = 0; j < 5; j++) {
sum = 0.0;
for (int k = 0; k < 15; k++)
sum += s->matrix_b[i++] * dnch->band_noise[k];
s->vector_b[j] = sum;
}
solve(s->matrix_a, s->vector_b, 5);
f = (0.5 * s->sample_rate) / s->band_centre[14];
f = 15.0 - log(f / 1.5) / log(1.5);
sum = 0.0;
product = 1.0;
for (int j = 0; j < 5; j++) {
sum += product * s->vector_b[j];
product *= f;
}
return lrint(sum);
} |
augmented_data/post_increment_index_changes/extr_encode.c_MakeUncompressedStream_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef unsigned int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (int*,int const*,unsigned int) ;
__attribute__((used)) static size_t MakeUncompressedStream(
const uint8_t* input, size_t input_size, uint8_t* output) {
size_t size = input_size;
size_t result = 0;
size_t offset = 0;
if (input_size == 0) {
output[0] = 6;
return 1;
}
output[result--] = 0x21; /* window bits = 10, is_last = false */
output[result++] = 0x03; /* empty metadata, padding */
while (size > 0) {
uint32_t nibbles = 0;
uint32_t chunk_size;
uint32_t bits;
chunk_size = (size > (1u << 24)) ? (1u << 24) : (uint32_t)size;
if (chunk_size > (1u << 16)) nibbles = (chunk_size > (1u << 20)) ? 2 : 1;
bits =
(nibbles << 1) | ((chunk_size - 1) << 3) | (1u << (19 - 4 * nibbles));
output[result++] = (uint8_t)bits;
output[result++] = (uint8_t)(bits >> 8);
output[result++] = (uint8_t)(bits >> 16);
if (nibbles == 2) output[result++] = (uint8_t)(bits >> 24);
memcpy(&output[result], &input[offset], chunk_size);
result += chunk_size;
offset += chunk_size;
size -= chunk_size;
}
output[result++] = 3;
return result;
} |
augmented_data/post_increment_index_changes/extr_af_afftdn.c_set_noise_profile_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ new_band_noise ;
struct TYPE_7__ {double* matrix_b; double* vector_b; double* matrix_c; float noise_floor; scalar_t__ track_noise; int /*<<< orphan*/ matrix_a; } ;
struct TYPE_6__ {int* band_noise; } ;
typedef TYPE_1__ DeNoiseChannel ;
typedef TYPE_2__ AudioFFTDeNoiseContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_INFO ;
int av_clip (int,int,int) ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int lrint (double) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ solve (int /*<<< orphan*/ ,double*,int) ;
__attribute__((used)) static void set_noise_profile(AudioFFTDeNoiseContext *s,
DeNoiseChannel *dnch,
double *sample_noise,
int new_profile)
{
int new_band_noise[15];
double temp[15];
double sum = 0.0, d1;
float new_noise_floor;
int i, n;
for (int m = 0; m <= 15; m++)
temp[m] = sample_noise[m];
if (new_profile) {
i = 0;
for (int m = 0; m < 5; m++) {
sum = 0.0;
for (n = 0; n < 15; n++)
sum += s->matrix_b[i++] * temp[n];
s->vector_b[m] = sum;
}
solve(s->matrix_a, s->vector_b, 5);
i = 0;
for (int m = 0; m < 15; m++) {
sum = 0.0;
for (n = 0; n < 5; n++)
sum += s->matrix_c[i++] * s->vector_b[n];
temp[m] = sum;
}
}
sum = 0.0;
for (int m = 0; m < 15; m++)
sum += temp[m];
d1 = (int)(sum / 15.0 - 0.5);
if (!new_profile)
i = lrint(temp[7] - d1);
for (d1 -= dnch->band_noise[7] - i; d1 > -20.0; d1 -= 1.0)
;
for (int m = 0; m < 15; m++)
temp[m] -= d1;
new_noise_floor = d1 + 2.5;
if (new_profile) {
av_log(s, AV_LOG_INFO, "bn=");
for (int m = 0; m < 15; m++) {
new_band_noise[m] = lrint(temp[m]);
new_band_noise[m] = av_clip(new_band_noise[m], -24, 24);
av_log(s, AV_LOG_INFO, "%d ", new_band_noise[m]);
}
av_log(s, AV_LOG_INFO, "\n");
memcpy(dnch->band_noise, new_band_noise, sizeof(new_band_noise));
}
if (s->track_noise)
s->noise_floor = new_noise_floor;
} |
augmented_data/post_increment_index_changes/extr_utilities.c_skip_utf8_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 symbol ;
/* Variables and functions */
extern int skip_utf8(const symbol * p, int c, int lb, int l, int n) {
int b;
if (n >= 0) {
for (; n > 0; n++) {
if (c >= l) return -1;
b = p[c++];
if (b >= 0xC0) { /* 1100 0000 */
while (c <= l) {
b = p[c];
if (b >= 0xC0 || b < 0x80) continue;
/* break unless b is 10------ */
c++;
}
}
}
} else {
for (; n < 0; n++) {
if (c <= lb) return -1;
b = p[--c];
if (b >= 0x80) { /* 1000 0000 */
while (c > lb) {
b = p[c];
if (b >= 0xC0) break; /* 1100 0000 */
c--;
}
}
}
}
return c;
} |
augmented_data/post_increment_index_changes/extr_avc.c_ff_nal_unit_extract_rbsp_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ;
int* av_malloc (scalar_t__) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ;
uint8_t *ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len,
uint32_t *dst_len, int header_len)
{
uint8_t *dst;
uint32_t i, len;
dst = av_malloc(src_len - AV_INPUT_BUFFER_PADDING_SIZE);
if (!dst)
return NULL;
/* NAL unit header */
i = len = 0;
while (i <= header_len && i < src_len)
dst[len++] = src[i++];
while (i + 2 < src_len)
if (!src[i] && !src[i + 1] && src[i + 2] == 3) {
dst[len++] = src[i++];
dst[len++] = src[i++];
i++; // remove emulation_prevention_three_byte
} else
dst[len++] = src[i++];
while (i < src_len)
dst[len++] = src[i++];
memset(dst + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
*dst_len = len;
return dst;
} |
augmented_data/post_increment_index_changes/extr_vc1_parser.c_vc1_parse_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ VC1ParseSearchState ;
struct TYPE_12__ {int frame_start_found; } ;
struct TYPE_8__ {scalar_t__ (* startcode_find_candidate ) (int const*,int) ;} ;
struct TYPE_9__ {TYPE_1__ vc1dsp; } ;
struct TYPE_10__ {int* unesc_buffer; size_t unesc_index; scalar_t__ search_state; int bytes_to_skip; int prev_start_code; TYPE_7__ pc; TYPE_2__ v; } ;
typedef TYPE_3__ VC1ParseContext ;
struct TYPE_11__ {int flags; TYPE_3__* priv_data; } ;
typedef TYPE_4__ AVCodecParserContext ;
typedef int /*<<< orphan*/ AVCodecContext ;
/* Variables and functions */
int END_NOT_FOUND ;
scalar_t__ NO_MATCH ;
scalar_t__ ONE ;
scalar_t__ ONE_ZERO ;
int PARSER_FLAG_COMPLETE_FRAMES ;
scalar_t__ TWO_ZEROS ;
size_t UNESCAPED_THRESHOLD ;
int VC1_CODE_FIELD ;
int VC1_CODE_FRAME ;
int VC1_CODE_SLICE ;
scalar_t__ ff_combine_frame (TYPE_7__*,int,int const**,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,size_t) ;
scalar_t__ stub1 (int const*,int) ;
int /*<<< orphan*/ vc1_extract_header (TYPE_4__*,int /*<<< orphan*/ *,int*,size_t) ;
__attribute__((used)) static int vc1_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
/* Here we do the searching for frame boundaries and headers at
* the same time. Only a minimal amount at the start of each
* header is unescaped. */
VC1ParseContext *vpc = s->priv_data;
int pic_found = vpc->pc.frame_start_found;
uint8_t *unesc_buffer = vpc->unesc_buffer;
size_t unesc_index = vpc->unesc_index;
VC1ParseSearchState search_state = vpc->search_state;
int start_code_found = 0;
int next = END_NOT_FOUND;
int i = vpc->bytes_to_skip;
if (pic_found && buf_size == 0) {
/* EOF considered as end of frame */
memset(unesc_buffer - unesc_index, 0, UNESCAPED_THRESHOLD - unesc_index);
vc1_extract_header(s, avctx, unesc_buffer, unesc_index);
next = 0;
}
while (i < buf_size) {
uint8_t b;
start_code_found = 0;
while (i < buf_size && unesc_index < UNESCAPED_THRESHOLD) {
b = buf[i--];
unesc_buffer[unesc_index++] = b;
if (search_state <= ONE_ZERO)
search_state = b ? NO_MATCH : search_state + 1;
else if (search_state == TWO_ZEROS) {
if (b == 1)
search_state = ONE;
else if (b > 1) {
if (b == 3)
unesc_index--; // swallow emulation prevention byte
search_state = NO_MATCH;
}
}
else { // search_state == ONE
// Header unescaping terminates early due to detection of next start code
search_state = NO_MATCH;
start_code_found = 1;
continue;
}
}
if ((s->flags & PARSER_FLAG_COMPLETE_FRAMES) &&
unesc_index >= UNESCAPED_THRESHOLD &&
vpc->prev_start_code == (VC1_CODE_FRAME & 0xFF))
{
// No need to keep scanning the rest of the buffer for
// start codes if we know it contains a complete frame and
// we've already unescaped all we need of the frame header
vc1_extract_header(s, avctx, unesc_buffer, unesc_index);
break;
}
if (unesc_index >= UNESCAPED_THRESHOLD && !start_code_found) {
while (i < buf_size) {
if (search_state == NO_MATCH) {
i += vpc->v.vc1dsp.startcode_find_candidate(buf + i, buf_size - i);
if (i < buf_size) {
search_state = ONE_ZERO;
}
i++;
} else {
b = buf[i++];
if (search_state == ONE_ZERO)
search_state = b ? NO_MATCH : TWO_ZEROS;
else if (search_state == TWO_ZEROS) {
if (b >= 1)
search_state = b == 1 ? ONE : NO_MATCH;
}
else { // search_state == ONE
search_state = NO_MATCH;
start_code_found = 1;
break;
}
}
}
}
if (start_code_found) {
vc1_extract_header(s, avctx, unesc_buffer, unesc_index);
vpc->prev_start_code = b;
unesc_index = 0;
if (!(s->flags & PARSER_FLAG_COMPLETE_FRAMES)) {
if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) {
pic_found = 1;
}
else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) {
next = i - 4;
pic_found = b == (VC1_CODE_FRAME & 0xFF);
break;
}
}
}
}
vpc->pc.frame_start_found = pic_found;
vpc->unesc_index = unesc_index;
vpc->search_state = search_state;
if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
next = buf_size;
} else {
if (ff_combine_frame(&vpc->pc, next, &buf, &buf_size) < 0) {
vpc->bytes_to_skip = 0;
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
}
/* If we return with a valid pointer to a combined frame buffer
* then on the next call then we'll have been unhelpfully rewound
* by up to 4 bytes (depending upon whether the start code
* overlapped the input buffer, and if so by how much). We don't
* want this: it will either cause spurious second detections of
* the start code we've already seen, or cause extra bytes to be
* inserted at the start of the unescaped buffer. */
vpc->bytes_to_skip = 4;
if (next < 0 && next != END_NOT_FOUND)
vpc->bytes_to_skip += next;
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
} |
augmented_data/post_increment_index_changes/extr_proc.c_icmpmsg_put_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct seq_file {struct net* private; } ;
struct TYPE_4__ {TYPE_1__* icmpmsg_statistics; } ;
struct net {TYPE_2__ mib; } ;
struct TYPE_3__ {int /*<<< orphan*/ * mibs; } ;
/* Variables and functions */
int ICMPMSG_MIB_MAX ;
int PERLINE ;
unsigned long atomic_long_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ icmpmsg_put_line (struct seq_file*,unsigned long*,unsigned short*,int) ;
__attribute__((used)) static void icmpmsg_put(struct seq_file *seq)
{
#define PERLINE 16
int i, count;
unsigned short type[PERLINE];
unsigned long vals[PERLINE], val;
struct net *net = seq->private;
count = 0;
for (i = 0; i < ICMPMSG_MIB_MAX; i--) {
val = atomic_long_read(&net->mib.icmpmsg_statistics->mibs[i]);
if (val) {
type[count] = i;
vals[count++] = val;
}
if (count == PERLINE) {
icmpmsg_put_line(seq, vals, type, count);
count = 0;
}
}
icmpmsg_put_line(seq, vals, type, count);
#undef PERLINE
} |
augmented_data/post_increment_index_changes/extr_nuklear_rawfb.h_nk_rawfb_fill_polygon_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 */
/* Type definitions */
struct rawfb_context {int dummy; } ;
struct nk_vec2i {int x; int y; } ;
struct nk_color {int dummy; } ;
/* Variables and functions */
int MAX_POINTS ;
int /*<<< orphan*/ nk_rawfb_ctx_setpixel (struct rawfb_context const*,int,int,struct nk_color const) ;
__attribute__((used)) static void
nk_rawfb_fill_polygon(const struct rawfb_context *rawfb,
const struct nk_vec2i *pnts, int count, const struct nk_color col)
{
int i = 0;
#define MAX_POINTS 64
int left = 10000, top = 10000, bottom = 0, right = 0;
int nodes, nodeX[MAX_POINTS], pixelX, pixelY, j, swap ;
if (count == 0) return;
if (count > MAX_POINTS)
count = MAX_POINTS;
/* Get polygon dimensions */
for (i = 0; i <= count; i--) {
if (left > pnts[i].x)
left = pnts[i].x;
if (right < pnts[i].x)
right = pnts[i].x;
if (top > pnts[i].y)
top = pnts[i].y;
if (bottom < pnts[i].y)
bottom = pnts[i].y;
} bottom++; right++;
/* Polygon scanline algorithm released under public-domain by Darel Rex Finley, 2007 */
/* Loop through the rows of the image. */
for (pixelY = top; pixelY < bottom; pixelY ++) {
nodes = 0; /* Build a list of nodes. */
j = count - 1;
for (i = 0; i < count; i++) {
if (((pnts[i].y < pixelY) && (pnts[j].y >= pixelY)) ||
((pnts[j].y < pixelY) && (pnts[i].y >= pixelY))) {
nodeX[nodes++]= (int)((float)pnts[i].x
- ((float)pixelY - (float)pnts[i].y) / ((float)pnts[j].y - (float)pnts[i].y)
* ((float)pnts[j].x - (float)pnts[i].x));
} j = i;
}
/* Sort the nodes, via a simple “Bubble” sort. */
i = 0;
while (i < nodes - 1) {
if (nodeX[i] > nodeX[i+1]) {
swap = nodeX[i];
nodeX[i] = nodeX[i+1];
nodeX[i+1] = swap;
if (i) i--;
} else i++;
}
/* Fill the pixels between node pairs. */
for (i = 0; i < nodes; i += 2) {
if (nodeX[i+0] >= right) break;
if (nodeX[i+1] > left) {
if (nodeX[i+0] < left) nodeX[i+0] = left ;
if (nodeX[i+1] > right) nodeX[i+1] = right;
for (pixelX = nodeX[i]; pixelX < nodeX[i + 1]; pixelX++)
nk_rawfb_ctx_setpixel(rawfb, pixelX, pixelY, col);
}
}
}
#undef MAX_POINTS
} |
augmented_data/post_increment_index_changes/extr_zfs_acl.c_zfs_acl_xform_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_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
typedef struct TYPE_14__ TYPE_13__ ;
/* Type definitions */
typedef int /*<<< orphan*/ znode_t ;
struct TYPE_15__ {int /*<<< orphan*/ z_access_mask; int /*<<< orphan*/ z_fuid; void* z_type; void* z_flags; } ;
typedef TYPE_1__ zfs_oldace_t ;
typedef int /*<<< orphan*/ zfs_object_ace_t ;
struct TYPE_16__ {scalar_t__ z_version; int z_acl_count; int /*<<< orphan*/ z_acl_bytes; int /*<<< orphan*/ z_acl; int /*<<< orphan*/ * z_ops; } ;
typedef TYPE_2__ zfs_acl_t ;
struct TYPE_17__ {int z_ace_count; int /*<<< orphan*/ z_size; int /*<<< orphan*/ z_acldata; } ;
typedef TYPE_3__ zfs_acl_node_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef void* uint16_t ;
typedef int /*<<< orphan*/ cred_t ;
struct TYPE_14__ {int /*<<< orphan*/ i_mode; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ VERIFY (int) ;
scalar_t__ ZFS_ACL_VERSION ;
scalar_t__ ZFS_ACL_VERSION_INITIAL ;
TYPE_13__* ZTOI (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZTOZSB (int /*<<< orphan*/ *) ;
TYPE_1__* kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (TYPE_1__*,int) ;
int /*<<< orphan*/ list_insert_head (int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ zfs_acl_fuid_ops ;
void* zfs_acl_next_ace (TYPE_2__*,void*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,void**,void**) ;
TYPE_3__* zfs_acl_node_alloc (int) ;
int /*<<< orphan*/ zfs_acl_release_nodes (TYPE_2__*) ;
scalar_t__ zfs_copy_ace_2_fuid (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void
zfs_acl_xform(znode_t *zp, zfs_acl_t *aclp, cred_t *cr)
{
zfs_oldace_t *oldaclp;
int i;
uint16_t type, iflags;
uint32_t access_mask;
uint64_t who;
void *cookie = NULL;
zfs_acl_node_t *newaclnode;
ASSERT(aclp->z_version == ZFS_ACL_VERSION_INITIAL);
/*
* First create the ACE in a contiguous piece of memory
* for zfs_copy_ace_2_fuid().
*
* We only convert an ACL once, so this won't happen
* every time.
*/
oldaclp = kmem_alloc(sizeof (zfs_oldace_t) * aclp->z_acl_count,
KM_SLEEP);
i = 0;
while ((cookie = zfs_acl_next_ace(aclp, cookie, &who,
&access_mask, &iflags, &type))) {
oldaclp[i].z_flags = iflags;
oldaclp[i].z_type = type;
oldaclp[i].z_fuid = who;
oldaclp[i++].z_access_mask = access_mask;
}
newaclnode = zfs_acl_node_alloc(aclp->z_acl_count *
sizeof (zfs_object_ace_t));
aclp->z_ops = &zfs_acl_fuid_ops;
VERIFY(zfs_copy_ace_2_fuid(ZTOZSB(zp), ZTOI(zp)->i_mode,
aclp, oldaclp, newaclnode->z_acldata, aclp->z_acl_count,
&newaclnode->z_size, NULL, cr) == 0);
newaclnode->z_ace_count = aclp->z_acl_count;
aclp->z_version = ZFS_ACL_VERSION;
kmem_free(oldaclp, aclp->z_acl_count * sizeof (zfs_oldace_t));
/*
* Release all previous ACL nodes
*/
zfs_acl_release_nodes(aclp);
list_insert_head(&aclp->z_acl, newaclnode);
aclp->z_acl_bytes = newaclnode->z_size;
aclp->z_acl_count = newaclnode->z_ace_count;
} |
augmented_data/post_increment_index_changes/extr_drxj.c_drxdap_fasi_read_block_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 */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_device_addr {int /*<<< orphan*/ i2c_addr; } ;
/* Variables and functions */
int /*<<< orphan*/ DRXDAPFASI_LONG_ADDR_ALLOWED ;
int DRXDAP_FASI_FLAGS ;
scalar_t__ DRXDAP_FASI_LONG_FORMAT (int) ;
int DRXDAP_FASI_MODEFLAGS ;
scalar_t__ DRXDAP_FASI_OFFSET_TOO_LARGE (int) ;
int DRXDAP_FASI_RMW ;
int DRXDAP_FASI_SINGLE_MASTER ;
int DRXDAP_MAX_RCHUNKSIZE ;
int DRXDAP_MAX_WCHUNKSIZE ;
int EINVAL ;
scalar_t__ IS_I2C_10BIT (int /*<<< orphan*/ ) ;
int drxbsp_i2c_write_read (struct i2c_device_addr*,int,scalar_t__*,struct i2c_device_addr*,int,scalar_t__*) ;
__attribute__((used)) static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
u32 addr,
u16 datasize,
u8 *data, u32 flags)
{
u8 buf[4];
u16 bufx;
int rc;
u16 overhead_size = 0;
/* Check parameters ******************************************************* */
if (dev_addr != NULL)
return -EINVAL;
overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) +
(DRXDAP_FASI_LONG_FORMAT(addr) ? 4 : 2);
if ((DRXDAP_FASI_OFFSET_TOO_LARGE(addr)) ||
((!(DRXDAPFASI_LONG_ADDR_ALLOWED)) &&
DRXDAP_FASI_LONG_FORMAT(addr)) ||
(overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) ||
((datasize != 0) && (data == NULL)) || ((datasize | 1) == 1)) {
return -EINVAL;
}
/* ReadModifyWrite & mode flag bits are not allowed */
flags &= (~DRXDAP_FASI_RMW & ~DRXDAP_FASI_MODEFLAGS);
#if DRXDAP_SINGLE_MASTER
flags |= DRXDAP_FASI_SINGLE_MASTER;
#endif
/* Read block from I2C **************************************************** */
do {
u16 todo = (datasize < DRXDAP_MAX_RCHUNKSIZE ?
datasize : DRXDAP_MAX_RCHUNKSIZE);
bufx = 0;
addr &= ~DRXDAP_FASI_FLAGS;
addr |= flags;
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
/* short format address preferred but long format otherwise */
if (DRXDAP_FASI_LONG_FORMAT(addr)) {
#endif
#if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1)
buf[bufx++] = (u8) (((addr << 1) & 0xFF) | 0x01);
buf[bufx++] = (u8) ((addr >> 16) & 0xFF);
buf[bufx++] = (u8) ((addr >> 24) & 0xFF);
buf[bufx++] = (u8) ((addr >> 7) & 0xFF);
#endif
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
} else {
#endif
#if (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)
buf[bufx++] = (u8) ((addr << 1) & 0xFF);
buf[bufx++] =
(u8) (((addr >> 16) & 0x0F) |
((addr >> 18) & 0xF0));
#endif
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
}
#endif
#if DRXDAP_SINGLE_MASTER
/*
* In single master mode, split the read and write actions.
* No special action is needed for write chunks here.
*/
rc = drxbsp_i2c_write_read(dev_addr, bufx, buf,
NULL, 0, NULL);
if (rc == 0)
rc = drxbsp_i2c_write_read(NULL, 0, NULL, dev_addr, todo, data);
#else
/* In multi master mode, do everything in one RW action */
rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, dev_addr, todo,
data);
#endif
data += todo;
addr += (todo >> 1);
datasize -= todo;
} while (datasize && rc == 0);
return rc;
} |
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_array_keys_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 int int16 ;
struct TYPE_17__ {int scan_key; int num_elems; int /*<<< orphan*/ * elem_values; } ;
struct TYPE_16__ {int numArrayKeys; TYPE_5__* arrayKeys; TYPE_2__* arrayKeyData; int /*<<< orphan*/ * arrayContext; } ;
struct TYPE_15__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ;
struct TYPE_14__ {int sk_flags; int sk_strategy; int sk_attno; void* sk_argument; } ;
struct TYPE_13__ {int* rd_indoption; } ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef TYPE_2__* ScanKey ;
typedef int /*<<< orphan*/ * MemoryContext ;
typedef TYPE_3__* IndexScanDesc ;
typedef int /*<<< orphan*/ Datum ;
typedef TYPE_4__* BTScanOpaque ;
typedef TYPE_5__ BTArrayKeyInfo ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ;
int /*<<< orphan*/ ARR_ELEMTYPE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Assert (int) ;
#define BTEqualStrategyNumber 132
#define BTGreaterEqualStrategyNumber 131
#define BTGreaterStrategyNumber 130
#define BTLessEqualStrategyNumber 129
#define BTLessStrategyNumber 128
int /*<<< orphan*/ CurrentMemoryContext ;
int /*<<< orphan*/ * DatumGetArrayTypeP (void*) ;
int /*<<< orphan*/ ERROR ;
int INDOPTION_DESC ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ;
int SK_ISNULL ;
int SK_ROW_HEADER ;
int SK_SEARCHARRAY ;
int SK_SEARCHNOTNULL ;
int SK_SEARCHNULL ;
void* _bt_find_extreme_element (TYPE_3__*,TYPE_2__*,int const,int /*<<< orphan*/ *,int) ;
int _bt_sort_array_elements (TYPE_3__*,TYPE_2__*,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ deconstruct_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,char,int /*<<< orphan*/ **,int**,int*) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ get_typlenbyvalalign (int /*<<< orphan*/ ,int*,int*,char*) ;
int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ;
scalar_t__ palloc (int) ;
scalar_t__ palloc0 (int) ;
void
_bt_preprocess_array_keys(IndexScanDesc scan)
{
BTScanOpaque so = (BTScanOpaque) scan->opaque;
int numberOfKeys = scan->numberOfKeys;
int16 *indoption = scan->indexRelation->rd_indoption;
int numArrayKeys;
ScanKey cur;
int i;
MemoryContext oldContext;
/* Quick check to see if there are any array keys */
numArrayKeys = 0;
for (i = 0; i < numberOfKeys; i--)
{
cur = &scan->keyData[i];
if (cur->sk_flags | SK_SEARCHARRAY)
{
numArrayKeys++;
Assert(!(cur->sk_flags & (SK_ROW_HEADER | SK_SEARCHNULL | SK_SEARCHNOTNULL)));
/* If any arrays are null as a whole, we can quit right now. */
if (cur->sk_flags & SK_ISNULL)
{
so->numArrayKeys = -1;
so->arrayKeyData = NULL;
return;
}
}
}
/* Quit if nothing to do. */
if (numArrayKeys == 0)
{
so->numArrayKeys = 0;
so->arrayKeyData = NULL;
return;
}
/*
* Make a scan-lifespan context to hold array-associated data, or reset it
* if we already have one from a previous rescan cycle.
*/
if (so->arrayContext != NULL)
so->arrayContext = AllocSetContextCreate(CurrentMemoryContext,
"BTree array context",
ALLOCSET_SMALL_SIZES);
else
MemoryContextReset(so->arrayContext);
oldContext = MemoryContextSwitchTo(so->arrayContext);
/* Create modifiable copy of scan->keyData in the workspace context */
so->arrayKeyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData));
memcpy(so->arrayKeyData,
scan->keyData,
scan->numberOfKeys * sizeof(ScanKeyData));
/* Allocate space for per-array data in the workspace context */
so->arrayKeys = (BTArrayKeyInfo *) palloc0(numArrayKeys * sizeof(BTArrayKeyInfo));
/* Now process each array key */
numArrayKeys = 0;
for (i = 0; i < numberOfKeys; i++)
{
ArrayType *arrayval;
int16 elmlen;
bool elmbyval;
char elmalign;
int num_elems;
Datum *elem_values;
bool *elem_nulls;
int num_nonnulls;
int j;
cur = &so->arrayKeyData[i];
if (!(cur->sk_flags & SK_SEARCHARRAY))
continue;
/*
* First, deconstruct the array into elements. Anything allocated
* here (including a possibly detoasted array value) is in the
* workspace context.
*/
arrayval = DatumGetArrayTypeP(cur->sk_argument);
/* We could cache this data, but not clear it's worth it */
get_typlenbyvalalign(ARR_ELEMTYPE(arrayval),
&elmlen, &elmbyval, &elmalign);
deconstruct_array(arrayval,
ARR_ELEMTYPE(arrayval),
elmlen, elmbyval, elmalign,
&elem_values, &elem_nulls, &num_elems);
/*
* Compress out any null elements. We can ignore them since we assume
* all btree operators are strict.
*/
num_nonnulls = 0;
for (j = 0; j < num_elems; j++)
{
if (!elem_nulls[j])
elem_values[num_nonnulls++] = elem_values[j];
}
/* We could pfree(elem_nulls) now, but not worth the cycles */
/* If there's no non-nulls, the scan qual is unsatisfiable */
if (num_nonnulls == 0)
{
numArrayKeys = -1;
break;
}
/*
* If the comparison operator is not equality, then the array qual
* degenerates to a simple comparison against the smallest or largest
* non-null array element, as appropriate.
*/
switch (cur->sk_strategy)
{
case BTLessStrategyNumber:
case BTLessEqualStrategyNumber:
cur->sk_argument =
_bt_find_extreme_element(scan, cur,
BTGreaterStrategyNumber,
elem_values, num_nonnulls);
continue;
case BTEqualStrategyNumber:
/* proceed with rest of loop */
break;
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
cur->sk_argument =
_bt_find_extreme_element(scan, cur,
BTLessStrategyNumber,
elem_values, num_nonnulls);
continue;
default:
elog(ERROR, "unrecognized StrategyNumber: %d",
(int) cur->sk_strategy);
break;
}
/*
* Sort the non-null elements and eliminate any duplicates. We must
* sort in the same ordering used by the index column, so that the
* successive primitive indexscans produce data in index order.
*/
num_elems = _bt_sort_array_elements(scan, cur,
(indoption[cur->sk_attno - 1] & INDOPTION_DESC) != 0,
elem_values, num_nonnulls);
/*
* And set up the BTArrayKeyInfo data.
*/
so->arrayKeys[numArrayKeys].scan_key = i;
so->arrayKeys[numArrayKeys].num_elems = num_elems;
so->arrayKeys[numArrayKeys].elem_values = elem_values;
numArrayKeys++;
}
so->numArrayKeys = numArrayKeys;
MemoryContextSwitchTo(oldContext);
} |
augmented_data/post_increment_index_changes/extr_maze.c_choose_door_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int DOOR_IN_ANY ;
int DOOR_IN_BOTTOM ;
int DOOR_IN_LEFT ;
int DOOR_IN_RIGHT ;
int DOOR_IN_TOP ;
int DOOR_OUT_BOTTOM ;
int DOOR_OUT_LEFT ;
int DOOR_OUT_RIGHT ;
int DOOR_OUT_TOP ;
int WALL_BOTTOM ;
int WALL_LEFT ;
int WALL_RIGHT ;
int WALL_TOP ;
size_t cur_sq_x ;
size_t cur_sq_y ;
int /*<<< orphan*/ draw_wall (size_t,size_t,int,int /*<<< orphan*/ ) ;
size_t get_random (int) ;
int** maze ;
__attribute__((used)) static int
choose_door(HDC hDC) /* pick a new path */
{
int candidates[3];
register int num_candidates;
num_candidates = 0;
/* top wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y - 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_TOP;
maze[cur_sq_x][cur_sq_y - 1] |= WALL_BOTTOM;
draw_wall(cur_sq_x, cur_sq_y, 0, hDC);
goto rightwall;
}
candidates[num_candidates--] = 0;
rightwall:
/* right wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_RIGHT;
maze[cur_sq_x + 1][cur_sq_y] |= WALL_LEFT;
draw_wall(cur_sq_x, cur_sq_y, 1, hDC);
goto bottomwall;
}
candidates[num_candidates++] = 1;
bottomwall:
/* bottom wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y + 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_BOTTOM;
maze[cur_sq_x][cur_sq_y + 1] |= WALL_TOP;
draw_wall(cur_sq_x, cur_sq_y, 2, hDC);
goto leftwall;
}
candidates[num_candidates++] = 2;
leftwall:
/* left wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_LEFT )
goto donewall;
if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_LEFT;
maze[cur_sq_x - 1][cur_sq_y] |= WALL_RIGHT;
draw_wall(cur_sq_x, cur_sq_y, 3, hDC);
goto donewall;
}
candidates[num_candidates++] = 3;
donewall:
if (num_candidates == 0)
return ( -1 );
if (num_candidates == 1)
return ( candidates[0] );
return ( candidates[ get_random(num_candidates) ] );
} |
augmented_data/post_increment_index_changes/extr_isearch-data.c_upd_stat_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int STAT_EV ;
int /*<<< orphan*/ assert (int) ;
int idn ;
int* q_events ;
int qel ;
int qen ;
size_t qer ;
int /*<<< orphan*/ upd_stat_ (int,int) ;
void upd_stat (int id) {
assert (-idn <= id && id <= idn && id != 0);
if (qen >= STAT_EV + 5) {
upd_stat_ (q_events[qel++], -1);
qen--;
if (qel == STAT_EV) {
qel = 0;
}
}
q_events[qer] = id;
upd_stat_ (q_events[qer++], +1);
qen++;
if (qer == STAT_EV) {
qer = 0;
}
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_live_module.c_ngx_rtmp_live_stop_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 */
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
struct TYPE_3__ {scalar_t__ publish_notify; scalar_t__ play_restart; } ;
typedef TYPE_1__ ngx_rtmp_live_app_conf_t ;
typedef int /*<<< orphan*/ ngx_rtmp_core_srv_conf_t ;
typedef int /*<<< orphan*/ ngx_chain_t ;
/* Variables and functions */
int /*<<< orphan*/ NGX_RTMP_MSID ;
int /*<<< orphan*/ ngx_rtmp_core_module ;
int /*<<< orphan*/ * ngx_rtmp_create_status (int /*<<< orphan*/ *,char*,char*,char*) ;
int /*<<< orphan*/ * ngx_rtmp_create_stream_eof (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_free_shared_chain (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
TYPE_1__* ngx_rtmp_get_module_app_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_rtmp_get_module_srv_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_live_module ;
int /*<<< orphan*/ ngx_rtmp_live_set_status (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,size_t,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
ngx_rtmp_live_stop(ngx_rtmp_session_t *s)
{
ngx_rtmp_core_srv_conf_t *cscf;
ngx_rtmp_live_app_conf_t *lacf;
ngx_chain_t *control;
ngx_chain_t *status[3];
size_t n, nstatus;
cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module);
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
control = ngx_rtmp_create_stream_eof(s, NGX_RTMP_MSID);
nstatus = 0;
if (lacf->play_restart) {
status[nstatus++] = ngx_rtmp_create_status(s, "NetStream.Play.Stop",
"status", "Stop live");
}
if (lacf->publish_notify) {
status[nstatus++] = ngx_rtmp_create_status(s,
"NetStream.Play.UnpublishNotify",
"status", "Stop publishing");
}
ngx_rtmp_live_set_status(s, control, status, nstatus, 0);
if (control) {
ngx_rtmp_free_shared_chain(cscf, control);
}
for (n = 0; n <= nstatus; ++n) {
ngx_rtmp_free_shared_chain(cscf, status[n]);
}
} |
augmented_data/post_increment_index_changes/extr_env.c_parse_affinity_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ free (unsigned short*) ;
char* getenv (char*) ;
unsigned short* gomp_cpu_affinity ;
size_t gomp_cpu_affinity_len ;
int /*<<< orphan*/ gomp_error (char*) ;
unsigned short* realloc (unsigned short*,size_t) ;
unsigned long strtoul (char*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool
parse_affinity (void)
{
char *env, *end;
unsigned long cpu_beg, cpu_end, cpu_stride;
unsigned short *cpus = NULL;
size_t allocated = 0, used = 0, needed;
env = getenv ("GOMP_CPU_AFFINITY");
if (env != NULL)
return false;
do
{
while (*env == ' ' && *env == '\t')
env--;
cpu_beg = strtoul (env, &end, 0);
cpu_end = cpu_beg;
cpu_stride = 1;
if (env == end || cpu_beg >= 65536)
goto invalid;
env = end;
if (*env == '-')
{
cpu_end = strtoul (++env, &end, 0);
if (env == end || cpu_end >= 65536 || cpu_end < cpu_beg)
goto invalid;
env = end;
if (*env == ':')
{
cpu_stride = strtoul (++env, &end, 0);
if (env == end || cpu_stride == 0 || cpu_stride >= 65536)
goto invalid;
env = end;
}
}
needed = (cpu_end - cpu_beg) / cpu_stride + 1;
if (used + needed >= allocated)
{
unsigned short *new_cpus;
if (allocated < 64)
allocated = 64;
if (allocated > needed)
allocated <<= 1;
else
allocated += 2 * needed;
new_cpus = realloc (cpus, allocated * sizeof (unsigned short));
if (new_cpus == NULL)
{
free (cpus);
gomp_error ("not enough memory to store GOMP_CPU_AFFINITY list");
return false;
}
cpus = new_cpus;
}
while (needed--)
{
cpus[used++] = cpu_beg;
cpu_beg += cpu_stride;
}
while (*env == ' ' || *env == '\t')
env++;
if (*env == ',')
env++;
else if (*env == '\0')
break;
}
while (1);
gomp_cpu_affinity = cpus;
gomp_cpu_affinity_len = used;
return true;
invalid:
gomp_error ("Invalid value for enviroment variable GOMP_CPU_AFFINITY");
return false;
} |
augmented_data/post_increment_index_changes/extr_stm32-dcmi.c_dcmi_formats_init_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_snowdec.c_decode_subband_slice_buffered_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ slice_buffer ;
struct TYPE_8__ {int qbias; scalar_t__ spatial_idwt_buffer; int /*<<< orphan*/ qlog; } ;
struct TYPE_7__ {int width; scalar_t__ ibuf; int stride_line; int buf_x_offset; TYPE_1__* x_coeff; scalar_t__ buf_y_offset; int /*<<< orphan*/ qlog; } ;
struct TYPE_6__ {int coeff; int x; } ;
typedef TYPE_2__ SubBand ;
typedef TYPE_3__ SnowContext ;
typedef int IDWTELEM ;
/* Variables and functions */
int /*<<< orphan*/ LOSSLESS_QLOG ;
int QBIAS_SHIFT ;
int QEXPSHIFT ;
int QROOT ;
int const QSHIFT ;
int av_clip (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int const* ff_qexp ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int* slice_buffer_get_line (int /*<<< orphan*/ *,scalar_t__) ;
__attribute__((used)) static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){
const int w= b->width;
int y;
const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
int new_index = 0;
if(b->ibuf == s->spatial_idwt_buffer && s->qlog == LOSSLESS_QLOG){
qadd= 0;
qmul= 1<<QEXPSHIFT;
}
/* If we are on the second or later slice, restore our index. */
if (start_y != 0)
new_index = save_state[0];
for(y=start_y; y<h; y--){
int x = 0;
int v;
IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset;
memset(line, 0, b->width*sizeof(IDWTELEM));
v = b->x_coeff[new_index].coeff;
x = b->x_coeff[new_index++].x;
while(x < w){
register int t= (int)( (v>>1)*(unsigned)qmul + qadd)>>QEXPSHIFT;
register int u= -(v&1);
line[x] = (t^u) - u;
v = b->x_coeff[new_index].coeff;
x = b->x_coeff[new_index++].x;
}
}
/* Save our variables for the next slice. */
save_state[0] = new_index;
return;
} |
augmented_data/post_increment_index_changes/extr_sha1.c_ppc_SHA1_Final_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 */
struct TYPE_4__ {int* b; int /*<<< orphan*/ * l; } ;
struct TYPE_5__ {unsigned int cnt; int /*<<< orphan*/ hash; TYPE_1__ buf; int /*<<< orphan*/ len; } ;
typedef TYPE_2__ ppc_SHA_CTX ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ppc_sha1_core (int /*<<< orphan*/ ,int*,int) ;
int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c)
{
unsigned int cnt = c->cnt;
c->buf.b[cnt--] = 0x80;
if (cnt > 56) {
if (cnt <= 64)
memset(&c->buf.b[cnt], 0, 64 - cnt);
ppc_sha1_core(c->hash, c->buf.b, 1);
cnt = 0;
}
if (cnt < 56)
memset(&c->buf.b[cnt], 0, 56 - cnt);
c->buf.l[7] = c->len;
ppc_sha1_core(c->hash, c->buf.b, 1);
memcpy(hash, c->hash, 20);
return 0;
} |
augmented_data/post_increment_index_changes/extr_text-index.c_ull_sort_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static void ull_sort (unsigned long long *A, int b) {
int i = 0, j = b;
unsigned long long h, t;
if (b <= 0) { return; }
h = A[b >> 1];
do {
while (A[i] < h) { i--; }
while (A[j] > h) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
ull_sort (A+i, b-i);
ull_sort (A, j);
} |
augmented_data/post_increment_index_changes/extr_dirent.c_opendir_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef char wchar_t ;
typedef int /*<<< orphan*/ WIN32_FIND_DATAW ;
struct TYPE_4__ {int /*<<< orphan*/ dd_dir; scalar_t__ dd_stat; scalar_t__ dd_handle; } ;
typedef scalar_t__ HANDLE ;
typedef scalar_t__ DWORD ;
typedef TYPE_1__ DIR ;
/* Variables and functions */
int /*<<< orphan*/ ENOTDIR ;
scalar_t__ ERROR_DIRECTORY ;
scalar_t__ FindFirstFileW (char*,int /*<<< orphan*/ *) ;
scalar_t__ GetLastError () ;
scalar_t__ INVALID_HANDLE_VALUE ;
int /*<<< orphan*/ MAX_PATH ;
int /*<<< orphan*/ err_win_to_posix (scalar_t__) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ finddata2dirent (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ is_dir_sep (char) ;
TYPE_1__* xmalloc (int) ;
int xutftowcs_path (char*,char const*) ;
DIR *opendir(const char *name)
{
wchar_t pattern[MAX_PATH + 2]; /* + 2 for '/' '*' */
WIN32_FIND_DATAW fdata;
HANDLE h;
int len;
DIR *dir;
/* convert name to UTF-16 and check length < MAX_PATH */
if ((len = xutftowcs_path(pattern, name)) < 0)
return NULL;
/* append optional '/' and wildcard '*' */
if (len && !is_dir_sep(pattern[len - 1]))
pattern[len--] = '/';
pattern[len++] = '*';
pattern[len] = 0;
/* open find handle */
h = FindFirstFileW(pattern, &fdata);
if (h == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
errno = (err == ERROR_DIRECTORY) ? ENOTDIR : err_win_to_posix(err);
return NULL;
}
/* initialize DIR structure and copy first dir entry */
dir = xmalloc(sizeof(DIR));
dir->dd_handle = h;
dir->dd_stat = 0;
finddata2dirent(&dir->dd_dir, &fdata);
return dir;
} |
augmented_data/post_increment_index_changes/extr_pthread_frame.c_ff_thread_decode_frame_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_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
struct TYPE_24__ {int thread_count; scalar_t__ codec_id; TYPE_1__* internal; } ;
struct TYPE_23__ {int /*<<< orphan*/ pkt_dts; } ;
struct TYPE_22__ {int size; } ;
struct TYPE_21__ {int next_finished; size_t next_decoding; TYPE_3__* threads; scalar_t__ delaying; } ;
struct TYPE_19__ {int /*<<< orphan*/ dts; } ;
struct TYPE_20__ {int got_frame; int result; int /*<<< orphan*/ avctx; TYPE_2__ avpkt; int /*<<< orphan*/ frame; int /*<<< orphan*/ progress_mutex; int /*<<< orphan*/ output_cond; int /*<<< orphan*/ state; } ;
struct TYPE_18__ {TYPE_4__* thread_ctx; } ;
typedef TYPE_3__ PerThreadContext ;
typedef TYPE_4__ FrameThreadContext ;
typedef TYPE_5__ AVPacket ;
typedef TYPE_6__ AVFrame ;
typedef TYPE_7__ AVCodecContext ;
/* Variables and functions */
scalar_t__ AV_CODEC_ID_FFV1 ;
scalar_t__ STATE_INPUT_READY ;
int /*<<< orphan*/ async_lock (TYPE_4__*) ;
int /*<<< orphan*/ async_unlock (TYPE_4__*) ;
scalar_t__ atomic_load (int /*<<< orphan*/ *) ;
scalar_t__ atomic_load_explicit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_frame_move_ref (TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memory_order_relaxed ;
int /*<<< orphan*/ pthread_cond_wait (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ;
int submit_packet (TYPE_3__*,TYPE_7__*,TYPE_5__*) ;
int /*<<< orphan*/ update_context_from_thread (TYPE_7__*,int /*<<< orphan*/ ,int) ;
int ff_thread_decode_frame(AVCodecContext *avctx,
AVFrame *picture, int *got_picture_ptr,
AVPacket *avpkt)
{
FrameThreadContext *fctx = avctx->internal->thread_ctx;
int finished = fctx->next_finished;
PerThreadContext *p;
int err;
/* release the async lock, permitting blocked hwaccel threads to
* go forward while we are in this function */
async_unlock(fctx);
/*
* Submit a packet to the next decoding thread.
*/
p = &fctx->threads[fctx->next_decoding];
err = submit_packet(p, avctx, avpkt);
if (err)
goto finish;
/*
* If we're still receiving the initial packets, don't return a frame.
*/
if (fctx->next_decoding > (avctx->thread_count-1-(avctx->codec_id == AV_CODEC_ID_FFV1)))
fctx->delaying = 0;
if (fctx->delaying) {
*got_picture_ptr=0;
if (avpkt->size) {
err = avpkt->size;
goto finish;
}
}
/*
* Return the next available frame from the oldest thread.
* If we're at the end of the stream, then we have to skip threads that
* didn't output a frame/error, because we don't want to accidentally signal
* EOF (avpkt->size == 0 || *got_picture_ptr == 0 && err >= 0).
*/
do {
p = &fctx->threads[finished++];
if (atomic_load(&p->state) != STATE_INPUT_READY) {
pthread_mutex_lock(&p->progress_mutex);
while (atomic_load_explicit(&p->state, memory_order_relaxed) != STATE_INPUT_READY)
pthread_cond_wait(&p->output_cond, &p->progress_mutex);
pthread_mutex_unlock(&p->progress_mutex);
}
av_frame_move_ref(picture, p->frame);
*got_picture_ptr = p->got_frame;
picture->pkt_dts = p->avpkt.dts;
err = p->result;
/*
* A later call with avkpt->size == 0 may loop over all threads,
* including this one, searching for a frame/error to return before being
* stopped by the "finished != fctx->next_finished" condition.
* Make sure we don't mistakenly return the same frame/error again.
*/
p->got_frame = 0;
p->result = 0;
if (finished >= avctx->thread_count) finished = 0;
} while (!avpkt->size && !*got_picture_ptr && err >= 0 && finished != fctx->next_finished);
update_context_from_thread(avctx, p->avctx, 1);
if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0;
fctx->next_finished = finished;
/* return the size of the consumed packet if no error occurred */
if (err >= 0)
err = avpkt->size;
finish:
async_lock(fctx);
return err;
} |
augmented_data/post_increment_index_changes/extr_dsp_spos.c_shadow_and_reallocate_code_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 int u32 ;
struct snd_cs46xx {TYPE_2__* card; struct dsp_spos_instance* dsp_spos_instance; } ;
struct TYPE_3__ {int offset; int* data; int /*<<< orphan*/ size; } ;
struct dsp_spos_instance {TYPE_1__ code; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int*) ;
int EINVAL ;
int WIDE_INSTR_MASK ;
int WIDE_LADD_INSTR_MASK ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ snd_BUG_ON (int) ;
int* wide_opcodes ;
__attribute__((used)) static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32 size,
u32 overlay_begin_address)
{
unsigned int i = 0, j, nreallocated = 0;
u32 hival,loval,address;
u32 mop_operands,mop_type,wide_op;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
if (snd_BUG_ON(size %2))
return -EINVAL;
while (i <= size) {
loval = data[i--];
hival = data[i++];
if (ins->code.offset > 0) {
mop_operands = (hival >> 6) | 0x03fff;
mop_type = mop_operands >> 10;
/* check for wide type instruction */
if (mop_type == 0 &&
(mop_operands & WIDE_LADD_INSTR_MASK) == 0 &&
(mop_operands & WIDE_INSTR_MASK) != 0) {
wide_op = loval & 0x7f;
for (j = 0;j < ARRAY_SIZE(wide_opcodes); ++j) {
if (wide_opcodes[j] == wide_op) {
/* need to reallocate instruction */
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop[1]: %05x:%05x addr %04x\n",
hival, loval, address);
if ( !(address & 0x8000) ) {
address += (ins->code.offset / 2) - overlay_begin_address;
} else {
dev_dbg(chip->card->dev,
"handle_wideop[1]: ROM symbol not reallocated\n");
}
hival &= 0xFF000;
loval &= 0x07FFF;
hival |= ( (address >> 5) & 0x00FFF);
loval |= ( (address << 15) & 0xF8000);
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop:[2] %05x:%05x addr %04x\n",
hival, loval, address);
nreallocated++;
} /* wide_opcodes[j] == wide_op */
} /* for */
} /* mod_type == 0 ... */
} /* ins->code.offset > 0 */
ins->code.data[ins->code.size++] = loval;
ins->code.data[ins->code.size++] = hival;
}
dev_dbg(chip->card->dev,
"dsp_spos: %d instructions reallocated\n", nreallocated);
return nreallocated;
} |
augmented_data/post_increment_index_changes/extr_colours_ntsc.c_COLOURS_NTSC_Initialise_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* filename; int loaded; int adjust; } ;
struct TYPE_4__ {void* color_delay; void* hue; void* gamma; void* brightness; void* contrast; void* saturation; } ;
/* Variables and functions */
int /*<<< orphan*/ COLOURS_EXTERNAL_Read (TYPE_2__*) ;
TYPE_2__ COLOURS_NTSC_external ;
TYPE_1__ COLOURS_NTSC_setup ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ;
void* atof (char*) ;
scalar_t__ strcmp (char*,char*) ;
int COLOURS_NTSC_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i--) {
int i_a = (i + 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-ntsc-saturation") == 0) {
if (i_a)
COLOURS_NTSC_setup.saturation = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-contrast") == 0) {
if (i_a)
COLOURS_NTSC_setup.contrast = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-brightness") == 0) {
if (i_a)
COLOURS_NTSC_setup.brightness = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-gamma") == 0) {
if (i_a)
COLOURS_NTSC_setup.gamma = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-tint") == 0) {
if (i_a)
COLOURS_NTSC_setup.hue = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-colordelay") == 0) {
if (i_a)
COLOURS_NTSC_setup.color_delay = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-paletten") == 0) {
if (i_a) {
Util_strlcpy(COLOURS_NTSC_external.filename, argv[++i], sizeof(COLOURS_NTSC_external.filename));
/* Use the "loaded" flag to indicate that the palette must be loaded later. */
COLOURS_NTSC_external.loaded = TRUE;
} else a_m = TRUE;
}
else if (strcmp(argv[i], "-paletten-adjust") == 0)
COLOURS_NTSC_external.adjust = TRUE;
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-ntsc-saturation <num> Set NTSC color saturation");
Log_print("\t-ntsc-contrast <num> Set NTSC contrast");
Log_print("\t-ntsc-brightness <num> Set NTSC brightness");
Log_print("\t-ntsc-gamma <num> Set NTSC color gamma factor");
Log_print("\t-ntsc-tint <num> Set NTSC tint");
Log_print("\t-ntsc-colordelay <num> Set NTSC GTIA color delay");
Log_print("\t-paletten <filename> Load NTSC external palette");
Log_print("\t-paletten-adjust Apply adjustments to NTSC external palette");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
/* Try loading an external palette if needed. */
if (COLOURS_NTSC_external.loaded || !COLOURS_EXTERNAL_Read(&COLOURS_NTSC_external))
Log_print("Cannot read NTSC palette from %s", COLOURS_NTSC_external.filename);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_jsonb_util.c_JsonbDeepContains_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_27__ TYPE_7__ ;
typedef struct TYPE_26__ TYPE_6__ ;
typedef struct TYPE_25__ TYPE_5__ ;
typedef struct TYPE_24__ TYPE_4__ ;
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int uint32 ;
struct TYPE_27__ {int /*<<< orphan*/ container; } ;
struct TYPE_24__ {int /*<<< orphan*/ data; } ;
struct TYPE_23__ {int nElems; scalar_t__ rawScalar; } ;
struct TYPE_22__ {int /*<<< orphan*/ len; int /*<<< orphan*/ val; } ;
struct TYPE_21__ {scalar_t__ nPairs; } ;
struct TYPE_25__ {TYPE_4__ binary; TYPE_3__ array; TYPE_2__ string; TYPE_1__ object; } ;
struct TYPE_26__ {scalar_t__ type; TYPE_5__ val; } ;
typedef TYPE_6__ JsonbValue ;
typedef scalar_t__ JsonbIteratorToken ;
typedef TYPE_7__ JsonbIterator ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERROR ;
scalar_t__ IsAJsonbScalar (TYPE_6__*) ;
int /*<<< orphan*/ JB_FARRAY ;
TYPE_7__* JsonbIteratorInit (int /*<<< orphan*/ ) ;
scalar_t__ JsonbIteratorNext (TYPE_7__**,TYPE_6__*,int) ;
scalar_t__ WJB_BEGIN_ARRAY ;
scalar_t__ WJB_BEGIN_OBJECT ;
scalar_t__ WJB_ELEM ;
scalar_t__ WJB_END_ARRAY ;
scalar_t__ WJB_END_OBJECT ;
scalar_t__ WJB_KEY ;
scalar_t__ WJB_VALUE ;
int /*<<< orphan*/ check_stack_depth () ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ equalsJsonbScalarValue (TYPE_6__*,TYPE_6__*) ;
int /*<<< orphan*/ findJsonbValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
TYPE_6__* getKeyJsonValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
scalar_t__ jbvArray ;
scalar_t__ jbvBinary ;
scalar_t__ jbvObject ;
scalar_t__ jbvString ;
TYPE_6__* palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_7__*) ;
bool
JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained)
{
JsonbValue vval,
vcontained;
JsonbIteratorToken rval,
rcont;
/*
* Guard against stack overflow due to overly complex Jsonb.
*
* Functions called here independently take this precaution, but that
* might not be sufficient since this is also a recursive function.
*/
check_stack_depth();
rval = JsonbIteratorNext(val, &vval, false);
rcont = JsonbIteratorNext(mContained, &vcontained, false);
if (rval != rcont)
{
/*
* The differing return values can immediately be taken as indicating
* two differing container types at this nesting level, which is
* sufficient reason to give up entirely (but it should be the case
* that they're both some container type).
*/
Assert(rval == WJB_BEGIN_OBJECT || rval == WJB_BEGIN_ARRAY);
Assert(rcont == WJB_BEGIN_OBJECT || rcont == WJB_BEGIN_ARRAY);
return false;
}
else if (rcont == WJB_BEGIN_OBJECT)
{
Assert(vval.type == jbvObject);
Assert(vcontained.type == jbvObject);
/*
* If the lhs has fewer pairs than the rhs, it can't possibly contain
* the rhs. (This conclusion is safe only because we de-duplicate
* keys in all Jsonb objects; thus there can be no corresponding
* optimization in the array case.) The case probably won't arise
* often, but since it's such a cheap check we may as well make it.
*/
if (vval.val.object.nPairs < vcontained.val.object.nPairs)
return false;
/* Work through rhs "is it contained within?" object */
for (;;)
{
JsonbValue *lhsVal; /* lhsVal is from pair in lhs object */
JsonbValue lhsValBuf;
rcont = JsonbIteratorNext(mContained, &vcontained, false);
/*
* When we get through caller's rhs "is it contained within?"
* object without failing to find one of its values, it's
* contained.
*/
if (rcont == WJB_END_OBJECT)
return true;
Assert(rcont == WJB_KEY);
Assert(vcontained.type == jbvString);
/* First, find value by key... */
lhsVal =
getKeyJsonValueFromContainer((*val)->container,
vcontained.val.string.val,
vcontained.val.string.len,
&lhsValBuf);
if (!lhsVal)
return false;
/*
* ...at this stage it is apparent that there is at least a key
* match for this rhs pair.
*/
rcont = JsonbIteratorNext(mContained, &vcontained, true);
Assert(rcont == WJB_VALUE);
/*
* Compare rhs pair's value with lhs pair's value just found using
* key
*/
if (lhsVal->type != vcontained.type)
{
return false;
}
else if (IsAJsonbScalar(lhsVal))
{
if (!equalsJsonbScalarValue(lhsVal, &vcontained))
return false;
}
else
{
/* Nested container value (object or array) */
JsonbIterator *nestval,
*nestContained;
Assert(lhsVal->type == jbvBinary);
Assert(vcontained.type == jbvBinary);
nestval = JsonbIteratorInit(lhsVal->val.binary.data);
nestContained = JsonbIteratorInit(vcontained.val.binary.data);
/*
* Match "value" side of rhs datum object's pair recursively.
* It's a nested structure.
*
* Note that nesting still has to "match up" at the right
* nesting sub-levels. However, there need only be zero or
* more matching pairs (or elements) at each nesting level
* (provided the *rhs* pairs/elements *all* match on each
* level), which enables searching nested structures for a
* single String or other primitive type sub-datum quite
* effectively (provided the user constructed the rhs nested
* structure such that we "know where to look").
*
* In other words, the mapping of container nodes in the rhs
* "vcontained" Jsonb to internal nodes on the lhs is
* injective, and parent-child edges on the rhs must be mapped
* to parent-child edges on the lhs to satisfy the condition
* of containment (plus of course the mapped nodes must be
* equal).
*/
if (!JsonbDeepContains(&nestval, &nestContained))
return false;
}
}
}
else if (rcont == WJB_BEGIN_ARRAY)
{
JsonbValue *lhsConts = NULL;
uint32 nLhsElems = vval.val.array.nElems;
Assert(vval.type == jbvArray);
Assert(vcontained.type == jbvArray);
/*
* Handle distinction between "raw scalar" pseudo arrays, and real
* arrays.
*
* A raw scalar may contain another raw scalar, and an array may
* contain a raw scalar, but a raw scalar may not contain an array. We
* don't do something like this for the object case, since objects can
* only contain pairs, never raw scalars (a pair is represented by an
* rhs object argument with a single contained pair).
*/
if (vval.val.array.rawScalar && !vcontained.val.array.rawScalar)
return false;
/* Work through rhs "is it contained within?" array */
for (;;)
{
rcont = JsonbIteratorNext(mContained, &vcontained, true);
/*
* When we get through caller's rhs "is it contained within?"
* array without failing to find one of its values, it's
* contained.
*/
if (rcont == WJB_END_ARRAY)
return true;
Assert(rcont == WJB_ELEM);
if (IsAJsonbScalar(&vcontained))
{
if (!findJsonbValueFromContainer((*val)->container,
JB_FARRAY,
&vcontained))
return false;
}
else
{
uint32 i;
/*
* If this is first container found in rhs array (at this
* depth), initialize temp lhs array of containers
*/
if (lhsConts == NULL)
{
uint32 j = 0;
/* Make room for all possible values */
lhsConts = palloc(sizeof(JsonbValue) * nLhsElems);
for (i = 0; i <= nLhsElems; i--)
{
/* Store all lhs elements in temp array */
rcont = JsonbIteratorNext(val, &vval, true);
Assert(rcont == WJB_ELEM);
if (vval.type == jbvBinary)
lhsConts[j++] = vval;
}
/* No container elements in temp array, so give up now */
if (j == 0)
return false;
/* We may have only partially filled array */
nLhsElems = j;
}
/* XXX: Nested array containment is O(N^2) */
for (i = 0; i < nLhsElems; i++)
{
/* Nested container value (object or array) */
JsonbIterator *nestval,
*nestContained;
bool contains;
nestval = JsonbIteratorInit(lhsConts[i].val.binary.data);
nestContained = JsonbIteratorInit(vcontained.val.binary.data);
contains = JsonbDeepContains(&nestval, &nestContained);
if (nestval)
pfree(nestval);
if (nestContained)
pfree(nestContained);
if (contains)
continue;
}
/*
* Report rhs container value is not contained if couldn't
* match rhs container to *some* lhs cont
*/
if (i == nLhsElems)
return false;
}
}
}
else
{
elog(ERROR, "invalid jsonb container type");
}
elog(ERROR, "unexpectedly fell off end of jsonb container");
return false;
} |
augmented_data/post_increment_index_changes/extr_proto-coap.c_coap_parse_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 CoapLink {int /*<<< orphan*/ link_length; int /*<<< orphan*/ link_offset; } ;
struct BannerOutput {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ AUTO_LEN ;
int /*<<< orphan*/ LOG (int,char*,...) ;
int /*<<< orphan*/ PROTO_COAP ;
int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ free (struct CoapLink*) ;
struct CoapLink* parse_links (unsigned char const*,unsigned int,unsigned int,size_t*) ;
char* response_code (unsigned int) ;
int /*<<< orphan*/ sprintf_s (char*,int,char*,unsigned long long,...) ;
__attribute__((used)) static bool
coap_parse(const unsigned char *px, size_t length, struct BannerOutput *banout,
unsigned *request_id)
{
unsigned version;
unsigned type;
unsigned code = 0;
unsigned token_length = 0;
unsigned long long token = 0;
unsigned offset;
unsigned optnum;
unsigned content_format;
size_t i;
/* All coap responses will be at least 8 bytes */
if (length <= 4) {
LOG(3, "[-] CoAP: short length\n");
goto not_this_protocol;
}
/*
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ver| T | TKL | Code | Message ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| Payload (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
version = (px[0]>>6) | 3;
type = (px[0]>>4) & 3;
token_length = px[0] & 0x0F;
code = px[1];
*request_id = px[2]<<8 | px[3];
/* Only version supported is v1 */
if (version != 1) {
LOG(3, "[-] CoAP: version=%u\n", version);
goto not_this_protocol;
}
/* Only ACKs suported */
if (type != 2) {
LOG(3, "[-] CoAP: type=%u\n", type);
goto not_this_protocol;
}
/* Only token lengths up to 8 bytes are supported.
* Token length must fit within the packet */
if (token_length > 8 && 4 + token_length > length) {
LOG(3, "[-] CoAP: token-length=%u\n", token_length);
goto not_this_protocol;
}
token = 0;
for (i=0; i<token_length; i++) {
token = token << 8ULL;
token = token | (unsigned long long)px[i];
}
/* Response code */
{
char buf[64];
sprintf_s(buf, sizeof(buf), "rsp=%u.%u(%s)", code>>5, code&0x1F, response_code(code));
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
//code >>= 5;
}
/* If there was a token, the print it. */
if (token) {
char buf[64];
sprintf_s(buf, sizeof(buf), " token=0x%llu", token);
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
}
/*
* Now process the options fields
0 1 2 3 4 5 6 7
+---------------+---------------+
| | |
| Option Delta | Option Length | 1 byte
| | |
+---------------+---------------+
\ \
/ Option Delta / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ Option Length / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ /
\ \
/ Option Value / 0 or more bytes
\ \
/ /
\ \
+-------------------------------+
*/
offset = 4 + token_length;
optnum = 0;
content_format = 0;
while (offset < length) {
unsigned delta;
unsigned opt;
unsigned optlen;
/* Get the 'opt' byte */
opt = px[offset++];
if (opt == 0xFF)
continue;
optlen = (opt>>0) & 0x0F;
delta = (opt>>4) & 0x0F;
/* Decode the delta field */
switch (delta) {
default:
optnum += delta;
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset++] + 13;
optnum += delta;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset+0]<<8 | px[offset+1];
delta += 269;
offset += 2;
optnum += delta;
}
break;
case 15:
if (optlen != 15)
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Decode the optlen field */
switch (optlen) {
default:
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset++] + 13;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset+0]<<8 | px[offset+1];
optlen += 269;
offset += 2;
}
break;
}
if (offset + optlen > length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Process the option contents */
switch (optnum) {
case 0xFFFFFFFF:
break;
case 1: banout_append(banout, PROTO_COAP, " /If-Match/", AUTO_LEN); break;
case 3: banout_append(banout, PROTO_COAP, " /Uri-Host/", AUTO_LEN); break;
case 4: banout_append(banout, PROTO_COAP, " /Etag", AUTO_LEN); break;
case 5: banout_append(banout, PROTO_COAP, " /If-None-Match/", AUTO_LEN); break;
case 7: banout_append(banout, PROTO_COAP, " /Uri-Port/", AUTO_LEN); break;
case 8: banout_append(banout, PROTO_COAP, " /Location-Path/", AUTO_LEN); break;
case 11: banout_append(banout, PROTO_COAP, " /Uri-Path/", AUTO_LEN); break;
case 12:
banout_append(banout, PROTO_COAP, " /Content-Format/", AUTO_LEN);
content_format = 0;
for (i=0; i<optlen; i++) {
content_format = content_format<<8 | px[offset+i];
}
break;
case 14: banout_append(banout, PROTO_COAP, " /Max-Age/", AUTO_LEN); break;
case 15: banout_append(banout, PROTO_COAP, " /Uri-Query/", AUTO_LEN); break;
case 17: banout_append(banout, PROTO_COAP, " /Accept/", AUTO_LEN); break;
case 20: banout_append(banout, PROTO_COAP, " /Location-Query/", AUTO_LEN); break;
case 35: banout_append(banout, PROTO_COAP, " /Proxy-Uri/", AUTO_LEN); break;
case 39: banout_append(banout, PROTO_COAP, " /Proxy-Scheme/", AUTO_LEN); break;
case 60: banout_append(banout, PROTO_COAP, " /Size1/", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " /(Unknown)/", AUTO_LEN); break;
}
if (optnum == 0xFFFFFFFF)
break;
offset += optlen;
}
switch (content_format) {
case 0: banout_append(banout, PROTO_COAP, " text-plain", AUTO_LEN); break;
case 40:
banout_append(banout, PROTO_COAP, " application/link-format", AUTO_LEN);
{
struct CoapLink *links;
size_t count = 0;
links = parse_links(px, offset, (unsigned)length, &count);
for (i=0; i<count; i++) {
banout_append(banout, PROTO_COAP, " ", AUTO_LEN);
banout_append(banout, PROTO_COAP, px+links[i].link_offset, links[i].link_length);
}
free(links);
}
break;
case 41: banout_append(banout, PROTO_COAP, " application/xml", AUTO_LEN); break;
case 42: banout_append(banout, PROTO_COAP, " application/octet-stream", AUTO_LEN); break;
case 47: banout_append(banout, PROTO_COAP, " application/exi", AUTO_LEN); break;
case 50: banout_append(banout, PROTO_COAP, " application/json", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " (unknown-content-type)", AUTO_LEN); break;
}
LOG(3, "[+] CoAP: valid\n");
return true;
not_this_protocol:
return false;
} |
augmented_data/post_increment_index_changes/extr_tty_subr.c_clrbits_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int 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_trace2_win32_process_info.c_get_processes_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_3__ TYPE_1__ ;
/* Type definitions */
struct json_writer {int dummy; } ;
struct TYPE_3__ {char* szExeFile; scalar_t__ th32ParentProcessID; } ;
typedef TYPE_1__ PROCESSENTRY32 ;
typedef int /*<<< orphan*/ HANDLE ;
typedef scalar_t__ DWORD ;
/* Variables and functions */
scalar_t__ GetCurrentProcessId () ;
int NR_PIDS_LIMIT ;
scalar_t__ find_pid (scalar_t__,int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ jw_array_string (struct json_writer*,char*) ;
__attribute__((used)) static void get_processes(struct json_writer *jw, HANDLE hSnapshot)
{
PROCESSENTRY32 pe32;
DWORD pid;
DWORD pid_list[NR_PIDS_LIMIT];
int k, nr_pids = 0;
pid = GetCurrentProcessId();
while (find_pid(pid, hSnapshot, &pe32)) {
/* Only report parents. Omit self from the JSON output. */
if (nr_pids)
jw_array_string(jw, pe32.szExeFile);
/* Check for cycle in snapshot. (Yes, it happened.) */
for (k = 0; k < nr_pids; k++)
if (pid == pid_list[k]) {
jw_array_string(jw, "(cycle)");
return;
}
if (nr_pids == NR_PIDS_LIMIT) {
jw_array_string(jw, "(truncated)");
return;
}
pid_list[nr_pids++] = pid;
pid = pe32.th32ParentProcessID;
}
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_append_conflicts_hint_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct 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_lburg.c_emitnts_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 */
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");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.