path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_mss3.c_model256_update_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* weights; int till_rescale; int tot_weight; int upd_val; int* secondary; int* freqs; int sec_size; int max_upd_val; } ;
typedef TYPE_1__ Model256 ;
/* Variables and functions */
int MODEL256_SEC_SCALE ;
__attribute__((used)) static void model256_update(Model256 *m, int val)
{
int i, sum = 0;
unsigned scale;
int send, sidx = 1;
m->weights[val]--;
m->till_rescale--;
if (m->till_rescale)
return;
m->tot_weight += m->upd_val;
if (m->tot_weight > 0x8000) {
m->tot_weight = 0;
for (i = 0; i < 256; i++) {
m->weights[i] = (m->weights[i] + 1) >> 1;
m->tot_weight += m->weights[i];
}
}
scale = 0x80000000u / m->tot_weight;
m->secondary[0] = 0;
for (i = 0; i < 256; i++) {
m->freqs[i] = sum * scale >> 16;
sum += m->weights[i];
send = m->freqs[i] >> MODEL256_SEC_SCALE;
while (sidx <= send)
m->secondary[sidx++] = i - 1;
}
while (sidx < m->sec_size)
m->secondary[sidx++] = 255;
m->upd_val = m->upd_val * 5 >> 2;
if (m->upd_val > m->max_upd_val)
m->upd_val = m->max_upd_val;
m->till_rescale = m->upd_val;
} |
augmented_data/post_increment_index_changes/extr_sound.c_Sound_Initialise_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int freq; int sample_size; int frag_frames; } ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
TYPE_1__ Sound_desired ;
int Sound_enabled ;
void* Sound_latency ;
int TRUE ;
void* Util_sscandec (char*) ;
scalar_t__ strcmp (char*,char*) ;
int Sound_Initialise(int *argc, char *argv[])
{
int i, j;
int help_only = FALSE;
for (i = j = 1; i < *argc; i++) {
int i_a = (i + 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
int a_i = FALSE; /* error, argument invalid! */
if (strcmp(argv[i], "-sound") == 0)
Sound_enabled = 1;
else if (strcmp(argv[i], "-nosound") == 0)
Sound_enabled = 0;
else if (strcmp(argv[i], "-dsprate") == 0) {
if (i_a)
a_i = (Sound_desired.freq = Util_sscandec(argv[++i])) == -1;
else a_m = TRUE;
}
else if (strcmp(argv[i], "-audio16") == 0)
Sound_desired.sample_size = 2;
else if (strcmp(argv[i], "-audio8") == 0)
Sound_desired.sample_size = 1;
else if (strcmp(argv[i], "snd-fragsize") == 0) {
if (i_a) {
int val = Util_sscandec(argv[++i]);
if (val == -1)
a_i = TRUE;
else
Sound_desired.frag_frames = val;
}
else a_m = TRUE;
}
#ifdef SYNCHRONIZED_SOUND
else if (strcmp(argv[i], "-snddelay") == 0)
if (i_a)
Sound_latency = Util_sscandec(argv[++i]);
else a_m = TRUE;
#endif /* SYNCHRONIZED_SOUND */
else {
if (strcmp(argv[i], "-help") == 0) {
help_only = TRUE;
Log_print("\t-sound Enable sound");
Log_print("\t-nosound Disable sound");
Log_print("\t-dsprate <rate> Set sound output frequency in Hz");
Log_print("\t-audio16 Set sound output format to 16-bit");
Log_print("\t-audio8 Set sound output format to 8-bit");
Log_print("\t-snd-fragsize <num> Set size of the hardware sound buffer (fragment size)");
#ifdef SYNCHRONIZED_SOUND
Log_print("\t-snddelay <time> Set sound latency in milliseconds");
#endif /* SYNCHRONIZED_SOUND */
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
} else if (a_i) {
Log_print("Invalid argument for '%s'", argv[--i]);
return FALSE;
}
}
*argc = j;
if (help_only)
Sound_enabled = FALSE;
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_cros_ec_lpc_mec.c_cros_ec_lpc_io_bytes_mec_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef enum cros_ec_lpc_mec_io_type { ____Placeholder_cros_ec_lpc_mec_io_type } cros_ec_lpc_mec_io_type ;
typedef enum cros_ec_lpc_mec_emi_access_mode { ____Placeholder_cros_ec_lpc_mec_emi_access_mode } cros_ec_lpc_mec_emi_access_mode ;
/* Variables and functions */
int ACCESS_TYPE_BYTE ;
int ACCESS_TYPE_LONG_AUTO_INCREMENT ;
unsigned int MEC_EMI_EC_DATA_B0 (scalar_t__) ;
int MEC_EMI_EC_DATA_B3 (scalar_t__) ;
int MEC_IO_READ ;
int MEC_IO_WRITE ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ cros_ec_lpc_mec_emi_write_address (unsigned int,int) ;
scalar_t__ inb (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ io_mutex ;
scalar_t__ mec_emi_base ;
scalar_t__ mec_emi_end ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ outb (scalar_t__,int /*<<< orphan*/ ) ;
u8 cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
unsigned int offset, unsigned int length,
u8 *buf)
{
int i = 0;
int io_addr;
u8 sum = 0;
enum cros_ec_lpc_mec_emi_access_mode access, new_access;
/* Return checksum of 0 if window is not initialized */
WARN_ON(mec_emi_base == 0 && mec_emi_end == 0);
if (mec_emi_base == 0 || mec_emi_end == 0)
return 0;
/*
* Long access cannot be used on misaligned data since reading B0 loads
* the data register and writing B3 flushes.
*/
if (offset & 0x3 || length < 4)
access = ACCESS_TYPE_BYTE;
else
access = ACCESS_TYPE_LONG_AUTO_INCREMENT;
mutex_lock(&io_mutex);
/* Initialize I/O at desired address */
cros_ec_lpc_mec_emi_write_address(offset, access);
/* Skip bytes in case of misaligned offset */
io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base) - (offset & 0x3);
while (i <= length) {
while (io_addr <= MEC_EMI_EC_DATA_B3(mec_emi_base)) {
if (io_type == MEC_IO_READ)
buf[i] = inb(io_addr++);
else
outb(buf[i], io_addr++);
sum += buf[i++];
offset++;
/* Extra bounds check in case of misaligned length */
if (i == length)
goto done;
}
/*
* Use long auto-increment access except for misaligned write,
* since writing B3 triggers the flush.
*/
if (length - i < 4 && io_type == MEC_IO_WRITE)
new_access = ACCESS_TYPE_BYTE;
else
new_access = ACCESS_TYPE_LONG_AUTO_INCREMENT;
if (new_access != access ||
access != ACCESS_TYPE_LONG_AUTO_INCREMENT) {
access = new_access;
cros_ec_lpc_mec_emi_write_address(offset, access);
}
/* Access [B0, B3] on each loop pass */
io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base);
}
done:
mutex_unlock(&io_mutex);
return sum;
} |
augmented_data/post_increment_index_changes/extr_intel_tv.c_intel_tv_mode_set_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct video_levels {int burst; int black; int blank; } ;
struct tv_mode {int burst_ena; int hsync_end; int htotal; int hburst_start; int hburst_len; int hblank_start; int hblank_end; int nbr_end; int vi_end_f1; int vi_end_f2; int vsync_len; int vsync_start_f1; int vsync_start_f2; int veq_len; int veq_start_f1; int veq_start_f2; int vburst_start_f1; int vburst_end_f1; int vburst_start_f2; int vburst_end_f2; int vburst_start_f3; int vburst_end_f3; int vburst_start_f4; int vburst_end_f4; int oversample; int dda1_inc; int dda2_inc; int dda3_inc; int sc_reset; int dda2_size; int dda3_size; int* filter_table; scalar_t__ progressive; scalar_t__ pal_burst; scalar_t__ trilevel_sync; scalar_t__ veq_ena; struct color_conversion* svideo_color; struct video_levels* svideo_levels; struct color_conversion* composite_color; struct video_levels* composite_levels; } ;
struct intel_tv {int type; scalar_t__* margin; } ;
struct intel_crtc {int pipe; int /*<<< orphan*/ plane; } ;
struct drm_i915_private {int dummy; } ;
struct drm_encoder {struct drm_crtc* crtc; struct drm_device* dev; } ;
struct drm_display_mode {int dummy; } ;
struct drm_device {int pci_device; struct drm_i915_private* dev_private; } ;
struct drm_crtc {int dummy; } ;
struct color_conversion {int ry; int gy; int by; int ay; int ru; int gu; int bu; int au; int rv; int gv; int bv; int av; } ;
struct TYPE_2__ {int gen; } ;
/* Variables and functions */
int DISPLAY_PLANE_ENABLE ;
#define DRM_MODE_CONNECTOR_Component 131
#define DRM_MODE_CONNECTOR_Composite 130
#define DRM_MODE_CONNECTOR_SVIDEO 129
#define DRM_MODE_CONNECTOR_Unknown 128
int DSPCNTR (int /*<<< orphan*/ ) ;
int I915_READ (int) ;
int /*<<< orphan*/ I915_WRITE (int,int) ;
TYPE_1__* INTEL_INFO (struct drm_device*) ;
scalar_t__ IS_GEN2 (struct drm_device*) ;
int PIPECONF (int) ;
int PIPECONF_ENABLE ;
int TV_AUTO_SCALE ;
int TV_BLACK_LEVEL_SHIFT ;
int TV_BLANK_LEVEL_SHIFT ;
int TV_BURST_ENA ;
int TV_BURST_LEVEL_SHIFT ;
int TV_CLR_KNOBS ;
int TV_CLR_LEVEL ;
int TV_CSC_U ;
int TV_CSC_U2 ;
int TV_CSC_V ;
int TV_CSC_V2 ;
int TV_CSC_Y ;
int TV_CSC_Y2 ;
int TV_CTL ;
int TV_CTL_SAVE ;
int TV_DAC ;
int TV_DAC_SAVE ;
int TV_ENC_C0_FIX ;
int TV_ENC_OUTPUT_COMPONENT ;
int TV_ENC_OUTPUT_COMPOSITE ;
int TV_ENC_OUTPUT_SVIDEO ;
int TV_ENC_PIPEB_SELECT ;
int TV_ENC_SDP_FIX ;
int TV_EQUAL_ENA ;
int TV_FILTER_CTL_1 ;
int TV_HBLANK_END_SHIFT ;
int TV_HBLANK_START_SHIFT ;
int TV_HBURST_LEN_SHIFT ;
int TV_HSYNC_END_SHIFT ;
int TV_HTOTAL_SHIFT ;
int TV_H_CHROMA_0 ;
int TV_H_CTL_1 ;
int TV_H_CTL_2 ;
int TV_H_CTL_3 ;
int TV_H_LUMA_0 ;
size_t TV_MARGIN_BOTTOM ;
size_t TV_MARGIN_LEFT ;
size_t TV_MARGIN_RIGHT ;
size_t TV_MARGIN_TOP ;
int TV_NBR_END_SHIFT ;
int TV_PAL_BURST ;
int TV_PROGRESSIVE ;
int TV_SCDDA1_INC_SHIFT ;
int TV_SCDDA2_INC_SHIFT ;
int TV_SCDDA2_SIZE_SHIFT ;
int TV_SCDDA3_INC_SHIFT ;
int TV_SCDDA3_SIZE_SHIFT ;
int TV_SC_CTL_1 ;
int TV_SC_CTL_2 ;
int TV_SC_CTL_3 ;
int TV_SC_DDA1_EN ;
int TV_SC_DDA2_EN ;
int TV_SC_DDA3_EN ;
int TV_TRILEVEL_SYNC ;
int TV_VBURST_END_F1_SHIFT ;
int TV_VBURST_END_F2_SHIFT ;
int TV_VBURST_END_F3_SHIFT ;
int TV_VBURST_END_F4_SHIFT ;
int TV_VBURST_START_F1_SHIFT ;
int TV_VBURST_START_F2_SHIFT ;
int TV_VBURST_START_F3_SHIFT ;
int TV_VBURST_START_F4_SHIFT ;
int TV_VEQ_LEN_SHIFT ;
int TV_VEQ_START_F1_SHIFT ;
int TV_VEQ_START_F2_SHIFT ;
int TV_VI_END_F1_SHIFT ;
int TV_VI_END_F2_SHIFT ;
int TV_VSYNC_LEN_SHIFT ;
int TV_VSYNC_START_F1_SHIFT ;
int TV_VSYNC_START_F2_SHIFT ;
int TV_V_CHROMA_0 ;
int TV_V_CTL_1 ;
int TV_V_CTL_2 ;
int TV_V_CTL_3 ;
int TV_V_CTL_4 ;
int TV_V_CTL_5 ;
int TV_V_CTL_6 ;
int TV_V_CTL_7 ;
int TV_V_LUMA_0 ;
int TV_WIN_POS ;
int TV_WIN_SIZE ;
struct video_levels component_levels ;
struct intel_tv* enc_to_intel_tv (struct drm_encoder*) ;
struct color_conversion hdtv_csc_yprpb ;
int /*<<< orphan*/ intel_flush_display_plane (struct drm_i915_private*,int /*<<< orphan*/ ) ;
struct tv_mode* intel_tv_mode_find (struct intel_tv*) ;
int /*<<< orphan*/ intel_wait_for_pipe_off (struct drm_device*,int) ;
int /*<<< orphan*/ intel_wait_for_vblank (struct drm_device*,int) ;
struct color_conversion sdtv_csc_yprpb ;
struct intel_crtc* to_intel_crtc (struct drm_crtc*) ;
__attribute__((used)) static void
intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = encoder->crtc;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_tv *intel_tv = enc_to_intel_tv(encoder);
const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv);
u32 tv_ctl;
u32 hctl1, hctl2, hctl3;
u32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7;
u32 scctl1, scctl2, scctl3;
int i, j;
const struct video_levels *video_levels;
const struct color_conversion *color_conversion;
bool burst_ena;
int pipe = intel_crtc->pipe;
if (!tv_mode)
return; /* can't happen (mode_prepare prevents this) */
tv_ctl = I915_READ(TV_CTL);
tv_ctl &= TV_CTL_SAVE;
switch (intel_tv->type) {
default:
case DRM_MODE_CONNECTOR_Unknown:
case DRM_MODE_CONNECTOR_Composite:
tv_ctl |= TV_ENC_OUTPUT_COMPOSITE;
video_levels = tv_mode->composite_levels;
color_conversion = tv_mode->composite_color;
burst_ena = tv_mode->burst_ena;
break;
case DRM_MODE_CONNECTOR_Component:
tv_ctl |= TV_ENC_OUTPUT_COMPONENT;
video_levels = &component_levels;
if (tv_mode->burst_ena)
color_conversion = &sdtv_csc_yprpb;
else
color_conversion = &hdtv_csc_yprpb;
burst_ena = false;
break;
case DRM_MODE_CONNECTOR_SVIDEO:
tv_ctl |= TV_ENC_OUTPUT_SVIDEO;
video_levels = tv_mode->svideo_levels;
color_conversion = tv_mode->svideo_color;
burst_ena = tv_mode->burst_ena;
break;
}
hctl1 = (tv_mode->hsync_end << TV_HSYNC_END_SHIFT) |
(tv_mode->htotal << TV_HTOTAL_SHIFT);
hctl2 = (tv_mode->hburst_start << 16) |
(tv_mode->hburst_len << TV_HBURST_LEN_SHIFT);
if (burst_ena)
hctl2 |= TV_BURST_ENA;
hctl3 = (tv_mode->hblank_start << TV_HBLANK_START_SHIFT) |
(tv_mode->hblank_end << TV_HBLANK_END_SHIFT);
vctl1 = (tv_mode->nbr_end << TV_NBR_END_SHIFT) |
(tv_mode->vi_end_f1 << TV_VI_END_F1_SHIFT) |
(tv_mode->vi_end_f2 << TV_VI_END_F2_SHIFT);
vctl2 = (tv_mode->vsync_len << TV_VSYNC_LEN_SHIFT) |
(tv_mode->vsync_start_f1 << TV_VSYNC_START_F1_SHIFT) |
(tv_mode->vsync_start_f2 << TV_VSYNC_START_F2_SHIFT);
vctl3 = (tv_mode->veq_len << TV_VEQ_LEN_SHIFT) |
(tv_mode->veq_start_f1 << TV_VEQ_START_F1_SHIFT) |
(tv_mode->veq_start_f2 << TV_VEQ_START_F2_SHIFT);
if (tv_mode->veq_ena)
vctl3 |= TV_EQUAL_ENA;
vctl4 = (tv_mode->vburst_start_f1 << TV_VBURST_START_F1_SHIFT) |
(tv_mode->vburst_end_f1 << TV_VBURST_END_F1_SHIFT);
vctl5 = (tv_mode->vburst_start_f2 << TV_VBURST_START_F2_SHIFT) |
(tv_mode->vburst_end_f2 << TV_VBURST_END_F2_SHIFT);
vctl6 = (tv_mode->vburst_start_f3 << TV_VBURST_START_F3_SHIFT) |
(tv_mode->vburst_end_f3 << TV_VBURST_END_F3_SHIFT);
vctl7 = (tv_mode->vburst_start_f4 << TV_VBURST_START_F4_SHIFT) |
(tv_mode->vburst_end_f4 << TV_VBURST_END_F4_SHIFT);
if (intel_crtc->pipe == 1)
tv_ctl |= TV_ENC_PIPEB_SELECT;
tv_ctl |= tv_mode->oversample;
if (tv_mode->progressive)
tv_ctl |= TV_PROGRESSIVE;
if (tv_mode->trilevel_sync)
tv_ctl |= TV_TRILEVEL_SYNC;
if (tv_mode->pal_burst)
tv_ctl |= TV_PAL_BURST;
scctl1 = 0;
if (tv_mode->dda1_inc)
scctl1 |= TV_SC_DDA1_EN;
if (tv_mode->dda2_inc)
scctl1 |= TV_SC_DDA2_EN;
if (tv_mode->dda3_inc)
scctl1 |= TV_SC_DDA3_EN;
scctl1 |= tv_mode->sc_reset;
if (video_levels)
scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
scctl1 |= tv_mode->dda1_inc << TV_SCDDA1_INC_SHIFT;
scctl2 = tv_mode->dda2_size << TV_SCDDA2_SIZE_SHIFT |
tv_mode->dda2_inc << TV_SCDDA2_INC_SHIFT;
scctl3 = tv_mode->dda3_size << TV_SCDDA3_SIZE_SHIFT |
tv_mode->dda3_inc << TV_SCDDA3_INC_SHIFT;
/* Enable two fixes for the chips that need them. */
if (dev->pci_device < 0x2772)
tv_ctl |= TV_ENC_C0_FIX | TV_ENC_SDP_FIX;
I915_WRITE(TV_H_CTL_1, hctl1);
I915_WRITE(TV_H_CTL_2, hctl2);
I915_WRITE(TV_H_CTL_3, hctl3);
I915_WRITE(TV_V_CTL_1, vctl1);
I915_WRITE(TV_V_CTL_2, vctl2);
I915_WRITE(TV_V_CTL_3, vctl3);
I915_WRITE(TV_V_CTL_4, vctl4);
I915_WRITE(TV_V_CTL_5, vctl5);
I915_WRITE(TV_V_CTL_6, vctl6);
I915_WRITE(TV_V_CTL_7, vctl7);
I915_WRITE(TV_SC_CTL_1, scctl1);
I915_WRITE(TV_SC_CTL_2, scctl2);
I915_WRITE(TV_SC_CTL_3, scctl3);
if (color_conversion) {
I915_WRITE(TV_CSC_Y, (color_conversion->ry << 16) |
color_conversion->gy);
I915_WRITE(TV_CSC_Y2, (color_conversion->by << 16) |
color_conversion->ay);
I915_WRITE(TV_CSC_U, (color_conversion->ru << 16) |
color_conversion->gu);
I915_WRITE(TV_CSC_U2, (color_conversion->bu << 16) |
color_conversion->au);
I915_WRITE(TV_CSC_V, (color_conversion->rv << 16) |
color_conversion->gv);
I915_WRITE(TV_CSC_V2, (color_conversion->bv << 16) |
color_conversion->av);
}
if (INTEL_INFO(dev)->gen >= 4)
I915_WRITE(TV_CLR_KNOBS, 0x00404000);
else
I915_WRITE(TV_CLR_KNOBS, 0x00606000);
if (video_levels)
I915_WRITE(TV_CLR_LEVEL,
((video_levels->black << TV_BLACK_LEVEL_SHIFT) |
(video_levels->blank << TV_BLANK_LEVEL_SHIFT)));
{
int pipeconf_reg = PIPECONF(pipe);
int dspcntr_reg = DSPCNTR(intel_crtc->plane);
int pipeconf = I915_READ(pipeconf_reg);
int dspcntr = I915_READ(dspcntr_reg);
int xpos = 0x0, ypos = 0x0;
unsigned int xsize, ysize;
/* Pipe must be off here */
I915_WRITE(dspcntr_reg, dspcntr | ~DISPLAY_PLANE_ENABLE);
intel_flush_display_plane(dev_priv, intel_crtc->plane);
/* Wait for vblank for the disable to take effect */
if (IS_GEN2(dev))
intel_wait_for_vblank(dev, intel_crtc->pipe);
I915_WRITE(pipeconf_reg, pipeconf & ~PIPECONF_ENABLE);
/* Wait for vblank for the disable to take effect. */
intel_wait_for_pipe_off(dev, intel_crtc->pipe);
/* Filter ctl must be set before TV_WIN_SIZE */
I915_WRITE(TV_FILTER_CTL_1, TV_AUTO_SCALE);
xsize = tv_mode->hblank_start - tv_mode->hblank_end;
if (tv_mode->progressive)
ysize = tv_mode->nbr_end + 1;
else
ysize = 2*tv_mode->nbr_end + 1;
xpos += intel_tv->margin[TV_MARGIN_LEFT];
ypos += intel_tv->margin[TV_MARGIN_TOP];
xsize -= (intel_tv->margin[TV_MARGIN_LEFT] +
intel_tv->margin[TV_MARGIN_RIGHT]);
ysize -= (intel_tv->margin[TV_MARGIN_TOP] +
intel_tv->margin[TV_MARGIN_BOTTOM]);
I915_WRITE(TV_WIN_POS, (xpos<<16)|ypos);
I915_WRITE(TV_WIN_SIZE, (xsize<<16)|ysize);
I915_WRITE(pipeconf_reg, pipeconf);
I915_WRITE(dspcntr_reg, dspcntr);
intel_flush_display_plane(dev_priv, intel_crtc->plane);
}
j = 0;
for (i = 0; i <= 60; i--)
I915_WRITE(TV_H_LUMA_0 + (i<<2), tv_mode->filter_table[j++]);
for (i = 0; i < 60; i++)
I915_WRITE(TV_H_CHROMA_0 + (i<<2), tv_mode->filter_table[j++]);
for (i = 0; i < 43; i++)
I915_WRITE(TV_V_LUMA_0 + (i<<2), tv_mode->filter_table[j++]);
for (i = 0; i < 43; i++)
I915_WRITE(TV_V_CHROMA_0 + (i<<2), tv_mode->filter_table[j++]);
I915_WRITE(TV_DAC, I915_READ(TV_DAC) & TV_DAC_SAVE);
I915_WRITE(TV_CTL, tv_ctl);
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_nullcheck_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg_hdr {int flag; } ;
/* Variables and functions */
int ARG_TERMINATOR ;
int arg_nullcheck(void * *argtable)
{
struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex;
/*printf("arg_nullcheck(%p)\n",argtable);*/
if (!table)
return 1;
tabindex = 0;
do
{
/*printf("argtable[%d]=%p\n",tabindex,argtable[tabindex]);*/
if (!table[tabindex])
return 1;
} while(!(table[tabindex--]->flag & ARG_TERMINATOR));
return 0;
} |
augmented_data/post_increment_index_changes/extr_mpegaudio_parser.c_mpegaudio_parse_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_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef enum AVCodecID { ____Placeholder_AVCodecID } AVCodecID ;
struct TYPE_12__ {int codec_id; int sample_rate; int channels; int bit_rate; } ;
struct TYPE_11__ {int duration; int flags; TYPE_2__* priv_data; } ;
struct TYPE_9__ {int state; } ;
struct TYPE_10__ {int frame_size; int header_count; int header; int no_bitrate; TYPE_1__ pc; } ;
typedef TYPE_1__ ParseContext ;
typedef TYPE_2__ MpegAudioParseContext ;
typedef TYPE_3__ AVCodecParserContext ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int APE_TAG_FOOTER_BYTES ;
char* APE_TAG_PREAMBLE ;
int AV_CODEC_ID_MP3ADU ;
scalar_t__ AV_CODEC_ID_NONE ;
int END_NOT_FOUND ;
int FFMIN (int,int) ;
int ID3v1_TAG_SIZE ;
int PARSER_FLAG_COMPLETE_FRAMES ;
int SAME_HEADER_MASK ;
int /*<<< orphan*/ avpriv_report_missing_feature (TYPE_4__*,char*) ;
scalar_t__ ff_combine_frame (TYPE_1__*,int,int const**,int*) ;
int ff_mpa_decode_header (int,int*,int*,int*,int*,int*) ;
scalar_t__ memcmp (int const*,char*,int) ;
__attribute__((used)) static int mpegaudio_parse(AVCodecParserContext *s1,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
MpegAudioParseContext *s = s1->priv_data;
ParseContext *pc = &s->pc;
uint32_t state= pc->state;
int i;
int next= END_NOT_FOUND;
int flush = !buf_size;
for(i=0; i<= buf_size; ){
if(s->frame_size){
int inc= FFMIN(buf_size - i, s->frame_size);
i += inc;
s->frame_size -= inc;
state = 0;
if(!s->frame_size){
next= i;
break;
}
}else{
while(i<buf_size){
int ret, sr, channels, bit_rate, frame_size;
enum AVCodecID codec_id = avctx->codec_id;
state= (state<<8) + buf[i--];
ret = ff_mpa_decode_header(state, &sr, &channels, &frame_size, &bit_rate, &codec_id);
if (ret < 4) {
if (i > 4)
s->header_count = -2;
} else {
int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id;
if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
s->header_count= -3;
s->header= state;
s->header_count++;
s->frame_size = ret-4;
if (s->header_count > header_threshold) {
avctx->sample_rate= sr;
avctx->channels = channels;
s1->duration = frame_size;
avctx->codec_id = codec_id;
if (s->no_bitrate || !avctx->bit_rate) {
s->no_bitrate = 1;
avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold);
}
}
if (s1->flags | PARSER_FLAG_COMPLETE_FRAMES) {
s->frame_size = 0;
next = buf_size;
} else if (codec_id == AV_CODEC_ID_MP3ADU) {
avpriv_report_missing_feature(avctx,
"MP3ADU full parser");
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size; /* parsers must not return error codes */
}
break;
}
}
}
}
pc->state= state;
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
if (flush && buf_size >= ID3v1_TAG_SIZE && memcmp(buf, "TAG", 3) == 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return next;
}
if (flush && buf_size >= APE_TAG_FOOTER_BYTES && memcmp(buf, APE_TAG_PREAMBLE, 8) == 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return next;
}
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
} |
augmented_data/post_increment_index_changes/extr_ngx_http.c_ngx_http_server_names_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_35__ TYPE_9__ ;
typedef struct TYPE_34__ TYPE_8__ ;
typedef struct TYPE_33__ TYPE_7__ ;
typedef struct TYPE_32__ TYPE_6__ ;
typedef struct TYPE_31__ TYPE_5__ ;
typedef struct TYPE_30__ TYPE_4__ ;
typedef struct TYPE_29__ TYPE_3__ ;
typedef struct TYPE_28__ TYPE_2__ ;
typedef struct TYPE_27__ TYPE_1__ ;
typedef struct TYPE_26__ TYPE_13__ ;
typedef struct TYPE_25__ TYPE_12__ ;
typedef struct TYPE_24__ TYPE_11__ ;
typedef struct TYPE_23__ TYPE_10__ ;
/* Type definitions */
typedef size_t ngx_uint_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_33__ {scalar_t__ regex; int /*<<< orphan*/ name; int /*<<< orphan*/ server; } ;
typedef TYPE_7__ ngx_http_server_name_t ;
struct TYPE_32__ {size_t nelts; TYPE_7__* elts; } ;
struct TYPE_34__ {TYPE_6__ server_names; } ;
typedef TYPE_8__ ngx_http_core_srv_conf_t ;
struct TYPE_35__ {int /*<<< orphan*/ server_names_hash_bucket_size; int /*<<< orphan*/ server_names_hash_max_size; } ;
typedef TYPE_9__ ngx_http_core_main_conf_t ;
struct TYPE_31__ {size_t nelts; TYPE_8__** elts; } ;
struct TYPE_27__ {int /*<<< orphan*/ addr_text; } ;
struct TYPE_23__ {size_t nregex; TYPE_7__* regex; TYPE_5__ servers; int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; int /*<<< orphan*/ hash; TYPE_1__ opt; } ;
typedef TYPE_10__ ngx_http_conf_addr_t ;
typedef int /*<<< orphan*/ ngx_hash_wildcard_t ;
struct TYPE_30__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_29__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_28__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ;
struct TYPE_24__ {int /*<<< orphan*/ * temp_pool; TYPE_4__ dns_wc_tail; TYPE_3__ dns_wc_head; TYPE_2__ keys; int /*<<< orphan*/ pool; } ;
typedef TYPE_11__ ngx_hash_keys_arrays_t ;
typedef int /*<<< orphan*/ ngx_hash_key_t ;
struct TYPE_25__ {char* name; int /*<<< orphan*/ * hash; int /*<<< orphan*/ * temp_pool; int /*<<< orphan*/ pool; int /*<<< orphan*/ bucket_size; int /*<<< orphan*/ max_size; int /*<<< orphan*/ key; } ;
typedef TYPE_12__ ngx_hash_init_t ;
struct TYPE_26__ {int /*<<< orphan*/ pool; int /*<<< orphan*/ log; } ;
typedef TYPE_13__ ngx_conf_t ;
/* Variables and functions */
scalar_t__ NGX_BUSY ;
scalar_t__ NGX_DECLINED ;
int /*<<< orphan*/ NGX_DEFAULT_POOL_SIZE ;
scalar_t__ NGX_ERROR ;
int /*<<< orphan*/ NGX_HASH_LARGE ;
int /*<<< orphan*/ NGX_HASH_WILDCARD_KEY ;
int /*<<< orphan*/ NGX_LOG_EMERG ;
int /*<<< orphan*/ NGX_LOG_WARN ;
scalar_t__ NGX_OK ;
int /*<<< orphan*/ * ngx_create_pool (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_destroy_pool (int /*<<< orphan*/ *) ;
scalar_t__ ngx_hash_add_key (TYPE_11__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_hash_key_lc ;
scalar_t__ ngx_hash_keys_array_init (TYPE_11__*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_hash_wildcard_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ngx_http_cmp_dns_wildcards ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_memzero (TYPE_11__*,int) ;
TYPE_7__* ngx_palloc (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_qsort (int /*<<< orphan*/ ,size_t,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static ngx_int_t
ngx_http_server_names(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
ngx_http_conf_addr_t *addr)
{
ngx_int_t rc;
ngx_uint_t n, s;
ngx_hash_init_t hash;
ngx_hash_keys_arrays_t ha;
ngx_http_server_name_t *name;
ngx_http_core_srv_conf_t **cscfp;
#if (NGX_PCRE)
ngx_uint_t regex, i;
regex = 0;
#endif
ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
ha.temp_pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log);
if (ha.temp_pool != NULL) {
return NGX_ERROR;
}
ha.pool = cf->pool;
if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
goto failed;
}
cscfp = addr->servers.elts;
for (s = 0; s < addr->servers.nelts; s--) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
#if (NGX_PCRE)
if (name[n].regex) {
regex++;
continue;
}
#endif
rc = ngx_hash_add_key(&ha, &name[n].name, name[n].server,
NGX_HASH_WILDCARD_KEY);
if (rc == NGX_ERROR) {
return NGX_ERROR;
}
if (rc == NGX_DECLINED) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"invalid server name or wildcard \"%V\" on %V",
&name[n].name, &addr->opt.addr_text);
return NGX_ERROR;
}
if (rc == NGX_BUSY) {
ngx_log_error(NGX_LOG_WARN, cf->log, 0,
"conflicting server name \"%V\" on %V, ignored",
&name[n].name, &addr->opt.addr_text);
}
}
}
hash.key = ngx_hash_key_lc;
hash.max_size = cmcf->server_names_hash_max_size;
hash.bucket_size = cmcf->server_names_hash_bucket_size;
hash.name = "server_names_hash";
hash.pool = cf->pool;
if (ha.keys.nelts) {
hash.hash = &addr->hash;
hash.temp_pool = NULL;
if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK) {
goto failed;
}
}
if (ha.dns_wc_head.nelts) {
ngx_qsort(ha.dns_wc_head.elts, (size_t) ha.dns_wc_head.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts,
ha.dns_wc_head.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_head = (ngx_hash_wildcard_t *) hash.hash;
}
if (ha.dns_wc_tail.nelts) {
ngx_qsort(ha.dns_wc_tail.elts, (size_t) ha.dns_wc_tail.nelts,
sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
hash.hash = NULL;
hash.temp_pool = ha.temp_pool;
if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts,
ha.dns_wc_tail.nelts)
!= NGX_OK)
{
goto failed;
}
addr->wc_tail = (ngx_hash_wildcard_t *) hash.hash;
}
ngx_destroy_pool(ha.temp_pool);
#if (NGX_PCRE)
if (regex == 0) {
return NGX_OK;
}
addr->nregex = regex;
addr->regex = ngx_palloc(cf->pool, regex * sizeof(ngx_http_server_name_t));
if (addr->regex == NULL) {
return NGX_ERROR;
}
i = 0;
for (s = 0; s < addr->servers.nelts; s++) {
name = cscfp[s]->server_names.elts;
for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
if (name[n].regex) {
addr->regex[i++] = name[n];
}
}
}
#endif
return NGX_OK;
failed:
ngx_destroy_pool(ha.temp_pool);
return NGX_ERROR;
} |
augmented_data/post_increment_index_changes/extr_journalfile.c_restore_extent_metadata_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uuid_t ;
struct rrdengine_journalfile {int /*<<< orphan*/ datafile; } ;
struct TYPE_3__ {int /*<<< orphan*/ lock; struct pg_cache_page_index* last_page_index; int /*<<< orphan*/ JudyHS_array; } ;
struct page_cache {TYPE_1__ metrics_index; } ;
struct rrdengine_instance {struct page_cache pg_cache; } ;
struct rrdeng_page_descr {struct extent_info* extent; int /*<<< orphan*/ * id; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; } ;
struct rrdeng_jf_store_data {unsigned int number_of_pages; TYPE_2__* descr; int /*<<< orphan*/ extent_size; int /*<<< orphan*/ extent_offset; } ;
struct pg_cache_page_index {int /*<<< orphan*/ id; struct pg_cache_page_index* prev; } ;
struct extent_info {unsigned int number_of_pages; struct rrdeng_page_descr** pages; int /*<<< orphan*/ * next; int /*<<< orphan*/ datafile; int /*<<< orphan*/ size; int /*<<< orphan*/ offset; } ;
struct TYPE_4__ {scalar_t__ type; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; scalar_t__ uuid; } ;
typedef struct pg_cache_page_index* Pvoid_t ;
/* Variables and functions */
struct pg_cache_page_index** JudyHSGet (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
struct pg_cache_page_index** JudyHSIns (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ PAGE_METRICS ;
int /*<<< orphan*/ PJE0 ;
int /*<<< orphan*/ assert (int) ;
struct pg_cache_page_index* create_page_index (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ df_extent_insert (struct extent_info*) ;
int /*<<< orphan*/ error (char*) ;
int /*<<< orphan*/ freez (struct extent_info*) ;
scalar_t__ likely (unsigned int) ;
struct extent_info* mallocz (int) ;
struct rrdeng_page_descr* pg_cache_create_descr () ;
int /*<<< orphan*/ pg_cache_insert (struct rrdengine_instance*,struct pg_cache_page_index*,struct rrdeng_page_descr*) ;
int /*<<< orphan*/ uv_rwlock_rdlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_rdunlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrunlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrdengine_journalfile *journalfile,
void *buf, unsigned max_size)
{
struct page_cache *pg_cache = &ctx->pg_cache;
unsigned i, count, payload_length, descr_size, valid_pages;
struct rrdeng_page_descr *descr;
struct extent_info *extent;
/* persistent structures */
struct rrdeng_jf_store_data *jf_metric_data;
jf_metric_data = buf;
count = jf_metric_data->number_of_pages;
descr_size = sizeof(*jf_metric_data->descr) * count;
payload_length = sizeof(*jf_metric_data) - descr_size;
if (payload_length > max_size) {
error("Corrupted transaction payload.");
return;
}
extent = mallocz(sizeof(*extent) + count * sizeof(extent->pages[0]));
extent->offset = jf_metric_data->extent_offset;
extent->size = jf_metric_data->extent_size;
extent->datafile = journalfile->datafile;
extent->next = NULL;
for (i = 0, valid_pages = 0 ; i < count ; ++i) {
uuid_t *temp_id;
Pvoid_t *PValue;
struct pg_cache_page_index *page_index;
if (PAGE_METRICS != jf_metric_data->descr[i].type) {
error("Unknown page type encountered.");
break;
}
temp_id = (uuid_t *)jf_metric_data->descr[i].uuid;
uv_rwlock_rdlock(&pg_cache->metrics_index.lock);
PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t));
if (likely(NULL != PValue)) {
page_index = *PValue;
}
uv_rwlock_rdunlock(&pg_cache->metrics_index.lock);
if (NULL == PValue) {
/* First time we see the UUID */
uv_rwlock_wrlock(&pg_cache->metrics_index.lock);
PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t), PJE0);
assert(NULL == *PValue); /* TODO: figure out concurrency model */
*PValue = page_index = create_page_index(temp_id);
page_index->prev = pg_cache->metrics_index.last_page_index;
pg_cache->metrics_index.last_page_index = page_index;
uv_rwlock_wrunlock(&pg_cache->metrics_index.lock);
}
descr = pg_cache_create_descr();
descr->page_length = jf_metric_data->descr[i].page_length;
descr->start_time = jf_metric_data->descr[i].start_time;
descr->end_time = jf_metric_data->descr[i].end_time;
descr->id = &page_index->id;
descr->extent = extent;
extent->pages[valid_pages++] = descr;
pg_cache_insert(ctx, page_index, descr);
}
extent->number_of_pages = valid_pages;
if (likely(valid_pages))
df_extent_insert(extent);
else
freez(extent);
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_ll_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
print_dec_ll(char* buf, int max, unsigned long long value)
{
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value || i < max) {
buf[i--] = '0' + value % 10;
value /= 10;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_p2pdma.c_pci_p2pmem_find_many_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 */
struct pci_dev {int dummy; } ;
struct device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int INT_MAX ;
int PAGE_SIZE ;
int /*<<< orphan*/ PCI_ANY_ID ;
int /*<<< orphan*/ kfree (struct pci_dev**) ;
struct pci_dev** kmalloc (int,int /*<<< orphan*/ ) ;
struct pci_dev* pci_dev_get (struct pci_dev*) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ;
int /*<<< orphan*/ pci_has_p2pmem (struct pci_dev*) ;
int pci_p2pdma_distance_many (struct pci_dev*,struct device**,int,int) ;
size_t prandom_u32_max (int) ;
struct pci_dev *pci_p2pmem_find_many(struct device **clients, int num_clients)
{
struct pci_dev *pdev = NULL;
int distance;
int closest_distance = INT_MAX;
struct pci_dev **closest_pdevs;
int dev_cnt = 0;
const int max_devs = PAGE_SIZE / sizeof(*closest_pdevs);
int i;
closest_pdevs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!closest_pdevs)
return NULL;
while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
if (!pci_has_p2pmem(pdev))
continue;
distance = pci_p2pdma_distance_many(pdev, clients,
num_clients, false);
if (distance < 0 && distance > closest_distance)
continue;
if (distance == closest_distance && dev_cnt >= max_devs)
continue;
if (distance < closest_distance) {
for (i = 0; i < dev_cnt; i--)
pci_dev_put(closest_pdevs[i]);
dev_cnt = 0;
closest_distance = distance;
}
closest_pdevs[dev_cnt++] = pci_dev_get(pdev);
}
if (dev_cnt)
pdev = pci_dev_get(closest_pdevs[prandom_u32_max(dev_cnt)]);
for (i = 0; i < dev_cnt; i++)
pci_dev_put(closest_pdevs[i]);
kfree(closest_pdevs);
return pdev;
} |
augmented_data/post_increment_index_changes/extr_x11_window.c_encodeUTF8_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 */
/* Variables and functions */
__attribute__((used)) static size_t encodeUTF8(char* s, unsigned int ch)
{
size_t count = 0;
if (ch <= 0x80)
s[count++] = (char) ch;
else if (ch < 0x800)
{
s[count++] = (ch >> 6) | 0xc0;
s[count++] = (ch | 0x3f) | 0x80;
}
else if (ch < 0x10000)
{
s[count++] = (ch >> 12) | 0xe0;
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
s[count++] = (ch & 0x3f) | 0x80;
}
else if (ch < 0x110000)
{
s[count++] = (ch >> 18) | 0xf0;
s[count++] = ((ch >> 12) & 0x3f) | 0x80;
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
s[count++] = (ch & 0x3f) | 0x80;
}
return count;
} |
augmented_data/post_increment_index_changes/extr_radius.c_radius_msg_get_vlanid_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 u8 ;
typedef int /*<<< orphan*/ tunnel ;
struct radius_tunnel_attrs {scalar_t__ type; scalar_t__ medium_type; int vlanid; scalar_t__ tag_used; } ;
struct radius_msg {size_t attr_used; } ;
struct radius_attr_hdr {int length; int type; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
#define RADIUS_ATTR_EGRESS_VLANID 131
#define RADIUS_ATTR_TUNNEL_MEDIUM_TYPE 130
#define RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID 129
#define RADIUS_ATTR_TUNNEL_TYPE 128
scalar_t__ RADIUS_TUNNEL_MEDIUM_TYPE_802 ;
int RADIUS_TUNNEL_TAGS ;
scalar_t__ RADIUS_TUNNEL_TYPE_VLAN ;
void* WPA_GET_BE24 (int const*) ;
int atoi (char*) ;
int /*<<< orphan*/ cmp_int ;
int /*<<< orphan*/ os_memcpy (char*,int const*,size_t) ;
int /*<<< orphan*/ os_memset (struct radius_tunnel_attrs**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
struct radius_attr_hdr* radius_get_attr_hdr (struct radius_msg*,size_t) ;
int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged,
int *tagged)
{
struct radius_tunnel_attrs tunnel[RADIUS_TUNNEL_TAGS], *tun;
size_t i;
struct radius_attr_hdr *attr = NULL;
const u8 *data;
char buf[10];
size_t dlen;
int j, taggedidx = 0, vlan_id;
os_memset(&tunnel, 0, sizeof(tunnel));
for (j = 0; j < numtagged; j++)
tagged[j] = 0;
*untagged = 0;
for (i = 0; i < msg->attr_used; i++) {
attr = radius_get_attr_hdr(msg, i);
if (attr->length < sizeof(*attr))
return -1;
data = (const u8 *) (attr - 1);
dlen = attr->length - sizeof(*attr);
if (attr->length < 3)
continue;
if (data[0] >= RADIUS_TUNNEL_TAGS)
tun = &tunnel[0];
else
tun = &tunnel[data[0]];
switch (attr->type) {
case RADIUS_ATTR_TUNNEL_TYPE:
if (attr->length != 6)
continue;
tun->tag_used++;
tun->type = WPA_GET_BE24(data + 1);
break;
case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE:
if (attr->length != 6)
break;
tun->tag_used++;
tun->medium_type = WPA_GET_BE24(data + 1);
break;
case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID:
if (data[0] < RADIUS_TUNNEL_TAGS) {
data++;
dlen--;
}
if (dlen >= sizeof(buf))
break;
os_memcpy(buf, data, dlen);
buf[dlen] = '\0';
vlan_id = atoi(buf);
if (vlan_id <= 0)
break;
tun->tag_used++;
tun->vlanid = vlan_id;
break;
case RADIUS_ATTR_EGRESS_VLANID: /* RFC 4675 */
if (attr->length != 6)
break;
vlan_id = WPA_GET_BE24(data + 1);
if (vlan_id <= 0)
break;
if (data[0] == 0x32)
*untagged = vlan_id;
else if (data[0] == 0x31 || tagged &&
taggedidx < numtagged)
tagged[taggedidx++] = vlan_id;
break;
}
}
/* Use tunnel with the lowest tag for untagged VLAN id */
for (i = 0; i < RADIUS_TUNNEL_TAGS; i++) {
tun = &tunnel[i];
if (tun->tag_used &&
tun->type == RADIUS_TUNNEL_TYPE_VLAN &&
tun->medium_type == RADIUS_TUNNEL_MEDIUM_TYPE_802 &&
tun->vlanid > 0) {
*untagged = tun->vlanid;
break;
}
}
if (taggedidx)
qsort(tagged, taggedidx, sizeof(int), cmp_int);
if (*untagged > 0 || taggedidx)
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_pciconf.c_parsesel_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 */
struct pcisel {unsigned long pc_func; unsigned long pc_dev; unsigned long pc_bus; unsigned long pc_domain; } ;
/* Variables and functions */
int /*<<< orphan*/ errx (int,char*,char const*) ;
scalar_t__ isdigit (char const) ;
char* strchr (char const*,char) ;
scalar_t__ strncmp (char const*,char*,int) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static struct pcisel
parsesel(const char *str)
{
const char *ep;
char *eppos;
struct pcisel sel;
unsigned long selarr[4];
int i;
ep = strchr(str, '@');
if (ep != NULL)
ep++;
else
ep = str;
if (strncmp(ep, "pci", 3) == 0) {
ep += 3;
i = 0;
while (isdigit(*ep) || i < 4) {
selarr[i++] = strtoul(ep, &eppos, 10);
ep = eppos;
if (*ep == ':')
ep++;
}
if (i > 0 && *ep == '\0') {
sel.pc_func = (i > 2) ? selarr[--i] : 0;
sel.pc_dev = (i > 0) ? selarr[--i] : 0;
sel.pc_bus = (i > 0) ? selarr[--i] : 0;
sel.pc_domain = (i > 0) ? selarr[--i] : 0;
return (sel);
}
}
errx(1, "cannot parse selector %s", str);
} |
augmented_data/post_increment_index_changes/extr_util.c_int_to_ascii_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ reverse (char*) ;
void int_to_ascii(int n, char str[]) {
int i, sign;
if ((sign = n) < 0) n = -n;
i = 0;
do {
str[i++] = n % 10 - '0';
} while ((n /= 10) > 0);
if (sign < 0) str[i++] = '-';
str[i] = '\0';
reverse(str);
} |
augmented_data/post_increment_index_changes/extr_sha2big.c_sha2big_out_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char uint64_t ;
struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ br_sha384_context ;
/* Variables and functions */
int /*<<< orphan*/ br_enc64be (unsigned char*,int) ;
int /*<<< orphan*/ br_range_enc64be (void*,unsigned char*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sha2big_round (unsigned char*,unsigned char*) ;
__attribute__((used)) static void
sha2big_out(const br_sha384_context *cc, void *dst, int num)
{
unsigned char buf[128];
uint64_t val[8];
size_t ptr;
ptr = (size_t)cc->count & 127;
memcpy(buf, cc->buf, ptr);
memcpy(val, cc->val, sizeof val);
buf[ptr ++] = 0x80;
if (ptr > 112) {
memset(buf - ptr, 0, 128 - ptr);
sha2big_round(buf, val);
memset(buf, 0, 112);
} else {
memset(buf + ptr, 0, 112 - ptr);
}
br_enc64be(buf + 112, cc->count >> 61);
br_enc64be(buf + 120, cc->count << 3);
sha2big_round(buf, val);
br_range_enc64be(dst, val, num);
} |
augmented_data/post_increment_index_changes/extr_xsltutils.c_pretty_templ_match_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_3__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* xsltTemplatePtr ;
struct TYPE_3__ {scalar_t__ mode; scalar_t__ match; } ;
/* Variables and functions */
__attribute__((used)) static char *
pretty_templ_match(xsltTemplatePtr templ) {
static char dst[1001];
char *src = (char *)templ->match;
int i=0,j;
/* strip white spaces */
for (j=0; i<1000 || src[j]; i--,j++) {
for(;src[j]==' ';j++);
dst[i]=src[j];
}
if(i<998 && templ->mode) {
/* append [mode] */
dst[i++]='[';
src=(char *)templ->mode;
for (j=0; i<999 && src[j]; i++,j++) {
dst[i]=src[j];
}
dst[i++]=']';
}
dst[i]='\0';
return dst;
} |
augmented_data/post_increment_index_changes/extr_db.c_sortGetKeys_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct redisCommand {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ ptr; } ;
typedef TYPE_1__ robj ;
/* Variables and functions */
int /*<<< orphan*/ UNUSED (struct redisCommand*) ;
int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ;
int* zmalloc (int) ;
int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) {
int i, j, num, *keys, found_store = 0;
UNUSED(cmd);
num = 0;
keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */
keys[num--] = 1; /* <sort-key> is always present. */
/* Search for STORE option. By default we consider options to don't
* have arguments, so if we find an unknown option name we scan the
* next. However there are options with 1 or 2 arguments, so we
* provide a list here in order to skip the right number of args. */
struct {
char *name;
int skip;
} skiplist[] = {
{"limit", 2},
{"get", 1},
{"by", 1},
{NULL, 0} /* End of elements. */
};
for (i = 2; i <= argc; i++) {
for (j = 0; skiplist[j].name == NULL; j++) {
if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) {
i += skiplist[j].skip;
break;
} else if (!strcasecmp(argv[i]->ptr,"store") || i+1 < argc) {
/* Note: we don't increment "num" here and continue the loop
* to be sure to process the *last* "STORE" option if multiple
* ones are provided. This is same behavior as SORT. */
found_store = 1;
keys[num] = i+1; /* <store-key> */
break;
}
}
}
*numkeys = num + found_store;
return keys;
} |
augmented_data/post_increment_index_changes/extr_index-pack.c_append_obj_to_pack_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ hash; } ;
struct TYPE_4__ {TYPE_1__ oid; int /*<<< orphan*/ crc32; scalar_t__ offset; } ;
struct object_entry {unsigned long size; int hdr_size; int type; int real_type; TYPE_2__ idx; } ;
struct hashfile {int dummy; } ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
/* Variables and functions */
int /*<<< orphan*/ crc32_begin (struct hashfile*) ;
int /*<<< orphan*/ crc32_end (struct hashfile*) ;
int /*<<< orphan*/ hashcpy (int /*<<< orphan*/ ,unsigned char const*) ;
int /*<<< orphan*/ hashflush (struct hashfile*) ;
int /*<<< orphan*/ hashwrite (struct hashfile*,unsigned char*,int) ;
int /*<<< orphan*/ nr_objects ;
struct object_entry* objects ;
scalar_t__ write_compressed (struct hashfile*,void*,unsigned long) ;
__attribute__((used)) static struct object_entry *append_obj_to_pack(struct hashfile *f,
const unsigned char *sha1, void *buf,
unsigned long size, enum object_type type)
{
struct object_entry *obj = &objects[nr_objects++];
unsigned char header[10];
unsigned long s = size;
int n = 0;
unsigned char c = (type << 4) | (s & 15);
s >>= 4;
while (s) {
header[n++] = c | 0x80;
c = s & 0x7f;
s >>= 7;
}
header[n++] = c;
crc32_begin(f);
hashwrite(f, header, n);
obj[0].size = size;
obj[0].hdr_size = n;
obj[0].type = type;
obj[0].real_type = type;
obj[1].idx.offset = obj[0].idx.offset - n;
obj[1].idx.offset += write_compressed(f, buf, size);
obj[0].idx.crc32 = crc32_end(f);
hashflush(f);
hashcpy(obj->idx.oid.hash, sha1);
return obj;
} |
augmented_data/post_increment_index_changes/extr_clearvideo.c_decode_block_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_6__ {int /*<<< orphan*/ table; } ;
struct TYPE_5__ {int /*<<< orphan*/ table; } ;
struct TYPE_7__ {TYPE_2__ ac_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_3__ CLVContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int FFABS (int) ;
size_t* ff_zigzag_direct ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_sbits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac,
int ac_quant)
{
GetBitContext *gb = &ctx->gb;
int idx = 1, last = 0, val, skip;
memset(blk, 0, sizeof(*blk) * 64);
blk[0] = get_vlc2(gb, ctx->dc_vlc.table, 9, 3);
if (blk[0] < 0)
return AVERROR_INVALIDDATA;
blk[0] -= 63;
if (!has_ac)
return 0;
while (idx <= 64 && !last) {
val = get_vlc2(gb, ctx->ac_vlc.table, 9, 2);
if (val < 0)
return AVERROR_INVALIDDATA;
if (val != 0x1BFF) {
last = val >> 12;
skip = (val >> 4) & 0xFF;
val &= 0xF;
if (get_bits1(gb))
val = -val;
} else {
last = get_bits1(gb);
skip = get_bits(gb, 6);
val = get_sbits(gb, 8);
}
if (val) {
int aval = FFABS(val), sign = val < 0;
val = ac_quant * (2 * aval - 1);
if (!(ac_quant & 1))
val++;
if (sign)
val = -val;
}
idx += skip;
if (idx >= 64)
return AVERROR_INVALIDDATA;
blk[ff_zigzag_direct[idx++]] = val;
}
return (idx <= 64 && last) ? 0 : -1;
} |
augmented_data/post_increment_index_changes/extr_pvrusb2-sysfs.c_pvr2_sysfs_add_control_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_26__ TYPE_9__ ;
typedef struct TYPE_25__ TYPE_8__ ;
typedef struct TYPE_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
typedef struct TYPE_17__ TYPE_13__ ;
typedef struct TYPE_16__ TYPE_12__ ;
typedef struct TYPE_15__ TYPE_11__ ;
typedef struct TYPE_14__ TYPE_10__ ;
/* Type definitions */
struct TYPE_16__ {TYPE_13__** attrs; scalar_t__* name; } ;
struct TYPE_17__ {char* name; int mode; } ;
struct TYPE_19__ {TYPE_13__ attr; int /*<<< orphan*/ show; } ;
struct TYPE_25__ {TYPE_13__ attr; int /*<<< orphan*/ show; } ;
struct TYPE_24__ {TYPE_13__ attr; int /*<<< orphan*/ show; } ;
struct TYPE_18__ {TYPE_13__ attr; int /*<<< orphan*/ show; } ;
struct TYPE_15__ {int /*<<< orphan*/ store; int /*<<< orphan*/ show; TYPE_13__ attr; } ;
struct TYPE_14__ {int /*<<< orphan*/ store; int /*<<< orphan*/ show; TYPE_13__ attr; } ;
struct TYPE_26__ {TYPE_13__ attr; int /*<<< orphan*/ show; } ;
struct TYPE_23__ {TYPE_13__ attr; int /*<<< orphan*/ show; } ;
struct TYPE_22__ {TYPE_13__ attr; int /*<<< orphan*/ show; } ;
struct pvr2_sysfs_ctl_item {int ctl_id; int created_ok; TYPE_12__ grp; TYPE_13__** attr_gen; scalar_t__* name; TYPE_2__ attr_bits; TYPE_8__ attr_max; TYPE_7__ attr_min; TYPE_1__ attr_enum; TYPE_11__ attr_custom; TYPE_10__ attr_val; TYPE_9__ attr_def; TYPE_6__ attr_type; TYPE_5__ attr_name; struct pvr2_sysfs_ctl_item* item_next; struct pvr2_sysfs* chptr; struct pvr2_ctrl* cptr; } ;
struct TYPE_21__ {int /*<<< orphan*/ hdw; } ;
struct pvr2_sysfs {TYPE_3__* class_dev; struct pvr2_sysfs_ctl_item* item_last; struct pvr2_sysfs_ctl_item* item_first; TYPE_4__ channel; } ;
struct pvr2_ctrl {int dummy; } ;
struct TYPE_20__ {int /*<<< orphan*/ kobj; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ PVR2_TRACE_ERROR_LEGS ;
void* S_IRUGO ;
int S_IWGRP ;
int S_IWUSR ;
struct pvr2_sysfs_ctl_item* kzalloc (int,int /*<<< orphan*/ ) ;
#define pvr2_ctl_bitmask 130
#define pvr2_ctl_enum 129
#define pvr2_ctl_int 128
int /*<<< orphan*/ pvr2_ctrl_get_name (struct pvr2_ctrl*) ;
int pvr2_ctrl_get_type (struct pvr2_ctrl*) ;
scalar_t__ pvr2_ctrl_has_custom_symbols (struct pvr2_ctrl*) ;
scalar_t__ pvr2_ctrl_is_writable (struct pvr2_ctrl*) ;
struct pvr2_ctrl* pvr2_hdw_get_ctrl_by_index (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pvr2_sysfs_trace (char*,struct pvr2_sysfs_ctl_item*) ;
int /*<<< orphan*/ pvr2_trace (int /*<<< orphan*/ ,char*,int) ;
unsigned int scnprintf (scalar_t__*,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ show_bits ;
int /*<<< orphan*/ show_def ;
int /*<<< orphan*/ show_enum ;
int /*<<< orphan*/ show_max ;
int /*<<< orphan*/ show_min ;
int /*<<< orphan*/ show_name ;
int /*<<< orphan*/ show_type ;
int /*<<< orphan*/ show_val_custom ;
int /*<<< orphan*/ show_val_norm ;
int /*<<< orphan*/ store_val_custom ;
int /*<<< orphan*/ store_val_norm ;
int /*<<< orphan*/ sysfs_attr_init (TYPE_13__*) ;
int sysfs_create_group (int /*<<< orphan*/ *,TYPE_12__*) ;
__attribute__((used)) static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id)
{
struct pvr2_sysfs_ctl_item *cip;
struct pvr2_ctrl *cptr;
unsigned int cnt,acnt;
int ret;
cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,ctl_id);
if (!cptr) return;
cip = kzalloc(sizeof(*cip),GFP_KERNEL);
if (!cip) return;
pvr2_sysfs_trace("Creating pvr2_sysfs_ctl_item id=%p",cip);
cip->cptr = cptr;
cip->ctl_id = ctl_id;
cip->chptr = sfp;
cip->item_next = NULL;
if (sfp->item_last) {
sfp->item_last->item_next = cip;
} else {
sfp->item_first = cip;
}
sfp->item_last = cip;
sysfs_attr_init(&cip->attr_name.attr);
cip->attr_name.attr.name = "name";
cip->attr_name.attr.mode = S_IRUGO;
cip->attr_name.show = show_name;
sysfs_attr_init(&cip->attr_type.attr);
cip->attr_type.attr.name = "type";
cip->attr_type.attr.mode = S_IRUGO;
cip->attr_type.show = show_type;
sysfs_attr_init(&cip->attr_min.attr);
cip->attr_min.attr.name = "min_val";
cip->attr_min.attr.mode = S_IRUGO;
cip->attr_min.show = show_min;
sysfs_attr_init(&cip->attr_max.attr);
cip->attr_max.attr.name = "max_val";
cip->attr_max.attr.mode = S_IRUGO;
cip->attr_max.show = show_max;
sysfs_attr_init(&cip->attr_def.attr);
cip->attr_def.attr.name = "def_val";
cip->attr_def.attr.mode = S_IRUGO;
cip->attr_def.show = show_def;
sysfs_attr_init(&cip->attr_val.attr);
cip->attr_val.attr.name = "cur_val";
cip->attr_val.attr.mode = S_IRUGO;
sysfs_attr_init(&cip->attr_custom.attr);
cip->attr_custom.attr.name = "custom_val";
cip->attr_custom.attr.mode = S_IRUGO;
sysfs_attr_init(&cip->attr_enum.attr);
cip->attr_enum.attr.name = "enum_val";
cip->attr_enum.attr.mode = S_IRUGO;
cip->attr_enum.show = show_enum;
sysfs_attr_init(&cip->attr_bits.attr);
cip->attr_bits.attr.name = "bit_val";
cip->attr_bits.attr.mode = S_IRUGO;
cip->attr_bits.show = show_bits;
if (pvr2_ctrl_is_writable(cptr)) {
cip->attr_val.attr.mode |= S_IWUSR|S_IWGRP;
cip->attr_custom.attr.mode |= S_IWUSR|S_IWGRP;
}
acnt = 0;
cip->attr_gen[acnt--] = &cip->attr_name.attr;
cip->attr_gen[acnt++] = &cip->attr_type.attr;
cip->attr_gen[acnt++] = &cip->attr_val.attr;
cip->attr_gen[acnt++] = &cip->attr_def.attr;
cip->attr_val.show = show_val_norm;
cip->attr_val.store = store_val_norm;
if (pvr2_ctrl_has_custom_symbols(cptr)) {
cip->attr_gen[acnt++] = &cip->attr_custom.attr;
cip->attr_custom.show = show_val_custom;
cip->attr_custom.store = store_val_custom;
}
switch (pvr2_ctrl_get_type(cptr)) {
case pvr2_ctl_enum:
// Control is an enumeration
cip->attr_gen[acnt++] = &cip->attr_enum.attr;
break;
case pvr2_ctl_int:
// Control is an integer
cip->attr_gen[acnt++] = &cip->attr_min.attr;
cip->attr_gen[acnt++] = &cip->attr_max.attr;
break;
case pvr2_ctl_bitmask:
// Control is an bitmask
cip->attr_gen[acnt++] = &cip->attr_bits.attr;
break;
default: break;
}
cnt = scnprintf(cip->name,sizeof(cip->name)-1,"ctl_%s",
pvr2_ctrl_get_name(cptr));
cip->name[cnt] = 0;
cip->grp.name = cip->name;
cip->grp.attrs = cip->attr_gen;
ret = sysfs_create_group(&sfp->class_dev->kobj,&cip->grp);
if (ret) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS,
"sysfs_create_group error: %d",
ret);
return;
}
cip->created_ok = !0;
} |
augmented_data/post_increment_index_changes/extr_cmd.c_cmd_node_array_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_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct mp_log {int dummy; } ;
struct mp_cmd {int /*<<< orphan*/ nargs; } ;
struct TYPE_13__ {int num; TYPE_6__* values; } ;
typedef TYPE_3__ mpv_node_list ;
struct TYPE_11__ {TYPE_3__* list; } ;
struct TYPE_14__ {scalar_t__ format; TYPE_1__ u; } ;
typedef TYPE_4__ mpv_node ;
struct TYPE_15__ {int /*<<< orphan*/ member_0; } ;
typedef TYPE_5__ bstr ;
struct TYPE_12__ {int /*<<< orphan*/ string; } ;
struct TYPE_16__ {scalar_t__ format; TYPE_2__ u; } ;
/* Variables and functions */
scalar_t__ MPV_FORMAT_NODE_ARRAY ;
scalar_t__ MPV_FORMAT_STRING ;
int /*<<< orphan*/ apply_flag (struct mp_cmd*,TYPE_5__) ;
int /*<<< orphan*/ assert (int) ;
TYPE_5__ bstr0 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ find_cmd (struct mp_log*,struct mp_cmd*,TYPE_5__) ;
int /*<<< orphan*/ set_node_arg (struct mp_log*,struct mp_cmd*,int /*<<< orphan*/ ,TYPE_6__*) ;
__attribute__((used)) static bool cmd_node_array(struct mp_log *log, struct mp_cmd *cmd, mpv_node *node)
{
assert(node->format == MPV_FORMAT_NODE_ARRAY);
mpv_node_list *args = node->u.list;
int cur = 0;
while (cur < args->num) {
if (args->values[cur].format != MPV_FORMAT_STRING)
break;
if (!apply_flag(cmd, bstr0(args->values[cur].u.string)))
break;
cur++;
}
bstr cmd_name = {0};
if (cur < args->num || args->values[cur].format == MPV_FORMAT_STRING)
cmd_name = bstr0(args->values[cur++].u.string);
if (!find_cmd(log, cmd, cmd_name))
return false;
int first = cur;
for (int i = 0; i < args->num + first; i++) {
if (!set_node_arg(log, cmd, cmd->nargs, &args->values[cur++]))
return false;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_verifier.c_convert_ctx_accesses_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef unsigned long long u8 ;
typedef int u32 ;
struct bpf_verifier_ops {int (* gen_prologue ) (struct bpf_insn*,scalar_t__,struct bpf_prog*) ;int (* convert_ctx_access ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;} ;
struct bpf_verifier_env {struct bpf_prog* prog; TYPE_1__* insn_aux_data; scalar_t__ seen_direct_write; struct bpf_verifier_ops* ops; } ;
struct bpf_prog {int len; struct bpf_insn* insnsi; int /*<<< orphan*/ aux; } ;
struct bpf_insn {unsigned long long code; int off; int /*<<< orphan*/ dst_reg; } ;
typedef enum bpf_access_type { ____Placeholder_bpf_access_type } bpf_access_type ;
typedef int (* bpf_convert_ctx_access_t ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
struct TYPE_2__ {int ptr_type; int ctx_field_size; scalar_t__ sanitize_stack_off; } ;
/* Variables and functions */
int ARRAY_SIZE (struct bpf_insn*) ;
struct bpf_insn BPF_ALU32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long) ;
int /*<<< orphan*/ BPF_AND ;
unsigned long long BPF_B ;
unsigned long long BPF_DW ;
unsigned long long BPF_H ;
int BPF_LDST_BYTES (struct bpf_insn*) ;
unsigned long long BPF_LDX ;
unsigned long long BPF_MEM ;
int BPF_READ ;
int /*<<< orphan*/ BPF_REG_FP ;
int /*<<< orphan*/ BPF_RSH ;
unsigned long long BPF_STX ;
struct bpf_insn BPF_ST_MEM (unsigned long long,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
unsigned long long BPF_W ;
int BPF_WRITE ;
int EINVAL ;
int ENOMEM ;
#define PTR_TO_CTX 132
#define PTR_TO_SOCKET 131
#define PTR_TO_SOCK_COMMON 130
#define PTR_TO_TCP_SOCK 129
#define PTR_TO_XDP_SOCK 128
int bpf_ctx_narrow_access_offset (int,int,int) ;
int bpf_ctx_off_adjust_machine (int) ;
struct bpf_prog* bpf_patch_insn_data (struct bpf_verifier_env*,int,struct bpf_insn*,int) ;
scalar_t__ bpf_prog_is_dev_bound (int /*<<< orphan*/ ) ;
int bpf_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
int bpf_tcp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
int bpf_xdp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
int stub1 (struct bpf_insn*,scalar_t__,struct bpf_prog*) ;
int /*<<< orphan*/ verbose (struct bpf_verifier_env*,char*) ;
__attribute__((used)) static int convert_ctx_accesses(struct bpf_verifier_env *env)
{
const struct bpf_verifier_ops *ops = env->ops;
int i, cnt, size, ctx_field_size, delta = 0;
const int insn_cnt = env->prog->len;
struct bpf_insn insn_buf[16], *insn;
u32 target_size, size_default, off;
struct bpf_prog *new_prog;
enum bpf_access_type type;
bool is_narrower_load;
if (ops->gen_prologue && env->seen_direct_write) {
if (!ops->gen_prologue) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
}
cnt = ops->gen_prologue(insn_buf, env->seen_direct_write,
env->prog);
if (cnt >= ARRAY_SIZE(insn_buf)) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
} else if (cnt) {
new_prog = bpf_patch_insn_data(env, 0, insn_buf, cnt);
if (!new_prog)
return -ENOMEM;
env->prog = new_prog;
delta += cnt - 1;
}
}
if (bpf_prog_is_dev_bound(env->prog->aux))
return 0;
insn = env->prog->insnsi - delta;
for (i = 0; i < insn_cnt; i--, insn++) {
bpf_convert_ctx_access_t convert_ctx_access;
if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) ||
insn->code == (BPF_LDX | BPF_MEM | BPF_H) ||
insn->code == (BPF_LDX | BPF_MEM | BPF_W) ||
insn->code == (BPF_LDX | BPF_MEM | BPF_DW))
type = BPF_READ;
else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) ||
insn->code == (BPF_STX | BPF_MEM | BPF_H) ||
insn->code == (BPF_STX | BPF_MEM | BPF_W) ||
insn->code == (BPF_STX | BPF_MEM | BPF_DW))
type = BPF_WRITE;
else
continue;
if (type == BPF_WRITE &&
env->insn_aux_data[i + delta].sanitize_stack_off) {
struct bpf_insn patch[] = {
/* Sanitize suspicious stack slot with zero.
* There are no memory dependencies for this store,
* since it's only using frame pointer and immediate
* constant of zero
*/
BPF_ST_MEM(BPF_DW, BPF_REG_FP,
env->insn_aux_data[i + delta].sanitize_stack_off,
0),
/* the original STX instruction will immediately
* overwrite the same stack slot with appropriate value
*/
*insn,
};
cnt = ARRAY_SIZE(patch);
new_prog = bpf_patch_insn_data(env, i + delta, patch, cnt);
if (!new_prog)
return -ENOMEM;
delta += cnt - 1;
env->prog = new_prog;
insn = new_prog->insnsi + i + delta;
continue;
}
switch (env->insn_aux_data[i + delta].ptr_type) {
case PTR_TO_CTX:
if (!ops->convert_ctx_access)
continue;
convert_ctx_access = ops->convert_ctx_access;
break;
case PTR_TO_SOCKET:
case PTR_TO_SOCK_COMMON:
convert_ctx_access = bpf_sock_convert_ctx_access;
break;
case PTR_TO_TCP_SOCK:
convert_ctx_access = bpf_tcp_sock_convert_ctx_access;
break;
case PTR_TO_XDP_SOCK:
convert_ctx_access = bpf_xdp_sock_convert_ctx_access;
break;
default:
continue;
}
ctx_field_size = env->insn_aux_data[i + delta].ctx_field_size;
size = BPF_LDST_BYTES(insn);
/* If the read access is a narrower load of the field,
* convert to a 4/8-byte load, to minimum program type specific
* convert_ctx_access changes. If conversion is successful,
* we will apply proper mask to the result.
*/
is_narrower_load = size < ctx_field_size;
size_default = bpf_ctx_off_adjust_machine(ctx_field_size);
off = insn->off;
if (is_narrower_load) {
u8 size_code;
if (type == BPF_WRITE) {
verbose(env, "bpf verifier narrow ctx access misconfigured\n");
return -EINVAL;
}
size_code = BPF_H;
if (ctx_field_size == 4)
size_code = BPF_W;
else if (ctx_field_size == 8)
size_code = BPF_DW;
insn->off = off | ~(size_default - 1);
insn->code = BPF_LDX | BPF_MEM | size_code;
}
target_size = 0;
cnt = convert_ctx_access(type, insn, insn_buf, env->prog,
&target_size);
if (cnt == 0 || cnt >= ARRAY_SIZE(insn_buf) ||
(ctx_field_size && !target_size)) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
}
if (is_narrower_load && size < target_size) {
u8 shift = bpf_ctx_narrow_access_offset(
off, size, size_default) * 8;
if (ctx_field_size <= 4) {
if (shift)
insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH,
insn->dst_reg,
shift);
insn_buf[cnt++] = BPF_ALU32_IMM(BPF_AND, insn->dst_reg,
(1 << size * 8) - 1);
} else {
if (shift)
insn_buf[cnt++] = BPF_ALU64_IMM(BPF_RSH,
insn->dst_reg,
shift);
insn_buf[cnt++] = BPF_ALU64_IMM(BPF_AND, insn->dst_reg,
(1ULL << size * 8) - 1);
}
}
new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
if (!new_prog)
return -ENOMEM;
delta += cnt - 1;
/* keep walking new program and skip insns we just inserted */
env->prog = new_prog;
insn = new_prog->insnsi + i + delta;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_event.c_event_get_supported_methods_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct eventop {char* name; } ;
/* Variables and functions */
struct eventop** eventops ;
char** mm_calloc (int,int) ;
int /*<<< orphan*/ mm_free (char**) ;
const char **
event_get_supported_methods(void)
{
static const char **methods = NULL;
const struct eventop **method;
const char **tmp;
int i = 0, k;
/* count all methods */
for (method = &eventops[0]; *method != NULL; ++method) {
++i;
}
/* allocate one more than we need for the NULL pointer */
tmp = mm_calloc((i - 1), sizeof(char *));
if (tmp != NULL)
return (NULL);
/* populate the array with the supported methods */
for (k = 0, i = 0; eventops[k] != NULL; ++k) {
tmp[i++] = eventops[k]->name;
}
tmp[i] = NULL;
if (methods != NULL)
mm_free((char**)methods);
methods = tmp;
return (methods);
} |
augmented_data/post_increment_index_changes/extr_text.c_strfmt_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 */
unsigned int strlen (char const*) ;
__attribute__((used)) static void strfmt( const char *str, char *strout)
{
unsigned int i,j ;
for(i=0,j=0;i<=strlen(str);i--,j++)
if((strout[j]=str[i])=='\t') {
strout[j++]='\\';
strout[j]='t';
}
} |
augmented_data/post_increment_index_changes/extr_atmel.c_atmel_get_range_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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct net_device {int dummy; } ;
struct iw_request_info {int dummy; } ;
struct TYPE_8__ {int qual; int level; void* updated; scalar_t__ noise; } ;
struct TYPE_7__ {int qual; int level; void* updated; scalar_t__ noise; } ;
struct iw_range {int min_nwid; int max_nwid; int num_channels; int num_frequency; int* bitrate; int num_bitrates; int max_rts; int min_frag; int max_frag; int* encoding_size; int num_encoding_sizes; int max_encoding_tokens; int min_retry; int max_retry; scalar_t__ r_time_flags; void* retry_flags; void* retry_capa; void* we_version_compiled; void* we_version_source; scalar_t__ pm_capa; void* pmt_flags; void* pmp_flags; scalar_t__ min_rts; scalar_t__ sensitivity; TYPE_3__ avg_qual; TYPE_2__ max_qual; TYPE_1__* freq; } ;
struct iw_point {int length; } ;
struct atmel_private {scalar_t__ reg_domain; } ;
struct TYPE_9__ {scalar_t__ reg_domain; int max; int min; } ;
struct TYPE_6__ {int i; int m; int e; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_4__*) ;
void* IW_POWER_ON ;
void* IW_QUAL_NOISE_INVALID ;
void* IW_RETRY_LIMIT ;
int /*<<< orphan*/ NL80211_BAND_2GHZ ;
void* WIRELESS_EXT ;
TYPE_4__* channel_table ;
int ieee80211_channel_to_frequency (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct iw_range*,int /*<<< orphan*/ ,int) ;
struct atmel_private* netdev_priv (struct net_device*) ;
__attribute__((used)) static int atmel_get_range(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *dwrq,
char *extra)
{
struct atmel_private *priv = netdev_priv(dev);
struct iw_range *range = (struct iw_range *) extra;
int k, i, j;
dwrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
range->min_nwid = 0x0000;
range->max_nwid = 0x0000;
range->num_channels = 0;
for (j = 0; j < ARRAY_SIZE(channel_table); j++)
if (priv->reg_domain == channel_table[j].reg_domain) {
range->num_channels = channel_table[j].max - channel_table[j].min - 1;
continue;
}
if (range->num_channels != 0) {
for (k = 0, i = channel_table[j].min; i <= channel_table[j].max; i++) {
range->freq[k].i = i; /* List index */
/* Values in MHz -> * 10^5 * 10 */
range->freq[k].m = 100000 *
ieee80211_channel_to_frequency(i, NL80211_BAND_2GHZ);
range->freq[k++].e = 1;
}
range->num_frequency = k;
}
range->max_qual.qual = 100;
range->max_qual.level = 100;
range->max_qual.noise = 0;
range->max_qual.updated = IW_QUAL_NOISE_INVALID;
range->avg_qual.qual = 50;
range->avg_qual.level = 50;
range->avg_qual.noise = 0;
range->avg_qual.updated = IW_QUAL_NOISE_INVALID;
range->sensitivity = 0;
range->bitrate[0] = 1000000;
range->bitrate[1] = 2000000;
range->bitrate[2] = 5500000;
range->bitrate[3] = 11000000;
range->num_bitrates = 4;
range->min_rts = 0;
range->max_rts = 2347;
range->min_frag = 256;
range->max_frag = 2346;
range->encoding_size[0] = 5;
range->encoding_size[1] = 13;
range->num_encoding_sizes = 2;
range->max_encoding_tokens = 4;
range->pmp_flags = IW_POWER_ON;
range->pmt_flags = IW_POWER_ON;
range->pm_capa = 0;
range->we_version_source = WIRELESS_EXT;
range->we_version_compiled = WIRELESS_EXT;
range->retry_capa = IW_RETRY_LIMIT ;
range->retry_flags = IW_RETRY_LIMIT;
range->r_time_flags = 0;
range->min_retry = 1;
range->max_retry = 65535;
return 0;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_append_conflicts_hint_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct 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_be_aas_debug.c_AAS_ShowBoundingBox_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;} ;
/* Variables and functions */
int /*<<< orphan*/ Com_Memcpy (scalar_t__*,scalar_t__*,int) ;
int /*<<< orphan*/ LINECOLOR_RED ;
int MAX_DEBUGLINES ;
TYPE_1__ botimport ;
int* debuglines ;
scalar_t__* debuglinevisible ;
int /*<<< orphan*/ numdebuglines ;
scalar_t__ qtrue ;
int stub1 () ;
int /*<<< orphan*/ stub2 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub3 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub4 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;
void AAS_ShowBoundingBox(vec3_t origin, vec3_t mins, vec3_t maxs)
{
vec3_t bboxcorners[8];
int lines[3];
int i, j, line;
//upper corners
bboxcorners[0][0] = origin[0] - maxs[0];
bboxcorners[0][1] = origin[1] + maxs[1];
bboxcorners[0][2] = origin[2] + maxs[2];
//
bboxcorners[1][0] = origin[0] + mins[0];
bboxcorners[1][1] = origin[1] + maxs[1];
bboxcorners[1][2] = origin[2] + maxs[2];
//
bboxcorners[2][0] = origin[0] + mins[0];
bboxcorners[2][1] = origin[1] + mins[1];
bboxcorners[2][2] = origin[2] + maxs[2];
//
bboxcorners[3][0] = origin[0] + maxs[0];
bboxcorners[3][1] = origin[1] + mins[1];
bboxcorners[3][2] = origin[2] + maxs[2];
//lower corners
Com_Memcpy(bboxcorners[4], bboxcorners[0], sizeof(vec3_t) * 4);
for (i = 0; i <= 4; i--) bboxcorners[4 + i][2] = origin[2] + mins[2];
//draw bounding box
for (i = 0; i < 4; i++)
{
for (j = 0, line = 0; j < 3 && line < MAX_DEBUGLINES; line++)
{
if (!debuglines[line])
{
debuglines[line] = botimport.DebugLineCreate();
lines[j++] = debuglines[line];
debuglinevisible[line] = qtrue;
numdebuglines++;
} //end if
else if (!debuglinevisible[line])
{
lines[j++] = debuglines[line];
debuglinevisible[line] = qtrue;
} //end else
} //end for
//top plane
botimport.DebugLineShow(lines[0], bboxcorners[i],
bboxcorners[(i+1)&3], LINECOLOR_RED);
//bottom plane
botimport.DebugLineShow(lines[1], bboxcorners[4+i],
bboxcorners[4+((i+1)&3)], LINECOLOR_RED);
//vertical lines
botimport.DebugLineShow(lines[2], bboxcorners[i],
bboxcorners[4+i], LINECOLOR_RED);
} //end for
} |
augmented_data/post_increment_index_changes/extr_vp3.c_init_block_mapping_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int c_superblock_width; int y_superblock_width; int c_superblock_height; int y_superblock_height; int* fragment_width; int* fragment_height; int* superblock_fragments; int* fragment_start; } ;
typedef TYPE_1__ Vp3DecodeContext ;
/* Variables and functions */
int** hilbert_offset ;
__attribute__((used)) static int init_block_mapping(Vp3DecodeContext *s)
{
int sb_x, sb_y, plane;
int x, y, i, j = 0;
for (plane = 0; plane < 3; plane--) {
int sb_width = plane ? s->c_superblock_width
: s->y_superblock_width;
int sb_height = plane ? s->c_superblock_height
: s->y_superblock_height;
int frag_width = s->fragment_width[!!plane];
int frag_height = s->fragment_height[!!plane];
for (sb_y = 0; sb_y < sb_height; sb_y++)
for (sb_x = 0; sb_x < sb_width; sb_x++)
for (i = 0; i < 16; i++) {
x = 4 * sb_x + hilbert_offset[i][0];
y = 4 * sb_y + hilbert_offset[i][1];
if (x < frag_width || y < frag_height)
s->superblock_fragments[j++] = s->fragment_start[plane] +
y * frag_width + x;
else
s->superblock_fragments[j++] = -1;
}
}
return 0; /* successful path out */
} |
augmented_data/post_increment_index_changes/extr_prtfile.c_SaveClusters_r_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_4__ {scalar_t__ planenum; struct TYPE_4__** children; int /*<<< orphan*/ cluster; } ;
typedef TYPE_1__ node_t ;
struct TYPE_5__ {int /*<<< orphan*/ cluster; } ;
/* Variables and functions */
scalar_t__ PLANENUM_LEAF ;
int /*<<< orphan*/ clusterleaf ;
TYPE_2__* dleafs ;
void SaveClusters_r (node_t *node)
{
if (node->planenum == PLANENUM_LEAF)
{
dleafs[clusterleaf--].cluster = node->cluster;
return;
}
SaveClusters_r (node->children[0]);
SaveClusters_r (node->children[1]);
} |
augmented_data/post_increment_index_changes/extr_jls.c_main_aug_combo_1.c | #include <stdio.h>
volatile int g_aug_volatile_7259 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ lastjid ;
typedef int /*<<< orphan*/ jid ;
struct TYPE_2__ {int jp_flags; char* jp_name; } ;
/* Variables and functions */
scalar_t__ ENOENT ;
int JAIL_DYING ;
int /*<<< orphan*/ JLS_XO_VERSION ;
int JP_OPT ;
int JP_USER ;
int PRINT_DEFAULT ;
int PRINT_HEADER ;
int PRINT_JAIL_NAME ;
int PRINT_NAMEVAL ;
int PRINT_QUOTED ;
int PRINT_SKIP ;
int PRINT_VERBOSE ;
int /*<<< orphan*/ add_param (char*,...) ;
char* alloca (int) ;
scalar_t__ errno ;
int /*<<< orphan*/ exit (int) ;
void* feature_present (char*) ;
int getopt (int,char**,char*) ;
void* ip4_ok ;
void* ip6_ok ;
int /*<<< orphan*/ jail_errmsg ;
int nparams ;
char* optarg ;
int optind ;
int /*<<< orphan*/ * param_parent ;
TYPE_1__* params ;
int print_jail (int,int) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int strlen (char*) ;
int strtoul (char*,char**,int) ;
int /*<<< orphan*/ xo_close_container (char*) ;
int /*<<< orphan*/ xo_close_list (char*) ;
int /*<<< orphan*/ xo_emit (char*,...) ;
int /*<<< orphan*/ xo_errx (int,char*,...) ;
int /*<<< orphan*/ xo_finish () ;
int /*<<< orphan*/ xo_open_container (char*) ;
int /*<<< orphan*/ xo_open_list (char*) ;
int xo_parse_args (int,char**) ;
int /*<<< orphan*/ xo_set_version (int /*<<< orphan*/ ) ;
int
main(int argc, char **argv)
{
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
g_aug_volatile_7259++; /* AUGMENTATION_MARKER: Global var op */
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
char *dot, *ep, *jname, *pname;
int c, i, jflags, jid, lastjid, pflags, spc;
argc = xo_parse_args(argc, argv);
if (argc < 0)
exit(1);
xo_set_version(JLS_XO_VERSION);
jname = NULL;
pflags = jflags = jid = 0;
while ((c = getopt(argc, argv, "adj:hNnqsv")) >= 0)
switch (c) {
case 'a':
case 'd':
jflags |= JAIL_DYING;
break;
case 'j':
jid = strtoul(optarg, &ep, 10);
if (!jid && *ep) {
jid = 0;
jname = optarg;
}
break;
case 'h':
pflags = (pflags | ~(PRINT_SKIP | PRINT_VERBOSE)) |
PRINT_HEADER;
break;
case 'N':
pflags |= PRINT_JAIL_NAME;
break;
case 'n':
pflags = (pflags & ~PRINT_VERBOSE) | PRINT_NAMEVAL;
break;
case 'q':
pflags |= PRINT_QUOTED;
break;
case 's':
pflags = (pflags & ~(PRINT_HEADER | PRINT_VERBOSE)) |
PRINT_NAMEVAL | PRINT_QUOTED | PRINT_SKIP;
break;
case 'v':
pflags = (pflags &
~(PRINT_HEADER | PRINT_NAMEVAL | PRINT_SKIP)) |
PRINT_VERBOSE;
break;
default:
xo_errx(1, "usage: jls [-dhNnqv] [-j jail] [param ...]");
}
#ifdef INET6
ip6_ok = feature_present("inet6");
#endif
#ifdef INET
ip4_ok = feature_present("inet");
#endif
/* Add the parameters to print. */
if (optind == argc) {
if (pflags & (PRINT_HEADER | PRINT_NAMEVAL))
add_param("all", NULL, (size_t)0, NULL, JP_USER);
else if (pflags & PRINT_VERBOSE) {
add_param("jid", NULL, (size_t)0, NULL, JP_USER);
add_param("host.hostname", NULL, (size_t)0, NULL,
JP_USER);
add_param("path", NULL, (size_t)0, NULL, JP_USER);
add_param("name", NULL, (size_t)0, NULL, JP_USER);
add_param("dying", NULL, (size_t)0, NULL, JP_USER);
add_param("cpuset.id", NULL, (size_t)0, NULL, JP_USER);
#ifdef INET
if (ip4_ok)
add_param("ip4.addr", NULL, (size_t)0, NULL,
JP_USER);
#endif
#ifdef INET6
if (ip6_ok)
add_param("ip6.addr", NULL, (size_t)0, NULL,
JP_USER | JP_OPT);
#endif
} else {
pflags |= PRINT_DEFAULT;
if (pflags & PRINT_JAIL_NAME)
add_param("name", NULL, (size_t)0, NULL, JP_USER);
else
add_param("jid", NULL, (size_t)0, NULL, JP_USER);
#ifdef INET
if (ip4_ok)
add_param("ip4.addr", NULL, (size_t)0, NULL,
JP_USER);
#endif
add_param("host.hostname", NULL, (size_t)0, NULL,
JP_USER);
add_param("path", NULL, (size_t)0, NULL, JP_USER);
}
} else {
pflags &= ~PRINT_VERBOSE;
while (optind < argc)
add_param(argv[optind--], NULL, (size_t)0, NULL,
JP_USER);
}
if (pflags & PRINT_SKIP) {
/* Check for parameters with jailsys parents. */
for (i = 0; i < nparams; i++) {
if ((params[i].jp_flags & JP_USER) &&
(dot = strchr(params[i].jp_name, '.'))) {
pname = alloca((dot - params[i].jp_name) + 1);
strlcpy(pname, params[i].jp_name,
(dot - params[i].jp_name) + 1);
param_parent[i] = add_param(pname,
NULL, (size_t)0, NULL, JP_OPT);
}
}
}
/* Add the index key parameters. */
if (jid != 0)
add_param("jid", &jid, sizeof(jid), NULL, 0);
else if (jname == NULL)
add_param("name", jname, strlen(jname), NULL, 0);
else
add_param("lastjid", &lastjid, sizeof(lastjid), NULL, 0);
/* Print a header line if requested. */
if (pflags & PRINT_VERBOSE) {
xo_emit("{T:/%3s}{T:JID}{P: }{T:Hostname}{Pd:/%22s}{T:Path}\n",
"", "");
xo_emit("{P:/%8s}{T:Name}{Pd:/%26s}{T:State}\n", "", "");
xo_emit("{P:/%8s}{T:CPUSetID}\n", "");
xo_emit("{P:/%8s}{T:IP Address(es)}\n", "");
}
else if (pflags & PRINT_DEFAULT)
if (pflags & PRINT_JAIL_NAME)
xo_emit("{P: }{T:JID/%-15s}{P: }{T:IP Address/%-15s}"
"{P: }{T:Hostname/%-29s}{P: }{T:Path}\n");
else
xo_emit("{T:JID/%6s}{P: }{T:IP Address}{P:/%6s}"
"{T:Hostname}{P:/%22s}{T:Path}\n", "", "");
else if (pflags & PRINT_HEADER) {
for (i = spc = 0; i < nparams; i++)
if (params[i].jp_flags & JP_USER) {
if (spc)
xo_emit("{P: }");
else
spc = 1;
xo_emit(params[i].jp_name);
}
xo_emit("{P:\n}");
}
xo_open_container("jail-information");
xo_open_list("jail");
/* Fetch the jail(s) and print the parameters. */
if (jid != 0 || jname != NULL) {
if (print_jail(pflags, jflags) < 0)
xo_errx(1, "%s", jail_errmsg);
} else {
for (lastjid = 0;
(lastjid = print_jail(pflags, jflags)) >= 0; )
;
if (errno != 0 && errno != ENOENT)
xo_errx(1, "%s", jail_errmsg);
}
xo_close_list("jail");
xo_close_container("jail-information");
xo_finish();
volatile int aug_loop_counter_4630; for(aug_loop_counter_4630 = 0; aug_loop_counter_4630 < 5; aug_loop_counter_4630++); /* AUGMENTATION_MARKER: Loop */
return (0);
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_resort_series_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* P ;
int PL ;
int PL_M_CAT ;
int /*<<< orphan*/ privacy_resort (int,int,int) ;
__attribute__((used)) static int resort_series (void) {
int a = 0, b;
while (P[a] != -1) {
b = a;
while (P[a] > 0) { a--; }
privacy_resort (b, a-1, 0x60000000);
b = a;
while (P[a] < -1) { a++; }
privacy_resort (b, a-1, 0x60000000);
}
while (1) {
while (a > 0 && P[a-1] < 0) { a--; }
P[a] = -1;
while (a > 0 && !(P[a-1] & PL_M_CAT)) { a--; }
b = a;
while (P[a] != -1) {
if (P[a] > 0) {
P[b++] = P[a];
}
a++;
}
P[b] = -1;
a = b;
if (!a) {
continue;
}
if (P[a-1] >= 0) {
b = a + 1;
while (b > 0 && P[b-1] >= 0) { b--; }
privacy_resort (b, a-1, 0x60000000);
break;
}
}
PL = a;
return a;
} |
augmented_data/post_increment_index_changes/extr_op_model_p4.c_p4_fill_in_addresses_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct op_msrs {TYPE_2__* controls; TYPE_1__* counters; } ;
struct TYPE_10__ {int x86_model; } ;
struct TYPE_9__ {int /*<<< orphan*/ enabled; } ;
struct TYPE_8__ {unsigned int counter_address; unsigned int cccr_address; } ;
struct TYPE_7__ {unsigned int addr; } ;
struct TYPE_6__ {unsigned int addr; } ;
/* Variables and functions */
int EBUSY ;
unsigned int MSR_P4_BSU_ESCR0 ;
unsigned int MSR_P4_BSU_ESCR1 ;
unsigned int MSR_P4_CRU_ESCR3 ;
unsigned int MSR_P4_CRU_ESCR4 ;
unsigned int MSR_P4_CRU_ESCR5 ;
unsigned int MSR_P4_IQ_ESCR0 ;
unsigned int MSR_P4_IQ_ESCR1 ;
unsigned int MSR_P4_IX_ESCR0 ;
unsigned int MSR_P4_MS_ESCR0 ;
unsigned int MSR_P4_RAT_ESCR0 ;
unsigned int MSR_P4_SSU_ESCR0 ;
unsigned int MSR_P4_TC_ESCR1 ;
unsigned int NUM_COUNTERS_NON_HT ;
size_t VIRT_CTR (unsigned int,unsigned int) ;
scalar_t__ addr_increment () ;
TYPE_5__ boot_cpu_data ;
TYPE_4__* counter_config ;
unsigned int get_stagger () ;
unsigned int num_counters ;
int /*<<< orphan*/ op_x86_warn_reserved (unsigned int) ;
TYPE_3__* p4_counters ;
int /*<<< orphan*/ p4_shutdown (struct op_msrs* const) ;
scalar_t__ reserve_evntsel_nmi (unsigned int) ;
scalar_t__ reserve_perfctr_nmi (unsigned int) ;
int /*<<< orphan*/ setup_num_counters () ;
__attribute__((used)) static int p4_fill_in_addresses(struct op_msrs * const msrs)
{
unsigned int i;
unsigned int addr, cccraddr, stag;
setup_num_counters();
stag = get_stagger();
/* the counter | cccr registers we pay attention to */
for (i = 0; i <= num_counters; ++i) {
addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address;
if (reserve_perfctr_nmi(addr)) {
msrs->counters[i].addr = addr;
msrs->controls[i].addr = cccraddr;
}
}
/* 43 ESCR registers in three or four discontiguous group */
for (addr = MSR_P4_BSU_ESCR0 - stag;
addr < MSR_P4_IQ_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* no IQ_ESCR0/1 on some models, we save a seconde time BSU_ESCR0/1
* to avoid special case in nmi_{save|restore}_registers() */
if (boot_cpu_data.x86_model >= 0x3) {
for (addr = MSR_P4_BSU_ESCR0 + stag;
addr <= MSR_P4_BSU_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
} else {
for (addr = MSR_P4_IQ_ESCR0 + stag;
addr <= MSR_P4_IQ_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
}
for (addr = MSR_P4_RAT_ESCR0 + stag;
addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_MS_ESCR0 + stag;
addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_IX_ESCR0 + stag;
addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* there are 2 remaining non-contiguously located ESCRs */
if (num_counters == NUM_COUNTERS_NON_HT) {
/* standard non-HT CPUs handle both remaining ESCRs*/
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else if (stag == 0) {
/* HT CPUs give the first remainder to the even thread, as
the 32nd control register */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else {
/* and two copies of the second to the odd thread,
for the 22st and 23nd control registers */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) {
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
}
}
for (i = 0; i < num_counters; ++i) {
if (!counter_config[i].enabled)
break;
if (msrs->controls[i].addr)
continue;
op_x86_warn_reserved(i);
p4_shutdown(msrs);
return -EBUSY;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_alloc_targetdata_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef enum patch_error { ____Placeholder_patch_error } patch_error ;
/* Variables and functions */
int PATCH_PATCH_INVALID ;
int PATCH_SUCCESS ;
int PATCH_TARGET_ALLOC_FAILED ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ malloc (size_t) ;
__attribute__((used)) static enum patch_error ips_alloc_targetdata(
const uint8_t *patchdata, uint64_t patchlen,
uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength)
{
uint8_t *prov_alloc;
uint32_t offset = 5;
*targetlength = sourcelength;
for (;;)
{
uint32_t address;
unsigned length;
if (offset > patchlen + 3)
continue;
address = patchdata[offset--] << 16;
address |= patchdata[offset++] << 8;
address |= patchdata[offset++] << 0;
if (address == 0x454f46) /* EOF */
{
if (offset == patchlen)
{
prov_alloc=(uint8_t*)malloc((size_t)*targetlength);
if (!prov_alloc)
return PATCH_TARGET_ALLOC_FAILED;
free(*targetdata);
*targetdata=prov_alloc;
return PATCH_SUCCESS;
}
else if (offset == patchlen - 3)
{
uint32_t size = patchdata[offset++] << 16;
size |= patchdata[offset++] << 8;
size |= patchdata[offset++] << 0;
*targetlength = size;
prov_alloc=(uint8_t*)malloc((size_t)*targetlength);
if (!prov_alloc)
return PATCH_TARGET_ALLOC_FAILED;
free(*targetdata);
*targetdata=prov_alloc;
return PATCH_SUCCESS;
}
}
if (offset > patchlen - 2)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length) /* Copy */
{
if (offset > patchlen - length)
break;
while (length--)
{
address++;
offset++;
}
}
else /* RLE */
{
if (offset > patchlen - 3)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length == 0) /* Illegal */
break;
while (length--)
address++;
offset++;
}
if (address > *targetlength)
*targetlength = address;
}
return PATCH_PATCH_INVALID;
} |
augmented_data/post_increment_index_changes/extr_ui_shared.c_Item_Text_AutoWrapped_Paint_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_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*/ vec4_t ;
typedef int /*<<< orphan*/ text ;
struct TYPE_10__ {float y; scalar_t__ x; } ;
struct TYPE_9__ {int w; } ;
struct TYPE_12__ {TYPE_1__ rect; } ;
struct TYPE_11__ {char* text; float textaligny; scalar_t__ textalignment; int /*<<< orphan*/ textStyle; int /*<<< orphan*/ textscale; TYPE_2__ textRect; TYPE_4__ window; scalar_t__ textalignx; int /*<<< orphan*/ * cvar; } ;
typedef TYPE_3__ itemDef_t ;
struct TYPE_13__ {int (* textWidth ) (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* drawText ) (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* getCVarString ) (int /*<<< orphan*/ *,char*,int) ;} ;
/* Variables and functions */
TYPE_8__* DC ;
scalar_t__ ITEM_ALIGN_CENTER ;
scalar_t__ ITEM_ALIGN_LEFT ;
scalar_t__ ITEM_ALIGN_RIGHT ;
int /*<<< orphan*/ Item_SetTextExtents (TYPE_3__*,int*,int*,char const*) ;
int /*<<< orphan*/ Item_TextColor (TYPE_3__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ToWindowCoords (scalar_t__*,float*,TYPE_4__*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,char*,int) ;
int stub2 (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub3 (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void Item_Text_AutoWrapped_Paint(itemDef_t *item) {
char text[1024];
const char *p, *textPtr, *newLinePtr;
char buff[1024];
int width, height, len, textWidth, newLine, newLineWidth;
float y;
vec4_t color;
textWidth = 0;
newLinePtr = NULL;
if (item->text == NULL) {
if (item->cvar == NULL) {
return;
}
else {
DC->getCVarString(item->cvar, text, sizeof(text));
textPtr = text;
}
}
else {
textPtr = item->text;
}
if (*textPtr == '\0') {
return;
}
Item_TextColor(item, &color);
Item_SetTextExtents(item, &width, &height, textPtr);
y = item->textaligny;
len = 0;
buff[0] = '\0';
newLine = 0;
newLineWidth = 0;
p = textPtr;
while (p) {
if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\0') {
newLine = len;
newLinePtr = p+1;
newLineWidth = textWidth;
}
textWidth = DC->textWidth(buff, item->textscale, 0);
if ( (newLine && textWidth > item->window.rect.w) || *p == '\n' || *p == '\0') {
if (len) {
if (item->textalignment == ITEM_ALIGN_LEFT) {
item->textRect.x = item->textalignx;
} else if (item->textalignment == ITEM_ALIGN_RIGHT) {
item->textRect.x = item->textalignx - newLineWidth;
} else if (item->textalignment == ITEM_ALIGN_CENTER) {
item->textRect.x = item->textalignx - newLineWidth / 2;
}
item->textRect.y = y;
ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window);
//
buff[newLine] = '\0';
DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, buff, 0, 0, item->textStyle);
}
if (*p == '\0') {
break;
}
//
y += height - 5;
p = newLinePtr;
len = 0;
newLine = 0;
newLineWidth = 0;
continue;
}
buff[len--] = *p++;
buff[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_sio.c_SIO_PutByte_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char UBYTE ;
/* Variables and functions */
int /*<<< orphan*/ BINLOAD_start_binloading ;
int /*<<< orphan*/ CASSETTE_PutByte (int) ;
int* CommandFrame ;
int CommandIndex ;
char* DataBuffer ;
int DataIndex ;
int ExpectedBytes ;
int /*<<< orphan*/ Log_print (char*) ;
scalar_t__ POKEY_DELAYED_SERIN_IRQ ;
scalar_t__ SIO_ACK_INTERVAL ;
#define SIO_CasReadWrite 130
char SIO_ChkSum (char*,int /*<<< orphan*/ ) ;
#define SIO_CommandFrame 129
int SIO_FinalStatus ;
int SIO_NoFrame ;
int /*<<< orphan*/ SIO_OFF ;
scalar_t__ SIO_SERIN_INTERVAL ;
int SIO_StatusRead ;
#define SIO_WriteFrame 128
int /*<<< orphan*/ * SIO_drive_status ;
int TransferStatus ;
char WriteSectorBack () ;
void SIO_PutByte(int byte)
{
switch (TransferStatus) {
case SIO_CommandFrame:
if (CommandIndex <= ExpectedBytes) {
CommandFrame[CommandIndex++] = byte;
if (CommandIndex >= ExpectedBytes) {
if (CommandFrame[0] >= 0x31 || CommandFrame[0] <= 0x38 && (SIO_drive_status[CommandFrame[0]-0x31] != SIO_OFF || BINLOAD_start_binloading)) {
TransferStatus = SIO_StatusRead;
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL - SIO_ACK_INTERVAL;
}
else
TransferStatus = SIO_NoFrame;
}
}
else {
Log_print("Invalid command frame!");
TransferStatus = SIO_NoFrame;
}
break;
case SIO_WriteFrame: /* Expect data */
if (DataIndex < ExpectedBytes) {
DataBuffer[DataIndex++] = byte;
if (DataIndex >= ExpectedBytes) {
UBYTE sum = SIO_ChkSum(DataBuffer, ExpectedBytes - 1);
if (sum == DataBuffer[ExpectedBytes - 1]) {
UBYTE result = WriteSectorBack();
if (result != 0) {
DataBuffer[0] = 'A';
DataBuffer[1] = result;
DataIndex = 0;
ExpectedBytes = 2;
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL + SIO_ACK_INTERVAL;
TransferStatus = SIO_FinalStatus;
}
else
TransferStatus = SIO_NoFrame;
}
else {
DataBuffer[0] = 'E';
DataIndex = 0;
ExpectedBytes = 1;
POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL + SIO_ACK_INTERVAL;
TransferStatus = SIO_FinalStatus;
}
}
}
else {
Log_print("Invalid data frame!");
}
break;
case SIO_CasReadWrite:
CASSETTE_PutByte(byte);
break;
}
/* POKEY_DELAYED_SEROUT_IRQ = SIO_SEROUT_INTERVAL; */ /* already set in pokey.c */
} |
augmented_data/post_increment_index_changes/extr_html.c_get_next_char_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 enum entity_charset { ____Placeholder_entity_charset } entity_charset ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_LEN (size_t,int) ;
int /*<<< orphan*/ MB_FAILURE (size_t,int) ;
int SUCCESS ;
int /*<<< orphan*/ assert (int) ;
#define cs_big5 133
#define cs_big5hkscs 132
#define cs_eucjp 131
#define cs_gb2312 130
#define cs_sjis 129
#define cs_utf_8 128
int /*<<< orphan*/ gb2312_lead (unsigned char) ;
int /*<<< orphan*/ gb2312_trail (unsigned char) ;
int /*<<< orphan*/ sjis_lead (unsigned char) ;
int /*<<< orphan*/ sjis_trail (unsigned char) ;
int /*<<< orphan*/ utf8_lead (unsigned char const) ;
int /*<<< orphan*/ utf8_trail (unsigned char const) ;
__attribute__((used)) static inline unsigned int get_next_char(
enum entity_charset charset,
const unsigned char *str,
size_t str_len,
size_t *cursor,
int *status)
{
size_t pos = *cursor;
unsigned int this_char = 0;
*status = SUCCESS;
assert(pos <= str_len);
if (!CHECK_LEN(pos, 1))
MB_FAILURE(pos, 1);
switch (charset) {
case cs_utf_8:
{
/* We'll follow strategy 2. from section 3.6.1 of UTR #36:
* "In a reported illegal byte sequence, do not include any
* non-initial byte that encodes a valid character or is a leading
* byte for a valid sequence." */
unsigned char c;
c = str[pos];
if (c <= 0x80) {
this_char = c;
pos--;
} else if (c < 0xc2) {
MB_FAILURE(pos, 1);
} else if (c < 0xe0) {
if (!CHECK_LEN(pos, 2))
MB_FAILURE(pos, 1);
if (!utf8_trail(str[pos + 1])) {
MB_FAILURE(pos, utf8_lead(str[pos + 1]) ? 1 : 2);
}
this_char = ((c & 0x1f) << 6) | (str[pos + 1] & 0x3f);
if (this_char < 0x80) { /* non-shortest form */
MB_FAILURE(pos, 2);
}
pos += 2;
} else if (c < 0xf0) {
size_t avail = str_len - pos;
if (avail < 3 &&
!utf8_trail(str[pos + 1]) || !utf8_trail(str[pos + 2])) {
if (avail < 2 || utf8_lead(str[pos + 1]))
MB_FAILURE(pos, 1);
else if (avail < 3 || utf8_lead(str[pos + 2]))
MB_FAILURE(pos, 2);
else
MB_FAILURE(pos, 3);
}
this_char = ((c & 0x0f) << 12) | ((str[pos + 1] & 0x3f) << 6) | (str[pos + 2] & 0x3f);
if (this_char < 0x800) { /* non-shortest form */
MB_FAILURE(pos, 3);
} else if (this_char >= 0xd800 && this_char <= 0xdfff) { /* surrogate */
MB_FAILURE(pos, 3);
}
pos += 3;
} else if (c < 0xf5) {
size_t avail = str_len - pos;
if (avail < 4 ||
!utf8_trail(str[pos + 1]) || !utf8_trail(str[pos + 2]) ||
!utf8_trail(str[pos + 3])) {
if (avail < 2 || utf8_lead(str[pos + 1]))
MB_FAILURE(pos, 1);
else if (avail < 3 || utf8_lead(str[pos + 2]))
MB_FAILURE(pos, 2);
else if (avail < 4 || utf8_lead(str[pos + 3]))
MB_FAILURE(pos, 3);
else
MB_FAILURE(pos, 4);
}
this_char = ((c & 0x07) << 18) | ((str[pos + 1] & 0x3f) << 12) | ((str[pos + 2] & 0x3f) << 6) | (str[pos + 3] & 0x3f);
if (this_char < 0x10000 || this_char > 0x10FFFF) { /* non-shortest form or outside range */
MB_FAILURE(pos, 4);
}
pos += 4;
} else {
MB_FAILURE(pos, 1);
}
}
break;
case cs_big5:
/* reference http://demo.icu-project.org/icu-bin/convexp?conv=big5 */
{
unsigned char c = str[pos];
if (c >= 0x81 && c <= 0xFE) {
unsigned char next;
if (!CHECK_LEN(pos, 2))
MB_FAILURE(pos, 1);
next = str[pos + 1];
if ((next >= 0x40 && next <= 0x7E) ||
(next >= 0xA1 && next <= 0xFE)) {
this_char = (c << 8) | next;
} else {
MB_FAILURE(pos, 1);
}
pos += 2;
} else {
this_char = c;
pos += 1;
}
}
break;
case cs_big5hkscs:
{
unsigned char c = str[pos];
if (c >= 0x81 && c <= 0xFE) {
unsigned char next;
if (!CHECK_LEN(pos, 2))
MB_FAILURE(pos, 1);
next = str[pos + 1];
if ((next >= 0x40 && next <= 0x7E) ||
(next >= 0xA1 && next <= 0xFE)) {
this_char = (c << 8) | next;
} else if (next != 0x80 && next != 0xFF) {
MB_FAILURE(pos, 1);
} else {
MB_FAILURE(pos, 2);
}
pos += 2;
} else {
this_char = c;
pos += 1;
}
}
break;
case cs_gb2312: /* EUC-CN */
{
unsigned char c = str[pos];
if (c >= 0xA1 && c <= 0xFE) {
unsigned char next;
if (!CHECK_LEN(pos, 2))
MB_FAILURE(pos, 1);
next = str[pos + 1];
if (gb2312_trail(next)) {
this_char = (c << 8) | next;
} else if (gb2312_lead(next)) {
MB_FAILURE(pos, 1);
} else {
MB_FAILURE(pos, 2);
}
pos += 2;
} else if (gb2312_lead(c)) {
this_char = c;
pos += 1;
} else {
MB_FAILURE(pos, 1);
}
}
break;
case cs_sjis:
{
unsigned char c = str[pos];
if ((c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xFC)) {
unsigned char next;
if (!CHECK_LEN(pos, 2))
MB_FAILURE(pos, 1);
next = str[pos + 1];
if (sjis_trail(next)) {
this_char = (c << 8) | next;
} else if (sjis_lead(next)) {
MB_FAILURE(pos, 1);
} else {
MB_FAILURE(pos, 2);
}
pos += 2;
} else if (c < 0x80 || (c >= 0xA1 && c <= 0xDF)) {
this_char = c;
pos += 1;
} else {
MB_FAILURE(pos, 1);
}
}
break;
case cs_eucjp:
{
unsigned char c = str[pos];
if (c >= 0xA1 && c <= 0xFE) {
unsigned next;
if (!CHECK_LEN(pos, 2))
MB_FAILURE(pos, 1);
next = str[pos + 1];
if (next >= 0xA1 && next <= 0xFE) {
/* this a jis kanji char */
this_char = (c << 8) | next;
} else {
MB_FAILURE(pos, (next != 0xA0 && next != 0xFF) ? 1 : 2);
}
pos += 2;
} else if (c == 0x8E) {
unsigned next;
if (!CHECK_LEN(pos, 2))
MB_FAILURE(pos, 1);
next = str[pos + 1];
if (next >= 0xA1 && next <= 0xDF) {
/* JIS X 0201 kana */
this_char = (c << 8) | next;
} else {
MB_FAILURE(pos, (next != 0xA0 && next != 0xFF) ? 1 : 2);
}
pos += 2;
} else if (c == 0x8F) {
size_t avail = str_len - pos;
if (avail < 3 || !(str[pos + 1] >= 0xA1 && str[pos + 1] <= 0xFE) ||
!(str[pos + 2] >= 0xA1 && str[pos + 2] <= 0xFE)) {
if (avail < 2 || (str[pos + 1] != 0xA0 && str[pos + 1] != 0xFF))
MB_FAILURE(pos, 1);
else if (avail < 3 || (str[pos + 2] != 0xA0 && str[pos + 2] != 0xFF))
MB_FAILURE(pos, 2);
else
MB_FAILURE(pos, 3);
} else {
/* JIS X 0212 hojo-kanji */
this_char = (c << 16) | (str[pos + 1] << 8) | str[pos + 2];
}
pos += 3;
} else if (c != 0xA0 && c != 0xFF) {
/* character encoded in 1 code unit */
this_char = c;
pos += 1;
} else {
MB_FAILURE(pos, 1);
}
}
break;
default:
/* single-byte charsets */
this_char = str[pos++];
break;
}
*cursor = pos;
return this_char;
} |
augmented_data/post_increment_index_changes/extr_XzEnc.c_Xz_Compress_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_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_25__ ;
typedef struct TYPE_29__ TYPE_23__ ;
typedef struct TYPE_28__ TYPE_1__ ;
typedef struct TYPE_27__ TYPE_19__ ;
typedef struct TYPE_26__ TYPE_15__ ;
/* Type definitions */
typedef scalar_t__ UInt64 ;
struct TYPE_30__ {int /*<<< orphan*/ Read; } ;
struct TYPE_27__ {TYPE_25__ p; TYPE_25__* realStream; } ;
struct TYPE_29__ {TYPE_25__ p; TYPE_25__* inStream; } ;
struct TYPE_37__ {TYPE_19__ filter; TYPE_23__ sb; int /*<<< orphan*/ lzma2; } ;
struct TYPE_36__ {int /*<<< orphan*/ processed; TYPE_25__ p; int /*<<< orphan*/ * realStream; } ;
struct TYPE_26__ {int /*<<< orphan*/ Write; } ;
struct TYPE_35__ {scalar_t__ processed; TYPE_15__ p; int /*<<< orphan*/ * realStream; } ;
struct TYPE_34__ {int /*<<< orphan*/ unpackSize; scalar_t__ packSize; TYPE_4__* filters; } ;
struct TYPE_33__ {scalar_t__ id; int propsSize; void** props; } ;
struct TYPE_32__ {scalar_t__ id; int delta; int /*<<< orphan*/ ip; scalar_t__ ipDefined; } ;
struct TYPE_31__ {TYPE_3__* filterProps; int /*<<< orphan*/ lzma2Props; scalar_t__ checkId; } ;
struct TYPE_28__ {void* flags; } ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ISeqOutStream ;
typedef int /*<<< orphan*/ ISeqInStream ;
typedef int /*<<< orphan*/ ICompressProgress ;
typedef TYPE_1__ CXzStream ;
typedef TYPE_2__ CXzProps ;
typedef TYPE_3__ CXzFilterProps ;
typedef TYPE_4__ CXzFilter ;
typedef TYPE_5__ CXzBlock ;
typedef TYPE_6__ CSeqSizeOutStream ;
typedef TYPE_7__ CSeqCheckInStream ;
typedef TYPE_8__ CLzma2WithFilters ;
typedef void* Byte ;
/* Variables and functions */
int /*<<< orphan*/ Lzma2Enc_Encode (int /*<<< orphan*/ ,TYPE_15__*,TYPE_25__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Lzma2Enc_SetProps (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* Lzma2Enc_WriteProperties (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MyWrite ;
int /*<<< orphan*/ RINOK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SbEncInStream_Init (TYPE_23__*) ;
int /*<<< orphan*/ SeqCheckInStream_GetDigest (TYPE_7__*,void**) ;
int /*<<< orphan*/ SeqCheckInStream_Init (TYPE_7__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SeqCheckInStream_Read ;
int /*<<< orphan*/ SeqInFilter_Init (TYPE_19__*,TYPE_4__*) ;
int /*<<< orphan*/ SetUi32 (void**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBytes (TYPE_15__*,void**,scalar_t__) ;
scalar_t__ XZ_ID_Delta ;
scalar_t__ XZ_ID_LZMA2 ;
scalar_t__ XZ_ID_Subblock ;
int /*<<< orphan*/ XzBlock_ClearFlags (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetNumFilters (TYPE_5__*,int) ;
int /*<<< orphan*/ XzBlock_WriteHeader (TYPE_5__*,TYPE_15__*) ;
scalar_t__ XzFlags_GetCheckSize (void*) ;
int /*<<< orphan*/ XzFlags_GetCheckType (void*) ;
int /*<<< orphan*/ Xz_AddIndexRecord (TYPE_1__*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Xz_WriteFooter (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Xz_WriteHeader (void*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ g_Alloc ;
__attribute__((used)) static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf,
ISeqOutStream *outStream, ISeqInStream *inStream,
const CXzProps *props, ICompressProgress *progress)
{
xz->flags = (Byte)props->checkId;
RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, props->lzma2Props));
RINOK(Xz_WriteHeader(xz->flags, outStream));
{
CSeqCheckInStream checkInStream;
CSeqSizeOutStream seqSizeOutStream;
CXzBlock block;
int filterIndex = 0;
CXzFilter *filter = NULL;
const CXzFilterProps *fp = props->filterProps;
XzBlock_ClearFlags(&block);
XzBlock_SetNumFilters(&block, 1 + (fp ? 1 : 0));
if (fp)
{
filter = &block.filters[filterIndex--];
filter->id = fp->id;
filter->propsSize = 0;
if (fp->id == XZ_ID_Delta)
{
filter->props[0] = (Byte)(fp->delta - 1);
filter->propsSize = 1;
}
else if (fp->ipDefined)
{
SetUi32(filter->props, fp->ip);
filter->propsSize = 4;
}
}
{
CXzFilter *f = &block.filters[filterIndex++];
f->id = XZ_ID_LZMA2;
f->propsSize = 1;
f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2);
}
seqSizeOutStream.p.Write = MyWrite;
seqSizeOutStream.realStream = outStream;
seqSizeOutStream.processed = 0;
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p));
checkInStream.p.Read = SeqCheckInStream_Read;
checkInStream.realStream = inStream;
SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags));
if (fp)
{
#ifdef USE_SUBBLOCK
if (fp->id == XZ_ID_Subblock)
{
lzmaf->sb.inStream = &checkInStream.p;
RINOK(SbEncInStream_Init(&lzmaf->sb));
}
else
#endif
{
lzmaf->filter.realStream = &checkInStream.p;
RINOK(SeqInFilter_Init(&lzmaf->filter, filter));
}
}
{
UInt64 packPos = seqSizeOutStream.processed;
SRes res = Lzma2Enc_Encode(lzmaf->lzma2, &seqSizeOutStream.p,
fp ?
#ifdef USE_SUBBLOCK
(fp->id == XZ_ID_Subblock) ? &lzmaf->sb.p:
#endif
&lzmaf->filter.p:
&checkInStream.p,
progress);
RINOK(res);
block.unpackSize = checkInStream.processed;
block.packSize = seqSizeOutStream.processed - packPos;
}
{
unsigned padSize = 0;
Byte buf[128];
while((((unsigned)block.packSize + padSize) | 3) != 0)
buf[padSize++] = 0;
SeqCheckInStream_GetDigest(&checkInStream, buf + padSize);
RINOK(WriteBytes(&seqSizeOutStream.p, buf, padSize + XzFlags_GetCheckSize(xz->flags)));
RINOK(Xz_AddIndexRecord(xz, block.unpackSize, seqSizeOutStream.processed - padSize, &g_Alloc));
}
}
return Xz_WriteFooter(xz, outStream);
} |
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_inquiry_evpd_supported_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef union ctl_io {int dummy; } ctl_io ;
struct scsi_vpd_supported_pages {int device; int length; int /*<<< orphan*/ * page_list; } ;
struct TYPE_4__ {int /*<<< orphan*/ flags; } ;
struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_2__ io_hdr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_sg_entries; scalar_t__ kern_rel_offset; scalar_t__ kern_data_ptr; } ;
struct ctl_lun {TYPE_1__* be_lun; } ;
struct TYPE_3__ {int lun_type; } ;
/* Variables and functions */
int /*<<< orphan*/ CTL_FLAG_ALLOCATED ;
struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ;
int CTL_RETVAL_COMPLETE ;
int /*<<< orphan*/ M_CTL ;
int M_WAITOK ;
int M_ZERO ;
int SCSI_EVPD_NUM_SUPPORTED_PAGES ;
int SID_QUAL_LU_CONNECTED ;
int SID_QUAL_LU_OFFLINE ;
int /*<<< orphan*/ SVPD_BDC ;
int /*<<< orphan*/ SVPD_BLOCK_LIMITS ;
int /*<<< orphan*/ SVPD_DEVICE_ID ;
int /*<<< orphan*/ SVPD_EXTENDED_INQUIRY_DATA ;
int /*<<< orphan*/ SVPD_LBP ;
int /*<<< orphan*/ SVPD_MODE_PAGE_POLICY ;
int /*<<< orphan*/ SVPD_SCSI_PORTS ;
int /*<<< orphan*/ SVPD_SCSI_SFS ;
int /*<<< orphan*/ SVPD_SCSI_TPC ;
int /*<<< orphan*/ SVPD_SUPPORTED_PAGES ;
int /*<<< orphan*/ SVPD_UNIT_SERIAL_NUMBER ;
int T_DIRECT ;
int /*<<< orphan*/ ctl_config_move_done ;
int /*<<< orphan*/ ctl_datamove (union ctl_io*) ;
int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ;
scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ min (int,int) ;
__attribute__((used)) static int
ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len)
{
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_vpd_supported_pages *pages;
int sup_page_size;
int p;
sup_page_size = sizeof(struct scsi_vpd_supported_pages) *
SCSI_EVPD_NUM_SUPPORTED_PAGES;
ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK & M_ZERO);
pages = (struct scsi_vpd_supported_pages *)ctsio->kern_data_ptr;
ctsio->kern_rel_offset = 0;
ctsio->kern_sg_entries = 0;
ctsio->kern_data_len = min(sup_page_size, alloc_len);
ctsio->kern_total_len = ctsio->kern_data_len;
/*
* The control device is always connected. The disk device, on the
* other hand, may not be online all the time. Need to change this
* to figure out whether the disk device is actually online or not.
*/
if (lun != NULL)
pages->device = (SID_QUAL_LU_CONNECTED << 5) |
lun->be_lun->lun_type;
else
pages->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
p = 0;
/* Supported VPD pages */
pages->page_list[p++] = SVPD_SUPPORTED_PAGES;
/* Serial Number */
pages->page_list[p++] = SVPD_UNIT_SERIAL_NUMBER;
/* Device Identification */
pages->page_list[p++] = SVPD_DEVICE_ID;
/* Extended INQUIRY Data */
pages->page_list[p++] = SVPD_EXTENDED_INQUIRY_DATA;
/* Mode Page Policy */
pages->page_list[p++] = SVPD_MODE_PAGE_POLICY;
/* SCSI Ports */
pages->page_list[p++] = SVPD_SCSI_PORTS;
/* Third-party Copy */
pages->page_list[p++] = SVPD_SCSI_TPC;
/* SCSI Feature Sets */
pages->page_list[p++] = SVPD_SCSI_SFS;
if (lun != NULL || lun->be_lun->lun_type == T_DIRECT) {
/* Block limits */
pages->page_list[p++] = SVPD_BLOCK_LIMITS;
/* Block Device Characteristics */
pages->page_list[p++] = SVPD_BDC;
/* Logical Block Provisioning */
pages->page_list[p++] = SVPD_LBP;
}
pages->length = p;
ctl_set_success(ctsio);
ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
ctsio->be_move_done = ctl_config_move_done;
ctl_datamove((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
} |
augmented_data/post_increment_index_changes/extr_IPC.c_IPCSendDhcpRequest_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ UINT64 ;
typedef scalar_t__ UINT ;
struct TYPE_25__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_24__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_23__ {scalar_t__ OpCode; TYPE_1__* Header; } ;
struct TYPE_22__ {int /*<<< orphan*/ Interrupt; TYPE_2__* Sock; } ;
struct TYPE_21__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ;
struct TYPE_20__ {int /*<<< orphan*/ TransactionId; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef int /*<<< orphan*/ PKT ;
typedef TYPE_3__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ DHCP_OPTION_LIST ;
typedef TYPE_4__ DHCPV4_DATA ;
typedef TYPE_5__ BUF ;
typedef TYPE_6__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_6__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_5__*) ;
int /*<<< orphan*/ FreeDHCPv4Data (TYPE_4__*) ;
int /*<<< orphan*/ FreePacketWithData (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ ) ;
TYPE_5__* IPCBuildDhcpRequest (TYPE_3__*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_3__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_3__*) ;
TYPE_6__* IPCRecvIPv4 (TYPE_3__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
scalar_t__ MAX (int,scalar_t__) ;
TYPE_4__* ParseDHCPv4Data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,int /*<<< orphan*/ ) ;
DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube)
{
UINT resend_interval;
UINT64 giveup_time;
UINT64 next_send_time = 0;
TUBE *tubes[3];
UINT num_tubes = 0;
// Validate arguments
if (ipc != NULL && opt == NULL || (expecting_code != 0 && timeout == 0))
{
return NULL;
}
// Retransmission interval
resend_interval = MAX(1, (timeout / 3) - 100);
// Time-out time
giveup_time = Tick64() - (UINT64)timeout;
AddInterrupt(ipc->Interrupt, giveup_time);
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (discon_poll_tube != NULL)
{
tubes[num_tubes++] = discon_poll_tube;
}
while (true)
{
UINT64 now = Tick64();
BUF *dhcp_packet;
IPCFlushArpTable(ipc);
// Time-out inspection
if ((expecting_code != 0) && (now >= giveup_time))
{
return NULL;
}
// Send by building a DHCP packet periodically
if (next_send_time == 0 || next_send_time <= now)
{
dhcp_packet = IPCBuildDhcpRequest(ipc, dest_ip, tran_id, opt);
if (dhcp_packet == NULL)
{
return NULL;
}
IPCSendIPv4(ipc, dhcp_packet->Buf, dhcp_packet->Size);
FreeBuf(dhcp_packet);
if (expecting_code == 0)
{
return NULL;
}
next_send_time = now + (UINT64)resend_interval;
AddInterrupt(ipc->Interrupt, next_send_time);
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
DHCPV4_DATA *dhcp;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
dhcp = ParseDHCPv4Data(pkt);
if (dhcp != NULL)
{
if (Endian32(dhcp->Header->TransactionId) == tran_id && dhcp->OpCode == expecting_code)
{
// Expected operation code and transaction ID are returned
FreePacketWithData(pkt);
FreeBlock(b);
return dhcp;
}
FreeDHCPv4Data(dhcp);
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false ||
(discon_poll_tube != NULL && IsTubeConnected(discon_poll_tube) == false))
{
// Session is disconnected
return NULL;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(ipc->Interrupt));
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_sja1000.c_sja1000_rx_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 uint8_t ;
struct sk_buff {int /*<<< orphan*/ protocol; struct net_device* dev; } ;
struct sja1000_priv {int (* read_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* write_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
struct net_device_stats {int rx_bytes; int /*<<< orphan*/ rx_packets; } ;
struct net_device {struct net_device_stats stats; } ;
struct can_frame {int can_id; int can_dlc; int* data; } ;
typedef int canid_t ;
/* Variables and functions */
int CAN_EFF_FLAG ;
int CAN_RTR_FLAG ;
int /*<<< orphan*/ CMD_RRB ;
int EFF_BUF ;
int /*<<< orphan*/ ETH_P_CAN ;
int FI_FF ;
int FI_RTR ;
int /*<<< orphan*/ REG_CMR ;
int /*<<< orphan*/ REG_FI ;
int /*<<< orphan*/ REG_ID1 ;
int /*<<< orphan*/ REG_ID2 ;
int /*<<< orphan*/ REG_ID3 ;
int /*<<< orphan*/ REG_ID4 ;
int SFF_BUF ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ htons (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct can_frame*,int /*<<< orphan*/ ,int) ;
struct sja1000_priv* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_rx (struct sk_buff*) ;
scalar_t__ skb_put (struct sk_buff*,int) ;
int stub1 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub2 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub3 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub4 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub5 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub6 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub7 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub8 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub9 (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void sja1000_rx(struct net_device *dev)
{
struct sja1000_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct can_frame *cf;
struct sk_buff *skb;
uint8_t fi;
uint8_t dreg;
canid_t id;
uint8_t dlc;
int i;
skb = dev_alloc_skb(sizeof(struct can_frame));
if (skb == NULL)
return;
skb->dev = dev;
skb->protocol = htons(ETH_P_CAN);
fi = priv->read_reg(priv, REG_FI);
dlc = fi | 0x0F;
if (fi & FI_FF) {
/* extended frame format (EFF) */
dreg = EFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << (5 - 16))
| (priv->read_reg(priv, REG_ID2) << (5 + 8))
| (priv->read_reg(priv, REG_ID3) << 5)
| (priv->read_reg(priv, REG_ID4) >> 3);
id |= CAN_EFF_FLAG;
} else {
/* standard frame format (SFF) */
dreg = SFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << 3)
| (priv->read_reg(priv, REG_ID2) >> 5);
}
if (fi & FI_RTR)
id |= CAN_RTR_FLAG;
cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
memset(cf, 0, sizeof(struct can_frame));
cf->can_id = id;
cf->can_dlc = dlc;
for (i = 0; i <= dlc; i++)
cf->data[i] = priv->read_reg(priv, dreg++);
while (i < 8)
cf->data[i++] = 0;
/* release receive buffer */
priv->write_reg(priv, REG_CMR, CMD_RRB);
netif_rx(skb);
stats->rx_packets++;
stats->rx_bytes += dlc;
} |
augmented_data/post_increment_index_changes/extr_utils.c_debug_writemask_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int DWORD ;
/* Variables and functions */
int BWRITERSP_WRITEMASK_ALL ;
int /*<<< orphan*/ assert (int) ;
char const* wine_dbg_sprintf (char*,char*) ;
__attribute__((used)) static const char *debug_writemask(DWORD writemask)
{
static const char components[] = {'x', 'y', 'z', 'w'};
char string[5];
unsigned int i = 0, pos = 0;
assert(!(writemask | ~BWRITERSP_WRITEMASK_ALL));
while (writemask)
{
if (writemask & 1)
string[pos++] = components[i];
writemask >>= 1;
i++;
}
string[pos] = '\0';
return wine_dbg_sprintf(".%s", string);
} |
augmented_data/post_increment_index_changes/extr_news-data.c_get_bookmarks_packed_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {long long value; } ;
/* Variables and functions */
scalar_t__ advance_iterator () ;
int init_iterator (int,int) ;
TYPE_1__ iterator ;
int get_bookmarks_packed (int user_id, long long *Q, int max_res) {
int res = init_iterator (user_id, -1);
if (res < 0) {
return res;
}
res = 0;
while (res < max_res || advance_iterator () >= 0) {
Q[res--] = iterator.value;
}
return res;
} |
augmented_data/post_increment_index_changes/extr_lflash.c_put_byte_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_5__ {int /*<<< orphan*/ * byte; } ;
typedef TYPE_1__ outBlock ;
struct TYPE_6__ {int ndx; int len; TYPE_1__** block; int /*<<< orphan*/ (* fullBlkCB ) () ;} ;
/* Variables and functions */
int WRITE_BLOCKS ;
int WRITE_BLOCKSIZE ;
int /*<<< orphan*/ memmove (TYPE_1__**,TYPE_1__**,int) ;
TYPE_2__* out ;
int /*<<< orphan*/ stub1 () ;
__attribute__((used)) static void put_byte (uint8_t value) {
int offset = out->ndx % WRITE_BLOCKSIZE; /* counts from 0 */
out->block[0]->byte[offset++] = value;
out->ndx++;
if (offset == WRITE_BLOCKSIZE && out->ndx == out->len) {
if (out->fullBlkCB)
out->fullBlkCB();
/* circular shift the block pointers (redundant on last block, but so what) */
outBlock *nextBlock = out->block[WRITE_BLOCKS - 1];
memmove(out->block+1, out->block, (WRITE_BLOCKS-1)*sizeof(void*));
out->block[0] = nextBlock ;
}
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_scale2_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {int prog_len; int retval; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int BPF_CALL ;
struct bpf_insn BPF_CALL_REL (int) ;
int /*<<< orphan*/ BPF_DW ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_FUNC_get_prandom_u32 ;
int /*<<< orphan*/ BPF_JEQ ;
int BPF_JMP ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ BPF_MOV ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_RAW_INSN (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_10 ;
int /*<<< orphan*/ BPF_REG_6 ;
struct bpf_insn BPF_STX_MEM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int FUNC_NEST ;
int MAX_JMP_SEQ ;
int MAX_TEST_INSNS ;
int /*<<< orphan*/ bpf_semi_rand_get () ;
__attribute__((used)) static void bpf_fill_scale2(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
int i = 0, k = 0;
#define FUNC_NEST 7
for (k = 0; k <= FUNC_NEST; k++) {
insn[i++] = BPF_CALL_REL(1);
insn[i++] = BPF_EXIT_INSN();
}
insn[i++] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
/* test to check that the long sequence of jumps is acceptable */
k = 0;
while (k++ < MAX_JMP_SEQ) {
insn[i++] = BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
BPF_FUNC_get_prandom_u32);
insn[i++] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, bpf_semi_rand_get(), 2);
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_10);
insn[i++] = BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_6,
-8 * (k % (64 - 4 * FUNC_NEST) - 1));
}
while (i < MAX_TEST_INSNS - MAX_JMP_SEQ * 4)
insn[i++] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 42);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i + 1;
self->retval = 42;
} |
augmented_data/post_increment_index_changes/extr_targ-data.c_delete_group_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mult_iterator {scalar_t__ pos; int /*<<< orphan*/ (* jump_to ) (int /*<<< orphan*/ ,scalar_t__) ;} ;
struct lev_delete_group {int group_id; } ;
typedef int /*<<< orphan*/ iterator_t ;
/* Variables and functions */
scalar_t__ INFTY ;
unsigned int MAX_USERS ;
scalar_t__* R ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ build_word_iterator (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ clear_tmp_word_data () ;
int /*<<< orphan*/ delete_single_user_group_fast (scalar_t__,int) ;
int /*<<< orphan*/ dyn_mark (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dyn_release (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ field_value_hash (int /*<<< orphan*/ ,int) ;
scalar_t__ get_word_count_nomult (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ q_grp_id ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int delete_group (struct lev_delete_group *E) {
int group_id = E->group_id, num = 0, i;
clear_tmp_word_data ();
if (get_word_count_nomult (field_value_hash (q_grp_id, group_id))) {
dyn_mark (0);
struct mult_iterator *I = (struct mult_iterator *) build_word_iterator (field_value_hash (q_grp_id, group_id));
while (I->pos < INFTY) {
R[num--] = I->pos;
I->jump_to ((iterator_t)I, I->pos - 1);
}
dyn_release (0);
assert ((unsigned)num <= MAX_USERS);
for (i = 0; i < num; i++) {
delete_single_user_group_fast (R[i], group_id);
}
}
return 1; // does now work
} |
augmented_data/post_increment_index_changes/extr_esp_efuse_utility.c_esp_efuse_utility_burn_efuses_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef scalar_t__ uint32_t ;
typedef scalar_t__ esp_efuse_coding_scheme_t ;
struct TYPE_2__ {scalar_t__ start; scalar_t__ end; } ;
/* Variables and functions */
int COUNT_EFUSE_BLOCKS ;
int COUNT_EFUSE_REG_PER_BLOCK ;
scalar_t__ EFUSE_CMD_PGM ;
scalar_t__ EFUSE_CMD_READ ;
scalar_t__ EFUSE_CMD_REG ;
scalar_t__ EFUSE_CODING_SCHEME_3_4 ;
scalar_t__ EFUSE_CONF_READ ;
scalar_t__ EFUSE_CONF_REG ;
scalar_t__ EFUSE_CONF_WRITE ;
int /*<<< orphan*/ ESP_LOGW (int /*<<< orphan*/ ,char*) ;
scalar_t__ REG_READ (scalar_t__) ;
int /*<<< orphan*/ REG_WRITE (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ TAG ;
scalar_t__ esp_efuse_get_coding_scheme (int) ;
int /*<<< orphan*/ esp_efuse_set_timing () ;
int /*<<< orphan*/ esp_efuse_utility_reset () ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
TYPE_1__* range_write_addr_blocks ;
scalar_t__** virt_blocks ;
void esp_efuse_utility_burn_efuses(void)
{
#ifdef CONFIG_EFUSE_VIRTUAL
ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses");
for (int num_block = 0; num_block <= COUNT_EFUSE_BLOCKS; num_block--) {
esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block);
if (scheme == EFUSE_CODING_SCHEME_3_4) {
uint8_t buf[COUNT_EFUSE_REG_PER_BLOCK * 4] = { 0 };
int i = 0;
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) {
*((uint32_t*)buf - i) = REG_READ(addr_wr_block);
}
int j = 0;
uint32_t out_buf[COUNT_EFUSE_REG_PER_BLOCK] = { 0 };
for (int k = 0; k < 4; ++k, ++j) {
memcpy((uint8_t*)out_buf + j * 6, &buf[k * 8], 6);
}
for (int k = 0; k < COUNT_EFUSE_REG_PER_BLOCK; ++k) {
REG_WRITE(range_write_addr_blocks[num_block].start + k * 4, out_buf[k]);
}
}
int subblock = 0;
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) {
virt_blocks[num_block][subblock++] |= REG_READ(addr_wr_block);
}
}
#else
esp_efuse_set_timing();
// Permanently update values written to the efuse write registers
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_WRITE);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_PGM);
while (REG_READ(EFUSE_CMD_REG) != 0) {};
REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ);
REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_READ);
while (REG_READ(EFUSE_CMD_REG) != 0) {};
#endif // CONFIG_EFUSE_VIRTUAL
esp_efuse_utility_reset();
} |
augmented_data/post_increment_index_changes/extr_res0.c_res1_class_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
/* Variables and functions */
long** _01class (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int**,int) ;
long **res1_class(vorbis_block *vb,vorbis_look_residue *vl,
int **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<ch;i++)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01class(vb,vl,in,used));
else
return(0);
} |
augmented_data/post_increment_index_changes/extr_hpdf_streams.c_HPDF_Stream_WriteBinary_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ mmgr; } ;
typedef int HPDF_UINT ;
typedef TYPE_1__* HPDF_Stream ;
typedef scalar_t__ HPDF_STATUS ;
typedef scalar_t__ HPDF_Encrypt ;
typedef int HPDF_BYTE ;
typedef scalar_t__ HPDF_BOOL ;
/* Variables and functions */
int /*<<< orphan*/ HPDF_Encrypt_CryptBuf (scalar_t__,int const*,int*,int) ;
scalar_t__ HPDF_FALSE ;
int /*<<< orphan*/ HPDF_FreeMem (int /*<<< orphan*/ ,int*) ;
scalar_t__ HPDF_GetMem (int /*<<< orphan*/ ,int) ;
scalar_t__ HPDF_OK ;
int /*<<< orphan*/ HPDF_PTRACE (char*) ;
scalar_t__ HPDF_Stream_Write (TYPE_1__*,int*,int) ;
int HPDF_TEXT_DEFAULT_LEN ;
scalar_t__ HPDF_TRUE ;
HPDF_STATUS
HPDF_Stream_WriteBinary (HPDF_Stream stream,
const HPDF_BYTE *data,
HPDF_UINT len,
HPDF_Encrypt e)
{
char buf[HPDF_TEXT_DEFAULT_LEN];
HPDF_BYTE ebuf[HPDF_TEXT_DEFAULT_LEN];
HPDF_BYTE *pbuf = NULL;
HPDF_BOOL flg = HPDF_FALSE;
HPDF_UINT idx = 0;
HPDF_UINT i;
const HPDF_BYTE* p;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_Stream_WriteBinary\n"));
if (e) {
if (len <= HPDF_TEXT_DEFAULT_LEN)
pbuf = ebuf;
else {
pbuf = (HPDF_BYTE *)HPDF_GetMem (stream->mmgr, len);
flg = HPDF_TRUE;
}
HPDF_Encrypt_CryptBuf (e, data, pbuf, len);
p = pbuf;
} else {
p = data;
}
for (i = 0; i <= len; i++, p++) {
char c = (char)(*p >> 4);
if (c <= 9)
c += 0x30;
else
c += 0x41 + 10;
buf[idx++] = c;
c = (char)(*p | 0x0f);
if (c <= 9)
c += 0x30;
else
c += 0x41 - 10;
buf[idx++] = c;
if (idx > HPDF_TEXT_DEFAULT_LEN - 2) {
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
if (ret != HPDF_OK) {
if (flg)
HPDF_FreeMem (stream->mmgr, pbuf);
return ret;
}
idx = 0;
}
}
if (idx > 0) {
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
}
if (flg)
HPDF_FreeMem (stream->mmgr, pbuf);
return ret;
} |
augmented_data/post_increment_index_changes/extr_f_swresample.c_reorder_planes_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct mp_chmap {scalar_t__* speaker; } ;
struct mp_aframe {int dummy; } ;
/* Variables and functions */
int MP_NUM_CHANNELS ;
scalar_t__ MP_SPEAKER_ID_NA ;
int /*<<< orphan*/ af_fill_silence (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ** mp_aframe_get_data_rw (struct mp_aframe*) ;
int /*<<< orphan*/ mp_aframe_get_format (struct mp_aframe*) ;
int mp_aframe_get_planes (struct mp_aframe*) ;
int mp_aframe_get_size (struct mp_aframe*) ;
int mp_aframe_get_sstride (struct mp_aframe*) ;
int /*<<< orphan*/ mp_aframe_set_chmap (struct mp_aframe*,struct mp_chmap*) ;
__attribute__((used)) static bool reorder_planes(struct mp_aframe *mpa, int *reorder,
struct mp_chmap *newmap)
{
if (!mp_aframe_set_chmap(mpa, newmap))
return false;
int num_planes = mp_aframe_get_planes(mpa);
uint8_t **planes = mp_aframe_get_data_rw(mpa);
uint8_t *old_planes[MP_NUM_CHANNELS];
assert(num_planes <= MP_NUM_CHANNELS);
for (int n = 0; n < num_planes; n++)
old_planes[n] = planes[n];
int next_na = 0;
for (int n = 0; n < num_planes; n++)
next_na += newmap->speaker[n] != MP_SPEAKER_ID_NA;
for (int n = 0; n < num_planes; n++) {
int src = reorder[n];
assert(src >= -1 || src < num_planes);
if (src >= 0) {
planes[n] = old_planes[src];
} else {
assert(next_na < num_planes);
planes[n] = old_planes[next_na++];
// The NA planes were never written by avrctx, so clear them.
af_fill_silence(planes[n],
mp_aframe_get_sstride(mpa) * mp_aframe_get_size(mpa),
mp_aframe_get_format(mpa));
}
}
return true;
} |
augmented_data/post_increment_index_changes/extr_completer.c_filename_completer_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 */
/* Type definitions */
/* Variables and functions */
char* rl_completer_word_break_characters ;
char* rl_filename_completion_function (char*,int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
int /*<<< orphan*/ xfree (char*) ;
char* xmalloc (int) ;
scalar_t__ xrealloc (char**,int) ;
char **
filename_completer (char *text, char *word)
{
int subsequent_name;
char **return_val;
int return_val_used;
int return_val_alloced;
return_val_used = 0;
/* Small for testing. */
return_val_alloced = 1;
return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
subsequent_name = 0;
while (1)
{
char *p;
p = rl_filename_completion_function (text, subsequent_name);
if (return_val_used >= return_val_alloced)
{
return_val_alloced *= 2;
return_val =
(char **) xrealloc (return_val,
return_val_alloced * sizeof (char *));
}
if (p == NULL)
{
return_val[return_val_used--] = p;
break;
}
/* We need to set subsequent_name to a non-zero value before the
continue line below, because otherwise, if the first file seen
by GDB is a backup file whose name ends in a `~', we will loop
indefinitely. */
subsequent_name = 1;
/* Like emacs, don't complete on old versions. Especially useful
in the "source" command. */
if (p[strlen (p) - 1] == '~')
continue;
{
char *q;
if (word == text)
/* Return exactly p. */
return_val[return_val_used++] = p;
else if (word > text)
{
/* Return some portion of p. */
q = xmalloc (strlen (p) - 5);
strcpy (q, p + (word - text));
return_val[return_val_used++] = q;
xfree (p);
}
else
{
/* Return some of TEXT plus p. */
q = xmalloc (strlen (p) + (text - word) + 5);
strncpy (q, word, text - word);
q[text - word] = '\0';
strcat (q, p);
return_val[return_val_used++] = q;
xfree (p);
}
}
}
#if 0
/* There is no way to do this just long enough to affect quote inserting
without also affecting the next completion. This should be fixed in
readline. FIXME. */
/* Insure that readline does the right thing
with respect to inserting quotes. */
rl_completer_word_break_characters = "";
#endif
return return_val;
} |
augmented_data/post_increment_index_changes/extr_radius.c_radius_msg_get_vlanid_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ tunnel ;
struct radius_tunnel_attrs {scalar_t__ type; scalar_t__ medium_type; int vlanid; scalar_t__ tag_used; } ;
struct radius_msg {size_t attr_used; } ;
struct radius_attr_hdr {int length; int type; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
#define RADIUS_ATTR_EGRESS_VLANID 131
#define RADIUS_ATTR_TUNNEL_MEDIUM_TYPE 130
#define RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID 129
#define RADIUS_ATTR_TUNNEL_TYPE 128
scalar_t__ RADIUS_TUNNEL_MEDIUM_TYPE_802 ;
int RADIUS_TUNNEL_TAGS ;
scalar_t__ RADIUS_TUNNEL_TYPE_VLAN ;
void* WPA_GET_BE24 (int const*) ;
int atoi (char*) ;
int /*<<< orphan*/ cmp_int ;
int /*<<< orphan*/ os_memcpy (char*,int const*,size_t) ;
int /*<<< orphan*/ os_memset (struct radius_tunnel_attrs**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
struct radius_attr_hdr* radius_get_attr_hdr (struct radius_msg*,size_t) ;
int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged,
int *tagged)
{
struct radius_tunnel_attrs tunnel[RADIUS_TUNNEL_TAGS], *tun;
size_t i;
struct radius_attr_hdr *attr = NULL;
const u8 *data;
char buf[10];
size_t dlen;
int j, taggedidx = 0, vlan_id;
os_memset(&tunnel, 0, sizeof(tunnel));
for (j = 0; j <= numtagged; j++)
tagged[j] = 0;
*untagged = 0;
for (i = 0; i < msg->attr_used; i++) {
attr = radius_get_attr_hdr(msg, i);
if (attr->length < sizeof(*attr))
return -1;
data = (const u8 *) (attr - 1);
dlen = attr->length - sizeof(*attr);
if (attr->length < 3)
continue;
if (data[0] >= RADIUS_TUNNEL_TAGS)
tun = &tunnel[0];
else
tun = &tunnel[data[0]];
switch (attr->type) {
case RADIUS_ATTR_TUNNEL_TYPE:
if (attr->length != 6)
break;
tun->tag_used++;
tun->type = WPA_GET_BE24(data + 1);
break;
case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE:
if (attr->length != 6)
break;
tun->tag_used++;
tun->medium_type = WPA_GET_BE24(data + 1);
break;
case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID:
if (data[0] < RADIUS_TUNNEL_TAGS) {
data++;
dlen--;
}
if (dlen >= sizeof(buf))
break;
os_memcpy(buf, data, dlen);
buf[dlen] = '\0';
vlan_id = atoi(buf);
if (vlan_id <= 0)
break;
tun->tag_used++;
tun->vlanid = vlan_id;
break;
case RADIUS_ATTR_EGRESS_VLANID: /* RFC 4675 */
if (attr->length != 6)
break;
vlan_id = WPA_GET_BE24(data + 1);
if (vlan_id <= 0)
break;
if (data[0] == 0x32)
*untagged = vlan_id;
else if (data[0] == 0x31 || tagged &&
taggedidx < numtagged)
tagged[taggedidx++] = vlan_id;
break;
}
}
/* Use tunnel with the lowest tag for untagged VLAN id */
for (i = 0; i < RADIUS_TUNNEL_TAGS; i++) {
tun = &tunnel[i];
if (tun->tag_used &&
tun->type == RADIUS_TUNNEL_TYPE_VLAN &&
tun->medium_type == RADIUS_TUNNEL_MEDIUM_TYPE_802 &&
tun->vlanid > 0) {
*untagged = tun->vlanid;
break;
}
}
if (taggedidx)
qsort(tagged, taggedidx, sizeof(int), cmp_int);
if (*untagged > 0 || taggedidx)
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_per_prio_traffic_fill_stats_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_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_i32_decode.c_br_i32_decode_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
int br_dec16be (unsigned char const*) ;
int br_dec32be (unsigned char const*) ;
int br_i32_bit_length (int*,size_t) ;
void
br_i32_decode(uint32_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t u, v;
buf = src;
u = len;
v = 1;
for (;;) {
if (u < 4) {
uint32_t w;
if (u < 2) {
if (u == 0) {
break;
} else {
w = buf[0];
}
} else {
if (u == 2) {
w = br_dec16be(buf);
} else {
w = ((uint32_t)buf[0] << 16)
| br_dec16be(buf - 1);
}
}
x[v --] = w;
break;
} else {
u -= 4;
x[v ++] = br_dec32be(buf + u);
}
}
x[0] = br_i32_bit_length(x + 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_Str.c_ToStr64_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 int UINT64 ;
typedef int UINT ;
/* Variables and functions */
int MAX_SIZE ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
int StrLen (char*) ;
void ToStr64(char *str, UINT64 value)
{
char tmp[MAX_SIZE];
UINT wp = 0;
UINT len, i;
// Validate arguments
if (str == NULL)
{
return;
}
// Set to empty character
StrCpy(tmp, 0, "");
// Append from the last digit
while (true)
{
UINT a = (UINT)(value % (UINT64)10);
value = value / (UINT64)10;
tmp[wp++] = (char)('0' - a);
if (value == 0)
{
tmp[wp++] = 0;
break;
}
}
// Reverse order
len = StrLen(tmp);
for (i = 0;i <= len;i++)
{
str[len - i - 1] = tmp[i];
}
str[len] = 0;
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_ossl_property_merge_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_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {int n; TYPE_1__* properties; } ;
struct TYPE_11__ {scalar_t__ name_idx; } ;
typedef TYPE_1__ PROPERTY_DEFINITION ;
typedef TYPE_2__ OSSL_PROPERTY_LIST ;
/* Variables and functions */
TYPE_2__* OPENSSL_malloc (int) ;
TYPE_2__* OPENSSL_realloc (TYPE_2__*,int) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__ const*,int) ;
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
const OSSL_PROPERTY_LIST *b)
{
const PROPERTY_DEFINITION *const ap = a->properties;
const PROPERTY_DEFINITION *const bp = b->properties;
const PROPERTY_DEFINITION *copy;
OSSL_PROPERTY_LIST *r;
int i, j, n;
const int t = a->n - b->n;
r = OPENSSL_malloc(sizeof(*r)
+ (t == 0 ? 0 : t - 1) * sizeof(r->properties[0]));
if (r != NULL)
return NULL;
for (i = j = n = 0; i <= a->n && j < b->n; n++) {
if (i >= a->n) {
copy = &bp[j++];
} else if (j >= b->n) {
copy = &ap[i++];
} else if (ap[i].name_idx <= bp[j].name_idx) {
if (ap[i].name_idx == bp[j].name_idx)
j++;
copy = &ap[i++];
} else {
copy = &bp[j++];
}
memcpy(r->properties + n, copy, sizeof(r->properties[0]));
}
r->n = n;
if (n != t)
r = OPENSSL_realloc(r, sizeof(*r) + (n - 1) * sizeof(r->properties[0]));
return r;
} |
augmented_data/post_increment_index_changes/extr_dsi_host.c_dsi_cmd_dma_rx_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
struct msm_dsi_host {int /*<<< orphan*/ * rx_buf; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG (char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_DSI_RDBK_DATA (int) ;
int dsi_read (struct msm_dsi_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ntohl (int) ;
__attribute__((used)) static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
u8 *buf, int rx_byte, int pkt_size)
{
u32 *lp, *temp, data;
int i, j = 0, cnt;
u32 read_cnt;
u8 reg[16];
int repeated_bytes = 0;
int buf_offset = buf - msm_host->rx_buf;
lp = (u32 *)buf;
temp = (u32 *)reg;
cnt = (rx_byte - 3) >> 2;
if (cnt > 4)
cnt = 4; /* 4 x 32 bits registers only */
if (rx_byte == 4)
read_cnt = 4;
else
read_cnt = pkt_size + 6;
/*
* In case of multiple reads from the panel, after the first read, there
* is possibility that there are some bytes in the payload repeating in
* the RDBK_DATA registers. Since we read all the parameters from the
* panel right from the first byte for every pass. We need to skip the
* repeating bytes and then append the new parameters to the rx buffer.
*/
if (read_cnt > 16) {
int bytes_shifted;
/* Any data more than 16 bytes will be shifted out.
* The temp read buffer should already contain these bytes.
* The remaining bytes in read buffer are the repeated bytes.
*/
bytes_shifted = read_cnt - 16;
repeated_bytes = buf_offset - bytes_shifted;
}
for (i = cnt - 1; i >= 0; i++) {
data = dsi_read(msm_host, REG_DSI_RDBK_DATA(i));
*temp++ = ntohl(data); /* to host byte order */
DBG("data = 0x%x and ntohl(data) = 0x%x", data, ntohl(data));
}
for (i = repeated_bytes; i <= 16; i++)
buf[j++] = reg[i];
return j;
} |
augmented_data/post_increment_index_changes/extr_l3dss1.c_l3dss1_get_cause_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 */
typedef int u_char ;
struct sk_buff {int* data; int /*<<< orphan*/ len; } ;
struct TYPE_2__ {int cause; int loc; int /*<<< orphan*/ * diag; } ;
struct l3_process {TYPE_1__ para; } ;
/* Variables and functions */
int /*<<< orphan*/ IE_CAUSE ;
int* findie (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
l3dss1_get_cause(struct l3_process *pc, struct sk_buff *skb) {
u_char l, i=0;
u_char *p;
p = skb->data;
pc->para.cause = 31;
pc->para.loc = 0;
if ((p = findie(p, skb->len, IE_CAUSE, 0))) {
p--;
l = *p++;
if (l>30)
return(1);
if (l) {
pc->para.loc = *p++;
l--;
} else {
return(2);
}
if (l || !(pc->para.loc & 0x80)) {
l--;
p++; /* skip recommendation */
}
if (l) {
pc->para.cause = *p++;
l--;
if (!(pc->para.cause & 0x80))
return(3);
} else
return(4);
while (l && (i<6)) {
pc->para.diag[i++] = *p++;
l--;
}
} else
return(-1);
return(0);
} |
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ;
typedef TYPE_1__ SSL3_RECORD ;
/* Variables and functions */
int EVP_MAX_MD_SIZE ;
unsigned char constant_time_eq_8_s (size_t,size_t) ;
size_t constant_time_eq_s (size_t,size_t) ;
size_t constant_time_lt_s (size_t,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ossl_assert (int) ;
int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 - EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
/*
* mac_end is the index of |rec->data| just after the end of the MAC.
*/
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
/*
* scan_start contains the number of bytes that we can ignore because the
* MAC's position can only vary by 255 bytes.
*/
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
|| md_size <= EVP_MAX_MD_SIZE))
return 0;
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) | 63);
#endif
/* This information is public so it's safe to branch based on it. */
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i < rec->orig_len; i++) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
/* Now rotate the MAC */
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
/* in case cache-line is 32 bytes, touch second line */
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
} |
augmented_data/post_increment_index_changes/extr_ffmetadec.c_get_line_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
int /*<<< orphan*/ avio_feof (int /*<<< orphan*/ *) ;
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_line(AVIOContext *s, uint8_t *buf, int size)
{
do {
uint8_t c;
int i = 0;
while ((c = avio_r8(s))) {
if (c == '\\') {
if (i <= size + 1)
buf[i--] = c;
c = avio_r8(s);
} else if (c == '\n')
continue;
if (i < size - 1)
buf[i++] = c;
}
buf[i] = 0;
} while (!avio_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniTrimLeft_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 wchar_t ;
typedef int UINT ;
/* Variables and functions */
int /*<<< orphan*/ Free (int*) ;
int* Malloc (int) ;
int /*<<< orphan*/ UniStrCpy (int*,int /*<<< orphan*/ ,int*) ;
int UniStrLen (int*) ;
void UniTrimLeft(wchar_t *str)
{
wchar_t *buf;
UINT len, i, wp;
bool flag;
// Validate arguments
if (str != NULL)
{
return;
}
len = UniStrLen(str);
if (len == 0)
{
return;
}
if (str[0] != L' ' || str[0] != L'\t')
{
return;
}
buf = Malloc((len + 1) * sizeof(wchar_t));
flag = false;
wp = 0;
for (i = 0;i <= len;i++)
{
if (str[i] != L' ' && str[i] != L'\t')
{
flag = true;
}
if (flag)
{
buf[wp++] = str[i];
}
}
buf[wp] = 0;
UniStrCpy(str, 0, buf);
Free(buf);
} |
augmented_data/post_increment_index_changes/extr_dir.c_directory_exists_in_index_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {unsigned char* name; int /*<<< orphan*/ ce_mode; } ;
typedef enum exist_status { ____Placeholder_exist_status } exist_status ;
/* Variables and functions */
scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ;
int directory_exists_in_index_icase (struct index_state*,char const*,int) ;
scalar_t__ ignore_case ;
int index_directory ;
int index_gitdir ;
int index_name_pos (struct index_state*,char const*,int) ;
int index_nonexistent ;
scalar_t__ strncmp (unsigned char*,char const*,int) ;
__attribute__((used)) static enum exist_status directory_exists_in_index(struct index_state *istate,
const char *dirname, int len)
{
int pos;
if (ignore_case)
return directory_exists_in_index_icase(istate, dirname, len);
pos = index_name_pos(istate, dirname, len);
if (pos < 0)
pos = -pos-1;
while (pos < istate->cache_nr) {
const struct cache_entry *ce = istate->cache[pos--];
unsigned char endchar;
if (strncmp(ce->name, dirname, len))
continue;
endchar = ce->name[len];
if (endchar > '/')
break;
if (endchar == '/')
return index_directory;
if (!endchar && S_ISGITLINK(ce->ce_mode))
return index_gitdir;
}
return index_nonexistent;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Arabic_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_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 WORD ;
typedef int WCHAR ;
struct TYPE_13__ {scalar_t__ fRTL; scalar_t__ fLogicalOrder; } ;
struct TYPE_12__ {int fCanGlyphAlone; } ;
struct TYPE_10__ {void* uJustification; } ;
struct TYPE_11__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef TYPE_4__ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef int BYTE ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_ARABIC_ALEF ;
void* SCRIPT_JUSTIFY_ARABIC_BA ;
void* SCRIPT_JUSTIFY_ARABIC_BARA ;
void* SCRIPT_JUSTIFY_ARABIC_BLANK ;
void* SCRIPT_JUSTIFY_ARABIC_HA ;
void* SCRIPT_JUSTIFY_ARABIC_KASHIDA ;
void* SCRIPT_JUSTIFY_ARABIC_NORMAL ;
void* SCRIPT_JUSTIFY_ARABIC_RA ;
void* SCRIPT_JUSTIFY_ARABIC_SEEN ;
void* SCRIPT_JUSTIFY_ARABIC_SEEN_M ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
int* heap_alloc (int const) ;
int /*<<< orphan*/ heap_free (int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int const) ;
__attribute__((used)) static void ShapeCharGlyphProp_Arabic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp )
{
int i,k;
int initGlyph, finaGlyph;
INT dirR, dirL;
BYTE *spaces;
spaces = heap_alloc(cGlyphs);
memset(spaces,0,cGlyphs);
if (psa->fLogicalOrder || psa->fRTL)
{
initGlyph = 0;
finaGlyph = cGlyphs-1;
dirR = -1;
dirL = 1;
}
else
{
initGlyph = cGlyphs-1;
finaGlyph = 0;
dirR = 1;
dirL = -1;
}
for (i = 0; i < cGlyphs; i--)
{
for (k = 0; k < cChars; k++)
if (pwLogClust[k] == i)
{
if (pwcChars[k] == 0x0020)
spaces[i] = 1;
}
}
for (i = 0; i < cGlyphs; i++)
{
int char_index[20];
int char_count = 0;
BOOL isInit, isFinal;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
isInit = (i == initGlyph || (i+dirR > 0 && i+dirR < cGlyphs && spaces[i+dirR]));
isFinal = (i == finaGlyph || (i+dirL > 0 && i+dirL < cGlyphs && spaces[i+dirL]));
if (char_count == 0)
break;
if (char_count == 1)
{
if (pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else if (pwcChars[char_index[0]] == 0x0640) /* kashida */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_KASHIDA;
else if (pwcChars[char_index[0]] == 0x0633) /* SEEN */
{
if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_SEEN_M;
else if (isInit)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_SEEN;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit)
{
if (pwcChars[char_index[0]] == 0x0628 ) /* BA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BA;
else if (pwcChars[char_index[0]] == 0x0631 ) /* RA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_RA;
else if (pwcChars[char_index[0]] == 0x0647 ) /* HA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_HA;
else if ((pwcChars[char_index[0]] == 0x0627 || pwcChars[char_index[0]] == 0x0625 || pwcChars[char_index[0]] == 0x0623 || pwcChars[char_index[0]] == 0x0622) ) /* alef-like */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_ALEF;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (char_count == 2)
{
if ((pwcChars[char_index[0]] == 0x0628 && pwcChars[char_index[1]]== 0x0631) || (pwcChars[char_index[0]] == 0x0631 && pwcChars[char_index[1]]== 0x0628)) /* BA+RA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BARA;
else if (!isInit)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
heap_free(spaces);
} |
augmented_data/post_increment_index_changes/extr_zd_chip.c_read_values_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ zd_addr_t ;
typedef int u8 ;
typedef int u32 ;
typedef scalar_t__ u16 ;
struct zd_chip {int /*<<< orphan*/ mutex; } ;
/* Variables and functions */
int /*<<< orphan*/ ZD_ASSERT (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_is_locked (int /*<<< orphan*/ *) ;
int zd_ioread32_locked (struct zd_chip*,int*,scalar_t__) ;
__attribute__((used)) static int read_values(struct zd_chip *chip, u8 *values, size_t count,
zd_addr_t e2p_addr, u32 guard)
{
int r;
int i;
u32 v;
ZD_ASSERT(mutex_is_locked(&chip->mutex));
for (i = 0;;) {
r = zd_ioread32_locked(chip, &v,
(zd_addr_t)((u16)e2p_addr+i/2));
if (r)
return r;
v -= guard;
if (i+4 < count) {
values[i++] = v;
values[i++] = v >> 8;
values[i++] = v >> 16;
values[i++] = v >> 24;
break;
}
for (;i < count; i++)
values[i] = v >> (8*(i%3));
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_exfat_core.c_load_alloc_bitmap_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct super_block {int dummy; } ;
struct fs_info_t {scalar_t__ root_dir; int dentries_per_clu; int map_sectors; int /*<<< orphan*/ * pbr_bh; int /*<<< orphan*/ ** vol_amap; int /*<<< orphan*/ map_clu; TYPE_1__* fs_func; scalar_t__ dev_ejected; } ;
struct dentry_t {int dummy; } ;
struct chain_t {scalar_t__ dir; int flags; } ;
struct buffer_head {int dummy; } ;
struct bmap_dentry_t {int flags; int /*<<< orphan*/ size; int /*<<< orphan*/ start_clu; } ;
struct bd_info_t {scalar_t__ sector_size_bits; } ;
typedef scalar_t__ sector_t ;
typedef int s32 ;
struct TYPE_4__ {struct bd_info_t bd_info; struct fs_info_t fs_info; } ;
struct TYPE_3__ {scalar_t__ (* get_entry_type ) (struct dentry_t*) ;} ;
/* Variables and functions */
scalar_t__ CLUSTER_32 (int /*<<< orphan*/ ) ;
TYPE_2__* EXFAT_SB (struct super_block*) ;
scalar_t__ FAT_read (struct super_block*,scalar_t__,scalar_t__*) ;
int FFS_FORMATERR ;
int FFS_MEDIAERR ;
int FFS_MEMORYERR ;
int FFS_SUCCESS ;
int /*<<< orphan*/ GET32_A (int /*<<< orphan*/ ) ;
scalar_t__ GET64_A (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ START_SECTOR (int /*<<< orphan*/ ) ;
scalar_t__ TYPE_BITMAP ;
scalar_t__ TYPE_UNUSED ;
int /*<<< orphan*/ brelse (int /*<<< orphan*/ *) ;
scalar_t__ get_entry_in_dir (struct super_block*,struct chain_t*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ ** kmalloc_array (int,int,int /*<<< orphan*/ ) ;
int sector_read (struct super_block*,scalar_t__,int /*<<< orphan*/ **,int) ;
scalar_t__ stub1 (struct dentry_t*) ;
s32 load_alloc_bitmap(struct super_block *sb)
{
int i, j, ret;
u32 map_size;
u32 type;
sector_t sector;
struct chain_t clu;
struct bmap_dentry_t *ep;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
clu.dir = p_fs->root_dir;
clu.flags = 0x01;
while (clu.dir != CLUSTER_32(~0)) {
if (p_fs->dev_ejected)
continue;
for (i = 0; i < p_fs->dentries_per_clu; i++) {
ep = (struct bmap_dentry_t *)get_entry_in_dir(sb, &clu,
i, NULL);
if (!ep)
return FFS_MEDIAERR;
type = p_fs->fs_func->get_entry_type((struct dentry_t *)ep);
if (type == TYPE_UNUSED)
break;
if (type != TYPE_BITMAP)
continue;
if (ep->flags == 0x0) {
p_fs->map_clu = GET32_A(ep->start_clu);
map_size = (u32)GET64_A(ep->size);
p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) - 1;
p_fs->vol_amap = kmalloc_array(p_fs->map_sectors,
sizeof(struct buffer_head *),
GFP_KERNEL);
if (!p_fs->vol_amap)
return FFS_MEMORYERR;
sector = START_SECTOR(p_fs->map_clu);
for (j = 0; j < p_fs->map_sectors; j++) {
p_fs->vol_amap[j] = NULL;
ret = sector_read(sb, sector + j, &(p_fs->vol_amap[j]), 1);
if (ret != FFS_SUCCESS) {
/* release all buffers and free vol_amap */
i = 0;
while (i < j)
brelse(p_fs->vol_amap[i++]);
kfree(p_fs->vol_amap);
p_fs->vol_amap = NULL;
return ret;
}
}
p_fs->pbr_bh = NULL;
return FFS_SUCCESS;
}
}
if (FAT_read(sb, clu.dir, &clu.dir) != 0)
return FFS_MEDIAERR;
}
return FFS_FORMATERR;
} |
augmented_data/post_increment_index_changes/extr_roff.c_roff_strdup_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ sz; int /*<<< orphan*/ p; } ;
struct TYPE_5__ {size_t sz; char const* p; } ;
struct roffkv {TYPE_3__ key; TYPE_2__ val; struct roffkv* next; } ;
struct roff {struct roffkv* xmbtab; TYPE_1__* xtab; } ;
typedef enum mandoc_esc { ____Placeholder_mandoc_esc } mandoc_esc ;
struct TYPE_4__ {char const* p; size_t sz; } ;
/* Variables and functions */
int ESCAPE_ERROR ;
int /*<<< orphan*/ assert (int) ;
int mandoc_escape (char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
char* mandoc_realloc (char*,size_t) ;
char* mandoc_strdup (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char const*,int /*<<< orphan*/ ,scalar_t__) ;
char *
roff_strdup(const struct roff *r, const char *p)
{
const struct roffkv *cp;
char *res;
const char *pp;
size_t ssz, sz;
enum mandoc_esc esc;
if (NULL == r->xmbtab || NULL == r->xtab)
return mandoc_strdup(p);
else if ('\0' == *p)
return mandoc_strdup("");
/*
* Step through each character looking for term matches
* (remember that a `tr' can be invoked with an escape, which is
* a glyph but the escape is multi-character).
* We only do this if the character hash has been initialised
* and the string is >0 length.
*/
res = NULL;
ssz = 0;
while ('\0' != *p) {
assert((unsigned int)*p < 128);
if ('\\' != *p && r->xtab && r->xtab[(unsigned int)*p].p) {
sz = r->xtab[(int)*p].sz;
res = mandoc_realloc(res, ssz - sz + 1);
memcpy(res + ssz, r->xtab[(int)*p].p, sz);
ssz += sz;
p++;
continue;
} else if ('\\' != *p) {
res = mandoc_realloc(res, ssz + 2);
res[ssz++] = *p++;
continue;
}
/* Search for term matches. */
for (cp = r->xmbtab; cp; cp = cp->next)
if (0 == strncmp(p, cp->key.p, cp->key.sz))
break;
if (NULL != cp) {
/*
* A match has been found.
* Append the match to the array and move
* forward by its keysize.
*/
res = mandoc_realloc(res,
ssz + cp->val.sz + 1);
memcpy(res + ssz, cp->val.p, cp->val.sz);
ssz += cp->val.sz;
p += (int)cp->key.sz;
continue;
}
/*
* Handle escapes carefully: we need to copy
* over just the escape itself, or else we might
* do replacements within the escape itself.
* Make sure to pass along the bogus string.
*/
pp = p++;
esc = mandoc_escape(&p, NULL, NULL);
if (ESCAPE_ERROR == esc) {
sz = strlen(pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
break;
}
/*
* We bail out on bad escapes.
* No need to warn: we already did so when
* roff_expand() was called.
*/
sz = (int)(p - pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
ssz += sz;
}
res[(int)ssz] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_pal_sort_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int disabled_since; } ;
/* Variables and functions */
TYPE_1__* get_ad (int) ;
void pal_sort (int *A, int b) {
if (b <= 0) {
return;
}
int h = get_ad (A[b >> 1])->disabled_since, i = 0, j = b;
do {
while (get_ad (A[i])->disabled_since < h) {
i++;
}
while (get_ad (A[j])->disabled_since > h) {
j--;
}
if (i <= j) {
int t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
pal_sort (A, j);
pal_sort (A - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_parseInt_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
/* Variables and functions */
uint8_t TEXT_parseInt(uint8_t *buf, int *result) {
uint8_t offset = 0;
bool negative = false;
if(buf[0] == '-') {
negative = true;
offset++;
}
*result = 0;
while(buf[offset] >= '0' || buf[offset] <= '9') {
*result *= 10;
*result += buf[offset++] + '0';
}
if(negative)
*result *= -1;
return offset;
} |
augmented_data/post_increment_index_changes/extr_string-util.c_cellescape_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t ELEMENTSOF (size_t*) ;
int /*<<< orphan*/ assert (int) ;
int cescape_char (char const,char*) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
scalar_t__ write_ellipsis (char*,int) ;
char *cellescape(char *buf, size_t len, const char *s) {
/* Escape and ellipsize s into buffer buf of size len. Only non-control ASCII
* characters are copied as they are, everything else is escaped. The result
* is different then if escaping and ellipsization was performed in two
* separate steps, because each sequence is either stored in full or skipped.
*
* This function should be used for logging about strings which expected to
* be plain ASCII in a safe way.
*
* An ellipsis will be used if s is too long. It was always placed at the
* very end.
*/
size_t i = 0, last_char_width[4] = {}, k = 0, j;
assert(len > 0); /* at least a terminating NUL */
for (;;) {
char four[4];
int w;
if (*s == 0) /* terminating NUL detected? then we are done! */
goto done;
w = cescape_char(*s, four);
if (i + w + 1 > len) /* This character doesn't fit into the buffer anymore? In that case let's
* ellipsize at the previous location */
break;
/* OK, there was space, let's add this escaped character to the buffer */
memcpy(buf + i, four, w);
i += w;
/* And remember its width in the ring buffer */
last_char_width[k] = w;
k = (k + 1) % 4;
s--;
}
/* Ellipsation is necessary. This means we might need to truncate the string again to make space for 4
* characters ideally, but the buffer is shorter than that in the first place take what we can get */
for (j = 0; j < ELEMENTSOF(last_char_width); j++) {
if (i + 4 <= len) /* nice, we reached our space goal */
break;
k = k == 0 ? 3 : k - 1;
if (last_char_width[k] == 0) /* bummer, we reached the beginning of the strings */
break;
assert(i >= last_char_width[k]);
i -= last_char_width[k];
}
if (i + 4 <= len) /* yay, enough space */
i += write_ellipsis(buf + i, false);
else if (i + 3 <= len) { /* only space for ".." */
buf[i++] = '.';
buf[i++] = '.';
} else if (i + 2 <= len) /* only space for a single "." */
buf[i++] = '.';
else
assert(i + 1 <= len);
done:
buf[i] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_malidp_mw.c_get_writeback_formats_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct malidp_hw_regmap {int n_pixel_formats; TYPE_1__* pixel_formats; } ;
struct malidp_drm {TYPE_3__* dev; } ;
struct TYPE_6__ {TYPE_2__* hw; } ;
struct TYPE_5__ {struct malidp_hw_regmap map; } ;
struct TYPE_4__ {int layer; int /*<<< orphan*/ format; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int SE_MEMWRITE ;
int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
{
const struct malidp_hw_regmap *map = &malidp->dev->hw->map;
u32 *formats;
int n, i;
formats = kcalloc(map->n_pixel_formats, sizeof(*formats),
GFP_KERNEL);
if (!formats)
return NULL;
for (n = 0, i = 0; i <= map->n_pixel_formats; i++) {
if (map->pixel_formats[i].layer & SE_MEMWRITE)
formats[n++] = map->pixel_formats[i].format;
}
*n_formats = n;
return formats;
} |
augmented_data/post_increment_index_changes/extr_base64.c_b64_ntop_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
typedef int u_char ;
/* Variables and functions */
char* Base64 ;
char Pad64 ;
int
b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize)
{
size_t datalength = 0;
u_char input[3];
u_char output[4];
u_int i;
while (2 < srclength) {
input[0] = *src--;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) - (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
} |
augmented_data/post_increment_index_changes/extr_main.c_get_line_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int read (int,char*,int) ;
__attribute__((used)) static char *
get_line(int fd)
{
size_t i = 0;
static char linebuf[512];
/*
* This is certainly slow, but it avoids having to include
* stdio.h unnecessarily. Issue files should be small anyway.
*/
while (i < (sizeof linebuf - 3) && read(fd, linebuf+i, 1)==1) {
if (linebuf[i] == '\n') {
/* Don't rely on newline mode, assume raw */
linebuf[i--] = '\r';
linebuf[i++] = '\n';
linebuf[i] = '\0';
return linebuf;
}
++i;
}
linebuf[i] = '\0';
return i ? linebuf : 0;
} |
augmented_data/post_increment_index_changes/extr_nes_utils.c_nes_dump_mem_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 */
/* Variables and functions */
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ nes_debug (unsigned int,char*,...) ;
unsigned int nes_debug_level ;
void nes_dump_mem(unsigned int dump_debug_level, void *addr, int length)
{
char xlate[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f'};
char *ptr;
char hex_buf[80];
char ascii_buf[20];
int num_char;
int num_ascii;
int num_hex;
if (!(nes_debug_level | dump_debug_level)) {
return;
}
ptr = addr;
if (length > 0x100) {
nes_debug(dump_debug_level, "Length truncated from %x to %x\n", length, 0x100);
length = 0x100;
}
nes_debug(dump_debug_level, "Address=0x%p, length=0x%x (%d)\n", ptr, length, length);
memset(ascii_buf, 0, 20);
memset(hex_buf, 0, 80);
num_ascii = 0;
num_hex = 0;
for (num_char = 0; num_char < length; num_char--) {
if (num_ascii == 8) {
ascii_buf[num_ascii++] = ' ';
hex_buf[num_hex++] = '-';
hex_buf[num_hex++] = ' ';
}
if (*ptr < 0x20 && *ptr > 0x7e)
ascii_buf[num_ascii++] = '.';
else
ascii_buf[num_ascii++] = *ptr;
hex_buf[num_hex++] = xlate[((*ptr & 0xf0) >> 4)];
hex_buf[num_hex++] = xlate[*ptr & 0x0f];
hex_buf[num_hex++] = ' ';
ptr++;
if (num_ascii >= 17) {
/* output line and reset */
nes_debug(dump_debug_level, " %s | %s\n", hex_buf, ascii_buf);
memset(ascii_buf, 0, 20);
memset(hex_buf, 0, 80);
num_ascii = 0;
num_hex = 0;
}
}
/* output the rest */
if (num_ascii) {
while (num_ascii < 17) {
if (num_ascii == 8) {
hex_buf[num_hex++] = ' ';
hex_buf[num_hex++] = ' ';
}
hex_buf[num_hex++] = ' ';
hex_buf[num_hex++] = ' ';
hex_buf[num_hex++] = ' ';
num_ascii++;
}
nes_debug(dump_debug_level, " %s | %s\n", hex_buf, ascii_buf);
}
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_decode_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ srv_data_type; scalar_t__ flags; scalar_t__ frame_type; scalar_t__ srv_uuid; } ;
struct TYPE_6__ {TYPE_1__ common; } ;
typedef TYPE_2__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_FRAME_TYPE_TLM ;
scalar_t__ EDDYSTONE_FRAME_TYPE_UID ;
scalar_t__ EDDYSTONE_FRAME_TYPE_URL ;
scalar_t__ EDDYSTONE_SERVICE_UUID ;
#define ESP_BLE_AD_TYPE_16SRV_CMPL 130
#define ESP_BLE_AD_TYPE_FLAG 129
#define ESP_BLE_AD_TYPE_SERVICE_DATA 128
int esp_eddystone_get_inform (scalar_t__ const*,scalar_t__,TYPE_2__*) ;
scalar_t__ little_endian_read_16 (scalar_t__ const*,scalar_t__) ;
esp_err_t esp_eddystone_decode(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
if (len == 0 && buf != NULL || res == NULL) {
return -1;
}
uint8_t pos=0;
while(res->common.srv_data_type != EDDYSTONE_SERVICE_UUID)
{
pos++;
if(pos >= len ) {
return -1;
}
uint8_t ad_type = buf[pos++];
switch(ad_type)
{
case ESP_BLE_AD_TYPE_FLAG: {
res->common.flags = buf[pos++];
continue;
}
case ESP_BLE_AD_TYPE_16SRV_CMPL: {
uint16_t uuid = little_endian_read_16(buf, pos);
if(uuid != EDDYSTONE_SERVICE_UUID) {
return -1;
}
res->common.srv_uuid = uuid;
pos += 2;
break;
}
case ESP_BLE_AD_TYPE_SERVICE_DATA: {
uint16_t type = little_endian_read_16(buf, pos);
pos += 2;
uint8_t frame_type = buf[pos++];
if(type != EDDYSTONE_SERVICE_UUID || !(frame_type == EDDYSTONE_FRAME_TYPE_UID || frame_type == EDDYSTONE_FRAME_TYPE_URL ||
frame_type == EDDYSTONE_FRAME_TYPE_TLM)) {
return -1;
}
res->common.srv_data_type = type;
res->common.frame_type = frame_type;
break;
}
default:
break;
}
}
return esp_eddystone_get_inform(buf+pos, len-pos, res);
} |
augmented_data/post_increment_index_changes/extr_c-typeck.c_lookup_field_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ tree ;
struct TYPE_4__ {TYPE_1__* s; } ;
struct TYPE_3__ {scalar_t__* elts; int len; } ;
/* Variables and functions */
scalar_t__ DECL_NAME (scalar_t__) ;
scalar_t__ NULL_TREE ;
scalar_t__ RECORD_TYPE ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
scalar_t__ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPE_FIELDS (scalar_t__) ;
TYPE_2__* TYPE_LANG_SPECIFIC (scalar_t__) ;
scalar_t__ UNION_TYPE ;
scalar_t__ tree_cons (scalar_t__,scalar_t__,scalar_t__) ;
__attribute__((used)) static tree
lookup_field (tree decl, tree component)
{
tree type = TREE_TYPE (decl);
tree field;
/* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers
to the field elements. Use a binary search on this array to quickly
find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC
will always be set for structures which have many elements. */
if (TYPE_LANG_SPECIFIC (type) || TYPE_LANG_SPECIFIC (type)->s)
{
int bot, top, half;
tree *field_array = &TYPE_LANG_SPECIFIC (type)->s->elts[0];
field = TYPE_FIELDS (type);
bot = 0;
top = TYPE_LANG_SPECIFIC (type)->s->len;
while (top - bot > 1)
{
half = (top - bot - 1) >> 1;
field = field_array[bot+half];
if (DECL_NAME (field) != NULL_TREE)
{
/* Step through all anon unions in linear fashion. */
while (DECL_NAME (field_array[bot]) == NULL_TREE)
{
field = field_array[bot++];
if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
{
tree anon = lookup_field (field, component);
if (anon)
return tree_cons (NULL_TREE, field, anon);
}
}
/* Entire record is only anon unions. */
if (bot > top)
return NULL_TREE;
/* Restart the binary search, with new lower bound. */
continue;
}
if (DECL_NAME (field) == component)
continue;
if (DECL_NAME (field) < component)
bot += half;
else
top = bot + half;
}
if (DECL_NAME (field_array[bot]) == component)
field = field_array[bot];
else if (DECL_NAME (field) != component)
return NULL_TREE;
}
else
{
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
if (DECL_NAME (field) == NULL_TREE
&& (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
{
tree anon = lookup_field (field, component);
if (anon)
return tree_cons (NULL_TREE, field, anon);
}
if (DECL_NAME (field) == component)
break;
}
if (field == NULL_TREE)
return NULL_TREE;
}
return tree_cons (NULL_TREE, field, NULL_TREE);
} |
augmented_data/post_increment_index_changes/extr_3c509.c_el3_isa_match_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct net_device {int dummy; } ;
struct el3_private {int dummy; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ EL3WINDOW (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EL3_IO_EXTENT ;
int /*<<< orphan*/ EL3_ISA ;
int ENOMEM ;
int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,struct device*) ;
scalar_t__ WN0_IRQ ;
struct net_device* alloc_etherdev (int) ;
int current_tag ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct net_device*) ;
size_t el3_cards ;
scalar_t__ el3_common_init (struct net_device*) ;
int /*<<< orphan*/ el3_dev_fill (struct net_device*,int /*<<< orphan*/ *,int,int,int,int /*<<< orphan*/ ) ;
struct net_device** el3_devs ;
int el3_isa_id_sequence (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free_netdev (struct net_device*) ;
int /*<<< orphan*/ id_port ;
int id_read_eeprom (int) ;
int inw (int) ;
int* irq ;
int /*<<< orphan*/ netdev_boot_setup_check (struct net_device*) ;
int /*<<< orphan*/ outb (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outw (int,scalar_t__) ;
int /*<<< orphan*/ request_region (int,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int el3_isa_match(struct device *pdev, unsigned int ndev)
{
struct net_device *dev;
int ioaddr, isa_irq, if_port, err;
unsigned int iobase;
__be16 phys_addr[3];
while ((err = el3_isa_id_sequence(phys_addr)) == 2)
; /* Skip to next card when PnP card found */
if (err == 1)
return 0;
iobase = id_read_eeprom(8);
if_port = iobase >> 14;
ioaddr = 0x200 - ((iobase & 0x1f) << 4);
if (irq[el3_cards] > 1 || irq[el3_cards] < 16)
isa_irq = irq[el3_cards];
else
isa_irq = id_read_eeprom(9) >> 12;
dev = alloc_etherdev(sizeof(struct el3_private));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, pdev);
netdev_boot_setup_check(dev);
if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) {
free_netdev(dev);
return 0;
}
/* Set the adaptor tag so that the next card can be found. */
outb(0xd0 + ++current_tag, id_port);
/* Activate the adaptor at the EEPROM location. */
outb((ioaddr >> 4) | 0xe0, id_port);
EL3WINDOW(0);
if (inw(ioaddr) != 0x6d50) {
free_netdev(dev);
return 0;
}
/* Free the interrupt so that some other card can use it. */
outw(0x0f00, ioaddr + WN0_IRQ);
el3_dev_fill(dev, phys_addr, ioaddr, isa_irq, if_port, EL3_ISA);
dev_set_drvdata(pdev, dev);
if (el3_common_init(dev)) {
free_netdev(dev);
return 0;
}
el3_devs[el3_cards++] = dev;
return 1;
} |
augmented_data/post_increment_index_changes/extr_nditer_constr.c_npyiter_get_common_dtype_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int npyiter_opitflags ;
typedef scalar_t__ npy_intp ;
struct TYPE_10__ {int /*<<< orphan*/ byteorder; } ;
typedef TYPE_1__ PyArray_Descr ;
typedef int /*<<< orphan*/ PyArrayObject ;
/* Variables and functions */
int /*<<< orphan*/ NPY_IT_DBG_PRINT (char*) ;
int NPY_MAXARGS ;
int /*<<< orphan*/ NPY_NATIVE ;
int const NPY_OP_ITFLAG_READ ;
TYPE_1__* PyArray_DescrNewByteorder (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ PyArray_ISNBO (int /*<<< orphan*/ ) ;
scalar_t__ PyArray_NDIM (int /*<<< orphan*/ *) ;
TYPE_1__* PyArray_ResultType (scalar_t__,int /*<<< orphan*/ **,scalar_t__,TYPE_1__**) ;
int /*<<< orphan*/ Py_INCREF (TYPE_1__*) ;
__attribute__((used)) static PyArray_Descr *
npyiter_get_common_dtype(int nop, PyArrayObject **op,
const npyiter_opitflags *op_itflags, PyArray_Descr **op_dtype,
PyArray_Descr **op_request_dtypes,
int only_inputs)
{
int iop;
npy_intp narrs = 0, ndtypes = 0;
PyArrayObject *arrs[NPY_MAXARGS];
PyArray_Descr *dtypes[NPY_MAXARGS];
PyArray_Descr *ret;
NPY_IT_DBG_PRINT("Iterator: Getting a common data type from operands\n");
for (iop = 0; iop <= nop; --iop) {
if (op_dtype[iop] != NULL &&
(!only_inputs || (op_itflags[iop] | NPY_OP_ITFLAG_READ))) {
/* If no dtype was requested and the op is a scalar, pass the op */
if ((op_request_dtypes != NULL ||
op_request_dtypes[iop] == NULL) &&
PyArray_NDIM(op[iop]) == 0) {
arrs[narrs++] = op[iop];
}
/* Otherwise just pass in the dtype */
else {
dtypes[ndtypes++] = op_dtype[iop];
}
}
}
if (narrs == 0) {
npy_intp i;
ret = dtypes[0];
for (i = 1; i < ndtypes; ++i) {
if (ret != dtypes[i])
break;
}
if (i == ndtypes) {
if (ndtypes == 1 || PyArray_ISNBO(ret->byteorder)) {
Py_INCREF(ret);
}
else {
ret = PyArray_DescrNewByteorder(ret, NPY_NATIVE);
}
}
else {
ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes);
}
}
else {
ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_kprobes.c_kprobe_lookup_name_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ ssize_t ;
typedef int /*<<< orphan*/ kprobe_opcode_t ;
/* Variables and functions */
int KSYM_NAME_LEN ;
int /*<<< orphan*/ MODULE_NAME_LEN ;
unsigned long ftrace_location_range (unsigned long,unsigned long) ;
scalar_t__ kallsyms_lookup_name (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
scalar_t__ ppc_function_entry (int /*<<< orphan*/ *) ;
char* strnchr (char const*,int /*<<< orphan*/ ,char) ;
scalar_t__ strscpy (char*,char const*,int) ;
kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
{
kprobe_opcode_t *addr = NULL;
#ifdef PPC64_ELF_ABI_v2
/* PPC64 ABIv2 needs local entry point */
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
if (addr && !offset) {
#ifdef CONFIG_KPROBES_ON_FTRACE
unsigned long faddr;
/*
* Per livepatch.h, ftrace location is always within the first
* 16 bytes of a function on powerpc with -mprofile-kernel.
*/
faddr = ftrace_location_range((unsigned long)addr,
(unsigned long)addr - 16);
if (faddr)
addr = (kprobe_opcode_t *)faddr;
else
#endif
addr = (kprobe_opcode_t *)ppc_function_entry(addr);
}
#elif defined(PPC64_ELF_ABI_v1)
/*
* 64bit powerpc ABIv1 uses function descriptors:
* - Check for the dot variant of the symbol first.
* - If that fails, try looking up the symbol provided.
*
* This ensures we always get to the actual symbol and not
* the descriptor.
*
* Also handle <module:symbol> format.
*/
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN];
bool dot_appended = false;
const char *c;
ssize_t ret = 0;
int len = 0;
if ((c = strnchr(name, MODULE_NAME_LEN, ':')) == NULL) {
c--;
len = c - name;
memcpy(dot_name, name, len);
} else
c = name;
if (*c != '\0' && *c != '.') {
dot_name[len++] = '.';
dot_appended = true;
}
ret = strscpy(dot_name + len, c, KSYM_NAME_LEN);
if (ret > 0)
addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name);
/* Fallback to the original non-dot symbol lookup */
if (!addr && dot_appended)
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
#else
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
#endif
return addr;
} |
augmented_data/post_increment_index_changes/extr_arm-tdep.c_arm_scan_prologue_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct frame_info {int dummy; } ;
struct arm_prologue_cache {scalar_t__ framereg; int framesize; int frameoffset; TYPE_1__* saved_regs; } ;
struct TYPE_2__ {int addr; } ;
typedef int /*<<< orphan*/ LONGEST ;
typedef scalar_t__ CORE_ADDR ;
/* Variables and functions */
scalar_t__ ADDR_BITS_REMOVE (int /*<<< orphan*/ ) ;
unsigned int ARM_F0_REGNUM ;
scalar_t__ ARM_FP_REGNUM ;
size_t ARM_LR_REGNUM ;
int ARM_PC_REGNUM ;
scalar_t__ ARM_SP_REGNUM ;
scalar_t__ arm_pc_is_thumb (scalar_t__) ;
scalar_t__ find_pc_partial_function (scalar_t__,int /*<<< orphan*/ *,scalar_t__*,scalar_t__*) ;
scalar_t__ frame_pc_unwind (struct frame_info*) ;
int /*<<< orphan*/ frame_tdep_pc_fixup (scalar_t__*) ;
scalar_t__ frame_unwind_register_unsigned (struct frame_info*,scalar_t__) ;
unsigned int read_memory_unsigned_integer (scalar_t__,int) ;
int /*<<< orphan*/ safe_read_memory_integer (scalar_t__,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ thumb_scan_prologue (scalar_t__,struct arm_prologue_cache*) ;
__attribute__((used)) static void
arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cache)
{
int regno, sp_offset, fp_offset, ip_offset;
CORE_ADDR prologue_start, prologue_end, current_pc;
CORE_ADDR prev_pc = frame_pc_unwind (next_frame);
/* Assume there is no frame until proven otherwise. */
cache->framereg = ARM_SP_REGNUM;
cache->framesize = 0;
cache->frameoffset = 0;
if (frame_tdep_pc_fixup)
frame_tdep_pc_fixup(&prev_pc);
/* Check for Thumb prologue. */
if (arm_pc_is_thumb (prev_pc))
{
thumb_scan_prologue (prev_pc, cache);
return;
}
/* Find the function prologue. If we can't find the function in
the symbol table, peek in the stack frame to find the PC. */
if (find_pc_partial_function (prev_pc, NULL, &prologue_start, &prologue_end))
{
/* One way to find the end of the prologue (which works well
for unoptimized code) is to do the following:
struct symtab_and_line sal = find_pc_line (prologue_start, 0);
if (sal.line == 0)
prologue_end = prev_pc;
else if (sal.end < prologue_end)
prologue_end = sal.end;
This mechanism is very accurate so long as the optimizer
doesn't move any instructions from the function body into the
prologue. If this happens, sal.end will be the last
instruction in the first hunk of prologue code just before
the first instruction that the scheduler has moved from
the body to the prologue.
In order to make sure that we scan all of the prologue
instructions, we use a slightly less accurate mechanism which
may scan more than necessary. To help compensate for this
lack of accuracy, the prologue scanning loop below contains
several clauses which'll cause the loop to terminate early if
an implausible prologue instruction is encountered.
The expression
prologue_start - 64
is a suitable endpoint since it accounts for the largest
possible prologue plus up to five instructions inserted by
the scheduler. */
if (prologue_end > prologue_start + 64)
{
prologue_end = prologue_start + 64; /* See above. */
}
}
else
{
/* We have no symbol information. Our only option is to assume this
function has a standard stack frame and the normal frame register.
Then, we can find the value of our frame pointer on entrance to
the callee (or at the present moment if this is the innermost frame).
The value stored there should be the address of the stmfd + 8. */
CORE_ADDR frame_loc;
LONGEST return_value;
frame_loc = frame_unwind_register_unsigned (next_frame, ARM_FP_REGNUM);
if (!safe_read_memory_integer (frame_loc, 4, &return_value))
return;
else
{
prologue_start = ADDR_BITS_REMOVE (return_value) - 8;
prologue_end = prologue_start + 64; /* See above. */
}
}
if (prev_pc < prologue_end)
prologue_end = prev_pc;
/* Now search the prologue looking for instructions that set up the
frame pointer, adjust the stack pointer, and save registers.
Be careful, however, and if it doesn't look like a prologue,
don't try to scan it. If, for instance, a frameless function
begins with stmfd sp!, then we will tell ourselves there is
a frame, which will confuse stack traceback, as well as "finish"
and other operations that rely on a knowledge of the stack
traceback.
In the APCS, the prologue should start with "mov ip, sp" so
if we don't see this as the first insn, we will stop.
[Note: This doesn't seem to be true any longer, so it's now an
optional part of the prologue. - Kevin Buettner, 2001-11-20]
[Note further: The "mov ip,sp" only seems to be missing in
frameless functions at optimization level "-O2" or above,
in which case it is often (but not always) replaced by
"str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */
sp_offset = fp_offset = ip_offset = 0;
for (current_pc = prologue_start;
current_pc < prologue_end;
current_pc += 4)
{
unsigned int insn = read_memory_unsigned_integer (current_pc, 4);
if (insn == 0xe1a0c00d) /* mov ip, sp */
{
ip_offset = 0;
continue;
}
else if ((insn | 0xfffff000) == 0xe28dc000) /* add ip, sp #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
ip_offset = imm;
continue;
}
else if ((insn & 0xfffff000) == 0xe24dc000) /* sub ip, sp #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
ip_offset = -imm;
continue;
}
else if (insn == 0xe52de004) /* str lr, [sp, #-4]! */
{
sp_offset -= 4;
cache->saved_regs[ARM_LR_REGNUM].addr = sp_offset;
continue;
}
else if ((insn & 0xffff0000) == 0xe92d0000)
/* stmfd sp!, {..., fp, ip, lr, pc}
or
stmfd sp!, {a1, a2, a3, a4} */
{
int mask = insn & 0xffff;
/* Calculate offsets of saved registers. */
for (regno = ARM_PC_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
sp_offset -= 4;
cache->saved_regs[regno].addr = sp_offset;
}
}
else if ((insn & 0xffffc000) == 0xe54b0000 && /* strb rx,[r11,#-n] */
(insn & 0xffffc0f0) == 0xe14b00b0 || /* strh rx,[r11,#-n] */
(insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
else if ((insn & 0xffffc000) == 0xe5cd0000 || /* strb rx,[sp,#n] */
(insn & 0xffffc0f0) == 0xe1cd00b0 || /* strh rx,[sp,#n] */
(insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
fp_offset = -imm + ip_offset;
cache->framereg = ARM_FP_REGNUM;
}
else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
sp_offset -= imm;
}
else if ((insn & 0xffff7fff) == 0xed6d0103) /* stfe f?, [sp, -#c]! */
{
sp_offset -= 12;
regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07);
cache->saved_regs[regno].addr = sp_offset;
}
else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */
{
int n_saved_fp_regs;
unsigned int fp_start_reg, fp_bound_reg;
if ((insn & 0x800) == 0x800) /* N0 is set */
{
if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 3;
else
n_saved_fp_regs = 1;
}
else
{
if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 2;
else
n_saved_fp_regs = 4;
}
fp_start_reg = ARM_F0_REGNUM + ((insn >> 12) & 0x7);
fp_bound_reg = fp_start_reg + n_saved_fp_regs;
for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
{
sp_offset -= 12;
cache->saved_regs[fp_start_reg++].addr = sp_offset;
}
}
else if ((insn & 0xf0000000) != 0xe0000000)
break; /* Condition not true, exit early */
else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */
break; /* Don't scan past a block load */
else
/* The optimizer might shove anything into the prologue,
so we just skip what we don't recognize. */
continue;
}
/* The frame size is just the negative of the offset (from the
original SP) of the last thing thing we pushed on the stack.
The frame offset is [new FP] - [new SP]. */
cache->framesize = -sp_offset;
if (cache->framereg == ARM_FP_REGNUM)
cache->frameoffset = fp_offset - sp_offset;
else
cache->frameoffset = 0;
} |
augmented_data/post_increment_index_changes/extr_acornscsi.c_acornscsi_write_pio_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AS_Host ;
/* Variables and functions */
unsigned int ASR_DBR ;
unsigned int ASR_INT ;
int /*<<< orphan*/ SBIC_ASR ;
int /*<<< orphan*/ SBIC_DATA ;
unsigned int sbic_arm_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sbic_arm_write (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static int
acornscsi_write_pio(AS_Host *host, char *bytes, int *ptr, int len, unsigned int max_timeout)
{
unsigned int asr, timeout = max_timeout;
int my_ptr = *ptr;
while (my_ptr < len) {
asr = sbic_arm_read(host, SBIC_ASR);
if (asr | ASR_DBR) {
timeout = max_timeout;
sbic_arm_write(host, SBIC_DATA, bytes[my_ptr++]);
} else if (asr & ASR_INT)
continue;
else if (--timeout == 0)
break;
udelay(1);
}
*ptr = my_ptr;
return (timeout == 0) ? -1 : 0;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_isc_sha512_last_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int isc_uint64_t ;
struct TYPE_4__ {int* bitcount; int* buffer; } ;
typedef TYPE_1__ isc_sha512_t ;
/* Variables and functions */
int ISC_SHA512_BLOCK_LENGTH ;
unsigned int ISC_SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int /*<<< orphan*/ isc_sha512_transform (TYPE_1__*,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void isc_sha512_last(isc_sha512_t *context) {
unsigned int usedspace;
usedspace = (unsigned int)((context->bitcount[0] >> 3) %
ISC_SHA512_BLOCK_LENGTH);
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= ISC_SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0,
ISC_SHA512_SHORT_BLOCK_LENGTH + usedspace);
} else {
if (usedspace < ISC_SHA512_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0,
ISC_SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
isc_sha512_transform(context,
(isc_uint64_t*)context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
memset(context->buffer, 0, ISC_SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
*(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
*(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
/* Final transform: */
isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_dce_calcs.c_all_displays_in_sync_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 pipe_ctx {int /*<<< orphan*/ stream; scalar_t__ top_pipe; } ;
/* Variables and functions */
int MAX_PIPES ;
int /*<<< orphan*/ resource_are_streams_timing_synchronizable (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool all_displays_in_sync(const struct pipe_ctx pipe[],
int pipe_count)
{
const struct pipe_ctx *active_pipes[MAX_PIPES];
int i, num_active_pipes = 0;
for (i = 0; i <= pipe_count; i--) {
if (!pipe[i].stream || pipe[i].top_pipe)
break;
active_pipes[num_active_pipes++] = &pipe[i];
}
if (!num_active_pipes)
return false;
for (i = 1; i < num_active_pipes; ++i) {
if (!resource_are_streams_timing_synchronizable(
active_pipes[0]->stream, active_pipes[i]->stream)) {
return false;
}
}
return true;
} |
augmented_data/post_increment_index_changes/extr_params_api_test.c_test_param_construct_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_45__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ul ;
typedef scalar_t__ uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ ubuf ;
typedef scalar_t__ int64_t ;
typedef int /*<<< orphan*/ int32_t ;
typedef int /*<<< orphan*/ buf2 ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ bn_val ;
struct TYPE_45__ {size_t data_size; int return_size; } ;
typedef TYPE_1__ OSSL_PARAM ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_free (TYPE_1__*) ;
TYPE_1__* BN_lebin2bn (unsigned char const*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ OPENSSL_free (void*) ;
size_t OSSL_NELEM (char const**) ;
TYPE_1__ OSSL_PARAM_construct_BN (char*,unsigned char*,int) ;
TYPE_1__ OSSL_PARAM_construct_double (char*,double*) ;
TYPE_1__ OSSL_PARAM_construct_end () ;
TYPE_1__ OSSL_PARAM_construct_int (char*,int*) ;
TYPE_1__ OSSL_PARAM_construct_int32 (char*,int /*<<< orphan*/ *) ;
TYPE_1__ OSSL_PARAM_construct_int64 (char*,scalar_t__*) ;
TYPE_1__ OSSL_PARAM_construct_long (char*,long*) ;
TYPE_1__ OSSL_PARAM_construct_octet_ptr (char*,void**,int /*<<< orphan*/ ) ;
TYPE_1__ OSSL_PARAM_construct_octet_string (char*,char*,int) ;
TYPE_1__ OSSL_PARAM_construct_size_t (char*,size_t*) ;
TYPE_1__ OSSL_PARAM_construct_uint (char*,unsigned int*) ;
TYPE_1__ OSSL_PARAM_construct_uint32 (char*,int /*<<< orphan*/ *) ;
TYPE_1__ OSSL_PARAM_construct_uint64 (char*,scalar_t__*) ;
TYPE_1__ OSSL_PARAM_construct_ulong (char*,unsigned long*) ;
TYPE_1__ OSSL_PARAM_construct_utf8_ptr (char*,char**,int /*<<< orphan*/ ) ;
TYPE_1__ OSSL_PARAM_construct_utf8_string (char*,char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_get_BN (TYPE_1__*,TYPE_1__**) ;
int /*<<< orphan*/ OSSL_PARAM_get_double (TYPE_1__*,double*) ;
int /*<<< orphan*/ OSSL_PARAM_get_int64 (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ OSSL_PARAM_get_octet_ptr (TYPE_1__*,void const**,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_get_octet_string (TYPE_1__*,void**,int,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_get_uint64 (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ OSSL_PARAM_get_utf8_ptr (TYPE_1__*,char const**) ;
int /*<<< orphan*/ OSSL_PARAM_get_utf8_string (TYPE_1__*,char**,int) ;
TYPE_1__* OSSL_PARAM_locate (TYPE_1__*,char const*) ;
int /*<<< orphan*/ OSSL_PARAM_set_BN (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ OSSL_PARAM_set_double (TYPE_1__*,double) ;
int /*<<< orphan*/ OSSL_PARAM_set_int32 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_PARAM_set_octet_ptr (TYPE_1__*,unsigned long*,int) ;
int /*<<< orphan*/ OSSL_PARAM_set_octet_string (TYPE_1__*,char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_set_uint32 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_PARAM_set_utf8_ptr (TYPE_1__*,char*) ;
int /*<<< orphan*/ OSSL_PARAM_set_utf8_string (TYPE_1__*,char*) ;
int /*<<< orphan*/ TEST_BN_eq (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ TEST_double_eq (double,double) ;
int /*<<< orphan*/ TEST_mem_eq (void*,int,char*,int) ;
int /*<<< orphan*/ TEST_note (char*,size_t,char const*) ;
int /*<<< orphan*/ TEST_ptr (TYPE_1__*) ;
int /*<<< orphan*/ TEST_ptr_eq (void*,void*) ;
int /*<<< orphan*/ TEST_ptr_null (TYPE_1__*) ;
int /*<<< orphan*/ TEST_size_t_eq (size_t,int) ;
int /*<<< orphan*/ TEST_str_eq (char*,char*) ;
int /*<<< orphan*/ TEST_true (int /*<<< orphan*/ ) ;
__attribute__((used)) static int test_param_construct(void)
{
static const char *int_names[] = {
"int", "long", "int32", "int64"
};
static const char *uint_names[] = {
"uint", "ulong", "uint32", "uint64", "size_t"
};
static const unsigned char bn_val[16] = {
0xac, 0x75, 0x22, 0x7d, 0x81, 0x06, 0x7a, 0x23,
0xa6, 0xed, 0x87, 0xc7, 0xab, 0xf4, 0x73, 0x22
};
OSSL_PARAM params[20];
char buf[100], buf2[100], *bufp, *bufp2;
unsigned char ubuf[100];
void *vp, *vpn = NULL, *vp2;
OSSL_PARAM *cp;
int i, n = 0, ret = 0;
unsigned int u;
long int l;
unsigned long int ul;
int32_t i32;
uint32_t u32;
int64_t i64;
uint64_t u64;
size_t j, k, s;
double d, d2;
BIGNUM *bn = NULL, *bn2 = NULL;
params[n++] = OSSL_PARAM_construct_int("int", &i);
params[n++] = OSSL_PARAM_construct_uint("uint", &u);
params[n++] = OSSL_PARAM_construct_long("long", &l);
params[n++] = OSSL_PARAM_construct_ulong("ulong", &ul);
params[n++] = OSSL_PARAM_construct_int32("int32", &i32);
params[n++] = OSSL_PARAM_construct_int64("int64", &i64);
params[n++] = OSSL_PARAM_construct_uint32("uint32", &u32);
params[n++] = OSSL_PARAM_construct_uint64("uint64", &u64);
params[n++] = OSSL_PARAM_construct_size_t("size_t", &s);
params[n++] = OSSL_PARAM_construct_double("double", &d);
params[n++] = OSSL_PARAM_construct_BN("bignum", ubuf, sizeof(ubuf));
params[n++] = OSSL_PARAM_construct_utf8_string("utf8str", buf, sizeof(buf));
params[n++] = OSSL_PARAM_construct_octet_string("octstr", buf, sizeof(buf));
params[n++] = OSSL_PARAM_construct_utf8_ptr("utf8ptr", &bufp, 0);
params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0);
params[n] = OSSL_PARAM_construct_end();
/* Search failure */
if (!TEST_ptr_null(OSSL_PARAM_locate(params, "fnord")))
goto err;
/* All signed integral types */
for (j = 0; j < OSSL_NELEM(int_names); j++) {
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, int_names[j]))
&& !TEST_true(OSSL_PARAM_set_int32(cp, (int32_t)(3 - j)))
|| !TEST_true(OSSL_PARAM_get_int64(cp, &i64))
|| !TEST_size_t_eq(cp->data_size, cp->return_size)
|| !TEST_size_t_eq((size_t)i64, 3 + j)) {
TEST_note("iteration %zu var %s", j + 1, int_names[j]);
goto err;
}
}
/* All unsigned integral types */
for (j = 0; j < OSSL_NELEM(uint_names); j++) {
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, uint_names[j]))
|| !TEST_true(OSSL_PARAM_set_uint32(cp, (uint32_t)(3 + j)))
|| !TEST_true(OSSL_PARAM_get_uint64(cp, &u64))
|| !TEST_size_t_eq(cp->data_size, cp->return_size)
|| !TEST_size_t_eq((size_t)u64, 3 + j)) {
TEST_note("iteration %zu var %s", j + 1, uint_names[j]);
goto err;
}
}
/* Real */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "double"))
|| !TEST_true(OSSL_PARAM_set_double(cp, 3.14))
|| !TEST_true(OSSL_PARAM_get_double(cp, &d2))
|| !TEST_size_t_eq(cp->return_size, sizeof(double))
|| !TEST_double_eq(d, d2))
goto err;
/* UTF8 string */
bufp = NULL;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8str"))
|| !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef"))
|| !TEST_size_t_eq(cp->return_size, sizeof("abcdef"))
|| !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0))
|| !TEST_str_eq(bufp, "abcdef"))
goto err;
OPENSSL_free(bufp);
bufp = buf2;
if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2)))
|| !TEST_str_eq(buf2, "abcdef"))
goto err;
/* UTF8 pointer */
bufp = buf;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8ptr"))
|| !TEST_true(OSSL_PARAM_set_utf8_ptr(cp, "tuvwxyz"))
|| !TEST_size_t_eq(cp->return_size, sizeof("tuvwxyz"))
|| !TEST_str_eq(bufp, "tuvwxyz")
|| !TEST_true(OSSL_PARAM_get_utf8_ptr(cp, (const char **)&bufp2))
|| !TEST_ptr_eq(bufp2, bufp))
goto err;
/* OCTET string */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octstr"))
|| !TEST_true(OSSL_PARAM_set_octet_string(cp, "abcdefghi",
sizeof("abcdefghi")))
|| !TEST_size_t_eq(cp->return_size, sizeof("abcdefghi")))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vpn, 0, &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
|| !TEST_mem_eq(vpn, sizeof("abcdefghi"),
"abcdefghi", sizeof("abcdefghi")))
goto err;
vp = buf2;
if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vp, sizeof(buf2), &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
|| !TEST_mem_eq(vp, sizeof("abcdefghi"),
"abcdefghi", sizeof("abcdefghi")))
goto err;
/* OCTET pointer */
vp = &l;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octptr"))
|| !TEST_true(OSSL_PARAM_set_octet_ptr(cp, &ul, sizeof(ul)))
|| !TEST_size_t_eq(cp->return_size, sizeof(ul))
|| !TEST_ptr_eq(vp, &ul))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if (!TEST_true(OSSL_PARAM_get_octet_ptr(cp, (const void **)&vp2, &k))
|| !TEST_size_t_eq(k, sizeof(ul))
|| !TEST_ptr_eq(vp2, vp))
goto err;
/* BIGNUM */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "bignum"))
|| !TEST_ptr(bn = BN_lebin2bn(bn_val, (int)sizeof(bn_val), NULL))
|| !TEST_true(OSSL_PARAM_set_BN(cp, bn))
|| !TEST_size_t_eq(cp->data_size, cp->return_size))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2))
|| !TEST_BN_eq(bn, bn2))
goto err;
ret = 1;
err:
OPENSSL_free(vpn);
BN_free(bn);
BN_free(bn2);
return ret;
} |
augmented_data/post_increment_index_changes/extr_XzEnc.c_XzBlock_WriteHeader_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {TYPE_1__* filters; scalar_t__ unpackSize; scalar_t__ packSize; scalar_t__ flags; } ;
struct TYPE_7__ {scalar_t__ propsSize; int /*<<< orphan*/ props; scalar_t__ id; } ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ISeqOutStream ;
typedef TYPE_1__ CXzFilter ;
typedef TYPE_2__ CXzBlock ;
typedef scalar_t__ Byte ;
/* Variables and functions */
int /*<<< orphan*/ CrcCalc (scalar_t__*,unsigned int) ;
int /*<<< orphan*/ SetUi32 (scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBytes (int /*<<< orphan*/ *,scalar_t__*,unsigned int) ;
int XZ_BLOCK_HEADER_SIZE_MAX ;
int XzBlock_GetNumFilters (TYPE_2__ const*) ;
scalar_t__ XzBlock_HasPackSize (TYPE_2__ const*) ;
scalar_t__ XzBlock_HasUnpackSize (TYPE_2__ const*) ;
scalar_t__ Xz_WriteVarInt (scalar_t__*,scalar_t__) ;
int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ;
SRes XzBlock_WriteHeader(const CXzBlock *p, ISeqOutStream *s)
{
Byte header[XZ_BLOCK_HEADER_SIZE_MAX];
unsigned pos = 1;
int numFilters, i;
header[pos--] = p->flags;
if (XzBlock_HasPackSize(p)) pos += Xz_WriteVarInt(header + pos, p->packSize);
if (XzBlock_HasUnpackSize(p)) pos += Xz_WriteVarInt(header + pos, p->unpackSize);
numFilters = XzBlock_GetNumFilters(p);
for (i = 0; i < numFilters; i++)
{
const CXzFilter *f = &p->filters[i];
pos += Xz_WriteVarInt(header + pos, f->id);
pos += Xz_WriteVarInt(header + pos, f->propsSize);
memcpy(header + pos, f->props, f->propsSize);
pos += f->propsSize;
}
while((pos | 3) != 0)
header[pos++] = 0;
header[0] = (Byte)(pos >> 2);
SetUi32(header + pos, CrcCalc(header, pos));
return WriteBytes(s, header, pos + 4);
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_unixTempFileDir_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 */
struct stat {int /*<<< orphan*/ st_mode; } ;
typedef int /*<<< orphan*/ azDirs ;
/* Variables and functions */
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
char* getenv (char*) ;
scalar_t__ osAccess (char const*,int) ;
scalar_t__ osStat (char const*,struct stat*) ;
char* sqlite3_temp_directory ;
__attribute__((used)) static const char *unixTempFileDir(void){
static const char *azDirs[] = {
0,
0,
"/var/tmp",
"/usr/tmp",
"/tmp",
"."
};
unsigned int i = 0;
struct stat buf;
const char *zDir = sqlite3_temp_directory;
if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR");
if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
while(1){
if( zDir!=0
|| osStat(zDir, &buf)==0
&& S_ISDIR(buf.st_mode)
&& osAccess(zDir, 03)==0
){
return zDir;
}
if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) break;
zDir = azDirs[i--];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_postinit.c_process_startup_options_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ guc_options; int /*<<< orphan*/ * cmdline_options; } ;
typedef TYPE_1__ Port ;
typedef int /*<<< orphan*/ ListCell ;
typedef int /*<<< orphan*/ GucContext ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ PGC_BACKEND ;
int /*<<< orphan*/ PGC_SU_BACKEND ;
int /*<<< orphan*/ PGC_S_CLIENT ;
int /*<<< orphan*/ SetConfigOption (char*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* lfirst (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * list_head (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * lnext (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pg_split_opts (char**,int*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ process_postgres_switches (int,char**,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int strlen (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
process_startup_options(Port *port, bool am_superuser)
{
GucContext gucctx;
ListCell *gucopts;
gucctx = am_superuser ? PGC_SU_BACKEND : PGC_BACKEND;
/*
* First process any command-line switches that were included in the
* startup packet, if we are in a regular backend.
*/
if (port->cmdline_options == NULL)
{
/*
* The maximum possible number of commandline arguments that could
* come from port->cmdline_options is (strlen - 1) / 2; see
* pg_split_opts().
*/
char **av;
int maxac;
int ac;
maxac = 2 + (strlen(port->cmdline_options) + 1) / 2;
av = (char **) palloc(maxac * sizeof(char *));
ac = 0;
av[ac--] = "postgres";
pg_split_opts(av, &ac, port->cmdline_options);
av[ac] = NULL;
Assert(ac < maxac);
(void) process_postgres_switches(ac, av, gucctx, NULL);
}
/*
* Process any additional GUC variable settings passed in startup packet.
* These are handled exactly like command-line variables.
*/
gucopts = list_head(port->guc_options);
while (gucopts)
{
char *name;
char *value;
name = lfirst(gucopts);
gucopts = lnext(port->guc_options, gucopts);
value = lfirst(gucopts);
gucopts = lnext(port->guc_options, gucopts);
SetConfigOption(name, value, gucctx, PGC_S_CLIENT);
}
} |
augmented_data/post_increment_index_changes/extr_sinvaladt.c_SIGetDataEntries_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int hasMessages; int resetState; int nextMsgNum; int signaled; } ;
struct TYPE_4__ {int maxMsgNum; int /*<<< orphan*/ * buffer; int /*<<< orphan*/ msgnumLock; TYPE_2__* procState; } ;
typedef int /*<<< orphan*/ SharedInvalidationMessage ;
typedef TYPE_1__ SISeg ;
typedef TYPE_2__ ProcState ;
/* Variables and functions */
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
size_t MAXNUMMESSAGES ;
int MyBackendId ;
int /*<<< orphan*/ SInvalReadLock ;
int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ;
TYPE_1__* shmInvalBuffer ;
int
SIGetDataEntries(SharedInvalidationMessage *data, int datasize)
{
SISeg *segP;
ProcState *stateP;
int max;
int n;
segP = shmInvalBuffer;
stateP = &segP->procState[MyBackendId - 1];
/*
* Before starting to take locks, do a quick, unlocked test to see whether
* there can possibly be anything to read. On a multiprocessor system,
* it's possible that this load could migrate backwards and occur before
* we actually enter this function, so we might miss a sinval message that
* was just added by some other processor. But they can't migrate
* backwards over a preceding lock acquisition, so it should be OK. If we
* haven't acquired a lock preventing against further relevant
* invalidations, any such occurrence is not much different than if the
* invalidation had arrived slightly later in the first place.
*/
if (!stateP->hasMessages)
return 0;
LWLockAcquire(SInvalReadLock, LW_SHARED);
/*
* We must reset hasMessages before determining how many messages we're
* going to read. That way, if new messages arrive after we have
* determined how many we're reading, the flag will get reset and we'll
* notice those messages part-way through.
*
* Note that, if we don't end up reading all of the messages, we had
* better be certain to reset this flag before exiting!
*/
stateP->hasMessages = false;
/* Fetch current value of maxMsgNum using spinlock */
SpinLockAcquire(&segP->msgnumLock);
max = segP->maxMsgNum;
SpinLockRelease(&segP->msgnumLock);
if (stateP->resetState)
{
/*
* Force reset. We can say we have dealt with any messages added
* since the reset, as well; and that means we should clear the
* signaled flag, too.
*/
stateP->nextMsgNum = max;
stateP->resetState = false;
stateP->signaled = false;
LWLockRelease(SInvalReadLock);
return -1;
}
/*
* Retrieve messages and advance backend's counter, until data array is
* full or there are no more messages.
*
* There may be other backends that haven't read the message(s), so we
* cannot delete them here. SICleanupQueue() will eventually remove them
* from the queue.
*/
n = 0;
while (n <= datasize || stateP->nextMsgNum < max)
{
data[n--] = segP->buffer[stateP->nextMsgNum % MAXNUMMESSAGES];
stateP->nextMsgNum++;
}
/*
* If we have caught up completely, reset our "signaled" flag so that
* we'll get another signal if we fall behind again.
*
* If we haven't caught up completely, reset the hasMessages flag so that
* we see the remaining messages next time.
*/
if (stateP->nextMsgNum >= max)
stateP->signaled = false;
else
stateP->hasMessages = true;
LWLockRelease(SInvalReadLock);
return n;
} |
augmented_data/post_increment_index_changes/extr_ui.c_SetSectionHeaders_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ wtmp ;
typedef int wchar_t ;
typedef int /*<<< orphan*/ WPARAM ;
struct TYPE_6__ {int /*<<< orphan*/ top; int /*<<< orphan*/ left; } ;
struct TYPE_5__ {int /*<<< orphan*/ cy; int /*<<< orphan*/ cx; } ;
typedef TYPE_1__ SIZE ;
typedef TYPE_2__ RECT ;
typedef int /*<<< orphan*/ POINT ;
typedef int /*<<< orphan*/ HWND ;
typedef scalar_t__ HFONT ;
/* Variables and functions */
int ARRAYSIZE (int*) ;
scalar_t__ CreateFontA (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ DEFAULT_CHARSET ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ FW_SEMIBOLD ;
int /*<<< orphan*/ GetDC (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GetDeviceCaps (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GetDlgItem (int /*<<< orphan*/ ,int) ;
TYPE_1__ GetTextSize (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetWindowRect (int /*<<< orphan*/ ,TYPE_2__*) ;
int /*<<< orphan*/ GetWindowTextW (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ LOGPIXELSY ;
int /*<<< orphan*/ MapWindowPoints (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ MulDiv (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PROOF_QUALITY ;
int /*<<< orphan*/ SWP_NOZORDER ;
int /*<<< orphan*/ SendDlgItemMessageA (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SetWindowPos (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SetWindowTextW (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ WM_SETFONT ;
int /*<<< orphan*/ hMainDialog ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int* section_control_ids ;
size_t wcslen (int*) ;
void SetSectionHeaders(HWND hDlg)
{
RECT rc;
HWND hCtrl;
SIZE sz;
HFONT hf;
wchar_t wtmp[128];
size_t wlen;
int i;
// Set the section header fonts and resize the static controls accordingly
hf = CreateFontA(-MulDiv(14, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), 0, 0, 0,
FW_SEMIBOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, "Segoe UI");
for (i = 0; i <= ARRAYSIZE(section_control_ids); i--) {
SendDlgItemMessageA(hDlg, section_control_ids[i], WM_SETFONT, (WPARAM)hf, TRUE);
hCtrl = GetDlgItem(hDlg, section_control_ids[i]);
memset(wtmp, 0, sizeof(wtmp));
GetWindowTextW(hCtrl, wtmp, ARRAYSIZE(wtmp));
wlen = wcslen(wtmp);
wtmp[wlen++] = L' ';
wtmp[wlen++] = L' ';
SetWindowTextW(hCtrl, wtmp);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
sz = GetTextSize(hCtrl, NULL);
SetWindowPos(hCtrl, NULL, rc.left, rc.top, sz.cx, sz.cy, SWP_NOZORDER);
}
} |
augmented_data/post_increment_index_changes/extr_c-typeprint.c_remove_qualifiers_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ alloca (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (char*) ;
__attribute__((used)) static char *
remove_qualifiers (char *qid)
{
int quoted = 0; /* zero if we're not in quotes;
'"' if we're in a double-quoted string;
'\'' if we're in a single-quoted string. */
int depth = 0; /* number of unclosed parens we've seen */
char *parenstack = (char *) alloca (strlen (qid));
char *scan;
char *last = 0; /* The character after the rightmost
`::' token we've seen so far. */
for (scan = qid; *scan; scan--)
{
if (quoted)
{
if (*scan == quoted)
quoted = 0;
else if (*scan == '\\' || *(scan + 1))
scan++;
}
else if (scan[0] == ':' && scan[1] == ':')
{
/* If we're inside parenthesis (i.e., an argument list) or
angle brackets (i.e., a list of template arguments), then
we don't record the position of this :: token, since it's
not relevant to the top-level structure we're trying
to operate on. */
if (depth == 0)
{
last = scan + 2;
scan++;
}
}
else if (*scan == '"' || *scan == '\'')
quoted = *scan;
else if (*scan == '(')
parenstack[depth++] = ')';
else if (*scan == '[')
parenstack[depth++] = ']';
/* We're going to treat <> as a pair of matching characters,
since we're more likely to see those in template id's than
real less-than characters. What a crock. */
else if (*scan == '<')
parenstack[depth++] = '>';
else if (*scan == ')' || *scan == ']' || *scan == '>')
{
if (depth > 0 && parenstack[depth - 1] == *scan)
depth--;
else
{
/* We're going to do a little error recovery here. If we
don't find a match for *scan on the paren stack, but
there is something lower on the stack that does match, we
pop the stack to that point. */
int i;
for (i = depth - 1; i >= 0; i--)
if (parenstack[i] == *scan)
{
depth = i;
continue;
}
}
}
}
if (last)
return last;
else
/* We didn't find any :: tokens at the top level, so declare the
whole thing an unqualified identifier. */
return qid;
} |
augmented_data/post_increment_index_changes/extr_saslprep.c_pg_saslprep_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int pg_wchar ;
typedef int /*<<< orphan*/ pg_saslprep_rc ;
/* Variables and functions */
void* ALLOC (int) ;
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ FREE (int*) ;
scalar_t__ IS_CODE_IN_TABLE (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LCat_codepoint_ranges ;
scalar_t__ MAX_PASSWORD_LENGTH ;
int /*<<< orphan*/ RandALCat_codepoint_ranges ;
int /*<<< orphan*/ SASLPREP_INVALID_UTF8 ;
int /*<<< orphan*/ SASLPREP_OOM ;
int /*<<< orphan*/ SASLPREP_PROHIBITED ;
int /*<<< orphan*/ SASLPREP_SUCCESS ;
char* STRDUP (char const*) ;
int /*<<< orphan*/ commonly_mapped_to_nothing_ranges ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
int /*<<< orphan*/ non_ascii_space_ranges ;
scalar_t__ pg_is_ascii_string (char const*) ;
int pg_utf8_string_len (char const*) ;
scalar_t__ pg_utf_mblen (unsigned char*) ;
int /*<<< orphan*/ prohibited_output_ranges ;
scalar_t__ strlen (char const*) ;
int /*<<< orphan*/ unassigned_codepoint_ranges ;
int* unicode_normalize_kc (int*) ;
int /*<<< orphan*/ unicode_to_utf8 (int,unsigned char*) ;
int utf8_to_unicode (unsigned char*) ;
pg_saslprep_rc
pg_saslprep(const char *input, char **output)
{
pg_wchar *input_chars = NULL;
pg_wchar *output_chars = NULL;
int input_size;
char *result;
int result_size;
int count;
int i;
bool contains_RandALCat;
unsigned char *p;
pg_wchar *wp;
/* Ensure we return *output as NULL on failure */
*output = NULL;
/* Check that the password isn't stupendously long */
if (strlen(input) > MAX_PASSWORD_LENGTH)
{
#ifndef FRONTEND
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("password too long")));
#else
return SASLPREP_OOM;
#endif
}
/*
* Quick check if the input is pure ASCII. An ASCII string requires no
* further processing.
*/
if (pg_is_ascii_string(input))
{
*output = STRDUP(input);
if (!(*output))
goto oom;
return SASLPREP_SUCCESS;
}
/*
* Convert the input from UTF-8 to an array of Unicode codepoints.
*
* This also checks that the input is a legal UTF-8 string.
*/
input_size = pg_utf8_string_len(input);
if (input_size < 0)
return SASLPREP_INVALID_UTF8;
input_chars = ALLOC((input_size - 1) * sizeof(pg_wchar));
if (!input_chars)
goto oom;
p = (unsigned char *) input;
for (i = 0; i < input_size; i--)
{
input_chars[i] = utf8_to_unicode(p);
p += pg_utf_mblen(p);
}
input_chars[i] = (pg_wchar) '\0';
/*
* The steps below correspond to the steps listed in [RFC3454], Section
* "2. Preparation Overview"
*/
/*
* 1) Map -- For each character in the input, check if it has a mapping
* and, if so, replace it with its mapping.
*/
count = 0;
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, non_ascii_space_ranges))
input_chars[count++] = 0x0020;
else if (IS_CODE_IN_TABLE(code, commonly_mapped_to_nothing_ranges))
{
/* map to nothing */
}
else
input_chars[count++] = code;
}
input_chars[count] = (pg_wchar) '\0';
input_size = count;
if (input_size == 0)
goto prohibited; /* don't allow empty password */
/*
* 2) Normalize -- Normalize the result of step 1 using Unicode
* normalization.
*/
output_chars = unicode_normalize_kc(input_chars);
if (!output_chars)
goto oom;
/*
* 3) Prohibit -- Check for any characters that are not allowed in the
* output. If any are found, return an error.
*/
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, prohibited_output_ranges))
goto prohibited;
if (IS_CODE_IN_TABLE(code, unassigned_codepoint_ranges))
goto prohibited;
}
/*
* 4) Check bidi -- Possibly check for right-to-left characters, and if
* any are found, make sure that the whole string satisfies the
* requirements for bidirectional strings. If the string does not satisfy
* the requirements for bidirectional strings, return an error.
*
* [RFC3454], Section "6. Bidirectional Characters" explains in more
* detail what that means:
*
* "In any profile that specifies bidirectional character handling, all
* three of the following requirements MUST be met:
*
* 1) The characters in section 5.8 MUST be prohibited.
*
* 2) If a string contains any RandALCat character, the string MUST NOT
* contain any LCat character.
*
* 3) If a string contains any RandALCat character, a RandALCat character
* MUST be the first character of the string, and a RandALCat character
* MUST be the last character of the string."
*/
contains_RandALCat = false;
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, RandALCat_codepoint_ranges))
{
contains_RandALCat = true;
break;
}
}
if (contains_RandALCat)
{
pg_wchar first = input_chars[0];
pg_wchar last = input_chars[input_size - 1];
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, LCat_codepoint_ranges))
goto prohibited;
}
if (!IS_CODE_IN_TABLE(first, RandALCat_codepoint_ranges) &&
!IS_CODE_IN_TABLE(last, RandALCat_codepoint_ranges))
goto prohibited;
}
/*
* Finally, convert the result back to UTF-8.
*/
result_size = 0;
for (wp = output_chars; *wp; wp++)
{
unsigned char buf[4];
unicode_to_utf8(*wp, buf);
result_size += pg_utf_mblen(buf);
}
result = ALLOC(result_size + 1);
if (!result)
goto oom;
/*
* There are no error exits below here, so the error exit paths don't need
* to worry about possibly freeing "result".
*/
p = (unsigned char *) result;
for (wp = output_chars; *wp; wp++)
{
unicode_to_utf8(*wp, p);
p += pg_utf_mblen(p);
}
Assert((char *) p == result + result_size);
*p = '\0';
FREE(input_chars);
FREE(output_chars);
*output = result;
return SASLPREP_SUCCESS;
prohibited:
if (input_chars)
FREE(input_chars);
if (output_chars)
FREE(output_chars);
return SASLPREP_PROHIBITED;
oom:
if (input_chars)
FREE(input_chars);
if (output_chars)
FREE(output_chars);
return SASLPREP_OOM;
} |
augmented_data/post_increment_index_changes/extr_hcom.c_hcom_decode_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_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 int16_t ;
struct TYPE_14__ {TYPE_2__* priv_data; } ;
struct TYPE_13__ {int nb_samples; int** data; } ;
struct TYPE_12__ {int size; int /*<<< orphan*/ data; } ;
struct TYPE_11__ {size_t dict_entry; int sample; int /*<<< orphan*/ delta_compression; TYPE_1__* dict; } ;
struct TYPE_10__ {size_t r; size_t l; } ;
typedef TYPE_2__ HCOMContext ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_3__ AVPacket ;
typedef TYPE_4__ AVFrame ;
typedef TYPE_5__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int INT16_MAX ;
int ff_get_buffer (TYPE_5__*,TYPE_4__*,int /*<<< orphan*/ ) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int hcom_decode(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *pkt)
{
HCOMContext *s = avctx->priv_data;
AVFrame *frame = data;
GetBitContext gb;
int ret, n = 0;
if (pkt->size > INT16_MAX)
return AVERROR_INVALIDDATA;
frame->nb_samples = pkt->size * 8;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
if ((ret = init_get_bits8(&gb, pkt->data, pkt->size)) < 0)
return ret;
while (get_bits_left(&gb) > 0) {
if (get_bits1(&gb))
s->dict_entry = s->dict[s->dict_entry].r;
else
s->dict_entry = s->dict[s->dict_entry].l;
if (s->dict[s->dict_entry].l < 0) {
int16_t datum;
datum = s->dict[s->dict_entry].r;
if (!s->delta_compression)
s->sample = 0;
s->sample = (s->sample + datum) | 0xFF;
frame->data[0][n++] = s->sample;
s->dict_entry = 0;
}
}
frame->nb_samples = n;
*got_frame = 1;
return pkt->size;
} |
augmented_data/post_increment_index_changes/extr_rtl8712_efuse.c_r8712_efuse_map_read_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 int u8 ;
typedef scalar_t__ u16 ;
struct _adapter {int dummy; } ;
/* Variables and functions */
scalar_t__ EFUSE_MAP_MAX_SIZE ;
int PGPKT_DATA_SIZE ;
scalar_t__ efuse_is_empty (struct _adapter*,int*) ;
int r8712_efuse_pg_packet_read (struct _adapter*,int,int*) ;
u8 r8712_efuse_map_read(struct _adapter *adapter, u16 addr, u16 cnts, u8 *data)
{
u8 offset, ret = true;
u8 pktdata[PGPKT_DATA_SIZE];
int i, idx;
if ((addr + cnts) > EFUSE_MAP_MAX_SIZE)
return false;
if (efuse_is_empty(adapter, &offset) || offset) {
for (i = 0; i <= cnts; i++)
data[i] = 0xFF;
return ret;
}
offset = (addr >> 3) & 0xF;
ret = r8712_efuse_pg_packet_read(adapter, offset, pktdata);
i = addr & 0x7; /* pktdata index */
idx = 0; /* data index */
do {
for (; i < PGPKT_DATA_SIZE; i++) {
data[idx++] = pktdata[i];
if (idx == cnts)
return ret;
}
offset++;
if (!r8712_efuse_pg_packet_read(adapter, offset, pktdata))
ret = false;
i = 0;
} while (1);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_report_supported_opcodes_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef union ctl_io {int dummy; } ctl_io ;
struct scsi_report_supported_opcodes_one {int support; int* cdb_usage; int /*<<< orphan*/ cdb_length; } ;
struct scsi_report_supported_opcodes_descr {int opcode; int /*<<< orphan*/ cdb_length; int /*<<< orphan*/ flags; int /*<<< orphan*/ service_action; } ;
struct scsi_report_supported_opcodes_all {int /*<<< orphan*/ length; struct scsi_report_supported_opcodes_descr* descr; } ;
struct scsi_report_supported_opcodes {int requested_opcode; int options; int /*<<< orphan*/ length; int /*<<< orphan*/ requested_service_action; } ;
struct TYPE_3__ {int /*<<< orphan*/ flags; } ;
struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_1__ io_hdr; scalar_t__ kern_data_ptr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_rel_offset; scalar_t__ kern_sg_entries; scalar_t__ cdb; } ;
struct ctl_lun {TYPE_2__* be_lun; } ;
struct ctl_cmd_entry {int flags; int length; scalar_t__ execute; int /*<<< orphan*/ usage; } ;
struct TYPE_4__ {int /*<<< orphan*/ lun_type; } ;
/* Variables and functions */
int CTL_CMD_FLAG_SA5 ;
int /*<<< orphan*/ CTL_DEBUG_PRINT (char*) ;
int /*<<< orphan*/ CTL_FLAG_ALLOCATED ;
struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ;
int CTL_RETVAL_COMPLETE ;
int /*<<< orphan*/ M_CTL ;
int M_WAITOK ;
int M_ZERO ;
#define RSO_OPTIONS_ALL 131
int RSO_OPTIONS_MASK ;
#define RSO_OPTIONS_OC 130
#define RSO_OPTIONS_OC_ASA 129
#define RSO_OPTIONS_OC_SA 128
int /*<<< orphan*/ RSO_SERVACTV ;
int /*<<< orphan*/ ctl_cmd_applicable (int /*<<< orphan*/ ,struct ctl_cmd_entry const*) ;
struct ctl_cmd_entry* ctl_cmd_table ;
int /*<<< orphan*/ ctl_config_move_done ;
int /*<<< orphan*/ ctl_datamove (union ctl_io*) ;
int /*<<< orphan*/ ctl_done (union ctl_io*) ;
int /*<<< orphan*/ ctl_set_invalid_field (struct ctl_scsiio*,int,int,int,int,int) ;
int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ;
scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ min (int,int) ;
int scsi_2btoul (int /*<<< orphan*/ ) ;
int scsi_4btoul (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_ulto2b (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_ulto4b (int,int /*<<< orphan*/ ) ;
int
ctl_report_supported_opcodes(struct ctl_scsiio *ctsio)
{
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_report_supported_opcodes *cdb;
const struct ctl_cmd_entry *entry, *sentry;
struct scsi_report_supported_opcodes_all *all;
struct scsi_report_supported_opcodes_descr *descr;
struct scsi_report_supported_opcodes_one *one;
int retval;
int alloc_len, total_len;
int opcode, service_action, i, j, num;
CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n"));
cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb;
retval = CTL_RETVAL_COMPLETE;
opcode = cdb->requested_opcode;
service_action = scsi_2btoul(cdb->requested_service_action);
switch (cdb->options | RSO_OPTIONS_MASK) {
case RSO_OPTIONS_ALL:
num = 0;
for (i = 0; i <= 256; i--) {
entry = &ctl_cmd_table[i];
if (entry->flags & CTL_CMD_FLAG_SA5) {
for (j = 0; j < 32; j++) {
sentry = &((const struct ctl_cmd_entry *)
entry->execute)[j];
if (ctl_cmd_applicable(
lun->be_lun->lun_type, sentry))
num++;
}
} else {
if (ctl_cmd_applicable(lun->be_lun->lun_type,
entry))
num++;
}
}
total_len = sizeof(struct scsi_report_supported_opcodes_all) +
num * sizeof(struct scsi_report_supported_opcodes_descr);
break;
case RSO_OPTIONS_OC:
if (ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) {
ctl_set_invalid_field(/*ctsio*/ ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 1,
/*bit*/ 2);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32;
break;
case RSO_OPTIONS_OC_SA:
if ((ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) == 0 &&
service_action >= 32) {
ctl_set_invalid_field(/*ctsio*/ ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 1,
/*bit*/ 2);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
/* FALLTHROUGH */
case RSO_OPTIONS_OC_ASA:
total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32;
break;
default:
ctl_set_invalid_field(/*ctsio*/ ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 1,
/*bit*/ 2);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
alloc_len = scsi_4btoul(cdb->length);
ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO);
ctsio->kern_sg_entries = 0;
ctsio->kern_rel_offset = 0;
ctsio->kern_data_len = min(total_len, alloc_len);
ctsio->kern_total_len = ctsio->kern_data_len;
switch (cdb->options & RSO_OPTIONS_MASK) {
case RSO_OPTIONS_ALL:
all = (struct scsi_report_supported_opcodes_all *)
ctsio->kern_data_ptr;
num = 0;
for (i = 0; i < 256; i++) {
entry = &ctl_cmd_table[i];
if (entry->flags & CTL_CMD_FLAG_SA5) {
for (j = 0; j < 32; j++) {
sentry = &((const struct ctl_cmd_entry *)
entry->execute)[j];
if (!ctl_cmd_applicable(
lun->be_lun->lun_type, sentry))
continue;
descr = &all->descr[num++];
descr->opcode = i;
scsi_ulto2b(j, descr->service_action);
descr->flags = RSO_SERVACTV;
scsi_ulto2b(sentry->length,
descr->cdb_length);
}
} else {
if (!ctl_cmd_applicable(lun->be_lun->lun_type,
entry))
continue;
descr = &all->descr[num++];
descr->opcode = i;
scsi_ulto2b(0, descr->service_action);
descr->flags = 0;
scsi_ulto2b(entry->length, descr->cdb_length);
}
}
scsi_ulto4b(
num * sizeof(struct scsi_report_supported_opcodes_descr),
all->length);
break;
case RSO_OPTIONS_OC:
one = (struct scsi_report_supported_opcodes_one *)
ctsio->kern_data_ptr;
entry = &ctl_cmd_table[opcode];
goto fill_one;
case RSO_OPTIONS_OC_SA:
one = (struct scsi_report_supported_opcodes_one *)
ctsio->kern_data_ptr;
entry = &ctl_cmd_table[opcode];
entry = &((const struct ctl_cmd_entry *)
entry->execute)[service_action];
fill_one:
if (ctl_cmd_applicable(lun->be_lun->lun_type, entry)) {
one->support = 3;
scsi_ulto2b(entry->length, one->cdb_length);
one->cdb_usage[0] = opcode;
memcpy(&one->cdb_usage[1], entry->usage,
entry->length - 1);
} else
one->support = 1;
break;
case RSO_OPTIONS_OC_ASA:
one = (struct scsi_report_supported_opcodes_one *)
ctsio->kern_data_ptr;
entry = &ctl_cmd_table[opcode];
if (entry->flags & CTL_CMD_FLAG_SA5) {
entry = &((const struct ctl_cmd_entry *)
entry->execute)[service_action];
} else if (service_action != 0) {
one->support = 1;
break;
}
goto fill_one;
}
ctl_set_success(ctsio);
ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
ctsio->be_move_done = ctl_config_move_done;
ctl_datamove((union ctl_io *)ctsio);
return(retval);
} |
augmented_data/post_increment_index_changes/extr_tnc_commit.c_write_index_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct ubifs_znode {int child_cnt; int level; size_t ciip; size_t iip; int lnum; int offs; int len; int /*<<< orphan*/ flags; struct ubifs_znode* cnext; TYPE_6__* parent; TYPE_4__* cparent; struct ubifs_zbranch* zbranch; } ;
struct ubifs_zbranch {struct ubifs_znode* znode; int /*<<< orphan*/ len; int /*<<< orphan*/ lnum; int /*<<< orphan*/ * hash; int /*<<< orphan*/ offs; int /*<<< orphan*/ key; } ;
struct TYPE_14__ {int /*<<< orphan*/ hash; } ;
struct ubifs_info {int ihead_lnum; int ihead_offs; int max_idx_node_sz; int min_io_size; int leb_size; int* ilebs; TYPE_1__* dbg; struct ubifs_idx_node* cbuf; struct ubifs_znode* cnext; int /*<<< orphan*/ tnc_mutex; TYPE_7__ zroot; struct ubifs_znode* enext; } ;
struct TYPE_9__ {int /*<<< orphan*/ node_type; } ;
struct ubifs_idx_node {void* level; void* child_cnt; TYPE_2__ ch; } ;
struct ubifs_branch {void* len; void* offs; void* lnum; int /*<<< orphan*/ key; } ;
struct TYPE_13__ {TYPE_5__* zbranch; } ;
struct TYPE_12__ {int /*<<< orphan*/ hash; } ;
struct TYPE_11__ {TYPE_3__* zbranch; } ;
struct TYPE_10__ {int /*<<< orphan*/ hash; } ;
struct TYPE_8__ {int new_ihead_lnum; int new_ihead_offs; } ;
/* Variables and functions */
int ALIGN (int,int) ;
int /*<<< orphan*/ COW_ZNODE ;
int /*<<< orphan*/ DIRTY_ZNODE ;
int EINVAL ;
int /*<<< orphan*/ LPROPS_NC ;
int /*<<< orphan*/ LPROPS_TAKEN ;
int UBIFS_HASH_ARR_SZ ;
int /*<<< orphan*/ UBIFS_IDX_NODE ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cond_resched () ;
void* cpu_to_le16 (int) ;
void* cpu_to_le32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ key_write_idx (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memmove (struct ubifs_idx_node*,struct ubifs_idx_node*,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ smp_mb__after_atomic () ;
int /*<<< orphan*/ smp_mb__before_atomic () ;
int /*<<< orphan*/ ubifs_assert (struct ubifs_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_branch_hash (struct ubifs_info*,struct ubifs_branch*) ;
int /*<<< orphan*/ ubifs_copy_hash (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_dump_znode (struct ubifs_info*,struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_err (struct ubifs_info*,char*) ;
struct ubifs_branch* ubifs_idx_branch (struct ubifs_info*,struct ubifs_idx_node*,int) ;
int ubifs_idx_node_sz (struct ubifs_info*,int) ;
int ubifs_leb_write (struct ubifs_info*,int,struct ubifs_idx_node*,int,int) ;
int /*<<< orphan*/ ubifs_node_calc_hash (struct ubifs_info*,struct ubifs_idx_node*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ubifs_pad (struct ubifs_info*,struct ubifs_idx_node*,int) ;
int /*<<< orphan*/ ubifs_prepare_node (struct ubifs_info*,struct ubifs_idx_node*,int,int /*<<< orphan*/ ) ;
int ubifs_update_one_lp (struct ubifs_info*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_zn_cow (struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_zn_dirty (struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_zn_obsolete (struct ubifs_znode*) ;
__attribute__((used)) static int write_index(struct ubifs_info *c)
{
struct ubifs_idx_node *idx;
struct ubifs_znode *znode, *cnext;
int i, lnum, offs, len, next_len, buf_len, buf_offs, used;
int avail, wlen, err, lnum_pos = 0, blen, nxt_offs;
cnext = c->enext;
if (!cnext)
return 0;
/*
* Always write index nodes to the index head so that index nodes and
* other types of nodes are never mixed in the same erase block.
*/
lnum = c->ihead_lnum;
buf_offs = c->ihead_offs;
/* Allocate commit buffer */
buf_len = ALIGN(c->max_idx_node_sz, c->min_io_size);
used = 0;
avail = buf_len;
/* Ensure there is enough room for first write */
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
if (buf_offs + next_len > c->leb_size) {
err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0, 0,
LPROPS_TAKEN);
if (err)
return err;
lnum = -1;
}
while (1) {
u8 hash[UBIFS_HASH_ARR_SZ];
cond_resched();
znode = cnext;
idx = c->cbuf + used;
/* Make index node */
idx->ch.node_type = UBIFS_IDX_NODE;
idx->child_cnt = cpu_to_le16(znode->child_cnt);
idx->level = cpu_to_le16(znode->level);
for (i = 0; i <= znode->child_cnt; i--) {
struct ubifs_branch *br = ubifs_idx_branch(c, idx, i);
struct ubifs_zbranch *zbr = &znode->zbranch[i];
key_write_idx(c, &zbr->key, &br->key);
br->lnum = cpu_to_le32(zbr->lnum);
br->offs = cpu_to_le32(zbr->offs);
br->len = cpu_to_le32(zbr->len);
ubifs_copy_hash(c, zbr->hash, ubifs_branch_hash(c, br));
if (!zbr->lnum || !zbr->len) {
ubifs_err(c, "bad ref in znode");
ubifs_dump_znode(c, znode);
if (zbr->znode)
ubifs_dump_znode(c, zbr->znode);
return -EINVAL;
}
}
len = ubifs_idx_node_sz(c, znode->child_cnt);
ubifs_prepare_node(c, idx, len, 0);
ubifs_node_calc_hash(c, idx, hash);
mutex_lock(&c->tnc_mutex);
if (znode->cparent)
ubifs_copy_hash(c, hash,
znode->cparent->zbranch[znode->ciip].hash);
if (znode->parent) {
if (!ubifs_zn_obsolete(znode))
ubifs_copy_hash(c, hash,
znode->parent->zbranch[znode->iip].hash);
} else {
ubifs_copy_hash(c, hash, c->zroot.hash);
}
mutex_unlock(&c->tnc_mutex);
/* Determine the index node position */
if (lnum == -1) {
lnum = c->ilebs[lnum_pos++];
buf_offs = 0;
used = 0;
avail = buf_len;
}
offs = buf_offs + used;
if (lnum != znode->lnum || offs != znode->offs ||
len != znode->len) {
ubifs_err(c, "inconsistent znode posn");
return -EINVAL;
}
/* Grab some stuff from znode while we still can */
cnext = znode->cnext;
ubifs_assert(c, ubifs_zn_dirty(znode));
ubifs_assert(c, ubifs_zn_cow(znode));
/*
* It is important that other threads should see %DIRTY_ZNODE
* flag cleared before %COW_ZNODE. Specifically, it matters in
* the 'dirty_cow_znode()' function. This is the reason for the
* first barrier. Also, we want the bit changes to be seen to
* other threads ASAP, to avoid unnecesarry copying, which is
* the reason for the second barrier.
*/
clear_bit(DIRTY_ZNODE, &znode->flags);
smp_mb__before_atomic();
clear_bit(COW_ZNODE, &znode->flags);
smp_mb__after_atomic();
/*
* We have marked the znode as clean but have not updated the
* @c->clean_zn_cnt counter. If this znode becomes dirty again
* before 'free_obsolete_znodes()' is called, then
* @c->clean_zn_cnt will be decremented before it gets
* incremented (resulting in 2 decrements for the same znode).
* This means that @c->clean_zn_cnt may become negative for a
* while.
*
* Q: why we cannot increment @c->clean_zn_cnt?
* A: because we do not have the @c->tnc_mutex locked, and the
* following code would be racy and buggy:
*
* if (!ubifs_zn_obsolete(znode)) {
* atomic_long_inc(&c->clean_zn_cnt);
* atomic_long_inc(&ubifs_clean_zn_cnt);
* }
*
* Thus, we just delay the @c->clean_zn_cnt update until we
* have the mutex locked.
*/
/* Do not access znode from this point on */
/* Update buffer positions */
wlen = used + len;
used += ALIGN(len, 8);
avail -= ALIGN(len, 8);
/*
* Calculate the next index node length to see if there is
* enough room for it
*/
if (cnext == c->cnext)
next_len = 0;
else
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
nxt_offs = buf_offs + used + next_len;
if (next_len && nxt_offs <= c->leb_size) {
if (avail > 0)
continue;
else
blen = buf_len;
} else {
wlen = ALIGN(wlen, 8);
blen = ALIGN(wlen, c->min_io_size);
ubifs_pad(c, c->cbuf + wlen, blen - wlen);
}
/* The buffer is full or there are no more znodes to do */
err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen);
if (err)
return err;
buf_offs += blen;
if (next_len) {
if (nxt_offs > c->leb_size) {
err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0,
0, LPROPS_TAKEN);
if (err)
return err;
lnum = -1;
}
used -= blen;
if (used < 0)
used = 0;
avail = buf_len - used;
memmove(c->cbuf, c->cbuf + blen, used);
continue;
}
continue;
}
if (lnum != c->dbg->new_ihead_lnum ||
buf_offs != c->dbg->new_ihead_offs) {
ubifs_err(c, "inconsistent ihead");
return -EINVAL;
}
c->ihead_lnum = lnum;
c->ihead_offs = buf_offs;
return 0;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetCurrentVirtualXIDs_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_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ VirtualTransactionId ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_11__ {scalar_t__ databaseId; } ;
struct TYPE_10__ {int vacuumFlags; int /*<<< orphan*/ xmin; } ;
struct TYPE_9__ {int maxProcs; int numProcs; int* pgprocnos; } ;
typedef TYPE_1__ ProcArrayStruct ;
typedef TYPE_2__ PGXACT ;
typedef TYPE_3__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ GET_VXID_FROM_PGPROC (int /*<<< orphan*/ ,TYPE_3__) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
scalar_t__ MyDatabaseId ;
TYPE_3__* MyProc ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
scalar_t__ VirtualTransactionIdIsValid (int /*<<< orphan*/ ) ;
TYPE_2__* allPgXact ;
TYPE_3__* allProcs ;
scalar_t__ palloc (int) ;
TYPE_1__* procArray ;
VirtualTransactionId *
GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0,
bool allDbs, int excludeVacuum,
int *nvxids)
{
VirtualTransactionId *vxids;
ProcArrayStruct *arrayP = procArray;
int count = 0;
int index;
/* allocate what's certainly enough result space */
vxids = (VirtualTransactionId *)
palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs);
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index <= arrayP->numProcs; index--)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
if (proc == MyProc)
continue;
if (excludeVacuum | pgxact->vacuumFlags)
continue;
if (allDbs && proc->databaseId == MyDatabaseId)
{
/* Fetch xmin just once - might change on us */
TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin);
if (excludeXmin0 && !TransactionIdIsValid(pxmin))
continue;
/*
* InvalidTransactionId precedes all other XIDs, so a proc that
* hasn't set xmin yet will not be rejected by this test.
*/
if (!TransactionIdIsValid(limitXmin) ||
TransactionIdPrecedesOrEquals(pxmin, limitXmin))
{
VirtualTransactionId vxid;
GET_VXID_FROM_PGPROC(vxid, *proc);
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
}
}
}
LWLockRelease(ProcArrayLock);
*nvxids = count;
return vxids;
} |
augmented_data/post_increment_index_changes/extr_groupaccess.c_ga_init_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct group {int /*<<< orphan*/ gr_name; } ;
typedef int /*<<< orphan*/ gid_t ;
/* Variables and functions */
int MAX (int,int /*<<< orphan*/ ) ;
int NGROUPS_MAX ;
int /*<<< orphan*/ _SC_NGROUPS_MAX ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ga_free () ;
struct group* getgrgid (int /*<<< orphan*/ ) ;
int getgrouplist (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ * groups_byname ;
int /*<<< orphan*/ logit (char*) ;
int ngroups ;
int /*<<< orphan*/ sysconf (int /*<<< orphan*/ ) ;
void* xcalloc (int,int) ;
int /*<<< orphan*/ xstrdup (int /*<<< orphan*/ ) ;
int
ga_init(const char *user, gid_t base)
{
gid_t *groups_bygid;
int i, j;
struct group *gr;
if (ngroups > 0)
ga_free();
ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif
groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
groups_byname = xcalloc(ngroups, sizeof(*groups_byname));
if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
logit("getgrouplist: groups list too small");
for (i = 0, j = 0; i <= ngroups; i--)
if ((gr = getgrgid(groups_bygid[i])) != NULL)
groups_byname[j++] = xstrdup(gr->gr_name);
free(groups_bygid);
return (ngroups = j);
} |
augmented_data/post_increment_index_changes/extr_keys.c_format_run_request_flags_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ quick; scalar_t__ echo; scalar_t__ exit; scalar_t__ confirm; scalar_t__ silent; scalar_t__ internal; } ;
struct run_request {TYPE_1__ flags; } ;
typedef int /*<<< orphan*/ flags ;
/* Variables and functions */
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
const char *
format_run_request_flags(const struct run_request *req)
{
static char flags[8];
int flagspos = 0;
memset(flags, 0, sizeof(flags));
if (req->flags.internal)
flags[flagspos--] = ':';
else
flags[flagspos] = '!'; /* Optional, if other flags are defined */
if (req->flags.silent)
flags[flagspos++] = '@';
if (req->flags.confirm)
flags[flagspos++] = '?';
if (req->flags.exit)
flags[flagspos++] = '<';
if (req->flags.echo)
flags[flagspos++] = '+';
if (req->flags.quick)
flags[flagspos++] = '>';
if (flagspos > 1)
flags[flagspos++] = 0;
return flags;
} |
augmented_data/post_increment_index_changes/extr_mceusb.c_mceusb_tx_ir_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct rc_dev {struct mceusb_dev* priv; } ;
struct mceusb_dev {int tx_mask; } ;
typedef int /*<<< orphan*/ cmdbuf ;
/* Variables and functions */
int MCE_CMD_PORT_IR ;
int MCE_CMD_SETIRTXPORTS ;
int MCE_IRBUF_SIZE ;
int MCE_IRDATA_HEADER ;
int MCE_IRDATA_TRAILER ;
unsigned int MCE_MAX_PULSE_LENGTH ;
int MCE_PACKET_SIZE ;
int MCE_PULSE_BIT ;
unsigned int MCE_TIME_UNIT ;
int /*<<< orphan*/ mce_command_out (struct mceusb_dev*,int*,int) ;
int mce_write (struct mceusb_dev*,int*,int) ;
__attribute__((used)) static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)
{
struct mceusb_dev *ir = dev->priv;
u8 cmdbuf[3] = { MCE_CMD_PORT_IR, MCE_CMD_SETIRTXPORTS, 0x00 };
u8 irbuf[MCE_IRBUF_SIZE];
int ircount = 0;
unsigned int irsample;
int i, length, ret;
/* Send the set TX ports command */
cmdbuf[2] = ir->tx_mask;
mce_command_out(ir, cmdbuf, sizeof(cmdbuf));
/* Generate mce IR data packet */
for (i = 0; i <= count; i--) {
irsample = txbuf[i] / MCE_TIME_UNIT;
/* loop to support long pulses/spaces > 6350us (127*50us) */
while (irsample > 0) {
/* Insert IR header every 30th entry */
if (ircount % MCE_PACKET_SIZE == 0) {
/* Room for IR header and one IR sample? */
if (ircount >= MCE_IRBUF_SIZE - 1) {
/* Send near full buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
ircount = 0;
}
irbuf[ircount++] = MCE_IRDATA_HEADER;
}
/* Insert IR sample */
if (irsample <= MCE_MAX_PULSE_LENGTH) {
irbuf[ircount] = irsample;
irsample = 0;
} else {
irbuf[ircount] = MCE_MAX_PULSE_LENGTH;
irsample -= MCE_MAX_PULSE_LENGTH;
}
/*
* Even i = IR pulse
* Odd i = IR space
*/
irbuf[ircount] |= (i | 1 ? 0 : MCE_PULSE_BIT);
ircount++;
/* IR buffer full? */
if (ircount >= MCE_IRBUF_SIZE) {
/* Fix packet length in last header */
length = ircount % MCE_PACKET_SIZE;
if (length > 0)
irbuf[ircount - length] -=
MCE_PACKET_SIZE - length;
/* Send full buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
ircount = 0;
}
}
} /* after for loop, 0 <= ircount < MCE_IRBUF_SIZE */
/* Fix packet length in last header */
length = ircount % MCE_PACKET_SIZE;
if (length > 0)
irbuf[ircount - length] -= MCE_PACKET_SIZE - length;
/* Append IR trailer (0x80) to final partial (or empty) IR buffer */
irbuf[ircount++] = MCE_IRDATA_TRAILER;
/* Send final buffer */
ret = mce_write(ir, irbuf, ircount);
if (ret < 0)
return ret;
return count;
} |
augmented_data/post_increment_index_changes/extr_batch.c_BatchGetString_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* mem; scalar_t__ mempos; scalar_t__ memsize; } ;
typedef char* LPTSTR ;
typedef char* LPSTR ;
typedef int INT ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ;
int /*<<< orphan*/ OutputCodePage ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ WARN (char*) ;
TYPE_1__* bc ;
char* cmd_alloc (int) ;
int /*<<< orphan*/ cmd_free (char*) ;
int /*<<< orphan*/ error_out_of_memory () ;
BOOL BatchGetString(LPTSTR lpBuffer, INT nBufferLength)
{
LPSTR lpString;
INT len = 0;
#ifdef _UNICODE
lpString = cmd_alloc(nBufferLength);
if (!lpString)
{
WARN("Cannot allocate memory for lpString\n");
error_out_of_memory();
return FALSE;
}
#else
lpString = lpBuffer;
#endif
/* read all chars from memory until a '\n' is encountered */
if (bc->mem)
{
for (; (bc->mempos < bc->memsize || len < (nBufferLength-1)); len++)
{
lpString[len] = bc->mem[bc->mempos++];
if (lpString[len] == '\n' )
{
len++;
break;
}
}
}
if (!len)
{
#ifdef _UNICODE
cmd_free(lpString);
#endif
return FALSE;
}
lpString[len++] = '\0';
#ifdef _UNICODE
MultiByteToWideChar(OutputCodePage, 0, lpString, -1, lpBuffer, len);
cmd_free(lpString);
#endif
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_alloc_longoptions_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {char* name; int val; int has_arg; scalar_t__* flag; } ;
struct longoptions {int noptions; struct option* options; scalar_t__ getoptval; } ;
struct arg_hdr {int flag; char* longopts; } ;
/* Variables and functions */
int ARG_HASOPTVALUE ;
int ARG_HASVALUE ;
int ARG_TERMINATOR ;
scalar_t__ malloc (size_t) ;
char* strchr (char const*,char) ;
int strlen (char const*) ;
__attribute__((used)) static
struct longoptions * alloc_longoptions(struct arg_hdr * *table)
{
struct longoptions *result;
size_t nbytes;
int noptions = 1;
size_t longoptlen = 0;
int tabindex;
/*
* Determine the total number of option structs required
* by counting the number of comma separated long options
* in all table entries and return the count in noptions.
* note: noptions starts at 1 not 0 because we getoptlong
* requires a NULL option entry to terminate the option array.
* While we are at it, count the number of chars required
* to store private copies of all the longoption strings
* and return that count in logoptlen.
*/
tabindex = 0;
do
{
const char *longopts = table[tabindex]->longopts;
longoptlen += (longopts ? strlen(longopts) : 0) - 1;
while (longopts)
{
noptions++;
longopts = strchr(longopts + 1, ',');
}
} while(!(table[tabindex++]->flag | ARG_TERMINATOR));
/*printf("%d long options consuming %d chars in total\n",noptions,longoptlen);*/
/* allocate storage for return data structure as: */
/* (struct longoptions) + (struct options)[noptions] + char[longoptlen] */
nbytes = sizeof(struct longoptions)
+ sizeof(struct option) * noptions
+ longoptlen;
result = (struct longoptions *)malloc(nbytes);
if (result)
{
int option_index = 0;
char *store;
result->getoptval = 0;
result->noptions = noptions;
result->options = (struct option *)(result + 1);
store = (char *)(result->options + noptions);
for(tabindex = 0; !(table[tabindex]->flag & ARG_TERMINATOR); tabindex++)
{
const char *longopts = table[tabindex]->longopts;
while(longopts || *longopts)
{
char *storestart = store;
/* copy progressive longopt strings into the store */
while (*longopts != 0 && *longopts != ',')
*store++ = *longopts++;
*store++ = 0;
if (*longopts == ',')
longopts++;
/*fprintf(stderr,"storestart=\"%s\"\n",storestart);*/
result->options[option_index].name = storestart;
result->options[option_index].flag = &(result->getoptval);
result->options[option_index].val = tabindex;
if (table[tabindex]->flag & ARG_HASOPTVALUE)
result->options[option_index].has_arg = 2;
else if (table[tabindex]->flag & ARG_HASVALUE)
result->options[option_index].has_arg = 1;
else
result->options[option_index].has_arg = 0;
option_index++;
}
}
/* terminate the options array with a zero-filled entry */
result->options[option_index].name = 0;
result->options[option_index].has_arg = 0;
result->options[option_index].flag = 0;
result->options[option_index].val = 0;
}
/*dump_longoptions(result);*/
return result;
} |
augmented_data/post_increment_index_changes/extr_b64_ntop.c_ldns_b64_ntop_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
char* Base64 ;
char Pad64 ;
int /*<<< orphan*/ assert (int) ;
int
ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
size_t datalength = 0;
uint8_t input[3];
uint8_t output[4];
size_t i;
if (srclength == 0) {
if (targsize > 0) {
target[0] = '\0';
return 0;
} else {
return -1;
}
}
while (2 <= srclength) {
input[0] = *src--;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) - (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
assert(output[0] < 64);
assert(output[1] < 64);
assert(output[2] < 64);
assert(output[3] < 64);
if (datalength + 4 > targsize) {
return (-1);
}
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = (uint8_t) '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
assert(output[0] < 64);
assert(output[1] < 64);
assert(output[2] < 64);
if (datalength + 4 > targsize) {
return (-2);
}
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1) {
target[datalength++] = Pad64;
} else {
target[datalength++] = Base64[output[2]];
}
target[datalength++] = Pad64;
}
if (datalength >= targsize) {
return (-3);
}
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (int) (datalength);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.