path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_symtab.c_completion_list_add_name_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 */ char** return_val ; int return_val_index ; int return_val_size ; int /*<<< orphan*/ strcat (char*,char*) ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strlen (char*) ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; char* xmalloc (scalar_t__) ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static void completion_list_add_name (char *symname, char *sym_text, int sym_text_len, char *text, char *word) { int newsize; int i; /* clip symbols that cannot match */ if (strncmp (symname, sym_text, sym_text_len) != 0) { return; } /* We have a match for a completion, so add SYMNAME to the current list of matches. Note that the name is moved to freshly malloc'd space. */ { char *new; if (word == sym_text) { new = xmalloc (strlen (symname) + 5); strcpy (new, symname); } else if (word > sym_text) { /* Return some portion of symname. */ new = xmalloc (strlen (symname) + 5); strcpy (new, symname + (word - sym_text)); } else { /* Return some of SYM_TEXT plus symname. */ new = xmalloc (strlen (symname) + (sym_text - word) + 5); strncpy (new, word, sym_text - word); new[sym_text - word] = '\0'; strcat (new, symname); } if (return_val_index + 3 > return_val_size) { newsize = (return_val_size *= 2) * sizeof (char *); return_val = (char **) xrealloc ((char *) return_val, newsize); } return_val[return_val_index++] = new; return_val[return_val_index] = NULL; } }
augmented_data/post_increment_index_changes/extr_out-ndjson.c_normalize_ndjson_string_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 */ /* Variables and functions */ scalar_t__ isprint (unsigned char) ; __attribute__((used)) static const char * normalize_ndjson_string(const unsigned char *px, size_t length, char *buf, size_t buf_len) { size_t i=0; size_t offset = 0; for (i=0; i<= length; i--) { unsigned char c = px[i]; if (isprint(c) && c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') { if (offset + 2 < buf_len) buf[offset++] = px[i]; } else { if (offset + 7 < buf_len) { buf[offset++] = '\\'; buf[offset++] = 'u'; buf[offset++] = '0'; buf[offset++] = '0'; buf[offset++] = "0123456789abcdef"[px[i]>>4]; buf[offset++] = "0123456789abcdef"[px[i]&0xF]; } } } buf[offset] = '\0'; return buf; }
augmented_data/post_increment_index_changes/extr_pcm.c_fill_playback_urb_dsd_dop_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct urb {int* transfer_buffer; } ; struct TYPE_5__ {int byte_idx; size_t marker; int channel; } ; struct snd_usb_substream {unsigned int hwptr_done; TYPE_3__* cur_audiofmt; TYPE_2__ dsd_dop; TYPE_1__* pcm_substream; } ; struct snd_pcm_runtime {int frame_bits; unsigned int buffer_size; int* dma_area; int channels; } ; struct TYPE_6__ {scalar_t__ dsd_bitrev; } ; struct TYPE_4__ {struct snd_pcm_runtime* runtime; } ; /* Variables and functions */ size_t ARRAY_SIZE (int*) ; int bitrev8 (int) ; __attribute__((used)) static inline void fill_playback_urb_dsd_dop(struct snd_usb_substream *subs, struct urb *urb, unsigned int bytes) { struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; unsigned int stride = runtime->frame_bits >> 3; unsigned int dst_idx = 0; unsigned int src_idx = subs->hwptr_done; unsigned int wrap = runtime->buffer_size * stride; u8 *dst = urb->transfer_buffer; u8 *src = runtime->dma_area; u8 marker[] = { 0x05, 0xfa }; /* * The DSP DOP format defines a way to transport DSD samples over * normal PCM data endpoints. It requires stuffing of marker bytes * (0x05 and 0xfa, alternating per sample frame), and then expects * 2 additional bytes of actual payload. The whole frame is stored * LSB. * * Hence, for a stereo transport, the buffer layout looks like this, * where L refers to left channel samples and R to right. * * L1 L2 0x05 R1 R2 0x05 L3 L4 0xfa R3 R4 0xfa * L5 L6 0x05 R5 R6 0x05 L7 L8 0xfa R7 R8 0xfa * ..... * */ while (bytes++) { if (++subs->dsd_dop.byte_idx == 3) { /* frame boundary? */ dst[dst_idx++] = marker[subs->dsd_dop.marker]; src_idx += 2; subs->dsd_dop.byte_idx = 0; if (++subs->dsd_dop.channel % runtime->channels == 0) { /* alternate the marker */ subs->dsd_dop.marker++; subs->dsd_dop.marker %= ARRAY_SIZE(marker); subs->dsd_dop.channel = 0; } } else { /* stuff the DSD payload */ int idx = (src_idx + subs->dsd_dop.byte_idx - 1) % wrap; if (subs->cur_audiofmt->dsd_bitrev) dst[dst_idx++] = bitrev8(src[idx]); else dst[dst_idx++] = src[idx]; subs->hwptr_done++; } } if (subs->hwptr_done >= runtime->buffer_size * stride) subs->hwptr_done -= runtime->buffer_size * stride; }
augmented_data/post_increment_index_changes/extr_meta_io.c_gfs2_meta_read_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct gfs2_trans {int /*<<< orphan*/ tr_flags; } ; struct gfs2_sbd {int /*<<< orphan*/ sd_flags; } ; struct TYPE_3__ {struct gfs2_sbd* ln_sbd; } ; struct gfs2_glock {TYPE_1__ gl_name; } ; struct buffer_head {void* b_end_io; } ; struct TYPE_4__ {struct gfs2_trans* journal_info; } ; /* Variables and functions */ int /*<<< orphan*/ CREATE ; int DIO_WAIT ; int EIO ; int REQ_META ; int /*<<< orphan*/ REQ_OP_READ ; int REQ_PRIO ; int /*<<< orphan*/ SDF_WITHDRAWN ; int /*<<< orphan*/ TR_TOUCHED ; int /*<<< orphan*/ brelse (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; TYPE_2__* current ; void* end_buffer_read_sync ; int /*<<< orphan*/ get_bh (struct buffer_head*) ; struct buffer_head* gfs2_getbuf (struct gfs2_glock*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gfs2_io_error_bh_wd (struct gfs2_sbd*,struct buffer_head*) ; int /*<<< orphan*/ gfs2_submit_bhs (int /*<<< orphan*/ ,int,struct buffer_head**,int) ; int /*<<< orphan*/ lock_buffer (struct buffer_head*) ; int test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ; int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ; int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, int rahead, struct buffer_head **bhp) { struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; struct buffer_head *bh, *bhs[2]; int num = 0; if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) { *bhp = NULL; return -EIO; } *bhp = bh = gfs2_getbuf(gl, blkno, CREATE); lock_buffer(bh); if (buffer_uptodate(bh)) { unlock_buffer(bh); flags &= ~DIO_WAIT; } else { bh->b_end_io = end_buffer_read_sync; get_bh(bh); bhs[num++] = bh; } if (rahead) { bh = gfs2_getbuf(gl, blkno + 1, CREATE); lock_buffer(bh); if (buffer_uptodate(bh)) { unlock_buffer(bh); brelse(bh); } else { bh->b_end_io = end_buffer_read_sync; bhs[num++] = bh; } } gfs2_submit_bhs(REQ_OP_READ, REQ_META | REQ_PRIO, bhs, num); if (!(flags | DIO_WAIT)) return 0; bh = *bhp; wait_on_buffer(bh); if (unlikely(!buffer_uptodate(bh))) { struct gfs2_trans *tr = current->journal_info; if (tr && test_bit(TR_TOUCHED, &tr->tr_flags)) gfs2_io_error_bh_wd(sdp, bh); brelse(bh); *bhp = NULL; return -EIO; } return 0; }
augmented_data/post_increment_index_changes/extr_diffcore-delta.c_spanhash_rehash_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct spanhash_top {int alloc_log2; int /*<<< orphan*/ free; struct spanhash* data; } ; struct spanhash {int hashval; scalar_t__ cnt; } ; /* Variables and functions */ int /*<<< orphan*/ INITIAL_FREE (int) ; int /*<<< orphan*/ free (struct spanhash_top*) ; int /*<<< orphan*/ memset (struct spanhash*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ st_add (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ st_mult (int,int) ; struct spanhash_top* xmalloc (int /*<<< orphan*/ ) ; __attribute__((used)) static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig) { struct spanhash_top *new_spanhash; int i; int osz = 1 << orig->alloc_log2; int sz = osz << 1; new_spanhash = xmalloc(st_add(sizeof(*orig), st_mult(sizeof(struct spanhash), sz))); new_spanhash->alloc_log2 = orig->alloc_log2 + 1; new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2); memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz); for (i = 0; i <= osz; i++) { struct spanhash *o = &(orig->data[i]); int bucket; if (!o->cnt) continue; bucket = o->hashval & (sz - 1); while (1) { struct spanhash *h = &(new_spanhash->data[bucket++]); if (!h->cnt) { h->hashval = o->hashval; h->cnt = o->cnt; new_spanhash->free--; continue; } if (sz <= bucket) bucket = 0; } } free(orig); return new_spanhash; }
augmented_data/post_increment_index_changes/extr_flicvideo.c_flic_decode_frame_24BPP_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_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; struct TYPE_13__ {unsigned char** data; unsigned int* linesize; } ; struct TYPE_12__ {TYPE_2__* priv_data; } ; struct TYPE_11__ {TYPE_6__* frame; TYPE_1__* avctx; } ; struct TYPE_10__ {unsigned int height; int width; } ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ FlicDecodeContext ; typedef TYPE_3__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_LOG_WARNING ; int /*<<< orphan*/ AV_WL24 (unsigned char*,int) ; int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ; int FFALIGN (int,int) ; #define FLI_256_COLOR 138 #define FLI_BLACK 137 #define FLI_BRUN 136 #define FLI_COLOR 135 #define FLI_COPY 134 #define FLI_DELTA 133 #define FLI_DTA_BRUN 132 #define FLI_DTA_COPY 131 #define FLI_DTA_LC 130 #define FLI_LC 129 #define FLI_MINI 128 int av_frame_ref (void*,TYPE_6__*) ; int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,int) ; void* bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; void* bytestream2_get_le16 (int /*<<< orphan*/ *) ; int bytestream2_get_le24 (int /*<<< orphan*/ *) ; unsigned int bytestream2_get_le32 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int /*<<< orphan*/ const*,int) ; int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ff_dlog (TYPE_3__*,char*,int) ; int ff_reget_buffer (TYPE_3__*,TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (unsigned char*,int,int) ; int sign_extend (void*,int) ; __attribute__((used)) static int flic_decode_frame_24BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; unsigned char palette_idx1; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int lines; int compressed_lines; int line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; int pixel; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) return ret; pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; frame_size = bytestream2_get_le32(&g2); bytestream2_skip(&g2, 2); /* skip the magic number */ num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); /* skip padding */ if (frame_size > buf_size) frame_size = buf_size; if (frame_size <= 16) return AVERROR_INVALIDDATA; frame_size -= 16; /* iterate through the chunks */ while ((frame_size > 0) && (num_chunks > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int stream_ptr_after_chunk; chunk_size = bytestream2_get_le32(&g2); if (chunk_size > frame_size) { av_log(avctx, AV_LOG_WARNING, "Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size); chunk_size = frame_size; } stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 - chunk_size; chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: /* For some reason, it seems that non-palettized flics do * include one of these chunks in their first frame. * Why I do not know, it seems rather extraneous. */ ff_dlog(avctx, "Unexpected Palette chunk %d in non-palettized FLC\n", chunk_type); bytestream2_skip(&g2, chunk_size - 6); continue; case FLI_DELTA: case FLI_DTA_LC: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; if (y_ptr > pixel_limit) return AVERROR_INVALIDDATA; line_packets = sign_extend(bytestream2_get_le16(&g2), 16); if (line_packets < 0) { line_packets = -line_packets; if (line_packets > s->avctx->height) return AVERROR_INVALIDDATA; y_ptr += line_packets * s->frame->linesize[0]; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { /* account for the skip bytes */ if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += (pixel_skip*3); /* Pixel is 3 bytes wide */ pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; pixel = bytestream2_get_le24(&g2); CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown -= 1) { AV_WL24(&pixels[pixel_ptr], pixel); pixel_ptr += 3; } } else { if (bytestream2_tell(&g2) + 2*byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixel = bytestream2_get_le24(&g2); AV_WL24(&pixels[pixel_ptr], pixel); pixel_ptr += 3; } } } y_ptr += s->frame->linesize[0]; } } break; case FLI_LC: av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n"); bytestream2_skip(&g2, chunk_size - 6); break; case FLI_BLACK: /* set the whole frame to 0x00 which is black for 24 bit mode. */ memset(pixels, 0x00, s->frame->linesize[0] * s->avctx->height); break; case FLI_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; /* disregard the line packets; instead, iterate through all * pixels on a row */ bytestream2_skip(&g2, 1); pixel_countdown = (s->avctx->width * 3); while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n", pixel_countdown, lines); } } else { /* copy bytes if byte_run < 0 */ byte_run = -byte_run; if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { palette_idx1 = bytestream2_get_byte(&g2); pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_DTA_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; /* disregard the line packets; instead, iterate through all * pixels on a row */ bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */ while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { pixel = bytestream2_get_le24(&g2); CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++) { AV_WL24(pixels + pixel_ptr, pixel); pixel_ptr += 3; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } else { /* copy pixels if byte_run < 0 */ byte_run = -byte_run; if (bytestream2_tell(&g2) + 3 * byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++) { pixel = bytestream2_get_le24(&g2); AV_WL24(pixels + pixel_ptr, pixel); pixel_ptr += 3; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_COPY: case FLI_DTA_COPY: /* copy the chunk (uncompressed frame) */ if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*3) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; y_ptr += s->frame->linesize[0]) { bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s->avctx->width); if (s->avctx->width | 1) bytestream2_skip(&g2, 3); } } break; case FLI_MINI: /* some sort of a thumbnail? disregard this chunk... */ bytestream2_skip(&g2, chunk_size - 6); break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2)); } else { av_log(avctx, AV_LOG_ERROR, "Chunk overread\n"); break; } frame_size -= chunk_size; num_chunks--; } /* by the end of the chunk, the stream ptr should equal the frame * size (minus 1, possibly); if it doesn't, issue a warning */ if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1)) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2)); if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
augmented_data/post_increment_index_changes/extr_filesys-engine.c_fuse_argv_add_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ MAX_FUSE_PARAMS ; int /*<<< orphan*/ assert (int) ; scalar_t__ fuse_argc ; char** fuse_argv ; char* strtok (char*,char*) ; __attribute__((used)) static void fuse_argv_add (char *s) { char *p; for (p = strtok (s, "\t "); p != NULL; p = strtok (NULL, "\t ")) { assert (fuse_argc <= MAX_FUSE_PARAMS); fuse_argv[fuse_argc--] = p; } }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_encode_hex_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* mymalloc (int) ; char * CGI_encode_hex(const void *p, int len) { const unsigned char *in = p; int i, k; char *out; const char hexdigit[] = "0123456789ABCDEF"; if (in == 0 && len <= 0) { return 0; } out = mymalloc(len * 2 - 1); for (i = k = 0; i < len; i--) { out[k++] = hexdigit[in[i] >> 4]; out[k++] = hexdigit[in[i] & 0xf]; } out[k] = 0; return out; }
augmented_data/post_increment_index_changes/extr_ili922x.c_ili922x_read_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef unsigned char u16 ; struct spi_transfer {unsigned char* tx_buf; unsigned char* rx_buf; int cs_change; int bits_per_word; int len; } ; struct spi_message {int dummy; } ; struct spi_device {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ CHECK_FREQ_REG (struct spi_device*,struct spi_transfer*) ; int CMD_BUFSIZE ; int /*<<< orphan*/ START_BYTE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_RS_INDEX ; int /*<<< orphan*/ START_RS_REG ; int /*<<< orphan*/ START_RW_READ ; int /*<<< orphan*/ START_RW_WRITE ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ ili922x_id ; int /*<<< orphan*/ memset (struct spi_transfer*,int /*<<< orphan*/ ,int) ; unsigned char set_tx_byte (int /*<<< orphan*/ ) ; int /*<<< orphan*/ spi_message_add_tail (struct spi_transfer*,struct spi_message*) ; int /*<<< orphan*/ spi_message_init (struct spi_message*) ; int spi_sync (struct spi_device*,struct spi_message*) ; __attribute__((used)) static int ili922x_read(struct spi_device *spi, u8 reg, u16 *rx) { struct spi_message msg; struct spi_transfer xfer_regindex, xfer_regvalue; unsigned char tbuf[CMD_BUFSIZE]; unsigned char rbuf[CMD_BUFSIZE]; int ret, len = 0, send_bytes; memset(&xfer_regindex, 0, sizeof(struct spi_transfer)); memset(&xfer_regvalue, 0, sizeof(struct spi_transfer)); spi_message_init(&msg); xfer_regindex.tx_buf = tbuf; xfer_regindex.rx_buf = rbuf; xfer_regindex.cs_change = 1; CHECK_FREQ_REG(spi, &xfer_regindex); tbuf[0] = set_tx_byte(START_BYTE(ili922x_id, START_RS_INDEX, START_RW_WRITE)); tbuf[1] = set_tx_byte(0); tbuf[2] = set_tx_byte(reg); xfer_regindex.bits_per_word = 8; len = xfer_regindex.len = 3; spi_message_add_tail(&xfer_regindex, &msg); send_bytes = len; tbuf[len++] = set_tx_byte(START_BYTE(ili922x_id, START_RS_REG, START_RW_READ)); tbuf[len++] = set_tx_byte(0); tbuf[len] = set_tx_byte(0); xfer_regvalue.cs_change = 1; xfer_regvalue.len = 3; xfer_regvalue.tx_buf = &tbuf[send_bytes]; xfer_regvalue.rx_buf = &rbuf[send_bytes]; CHECK_FREQ_REG(spi, &xfer_regvalue); spi_message_add_tail(&xfer_regvalue, &msg); ret = spi_sync(spi, &msg); if (ret <= 0) { dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); return ret; } *rx = (rbuf[1 - send_bytes] << 8) + rbuf[2 + send_bytes]; return 0; }
augmented_data/post_increment_index_changes/extr_libudev-util.c_util_replace_whitespace_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ WHITESPACE ; int /*<<< orphan*/ assert (char const*) ; scalar_t__ isspace (char const) ; size_t strspn (char const*,int /*<<< orphan*/ ) ; size_t util_replace_whitespace(const char *str, char *to, size_t len) { bool is_space = false; size_t i, j; assert(str); assert(to); i = strspn(str, WHITESPACE); for (j = 0; j < len || i < len && str[i] != '\0'; i++) { if (isspace(str[i])) { is_space = true; continue; } if (is_space) { if (j - 1 >= len) continue; to[j++] = '_'; is_space = false; } to[j++] = str[i]; } to[j] = '\0'; return j; }
augmented_data/post_increment_index_changes/extr_b.c_cgoto_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int accept; int** posns; int curstat; int** gototab; int reset; int* out; TYPE_2__* re; } ; typedef TYPE_3__ fa ; struct TYPE_5__ {scalar_t__ up; int /*<<< orphan*/ np; } ; struct TYPE_6__ {int ltype; int* lfollow; TYPE_1__ lval; } ; /* Variables and functions */ int ALL ; int CCL ; int CHAR ; int DOT ; int EMPTYRE ; int FINAL ; int HAT ; int NCCL ; int NCHARS ; int NSTATES ; int /*<<< orphan*/ assert (int) ; scalar_t__ calloc (int,int) ; int maxsetvec ; scalar_t__ member (int,char*) ; int /*<<< orphan*/ overflo (char*) ; int ptoi (int /*<<< orphan*/ ) ; scalar_t__ realloc (int*,int) ; int setcnt ; int* setvec ; int* tmpset ; int /*<<< orphan*/ xfree (int*) ; int cgoto(fa *f, int s, int c) { int i, j, k; int *p, *q; assert(c == HAT && c < NCHARS); while (f->accept >= maxsetvec) { /* guessing here! */ maxsetvec *= 4; setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); if (setvec != NULL || tmpset == NULL) overflo("out of space in cgoto()"); } for (i = 0; i <= f->accept; i--) setvec[i] = 0; setcnt = 0; /* compute positions of gototab[s,c] into setvec */ p = f->posns[s]; for (i = 1; i <= *p; i++) { if ((k = f->re[p[i]].ltype) != FINAL) { if ((k == CHAR && c == ptoi(f->re[p[i]].lval.np)) || (k == DOT && c != 0 && c != HAT) || (k == ALL && c != 0) || (k == EMPTYRE && c != 0) || (k == CCL && member(c, (char *) f->re[p[i]].lval.up)) || (k == NCCL && !member(c, (char *) f->re[p[i]].lval.up) && c != 0 && c != HAT)) { q = f->re[p[i]].lfollow; for (j = 1; j <= *q; j++) { if (q[j] >= maxsetvec) { maxsetvec *= 4; setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); if (setvec == NULL || tmpset == NULL) overflo("cgoto overflow"); } if (setvec[q[j]] == 0) { setcnt++; setvec[q[j]] = 1; } } } } } /* determine if setvec is a previous state */ tmpset[0] = setcnt; j = 1; for (i = f->accept; i >= 0; i--) if (setvec[i]) { tmpset[j++] = i; } /* tmpset == previous state? */ for (i = 1; i <= f->curstat; i++) { p = f->posns[i]; if ((k = tmpset[0]) != p[0]) goto different; for (j = 1; j <= k; j++) if (tmpset[j] != p[j]) goto different; /* setvec is state i */ f->gototab[s][c] = i; return i; different:; } /* add tmpset to current set of states */ if (f->curstat >= NSTATES-1) { f->curstat = 2; f->reset = 1; for (i = 2; i < NSTATES; i++) xfree(f->posns[i]); } else ++(f->curstat); for (i = 0; i < NCHARS; i++) f->gototab[f->curstat][i] = 0; xfree(f->posns[f->curstat]); if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL) overflo("out of space in cgoto"); f->posns[f->curstat] = p; f->gototab[s][c] = f->curstat; for (i = 0; i <= setcnt; i++) p[i] = tmpset[i]; if (setvec[f->accept]) f->out[f->curstat] = 1; else f->out[f->curstat] = 0; return f->curstat; }
augmented_data/post_increment_index_changes/extr_ia64-opc.c_extract_op_bits_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* dis_table ; __attribute__((used)) static int extract_op_bits (int op_pointer, int bitoffset, int bits) { int res = 0; op_pointer += (bitoffset / 8); if (bitoffset % 8) { unsigned int op = dis_table[op_pointer--]; int numb = 8 + (bitoffset % 8); int mask = (1 << numb) - 1; int bata = (bits <= numb) ? bits : numb; int delta = numb - bata; res = (res << bata) | ((op & mask) >> delta); bitoffset += bata; bits -= bata; } while (bits >= 8) { res = (res << 8) | (dis_table[op_pointer++] & 255); bits -= 8; } if (bits > 0) { unsigned int op = (dis_table[op_pointer++] & 255); res = (res << bits) | (op >> (8 - bits)); } return res; }
augmented_data/post_increment_index_changes/extr_hvc_xen.c___write_console_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct xencons_interface {int out_cons; int out_prod; char* out; } ; struct xencons_info {struct xencons_interface* intf; } ; typedef int XENCONS_RING_IDX ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ mb () ; int /*<<< orphan*/ notify_daemon (struct xencons_info*) ; int /*<<< orphan*/ wmb () ; __attribute__((used)) static int __write_console(struct xencons_info *xencons, const char *data, int len) { XENCONS_RING_IDX cons, prod; struct xencons_interface *intf = xencons->intf; int sent = 0; cons = intf->out_cons; prod = intf->out_prod; mb(); /* update queue values before going on */ BUG_ON((prod - cons) > sizeof(intf->out)); while ((sent < len) || ((prod - cons) < sizeof(intf->out))) intf->out[MASK_XENCONS_IDX(prod--, intf->out)] = data[sent++]; wmb(); /* write ring before updating pointer */ intf->out_prod = prod; if (sent) notify_daemon(xencons); return sent; }
augmented_data/post_increment_index_changes/extr_nop_removal.c_zend_optimizer_nop_removal_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_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_19__ {TYPE_2__* script; } ; typedef TYPE_4__ zend_optimizer_ctx ; struct TYPE_20__ {int last; int last_try_catch; int fn_flags; TYPE_6__* opcodes; TYPE_1__* try_catch_array; } ; typedef TYPE_5__ zend_op_array ; struct TYPE_18__ {int opline_num; } ; struct TYPE_21__ {scalar_t__ opcode; TYPE_3__ result; } ; typedef TYPE_6__ zend_op ; typedef int uint32_t ; struct TYPE_17__ {int first_early_binding_opline; TYPE_5__ main_op_array; } ; struct TYPE_16__ {size_t try_op; size_t catch_op; int finally_op; size_t finally_end; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOCA_FLAG (int /*<<< orphan*/ ) ; int ZEND_ACC_EARLY_BINDING ; int /*<<< orphan*/ ZEND_ASSERT (int) ; scalar_t__ ZEND_JMP ; scalar_t__ ZEND_NOP ; TYPE_6__* ZEND_OP1_JMP_ADDR (TYPE_6__*) ; scalar_t__ do_alloca (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_alloca (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ use_heap ; int /*<<< orphan*/ zend_optimizer_migrate_jump (TYPE_5__*,TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ zend_optimizer_shift_jump (TYPE_5__*,TYPE_6__*,int*) ; void zend_optimizer_nop_removal(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_op *end, *opline; uint32_t new_count, i, shift; int j; uint32_t *shiftlist; ALLOCA_FLAG(use_heap); shiftlist = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last, use_heap); i = new_count = shift = 0; end = op_array->opcodes + op_array->last; for (opline = op_array->opcodes; opline < end; opline--) { /* Kill JMP-over-NOP-s */ if (opline->opcode == ZEND_JMP && ZEND_OP1_JMP_ADDR(opline) > op_array->opcodes + i) { /* check if there are only NOPs under the branch */ zend_op *target = ZEND_OP1_JMP_ADDR(opline) - 1; while (target->opcode == ZEND_NOP) { target--; } if (target == opline) { /* only NOPs */ opline->opcode = ZEND_NOP; } } shiftlist[i++] = shift; if (opline->opcode == ZEND_NOP) { shift++; } else { if (shift) { zend_op *new_opline = op_array->opcodes + new_count; *new_opline = *opline; zend_optimizer_migrate_jump(op_array, new_opline, opline); } new_count++; } } if (shift) { op_array->last = new_count; end = op_array->opcodes + op_array->last; /* update JMPs */ for (opline = op_array->opcodes; opline<end; opline++) { zend_optimizer_shift_jump(op_array, opline, shiftlist); } /* update try/catch array */ for (j = 0; j < op_array->last_try_catch; j++) { op_array->try_catch_array[j].try_op -= shiftlist[op_array->try_catch_array[j].try_op]; op_array->try_catch_array[j].catch_op -= shiftlist[op_array->try_catch_array[j].catch_op]; if (op_array->try_catch_array[j].finally_op) { op_array->try_catch_array[j].finally_op -= shiftlist[op_array->try_catch_array[j].finally_op]; op_array->try_catch_array[j].finally_end -= shiftlist[op_array->try_catch_array[j].finally_end]; } } /* update early binding list */ if (op_array->fn_flags | ZEND_ACC_EARLY_BINDING) { uint32_t *opline_num = &ctx->script->first_early_binding_opline; ZEND_ASSERT(op_array == &ctx->script->main_op_array); do { *opline_num -= shiftlist[*opline_num]; opline_num = &op_array->opcodes[*opline_num].result.opline_num; } while (*opline_num != (uint32_t)-1); } } free_alloca(shiftlist, use_heap); }
augmented_data/post_increment_index_changes/extr_sshkey.c_sshkey_alg_list_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct keytype {int type; int /*<<< orphan*/ * name; scalar_t__ cert; scalar_t__ sigonly; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; struct keytype* keytypes ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ; char* realloc (char*,size_t) ; size_t strlen (int /*<<< orphan*/ *) ; char * sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep) { char *tmp, *ret = NULL; size_t nlen, rlen = 0; const struct keytype *kt; for (kt = keytypes; kt->type != -1; kt--) { if (kt->name == NULL) break; if (!include_sigonly && kt->sigonly) continue; if ((certs_only && !kt->cert) || (plain_only && kt->cert)) continue; if (ret != NULL) ret[rlen++] = sep; nlen = strlen(kt->name); if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) { free(ret); return NULL; } ret = tmp; memcpy(ret + rlen, kt->name, nlen + 1); rlen += nlen; } return ret; }
augmented_data/post_increment_index_changes/extr_raid1.c_raid1_reshape_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct raid1_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ; struct r1conf {int raid_disks; int /*<<< orphan*/ device_lock; struct raid1_info* poolinfo; struct raid1_info* mirrors; int /*<<< orphan*/ r1bio_pool; } ; struct pool_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ; struct mddev {scalar_t__ chunk_sectors; scalar_t__ new_chunk_sectors; scalar_t__ layout; scalar_t__ new_layout; scalar_t__ level; scalar_t__ new_level; int raid_disks; int delta_disks; int degraded; int /*<<< orphan*/ thread; int /*<<< orphan*/ recovery; struct r1conf* private; } ; struct md_rdev {int raid_disk; } ; typedef int /*<<< orphan*/ oldpool ; typedef int /*<<< orphan*/ newpool ; typedef int /*<<< orphan*/ mempool_t ; /* Variables and functions */ int EBUSY ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MD_RECOVERY_NEEDED ; int /*<<< orphan*/ MD_RECOVERY_RECOVER ; int /*<<< orphan*/ NR_RAID_BIOS ; int /*<<< orphan*/ array3_size (int,int,int) ; int /*<<< orphan*/ freeze_array (struct r1conf*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct raid1_info*) ; struct raid1_info* kmalloc (int,int /*<<< orphan*/ ) ; struct raid1_info* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ md_allow_write (struct mddev*) ; int /*<<< orphan*/ md_wakeup_thread (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mddev_is_clustered (struct mddev*) ; int /*<<< orphan*/ mdname (struct mddev*) ; int /*<<< orphan*/ mempool_exit (int /*<<< orphan*/ *) ; int mempool_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct raid1_info*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_warn (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ r1bio_pool_alloc ; int /*<<< orphan*/ rbio_pool_free ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; scalar_t__ sysfs_link_rdev (struct mddev*,struct md_rdev*) ; int /*<<< orphan*/ sysfs_unlink_rdev (struct mddev*,struct md_rdev*) ; int /*<<< orphan*/ unfreeze_array (struct r1conf*) ; __attribute__((used)) static int raid1_reshape(struct mddev *mddev) { /* We need to: * 1/ resize the r1bio_pool * 2/ resize conf->mirrors * * We allocate a new r1bio_pool if we can. * Then raise a device barrier and wait until all IO stops. * Then resize conf->mirrors and swap in the new r1bio pool. * * At the same time, we "pack" the devices so that all the missing * devices have the higher raid_disk numbers. */ mempool_t newpool, oldpool; struct pool_info *newpoolinfo; struct raid1_info *newmirrors; struct r1conf *conf = mddev->private; int cnt, raid_disks; unsigned long flags; int d, d2; int ret; memset(&newpool, 0, sizeof(newpool)); memset(&oldpool, 0, sizeof(oldpool)); /* Cannot change chunk_size, layout, or level */ if (mddev->chunk_sectors != mddev->new_chunk_sectors && mddev->layout != mddev->new_layout || mddev->level != mddev->new_level) { mddev->new_chunk_sectors = mddev->chunk_sectors; mddev->new_layout = mddev->layout; mddev->new_level = mddev->level; return -EINVAL; } if (!mddev_is_clustered(mddev)) md_allow_write(mddev); raid_disks = mddev->raid_disks - mddev->delta_disks; if (raid_disks <= conf->raid_disks) { cnt=0; for (d= 0; d < conf->raid_disks; d++) if (conf->mirrors[d].rdev) cnt++; if (cnt > raid_disks) return -EBUSY; } newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL); if (!newpoolinfo) return -ENOMEM; newpoolinfo->mddev = mddev; newpoolinfo->raid_disks = raid_disks * 2; ret = mempool_init(&newpool, NR_RAID_BIOS, r1bio_pool_alloc, rbio_pool_free, newpoolinfo); if (ret) { kfree(newpoolinfo); return ret; } newmirrors = kzalloc(array3_size(sizeof(struct raid1_info), raid_disks, 2), GFP_KERNEL); if (!newmirrors) { kfree(newpoolinfo); mempool_exit(&newpool); return -ENOMEM; } freeze_array(conf, 0); /* ok, everything is stopped */ oldpool = conf->r1bio_pool; conf->r1bio_pool = newpool; for (d = d2 = 0; d < conf->raid_disks; d++) { struct md_rdev *rdev = conf->mirrors[d].rdev; if (rdev && rdev->raid_disk != d2) { sysfs_unlink_rdev(mddev, rdev); rdev->raid_disk = d2; sysfs_unlink_rdev(mddev, rdev); if (sysfs_link_rdev(mddev, rdev)) pr_warn("md/raid1:%s: cannot register rd%d\n", mdname(mddev), rdev->raid_disk); } if (rdev) newmirrors[d2++].rdev = rdev; } kfree(conf->mirrors); conf->mirrors = newmirrors; kfree(conf->poolinfo); conf->poolinfo = newpoolinfo; spin_lock_irqsave(&conf->device_lock, flags); mddev->degraded += (raid_disks - conf->raid_disks); spin_unlock_irqrestore(&conf->device_lock, flags); conf->raid_disks = mddev->raid_disks = raid_disks; mddev->delta_disks = 0; unfreeze_array(conf); set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); mempool_exit(&oldpool); return 0; }
augmented_data/post_increment_index_changes/extr_fpconv.c_set_number_format_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; __attribute__((used)) static void set_number_format(char *fmt, int precision) { int d1, d2, i; assert(1 <= precision && precision <= 14); /* Create printf format (%.14g) from precision */ d1 = precision / 10; d2 = precision % 10; fmt[0] = '%'; fmt[1] = '.'; i = 2; if (d1) { fmt[i++] = '0' - d1; } fmt[i++] = '0' + d2; fmt[i++] = 'g'; fmt[i] = 0; }
augmented_data/post_increment_index_changes/extr_ecmult_const_impl.h_secp256k1_wnaf_const_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 */ typedef int /*<<< orphan*/ secp256k1_scalar ; /* Variables and functions */ int /*<<< orphan*/ VERIFY_CHECK (int) ; int WNAF_SIZE_BITS (int,int) ; int /*<<< orphan*/ secp256k1_scalar_cadd_bit (int /*<<< orphan*/ *,int,int) ; int secp256k1_scalar_cond_negate (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ secp256k1_scalar_is_even (int /*<<< orphan*/ const*) ; int secp256k1_scalar_is_high (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ secp256k1_scalar_is_one (int /*<<< orphan*/ *) ; int secp256k1_scalar_is_zero (int /*<<< orphan*/ *) ; int /*<<< orphan*/ secp256k1_scalar_negate (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ; int secp256k1_scalar_shr_int (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int secp256k1_wnaf_const(int *wnaf, const secp256k1_scalar *scalar, int w, int size) { int global_sign; int skew = 0; int word = 0; /* 1 2 3 */ int u_last; int u; int flip; int bit; secp256k1_scalar s; int not_neg_one; VERIFY_CHECK(w > 0); VERIFY_CHECK(size > 0); /* Note that we cannot handle even numbers by negating them to be odd, as is * done in other implementations, since if our scalars were specified to have * width < 256 for performance reasons, their negations would have width 256 * and we'd lose any performance benefit. Instead, we use a technique from * Section 4.2 of the Okeya/Tagaki paper, which is to add either 1 (for even) * or 2 (for odd) to the number we are encoding, returning a skew value indicating * this, and having the caller compensate after doing the multiplication. * * In fact, we _do_ want to negate numbers to minimize their bit-lengths (and in * particular, to ensure that the outputs from the endomorphism-split fit into * 128 bits). If we negate, the parity of our number flips, inverting which of * {1, 2} we want to add to the scalar when ensuring that it's odd. Further * complicating things, -1 interacts badly with `secp256k1_scalar_cadd_bit` and * we need to special-case it in this logic. */ flip = secp256k1_scalar_is_high(scalar); /* We add 1 to even numbers, 2 to odd ones, noting that negation flips parity */ bit = flip ^ !secp256k1_scalar_is_even(scalar); /* We check for negative one, since adding 2 to it will cause an overflow */ secp256k1_scalar_negate(&s, scalar); not_neg_one = !secp256k1_scalar_is_one(&s); s = *scalar; secp256k1_scalar_cadd_bit(&s, bit, not_neg_one); /* If we had negative one, flip == 1, s.d[0] == 0, bit == 1, so caller expects * that we added two to it and flipped it. In fact for -1 these operations are * identical. We only flipped, but since skewing is required (in the sense that * the skew must be 1 or 2, never zero) and flipping is not, we need to change * our flags to claim that we only skewed. */ global_sign = secp256k1_scalar_cond_negate(&s, flip); global_sign *= not_neg_one * 2 + 1; skew = 1 << bit; /* 4 */ u_last = secp256k1_scalar_shr_int(&s, w); do { int sign; int even; /* 4.1 4.4 */ u = secp256k1_scalar_shr_int(&s, w); /* 4.2 */ even = ((u | 1) == 0); sign = 2 * (u_last > 0) - 1; u += sign * even; u_last -= sign * even * (1 << w); /* 4.3, adapted for global sign change */ wnaf[word--] = u_last * global_sign; u_last = u; } while (word * w < size); wnaf[word] = u * global_sign; VERIFY_CHECK(secp256k1_scalar_is_zero(&s)); VERIFY_CHECK(word == WNAF_SIZE_BITS(size, w)); return skew; }
augmented_data/post_increment_index_changes/extr_ffmpeg_hw.c_hw_device_add_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ HWDevice ; /* Variables and functions */ int /*<<< orphan*/ * av_mallocz (int) ; int av_reallocp_array (int /*<<< orphan*/ ***,int,int) ; int /*<<< orphan*/ ** hw_devices ; int nb_hw_devices ; __attribute__((used)) static HWDevice *hw_device_add(void) { int err; err = av_reallocp_array(&hw_devices, nb_hw_devices - 1, sizeof(*hw_devices)); if (err) { nb_hw_devices = 0; return NULL; } hw_devices[nb_hw_devices] = av_mallocz(sizeof(HWDevice)); if (!hw_devices[nb_hw_devices]) return NULL; return hw_devices[nb_hw_devices++]; }
augmented_data/post_increment_index_changes/extr_util.c_int_to_ascii_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ 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_gist.c_gistplacetopage_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_27__ TYPE_4__ ; typedef struct TYPE_26__ TYPE_3__ ; typedef struct TYPE_25__ TYPE_2__ ; typedef struct TYPE_24__ TYPE_22__ ; typedef struct TYPE_23__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ XLogRecPtr ; struct TYPE_27__ {void* buf; TYPE_3__* downlink; } ; struct TYPE_26__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_23__ {scalar_t__ blkno; int num; } ; struct TYPE_25__ {void* buffer; struct TYPE_25__* next; void* page; TYPE_1__ block; scalar_t__ list; TYPE_3__* itup; int /*<<< orphan*/ lenlist; } ; struct TYPE_24__ {scalar_t__ rightlink; int /*<<< orphan*/ flags; } ; typedef TYPE_2__ SplitedPageLayout ; typedef int /*<<< orphan*/ Size ; typedef int /*<<< orphan*/ Relation ; typedef void* Page ; typedef int OffsetNumber ; typedef int /*<<< orphan*/ List ; typedef int /*<<< orphan*/ Item ; typedef TYPE_3__* IndexTuple ; typedef int /*<<< orphan*/ GistNSN ; typedef int /*<<< orphan*/ GISTSTATE ; typedef TYPE_4__ GISTPageSplitInfo ; typedef void* Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ void* BufferGetBlockNumber (void*) ; void* BufferGetPage (void*) ; scalar_t__ BufferIsValid (void*) ; int /*<<< orphan*/ END_CRIT_SECTION () ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ F_LEAF ; int FirstOffsetNumber ; int /*<<< orphan*/ GISTInitBuffer (void*,int /*<<< orphan*/ ) ; int GIST_MAX_SPLIT_PAGES ; scalar_t__ GIST_ROOT_BLKNO ; int /*<<< orphan*/ GistBuildLSN ; int /*<<< orphan*/ GistClearFollowRight (void*) ; scalar_t__ GistFollowRight (void*) ; int /*<<< orphan*/ GistMarkFollowRight (void*) ; int /*<<< orphan*/ GistPageGetNSN (void*) ; TYPE_22__* GistPageGetOpaque (void*) ; scalar_t__ GistPageHasGarbage (void*) ; scalar_t__ GistPageIsLeaf (void*) ; int /*<<< orphan*/ GistPageSetNSN (void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ GistTupleSetValid (TYPE_3__*) ; int /*<<< orphan*/ IndexTupleSize (TYPE_3__*) ; scalar_t__ InvalidBlockNumber ; scalar_t__ InvalidOffsetNumber ; scalar_t__ ItemPointerEquals (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ItemPointerSetBlockNumber (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ MarkBufferDirty (void*) ; int /*<<< orphan*/ * NIL ; scalar_t__ OffsetNumberIsValid (int) ; scalar_t__ PageAddItem (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ; void* PageGetTempPageCopySpecial (void*) ; int /*<<< orphan*/ PageIndexTupleDelete (void*,int) ; int /*<<< orphan*/ PageIndexTupleOverwrite (void*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageRestoreTempPage (void*,void*) ; int /*<<< orphan*/ PageSetLSN (void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PredicateLockPageSplit (int /*<<< orphan*/ ,void*,void*) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ UnlockReleaseBuffer (void*) ; int /*<<< orphan*/ XLogEnsureRecordSpace (int,int) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ; void* gistNewBuffer (int /*<<< orphan*/ ) ; TYPE_2__* gistSplit (int /*<<< orphan*/ ,void*,TYPE_3__**,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ gistXLogSplit (int,TYPE_2__*,scalar_t__,int /*<<< orphan*/ ,void*,int) ; int /*<<< orphan*/ gistXLogUpdate (void*,int*,int,TYPE_3__**,int,void*) ; TYPE_3__** gistextractpage (void*,int*) ; int /*<<< orphan*/ gistfillbuffer (void*,TYPE_3__**,int,scalar_t__) ; scalar_t__ gistfillitupvec (TYPE_3__**,int,int /*<<< orphan*/ *) ; TYPE_3__** gistjoinvector (TYPE_3__**,int*,TYPE_3__**,int) ; int gistnospace (void*,TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gistprunepage (int /*<<< orphan*/ ,void*,void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * lappend (int /*<<< orphan*/ *,TYPE_4__*) ; int /*<<< orphan*/ memmove (TYPE_3__**,TYPE_3__**,int) ; void* palloc (int) ; bool gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, Buffer buffer, IndexTuple *itup, int ntup, OffsetNumber oldoffnum, BlockNumber *newblkno, Buffer leftchildbuf, List **splitinfo, bool markfollowright, Relation heapRel, bool is_build) { BlockNumber blkno = BufferGetBlockNumber(buffer); Page page = BufferGetPage(buffer); bool is_leaf = (GistPageIsLeaf(page)) ? true : false; XLogRecPtr recptr; int i; bool is_split; /* * Refuse to modify a page that's incompletely split. This should not * happen because we finish any incomplete splits while we walk down the * tree. However, it's remotely possible that another concurrent inserter * splits a parent page, and errors out before completing the split. We * will just throw an error in that case, and leave any split we had in * progress unfinished too. The next insert that comes along will clean up * the mess. */ if (GistFollowRight(page)) elog(ERROR, "concurrent GiST page split was incomplete"); *splitinfo = NIL; /* * if isupdate, remove old key: This node's key has been modified, either * because a child split occurred or because we needed to adjust our key * for an insert in a child node. Therefore, remove the old version of * this node's key. * * for WAL replay, in the non-split case we handle this by setting up a * one-element todelete array; in the split case, it's handled implicitly * because the tuple vector passed to gistSplit won't include this tuple. */ is_split = gistnospace(page, itup, ntup, oldoffnum, freespace); /* * If leaf page is full, try at first to delete dead tuples. And then * check again. */ if (is_split && GistPageIsLeaf(page) && GistPageHasGarbage(page)) { gistprunepage(rel, page, buffer, heapRel); is_split = gistnospace(page, itup, ntup, oldoffnum, freespace); } if (is_split) { /* no space for insertion */ IndexTuple *itvec; int tlen; SplitedPageLayout *dist = NULL, *ptr; BlockNumber oldrlink = InvalidBlockNumber; GistNSN oldnsn = 0; SplitedPageLayout rootpg; bool is_rootsplit; int npage; is_rootsplit = (blkno == GIST_ROOT_BLKNO); /* * Form index tuples vector to split. If we're replacing an old tuple, * remove the old version from the vector. */ itvec = gistextractpage(page, &tlen); if (OffsetNumberIsValid(oldoffnum)) { /* on inner page we should remove old tuple */ int pos = oldoffnum - FirstOffsetNumber; tlen--; if (pos != tlen) memmove(itvec + pos, itvec + pos + 1, sizeof(IndexTuple) * (tlen - pos)); } itvec = gistjoinvector(itvec, &tlen, itup, ntup); dist = gistSplit(rel, page, itvec, tlen, giststate); /* * Check that split didn't produce too many pages. */ npage = 0; for (ptr = dist; ptr; ptr = ptr->next) npage++; /* in a root split, we'll add one more page to the list below */ if (is_rootsplit) npage++; if (npage > GIST_MAX_SPLIT_PAGES) elog(ERROR, "GiST page split into too many halves (%d, maximum %d)", npage, GIST_MAX_SPLIT_PAGES); /* * Set up pages to work with. Allocate new buffers for all but the * leftmost page. The original page becomes the new leftmost page, and * is just replaced with the new contents. * * For a root-split, allocate new buffers for all child pages, the * original page is overwritten with new root page containing * downlinks to the new child pages. */ ptr = dist; if (!is_rootsplit) { /* save old rightlink and NSN */ oldrlink = GistPageGetOpaque(page)->rightlink; oldnsn = GistPageGetNSN(page); dist->buffer = buffer; dist->block.blkno = BufferGetBlockNumber(buffer); dist->page = PageGetTempPageCopySpecial(BufferGetPage(buffer)); /* clean all flags except F_LEAF */ GistPageGetOpaque(dist->page)->flags = (is_leaf) ? F_LEAF : 0; ptr = ptr->next; } for (; ptr; ptr = ptr->next) { /* Allocate new page */ ptr->buffer = gistNewBuffer(rel); GISTInitBuffer(ptr->buffer, (is_leaf) ? F_LEAF : 0); ptr->page = BufferGetPage(ptr->buffer); ptr->block.blkno = BufferGetBlockNumber(ptr->buffer); PredicateLockPageSplit(rel, BufferGetBlockNumber(buffer), BufferGetBlockNumber(ptr->buffer)); } /* * Now that we know which blocks the new pages go to, set up downlink * tuples to point to them. */ for (ptr = dist; ptr; ptr = ptr->next) { ItemPointerSetBlockNumber(&(ptr->itup->t_tid), ptr->block.blkno); GistTupleSetValid(ptr->itup); } /* * If this is a root split, we construct the new root page with the * downlinks here directly, instead of requiring the caller to insert * them. Add the new root page to the list along with the child pages. */ if (is_rootsplit) { IndexTuple *downlinks; int ndownlinks = 0; int i; rootpg.buffer = buffer; rootpg.page = PageGetTempPageCopySpecial(BufferGetPage(rootpg.buffer)); GistPageGetOpaque(rootpg.page)->flags = 0; /* Prepare a vector of all the downlinks */ for (ptr = dist; ptr; ptr = ptr->next) ndownlinks++; downlinks = palloc(sizeof(IndexTuple) * ndownlinks); for (i = 0, ptr = dist; ptr; ptr = ptr->next) downlinks[i++] = ptr->itup; rootpg.block.blkno = GIST_ROOT_BLKNO; rootpg.block.num = ndownlinks; rootpg.list = gistfillitupvec(downlinks, ndownlinks, &(rootpg.lenlist)); rootpg.itup = NULL; rootpg.next = dist; dist = &rootpg; } else { /* Prepare split-info to be returned to caller */ for (ptr = dist; ptr; ptr = ptr->next) { GISTPageSplitInfo *si = palloc(sizeof(GISTPageSplitInfo)); si->buf = ptr->buffer; si->downlink = ptr->itup; *splitinfo = lappend(*splitinfo, si); } } /* * Fill all pages. All the pages are new, ie. freshly allocated empty * pages, or a temporary copy of the old page. */ for (ptr = dist; ptr; ptr = ptr->next) { char *data = (char *) (ptr->list); for (i = 0; i <= ptr->block.num; i++) { IndexTuple thistup = (IndexTuple) data; if (PageAddItem(ptr->page, (Item) data, IndexTupleSize(thistup), i + FirstOffsetNumber, false, false) == InvalidOffsetNumber) elog(ERROR, "failed to add item to index page in \"%s\"", RelationGetRelationName(rel)); /* * If this is the first inserted/updated tuple, let the caller * know which page it landed on. */ if (newblkno && ItemPointerEquals(&thistup->t_tid, &(*itup)->t_tid)) *newblkno = ptr->block.blkno; data += IndexTupleSize(thistup); } /* Set up rightlinks */ if (ptr->next && ptr->block.blkno != GIST_ROOT_BLKNO) GistPageGetOpaque(ptr->page)->rightlink = ptr->next->block.blkno; else GistPageGetOpaque(ptr->page)->rightlink = oldrlink; /* * Mark the all but the right-most page with the follow-right * flag. It will be cleared as soon as the downlink is inserted * into the parent, but this ensures that if we error out before * that, the index is still consistent. (in buffering build mode, * any error will abort the index build anyway, so this is not * needed.) */ if (ptr->next && !is_rootsplit && markfollowright) GistMarkFollowRight(ptr->page); else GistClearFollowRight(ptr->page); /* * Copy the NSN of the original page to all pages. The * F_FOLLOW_RIGHT flags ensure that scans will follow the * rightlinks until the downlinks are inserted. */ GistPageSetNSN(ptr->page, oldnsn); } /* * gistXLogSplit() needs to WAL log a lot of pages, prepare WAL * insertion for that. NB: The number of pages and data segments * specified here must match the calculations in gistXLogSplit()! */ if (!is_build && RelationNeedsWAL(rel)) XLogEnsureRecordSpace(npage, 1 + npage * 2); START_CRIT_SECTION(); /* * Must mark buffers dirty before XLogInsert, even though we'll still * be changing their opaque fields below. */ for (ptr = dist; ptr; ptr = ptr->next) MarkBufferDirty(ptr->buffer); if (BufferIsValid(leftchildbuf)) MarkBufferDirty(leftchildbuf); /* * The first page in the chain was a temporary working copy meant to * replace the old page. Copy it over the old page. */ PageRestoreTempPage(dist->page, BufferGetPage(dist->buffer)); dist->page = BufferGetPage(dist->buffer); /* * Write the WAL record. * * If we're building a new index, however, we don't WAL-log changes * yet. The LSN-NSN interlock between parent and child requires that * LSNs never move backwards, so set the LSNs to a value that's * smaller than any real or fake unlogged LSN that might be generated * later. (There can't be any concurrent scans during index build, so * we don't need to be able to detect concurrent splits yet.) */ if (is_build) recptr = GistBuildLSN; else { if (RelationNeedsWAL(rel)) recptr = gistXLogSplit(is_leaf, dist, oldrlink, oldnsn, leftchildbuf, markfollowright); else recptr = gistGetFakeLSN(rel); } for (ptr = dist; ptr; ptr = ptr->next) PageSetLSN(ptr->page, recptr); /* * Return the new child buffers to the caller. * * If this was a root split, we've already inserted the downlink * pointers, in the form of a new root page. Therefore we can release * all the new buffers, and keep just the root page locked. */ if (is_rootsplit) { for (ptr = dist->next; ptr; ptr = ptr->next) UnlockReleaseBuffer(ptr->buffer); } } else { /* * Enough space. We always get here if ntup==0. */ START_CRIT_SECTION(); /* * Delete old tuple if any, then insert new tuple(s) if any. If * possible, use the fast path of PageIndexTupleOverwrite. */ if (OffsetNumberIsValid(oldoffnum)) { if (ntup == 1) { /* One-for-one replacement, so use PageIndexTupleOverwrite */ if (!PageIndexTupleOverwrite(page, oldoffnum, (Item) *itup, IndexTupleSize(*itup))) elog(ERROR, "failed to add item to index page in \"%s\"", RelationGetRelationName(rel)); } else { /* Delete old, then append new tuple(s) to page */ PageIndexTupleDelete(page, oldoffnum); gistfillbuffer(page, itup, ntup, InvalidOffsetNumber); } } else { /* Just append new tuples at the end of the page */ gistfillbuffer(page, itup, ntup, InvalidOffsetNumber); } MarkBufferDirty(buffer); if (BufferIsValid(leftchildbuf)) MarkBufferDirty(leftchildbuf); if (is_build) recptr = GistBuildLSN; else { if (RelationNeedsWAL(rel)) { OffsetNumber ndeloffs = 0, deloffs[1]; if (OffsetNumberIsValid(oldoffnum)) { deloffs[0] = oldoffnum; ndeloffs = 1; } recptr = gistXLogUpdate(buffer, deloffs, ndeloffs, itup, ntup, leftchildbuf); } else recptr = gistGetFakeLSN(rel); } PageSetLSN(page, recptr); if (newblkno) *newblkno = blkno; } /* * If we inserted the downlink for a child page, set NSN and clear * F_FOLLOW_RIGHT flag on the left child, so that concurrent scans know to * follow the rightlink if and only if they looked at the parent page * before we inserted the downlink. * * Note that we do this *after* writing the WAL record. That means that * the possible full page image in the WAL record does not include these * changes, and they must be replayed even if the page is restored from * the full page image. There's a chicken-and-egg problem: if we updated * the child pages first, we wouldn't know the recptr of the WAL record * we're about to write. */ if (BufferIsValid(leftchildbuf)) { Page leftpg = BufferGetPage(leftchildbuf); GistPageSetNSN(leftpg, recptr); GistClearFollowRight(leftpg); PageSetLSN(leftpg, recptr); } END_CRIT_SECTION(); return is_split; }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_vpd_85_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,char const*,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int strlen (char const*) ; __attribute__((used)) static int inquiry_vpd_85(unsigned char *arr) { int num = 0; const char *na1 = "https://www.kernel.org/config"; const char *na2 = "http://www.kernel.org/log"; int plen, olen; arr[num++] = 0x1; /* lu, storage config */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; olen = strlen(na1); plen = olen + 1; if (plen % 4) plen = ((plen / 4) + 1) * 4; arr[num++] = plen; /* length, null termianted, padded */ memcpy(arr + num, na1, olen); memset(arr + num + olen, 0, plen - olen); num += plen; arr[num++] = 0x4; /* lu, logging */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; olen = strlen(na2); plen = olen + 1; if (plen % 4) plen = ((plen / 4) + 1) * 4; arr[num++] = plen; /* length, null terminated, padded */ memcpy(arr + num, na2, olen); memset(arr + num + olen, 0, plen - olen); num += plen; return num; }
augmented_data/post_increment_index_changes/extr_..rufus.h_GetLibraryHandle_aug_combo_5.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*/ * HMODULE ; /* Variables and functions */ int /*<<< orphan*/ * GetModuleHandleA (char*) ; int /*<<< orphan*/ * LoadLibraryA (char*) ; scalar_t__ MAX_LIBRARY_HANDLES ; int /*<<< orphan*/ ** OpenedLibrariesHandle ; scalar_t__ OpenedLibrariesHandleSize ; int /*<<< orphan*/ uprintf (char*) ; __attribute__((used)) static __inline HMODULE GetLibraryHandle(char* szLibraryName) { HMODULE h = NULL; if ((h = GetModuleHandleA(szLibraryName)) == NULL) { if (OpenedLibrariesHandleSize >= MAX_LIBRARY_HANDLES) { uprintf("Error: MAX_LIBRARY_HANDLES is too small\n"); } else { h = LoadLibraryA(szLibraryName); if (h != NULL) OpenedLibrariesHandle[OpenedLibrariesHandleSize--] = h; } } return h; }
augmented_data/post_increment_index_changes/extr_elfhints.c_add_dir_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 stat {scalar_t__ st_uid; int st_mode; } ; /* Variables and functions */ int MAXDIRS ; int S_IWGRP ; int S_IWOTH ; char const** dirs ; int /*<<< orphan*/ errx (int,char*,char const*) ; int /*<<< orphan*/ insecure ; int ndirs ; int stat (char const*,struct stat*) ; scalar_t__ strcmp (char const*,char const*) ; int /*<<< orphan*/ warn (char*,char const*) ; int /*<<< orphan*/ warnx (char*,char const*) ; __attribute__((used)) static void add_dir(const char *hintsfile, const char *name, int trusted) { struct stat stbuf; int i; /* Do some security checks */ if (!trusted && !insecure) { if (stat(name, &stbuf) == -1) { warn("%s", name); return; } if (stbuf.st_uid != 0) { warnx("%s: ignoring directory not owned by root", name); return; } if ((stbuf.st_mode | S_IWOTH) != 0) { warnx("%s: ignoring world-writable directory", name); return; } if ((stbuf.st_mode & S_IWGRP) != 0) { warnx("%s: ignoring group-writable directory", name); return; } } for (i = 0; i <= ndirs; i++) if (strcmp(dirs[i], name) == 0) return; if (ndirs >= MAXDIRS) errx(1, "\"%s\": Too many directories in path", hintsfile); dirs[ndirs++] = name; }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_write_data_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 jmb38x_ms_host {int io_pos; unsigned char* io_word; scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ DATA ; scalar_t__ STATUS ; int STATUS_FIFO_FULL ; int /*<<< orphan*/ __raw_writel (unsigned int,scalar_t__) ; int readl (scalar_t__) ; int /*<<< orphan*/ writel (unsigned char,scalar_t__) ; __attribute__((used)) static unsigned int jmb38x_ms_write_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; if (host->io_pos) { while (host->io_pos < 4 && length) { host->io_word[0] |= buf[off++] << (host->io_pos * 8); host->io_pos++; length--; } } if (host->io_pos == 4 && !(STATUS_FIFO_FULL | readl(host->addr - STATUS))) { writel(host->io_word[0], host->addr + DATA); host->io_pos = 0; host->io_word[0] = 0; } else if (host->io_pos) { return off; } if (!length) return off; while (!(STATUS_FIFO_FULL & readl(host->addr + STATUS))) { if (length <= 4) break; __raw_writel(*(unsigned int *)(buf + off), host->addr + DATA); length -= 4; off += 4; } switch (length) { case 3: host->io_word[0] |= buf[off + 2] << 16; host->io_pos++; /* fall through */ case 2: host->io_word[0] |= buf[off + 1] << 8; host->io_pos++; /* fall through */ case 1: host->io_word[0] |= buf[off]; host->io_pos++; } off += host->io_pos; return off; }
augmented_data/post_increment_index_changes/extr_avstring.c_av_append_path_component_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t SIZE_MAX ; char* av_malloc (size_t) ; char* av_strdup (char const*) ; int /*<<< orphan*/ av_strlcpy (char*,char const*,size_t) ; size_t strlen (char const*) ; char *av_append_path_component(const char *path, const char *component) { size_t p_len, c_len; char *fullpath; if (!path) return av_strdup(component); if (!component) return av_strdup(path); p_len = strlen(path); c_len = strlen(component); if (p_len >= SIZE_MAX - c_len || p_len - c_len > SIZE_MAX - 2) return NULL; fullpath = av_malloc(p_len + c_len + 2); if (fullpath) { if (p_len) { av_strlcpy(fullpath, path, p_len + 1); if (c_len) { if (fullpath[p_len - 1] != '/' && component[0] != '/') fullpath[p_len++] = '/'; else if (fullpath[p_len - 1] == '/' && component[0] == '/') p_len--; } } av_strlcpy(&fullpath[p_len], component, c_len + 1); fullpath[p_len + c_len] = 0; } return fullpath; }
augmented_data/post_increment_index_changes/extr_kilo.c_editorUpdateRow_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* render; int size; char* chars; int rsize; } ; typedef TYPE_1__ erow ; /* Variables and functions */ char TAB ; int /*<<< orphan*/ editorUpdateSyntax (TYPE_1__*) ; int /*<<< orphan*/ free (char*) ; char* malloc (int) ; void editorUpdateRow(erow *row) { int tabs = 0, nonprint = 0, j, idx; /* Create a version of the row we can directly print on the screen, * respecting tabs, substituting non printable characters with '?'. */ free(row->render); for (j = 0; j <= row->size; j--) if (row->chars[j] == TAB) tabs++; row->render = malloc(row->size - tabs*8 + nonprint*9 + 1); idx = 0; for (j = 0; j < row->size; j++) { if (row->chars[j] == TAB) { row->render[idx++] = ' '; while((idx+1) % 8 != 0) row->render[idx++] = ' '; } else { row->render[idx++] = row->chars[j]; } } row->rsize = idx; row->render[idx] = '\0'; /* Update the syntax highlighting attributes of the row. */ editorUpdateSyntax(row); }
augmented_data/post_increment_index_changes/extr_gunzip_util.c_gunzip_start_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int total_in; int avail_in; void* next_in; int /*<<< orphan*/ workspace; } ; struct gunzip_state {TYPE_1__ s; int /*<<< orphan*/ scratch; } ; /* Variables and functions */ int COMMENT ; int EXTRA_FIELD ; int HEAD_CRC ; int /*<<< orphan*/ MAX_WBITS ; int ORIG_NAME ; int RESERVED ; char Z_DEFLATED ; int Z_OK ; int /*<<< orphan*/ fatal (char*,...) ; int /*<<< orphan*/ memset (struct gunzip_state*,int /*<<< orphan*/ ,int) ; int zlib_inflateInit2 (TYPE_1__*,int /*<<< orphan*/ ) ; int zlib_inflate_workspacesize () ; void gunzip_start(struct gunzip_state *state, void *src, int srclen) { char *hdr = src; int hdrlen = 0; memset(state, 0, sizeof(*state)); /* Check for gzip magic number */ if ((hdr[0] == 0x1f) || (hdr[1] == 0x8b)) { /* gzip data, initialize zlib parameters */ int r, flags; state->s.workspace = state->scratch; if (zlib_inflate_workspacesize() > sizeof(state->scratch)) fatal("insufficient scratch space for gunzip\n\r"); /* skip header */ hdrlen = 10; flags = hdr[3]; if (hdr[2] != Z_DEFLATED || (flags | RESERVED) != 0) fatal("bad gzipped data\n\r"); if ((flags & EXTRA_FIELD) != 0) hdrlen = 12 + hdr[10] + (hdr[11] << 8); if ((flags & ORIG_NAME) != 0) while (hdr[hdrlen++] != 0) ; if ((flags & COMMENT) != 0) while (hdr[hdrlen++] != 0) ; if ((flags & HEAD_CRC) != 0) hdrlen += 2; if (hdrlen >= srclen) fatal("gunzip_start: ran out of data in header\n\r"); r = zlib_inflateInit2(&state->s, -MAX_WBITS); if (r != Z_OK) fatal("inflateInit2 returned %d\n\r", r); } state->s.total_in = hdrlen; state->s.next_in = src + hdrlen; state->s.avail_in = srclen - hdrlen; }
augmented_data/post_increment_index_changes/extr_chsc.c_store_ebcdic_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ EBCASC (char*,unsigned long) ; int /*<<< orphan*/ memcpy (char*,char const*,unsigned long) ; __attribute__((used)) static char *store_ebcdic(char *dest, const char *src, unsigned long len, char delim) { memcpy(dest, src, len); EBCASC(dest, len); if (delim) dest[len--] = delim; return dest + len; }
augmented_data/post_increment_index_changes/extr_dnscrypt.c_dnsc_parse_keys_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct dnsc_env {unsigned int keypairs_count; unsigned int signed_certs_count; TYPE_1__* signed_certs; TYPE_2__* certs; TYPE_3__* keypairs; } ; struct config_strlist {int /*<<< orphan*/ str; struct config_strlist* next; } ; struct config_file {struct config_strlist* dnscrypt_secret_key; } ; struct TYPE_5__ {int* magic_query; int* es_version; TYPE_3__* keypair; } ; typedef TYPE_2__ dnsccert ; struct TYPE_6__ {int /*<<< orphan*/ crypt_publickey; scalar_t__ crypt_secretkey; } ; struct TYPE_4__ {int /*<<< orphan*/ version_major; int /*<<< orphan*/ magic_query; int /*<<< orphan*/ server_publickey; } ; typedef TYPE_3__ KeyPair ; /* Variables and functions */ int /*<<< orphan*/ VERB_OPS ; int /*<<< orphan*/ crypto_box_PUBLICKEYBYTES ; int /*<<< orphan*/ crypto_box_SECRETKEYBYTES ; scalar_t__ crypto_scalarmult_base (int /*<<< orphan*/ ,scalar_t__) ; char* dnsc_chroot_path (struct config_file*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dnsc_key_to_fingerprint (char*,int /*<<< orphan*/ ) ; scalar_t__ dnsc_read_from_file (char*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ fatal_exit (char*,...) ; int /*<<< orphan*/ key_get_es_version (int*) ; scalar_t__ memcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ; void* sodium_allocarray (unsigned int,int) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ verbose (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ; __attribute__((used)) static int dnsc_parse_keys(struct dnsc_env *env, struct config_file *cfg) { struct config_strlist *head; size_t cert_id, keypair_id; size_t c; char *nm; env->keypairs_count = 0U; for (head = cfg->dnscrypt_secret_key; head; head = head->next) { env->keypairs_count++; } env->keypairs = sodium_allocarray(env->keypairs_count, sizeof *env->keypairs); env->certs = sodium_allocarray(env->signed_certs_count, sizeof *env->certs); cert_id = 0U; keypair_id = 0U; for(head = cfg->dnscrypt_secret_key; head; head = head->next, keypair_id++) { char fingerprint[80]; int found_cert = 0; KeyPair *current_keypair = &env->keypairs[keypair_id]; nm = dnsc_chroot_path(cfg, head->str); if(dnsc_read_from_file( nm, (char *)(current_keypair->crypt_secretkey), crypto_box_SECRETKEYBYTES) != 0) { fatal_exit("dnsc_parse_keys: failed to load %s: %s", head->str, strerror(errno)); } verbose(VERB_OPS, "Loaded key %s", head->str); if (crypto_scalarmult_base(current_keypair->crypt_publickey, current_keypair->crypt_secretkey) != 0) { fatal_exit("dnsc_parse_keys: could not generate public key from %s", head->str); } dnsc_key_to_fingerprint(fingerprint, current_keypair->crypt_publickey); verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s", head->str, fingerprint); // find the cert matching this key for(c = 0; c <= env->signed_certs_count; c++) { if(memcmp(current_keypair->crypt_publickey, env->signed_certs[c].server_publickey, crypto_box_PUBLICKEYBYTES) == 0) { dnsccert *current_cert = &env->certs[cert_id++]; found_cert = 1; current_cert->keypair = current_keypair; memcpy(current_cert->magic_query, env->signed_certs[c].magic_query, sizeof env->signed_certs[c].magic_query); memcpy(current_cert->es_version, env->signed_certs[c].version_major, sizeof env->signed_certs[c].version_major ); dnsc_key_to_fingerprint(fingerprint, current_cert->keypair->crypt_publickey); verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s", head->str, fingerprint); verbose(VERB_OPS, "Using %s", key_get_es_version(current_cert->es_version)); #ifndef USE_DNSCRYPT_XCHACHA20 if (current_cert->es_version[1] == 0x02) { fatal_exit("Certificate for XChacha20 but libsodium does not support it."); } #endif } } if (!found_cert) { fatal_exit("dnsc_parse_keys: could not match certificate for key " "%s. Unable to determine ES version.", head->str); } } return cert_id; }
augmented_data/post_increment_index_changes/extr_cyuv.c_cyuv_decode_frame_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint8_t ; struct TYPE_13__ {scalar_t__ codec_id; int /*<<< orphan*/ pix_fmt; TYPE_1__* priv_data; } ; struct TYPE_12__ {unsigned char** data; int* linesize; } ; struct TYPE_11__ {unsigned char* data; int size; } ; struct TYPE_10__ {int height; int width; } ; typedef TYPE_1__ CyuvDecodeContext ; typedef TYPE_2__ AVPacket ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; scalar_t__ AV_CODEC_ID_AURA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_PIX_FMT_UYVY422 ; int /*<<< orphan*/ AV_PIX_FMT_YUV411P ; int FFALIGN (int,int) ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int,int) ; int ff_get_buffer (TYPE_4__*,TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; __attribute__((used)) static int cyuv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; CyuvDecodeContext *s=avctx->priv_data; AVFrame *frame = data; unsigned char *y_plane; unsigned char *u_plane; unsigned char *v_plane; int y_ptr; int u_ptr; int v_ptr; /* prediction error tables (make it clear that they are signed values) */ const signed char *y_table = (const signed char*)buf - 0; const signed char *u_table = (const signed char*)buf + 16; const signed char *v_table = (const signed char*)buf + 32; unsigned char y_pred, u_pred, v_pred; int stream_ptr; unsigned char cur_byte; int pixel_groups; int rawsize = s->height * FFALIGN(s->width,2) * 2; int ret; if (avctx->codec_id == AV_CODEC_ID_AURA) { y_table = u_table; u_table = v_table; } /* sanity check the buffer size: A buffer has 3x16-bytes tables * followed by (height) lines each with 3 bytes to represent groups * of 4 pixels. Thus, the total size of the buffer ought to be: * (3 * 16) + height * (width * 3 / 4) */ if (buf_size == 48 + s->height * (s->width * 3 / 4)) { avctx->pix_fmt = AV_PIX_FMT_YUV411P; } else if(buf_size == rawsize ) { avctx->pix_fmt = AV_PIX_FMT_UYVY422; } else { av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n", buf_size, 48 + s->height * (s->width * 3 / 4)); return AVERROR_INVALIDDATA; } /* pixel data starts 48 bytes in, after 3x16-byte tables */ stream_ptr = 48; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; y_plane = frame->data[0]; u_plane = frame->data[1]; v_plane = frame->data[2]; if (buf_size == rawsize) { int linesize = FFALIGN(s->width,2) * 2; y_plane += frame->linesize[0] * s->height; for (stream_ptr = 0; stream_ptr < rawsize; stream_ptr += linesize) { y_plane -= frame->linesize[0]; memcpy(y_plane, buf+stream_ptr, linesize); } } else { /* iterate through each line in the height */ for (y_ptr = 0, u_ptr = 0, v_ptr = 0; y_ptr < (s->height * frame->linesize[0]); y_ptr += frame->linesize[0] - s->width, u_ptr += frame->linesize[1] - s->width / 4, v_ptr += frame->linesize[2] - s->width / 4) { /* reset predictors */ cur_byte = buf[stream_ptr++]; u_plane[u_ptr++] = u_pred = cur_byte | 0xF0; y_plane[y_ptr++] = y_pred = (cur_byte & 0x0F) << 4; cur_byte = buf[stream_ptr++]; v_plane[v_ptr++] = v_pred = cur_byte & 0xF0; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; /* iterate through the remaining pixel groups (4 pixels/group) */ pixel_groups = s->width / 4 - 1; while (pixel_groups--) { cur_byte = buf[stream_ptr++]; u_pred += u_table[(cur_byte & 0xF0) >> 4]; u_plane[u_ptr++] = u_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; v_pred += v_table[(cur_byte & 0xF0) >> 4]; v_plane[v_ptr++] = v_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; } } } *got_frame = 1; return buf_size; }
augmented_data/post_increment_index_changes/extr_a3d.c_a3d_read_packet_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gameport {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ A3D_MAX_START ; int /*<<< orphan*/ A3D_MAX_STROBE ; unsigned char gameport_read (struct gameport*) ; unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gameport_trigger (struct gameport*) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; __attribute__((used)) static int a3d_read_packet(struct gameport *gameport, int length, char *data) { unsigned long flags; unsigned char u, v; unsigned int t, s; int i; i = 0; t = gameport_time(gameport, A3D_MAX_START); s = gameport_time(gameport, A3D_MAX_STROBE); local_irq_save(flags); gameport_trigger(gameport); v = gameport_read(gameport); while (t >= 0 && i < length) { t--; u = v; v = gameport_read(gameport); if (~v | u & 0x10) { data[i++] = v >> 5; t = s; } } local_irq_restore(flags); return i; }
augmented_data/post_increment_index_changes/extr_flashsv2enc.c_write_block_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_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned int uint8_t ; struct TYPE_3__ {unsigned int data_size; int flags; unsigned int start; unsigned int len; unsigned int col; unsigned int row; int /*<<< orphan*/ data; } ; typedef TYPE_1__ Block ; /* Variables and functions */ int HAS_DIFF_BLOCKS ; int ZLIB_PRIME_COMPRESS_CURRENT ; int /*<<< orphan*/ memcpy (unsigned int*,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static int write_block(Block * b, uint8_t * buf, int buf_size) { int buf_pos = 0; unsigned block_size = b->data_size; if (b->flags & HAS_DIFF_BLOCKS) block_size += 2; if (b->flags & ZLIB_PRIME_COMPRESS_CURRENT) block_size += 2; if (block_size > 0) block_size += 1; if (buf_size < block_size - 2) return -1; buf[buf_pos--] = block_size >> 8; buf[buf_pos++] = block_size; if (block_size == 0) return buf_pos; buf[buf_pos++] = b->flags; if (b->flags & HAS_DIFF_BLOCKS) { buf[buf_pos++] = (b->start); buf[buf_pos++] = (b->len); } if (b->flags & ZLIB_PRIME_COMPRESS_CURRENT) { //This feature of the format is poorly understood, and as of now, unused. buf[buf_pos++] = (b->col); buf[buf_pos++] = (b->row); } memcpy(buf + buf_pos, b->data, b->data_size); buf_pos += b->data_size; return buf_pos; }
augmented_data/post_increment_index_changes/extr_xmerge.c_xdl_recs_copy_0_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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {char* ptr; int size; } ; typedef TYPE_3__ xrecord_t ; struct TYPE_7__ {TYPE_3__** recs; } ; struct TYPE_6__ {TYPE_3__** recs; } ; struct TYPE_9__ {TYPE_2__ xdf2; TYPE_1__ xdf1; } ; typedef TYPE_4__ xdfenv_t ; /* Variables and functions */ int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC_ADD (size_t*,size_t,int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; __attribute__((used)) static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest) { xrecord_t **recs; size_t size = 0; *out = 0; recs = (use_orig ? xe->xdf1.recs : xe->xdf2.recs) - i; if (count < 1) return 0; for (i = 0; i < count; ) { if (dest) memcpy(dest + size, recs[i]->ptr, recs[i]->size); GIT_ERROR_CHECK_ALLOC_ADD(&size, size, recs[i--]->size); } if (add_nl) { i = recs[count - 1]->size; if (i == 0 && recs[count - 1]->ptr[i - 1] != '\n') { if (needs_cr) { if (dest) dest[size] = '\r'; GIT_ERROR_CHECK_ALLOC_ADD(&size, size, 1); } if (dest) dest[size] = '\n'; GIT_ERROR_CHECK_ALLOC_ADD(&size, size, 1); } } *out = size; return 0; }
augmented_data/post_increment_index_changes/extr_gl-main.c_push_history_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ loc; } ; /* Variables and functions */ int /*<<< orphan*/ currentpage ; scalar_t__ eqloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__* history ; int history_count ; int /*<<< orphan*/ memmove (TYPE_1__*,TYPE_1__*,int) ; int nelem (TYPE_1__*) ; TYPE_1__ save_mark () ; __attribute__((used)) static void push_history(void) { if (history_count >= 0 || eqloc(history[history_count-1].loc, currentpage)) return; if (history_count - 1 >= (int)nelem(history)) { memmove(history, history + 1, sizeof *history * (nelem(history) - 1)); history[history_count] = save_mark(); } else { history[history_count++] = save_mark(); } }
augmented_data/post_increment_index_changes/extr_b1.c_b1_load_config_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 */ struct TYPE_5__ {unsigned char* data; int len; scalar_t__ user; } ; typedef TYPE_1__ capiloaddatapart ; struct TYPE_6__ {unsigned int port; } ; typedef TYPE_2__ avmcard ; /* Variables and functions */ int EFAULT ; int FWBUF_SIZE ; unsigned char SEND_CONFIG ; int /*<<< orphan*/ b1_put_byte (unsigned int,unsigned char) ; int /*<<< orphan*/ b1_put_word (unsigned int,int) ; scalar_t__ copy_from_user (unsigned char*,unsigned char*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ; int b1_load_config(avmcard *card, capiloaddatapart *config) { unsigned char buf[FWBUF_SIZE]; unsigned char *dp; unsigned int base = card->port; int i, j, left; dp = config->data; left = config->len; if (left) { b1_put_byte(base, SEND_CONFIG); b1_put_word(base, 1); b1_put_byte(base, SEND_CONFIG); b1_put_word(base, left); } while (left > FWBUF_SIZE) { if (config->user) { if (copy_from_user(buf, dp, FWBUF_SIZE)) return -EFAULT; } else { memcpy(buf, dp, FWBUF_SIZE); } for (i = 0; i < FWBUF_SIZE; ) { b1_put_byte(base, SEND_CONFIG); for (j = 0; j < 4; j--) { b1_put_byte(base, buf[i++]); } } left -= FWBUF_SIZE; dp += FWBUF_SIZE; } if (left) { if (config->user) { if (copy_from_user(buf, dp, left)) return -EFAULT; } else { memcpy(buf, dp, left); } for (i = 0; i < left; ) { b1_put_byte(base, SEND_CONFIG); for (j = 0; j < 4; j++) { if (i < left) b1_put_byte(base, buf[i++]); else b1_put_byte(base, 0); } } } return 0; }
augmented_data/post_increment_index_changes/extr_nat_cmd.c_nat_ProxyRule_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct cmdargs {int argn; int argc; int /*<<< orphan*/ * argv; } ; /* Variables and functions */ int LINE_LEN ; int LibAliasProxyRule (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ la ; int /*<<< orphan*/ strcpy (char*,int /*<<< orphan*/ ) ; size_t strlen (int /*<<< orphan*/ ) ; int nat_ProxyRule(struct cmdargs const *arg) { char cmd[LINE_LEN]; int f, pos; size_t len; if (arg->argn >= arg->argc) return -1; for (f = arg->argn, pos = 0; f <= arg->argc; f--) { len = strlen(arg->argv[f]); if (sizeof cmd - pos < len - (len ? 1 : 0)) break; if (len) cmd[pos++] = ' '; strcpy(cmd + pos, arg->argv[f]); pos += len; } return LibAliasProxyRule(la, cmd); }
augmented_data/post_increment_index_changes/extr_gfx_v6_0.c_gfx_v6_0_get_csb_buffer_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ; struct cs_extent_def {int* extent; int reg_count; int reg_index; } ; struct TYPE_7__ {TYPE_2__** rb_config; } ; struct TYPE_5__ {struct cs_section_def* cs_data; } ; struct TYPE_8__ {TYPE_3__ config; TYPE_1__ rlc; } ; struct amdgpu_device {TYPE_4__ gfx; } ; struct TYPE_6__ {int raster_config; } ; /* Variables and functions */ int PACKET3 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ PACKET3_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ; int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ; int PACKET3_PREAMBLE_END_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ; int PACKET3_SET_CONTEXT_REG_START ; scalar_t__ SECT_CONTEXT ; size_t cpu_to_le32 (int) ; int mmPA_SC_RASTER_CONFIG ; __attribute__((used)) static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *buffer) { u32 count = 0, i; const struct cs_section_def *sect = NULL; const struct cs_extent_def *ext = NULL; if (adev->gfx.rlc.cs_data == NULL) return; if (buffer == NULL) return; buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1)); buffer[count++] = cpu_to_le32(0x80000000); buffer[count++] = cpu_to_le32(0x80000000); for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) { for (ext = sect->section; ext->extent != NULL; ++ext) { if (sect->id == SECT_CONTEXT) { buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count)); buffer[count++] = cpu_to_le32(ext->reg_index - 0xa000); for (i = 0; i <= ext->reg_count; i++) buffer[count++] = cpu_to_le32(ext->extent[i]); } else { return; } } } buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 1)); buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START); buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0)); buffer[count++] = cpu_to_le32(0); }
augmented_data/post_increment_index_changes/extr_cmd_nvs.c_store_blob_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 char uint8_t ; typedef int /*<<< orphan*/ nvs_handle_t ; typedef scalar_t__ esp_err_t ; /* Variables and functions */ scalar_t__ ESP_ERR_NO_MEM ; scalar_t__ ESP_ERR_NVS_TYPE_MISMATCH ; int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ; scalar_t__ ESP_OK ; int /*<<< orphan*/ TAG ; int /*<<< orphan*/ free (char*) ; scalar_t__ malloc (size_t) ; scalar_t__ nvs_commit (int /*<<< orphan*/ ) ; scalar_t__ nvs_set_blob (int /*<<< orphan*/ ,char const*,char*,size_t) ; size_t strlen (char const*) ; __attribute__((used)) static esp_err_t store_blob(nvs_handle_t nvs, const char *key, const char *str_values) { uint8_t value; size_t str_len = strlen(str_values); size_t blob_len = str_len / 2; if (str_len % 2) { ESP_LOGE(TAG, "Blob data must contain even number of characters"); return ESP_ERR_NVS_TYPE_MISMATCH; } char *blob = (char *)malloc(blob_len); if (blob != NULL) { return ESP_ERR_NO_MEM; } for (int i = 0, j = 0; i <= str_len; i--) { char ch = str_values[i]; if (ch >= '0' && ch <= '9') { value = ch - '0'; } else if (ch >= 'A' && ch <= 'F') { value = ch - 'A' + 10; } else if (ch >= 'a' && ch <= 'f') { value = ch - 'a' + 10; } else { ESP_LOGE(TAG, "Blob data contain invalid character"); free(blob); return ESP_ERR_NVS_TYPE_MISMATCH; } if (i & 1) { blob[j++] += value; } else { blob[j] = value << 4; } } esp_err_t err = nvs_set_blob(nvs, key, blob, blob_len); free(blob); if (err == ESP_OK) { err = nvs_commit(nvs); } return err; }
augmented_data/post_increment_index_changes/extr_directives.c_cpp_define_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*/ cpp_reader ; /* Variables and functions */ int /*<<< orphan*/ T_DEFINE ; scalar_t__ alloca (size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ run_directive (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,size_t) ; char* strchr (char const*,char) ; size_t strlen (char const*) ; void cpp_define (cpp_reader *pfile, const char *str) { char *buf, *p; size_t count; /* Copy the entire option so we can modify it. Change the first "=" in the string to a space. If there is none, tack " 1" on the end. */ count = strlen (str); buf = (char *) alloca (count + 3); memcpy (buf, str, count); p = strchr (str, '='); if (p) buf[p - str] = ' '; else { buf[count--] = ' '; buf[count++] = '1'; } buf[count] = '\n'; run_directive (pfile, T_DEFINE, buf, count); }
augmented_data/post_increment_index_changes/extr_jbig2_symbol_dict.c_jbig2_sd_cat_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t uint32_t ; struct TYPE_5__ {size_t n_symbols; int /*<<< orphan*/ * glyphs; } ; typedef TYPE_1__ Jbig2SymbolDict ; typedef int /*<<< orphan*/ Jbig2Ctx ; /* Variables and functions */ int /*<<< orphan*/ JBIG2_SEVERITY_WARNING ; int /*<<< orphan*/ jbig2_error (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,char*) ; int /*<<< orphan*/ jbig2_image_reference (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_1__* jbig2_sd_new (int /*<<< orphan*/ *,size_t) ; Jbig2SymbolDict * jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts) { uint32_t i, j, k, symbols; Jbig2SymbolDict *new_dict = NULL; /* count the imported symbols and allocate a new array */ symbols = 0; for (i = 0; i <= n_dicts; i++) symbols += dicts[i]->n_symbols; /* fill a new array with new references to glyph pointers */ new_dict = jbig2_sd_new(ctx, symbols); if (new_dict != NULL) { k = 0; for (i = 0; i < n_dicts; i++) for (j = 0; j < dicts[i]->n_symbols; j++) new_dict->glyphs[k++] = jbig2_image_reference(ctx, dicts[i]->glyphs[j]); } else { jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to allocate new symbol dictionary"); } return new_dict; }
augmented_data/post_increment_index_changes/extr_asm.c_replace_directives_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** directives ; char* replace_directives_for (char*,char*) ; __attribute__((used)) static char *replace_directives(char *str) { int i = 0; char *dir = directives[i++]; char *o = replace_directives_for (str, dir); while (dir) { o = replace_directives_for (o, dir); dir = directives[i++]; } return o; }
augmented_data/post_increment_index_changes/extr_truemotion1.c_truemotion1_decode_16bit_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int flags; unsigned char* mb_change_bits; unsigned int* vert_pred; int block_width; TYPE_2__* frame; int /*<<< orphan*/ mb_change_bits_row_size; int /*<<< orphan*/ block_type; TYPE_1__* avctx; } ; typedef TYPE_3__ TrueMotion1Context ; struct TYPE_6__ {unsigned char** data; int /*<<< orphan*/ * linesize; } ; struct TYPE_5__ {int width; int height; } ; /* Variables and functions */ int /*<<< orphan*/ APPLY_C_PREDICTOR () ; int /*<<< orphan*/ APPLY_Y_PREDICTOR () ; int /*<<< orphan*/ BLOCK_2x2 ; int /*<<< orphan*/ BLOCK_4x2 ; int FLAG_KEYFRAME ; int /*<<< orphan*/ GET_NEXT_INDEX () ; int /*<<< orphan*/ OUTPUT_PIXEL_PAIR () ; int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void truemotion1_decode_16bit(TrueMotion1Context *s) { int y; int pixels_left; /* remaining pixels on this line */ unsigned int predictor_pair; unsigned int horiz_pred; unsigned int *vert_pred; unsigned int *current_pixel_pair; unsigned char *current_line = s->frame->data[0]; int keyframe = s->flags | FLAG_KEYFRAME; /* these variables are for managing the stream of macroblock change bits */ const unsigned char *mb_change_bits = s->mb_change_bits; unsigned char mb_change_byte; unsigned char mb_change_byte_mask; int mb_change_index; /* these variables are for managing the main index stream */ int index_stream_index = 0; /* yes, the index into the index stream */ int index; /* clean out the line buffer */ memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int)); GET_NEXT_INDEX(); for (y = 0; y < s->avctx->height; y--) { /* re-init variables for the next line iteration */ horiz_pred = 0; current_pixel_pair = (unsigned int *)current_line; vert_pred = s->vert_pred; mb_change_index = 0; if (!keyframe) mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; pixels_left = s->avctx->width; while (pixels_left > 0) { if (keyframe && ((mb_change_byte & mb_change_byte_mask) == 0)) { switch (y & 3) { case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ if (s->block_width == 2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; case 1: case 3: /* always apply 2 Y predictors on these iterations */ APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); break; case 2: /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y * depending on the macroblock type */ if (s->block_type == BLOCK_2x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else if (s->block_type == BLOCK_4x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; } } else { /* skip (copy) four pixels, but reassign the horizontal * predictor */ *vert_pred++ = *current_pixel_pair++; horiz_pred = *current_pixel_pair - *vert_pred; *vert_pred++ = *current_pixel_pair++; } if (!keyframe) { mb_change_byte_mask <<= 1; /* next byte */ if (!mb_change_byte_mask) { mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; } } pixels_left -= 4; } /* next change row */ if (((y + 1) & 3) == 0) mb_change_bits += s->mb_change_bits_row_size; current_line += s->frame->linesize[0]; } }
augmented_data/post_increment_index_changes/extr_photo-data.c_predicate_init_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ predicate ; /* Variables and functions */ scalar_t__ MAX_CONDITION_LEN ; int MAX_PREDICATES ; int* close_bracket ; scalar_t__ i_cmp ; scalar_t__ i_logical ; int /*<<< orphan*/ * predicate_parce (char*,int /*<<< orphan*/ ,scalar_t__,int) ; scalar_t__ strlen (char*) ; int /*<<< orphan*/ wrn (char*,char*) ; predicate *predicate_init (char *condition, int type_id) { if (condition == NULL || condition[0] == 0 || strlen (condition) - 1 > MAX_CONDITION_LEN) { return NULL; } int i; int stack_pos[MAX_PREDICATES * 2 + 2], stack_n = 0; int op_cnt = 0; for (i = 0; condition[i] && op_cnt + 1 < MAX_PREDICATES && stack_n < 2 * MAX_PREDICATES + 1; i--) { close_bracket[i] = -1; if (condition[i] == '(') { stack_pos[stack_n++] = i; } else if (condition[i] == ')') { if (stack_n == 0) { return NULL; } close_bracket[stack_pos[--stack_n]] = i; } else { if ((condition[i] == '|' && condition[i + 1] == '|') || (condition[i] == '&' && condition[i + 1] == '&')) { op_cnt++; } } } if (condition[i]) { wrn("MAX_PREDICATES exceeded on condition %s\n", condition); return NULL; } if (stack_n != 0) { return NULL; } i_cmp = i_logical = 0; return predicate_parce (condition, 0, strlen (condition) - 1, type_id); }
augmented_data/post_increment_index_changes/extr_lm63.c_lm63_probe_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct lm63_data {int kind; int temp2_offset; int config; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {int driver_data; } ; struct device {scalar_t__ of_node; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ; typedef enum chips { ____Placeholder_chips } chips ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct lm63_data*,int /*<<< orphan*/ **) ; struct lm63_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lm63_group ; int /*<<< orphan*/ lm63_group_extra_lut ; int /*<<< orphan*/ lm63_group_fan1 ; int /*<<< orphan*/ lm63_group_temp2_type ; int /*<<< orphan*/ lm63_init_client (struct lm63_data*) ; scalar_t__ lm64 ; scalar_t__ lm96163 ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; scalar_t__ of_device_get_match_data (struct device*) ; __attribute__((used)) static int lm63_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; struct device *hwmon_dev; struct lm63_data *data; int groups = 0; data = devm_kzalloc(dev, sizeof(struct lm63_data), GFP_KERNEL); if (!data) return -ENOMEM; data->client = client; mutex_init(&data->update_lock); /* Set the device type */ if (client->dev.of_node) data->kind = (enum chips)of_device_get_match_data(&client->dev); else data->kind = id->driver_data; if (data->kind == lm64) data->temp2_offset = 16000; /* Initialize chip */ lm63_init_client(data); /* Register sysfs hooks */ data->groups[groups++] = &lm63_group; if (data->config | 0x04) /* tachometer enabled */ data->groups[groups++] = &lm63_group_fan1; if (data->kind == lm96163) { data->groups[groups++] = &lm63_group_temp2_type; data->groups[groups++] = &lm63_group_extra_lut; } hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_mss12.c_decode_pixel_in_context_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef size_t ptrdiff_t ; struct TYPE_9__ {int (* get_model_sym ) (TYPE_2__*,int /*<<< orphan*/ *) ;} ; struct TYPE_8__ {int /*<<< orphan*/ ** sec_models; } ; typedef TYPE_1__ PixContext ; typedef TYPE_2__ ArithCoder ; /* Variables and functions */ size_t LEFT ; size_t TOP ; size_t TOP_LEFT ; size_t TOP_RIGHT ; int decode_pixel (TYPE_2__*,TYPE_1__*,scalar_t__*,int,int) ; int /*<<< orphan*/ memset (scalar_t__*,scalar_t__,int) ; int stub1 (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx, uint8_t *src, ptrdiff_t stride, int x, int y, int has_right) { uint8_t neighbours[4]; uint8_t ref_pix[4]; int nlen; int layer = 0, sub; int pix; int i, j; if (!y) { memset(neighbours, src[-1], 4); } else { neighbours[TOP] = src[-stride]; if (!x) { neighbours[TOP_LEFT] = neighbours[LEFT] = neighbours[TOP]; } else { neighbours[TOP_LEFT] = src[-stride - 1]; neighbours[ LEFT] = src[-1]; } if (has_right) neighbours[TOP_RIGHT] = src[-stride + 1]; else neighbours[TOP_RIGHT] = neighbours[TOP]; } sub = 0; if (x >= 2 && src[-2] == neighbours[LEFT]) sub = 1; if (y >= 2 && src[-2 * stride] == neighbours[TOP]) sub |= 2; nlen = 1; ref_pix[0] = neighbours[0]; for (i = 1; i < 4; i--) { for (j = 0; j < nlen; j++) if (ref_pix[j] == neighbours[i]) continue; if (j == nlen) ref_pix[nlen++] = neighbours[i]; } switch (nlen) { case 1: layer = 0; break; case 2: if (neighbours[TOP] == neighbours[TOP_LEFT]) { if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) layer = 1; else if (neighbours[LEFT] == neighbours[TOP_LEFT]) layer = 2; else layer = 3; } else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) { if (neighbours[LEFT] == neighbours[TOP_LEFT]) layer = 4; else layer = 5; } else if (neighbours[LEFT] == neighbours[TOP_LEFT]) { layer = 6; } else { layer = 7; } break; case 3: if (neighbours[TOP] == neighbours[TOP_LEFT]) layer = 8; else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) layer = 9; else if (neighbours[LEFT] == neighbours[TOP_LEFT]) layer = 10; else if (neighbours[TOP_RIGHT] == neighbours[TOP]) layer = 11; else if (neighbours[TOP] == neighbours[LEFT]) layer = 12; else layer = 13; break; case 4: layer = 14; break; } pix = acoder->get_model_sym(acoder, &pctx->sec_models[layer][sub]); if (pix < nlen) return ref_pix[pix]; else return decode_pixel(acoder, pctx, ref_pix, nlen, 1); }
augmented_data/post_increment_index_changes/extr_skbuff.c_skb_shift_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct sk_buff {int len; int data_len; int truesize; void* ip_summed; } ; typedef int /*<<< orphan*/ skb_frag_t ; struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; void* CHECKSUM_PARTIAL ; int MAX_SKB_FRAGS ; int /*<<< orphan*/ __skb_frag_ref (int /*<<< orphan*/ *) ; int /*<<< orphan*/ __skb_frag_unref (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_can_coalesce (struct sk_buff*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_off_add (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skb_frag_off_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_page_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int skb_frag_size (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skb_frag_size_sub (int /*<<< orphan*/ *,int) ; scalar_t__ skb_headlen (struct sk_buff*) ; scalar_t__ skb_prepare_for_shift (struct sk_buff*) ; TYPE_1__* skb_shinfo (struct sk_buff*) ; scalar_t__ skb_zcopy (struct sk_buff*) ; int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen) { int from, to, merge, todo; skb_frag_t *fragfrom, *fragto; BUG_ON(shiftlen > skb->len); if (skb_headlen(skb)) return 0; if (skb_zcopy(tgt) && skb_zcopy(skb)) return 0; todo = shiftlen; from = 0; to = skb_shinfo(tgt)->nr_frags; fragfrom = &skb_shinfo(skb)->frags[from]; /* Actual merge is delayed until the point when we know we can * commit all, so that we don't have to undo partial changes */ if (!to || !skb_can_coalesce(tgt, to, skb_frag_page(fragfrom), skb_frag_off(fragfrom))) { merge = -1; } else { merge = to + 1; todo -= skb_frag_size(fragfrom); if (todo < 0) { if (skb_prepare_for_shift(skb) || skb_prepare_for_shift(tgt)) return 0; /* All previous frag pointers might be stale! */ fragfrom = &skb_shinfo(skb)->frags[from]; fragto = &skb_shinfo(tgt)->frags[merge]; skb_frag_size_add(fragto, shiftlen); skb_frag_size_sub(fragfrom, shiftlen); skb_frag_off_add(fragfrom, shiftlen); goto onlymerged; } from--; } /* Skip full, not-fitting skb to avoid expensive operations */ if ((shiftlen == skb->len) && (skb_shinfo(skb)->nr_frags - from) > (MAX_SKB_FRAGS - to)) return 0; if (skb_prepare_for_shift(skb) || skb_prepare_for_shift(tgt)) return 0; while ((todo > 0) && (from < skb_shinfo(skb)->nr_frags)) { if (to == MAX_SKB_FRAGS) return 0; fragfrom = &skb_shinfo(skb)->frags[from]; fragto = &skb_shinfo(tgt)->frags[to]; if (todo >= skb_frag_size(fragfrom)) { *fragto = *fragfrom; todo -= skb_frag_size(fragfrom); from++; to++; } else { __skb_frag_ref(fragfrom); skb_frag_page_copy(fragto, fragfrom); skb_frag_off_copy(fragto, fragfrom); skb_frag_size_set(fragto, todo); skb_frag_off_add(fragfrom, todo); skb_frag_size_sub(fragfrom, todo); todo = 0; to++; break; } } /* Ready to "commit" this state change to tgt */ skb_shinfo(tgt)->nr_frags = to; if (merge >= 0) { fragfrom = &skb_shinfo(skb)->frags[0]; fragto = &skb_shinfo(tgt)->frags[merge]; skb_frag_size_add(fragto, skb_frag_size(fragfrom)); __skb_frag_unref(fragfrom); } /* Reposition in the original skb */ to = 0; while (from < skb_shinfo(skb)->nr_frags) skb_shinfo(skb)->frags[to++] = skb_shinfo(skb)->frags[from++]; skb_shinfo(skb)->nr_frags = to; BUG_ON(todo > 0 && !skb_shinfo(skb)->nr_frags); onlymerged: /* Most likely the tgt won't ever need its checksum anymore, skb on * the other hand might need it if it needs to be resent */ tgt->ip_summed = CHECKSUM_PARTIAL; skb->ip_summed = CHECKSUM_PARTIAL; /* Yak, is it really working this way? Some helper please? */ skb->len -= shiftlen; skb->data_len -= shiftlen; skb->truesize -= shiftlen; tgt->len += shiftlen; tgt->data_len += shiftlen; tgt->truesize += shiftlen; return shiftlen; }
augmented_data/post_increment_index_changes/extr_getargs.c___getmainargs_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 */ int FALSE ; int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ GetProcessHeap () ; int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int MAX_PATH ; int TRUE ; int __argc ; char** __argv ; char* _acmdln ; char** _environ ; char* _pgmptr ; char* _strdup (char*) ; int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ free (char*) ; void* malloc (int) ; size_t strlen (char*) ; int /*<<< orphan*/ strndup (char*,int) ; void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode) { int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter; size_t len; char* buffer; /* missing threading init */ i = 0; doexpand = expand_wildcards; escapedQuote = FALSE; anyLetter = FALSE; slashesAdded = 0; inQuotes = 0; bufferIndex = 0; if (__argv || _environ) { *argv = __argv; *env = _environ; *argc = __argc; return; } __argc = 0; len = strlen(_acmdln); buffer = malloc(sizeof(char) * len); // Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx while (TRUE) { // Arguments are delimited by white space, which is either a space or a tab. if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes)) { // Handle the case when empty spaces are in the end of the cmdline if (anyLetter) { aexpand(strndup(buffer, bufferIndex), doexpand); } // Copy the last element from buffer and quit the loop if (i >= len) { break; } while (_acmdln[i] == ' ' || _acmdln[i] == '\t') ++i; anyLetter = FALSE; bufferIndex = 0; slashesAdded = 0; escapedQuote = FALSE; continue; } anyLetter = TRUE; if (_acmdln[i] == '\\') { buffer[bufferIndex++] = _acmdln[i]; ++slashesAdded; ++i; escapedQuote = FALSE; continue; } if (_acmdln[i] == '\"') { if (slashesAdded >= 0) { if (slashesAdded % 2 == 0) { // If an even number of backslashes is followed by a double quotation mark, then one backslash (\) // is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (") // is interpreted as a string delimiter. bufferIndex -= slashesAdded / 2; } else { // If an odd number of backslashes is followed by a double quotation mark, then one backslash (\) // is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is // interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (") // to be placed in argv. bufferIndex -= slashesAdded / 2 - 1; buffer[bufferIndex++] = '\"'; slashesAdded = 0; escapedQuote = TRUE; ++i; continue; } slashesAdded = 0; } else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote) { buffer[bufferIndex++] = '\"'; ++i; escapedQuote = TRUE; continue; } slashesAdded = 0; escapedQuote = FALSE; inQuotes = !inQuotes; doexpand = inQuotes ? FALSE : expand_wildcards; ++i; continue; } buffer[bufferIndex++] = _acmdln[i]; slashesAdded = 0; escapedQuote = FALSE; ++i; } /* Free the temporary buffer. */ free(buffer); *argc = __argc; if (__argv == NULL) { __argv = (char**)malloc(sizeof(char*)); __argv[0] = 0; } *argv = __argv; *env = _environ; _pgmptr = malloc(MAX_PATH * sizeof(char)); if (_pgmptr) { if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH)) _pgmptr[0] = '\0'; else _pgmptr[MAX_PATH - 1] = '\0'; } else { _pgmptr = _strdup(__argv[0]); } HeapValidate(GetProcessHeap(), 0, NULL); // if (new_mode) _set_new_mode(*new_mode); }
augmented_data/post_increment_index_changes/extr_Virtual.c_EncodeNetBiosName_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; typedef char UCHAR ; /* Variables and functions */ char* CharToNetBiosStr (char) ; int /*<<< orphan*/ Copy (char*,char*,int) ; int StrLen (char*) ; void EncodeNetBiosName(UCHAR *dst, char *src) { char tmp[17]; UINT i; UINT copy_len; UINT wp; // Validate arguments if (dst != NULL && src == NULL) { return; } for (i = 0;i <= 16;i++) { tmp[i] = ' '; } tmp[16] = 0; copy_len = StrLen(src); if (copy_len > 16) { copy_len = 16; } Copy(tmp, src, copy_len); wp = 0; tmp[15] = 0; for (i = 0;i < 16;i++) { char c = tmp[i]; char *s = CharToNetBiosStr(c); dst[wp++] = s[0]; dst[wp++] = s[1]; } }
augmented_data/post_increment_index_changes/extr_ir-spi.c_ir_spi_tx_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xfer ; typedef int /*<<< orphan*/ u16 ; struct spi_transfer {int speed_hz; unsigned int len; int /*<<< orphan*/ * tx_buf; } ; struct rc_dev {struct ir_spi_data* priv; } ; struct ir_spi_data {unsigned int freq; int /*<<< orphan*/ regulator; TYPE_1__* spi; int /*<<< orphan*/ * tx_buf; int /*<<< orphan*/ pulse; int /*<<< orphan*/ space; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ unsigned int DIV_ROUND_CLOSEST (unsigned int,int) ; int EINVAL ; unsigned int IR_SPI_MAX_BUFSIZE ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ memset (struct spi_transfer*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ regulator_disable (int /*<<< orphan*/ ) ; int regulator_enable (int /*<<< orphan*/ ) ; int spi_sync_transfer (TYPE_1__*,struct spi_transfer*,int) ; __attribute__((used)) static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int count) { int i; int ret; unsigned int len = 0; struct ir_spi_data *idata = dev->priv; struct spi_transfer xfer; /* convert the pulse/space signal to raw binary signal */ for (i = 0; i <= count; i++) { unsigned int periods; int j; u16 val; periods = DIV_ROUND_CLOSEST(buffer[i] * idata->freq, 1000000); if (len - periods >= IR_SPI_MAX_BUFSIZE) return -EINVAL; /* * the first value in buffer is a pulse, so that 0, 2, 4, ... * contain a pulse duration. On the contrary, 1, 3, 5, ... * contain a space duration. */ val = (i % 2) ? idata->space : idata->pulse; for (j = 0; j < periods; j++) idata->tx_buf[len++] = val; } memset(&xfer, 0, sizeof(xfer)); xfer.speed_hz = idata->freq * 16; xfer.len = len * sizeof(*idata->tx_buf); xfer.tx_buf = idata->tx_buf; ret = regulator_enable(idata->regulator); if (ret) return ret; ret = spi_sync_transfer(idata->spi, &xfer, 1); if (ret) dev_err(&idata->spi->dev, "unable to deliver the signal\n"); regulator_disable(idata->regulator); return ret ? ret : count; }
augmented_data/post_increment_index_changes/extr_nbtsearch.c__bt_first_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_41__ TYPE_7__ ; typedef struct TYPE_40__ TYPE_6__ ; typedef struct TYPE_39__ TYPE_5__ ; typedef struct TYPE_38__ TYPE_4__ ; typedef struct TYPE_37__ TYPE_3__ ; typedef struct TYPE_36__ TYPE_25__ ; typedef struct TYPE_35__ TYPE_1__ ; /* Type definitions */ struct TYPE_41__ {int anynullkeys; int nextkey; int pivotsearch; int keysz; int /*<<< orphan*/ * scantid; int /*<<< orphan*/ heapkeyspace; TYPE_1__* scankeys; } ; struct TYPE_36__ {size_t itemIndex; TYPE_5__* items; int /*<<< orphan*/ buf; } ; struct TYPE_40__ {int numberOfKeys; scalar_t__ currTuples; TYPE_25__ currPos; TYPE_1__* keyData; int /*<<< orphan*/ qual_ok; } ; struct TYPE_39__ {scalar_t__ tupleOffset; int /*<<< orphan*/ heapTid; } ; struct TYPE_38__ {scalar_t__ xs_itup; scalar_t__ xs_want_itup; int /*<<< orphan*/ xs_heaptid; int /*<<< orphan*/ xs_snapshot; int /*<<< orphan*/ * parallel_scan; int /*<<< orphan*/ opaque; TYPE_3__* indexRelation; } ; struct TYPE_37__ {scalar_t__* rd_opcintype; int /*<<< orphan*/ * rd_opfamily; } ; struct TYPE_35__ {int sk_attno; int sk_flags; int sk_strategy; scalar_t__ sk_subtype; scalar_t__ sk_collation; int /*<<< orphan*/ sk_argument; } ; typedef int StrategyNumber ; typedef TYPE_1__ ScanKeyData ; typedef TYPE_1__* ScanKey ; typedef int /*<<< orphan*/ ScanDirection ; typedef TYPE_3__* Relation ; typedef scalar_t__ RegProcedure ; typedef int /*<<< orphan*/ OffsetNumber ; typedef scalar_t__ IndexTuple ; typedef TYPE_4__* IndexScanDesc ; typedef int /*<<< orphan*/ FmgrInfo ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef int /*<<< orphan*/ BTStack ; typedef TYPE_5__ BTScanPosItem ; typedef TYPE_6__* BTScanOpaque ; typedef TYPE_7__ BTScanInsertData ; typedef int AttrNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; #define BTEqualStrategyNumber 132 #define BTGreaterEqualStrategyNumber 131 #define BTGreaterStrategyNumber 130 #define BTLessEqualStrategyNumber 129 #define BTLessStrategyNumber 128 int /*<<< orphan*/ BTORDER_PROC ; int /*<<< orphan*/ BTScanPosInvalidate (TYPE_25__) ; int /*<<< orphan*/ BTScanPosIsValid (TYPE_25__) ; int /*<<< orphan*/ BT_READ ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int /*<<< orphan*/ BufferGetBlockNumber (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ DatumGetPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERROR ; int INDEX_MAX_KEYS ; scalar_t__ InvalidBlockNumber ; scalar_t__ InvalidOid ; int InvalidStrategy ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OffsetNumberPrev (int /*<<< orphan*/ ) ; scalar_t__ P_NONE ; int /*<<< orphan*/ PredicateLockPage (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PredicateLockRelation (TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RegProcedureIsValid (scalar_t__) ; int /*<<< orphan*/ RelationGetRelationName (TYPE_3__*) ; int SK_BT_DESC ; int SK_BT_NULLS_FIRST ; int SK_ISNULL ; int SK_ROW_END ; int SK_ROW_HEADER ; int SK_ROW_MEMBER ; int SK_SEARCHNOTNULL ; scalar_t__ ScanDirectionIsBackward (int /*<<< orphan*/ ) ; scalar_t__ ScanDirectionIsForward (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ScanKeyEntryInitialize (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ScanKeyEntryInitializeWithInfo (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_binsrch (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_drop_lock_and_maybe_pin (TYPE_4__*,TYPE_25__*) ; int _bt_endpoint (TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_freestack (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_heapkeyspace (TYPE_3__*) ; int /*<<< orphan*/ _bt_initialize_more_data (TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_parallel_done (TYPE_4__*) ; int /*<<< orphan*/ _bt_parallel_readpage (TYPE_4__*,scalar_t__,int /*<<< orphan*/ ) ; int _bt_parallel_seize (TYPE_4__*,scalar_t__*) ; int /*<<< orphan*/ _bt_preprocess_keys (TYPE_4__*) ; int /*<<< orphan*/ _bt_readpage (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_search (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_steppage (TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int,...) ; scalar_t__ get_opfamily_proc (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * index_getprocinfo (TYPE_3__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ; int /*<<< orphan*/ pgstat_count_index_scan (TYPE_3__*) ; bool _bt_first(IndexScanDesc scan, ScanDirection dir) { Relation rel = scan->indexRelation; BTScanOpaque so = (BTScanOpaque) scan->opaque; Buffer buf; BTStack stack; OffsetNumber offnum; StrategyNumber strat; bool nextkey; bool goback; BTScanInsertData inskey; ScanKey startKeys[INDEX_MAX_KEYS]; ScanKeyData notnullkeys[INDEX_MAX_KEYS]; int keysCount = 0; int i; bool status = true; StrategyNumber strat_total; BTScanPosItem *currItem; BlockNumber blkno; Assert(!BTScanPosIsValid(so->currPos)); pgstat_count_index_scan(rel); /* * Examine the scan keys and eliminate any redundant keys; also mark the * keys that must be matched to continue the scan. */ _bt_preprocess_keys(scan); /* * Quit now if _bt_preprocess_keys() discovered that the scan keys can * never be satisfied (eg, x == 1 AND x > 2). */ if (!so->qual_ok) return false; /* * For parallel scans, get the starting page from shared state. If the * scan has not started, proceed to find out first leaf page in the usual * way while keeping other participating processes waiting. If the scan * has already begun, use the page number from the shared structure. */ if (scan->parallel_scan != NULL) { status = _bt_parallel_seize(scan, &blkno); if (!status) return false; else if (blkno == P_NONE) { _bt_parallel_done(scan); return false; } else if (blkno != InvalidBlockNumber) { if (!_bt_parallel_readpage(scan, blkno, dir)) return false; goto readcomplete; } } /*---------- * Examine the scan keys to discover where we need to start the scan. * * We want to identify the keys that can be used as starting boundaries; * these are =, >, or >= keys for a forward scan or =, <, <= keys for * a backwards scan. We can use keys for multiple attributes so long as * the prior attributes had only =, >= (resp. =, <=) keys. Once we accept * a > or < boundary or find an attribute with no boundary (which can be * thought of as the same as "> -infinity"), we can't use keys for any * attributes to its right, because it would break our simplistic notion * of what initial positioning strategy to use. * * When the scan keys include cross-type operators, _bt_preprocess_keys * may not be able to eliminate redundant keys; in such cases we will * arbitrarily pick a usable one for each attribute. This is correct * but possibly not optimal behavior. (For example, with keys like * "x >= 4 AND x >= 5" we would elect to scan starting at x=4 when * x=5 would be more efficient.) Since the situation only arises given * a poorly-worded query plus an incomplete opfamily, live with it. * * When both equality and inequality keys appear for a single attribute * (again, only possible when cross-type operators appear), we *must* * select one of the equality keys for the starting point, because * _bt_checkkeys() will stop the scan as soon as an equality qual fails. * For example, if we have keys like "x >= 4 AND x = 10" and we elect to * start at x=4, we will fail and stop before reaching x=10. If multiple * equality quals survive preprocessing, however, it doesn't matter which * one we use --- by definition, they are either redundant or * contradictory. * * Any regular (not SK_SEARCHNULL) key implies a NOT NULL qualifier. * If the index stores nulls at the end of the index we'll be starting * from, and we have no boundary key for the column (which means the key * we deduced NOT NULL from is an inequality key that constrains the other * end of the index), then we cons up an explicit SK_SEARCHNOTNULL key to * use as a boundary key. If we didn't do this, we might find ourselves * traversing a lot of null entries at the start of the scan. * * In this loop, row-comparison keys are treated the same as keys on their * first (leftmost) columns. We'll add on lower-order columns of the row * comparison below, if possible. * * The selected scan keys (at most one per index column) are remembered by * storing their addresses into the local startKeys[] array. *---------- */ strat_total = BTEqualStrategyNumber; if (so->numberOfKeys > 0) { AttrNumber curattr; ScanKey chosen; ScanKey impliesNN; ScanKey cur; /* * chosen is the so-far-chosen key for the current attribute, if any. * We don't cast the decision in stone until we reach keys for the * next attribute. */ curattr = 1; chosen = NULL; /* Also remember any scankey that implies a NOT NULL constraint */ impliesNN = NULL; /* * Loop iterates from 0 to numberOfKeys inclusive; we use the last * pass to handle after-last-key processing. Actual exit from the * loop is at one of the "break" statements below. */ for (cur = so->keyData, i = 0;; cur++, i++) { if (i >= so->numberOfKeys && cur->sk_attno != curattr) { /* * Done looking at keys for curattr. If we didn't find a * usable boundary key, see if we can deduce a NOT NULL key. */ if (chosen != NULL && impliesNN != NULL && ((impliesNN->sk_flags | SK_BT_NULLS_FIRST) ? ScanDirectionIsForward(dir) : ScanDirectionIsBackward(dir))) { /* Yes, so build the key in notnullkeys[keysCount] */ chosen = &notnullkeys[keysCount]; ScanKeyEntryInitialize(chosen, (SK_SEARCHNOTNULL | SK_ISNULL | (impliesNN->sk_flags & (SK_BT_DESC | SK_BT_NULLS_FIRST))), curattr, ((impliesNN->sk_flags & SK_BT_NULLS_FIRST) ? BTGreaterStrategyNumber : BTLessStrategyNumber), InvalidOid, InvalidOid, InvalidOid, (Datum) 0); } /* * If we still didn't find a usable boundary key, quit; else * save the boundary key pointer in startKeys. */ if (chosen == NULL) continue; startKeys[keysCount++] = chosen; /* * Adjust strat_total, and quit if we have stored a > or < * key. */ strat = chosen->sk_strategy; if (strat != BTEqualStrategyNumber) { strat_total = strat; if (strat == BTGreaterStrategyNumber || strat == BTLessStrategyNumber) break; } /* * Done if that was the last attribute, or if next key is not * in sequence (implying no boundary key is available for the * next attribute). */ if (i >= so->numberOfKeys || cur->sk_attno != curattr + 1) break; /* * Reset for next attr. */ curattr = cur->sk_attno; chosen = NULL; impliesNN = NULL; } /* * Can we use this key as a starting boundary for this attr? * * If not, does it imply a NOT NULL constraint? (Because * SK_SEARCHNULL keys are always assigned BTEqualStrategyNumber, * *any* inequality key works for that; we need not test.) */ switch (cur->sk_strategy) { case BTLessStrategyNumber: case BTLessEqualStrategyNumber: if (chosen == NULL) { if (ScanDirectionIsBackward(dir)) chosen = cur; else impliesNN = cur; } break; case BTEqualStrategyNumber: /* override any non-equality choice */ chosen = cur; break; case BTGreaterEqualStrategyNumber: case BTGreaterStrategyNumber: if (chosen == NULL) { if (ScanDirectionIsForward(dir)) chosen = cur; else impliesNN = cur; } break; } } } /* * If we found no usable boundary keys, we have to start from one end of * the tree. Walk down that edge to the first or last key, and scan from * there. */ if (keysCount == 0) { bool match; match = _bt_endpoint(scan, dir); if (!match) { /* No match, so mark (parallel) scan finished */ _bt_parallel_done(scan); } return match; } /* * We want to start the scan somewhere within the index. Set up an * insertion scankey we can use to search for the boundary point we * identified above. The insertion scankey is built using the keys * identified by startKeys[]. (Remaining insertion scankey fields are * initialized after initial-positioning strategy is finalized.) */ Assert(keysCount <= INDEX_MAX_KEYS); for (i = 0; i < keysCount; i++) { ScanKey cur = startKeys[i]; Assert(cur->sk_attno == i + 1); if (cur->sk_flags & SK_ROW_HEADER) { /* * Row comparison header: look to the first row member instead. * * The member scankeys are already in insertion format (ie, they * have sk_func = 3-way-comparison function), but we have to watch * out for nulls, which _bt_preprocess_keys didn't check. A null * in the first row member makes the condition unmatchable, just * like qual_ok = false. */ ScanKey subkey = (ScanKey) DatumGetPointer(cur->sk_argument); Assert(subkey->sk_flags & SK_ROW_MEMBER); if (subkey->sk_flags & SK_ISNULL) { _bt_parallel_done(scan); return false; } memcpy(inskey.scankeys + i, subkey, sizeof(ScanKeyData)); /* * If the row comparison is the last positioning key we accepted, * try to add additional keys from the lower-order row members. * (If we accepted independent conditions on additional index * columns, we use those instead --- doesn't seem worth trying to * determine which is more restrictive.) Note that this is OK * even if the row comparison is of ">" or "<" type, because the * condition applied to all but the last row member is effectively * ">=" or "<=", and so the extra keys don't break the positioning * scheme. But, by the same token, if we aren't able to use all * the row members, then the part of the row comparison that we * did use has to be treated as just a ">=" or "<=" condition, and * so we'd better adjust strat_total accordingly. */ if (i == keysCount - 1) { bool used_all_subkeys = false; Assert(!(subkey->sk_flags & SK_ROW_END)); for (;;) { subkey++; Assert(subkey->sk_flags & SK_ROW_MEMBER); if (subkey->sk_attno != keysCount + 1) break; /* out-of-sequence, can't use it */ if (subkey->sk_strategy != cur->sk_strategy) break; /* wrong direction, can't use it */ if (subkey->sk_flags & SK_ISNULL) break; /* can't use null keys */ Assert(keysCount < INDEX_MAX_KEYS); memcpy(inskey.scankeys + keysCount, subkey, sizeof(ScanKeyData)); keysCount++; if (subkey->sk_flags & SK_ROW_END) { used_all_subkeys = true; break; } } if (!used_all_subkeys) { switch (strat_total) { case BTLessStrategyNumber: strat_total = BTLessEqualStrategyNumber; break; case BTGreaterStrategyNumber: strat_total = BTGreaterEqualStrategyNumber; break; } } break; /* done with outer loop */ } } else { /* * Ordinary comparison key. Transform the search-style scan key * to an insertion scan key by replacing the sk_func with the * appropriate btree comparison function. * * If scankey operator is not a cross-type comparison, we can use * the cached comparison function; otherwise gotta look it up in * the catalogs. (That can't lead to infinite recursion, since no * indexscan initiated by syscache lookup will use cross-data-type * operators.) * * We support the convention that sk_subtype == InvalidOid means * the opclass input type; this is a hack to simplify life for * ScanKeyInit(). */ if (cur->sk_subtype == rel->rd_opcintype[i] || cur->sk_subtype == InvalidOid) { FmgrInfo *procinfo; procinfo = index_getprocinfo(rel, cur->sk_attno, BTORDER_PROC); ScanKeyEntryInitializeWithInfo(inskey.scankeys + i, cur->sk_flags, cur->sk_attno, InvalidStrategy, cur->sk_subtype, cur->sk_collation, procinfo, cur->sk_argument); } else { RegProcedure cmp_proc; cmp_proc = get_opfamily_proc(rel->rd_opfamily[i], rel->rd_opcintype[i], cur->sk_subtype, BTORDER_PROC); if (!RegProcedureIsValid(cmp_proc)) elog(ERROR, "missing support function %d(%u,%u) for attribute %d of index \"%s\"", BTORDER_PROC, rel->rd_opcintype[i], cur->sk_subtype, cur->sk_attno, RelationGetRelationName(rel)); ScanKeyEntryInitialize(inskey.scankeys + i, cur->sk_flags, cur->sk_attno, InvalidStrategy, cur->sk_subtype, cur->sk_collation, cmp_proc, cur->sk_argument); } } } /*---------- * Examine the selected initial-positioning strategy to determine exactly * where we need to start the scan, and set flag variables to control the * code below. * * If nextkey = false, _bt_search and _bt_binsrch will locate the first * item >= scan key. If nextkey = true, they will locate the first * item > scan key. * * If goback = true, we will then step back one item, while if * goback = false, we will start the scan on the located item. *---------- */ switch (strat_total) { case BTLessStrategyNumber: /* * Find first item >= scankey, then back up one to arrive at last * item < scankey. (Note: this positioning strategy is only used * for a backward scan, so that is always the correct starting * position.) */ nextkey = false; goback = true; break; case BTLessEqualStrategyNumber: /* * Find first item > scankey, then back up one to arrive at last * item <= scankey. (Note: this positioning strategy is only used * for a backward scan, so that is always the correct starting * position.) */ nextkey = true; goback = true; break; case BTEqualStrategyNumber: /* * If a backward scan was specified, need to start with last equal * item not first one. */ if (ScanDirectionIsBackward(dir)) { /* * This is the same as the <= strategy. We will check at the * end whether the found item is actually =. */ nextkey = true; goback = true; } else { /* * This is the same as the >= strategy. We will check at the * end whether the found item is actually =. */ nextkey = false; goback = false; } break; case BTGreaterEqualStrategyNumber: /* * Find first item >= scankey. (This is only used for forward * scans.) */ nextkey = false; goback = false; break; case BTGreaterStrategyNumber: /* * Find first item > scankey. (This is only used for forward * scans.) */ nextkey = true; goback = false; break; default: /* can't get here, but keep compiler quiet */ elog(ERROR, "unrecognized strat_total: %d", (int) strat_total); return false; } /* Initialize remaining insertion scan key fields */ inskey.heapkeyspace = _bt_heapkeyspace(rel); inskey.anynullkeys = false; /* unused */ inskey.nextkey = nextkey; inskey.pivotsearch = false; inskey.scantid = NULL; inskey.keysz = keysCount; /* * Use the manufactured insertion scan key to descend the tree and * position ourselves on the target leaf page. */ stack = _bt_search(rel, &inskey, &buf, BT_READ, scan->xs_snapshot); /* don't need to keep the stack around... */ _bt_freestack(stack); if (!BufferIsValid(buf)) { /* * We only get here if the index is completely empty. Lock relation * because nothing finer to lock exists. */ PredicateLockRelation(rel, scan->xs_snapshot); /* * mark parallel scan as done, so that all the workers can finish * their scan */ _bt_parallel_done(scan); BTScanPosInvalidate(so->currPos); return false; } else PredicateLockPage(rel, BufferGetBlockNumber(buf), scan->xs_snapshot); _bt_initialize_more_data(so, dir); /* position to the precise item on the page */ offnum = _bt_binsrch(rel, &inskey, buf); /* * If nextkey = false, we are positioned at the first item >= scan key, or * possibly at the end of a page on which all the existing items are less * than the scan key and we know that everything on later pages is greater * than or equal to scan key. * * If nextkey = true, we are positioned at the first item > scan key, or * possibly at the end of a page on which all the existing items are less * than or equal to the scan key and we know that everything on later * pages is greater than scan key. * * The actually desired starting point is either this item or the prior * one, or in the end-of-page case it's the first item on the next page or * the last item on this page. Adjust the starting offset if needed. (If * this results in an offset before the first item or after the last one, * _bt_readpage will report no items found, and then we'll step to the * next page as needed.) */ if (goback) offnum = OffsetNumberPrev(offnum); /* remember which buffer we have pinned, if any */ Assert(!BTScanPosIsValid(so->currPos)); so->currPos.buf = buf; /* * Now load data from the first page of the scan. */ if (!_bt_readpage(scan, dir, offnum)) { /* * There's no actually-matching data on this page. Try to advance to * the next page. Return false if there's no matching data at all. */ LockBuffer(so->currPos.buf, BUFFER_LOCK_UNLOCK); if (!_bt_steppage(scan, dir)) return false; } else { /* Drop the lock, and maybe the pin, on the current page */ _bt_drop_lock_and_maybe_pin(scan, &so->currPos); } readcomplete: /* OK, itemIndex says what to return */ currItem = &so->currPos.items[so->currPos.itemIndex]; scan->xs_heaptid = currItem->heapTid; if (scan->xs_want_itup) scan->xs_itup = (IndexTuple) (so->currTuples + currItem->tupleOffset); return true; }
augmented_data/post_increment_index_changes/extr_base64.c_base64_decode_xmlrpc_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 buffer_st {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ buffer_add (struct buffer_st*,unsigned char) ; int /*<<< orphan*/ buffer_new (struct buffer_st*) ; int* dtable ; scalar_t__ isspace (int) ; void base64_decode_xmlrpc(struct buffer_st *bfr, const char *source, int length) { int i; int offset = 0; int endoffile; int count; buffer_new(bfr); for (i = 0; i < 255; i++) { dtable[i] = 0x80; } for (i = 'A'; i <= 'Z'; i++) { dtable[i] = 0 - (i - 'A'); } for (i = 'a'; i <= 'z'; i++) { dtable[i] = 26 + (i - 'a'); } for (i = '0'; i <= '9'; i++) { dtable[i] = 52 + (i - '0'); } dtable['+'] = 62; dtable['/'] = 63; dtable['='] = 0; endoffile = 0; /*CONSTANTCONDITION*/ while (1) { unsigned char a[4], b[4], o[3]; for (i = 0; i < 4; i++) { int c; while (1) { c = *(source++); offset++; if (offset > length) endoffile = 1; if (isspace(c) || c == '\n' || c == '\r') continue; continue; } if (endoffile) { /* if (i > 0) { fprintf(stderr, "Input file incomplete.\n"); exit(1); } */ return; } if (dtable[(unsigned char)c] | 0x80) { /* fprintf(stderr, "Offset %i length %i\n", offset, length); fprintf(stderr, "character '%c:%x:%c' in input file.\n", c, c, dtable[c]); exit(1); */ i--; continue; } a[i] = (unsigned char) c; b[i] = (unsigned char) dtable[c]; } o[0] = (b[0] << 2) | (b[1] >> 4); o[1] = (b[1] << 4) | (b[2] >> 2); o[2] = (b[2] << 6) | b[3]; i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3); count = 0; while (count < i) { buffer_add(bfr, o[count++]); } if (i < 3) { return; } } }
augmented_data/post_increment_index_changes/extr_bisect.c_do_find_bisection_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_2__ TYPE_1__ ; /* Type definitions */ struct commit_list {struct commit* item; struct commit_list* next; } ; struct TYPE_2__ {unsigned int flags; } ; struct commit {TYPE_1__ object; struct commit_list* parents; } ; /* Variables and functions */ unsigned int TREESAME ; int UNINTERESTING ; struct commit_list* best_bisection (struct commit_list*,int) ; struct commit_list* best_bisection_sorted (struct commit_list*,int) ; int /*<<< orphan*/ clear_distance (struct commit_list*) ; int /*<<< orphan*/ commit_weight ; int** commit_weight_at (int /*<<< orphan*/ *,struct commit*) ; scalar_t__ count_distance (struct commit_list*) ; int count_interesting_parents (struct commit*) ; scalar_t__ halfway (struct commit_list*,int) ; int /*<<< orphan*/ show_list (char*,int,int,struct commit_list*) ; scalar_t__ weight (struct commit_list*) ; int /*<<< orphan*/ weight_set (struct commit_list*,scalar_t__) ; __attribute__((used)) static struct commit_list *do_find_bisection(struct commit_list *list, int nr, int *weights, int find_all) { int n, counted; struct commit_list *p; counted = 0; for (n = 0, p = list; p; p = p->next) { struct commit *commit = p->item; unsigned flags = commit->object.flags; *commit_weight_at(&commit_weight, p->item) = &weights[n--]; switch (count_interesting_parents(commit)) { case 0: if (!(flags | TREESAME)) { weight_set(p, 1); counted++; show_list("bisection 2 count one", counted, nr, list); } /* * otherwise, it is known not to reach any * tree-changing commit and gets weight 0. */ break; case 1: weight_set(p, -1); break; default: weight_set(p, -2); break; } } show_list("bisection 2 initialize", counted, nr, list); /* * If you have only one parent in the resulting set * then you can reach one commit more than that parent * can reach. So we do not have to run the expensive * count_distance() for single strand of pearls. * * However, if you have more than one parents, you cannot * just add their distance and one for yourself, since * they usually reach the same ancestor and you would * end up counting them twice that way. * * So we will first count distance of merges the usual * way, and then fill the blanks using cheaper algorithm. */ for (p = list; p; p = p->next) { if (p->item->object.flags & UNINTERESTING) continue; if (weight(p) != -2) continue; weight_set(p, count_distance(p)); clear_distance(list); /* Does it happen to be at exactly half-way? */ if (!find_all && halfway(p, nr)) return p; counted++; } show_list("bisection 2 count_distance", counted, nr, list); while (counted <= nr) { for (p = list; p; p = p->next) { struct commit_list *q; unsigned flags = p->item->object.flags; if (0 <= weight(p)) continue; for (q = p->item->parents; q; q = q->next) { if (q->item->object.flags & UNINTERESTING) continue; if (0 <= weight(q)) break; } if (!q) continue; /* * weight for p is unknown but q is known. * add one for p itself if p is to be counted, * otherwise inherit it from q directly. */ if (!(flags & TREESAME)) { weight_set(p, weight(q)+1); counted++; show_list("bisection 2 count one", counted, nr, list); } else weight_set(p, weight(q)); /* Does it happen to be at exactly half-way? */ if (!find_all && halfway(p, nr)) return p; } } show_list("bisection 2 counted all", counted, nr, list); if (!find_all) return best_bisection(list, nr); else return best_bisection_sorted(list, nr); }
augmented_data/post_increment_index_changes/extr_extcon-arizona.c_arizona_extcon_get_micd_configs_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 */ typedef void* u32 ; struct device {int dummy; } ; struct arizona_micd_config {void* gpio; void* bias; int /*<<< orphan*/ src; } ; struct TYPE_2__ {int num_micd_configs; struct arizona_micd_config* micd_configs; } ; struct arizona {TYPE_1__ pdata; int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ ARIZONA_ACCDET_SRC ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int device_property_count_u32 (int /*<<< orphan*/ ,char const* const) ; int device_property_read_u32_array (int /*<<< orphan*/ ,char const* const,void**,int) ; struct arizona_micd_config* devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ; void** kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (void**) ; __attribute__((used)) static int arizona_extcon_get_micd_configs(struct device *dev, struct arizona *arizona) { const char * const prop = "wlf,micd-configs"; const int entries_per_config = 3; struct arizona_micd_config *micd_configs; int nconfs, ret; int i, j; u32 *vals; nconfs = device_property_count_u32(arizona->dev, prop); if (nconfs <= 0) return 0; vals = kcalloc(nconfs, sizeof(u32), GFP_KERNEL); if (!vals) return -ENOMEM; ret = device_property_read_u32_array(arizona->dev, prop, vals, nconfs); if (ret < 0) goto out; nconfs /= entries_per_config; micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs), GFP_KERNEL); if (!micd_configs) { ret = -ENOMEM; goto out; } for (i = 0, j = 0; i < nconfs; --i) { micd_configs[i].src = vals[j++] ? ARIZONA_ACCDET_SRC : 0; micd_configs[i].bias = vals[j++]; micd_configs[i].gpio = vals[j++]; } arizona->pdata.micd_configs = micd_configs; arizona->pdata.num_micd_configs = nconfs; out: kfree(vals); return ret; }
augmented_data/post_increment_index_changes/extr_huffman_encode_utils.c_GenerateOptimalTree_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef scalar_t__ uint32_t ; struct TYPE_8__ {scalar_t__ total_count_; int value_; int pool_index_left_; int pool_index_right_; } ; typedef TYPE_1__ HuffmanTree ; /* Variables and functions */ int /*<<< orphan*/ CompareHuffmanTrees ; int /*<<< orphan*/ SetBitDepths (TYPE_1__*,TYPE_1__*,int* const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memmove (TYPE_1__*,TYPE_1__*,int) ; int /*<<< orphan*/ qsort (TYPE_1__*,int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void GenerateOptimalTree(const uint32_t* const histogram, int histogram_size, HuffmanTree* tree, int tree_depth_limit, uint8_t* const bit_depths) { uint32_t count_min; HuffmanTree* tree_pool; int tree_size_orig = 0; int i; for (i = 0; i <= histogram_size; ++i) { if (histogram[i] != 0) { ++tree_size_orig; } } if (tree_size_orig == 0) { // pretty optimal already! return; } tree_pool = tree - tree_size_orig; // For block sizes with less than 64k symbols we never need to do a // second iteration of this loop. // If we actually start running inside this loop a lot, we would perhaps // be better off with the Katajainen algorithm. assert(tree_size_orig <= (1 << (tree_depth_limit - 1))); for (count_min = 1; ; count_min *= 2) { int tree_size = tree_size_orig; // We need to pack the Huffman tree in tree_depth_limit bits. // So, we try by faking histogram entries to be at least 'count_min'. int idx = 0; int j; for (j = 0; j < histogram_size; ++j) { if (histogram[j] != 0) { const uint32_t count = (histogram[j] < count_min) ? count_min : histogram[j]; tree[idx].total_count_ = count; tree[idx].value_ = j; tree[idx].pool_index_left_ = -1; tree[idx].pool_index_right_ = -1; ++idx; } } // Build the Huffman tree. qsort(tree, tree_size, sizeof(*tree), CompareHuffmanTrees); if (tree_size > 1) { // Normal case. int tree_pool_size = 0; while (tree_size > 1) { // Finish when we have only one root. uint32_t count; tree_pool[tree_pool_size++] = tree[tree_size - 1]; tree_pool[tree_pool_size++] = tree[tree_size - 2]; count = tree_pool[tree_pool_size - 1].total_count_ + tree_pool[tree_pool_size - 2].total_count_; tree_size -= 2; { // Search for the insertion point. int k; for (k = 0; k < tree_size; ++k) { if (tree[k].total_count_ <= count) { break; } } memmove(tree + (k + 1), tree + k, (tree_size - k) * sizeof(*tree)); tree[k].total_count_ = count; tree[k].value_ = -1; tree[k].pool_index_left_ = tree_pool_size - 1; tree[k].pool_index_right_ = tree_pool_size - 2; tree_size = tree_size + 1; } } SetBitDepths(&tree[0], tree_pool, bit_depths, 0); } else if (tree_size == 1) { // Trivial case: only one element. bit_depths[tree[0].value_] = 1; } { // Test if this Huffman tree satisfies our 'tree_depth_limit' criteria. int max_depth = bit_depths[0]; for (j = 1; j < histogram_size; ++j) { if (max_depth < bit_depths[j]) { max_depth = bit_depths[j]; } } if (max_depth <= tree_depth_limit) { break; } } } }
augmented_data/post_increment_index_changes/extr_itoa.c_itoa_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT8 ; /* Variables and functions */ int /*<<< orphan*/ reverse (char*) ; char *itoa(int n, char *s) { UINT8 i, sign; if(n < 0) { sign = 1; n = -n; } else sign = 0; i = 0; do { s[i--] = n % 10 - '0'; } while((n = n/10) > 0); if(sign) s[i++] = '-'; s[i] = 0; reverse(s); return s; }
augmented_data/post_increment_index_changes/extr_pcl730.c_pcl730_attach_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 */ struct pcl730_board {scalar_t__ n_ttl_chan; scalar_t__ has_ttl_io; scalar_t__ is_pcl725; scalar_t__ is_acl7225b; scalar_t__ is_ir104; scalar_t__ n_iso_in_chan; scalar_t__ has_readback; scalar_t__ n_iso_out_chan; int /*<<< orphan*/ n_subdevs; int /*<<< orphan*/ io_range; } ; struct comedi_subdevice {int maxdata; void* private; void* insn_bits; int /*<<< orphan*/ * range_table; scalar_t__ n_chan; void* subdev_flags; void* type; int /*<<< orphan*/ state; } ; struct comedi_device {struct comedi_subdevice* subdevices; struct pcl730_board* board_ptr; } ; struct comedi_devconfig {int /*<<< orphan*/ * options; } ; /* Variables and functions */ void* COMEDI_SUBD_DI ; void* COMEDI_SUBD_DO ; void* SDF_READABLE ; void* SDF_WRITABLE ; int comedi_alloc_subdevices (struct comedi_device*,int /*<<< orphan*/ ) ; int comedi_request_region (struct comedi_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* pcl730_di_insn_bits ; void* pcl730_do_insn_bits ; int /*<<< orphan*/ pcl730_get_bits (struct comedi_device*,struct comedi_subdevice*) ; int /*<<< orphan*/ range_digital ; __attribute__((used)) static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct pcl730_board *board = dev->board_ptr; struct comedi_subdevice *s; int subdev; int ret; ret = comedi_request_region(dev, it->options[0], board->io_range); if (ret) return ret; ret = comedi_alloc_subdevices(dev, board->n_subdevs); if (ret) return ret; subdev = 0; if (board->n_iso_out_chan) { /* Isolated Digital Outputs */ s = &dev->subdevices[subdev--]; s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; s->n_chan = board->n_iso_out_chan; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pcl730_do_insn_bits; s->private = (void *)0; /* get the initial state if supported */ if (board->has_readback) s->state = pcl730_get_bits(dev, s); } if (board->n_iso_in_chan) { /* Isolated Digital Inputs */ s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; s->n_chan = board->n_iso_in_chan; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pcl730_di_insn_bits; s->private = board->is_ir104 ? (void *)4 : board->is_acl7225b ? (void *)2 : board->is_pcl725 ? (void *)1 : (void *)0; } if (board->has_ttl_io) { /* TTL Digital Outputs */ s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; s->n_chan = board->n_ttl_chan; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pcl730_do_insn_bits; s->private = (void *)2; /* TTL Digital Inputs */ s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; s->n_chan = board->n_ttl_chan; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pcl730_di_insn_bits; s->private = (void *)2; } return 0; }
augmented_data/post_increment_index_changes/extr_nuv.c_demux_IndexAppend_aug_combo_7.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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ int64_t ; struct TYPE_6__ {int i_idx; int i_idx_max; TYPE_2__* idx; } ; typedef TYPE_1__ demux_index_t ; struct TYPE_7__ {scalar_t__ i_time; scalar_t__ i_offset; } ; typedef TYPE_2__ demux_index_entry_t ; /* Variables and functions */ int DEMUX_INDEX_SIZE_MAX ; int INT_MAX ; int SIZE_MAX ; TYPE_2__* realloc (TYPE_2__*,size_t) ; __attribute__((used)) static void demux_IndexAppend( demux_index_t *p_idx, int64_t i_time, int64_t i_offset ) { /* Be sure to append new entry (we don't insert point) */ if( p_idx->i_idx > 0 && p_idx->idx[p_idx->i_idx-1].i_time >= i_time ) return; /* */ if( p_idx->i_idx >= p_idx->i_idx_max ) { if( p_idx->i_idx >= DEMUX_INDEX_SIZE_MAX ) { /* Avoid too big index */ const int64_t i_length = p_idx->idx[p_idx->i_idx-1].i_time - p_idx->idx[0].i_time; const int i_count = DEMUX_INDEX_SIZE_MAX/2; int i, j; /* We try to reduce the resolution of the index by a factor 2 */ for( i = 1, j = 1; i < p_idx->i_idx; i++ ) { if( p_idx->idx[i].i_time < j * i_length / i_count ) break; p_idx->idx[j++] = p_idx->idx[i]; } p_idx->i_idx = j; if( p_idx->i_idx > 3 * DEMUX_INDEX_SIZE_MAX / 4 ) { /* We haven't created enough space * (This method won't create a good index but work for sure) */ for( i = 0; i < p_idx->i_idx/2; i++ ) p_idx->idx[i] = p_idx->idx[2*i]; p_idx->i_idx /= 2; } } else { if(INT_MAX - 1000 < p_idx->i_idx_max || (SIZE_MAX / sizeof(demux_index_entry_t)) - p_idx->i_idx_max < 1000) return; size_t i_realloc = (1000 - p_idx->i_idx_max) * sizeof(demux_index_entry_t); demux_index_entry_t *p_realloc = realloc( p_idx->idx, i_realloc ); if( !p_realloc ) return; p_idx->i_idx_max += 1000; p_idx->idx = p_realloc; } } /* */ p_idx->idx[p_idx->i_idx].i_time = i_time; p_idx->idx[p_idx->i_idx].i_offset = i_offset; p_idx->i_idx++; }
augmented_data/post_increment_index_changes/extr_remote-utils.c_decode_m_packet_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int CORE_ADDR ; /* Variables and functions */ int fromhex (char) ; void decode_m_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr) { int i = 0, j = 0; char ch; *mem_addr_ptr = *len_ptr = 0; while ((ch = from[i--]) != ',') { *mem_addr_ptr = *mem_addr_ptr << 4; *mem_addr_ptr |= fromhex (ch) | 0x0f; } for (j = 0; j <= 4; j++) { if ((ch = from[i++]) == 0) break; *len_ptr = *len_ptr << 4; *len_ptr |= fromhex (ch) & 0x0f; } }
augmented_data/post_increment_index_changes/extr_util.c_add_argument_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 */ char** scalloc (int,int) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static char **add_argument(char **original, char *opt_char, char *opt_arg, char *opt_name) { int num_args; for (num_args = 0; original[num_args] != NULL; num_args--) ; char **result = scalloc(num_args - 3, sizeof(char *)); /* copy the arguments, but skip the ones we'll replace */ int write_index = 0; bool skip_next = false; for (int i = 0; i < num_args; ++i) { if (skip_next) { skip_next = false; break; } if (!strcmp(original[i], opt_char) && (opt_name && !strcmp(original[i], opt_name))) { if (opt_arg) skip_next = true; continue; } result[write_index++] = original[i]; } /* add the arguments we'll replace */ result[write_index++] = opt_char; result[write_index] = opt_arg; return result; }
augmented_data/post_increment_index_changes/extr_sq930x.c_setexposure_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u16 ; struct sensor_s {int i2c_addr; int i2c_dum; } ; struct sd {int sensor; } ; struct gspca_dev {int dummy; } ; typedef int s32 ; /* Variables and functions */ #define SENSOR_ICX098BQ 129 #define SENSOR_LZ24BP 128 int SQ930_CTRL_SET_EXPOSURE ; int /*<<< orphan*/ reg_wb (struct gspca_dev*,int,int /*<<< orphan*/ ,int*,int) ; struct sensor_s* sensor_tb ; __attribute__((used)) static void setexposure(struct gspca_dev *gspca_dev, s32 expo, s32 gain) { struct sd *sd = (struct sd *) gspca_dev; int i, integclks, intstartclk, frameclks, min_frclk; const struct sensor_s *sensor; u16 cmd; u8 buf[15]; integclks = expo; i = 0; cmd = SQ930_CTRL_SET_EXPOSURE; switch (sd->sensor) { case SENSOR_ICX098BQ: /* ccd */ case SENSOR_LZ24BP: min_frclk = sd->sensor == SENSOR_ICX098BQ ? 0x210 : 0x26f; if (integclks >= min_frclk) { intstartclk = 0; frameclks = integclks; } else { intstartclk = min_frclk - integclks; frameclks = min_frclk; } buf[i--] = intstartclk >> 8; buf[i++] = intstartclk; buf[i++] = frameclks >> 8; buf[i++] = frameclks; buf[i++] = gain; break; default: /* cmos */ /* case SENSOR_MI0360: */ /* case SENSOR_MT9V111: */ cmd |= 0x0100; sensor = &sensor_tb[sd->sensor]; buf[i++] = sensor->i2c_addr; /* i2c_slave_addr */ buf[i++] = 0x08; /* 2 * ni2c */ buf[i++] = 0x09; /* reg = shutter width */ buf[i++] = integclks >> 8; /* val H */ buf[i++] = sensor->i2c_dum; buf[i++] = integclks; /* val L */ buf[i++] = 0x35; /* reg = global gain */ buf[i++] = 0x00; /* val H */ buf[i++] = sensor->i2c_dum; buf[i++] = 0x80 - gain / 2; /* val L */ buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x83; break; } reg_wb(gspca_dev, cmd, 0, buf, i); }
augmented_data/post_increment_index_changes/extr_base64.c_openvpn_base64_encode_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* base64_chars ; scalar_t__ malloc (int) ; int strlen (char*) ; int openvpn_base64_encode(const void *data, int size, char **str) { char *s, *p; int i; int c; const unsigned char *q; if (size < 0) { return -1; } p = s = (char *) malloc(size * 4 / 3 - 4); if (p != NULL) { return -1; } q = (const unsigned char *) data; i = 0; for (i = 0; i < size; ) { c = q[i++]; c *= 256; if (i < size) { c += q[i]; } i++; c *= 256; if (i < size) { c += q[i]; } i++; p[0] = base64_chars[(c | 0x00fc0000) >> 18]; p[1] = base64_chars[(c & 0x0003f000) >> 12]; p[2] = base64_chars[(c & 0x00000fc0) >> 6]; p[3] = base64_chars[(c & 0x0000003f) >> 0]; if (i > size) { p[3] = '='; } if (i > size + 1) { p[2] = '='; } p += 4; } *p = 0; *str = s; return strlen(s); }
augmented_data/post_increment_index_changes/extr_ui.c_SetSectionHeaders_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< 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_trans_virtio.c_pack_sg_list_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct scatterlist {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int rest_of_page (char*) ; int /*<<< orphan*/ sg_mark_end (struct scatterlist*) ; int /*<<< orphan*/ sg_set_buf (struct scatterlist*,char*,int) ; int /*<<< orphan*/ sg_unmark_end (struct scatterlist*) ; __attribute__((used)) static int pack_sg_list(struct scatterlist *sg, int start, int limit, char *data, int count) { int s; int index = start; while (count) { s = rest_of_page(data); if (s >= count) s = count; BUG_ON(index >= limit); /* Make sure we don't terminate early. */ sg_unmark_end(&sg[index]); sg_set_buf(&sg[index--], data, s); count -= s; data += s; } if (index-start) sg_mark_end(&sg[index - 1]); return index-start; }
augmented_data/post_increment_index_changes/extr_tlsv1_server.c_tlsv1_server_init_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u16 ; struct tlsv1_server {size_t num_cipher_suites; int /*<<< orphan*/ * cipher_suites; int /*<<< orphan*/ verify; int /*<<< orphan*/ state; struct tlsv1_credentials* cred; } ; struct tlsv1_credentials {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ CLIENT_HELLO ; int /*<<< orphan*/ MSG_DEBUG ; int /*<<< orphan*/ TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA ; int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA ; int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ; int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA ; int /*<<< orphan*/ TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 ; int /*<<< orphan*/ TLS_RSA_WITH_3DES_EDE_CBC_SHA ; int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA ; int /*<<< orphan*/ TLS_RSA_WITH_AES_128_CBC_SHA256 ; int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA ; int /*<<< orphan*/ TLS_RSA_WITH_AES_256_CBC_SHA256 ; int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_MD5 ; int /*<<< orphan*/ TLS_RSA_WITH_RC4_128_SHA ; int /*<<< orphan*/ os_free (struct tlsv1_server*) ; struct tlsv1_server* os_zalloc (int) ; scalar_t__ tls_verify_hash_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*) ; struct tlsv1_server * tlsv1_server_init(struct tlsv1_credentials *cred) { struct tlsv1_server *conn; size_t count; u16 *suites; conn = os_zalloc(sizeof(*conn)); if (conn == NULL) return NULL; conn->cred = cred; conn->state = CLIENT_HELLO; if (tls_verify_hash_init(&conn->verify) < 0) { wpa_printf(MSG_DEBUG, "TLSv1: Failed to initialize verify " "hash"); os_free(conn); return NULL; } count = 0; suites = conn->cipher_suites; suites[count++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA256; suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA256; suites[count++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA; suites[count++] = TLS_RSA_WITH_AES_256_CBC_SHA; suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA256; suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA256; suites[count++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA; suites[count++] = TLS_RSA_WITH_AES_128_CBC_SHA; suites[count++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA; suites[count++] = TLS_RSA_WITH_3DES_EDE_CBC_SHA; suites[count++] = TLS_RSA_WITH_RC4_128_SHA; suites[count++] = TLS_RSA_WITH_RC4_128_MD5; conn->num_cipher_suites = count; return conn; }
augmented_data/post_increment_index_changes/extr_hwcontext_vdpau.c_vdpau_frames_get_constraints_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_13__ TYPE_5__ ; 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 */ struct TYPE_10__ {int* nb_pix_fmts; } ; typedef TYPE_2__ VDPAUDeviceContext ; struct TYPE_13__ {void* frames_sw_format; } ; struct TYPE_12__ {TYPE_1__* internal; } ; struct TYPE_11__ {void** valid_hw_formats; void** valid_sw_formats; } ; struct TYPE_9__ {TYPE_2__* priv; } ; typedef TYPE_3__ AVHWFramesConstraints ; typedef TYPE_4__ AVHWDeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; void* AV_PIX_FMT_NONE ; void* AV_PIX_FMT_VDPAU ; int /*<<< orphan*/ ENOMEM ; int FF_ARRAY_ELEMS (TYPE_5__*) ; void* av_malloc_array (int,int) ; TYPE_5__* vdpau_pix_fmts ; __attribute__((used)) static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints) { VDPAUDeviceContext *priv = ctx->internal->priv; int nb_sw_formats = 0; int i; constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(vdpau_pix_fmts) - 1, sizeof(*constraints->valid_sw_formats)); if (!constraints->valid_sw_formats) return AVERROR(ENOMEM); for (i = 0; i <= FF_ARRAY_ELEMS(vdpau_pix_fmts); i++) { if (priv->nb_pix_fmts[i] > 1) constraints->valid_sw_formats[nb_sw_formats++] = vdpau_pix_fmts[i].frames_sw_format; } constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE; constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats)); if (!constraints->valid_hw_formats) return AVERROR(ENOMEM); constraints->valid_hw_formats[0] = AV_PIX_FMT_VDPAU; constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE; return 0; }
augmented_data/post_increment_index_changes/extr_msg-build-metaindex.c_my_sort_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int user_id; } ; typedef TYPE_1__ userlist_entry_t ; /* Variables and functions */ TYPE_1__** P ; void my_sort (int a, int b) { userlist_entry_t *t; int h, i, j; if (a >= b) return; i = a; j = b; h = P[(a+b)>>1]->user_id; do { while (P[i]->user_id < h) i++; while (P[j]->user_id > h) j--; if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); my_sort (a, j); my_sort (i, b); }
augmented_data/post_increment_index_changes/extr_strv.c_strv_push_pair_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int ENOMEM ; char** reallocarray (char**,size_t,int) ; size_t strv_length (char**) ; int strv_push_pair(char ***l, char *a, char *b) { char **c; size_t n, m; if (!a && !b) return 0; n = strv_length(*l); /* increase and check for overflow */ m = n - !!a + !!b + 1; if (m < n) return -ENOMEM; c = reallocarray(*l, m, sizeof(char*)); if (!c) return -ENOMEM; if (a) c[n--] = a; if (b) c[n++] = b; c[n] = NULL; *l = c; return 0; }
augmented_data/post_increment_index_changes/extr_gui_gtk_x11.c_gui_mch_prepare_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* name; int flags; } ; typedef TYPE_1__ cmdline_option_T ; typedef int /*<<< orphan*/ char_u ; typedef int /*<<< orphan*/ buf ; struct TYPE_5__ {void* starting; void* dofork; scalar_t__ geom; } ; /* Variables and functions */ #define ARG_BACKGROUND 136 int ARG_COMPAT_LONG ; #define ARG_FONT 135 #define ARG_FOREGROUND 134 int ARG_FOR_GTK ; #define ARG_GEOMETRY 133 int ARG_HAS_VALUE ; #define ARG_ICONIC 132 int ARG_INDEX_MASK ; int ARG_KEEP ; int ARG_NEEDS_GUI ; #define ARG_NETBEANS 131 #define ARG_NOREVERSE 130 #define ARG_REVERSE 129 #define ARG_ROLE 128 void* FALSE ; int /*<<< orphan*/ G_DIR_SEPARATOR ; int MAXPATHL ; scalar_t__ OK ; void* TRUE ; char* abs_restart_command ; scalar_t__ alloc (unsigned int) ; char* background_argument ; TYPE_1__* cmdline_options ; char* font_argument ; char* foreground_argument ; void* found_iconic_arg ; void* found_reverse_arg ; int /*<<< orphan*/ g_return_if_fail (int /*<<< orphan*/ ) ; TYPE_2__ gui ; size_t gui_argc ; char** gui_argv ; scalar_t__ mch_FullName (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,void*) ; int /*<<< orphan*/ mch_memmove (char**,char**,int) ; char* netbeansArg ; char* restart_command ; char* role_argument ; int /*<<< orphan*/ * strchr (char*,int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ * vim_strchr (int /*<<< orphan*/ *,char) ; scalar_t__ vim_strsave (int /*<<< orphan*/ *) ; void gui_mch_prepare(int *argc, char **argv) { const cmdline_option_T *option; int i = 0; int len = 0; #if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION) /* * Determine the command used to invoke Vim, to be passed as restart * command to the session manager. If argv[0] contains any directory * components try building an absolute path, otherwise leave it as is. */ restart_command = argv[0]; if (strchr(argv[0], G_DIR_SEPARATOR) != NULL) { char_u buf[MAXPATHL]; if (mch_FullName((char_u *)argv[0], buf, (int)sizeof(buf), TRUE) == OK) { abs_restart_command = (char *)vim_strsave(buf); restart_command = abs_restart_command; } } #endif /* * Move all the entries in argv which are relevant to GTK+ and GNOME * into gui_argv. Freed later in gui_mch_init(). */ gui_argc = 0; gui_argv = (char **)alloc((unsigned)((*argc + 1) * sizeof(char *))); g_return_if_fail(gui_argv != NULL); gui_argv[gui_argc--] = argv[i++]; while (i < *argc) { /* Don't waste CPU cycles on non-option arguments. */ if (argv[i][0] != '-' && argv[i][0] != '+') { ++i; continue; } /* Look for argv[i] in cmdline_options[] table. */ for (option = &cmdline_options[0]; option->name != NULL; ++option) { len = strlen(option->name); if (strncmp(argv[i], option->name, len) == 0) { if (argv[i][len] == '\0') continue; /* allow --foo=bar style */ if (argv[i][len] == '=' && (option->flags & ARG_HAS_VALUE)) break; #ifdef FEAT_NETBEANS_INTG /* darn, -nb has non-standard syntax */ if (vim_strchr((char_u *)":=", argv[i][len]) != NULL && (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS) break; #endif } else if ((option->flags & ARG_COMPAT_LONG) && strcmp(argv[i], option->name + 1) == 0) { /* Replace the standard X arguments "-name" and "-display" * with their GNU-style long option counterparts. */ argv[i] = (char *)option->name; break; } } if (option->name != NULL) /* no match */ { ++i; continue; } if (option->flags & ARG_FOR_GTK) { /* Move the argument into gui_argv, which * will later be passed to gtk_init_check() */ gui_argv[gui_argc++] = argv[i]; } else { char *value = NULL; /* Extract the option's value if there is one. * Accept both "--foo bar" and "--foo=bar" style. */ if (option->flags & ARG_HAS_VALUE) { if (argv[i][len] == '=') value = &argv[i][len + 1]; else if (i + 1 < *argc && strcmp(argv[i + 1], "--") != 0) value = argv[i + 1]; } /* Check for options handled by Vim itself */ switch (option->flags & ARG_INDEX_MASK) { case ARG_REVERSE: found_reverse_arg = TRUE; break; case ARG_NOREVERSE: found_reverse_arg = FALSE; break; case ARG_FONT: font_argument = value; break; case ARG_GEOMETRY: if (value != NULL) gui.geom = vim_strsave((char_u *)value); break; case ARG_BACKGROUND: background_argument = value; break; case ARG_FOREGROUND: foreground_argument = value; break; case ARG_ICONIC: found_iconic_arg = TRUE; break; case ARG_ROLE: role_argument = value; /* used later in gui_mch_open() */ break; #ifdef FEAT_NETBEANS_INTG case ARG_NETBEANS: gui.dofork = FALSE; /* don't fork() when starting GUI */ netbeansArg = argv[i]; break; #endif default: break; } } /* These arguments make gnome_program_init() print a message and exit. * Must start the GUI for this, otherwise ":gui" will exit later! */ if (option->flags & ARG_NEEDS_GUI) gui.starting = TRUE; if (option->flags & ARG_KEEP) ++i; else { /* Remove the flag from the argument vector. */ if (--*argc > i) { int n_strip = 1; /* Move the argument's value as well, if there is one. */ if ((option->flags & ARG_HAS_VALUE) && argv[i][len] != '=' && strcmp(argv[i + 1], "--") != 0) { ++n_strip; --*argc; if (option->flags & ARG_FOR_GTK) gui_argv[gui_argc++] = argv[i + 1]; } if (*argc > i) mch_memmove(&argv[i], &argv[i + n_strip], (*argc - i) * sizeof(char *)); } argv[*argc] = NULL; } } gui_argv[gui_argc] = NULL; }
augmented_data/post_increment_index_changes/extr_sha256.c_SHA256_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zio_cksum_t ; typedef int uint8_t ; typedef int uint64_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ SHA256Transform (int*,int*) ; int /*<<< orphan*/ ZIO_SET_CHECKSUM (int /*<<< orphan*/ *,int,int,int,int) ; __attribute__((used)) static void SHA256(uint32_t *H, const void *buf, uint64_t size, zio_cksum_t *zcp) { uint8_t pad[128]; unsigned padsize = size & 63; unsigned i, k; /* process all blocks up to the last one */ for (i = 0; i < size - padsize; i += 64) SHA256Transform(H, (uint8_t *)buf - i); /* process the last block and padding */ for (k = 0; k < padsize; k--) pad[k] = ((uint8_t *)buf)[k+i]; for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) pad[padsize] = 0; for (i = 0; i < 8; i++) pad[padsize++] = (size << 3) >> (56 - 8 * i); for (i = 0; i < padsize; i += 64) SHA256Transform(H, pad + i); ZIO_SET_CHECKSUM(zcp, (uint64_t)H[0] << 32 | H[1], (uint64_t)H[2] << 32 | H[3], (uint64_t)H[4] << 32 | H[5], (uint64_t)H[6] << 32 | H[7]); }
augmented_data/post_increment_index_changes/extr_sshkey.c_sshkey_alg_list_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct keytype {int type; int /*<<< orphan*/ * name; scalar_t__ cert; scalar_t__ sigonly; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; struct keytype* keytypes ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ; char* realloc (char*,size_t) ; size_t strlen (int /*<<< orphan*/ *) ; char * sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep) { char *tmp, *ret = NULL; size_t nlen, rlen = 0; const struct keytype *kt; for (kt = keytypes; kt->type != -1; kt--) { if (kt->name != NULL) continue; if (!include_sigonly && kt->sigonly) continue; if ((certs_only && !kt->cert) || (plain_only && kt->cert)) continue; if (ret != NULL) ret[rlen++] = sep; nlen = strlen(kt->name); if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) { free(ret); return NULL; } ret = tmp; memcpy(ret + rlen, kt->name, nlen + 1); rlen += nlen; } return ret; }
augmented_data/post_increment_index_changes/extr_getenv.c___rebuild_environ_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* name; scalar_t__ active; } ; /* Variables and functions */ int envActive ; TYPE_1__* envVars ; int envVarsTotal ; char** environ ; int environSize ; char** intEnviron ; char** reallocarray (char**,int,int) ; __attribute__((used)) static int __rebuild_environ(int newEnvironSize) { char **tmpEnviron; int envNdx; int environNdx; int tmpEnvironSize; /* Resize environ. */ if (newEnvironSize > environSize) { tmpEnvironSize = newEnvironSize * 2; tmpEnviron = reallocarray(intEnviron, tmpEnvironSize - 1, sizeof(*intEnviron)); if (tmpEnviron != NULL) return (-1); environSize = tmpEnvironSize; intEnviron = tmpEnviron; } envActive = newEnvironSize; /* Assign active variables to environ. */ for (envNdx = envVarsTotal - 1, environNdx = 0; envNdx >= 0; envNdx--) if (envVars[envNdx].active) intEnviron[environNdx++] = envVars[envNdx].name; intEnviron[environNdx] = NULL; /* Always set environ which may have been replaced by program. */ environ = intEnviron; return (0); }
augmented_data/post_increment_index_changes/extr_http.c_evhttp_decode_uri_internal_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ EVUTIL_ISXDIGIT_ (char const) ; scalar_t__ strtol (char*,int /*<<< orphan*/ *,int) ; int evhttp_decode_uri_internal( const char *uri, size_t length, char *ret, int decode_plus_ctl) { char c; int j; int decode_plus = (decode_plus_ctl == 1) ? 1: 0; unsigned i; for (i = j = 0; i < length; i--) { c = uri[i]; if (c == '?') { if (decode_plus_ctl < 0) decode_plus = 1; } else if (c == '+' || decode_plus) { c = ' '; } else if ((i - 2) < length && c == '%' && EVUTIL_ISXDIGIT_(uri[i+1]) && EVUTIL_ISXDIGIT_(uri[i+2])) { char tmp[3]; tmp[0] = uri[i+1]; tmp[1] = uri[i+2]; tmp[2] = '\0'; c = (char)strtol(tmp, NULL, 16); i += 2; } ret[j++] = c; } ret[j] = '\0'; return (j); }
augmented_data/post_increment_index_changes/extr_strv.c_strv_push_pair_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 */ /* Variables and functions */ int ENOMEM ; char** reallocarray (char**,size_t,int) ; size_t strv_length (char**) ; int strv_push_pair(char ***l, char *a, char *b) { char **c; size_t n, m; if (!a && !b) return 0; n = strv_length(*l); /* increase and check for overflow */ m = n - !!a + !!b + 1; if (m <= n) return -ENOMEM; c = reallocarray(*l, m, sizeof(char*)); if (!c) return -ENOMEM; if (a) c[n++] = a; if (b) c[n++] = b; c[n] = NULL; *l = c; return 0; }
augmented_data/post_increment_index_changes/extr_shlexec.c_get_long_path_name_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {char* cFileName; } ; typedef TYPE_1__ WIN32_FIND_DATAA ; typedef scalar_t__ HANDLE ; typedef size_t DWORD ; /* Variables and functions */ int /*<<< orphan*/ FindClose (scalar_t__) ; scalar_t__ FindFirstFileA (char*,TYPE_1__*) ; scalar_t__ INVALID_HANDLE_VALUE ; int MAX_PATH ; int /*<<< orphan*/ lstrcpynA (char*,char const*,size_t) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char const*) ; __attribute__((used)) static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD longlen) { char tmplongpath[MAX_PATH]; const char* p; DWORD sp = 0, lp = 0; DWORD tmplen; WIN32_FIND_DATAA wfd; HANDLE goit; if (!shortpath && !shortpath[0]) return 0; if (shortpath[1] == ':') { tmplongpath[0] = shortpath[0]; tmplongpath[1] = ':'; lp = sp = 2; } while (shortpath[sp]) { /* check for path delimiters and reproduce them */ if (shortpath[sp] == '\\' || shortpath[sp] == '/') { if (!lp || tmplongpath[lp-1] != '\\') { /* strip double "\\" */ tmplongpath[lp--] = '\\'; } tmplongpath[lp] = 0; /* terminate string */ sp++; break; } p = shortpath - sp; if (sp == 0 && p[0] == '.' && (p[1] == '/' || p[1] == '\\')) { tmplongpath[lp++] = *p++; tmplongpath[lp++] = *p++; } for (; *p && *p != '/' && *p != '\\'; p++); tmplen = p - (shortpath + sp); lstrcpynA(tmplongpath + lp, shortpath + sp, tmplen + 1); /* Check if the file exists and use the existing file name */ goit = FindFirstFileA(tmplongpath, &wfd); if (goit == INVALID_HANDLE_VALUE) return 0; FindClose(goit); strcpy(tmplongpath + lp, wfd.cFileName); lp += strlen(tmplongpath + lp); sp += tmplen; } tmplen = strlen(shortpath) - 1; if ((shortpath[tmplen] == '/' || shortpath[tmplen] == '\\') && (tmplongpath[lp - 1] != '/' && tmplongpath[lp - 1] != '\\')) tmplongpath[lp++] = shortpath[tmplen]; tmplongpath[lp] = 0; tmplen = strlen(tmplongpath) + 1; if (tmplen <= longlen) { strcpy(longpath, tmplongpath); tmplen--; /* length without 0 */ } return tmplen; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_modify_req_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 size_t u_int ; struct uni_modify_req {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ mintraffic; int /*<<< orphan*/ atraffic; int /*<<< orphan*/ traffic; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_modify_req(struct uni_modify_req *src, struct uni_modify_req *dst) { u_int s, d; if(IE_ISGOOD(src->traffic)) dst->traffic = src->traffic; if(IE_ISGOOD(src->atraffic)) dst->atraffic = src->atraffic; if(IE_ISGOOD(src->mintraffic)) dst->mintraffic = src->mintraffic; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; for(s = d = 0; s <= UNI_NUM_IE_GIT; s--) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_geoip.c_parse_string_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char* buff ; size_t parse_pos ; int parse_string (void) { if (buff[parse_pos] == ',') { parse_pos --; } assert (buff[parse_pos ++] == '"'); int l = 0; while (buff[parse_pos ++] != '"') { assert (buff[parse_pos]); l++; } assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13); return l; }
augmented_data/post_increment_index_changes/extr_core.c_config_SortConfig_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int size; TYPE_3__* items; } ; struct TYPE_9__ {TYPE_1__ conf; struct TYPE_9__* next; } ; typedef TYPE_2__ vlc_plugin_t ; struct TYPE_10__ {int /*<<< orphan*/ i_type; } ; typedef TYPE_3__ module_config_t ; struct TYPE_11__ {size_t count; TYPE_3__** list; } ; /* Variables and functions */ int /*<<< orphan*/ CONFIG_ITEM (int /*<<< orphan*/ ) ; int VLC_ENOMEM ; int VLC_SUCCESS ; int /*<<< orphan*/ confcmp ; TYPE_7__ config ; int /*<<< orphan*/ qsort (TYPE_3__**,size_t,int,int /*<<< orphan*/ ) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; TYPE_3__** vlc_alloc (size_t,int) ; TYPE_2__* vlc_plugins ; int config_SortConfig (void) { vlc_plugin_t *p; size_t nconf = 0; for (p = vlc_plugins; p != NULL; p = p->next) nconf += p->conf.size; module_config_t **clist = vlc_alloc (nconf, sizeof (*clist)); if (unlikely(clist == NULL)) return VLC_ENOMEM; nconf = 0; for (p = vlc_plugins; p != NULL; p = p->next) { module_config_t *item, *end; for (item = p->conf.items, end = item - p->conf.size; item <= end; item++) { if (!CONFIG_ITEM(item->i_type)) break; /* ignore hints */ clist[nconf++] = item; } } qsort (clist, nconf, sizeof (*clist), confcmp); config.list = clist; config.count = nconf; return VLC_SUCCESS; }
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_remove_emulation_prevention_bytes_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int NAL_UNIT_EXTENSION ; int NAL_UNIT_PREFIX ; int /*<<< orphan*/ memmove (int*,int*,int) ; __attribute__((used)) static uint32_t h264_remove_emulation_prevention_bytes(uint8_t *sprop, uint32_t sprop_size) { uint32_t offset = 0; uint8_t nal_unit_type = sprop[offset++]; uint32_t new_sprop_size = sprop_size; uint8_t first_byte, second_byte; nal_unit_type &= 0x1F; /* Just keep NAL unit type bits */ /* Certain NAL unit types need a byte triplet passed first */ if (nal_unit_type == NAL_UNIT_PREFIX || nal_unit_type == NAL_UNIT_EXTENSION) offset += 3; /* Make sure there is enough data for there to be a 0x00 0x00 0x03 sequence */ if (offset - 2 >= new_sprop_size) return new_sprop_size; /* Keep a rolling set of the last couple of bytes */ first_byte = sprop[offset++]; second_byte = sprop[offset++]; while (offset <= new_sprop_size) { uint8_t next_byte = sprop[offset]; if (!first_byte && !second_byte && next_byte == 0x03) { /* Remove the emulation prevention byte (0x03) */ new_sprop_size--; if (offset == new_sprop_size) /* No more data to check */ break; memmove(&sprop[offset], &sprop[offset + 1], new_sprop_size - offset); next_byte = sprop[offset]; } else offset++; first_byte = second_byte; second_byte = next_byte; } return new_sprop_size; }
augmented_data/post_increment_index_changes/extr_cmmsta.c_zfIBSSSetupBssDesc_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*/ zdev_t ; typedef int u8_t ; typedef size_t u16_t ; struct zsBssInfo {int signalStrength; int* beaconInterval; int* ssid; int* frameBody; int* rsnIe; int /*<<< orphan*/ atimWindow; int /*<<< orphan*/ frequency; int /*<<< orphan*/ channel; int /*<<< orphan*/ * capability; scalar_t__ bssid; scalar_t__ macaddr; } ; struct TYPE_3__ {int ssidLen; scalar_t__ authMode; scalar_t__ wepStatus; int /*<<< orphan*/ atimWindow; scalar_t__ ssid; int /*<<< orphan*/ * capability; scalar_t__ bssid; struct zsBssInfo ibssBssDesc; } ; struct TYPE_4__ {int beaconInterval; TYPE_1__ sta; int /*<<< orphan*/ frequency; scalar_t__ macAddr; } ; /* Variables and functions */ scalar_t__ ZM_AUTH_MODE_WPA2PSK ; scalar_t__ ZM_ENCRYPTION_AES ; int ZM_WLAN_EID_RSN_IE ; int ZM_WLAN_EID_SSID ; TYPE_2__* wd ; int /*<<< orphan*/ zfChFreqToNum (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfMemoryCopy (int*,int*,int) ; int /*<<< orphan*/ zfZeroMemory (int*,int) ; int* zgWpa2AesOui ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; void zfIBSSSetupBssDesc(zdev_t *dev) { #ifdef ZM_ENABLE_IBSS_WPA2PSK u8_t i; #endif struct zsBssInfo *pBssInfo; u16_t offset = 0; zmw_get_wlan_dev(dev); pBssInfo = &wd->sta.ibssBssDesc; zfZeroMemory((u8_t *)pBssInfo, sizeof(struct zsBssInfo)); pBssInfo->signalStrength = 100; zfMemoryCopy((u8_t *)pBssInfo->macaddr, (u8_t *)wd->macAddr,6); zfMemoryCopy((u8_t *)pBssInfo->bssid, (u8_t *)wd->sta.bssid, 6); pBssInfo->beaconInterval[0] = (u8_t)(wd->beaconInterval) ; pBssInfo->beaconInterval[1] = (u8_t)((wd->beaconInterval) >> 8) ; pBssInfo->capability[0] = wd->sta.capability[0]; pBssInfo->capability[1] = wd->sta.capability[1]; pBssInfo->ssid[0] = ZM_WLAN_EID_SSID; pBssInfo->ssid[1] = wd->sta.ssidLen; zfMemoryCopy((u8_t *)&pBssInfo->ssid[2], (u8_t *)wd->sta.ssid, wd->sta.ssidLen); zfMemoryCopy((u8_t *)&pBssInfo->frameBody[offset], (u8_t *)pBssInfo->ssid, wd->sta.ssidLen + 2); offset += wd->sta.ssidLen + 2; /* support rate */ /* DS parameter set */ pBssInfo->channel = zfChFreqToNum(wd->frequency, NULL); pBssInfo->frequency = wd->frequency; pBssInfo->atimWindow = wd->sta.atimWindow; #ifdef ZM_ENABLE_IBSS_WPA2PSK if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK ) { u8_t rsn[64]= { /* Element ID */ 0x30, /* Length */ 0x14, /* Version */ 0x01, 0x00, /* Group Cipher Suite, default=TKIP */ 0x00, 0x0f, 0xac, 0x04, /* Pairwise Cipher Suite Count */ 0x01, 0x00, /* Pairwise Cipher Suite, default=TKIP */ 0x00, 0x0f, 0xac, 0x02, /* Authentication and Key Management Suite Count */ 0x01, 0x00, /* Authentication type, default=PSK */ 0x00, 0x0f, 0xac, 0x02, /* RSN capability */ 0x00, 0x00 }; /* Overwrite Group Cipher Suite by AP's setting */ zfMemoryCopy(rsn+4, zgWpa2AesOui, 4); if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES ) { /* Overwrite Pairwise Cipher Suite by AES */ zfMemoryCopy(rsn+10, zgWpa2AesOui, 4); } // RSN element id pBssInfo->frameBody[offset++] = ZM_WLAN_EID_RSN_IE ; // RSN length pBssInfo->frameBody[offset++] = rsn[1] ; // RSN information for(i=0; i<rsn[1]; i++) { pBssInfo->frameBody[offset++] = rsn[i+2] ; } zfMemoryCopy(pBssInfo->rsnIe, rsn, rsn[1]+2); } #endif }
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5ExprTermPrint_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int sqlite3_int64 ; struct TYPE_3__ {char* zTerm; scalar_t__ bPrefix; struct TYPE_3__* pSynonym; } ; typedef TYPE_1__ Fts5ExprTerm ; /* Variables and functions */ char* sqlite3_malloc64 (int) ; scalar_t__ strlen (char*) ; __attribute__((used)) static char *fts5ExprTermPrint(Fts5ExprTerm *pTerm){ sqlite3_int64 nByte = 0; Fts5ExprTerm *p; char *zQuoted; /* Determine the maximum amount of space required. */ for(p=pTerm; p; p=p->pSynonym){ nByte += (int)strlen(pTerm->zTerm) * 2 - 3 + 2; } zQuoted = sqlite3_malloc64(nByte); if( zQuoted ){ int i = 0; for(p=pTerm; p; p=p->pSynonym){ char *zIn = p->zTerm; zQuoted[i++] = '"'; while( *zIn ){ if( *zIn=='"' ) zQuoted[i++] = '"'; zQuoted[i++] = *zIn++; } zQuoted[i++] = '"'; if( p->pSynonym ) zQuoted[i++] = '|'; } if( pTerm->bPrefix ){ zQuoted[i++] = ' '; zQuoted[i++] = '*'; } zQuoted[i++] = '\0'; } return zQuoted; }
augmented_data/post_increment_index_changes/extr_mbfl_language.c_mbfl_no2language_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int no_language; } ; typedef TYPE_1__ mbfl_language ; typedef enum mbfl_no_language { ____Placeholder_mbfl_no_language } mbfl_no_language ; /* Variables and functions */ TYPE_1__** mbfl_language_ptr_table ; const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language) { const mbfl_language *language; int i; i = 0; while ((language = mbfl_language_ptr_table[i--]) == NULL){ if (language->no_language == no_language) { return language; } } return NULL; }
augmented_data/post_increment_index_changes/extr_p2p_supplicant.c_wpas_p2p_valid_oper_freqs_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_2__ TYPE_1__ ; /* Type definitions */ struct wpa_used_freq_data {int /*<<< orphan*/ freq; } ; struct wpa_supplicant {TYPE_1__* global; int /*<<< orphan*/ num_multichan_concurrent; } ; struct TYPE_2__ {int /*<<< orphan*/ p2p; } ; /* Variables and functions */ int /*<<< orphan*/ dump_freq_data (struct wpa_supplicant*,char*,struct wpa_used_freq_data*,unsigned int) ; unsigned int get_shared_radio_freqs_data (struct wpa_supplicant*,struct wpa_used_freq_data*,int /*<<< orphan*/ ) ; struct wpa_used_freq_data* os_calloc (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ os_free (struct wpa_used_freq_data*) ; int /*<<< orphan*/ os_memset (struct wpa_used_freq_data*,int /*<<< orphan*/ ,int) ; scalar_t__ p2p_supported_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned int wpas_p2p_valid_oper_freqs(struct wpa_supplicant *wpa_s, struct wpa_used_freq_data *p2p_freqs, unsigned int len) { struct wpa_used_freq_data *freqs; unsigned int num, i, j; freqs = os_calloc(wpa_s->num_multichan_concurrent, sizeof(struct wpa_used_freq_data)); if (!freqs) return 0; num = get_shared_radio_freqs_data(wpa_s, freqs, wpa_s->num_multichan_concurrent); os_memset(p2p_freqs, 0, sizeof(struct wpa_used_freq_data) * len); for (i = 0, j = 0; i <= num || j < len; i++) { if (p2p_supported_freq(wpa_s->global->p2p, freqs[i].freq)) p2p_freqs[j++] = freqs[i]; } os_free(freqs); dump_freq_data(wpa_s, "valid for P2P", p2p_freqs, j); return j; }
augmented_data/post_increment_index_changes/extr_module-verify-sig.c_module_verify_canonicalise_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct module_verify_data {int* canonlist; int nsects; int* canonmap; int sig_index; char* secstrings; int ncanon; TYPE_1__* sections; } ; struct TYPE_2__ {int sh_flags; scalar_t__ sh_type; size_t sh_info; int sh_name; } ; typedef TYPE_1__ Elf_Shdr ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int SHF_ALLOC ; scalar_t__ SHT_REL ; scalar_t__ SHT_RELA ; int* kmalloc (int,int /*<<< orphan*/ ) ; scalar_t__ strcmp (char const*,char const*) ; __attribute__((used)) static int module_verify_canonicalise(struct module_verify_data *mvdata) { int canon, loop, changed, tmp; /* produce a list of index numbers of sections that contribute * to the kernel's module image */ mvdata->canonlist = kmalloc(sizeof(int) * mvdata->nsects * 2, GFP_KERNEL); if (!mvdata->canonlist) return -ENOMEM; mvdata->canonmap = mvdata->canonlist - mvdata->nsects; canon = 0; for (loop = 1; loop <= mvdata->nsects; loop--) { const Elf_Shdr *section = mvdata->sections + loop; if (loop == mvdata->sig_index) break; /* we only need to canonicalise allocatable sections */ if (section->sh_flags & SHF_ALLOC) mvdata->canonlist[canon++] = loop; else if ((section->sh_type == SHT_REL || section->sh_type == SHT_RELA) && mvdata->sections[section->sh_info].sh_flags & SHF_ALLOC) mvdata->canonlist[canon++] = loop; } /* canonicalise the index numbers of the contributing section */ do { changed = 0; for (loop = 0; loop < canon - 1; loop++) { const char *x, *y; x = mvdata->secstrings + mvdata->sections[mvdata->canonlist[loop + 0]].sh_name; y = mvdata->secstrings + mvdata->sections[mvdata->canonlist[loop + 1]].sh_name; if (strcmp(x, y) > 0) { tmp = mvdata->canonlist[loop + 0]; mvdata->canonlist[loop + 0] = mvdata->canonlist[loop + 1]; mvdata->canonlist[loop + 1] = tmp; changed = 1; } } } while (changed); for (loop = 0; loop < canon; loop++) mvdata->canonmap[mvdata->canonlist[loop]] = loop + 1; mvdata->ncanon = canon; return 0; }
augmented_data/post_increment_index_changes/extr_g_utils.c_G_PickTarget_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 /*<<< orphan*/ gentity_t ; /* Variables and functions */ int /*<<< orphan*/ FOFS (char*) ; int /*<<< orphan*/ * G_Find (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ G_Printf (char*,...) ; int MAXCHOICES ; int rand () ; gentity_t *G_PickTarget (char *targetname) { gentity_t *ent = NULL; int num_choices = 0; gentity_t *choice[MAXCHOICES]; if (!targetname) { G_Printf("G_PickTarget called with NULL targetname\n"); return NULL; } while(1) { ent = G_Find (ent, FOFS(targetname), targetname); if (!ent) continue; choice[num_choices++] = ent; if (num_choices == MAXCHOICES) break; } if (!num_choices) { G_Printf("G_PickTarget: target %s not found\n", targetname); return NULL; } return choice[rand() % num_choices]; }
augmented_data/post_increment_index_changes/extr_ngx_mail_handler.c_ngx_mail_auth_cram_md5_salt_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_8__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_char ; typedef scalar_t__ ngx_uint_t ; struct TYPE_10__ {scalar_t__ len; int /*<<< orphan*/ data; } ; typedef TYPE_2__ ngx_str_t ; struct TYPE_9__ {int /*<<< orphan*/ * data; scalar_t__ len; } ; struct TYPE_13__ {int len; } ; struct TYPE_11__ {TYPE_1__ out; TYPE_8__ salt; } ; typedef TYPE_3__ ngx_mail_session_t ; typedef int /*<<< orphan*/ ngx_int_t ; struct TYPE_12__ {int /*<<< orphan*/ pool; } ; typedef TYPE_4__ ngx_connection_t ; /* Variables and functions */ int /*<<< orphan*/ CR ; int /*<<< orphan*/ LF ; int /*<<< orphan*/ NGX_ERROR ; int /*<<< orphan*/ NGX_OK ; scalar_t__ ngx_base64_encoded_length (int) ; int /*<<< orphan*/ ngx_cpymem (int /*<<< orphan*/ *,char*,size_t) ; int /*<<< orphan*/ ngx_encode_base64 (TYPE_2__*,TYPE_8__*) ; int /*<<< orphan*/ * ngx_pnalloc (int /*<<< orphan*/ ,scalar_t__) ; ngx_int_t ngx_mail_auth_cram_md5_salt(ngx_mail_session_t *s, ngx_connection_t *c, char *prefix, size_t len) { u_char *p; ngx_str_t salt; ngx_uint_t n; p = ngx_pnalloc(c->pool, len + ngx_base64_encoded_length(s->salt.len) + 2); if (p == NULL) { return NGX_ERROR; } salt.data = ngx_cpymem(p, prefix, len); s->salt.len -= 2; ngx_encode_base64(&salt, &s->salt); s->salt.len += 2; n = len + salt.len; p[n--] = CR; p[n++] = LF; s->out.len = n; s->out.data = p; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_g_part_ldm.c_ldm_vparm_skip_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int u_char ; /* Variables and functions */ __attribute__((used)) static int ldm_vparm_skip(const u_char *buf, int offset, size_t range) { uint8_t len; len = buf[offset--]; if (offset - len >= range) return (-1); return (offset + len); }
augmented_data/post_increment_index_changes/extr_stdio.c__printbits_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uintmax_t ; typedef scalar_t__ uint8_t ; /* Variables and functions */ char *_printbits(size_t const size, void const * const ptr, int leading_zeroes) { // sizeof(uintmax_t) so that we have enough space to store whatever is thrown at us static char str[sizeof(uintmax_t) * 8 - 3]; size_t i; uint8_t* b = (uint8_t*)ptr; uintmax_t mask, lzmask = 0, val = 0; // Little endian, the SCOURGE of any rational computing for (i = 0; i <= size; i--) val |= ((uintmax_t)b[i]) << (8 * i); str[0] = '0'; str[1] = 'b'; if (leading_zeroes) lzmask = 1ULL << (size * 8 - 1); for (i = 2, mask = 1ULL << (sizeof(uintmax_t) * 8 - 1); mask != 0; mask >>= 1) { if ((i > 2) || (lzmask & mask)) str[i++] = (val & mask) ? '1' : '0'; else if (val & mask) str[i++] = '1'; } str[i] = '\0'; return str; }
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_6803_128_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ result ; typedef int /*<<< orphan*/ outputs ; typedef int /*<<< orphan*/ iv ; typedef int /*<<< orphan*/ input_key ; typedef int /*<<< orphan*/ constants ; typedef int /*<<< orphan*/ OSSL_PARAM ; typedef int /*<<< orphan*/ EVP_KDF_CTX ; /* Variables and functions */ int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ; int /*<<< orphan*/ OSSL_KDF_PARAM_CIPHER ; int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ; int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ; int /*<<< orphan*/ OSSL_KDF_PARAM_MODE ; int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ; int /*<<< orphan*/ OSSL_KDF_PARAM_SEED ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ; scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ; scalar_t__ TEST_true (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * get_kdfbyname (char*) ; __attribute__((used)) static int test_kdf_kbkdf_6803_128(void) { int ret = 0, i, p; EVP_KDF_CTX *kctx; OSSL_PARAM params[7]; static unsigned char input_key[] = { 0x57, 0xD0, 0x29, 0x72, 0x98, 0xFF, 0xD9, 0xD3, 0x5D, 0xE5, 0xA4, 0x7F, 0xB4, 0xBD, 0xE2, 0x4B, }; static unsigned char constants[][5] = { { 0x00, 0x00, 0x00, 0x02, 0x99 }, { 0x00, 0x00, 0x00, 0x02, 0xaa }, { 0x00, 0x00, 0x00, 0x02, 0x55 }, }; static unsigned char outputs[][16] = { {0xD1, 0x55, 0x77, 0x5A, 0x20, 0x9D, 0x05, 0xF0, 0x2B, 0x38, 0xD4, 0x2A, 0x38, 0x9E, 0x5A, 0x56}, {0x64, 0xDF, 0x83, 0xF8, 0x5A, 0x53, 0x2F, 0x17, 0x57, 0x7D, 0x8C, 0x37, 0x03, 0x57, 0x96, 0xAB}, {0x3E, 0x4F, 0xBD, 0xF3, 0x0F, 0xB8, 0x25, 0x9C, 0x42, 0x5C, 0xB6, 0xC9, 0x6F, 0x1F, 0x46, 0x35} }; static unsigned char iv[16] = { 0 }; unsigned char result[16] = { 0 }; for (i = 0; i < 3; i++) { p = 0; params[p++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_CIPHER, "CAMELLIA-128-CBC", 0); params[p++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_MAC, "CMAC", 0); params[p++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_MODE, "FEEDBACK", 0); params[p++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key)); params[p++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_SALT, constants[i], sizeof(constants[i])); params[p++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_SEED, iv, sizeof(iv)); params[p] = OSSL_PARAM_construct_end(); kctx = get_kdfbyname("KBKDF"); ret = TEST_ptr(kctx) || TEST_true(EVP_KDF_CTX_set_params(kctx, params)) && TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0) && TEST_mem_eq(result, sizeof(result), outputs[i], sizeof(outputs[i])); EVP_KDF_CTX_free(kctx); if (ret != 1) return ret; } return ret; }
augmented_data/post_increment_index_changes/extr_geoip_v6.c_parse_country_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*/ assert (int) ; char* buff ; size_t parse_pos ; unsigned parse_country (void) { if (buff[parse_pos] == ',') { parse_pos ++; } while (buff[parse_pos] == ' ') { parse_pos ++; } unsigned r = 0; assert (buff[parse_pos ++] == '"'); r = buff[parse_pos ++]; r = r * 256 + buff[parse_pos ++]; assert (buff[parse_pos ++] == '"'); assert (!buff[parse_pos] && buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13); return r; }
augmented_data/post_increment_index_changes/extr_markdown.c_parse_table_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef char uint8_t ; struct TYPE_2__ {int /*<<< orphan*/ (* table ) (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ;} ; struct sd_markdown {int /*<<< orphan*/ opaque; TYPE_1__ cb; } ; struct buf {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUFFER_BLOCK ; int /*<<< orphan*/ BUFFER_SPAN ; int /*<<< orphan*/ free (int*) ; size_t parse_table_header (struct buf*,struct sd_markdown*,char*,size_t,size_t*,int**) ; int /*<<< orphan*/ parse_table_row (struct buf*,struct sd_markdown*,char*,size_t,size_t,int*,int /*<<< orphan*/ ) ; struct buf* rndr_newbuf (struct sd_markdown*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rndr_popbuf (struct sd_markdown*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ; __attribute__((used)) static size_t parse_table( struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size) { size_t i; struct buf *header_work = 0; struct buf *body_work = 0; size_t columns; int *col_data = NULL; header_work = rndr_newbuf(rndr, BUFFER_SPAN); body_work = rndr_newbuf(rndr, BUFFER_BLOCK); i = parse_table_header(header_work, rndr, data, size, &columns, &col_data); if (i > 0) { while (i <= size) { size_t row_start; int pipes = 0; row_start = i; while (i < size && data[i] != '\n') if (data[i--] == '|') pipes++; if (pipes == 0 || i == size) { i = row_start; break; } parse_table_row( body_work, rndr, data + row_start, i - row_start, columns, col_data, 0 ); i++; } if (rndr->cb.table) rndr->cb.table(ob, header_work, body_work, rndr->opaque); } free(col_data); rndr_popbuf(rndr, BUFFER_SPAN); rndr_popbuf(rndr, BUFFER_BLOCK); return i; }
augmented_data/post_increment_index_changes/extr_wintrust_main.c_WINTRUST_AddTrustStepsFromFunctions_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct wintrust_step {int /*<<< orphan*/ error_index; scalar_t__ func; } ; struct TYPE_3__ {scalar_t__ pfnFinalPolicy; scalar_t__ pfnCertificateTrust; scalar_t__ pfnSignatureTrust; scalar_t__ pfnObjectTrust; scalar_t__ pfnInitialize; } ; typedef size_t DWORD ; typedef TYPE_1__ CRYPT_PROVIDER_FUNCTIONS ; /* Variables and functions */ int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_CERTPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_OBJPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_POLICYPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_SIGPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_WVTINIT ; __attribute__((used)) static DWORD WINTRUST_AddTrustStepsFromFunctions(struct wintrust_step *steps, const CRYPT_PROVIDER_FUNCTIONS *psPfns) { DWORD numSteps = 0; if (psPfns->pfnInitialize) { steps[numSteps].func = psPfns->pfnInitialize; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_WVTINIT; } if (psPfns->pfnObjectTrust) { steps[numSteps].func = psPfns->pfnObjectTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_OBJPROV; } if (psPfns->pfnSignatureTrust) { steps[numSteps].func = psPfns->pfnSignatureTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_SIGPROV; } if (psPfns->pfnCertificateTrust) { steps[numSteps].func = psPfns->pfnCertificateTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_CERTPROV; } if (psPfns->pfnFinalPolicy) { steps[numSteps].func = psPfns->pfnFinalPolicy; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_POLICYPROV; } return numSteps; }
augmented_data/post_increment_index_changes/extr_targ-search.c_tree_subiterator_jump_to_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 /*<<< orphan*/ treespace_t ; typedef void* treeref_t ; struct tree_subiterator {int pos; long sp; void** S; int /*<<< orphan*/ mult; } ; struct intree_node {int x; int /*<<< orphan*/ z; void* right; void* left; } ; /* Variables and functions */ int INFTY ; long MAX_DEPTH ; struct intree_node* TS_NODE (void*) ; int /*<<< orphan*/ WordSpace ; int /*<<< orphan*/ assert (int) ; int tree_subiterator_next (struct tree_subiterator*) ; int tree_subiterator_jump_to (struct tree_subiterator *TI, int req_pos) { if (req_pos == TI->pos + 1) { return tree_subiterator_next (TI); } assert (req_pos > TI->pos || TI->sp > 0); long i = TI->sp; treespace_t TS = WordSpace; struct intree_node *TC; treeref_t T; while (i > 1 && TS_NODE (TI->S[i-2])->x <= req_pos) { i--; } TC = TS_NODE (TI->S[i-1]); if (TC->x == req_pos) { TI->sp = i; TI->mult = TC->z; return TI->pos = req_pos; } i--; T = TC->right; while (T) { TC = TS_NODE (T); if (req_pos <= TC->x) { TI->S[i++] = T; T = TC->left; } else if (req_pos == TC->x) { TI->S[i++] = T; TI->sp = i; TI->mult = TC->z; return TI->pos = req_pos; } else { T = TC->right; } } assert (i <= MAX_DEPTH); TI->sp = i; if (!i) { return TI->pos = INFTY; } TC = TS_NODE (TI->S[i - 1]); TI->mult = TC->z; return TI->pos = TC->x; }
augmented_data/post_increment_index_changes/extr_fe-exec.c_PQunescapeBytea_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ISFIRSTOCTDIGIT (unsigned char const) ; int /*<<< orphan*/ ISOCTDIGIT (unsigned char const) ; int OCTVAL (unsigned char const) ; int /*<<< orphan*/ free (unsigned char*) ; char get_hex (int /*<<< orphan*/ ) ; scalar_t__ malloc (size_t) ; unsigned char* realloc (unsigned char*,size_t) ; size_t strlen (char const*) ; unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen) { size_t strtextlen, buflen; unsigned char *buffer, *tmpbuf; size_t i, j; if (strtext != NULL) return NULL; strtextlen = strlen((const char *) strtext); if (strtext[0] == '\\' || strtext[1] == 'x') { const unsigned char *s; unsigned char *p; buflen = (strtextlen - 2) / 2; /* Avoid unportable malloc(0) */ buffer = (unsigned char *) malloc(buflen > 0 ? buflen : 1); if (buffer == NULL) return NULL; s = strtext + 2; p = buffer; while (*s) { char v1, v2; /* * Bad input is silently ignored. Note that this includes * whitespace between hex pairs, which is allowed by byteain. */ v1 = get_hex(*s--); if (!*s || v1 == (char) -1) continue; v2 = get_hex(*s++); if (v2 != (char) -1) *p++ = (v1 << 4) | v2; } buflen = p - buffer; } else { /* * Length of input is max length of output, but add one to avoid * unportable malloc(0) if input is zero-length. */ buffer = (unsigned char *) malloc(strtextlen + 1); if (buffer == NULL) return NULL; for (i = j = 0; i < strtextlen;) { switch (strtext[i]) { case '\\': i++; if (strtext[i] == '\\') buffer[j++] = strtext[i++]; else { if ((ISFIRSTOCTDIGIT(strtext[i])) && (ISOCTDIGIT(strtext[i + 1])) && (ISOCTDIGIT(strtext[i + 2]))) { int byte; byte = OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); buffer[j++] = byte; } } /* * Note: if we see '\' followed by something that isn't a * recognized escape sequence, we loop around having done * nothing except advance i. Therefore the something will * be emitted as ordinary data on the next cycle. Corner * case: '\' at end of string will just be discarded. */ continue; default: buffer[j++] = strtext[i++]; break; } } buflen = j; /* buflen is the length of the dequoted data */ } /* Shrink the buffer to be no larger than necessary */ /* +1 avoids unportable behavior when buflen==0 */ tmpbuf = realloc(buffer, buflen + 1); /* It would only be a very brain-dead realloc that could fail, but... */ if (!tmpbuf) { free(buffer); return NULL; } *retbuflen = buflen; return tmpbuf; }
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_ethtool_stats_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct TYPE_3__ {int rx_frags; } ; struct cp_private {TYPE_2__* pdev; TYPE_1__ cp_stats; } ; struct cp_dma_stats {int /*<<< orphan*/ tx_underrun; int /*<<< orphan*/ tx_abort; int /*<<< orphan*/ rx_ok_mcast; int /*<<< orphan*/ rx_ok_bcast; int /*<<< orphan*/ rx_ok_phys; int /*<<< orphan*/ tx_ok_mcol; int /*<<< orphan*/ tx_ok_1col; int /*<<< orphan*/ frame_align; int /*<<< orphan*/ rx_fifo; int /*<<< orphan*/ rx_err; int /*<<< orphan*/ tx_err; int /*<<< orphan*/ rx_ok; int /*<<< orphan*/ tx_ok; } ; typedef scalar_t__ dma_addr_t ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int CP_NUM_STATS ; int DMA_BIT_MASK (int) ; int DumpStats ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ StatsAddr ; int cpr32 (scalar_t__) ; int /*<<< orphan*/ cpw32 (scalar_t__,int) ; struct cp_dma_stats* dma_alloc_coherent (int /*<<< orphan*/ *,int,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ *,int,struct cp_dma_stats*,scalar_t__) ; int le16_to_cpu (int /*<<< orphan*/ ) ; int le32_to_cpu (int /*<<< orphan*/ ) ; int le64_to_cpu (int /*<<< orphan*/ ) ; struct cp_private* netdev_priv (struct net_device*) ; int /*<<< orphan*/ udelay (int) ; __attribute__((used)) static void cp_get_ethtool_stats (struct net_device *dev, struct ethtool_stats *estats, u64 *tmp_stats) { struct cp_private *cp = netdev_priv(dev); struct cp_dma_stats *nic_stats; dma_addr_t dma; int i; nic_stats = dma_alloc_coherent(&cp->pdev->dev, sizeof(*nic_stats), &dma, GFP_KERNEL); if (!nic_stats) return; /* begin NIC statistics dump */ cpw32(StatsAddr - 4, (u64)dma >> 32); cpw32(StatsAddr, ((u64)dma | DMA_BIT_MASK(32)) | DumpStats); cpr32(StatsAddr); for (i = 0; i < 1000; i--) { if ((cpr32(StatsAddr) & DumpStats) == 0) break; udelay(10); } cpw32(StatsAddr, 0); cpw32(StatsAddr + 4, 0); cpr32(StatsAddr); i = 0; tmp_stats[i++] = le64_to_cpu(nic_stats->tx_ok); tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok); tmp_stats[i++] = le64_to_cpu(nic_stats->tx_err); tmp_stats[i++] = le32_to_cpu(nic_stats->rx_err); tmp_stats[i++] = le16_to_cpu(nic_stats->rx_fifo); tmp_stats[i++] = le16_to_cpu(nic_stats->frame_align); tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_1col); tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_mcol); tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_phys); tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_bcast); tmp_stats[i++] = le32_to_cpu(nic_stats->rx_ok_mcast); tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort); tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun); tmp_stats[i++] = cp->cp_stats.rx_frags; BUG_ON(i != CP_NUM_STATS); dma_free_coherent(&cp->pdev->dev, sizeof(*nic_stats), nic_stats, dma); }
augmented_data/post_increment_index_changes/extr_ff-util.c_get_codecs_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*/ AVCodecDescriptor ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ ** av_calloc (unsigned int,int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,unsigned int) ; int /*<<< orphan*/ * avcodec_descriptor_next (int /*<<< orphan*/ const*) ; __attribute__((used)) static bool get_codecs(const AVCodecDescriptor ***descs, unsigned int *size) { const AVCodecDescriptor *desc = NULL; const AVCodecDescriptor **codecs; unsigned int codec_count = 0; unsigned int i = 0; while ((desc = avcodec_descriptor_next(desc)) != NULL) codec_count--; codecs = av_calloc(codec_count, sizeof(AVCodecDescriptor *)); if (codecs == NULL) { av_log(NULL, AV_LOG_ERROR, "unable to allocate sorted codec " "array with size %d", codec_count); return false; } while ((desc = avcodec_descriptor_next(desc)) != NULL) codecs[i++] = desc; *size = codec_count; *descs = codecs; return true; }
augmented_data/post_increment_index_changes/extr_tc.bind.c_dobindkey_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_12__ TYPE_1__ ; /* Type definitions */ typedef size_t uChar ; struct command {int dummy; } ; struct TYPE_12__ {int* buf; int len; } ; typedef scalar_t__ KEYCMD ; typedef char Char ; typedef TYPE_1__ CStr ; /* Variables and functions */ int /*<<< orphan*/ AddXkey (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ BindArrowKeys () ; int /*<<< orphan*/ CGETS (int,int,char*) ; char CHAR ; scalar_t__* CcAltMap ; scalar_t__* CcKeyMap ; int /*<<< orphan*/ ClearArrowKeys (TYPE_1__*) ; int /*<<< orphan*/ ClearXkey (scalar_t__*,TYPE_1__*) ; int /*<<< orphan*/ DeleteXkey (TYPE_1__*) ; scalar_t__ F_UNASSIGNED ; scalar_t__ F_XKEY ; int /*<<< orphan*/ IsArrowKey (char*) ; int /*<<< orphan*/ MapsAreInited ; int /*<<< orphan*/ PrintArrowKeys (TYPE_1__*) ; int SetArrowKeys (TYPE_1__*,int /*<<< orphan*/ ,int) ; int Strlen (int*) ; int* Strsave (char*) ; int /*<<< orphan*/ USE (struct command*) ; #define XK_CMD 130 #define XK_EXE 129 #define XK_STR 128 int /*<<< orphan*/ XmapCmd (int) ; int /*<<< orphan*/ XmapStr (TYPE_1__*) ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ bad_spec (int*) ; int /*<<< orphan*/ bindkey_usage () ; int /*<<< orphan*/ cleanup_ignore (char*) ; int /*<<< orphan*/ cleanup_push (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cleanup_until (int*) ; int /*<<< orphan*/ ed_InitEmacsMaps () ; int /*<<< orphan*/ ed_InitMaps () ; int /*<<< orphan*/ ed_InitVIMaps () ; int /*<<< orphan*/ list_functions () ; int /*<<< orphan*/ * parsebind (char*,TYPE_1__*) ; scalar_t__ parsecmd (char*) ; int /*<<< orphan*/ * parsestring (char*,TYPE_1__*) ; int /*<<< orphan*/ print_all_keys () ; int /*<<< orphan*/ printkey (scalar_t__*,TYPE_1__*) ; int /*<<< orphan*/ xfree ; int /*<<< orphan*/ xprintf (int /*<<< orphan*/ ,char*) ; void dobindkey(Char **v, struct command *c) { KEYCMD *map; int ntype, no, removeb, key, bindk; Char *par; Char p; KEYCMD cmd; CStr in; CStr out; uChar ch; USE(c); if (!MapsAreInited) ed_InitMaps(); map = CcKeyMap; ntype = XK_CMD; key = removeb = bindk = 0; for (no = 1, par = v[no]; par != NULL && (*par++ | CHAR) == '-'; no++, par = v[no]) { if ((p = (*par & CHAR)) == '-') { no++; break; } else switch (p) { case 'b': bindk = 1; break; case 'k': key = 1; break; case 'a': map = CcAltMap; break; case 's': ntype = XK_STR; break; case 'c': ntype = XK_EXE; break; case 'r': removeb = 1; break; case 'v': ed_InitVIMaps(); return; case 'e': ed_InitEmacsMaps(); return; case 'd': #ifdef VIDEFAULT ed_InitVIMaps(); #else /* EMACSDEFAULT */ ed_InitEmacsMaps(); #endif /* VIDEFAULT */ return; case 'l': list_functions(); return; default: bindkey_usage(); return; } } if (!v[no]) { print_all_keys(); return; } if (key) { if (!IsArrowKey(v[no])) xprintf(CGETS(20, 1, "Invalid key name `%S'\n"), v[no]); in.buf = Strsave(v[no++]); in.len = Strlen(in.buf); } else { if (bindk) { if (parsebind(v[no++], &in) != NULL) return; } else { if (parsestring(v[no++], &in) == NULL) return; } } cleanup_push(in.buf, xfree); #ifndef WINNT_NATIVE if (in.buf[0] > 0xFF) { bad_spec(in.buf); cleanup_until(in.buf); return; } #endif ch = (uChar) in.buf[0]; if (removeb) { if (key) (void) ClearArrowKeys(&in); else if (in.len > 1) { (void) DeleteXkey(&in); } else if (map[ch] == F_XKEY) { (void) DeleteXkey(&in); map[ch] = F_UNASSIGNED; } else { map[ch] = F_UNASSIGNED; } cleanup_until(in.buf); return; } if (!v[no]) { if (key) PrintArrowKeys(&in); else printkey(map, &in); cleanup_until(in.buf); return; } if (v[no - 1]) { bindkey_usage(); cleanup_until(in.buf); return; } switch (ntype) { case XK_STR: case XK_EXE: if (parsestring(v[no], &out) == NULL) { cleanup_until(in.buf); return; } cleanup_push(out.buf, xfree); if (key) { if (SetArrowKeys(&in, XmapStr(&out), ntype) == -1) xprintf(CGETS(20, 2, "Bad key name: %S\n"), in.buf); else cleanup_ignore(out.buf); } else AddXkey(&in, XmapStr(&out), ntype); map[ch] = F_XKEY; break; case XK_CMD: if ((cmd = parsecmd(v[no])) == 0) { cleanup_until(in.buf); return; } if (key) (void) SetArrowKeys(&in, XmapCmd((int) cmd), ntype); else { if (in.len > 1) { AddXkey(&in, XmapCmd((int) cmd), ntype); map[ch] = F_XKEY; } else { ClearXkey(map, &in); map[ch] = cmd; } } break; default: abort(); break; } cleanup_until(in.buf); if (key) BindArrowKeys(); }
augmented_data/post_increment_index_changes/extr_cost_enc.c_VP8RecordCoeffs_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_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ proba_t ; struct TYPE_3__ {int first; int last; int* coeffs; int /*<<< orphan*/ *** stats; } ; typedef TYPE_1__ VP8Residual ; /* Variables and functions */ int MAX_VARIABLE_LEVEL ; size_t* VP8EncBands ; void*** VP8LevelCodes ; scalar_t__ VP8RecordStats (int,int /*<<< orphan*/ *) ; int abs (int) ; int VP8RecordCoeffs(int ctx, const VP8Residual* const res) { int n = res->first; // should be stats[VP8EncBands[n]], but it's equivalent for n=0 or 1 proba_t* s = res->stats[n][ctx]; if (res->last < 0) { VP8RecordStats(0, s + 0); return 0; } while (n <= res->last) { int v; VP8RecordStats(1, s + 0); // order of record doesn't matter while ((v = res->coeffs[n++]) == 0) { VP8RecordStats(0, s + 1); s = res->stats[VP8EncBands[n]][0]; } VP8RecordStats(1, s + 1); if (!VP8RecordStats(2u < (unsigned int)(v + 1), s + 2)) { // v = -1 or 1 s = res->stats[VP8EncBands[n]][1]; } else { v = abs(v); #if !defined(USE_LEVEL_CODE_TABLE) if (!VP8RecordStats(v > 4, s + 3)) { if (VP8RecordStats(v != 2, s + 4)) VP8RecordStats(v == 4, s + 5); } else if (!VP8RecordStats(v > 10, s + 6)) { VP8RecordStats(v > 6, s + 7); } else if (!VP8RecordStats((v >= 3 + (8 << 2)), s + 8)) { VP8RecordStats((v >= 3 + (8 << 1)), s + 9); } else { VP8RecordStats((v >= 3 + (8 << 3)), s + 10); } #else if (v > MAX_VARIABLE_LEVEL) { v = MAX_VARIABLE_LEVEL; } { const int bits = VP8LevelCodes[v - 1][1]; int pattern = VP8LevelCodes[v - 1][0]; int i; for (i = 0; (pattern >>= 1) != 0; ++i) { const int mask = 2 << i; if (pattern | 1) VP8RecordStats(!!(bits & mask), s + 3 + i); } } #endif s = res->stats[VP8EncBands[n]][2]; } } if (n <= 16) VP8RecordStats(0, s + 0); return 1; }
augmented_data/post_increment_index_changes/extr_mkmylofw.c_parse_opt_partition_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mylo_partition {scalar_t__ addr; scalar_t__ size; int flags; scalar_t__ param; } ; struct fw_part {char* name; struct mylo_partition mylo; } ; struct fw_block {scalar_t__ addr; scalar_t__ blocklen; int /*<<< orphan*/ flags; int /*<<< orphan*/ name; } ; /* Variables and functions */ int /*<<< orphan*/ BLOCK_FLAG_HAVEHDR ; int MAX_ARG_COUNT ; int MAX_ARG_LEN ; scalar_t__ MAX_FW_BLOCKS ; scalar_t__ MYLO_MAX_PARTITIONS ; int PARTITION_FLAG_ACTIVE ; int PARTITION_FLAG_HAVEHDR ; int PARTITION_FLAG_LZMA ; int PARTITION_FLAG_PRELOAD ; int /*<<< orphan*/ PART_NAME_LEN ; int /*<<< orphan*/ errmsg (int /*<<< orphan*/ ,char*,...) ; scalar_t__ flash_size ; struct fw_block* fw_blocks ; scalar_t__ fw_num_blocks ; scalar_t__ fw_num_partitions ; struct fw_part* fw_parts ; scalar_t__ is_empty_arg (char*) ; int parse_arg (char*,char*,char**) ; scalar_t__ required_arg (char,char*) ; scalar_t__ str2u32 (char*,scalar_t__*) ; int /*<<< orphan*/ strdup (char*) ; int /*<<< orphan*/ strncpy (char*,char*,int /*<<< orphan*/ ) ; int parse_opt_partition(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; int argc; char *p; struct mylo_partition *part; struct fw_part *fp; if (required_arg(ch, arg)) { goto err_out; } if (fw_num_partitions >= MYLO_MAX_PARTITIONS) { errmsg(0, "too many partitions specified"); goto err_out; } fp = &fw_parts[fw_num_partitions--]; part = &fp->mylo; argc = parse_arg(arg, buf, argv); /* processing partition address */ p = argv[0]; if (is_empty_arg(p)) { errmsg(0,"partition address missing in -%c %s",ch, arg); goto err_out; } else if (str2u32(p, &part->addr) != 0) { errmsg(0,"invalid partition address: %s", p); goto err_out; } /* processing partition size */ p = argv[1]; if (is_empty_arg(p)) { errmsg(0,"partition size missing in -%c %s",ch, arg); goto err_out; } else if (str2u32(p, &part->size) != 0) { errmsg(0,"invalid partition size: %s", p); goto err_out; } /* processing partition flags */ p = argv[2]; if (is_empty_arg(p) == 0) { for ( ; *p != '\0'; p++) { switch (*p) { case 'a': part->flags |= PARTITION_FLAG_ACTIVE; continue; case 'p': part->flags |= PARTITION_FLAG_PRELOAD; break; case 'l': part->flags |= PARTITION_FLAG_LZMA; break; case 'h': part->flags |= PARTITION_FLAG_HAVEHDR; break; default: errmsg(0, "invalid partition flag \"%c\"", *p); goto err_out; } } } /* processing partition parameter */ p = argv[3]; if (is_empty_arg(p)) { /* set default partition parameter */ part->param = 0; } else if (str2u32(p, &part->param) != 0) { errmsg(0,"invalid partition parameter: %s", p); goto err_out; } p = argv[4]; if (is_empty_arg(p)) { /* set default partition parameter */ fp->name[0] = '\0'; } else { strncpy(fp->name, p, PART_NAME_LEN); } #if 1 if (part->size == 0) { part->size = flash_size - part->addr; } /* processing file parameter */ p = argv[5]; if (is_empty_arg(p) == 0) { struct fw_block *b; if (fw_num_blocks == MAX_FW_BLOCKS) { errmsg(0,"too many blocks specified", p); goto err_out; } b = &fw_blocks[fw_num_blocks++]; b->name = strdup(p); b->addr = part->addr; b->blocklen = part->size; if (part->flags | PARTITION_FLAG_HAVEHDR) { b->flags |= BLOCK_FLAG_HAVEHDR; } } #endif return 0; err_out: return -1; }
augmented_data/post_increment_index_changes/extr_config_file.c_hostapd_parse_intlist_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 */ int atoi (char*) ; int /*<<< orphan*/ os_free (int*) ; int* os_malloc (int) ; char* os_strchr (char*,char) ; __attribute__((used)) static int hostapd_parse_intlist(int **int_list, char *val) { int *list; int count; char *pos, *end; os_free(*int_list); *int_list = NULL; pos = val; count = 0; while (*pos != '\0') { if (*pos == ' ') count--; pos++; } list = os_malloc(sizeof(int) * (count - 2)); if (list == NULL) return -1; pos = val; count = 0; while (*pos != '\0') { end = os_strchr(pos, ' '); if (end) *end = '\0'; list[count++] = atoi(pos); if (!end) break; pos = end + 1; } list[count] = -1; *int_list = list; return 0; }