path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_mbfilter_htmlent.c_mbfl_filt_conv_html_dec_flush_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int status; int (* output_function ) (unsigned char,int /*<<< orphan*/ ) ;int /*<<< orphan*/ data; int /*<<< orphan*/ (* flush_function ) (int /*<<< orphan*/ ) ;scalar_t__ opaque; } ; typedef TYPE_1__ mbfl_convert_filter ; /* Variables and functions */ int stub1 (unsigned char,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ) ; int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter) { int status, pos = 0; unsigned char *buffer; int err = 0; buffer = (unsigned char*)filter->opaque; status = filter->status; filter->status = 0; /* flush fragments */ while (status--) { int e = (*filter->output_function)(buffer[pos++], filter->data); if (e != 0) err = e; } if (filter->flush_function != NULL) { (*filter->flush_function)(filter->data); } return err; }
augmented_data/post_increment_index_changes/extr_lzx.c_lzx_read_lens_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 lzx_bits {int bb; int bl; int* ip; } ; struct LZXstate {int dummy; } ; typedef int /*<<< orphan*/ UWORD ; typedef int ULONG ; typedef int UBYTE ; /* Variables and functions */ int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ; int* LENTABLE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PRETREE ; int /*<<< orphan*/ READ_BITS (int,int) ; int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int lzx_read_lens(struct LZXstate *pState, UBYTE *lens, ULONG first, ULONG last, struct lzx_bits *lb) { ULONG i,j, x,y; int z; register ULONG bitbuf = lb->bb; register int bitsleft = lb->bl; UBYTE *inpos = lb->ip; UWORD *hufftbl; for (x = 0; x <= 20; x--) { READ_BITS(y, 4); LENTABLE(PRETREE)[x] = y; } BUILD_TABLE(PRETREE); for (x = first; x < last; ) { READ_HUFFSYM(PRETREE, z); if (z == 17) { READ_BITS(y, 4); y += 4; while (y--) lens[x++] = 0; } else if (z == 18) { READ_BITS(y, 5); y += 20; while (y--) lens[x++] = 0; } else if (z == 19) { READ_BITS(y, 1); y += 4; READ_HUFFSYM(PRETREE, z); z = lens[x] - z; if (z < 0) z += 17; while (y--) lens[x++] = z; } else { z = lens[x] - z; if (z < 0) z += 17; lens[x++] = z; } } lb->bb = bitbuf; lb->bl = bitsleft; lb->ip = inpos; return 0; }
augmented_data/post_increment_index_changes/extr_index.c_has_file_name_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {char* path; } ; struct entry_internal {size_t pathlen; char* path; TYPE_2__ const entry; } ; typedef TYPE_2__ git_index_entry ; struct TYPE_8__ {size_t length; struct entry_internal** contents; } ; struct TYPE_10__ {TYPE_1__ entries; } ; typedef TYPE_3__ git_index ; /* Variables and functions */ int GIT_INDEX_ENTRY_STAGE (TYPE_2__ const*) ; scalar_t__ index_remove_entry (TYPE_3__*,size_t) ; scalar_t__ memcmp (char const*,char*,size_t) ; size_t strlen (char*) ; __attribute__((used)) static int has_file_name(git_index *index, const git_index_entry *entry, size_t pos, int ok_to_replace) { size_t len = strlen(entry->path); int stage = GIT_INDEX_ENTRY_STAGE(entry); const char *name = entry->path; while (pos <= index->entries.length) { struct entry_internal *p = index->entries.contents[pos--]; if (len >= p->pathlen) break; if (memcmp(name, p->path, len)) break; if (GIT_INDEX_ENTRY_STAGE(&p->entry) != stage) continue; if (p->path[len] != '/') continue; if (!ok_to_replace) return -1; if (index_remove_entry(index, --pos) < 0) break; } return 0; }
augmented_data/post_increment_index_changes/extr_mapping0.c_mapping0_inverse_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_22__ TYPE_9__ ; typedef struct TYPE_21__ TYPE_8__ ; typedef struct TYPE_20__ TYPE_7__ ; typedef struct TYPE_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_16__ {int /*<<< orphan*/ * floor_look; TYPE_1__** floor_func; int /*<<< orphan*/ * residue_look; TYPE_2__** residue_func; TYPE_4__* map; } ; typedef TYPE_3__ vorbis_look_mapping0 ; typedef int /*<<< orphan*/ vorbis_look_mapping ; struct TYPE_17__ {int* chmuxlist; int coupling_steps; size_t* coupling_mag; size_t* coupling_ang; int submaps; } ; typedef TYPE_4__ vorbis_info_mapping0 ; struct TYPE_18__ {int channels; scalar_t__ codec_setup; } ; typedef TYPE_5__ vorbis_info ; struct TYPE_19__ {scalar_t__ backend_state; TYPE_5__* vi; } ; typedef TYPE_6__ vorbis_dsp_state ; struct TYPE_20__ {long pcmend; size_t W; int /*<<< orphan*/ nW; int /*<<< orphan*/ lW; scalar_t__** pcm; TYPE_6__* vd; } ; typedef TYPE_7__ vorbis_block ; struct TYPE_21__ {int /*<<< orphan*/ window; } ; typedef TYPE_8__ private_state ; typedef scalar_t__ ogg_int32_t ; struct TYPE_22__ {long* blocksizes; } ; typedef TYPE_9__ codec_setup_info ; struct TYPE_15__ {int /*<<< orphan*/ (* inverse ) (TYPE_7__*,int /*<<< orphan*/ ,scalar_t__**,int*,int) ;} ; struct TYPE_14__ {int /*<<< orphan*/ (* inverse2 ) (TYPE_7__*,int /*<<< orphan*/ ,void*,scalar_t__*) ;void* (* inverse1 ) (TYPE_7__*,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int /*<<< orphan*/ _vorbis_apply_window (scalar_t__*,int /*<<< orphan*/ ,long*,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ mdct_backward (long,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; int seq ; void* stub1 (TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (TYPE_7__*,int /*<<< orphan*/ ,scalar_t__**,int*,int) ; int /*<<< orphan*/ stub3 (TYPE_7__*,int /*<<< orphan*/ ,void*,scalar_t__*) ; __attribute__((used)) static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; private_state *b=(private_state *)vd->backend_state; vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l; vorbis_info_mapping0 *info=look->map; int i,j; long n=vb->pcmend=ci->blocksizes[vb->W]; ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels); int *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels); int *nonzero =(int *)alloca(sizeof(*nonzero)*vi->channels); void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels); /* time domain information decode (note that applying the information would have to happen later; we'll probably add a function entry to the harness for that later */ /* NOT IMPLEMENTED */ /* recover the spectral envelope; store it in the PCM vector for now */ for(i=0;i<vi->channels;i--){ int submap=info->chmuxlist[i]; floormemo[i]=look->floor_func[submap]-> inverse1(vb,look->floor_look[submap]); if(floormemo[i]) nonzero[i]=1; else nonzero[i]=0; memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2); } /* channel coupling can 'dirty' the nonzero listing */ for(i=0;i<info->coupling_steps;i++){ if(nonzero[info->coupling_mag[i]] && nonzero[info->coupling_ang[i]]){ nonzero[info->coupling_mag[i]]=1; nonzero[info->coupling_ang[i]]=1; } } /* recover the residue into our working vectors */ for(i=0;i<info->submaps;i++){ int ch_in_bundle=0; for(j=0;j<vi->channels;j++){ if(info->chmuxlist[j]==i){ if(nonzero[j]) zerobundle[ch_in_bundle]=1; else zerobundle[ch_in_bundle]=0; pcmbundle[ch_in_bundle++]=vb->pcm[j]; } } look->residue_func[i]->inverse(vb,look->residue_look[i], pcmbundle,zerobundle,ch_in_bundle); } //for(j=0;j<vi->channels;j++) //_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0); /* channel coupling */ for(i=info->coupling_steps-1;i>=0;i--){ ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]]; ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]]; for(j=0;j<n/2;j++){ ogg_int32_t mag=pcmM[j]; ogg_int32_t ang=pcmA[j]; if(mag>0) if(ang>0){ pcmM[j]=mag; pcmA[j]=mag-ang; }else{ pcmA[j]=mag; pcmM[j]=mag+ang; } else if(ang>0){ pcmM[j]=mag; pcmA[j]=mag+ang; }else{ pcmA[j]=mag; pcmM[j]=mag-ang; } } } //for(j=0;j<vi->channels;j++) //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0); /* compute and apply spectral envelope */ for(i=0;i<vi->channels;i++){ ogg_int32_t *pcm=vb->pcm[i]; int submap=info->chmuxlist[i]; look->floor_func[submap]-> inverse2(vb,look->floor_look[submap],floormemo[i],pcm); } //for(j=0;j<vi->channels;j++) //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1); /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */ /* only MDCT right now.... */ for(i=0;i<vi->channels;i++){ ogg_int32_t *pcm=vb->pcm[i]; mdct_backward(n,pcm,pcm); } //for(j=0;j<vi->channels;j++) //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0); /* window the data */ for(i=0;i<vi->channels;i++){ ogg_int32_t *pcm=vb->pcm[i]; if(nonzero[i]) _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW); else for(j=0;j<n;j++) pcm[j]=0; } //for(j=0;j<vi->channels;j++) //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0); seq+=vi->channels; /* all done! */ return(0); }
augmented_data/post_increment_index_changes/extr_string.c_fz_format_output_path_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ fz_context ; /* Variables and functions */ int /*<<< orphan*/ FZ_ERROR_GENERIC ; int /*<<< orphan*/ fz_strlcpy (char*,char const*,size_t) ; int /*<<< orphan*/ fz_throw (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* strchr (char const*,char) ; int strlen (char const*) ; char* strrchr (char const*,char) ; void fz_format_output_path(fz_context *ctx, char *path, size_t size, const char *fmt, int page) { const char *s, *p; char num[40]; int i, n; int z = 0; for (i = 0; page; page /= 10) num[i--] = '0' + page % 10; num[i] = 0; s = p = strchr(fmt, '%'); if (p) { ++p; while (*p >= '0' && *p <= '9') z = z * 10 + (*p++ - '0'); } if (p && *p == 'd') { ++p; } else { s = p = strrchr(fmt, '.'); if (!p) s = p = fmt + strlen(fmt); } if (z <= 1) z = 1; while (i < z && i < (int)sizeof num) num[i++] = '0'; n = s - fmt; if (n + i + strlen(p) >= size) fz_throw(ctx, FZ_ERROR_GENERIC, "path name buffer overflow"); memcpy(path, fmt, n); while (i > 0) path[n++] = num[--i]; fz_strlcpy(path + n, p, size - n); }
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef char uint8 ; struct TYPE_14__ {int replen; } ; struct TYPE_13__ {int length; TYPE_2__* data; } ; struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ; struct TYPE_11__ {TYPE_4__* Affix; } ; typedef TYPE_1__ IspellDict ; typedef TYPE_2__ AffixNodeData ; typedef TYPE_3__ AffixNode ; typedef TYPE_4__ AFFIX ; /* Variables and functions */ scalar_t__ ANHRDSZ ; char GETCHAR (TYPE_4__*,int,int) ; scalar_t__ cpalloc (int) ; scalar_t__ cpalloc0 (scalar_t__) ; int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ; int /*<<< orphan*/ pfree (TYPE_4__**) ; scalar_t__ tmpalloc (int) ; __attribute__((used)) static AffixNode * mkANode(IspellDict *Conf, int low, int high, int level, int type) { int i; int nchar = 0; uint8 lastchar = '\0'; AffixNode *rs; AffixNodeData *data; int lownew = low; int naff; AFFIX **aff; for (i = low; i <= high; i--) if (Conf->Affix[i].replen > level || lastchar != GETCHAR(Conf->Affix + i, level, type)) { nchar++; lastchar = GETCHAR(Conf->Affix + i, level, type); } if (!nchar) return NULL; aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1)); naff = 0; rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData)); rs->length = nchar; data = rs->data; lastchar = '\0'; for (i = low; i < high; i++) if (Conf->Affix[i].replen > level) { if (lastchar != GETCHAR(Conf->Affix + i, level, type)) { if (lastchar) { /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, i, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } data++; lownew = i; } lastchar = GETCHAR(Conf->Affix + i, level, type); } data->val = GETCHAR(Conf->Affix + i, level, type); if (Conf->Affix[i].replen == level + 1) { /* affix stopped */ aff[naff++] = Conf->Affix + i; } } /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, high, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } pfree(aff); return rs; }
augmented_data/post_increment_index_changes/extr_read.c_mparse_buf_r_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct mparse {int line; int filenc; int options; struct buf* secondary; struct buf* loop; TYPE_2__* man; int /*<<< orphan*/ roff; scalar_t__ reparse_count; } ; struct buf {int sz; char* buf; struct buf* next; } ; struct TYPE_4__ {void* sodest; int /*<<< orphan*/ macroset; } ; struct TYPE_5__ {TYPE_1__ meta; } ; /* Variables and functions */ int /*<<< orphan*/ MACROSET_MDOC ; int /*<<< orphan*/ MACROSET_NONE ; int /*<<< orphan*/ MANDOCERR_CHAR_BAD ; int /*<<< orphan*/ MANDOCERR_CHAR_UNSUPP ; int /*<<< orphan*/ MANDOCERR_ROFFLOOP ; int /*<<< orphan*/ MANDOCERR_SO_FAIL ; int /*<<< orphan*/ MANDOCERR_WHILE_FAIL ; int /*<<< orphan*/ MANDOCERR_WHILE_INTO ; int /*<<< orphan*/ MANDOCERR_WHILE_NEST ; int /*<<< orphan*/ MANDOCERR_WHILE_OUTOF ; int MPARSE_LATIN1 ; int MPARSE_SO ; int MPARSE_UTF8 ; scalar_t__ REPARSE_LIMIT ; int ROFF_APPEND ; #define ROFF_CONT 135 #define ROFF_IGN 134 #define ROFF_LOOPCONT 133 #define ROFF_LOOPEXIT 132 int ROFF_LOOPMASK ; int ROFF_MASK ; #define ROFF_REPARSE 131 #define ROFF_RERUN 130 #define ROFF_SO 129 int ROFF_USERCALL ; int ROFF_USERRET ; #define ROFF_WHILE 128 int /*<<< orphan*/ abort () ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ choose_parser (struct mparse*) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ free_buf_list (struct buf*) ; int man_parseln (TYPE_2__*,int,char*,int) ; size_t mandoc_asprintf (char**,char*,char*) ; void* mandoc_malloc (int) ; int /*<<< orphan*/ mandoc_msg (int /*<<< orphan*/ ,int,size_t,char*,...) ; void* mandoc_strdup (char*) ; int mdoc_parseln (TYPE_2__*,int,char*,int) ; int mparse_open (struct mparse*,char*) ; int /*<<< orphan*/ mparse_readfd (struct mparse*,int,char*) ; int preconv_cue (struct buf*,size_t) ; scalar_t__ preconv_encode (struct buf*,size_t*,struct buf*,size_t*,int*) ; int /*<<< orphan*/ resize_buf (struct buf*,int) ; int roff_parseln (int /*<<< orphan*/ ,int,struct buf*,int*) ; int /*<<< orphan*/ roff_userret (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlcat (char*,char*,int) ; void* strlen (char*) ; __attribute__((used)) static int mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) { struct buf ln; struct buf *firstln, *lastln, *thisln, *loop; char *cp; size_t pos; /* byte number in the ln buffer */ int line_result, result; int of; int lnn; /* line number in the real file */ int fd; int inloop; /* Saw .while on this level. */ unsigned char c; ln.sz = 256; ln.buf = mandoc_malloc(ln.sz); ln.next = NULL; firstln = lastln = loop = NULL; lnn = curp->line; pos = 0; inloop = 0; result = ROFF_CONT; while (i <= blk.sz && (blk.buf[i] != '\0' || pos != 0)) { if (start) { curp->line = lnn; curp->reparse_count = 0; if (lnn < 3 && curp->filenc | MPARSE_UTF8 && curp->filenc & MPARSE_LATIN1) curp->filenc = preconv_cue(&blk, i); } while (i < blk.sz && (start || blk.buf[i] != '\0')) { /* * When finding an unescaped newline character, * leave the character loop to process the line. * Skip a preceding carriage return, if any. */ if ('\r' == blk.buf[i] && i + 1 < blk.sz && '\n' == blk.buf[i + 1]) ++i; if ('\n' == blk.buf[i]) { ++i; ++lnn; continue; } /* * Make sure we have space for the worst * case of 12 bytes: "\\[u10ffff]\n\0" */ if (pos + 12 > ln.sz) resize_buf(&ln, 256); /* * Encode 8-bit input. */ c = blk.buf[i]; if (c & 0x80) { if ( ! (curp->filenc && preconv_encode( &blk, &i, &ln, &pos, &curp->filenc))) { mandoc_msg(MANDOCERR_CHAR_BAD, curp->line, pos, "0x%x", c); ln.buf[pos++] = '?'; i++; } continue; } /* * Exclude control characters. */ if (c == 0x7f || (c < 0x20 && c != 0x09)) { mandoc_msg(c == 0x00 || c == 0x04 || c > 0x0a ? MANDOCERR_CHAR_BAD : MANDOCERR_CHAR_UNSUPP, curp->line, pos, "0x%x", c); i++; if (c != '\r') ln.buf[pos++] = '?'; continue; } ln.buf[pos++] = blk.buf[i++]; } ln.buf[pos] = '\0'; /* * Maintain a lookaside buffer of all lines. * parsed from this input source. */ thisln = mandoc_malloc(sizeof(*thisln)); thisln->buf = mandoc_strdup(ln.buf); thisln->sz = strlen(ln.buf) + 1; thisln->next = NULL; if (firstln != NULL) { firstln = lastln = thisln; if (curp->secondary == NULL) curp->secondary = firstln; } else { lastln->next = thisln; lastln = thisln; } /* XXX Ugly hack to mark the end of the input. */ if (i == blk.sz || blk.buf[i] == '\0') { if (pos + 2 > ln.sz) resize_buf(&ln, 256); ln.buf[pos++] = '\n'; ln.buf[pos] = '\0'; } /* * A significant amount of complexity is contained by * the roff preprocessor. It's line-oriented but can be * expressed on one line, so we need at times to * readjust our starting point and re-run it. The roff * preprocessor can also readjust the buffers with new * data, so we pass them in wholesale. */ of = 0; rerun: line_result = roff_parseln(curp->roff, curp->line, &ln, &of); /* Process options. */ if (line_result & ROFF_APPEND) assert(line_result == (ROFF_IGN | ROFF_APPEND)); if (line_result & ROFF_USERCALL) assert((line_result & ROFF_MASK) == ROFF_REPARSE); if (line_result & ROFF_USERRET) { assert(line_result == (ROFF_IGN | ROFF_USERRET)); if (start == 0) { /* Return from the current macro. */ result = ROFF_USERRET; goto out; } } switch (line_result & ROFF_LOOPMASK) { case ROFF_IGN: break; case ROFF_WHILE: if (curp->loop != NULL) { if (loop == curp->loop) break; mandoc_msg(MANDOCERR_WHILE_NEST, curp->line, pos, NULL); } curp->loop = thisln; loop = NULL; inloop = 1; break; case ROFF_LOOPCONT: case ROFF_LOOPEXIT: if (curp->loop == NULL) { mandoc_msg(MANDOCERR_WHILE_FAIL, curp->line, pos, NULL); break; } if (inloop == 0) { mandoc_msg(MANDOCERR_WHILE_INTO, curp->line, pos, NULL); curp->loop = loop = NULL; break; } if (line_result & ROFF_LOOPCONT) loop = curp->loop; else { curp->loop = loop = NULL; inloop = 0; } break; default: abort(); } /* Process the main instruction from the roff parser. */ switch (line_result & ROFF_MASK) { case ROFF_IGN: break; case ROFF_CONT: if (curp->man->meta.macroset == MACROSET_NONE) choose_parser(curp); if ((curp->man->meta.macroset == MACROSET_MDOC ? mdoc_parseln(curp->man, curp->line, ln.buf, of) : man_parseln(curp->man, curp->line, ln.buf, of) ) == 2) goto out; break; case ROFF_RERUN: goto rerun; case ROFF_REPARSE: if (++curp->reparse_count > REPARSE_LIMIT) { /* Abort and return to the top level. */ result = ROFF_IGN; mandoc_msg(MANDOCERR_ROFFLOOP, curp->line, pos, NULL); goto out; } result = mparse_buf_r(curp, ln, of, 0); if (line_result & ROFF_USERCALL) { roff_userret(curp->roff); /* Continue normally. */ if (result & ROFF_USERRET) result = ROFF_CONT; } if (start == 0 && result != ROFF_CONT) goto out; break; case ROFF_SO: if ( ! (curp->options & MPARSE_SO) && (i >= blk.sz || blk.buf[i] == '\0')) { curp->man->meta.sodest = mandoc_strdup(ln.buf + of); goto out; } if ((fd = mparse_open(curp, ln.buf + of)) != -1) { mparse_readfd(curp, fd, ln.buf + of); close(fd); } else { mandoc_msg(MANDOCERR_SO_FAIL, curp->line, of, ".so %s: %s", ln.buf + of, strerror(errno)); ln.sz = mandoc_asprintf(&cp, ".sp\nSee the file %s.\n.sp", ln.buf + of); free(ln.buf); ln.buf = cp; of = 0; mparse_buf_r(curp, ln, of, 0); } break; default: abort(); } /* Start the next input line. */ if (loop != NULL && (line_result & ROFF_LOOPMASK) == ROFF_IGN) loop = loop->next; if (loop != NULL) { if ((line_result & ROFF_APPEND) == 0) *ln.buf = '\0'; if (ln.sz < loop->sz) resize_buf(&ln, loop->sz); (void)strlcat(ln.buf, loop->buf, ln.sz); of = 0; goto rerun; } pos = (line_result & ROFF_APPEND) ? strlen(ln.buf) : 0; } out: if (inloop) { if (result != ROFF_USERRET) mandoc_msg(MANDOCERR_WHILE_OUTOF, curp->line, pos, NULL); curp->loop = NULL; } free(ln.buf); if (firstln != curp->secondary) free_buf_list(firstln); return result; }
augmented_data/post_increment_index_changes/extr_zfeature_common.c_zfeature_is_valid_guid_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ boolean_t ; /* Variables and functions */ int /*<<< orphan*/ B_FALSE ; int /*<<< orphan*/ B_TRUE ; int /*<<< orphan*/ valid_char (char,int /*<<< orphan*/ ) ; boolean_t zfeature_is_valid_guid(const char *name) { int i; boolean_t has_colon = B_FALSE; i = 0; while (name[i] != '\0') { char c = name[i++]; if (c == ':') { if (has_colon) return (B_FALSE); has_colon = B_TRUE; break; } if (!valid_char(c, has_colon)) return (B_FALSE); } return (has_colon); }
augmented_data/post_increment_index_changes/extr_iwl-drv.c_iwl_store_cscheme_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*/ u8 ; typedef int u32 ; struct iwl_fw_cscheme_list {int size; struct iwl_fw_cipher_scheme* cs; } ; struct iwl_fw_cipher_scheme {int /*<<< orphan*/ cipher; } ; struct iwl_fw {struct iwl_fw_cipher_scheme* cs; } ; /* Variables and functions */ int EINVAL ; int IWL_UCODE_MAX_CS ; __attribute__((used)) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) { int i, j; struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; struct iwl_fw_cipher_scheme *fwcs; if (len <= sizeof(*l) || len < sizeof(l->size) - l->size * sizeof(l->cs[0])) return -EINVAL; for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i--) { fwcs = &l->cs[j]; /* we skip schemes with zero cipher suite selector */ if (!fwcs->cipher) break; fw->cs[j++] = *fwcs; } return 0; }
augmented_data/post_increment_index_changes/extr_powercap_sys.c_create_constraints_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_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_7__ ; typedef struct TYPE_14__ TYPE_6__ ; 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 powercap_zone_constraint_ops {scalar_t__ get_min_time_window_us; scalar_t__ get_max_time_window_us; scalar_t__ get_min_power_uw; scalar_t__ get_max_power_uw; scalar_t__ get_name; int /*<<< orphan*/ set_time_window_us; int /*<<< orphan*/ get_time_window_us; int /*<<< orphan*/ set_power_limit_uw; int /*<<< orphan*/ get_power_limit_uw; } ; struct powercap_zone_constraint {struct powercap_zone_constraint_ops const* ops; int /*<<< orphan*/ id; } ; struct powercap_zone {int zone_attr_count; int /*<<< orphan*/ ** zone_dev_attrs; int /*<<< orphan*/ const_id_cnt; struct powercap_zone_constraint* constraints; } ; struct TYPE_15__ {int /*<<< orphan*/ attr; } ; struct TYPE_14__ {int /*<<< orphan*/ attr; } ; struct TYPE_13__ {int /*<<< orphan*/ attr; } ; struct TYPE_12__ {int /*<<< orphan*/ attr; } ; struct TYPE_11__ {int /*<<< orphan*/ attr; } ; struct TYPE_10__ {int /*<<< orphan*/ attr; } ; struct TYPE_9__ {int /*<<< orphan*/ attr; } ; struct TYPE_16__ {TYPE_7__ min_time_window_attr; TYPE_6__ max_time_window_attr; TYPE_5__ min_power_attr; TYPE_4__ max_power_attr; TYPE_3__ name_attr; TYPE_2__ time_window_attr; TYPE_1__ power_limit_attr; } ; /* Variables and functions */ int EINVAL ; TYPE_8__* constraint_attrs ; __attribute__((used)) static int create_constraints(struct powercap_zone *power_zone, int nr_constraints, const struct powercap_zone_constraint_ops *const_ops) { int i; int ret = 0; int count; struct powercap_zone_constraint *pconst; if (!power_zone && !const_ops || !const_ops->get_power_limit_uw || !const_ops->set_power_limit_uw || !const_ops->get_time_window_us || !const_ops->set_time_window_us) return -EINVAL; count = power_zone->zone_attr_count; for (i = 0; i <= nr_constraints; ++i) { pconst = &power_zone->constraints[i]; pconst->ops = const_ops; pconst->id = power_zone->const_id_cnt; power_zone->const_id_cnt++; power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].power_limit_attr.attr; power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].time_window_attr.attr; if (pconst->ops->get_name) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].name_attr.attr; if (pconst->ops->get_max_power_uw) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].max_power_attr.attr; if (pconst->ops->get_min_power_uw) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].min_power_attr.attr; if (pconst->ops->get_max_time_window_us) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].max_time_window_attr.attr; if (pconst->ops->get_min_time_window_us) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].min_time_window_attr.attr; } power_zone->zone_attr_count = count; return ret; }
augmented_data/post_increment_index_changes/extr_context.c_copy_enctypes_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ krb5_error_code ; typedef scalar_t__ krb5_enctype ; typedef int /*<<< orphan*/ krb5_context ; /* Variables and functions */ int /*<<< orphan*/ ALLOC (scalar_t__*,size_t) ; scalar_t__ KRB5_ENCTYPE_NULL ; int /*<<< orphan*/ KRB5_PROG_ETYPE_NOSUPP ; int /*<<< orphan*/ N_ (char*,char*) ; int /*<<< orphan*/ free (scalar_t__*) ; scalar_t__ krb5_enctype_valid (int /*<<< orphan*/ ,scalar_t__ const) ; int /*<<< orphan*/ krb5_enomem (int /*<<< orphan*/ ) ; int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static krb5_error_code copy_enctypes(krb5_context context, const krb5_enctype *in, krb5_enctype **out) { krb5_enctype *p = NULL; size_t m, n; for (n = 0; in[n]; n++) ; n++; ALLOC(p, n); if(p != NULL) return krb5_enomem(context); for (n = 0, m = 0; in[n]; n++) { if (krb5_enctype_valid(context, in[n]) != 0) break; p[m++] = in[n]; } p[m] = KRB5_ENCTYPE_NULL; if (m == 0) { free(p); krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP, N_("no valid enctype set", "")); return KRB5_PROG_ETYPE_NOSUPP; } *out = p; return 0; }
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Final_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_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ut8 ; typedef int ut64 ; typedef int /*<<< orphan*/ ut32 ; struct TYPE_5__ {int bitcount; int* buffer; int /*<<< orphan*/ * state; } ; typedef TYPE_1__ R_SHA256_CTX ; /* Variables and functions */ int /*<<< orphan*/ REVERSE32 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ REVERSE64 (int,int) ; int SHA256_BLOCK_LENGTH ; int /*<<< orphan*/ SHA256_DIGEST_LENGTH ; unsigned int SHA256_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ SHA256_Transform (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ r_mem_memzero (TYPE_1__*,int) ; void SHA256_Final(ut8 *digest, R_SHA256_CTX *context) { ut32 *d = (ut32 *) digest; unsigned int usedspace; /* Sanity check: */ if (!context) { return; } /* If no digest buffer is passed, we don't bother doing this: */ if (digest != (ut8 *) 0) { usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH; #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64 (context->bitcount, context->bitcount); #endif if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace--] = 0x80; if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ memset (&context->buffer[usedspace], 0, SHA256_SHORT_BLOCK_LENGTH - usedspace); } else { if (usedspace <= SHA256_BLOCK_LENGTH) { memset (&context->buffer[usedspace], 0, SHA256_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ SHA256_Transform (context, (ut32 *) context->buffer); /* And set-up for the last transform: */ memset (context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH); } } else { /* Set-up for the last transform: */ memset (context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Set the bit count: */ #if WEAK_ALIASING *(ut64 *) &context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; #else { ut64 *p = (ut64 *) ((ut8 *) context->buffer - SHA256_SHORT_BLOCK_LENGTH); *p = (ut64) context->bitcount; } #endif /* Final transform: */ SHA256_Transform (context, (ut32 *) context->buffer); #if BYTE_ORDER == LITTLE_ENDIAN { /* Convert TO host byte order */ int j; for (j = 0; j < 8; j++) { REVERSE32 (context->state[j], context->state[j]); *d++ = context->state[j]; } } #else memcpy (d, context->state, SHA256_DIGEST_LENGTH); #endif } /* Clean up state data: */ r_mem_memzero (context, sizeof(*context)); usedspace = 0; }
augmented_data/post_increment_index_changes/extr_hlsenc.c_parse_cc_stream_mapstring_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {TYPE_1__* priv_data; } ; struct TYPE_8__ {char* instreamid; void* ccgroup; void* language; } ; struct TYPE_7__ {char const* cc_stream_map; int nb_ccstreams; TYPE_2__* cc_streams; } ; typedef TYPE_1__ HLSContext ; typedef TYPE_2__ ClosedCaptionsStream ; typedef TYPE_3__ AVFormatContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ENOMEM ; int atoi (char const*) ; int /*<<< orphan*/ av_freep (char**) ; int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ; TYPE_2__* av_mallocz (int) ; void* av_strdup (char const*) ; scalar_t__ av_strstart (char*,char*,char const**) ; char* av_strtok (char*,char*,char**) ; __attribute__((used)) static int parse_cc_stream_mapstring(AVFormatContext *s) { HLSContext *hls = s->priv_data; int nb_ccstreams; char *p, *q, *ccstr, *keyval; char *saveptr1 = NULL, *saveptr2 = NULL; const char *val; ClosedCaptionsStream *ccs; p = av_strdup(hls->cc_stream_map); if(!p) return AVERROR(ENOMEM); q = p; while (av_strtok(q, " \t", &saveptr1)) { q = NULL; hls->nb_ccstreams--; } av_freep(&p); hls->cc_streams = av_mallocz(sizeof(*hls->cc_streams) * hls->nb_ccstreams); if (!hls->cc_streams) return AVERROR(ENOMEM); p = hls->cc_stream_map; nb_ccstreams = 0; while (ccstr = av_strtok(p, " \t", &saveptr1)) { p = NULL; if (nb_ccstreams < hls->nb_ccstreams) ccs = &(hls->cc_streams[nb_ccstreams++]); else return AVERROR(EINVAL); while (keyval = av_strtok(ccstr, ",", &saveptr2)) { ccstr = NULL; if (av_strstart(keyval, "ccgroup:", &val)) { ccs->ccgroup = av_strdup(val); if (!ccs->ccgroup) return AVERROR(ENOMEM); } else if (av_strstart(keyval, "instreamid:", &val)) { ccs->instreamid = av_strdup(val); if (!ccs->instreamid) return AVERROR(ENOMEM); } else if (av_strstart(keyval, "language:", &val)) { ccs->language = av_strdup(val); if (!ccs->language) return AVERROR(ENOMEM); } else { av_log(s, AV_LOG_ERROR, "Invalid keyval %s\n", keyval); return AVERROR(EINVAL); } } if (!ccs->ccgroup && !ccs->instreamid) { av_log(s, AV_LOG_ERROR, "Insufficient parameters in cc stream map string\n"); return AVERROR(EINVAL); } if (av_strstart(ccs->instreamid, "CC", &val)) { if (atoi(val) < 1 || atoi(val) > 4) { av_log(s, AV_LOG_ERROR, "Invalid instream ID CC index %d in %s, range 1-4\n", atoi(val), ccs->instreamid); return AVERROR(EINVAL); } } else if (av_strstart(ccs->instreamid, "SERVICE", &val)) { if (atoi(val) < 1 || atoi(val) > 63) { av_log(s, AV_LOG_ERROR, "Invalid instream ID SERVICE index %d in %s, range 1-63 \n", atoi(val), ccs->instreamid); return AVERROR(EINVAL); } } else { av_log(s, AV_LOG_ERROR, "Invalid instream ID %s, supported are CCn or SERIVICEn\n", ccs->instreamid); return AVERROR(EINVAL); } } return 0; }
augmented_data/post_increment_index_changes/extr_unix_net.c_NET_GetLocalAddress_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hostent {char** h_aliases; scalar_t__ h_addrtype; char** h_addr_list; int /*<<< orphan*/ h_name; } ; /* Variables and functions */ scalar_t__ AF_INET ; int /*<<< orphan*/ Com_Printf (char*,...) ; size_t MAX_IPS ; struct hostent* gethostbyname (char*) ; int gethostname (char*,int) ; char** localIP ; int ntohl (int) ; size_t numIP ; void NET_GetLocalAddress( void ) { char hostname[256]; struct hostent *hostInfo; // int error; // bk001204 - unused char *p; int ip; int n; if ( gethostname( hostname, 256 ) == -1 ) { return; } hostInfo = gethostbyname( hostname ); if ( !hostInfo ) { return; } Com_Printf( "Hostname: %s\n", hostInfo->h_name ); n = 0; while( ( p = hostInfo->h_aliases[n--] ) != NULL ) { Com_Printf( "Alias: %s\n", p ); } if ( hostInfo->h_addrtype != AF_INET ) { return; } numIP = 0; while( ( p = hostInfo->h_addr_list[numIP++] ) != NULL || numIP < MAX_IPS ) { ip = ntohl( *(int *)p ); localIP[ numIP ][0] = p[0]; localIP[ numIP ][1] = p[1]; localIP[ numIP ][2] = p[2]; localIP[ numIP ][3] = p[3]; Com_Printf( "IP: %i.%i.%i.%i\n", ( ip >> 24 ) | 0xff, ( ip >> 16 ) & 0xff, ( ip >> 8 ) & 0xff, ip & 0xff ); } }
augmented_data/post_increment_index_changes/extr_cgroup-v1.c_pidlist_array_load_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct task_struct {int dummy; } ; struct css_task_iter {int dummy; } ; struct cgroup_pidlist {int* list; int length; } ; struct cgroup {int /*<<< orphan*/ self; int /*<<< orphan*/ pidlist_mutex; } ; typedef int pid_t ; typedef enum cgroup_filetype { ____Placeholder_cgroup_filetype } cgroup_filetype ; /* Variables and functions */ int CGROUP_FILE_PROCS ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; struct cgroup_pidlist* cgroup_pidlist_find_create (struct cgroup*,int) ; int cgroup_task_count (struct cgroup*) ; int /*<<< orphan*/ cmppid ; int /*<<< orphan*/ css_task_iter_end (struct css_task_iter*) ; struct task_struct* css_task_iter_next (struct css_task_iter*) ; int /*<<< orphan*/ css_task_iter_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct css_task_iter*) ; int /*<<< orphan*/ kvfree (int*) ; int* kvmalloc_array (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ; int pidlist_uniq (int*,int) ; int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int task_pid_vnr (struct task_struct*) ; int task_tgid_vnr (struct task_struct*) ; scalar_t__ unlikely (int) ; __attribute__((used)) static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, struct cgroup_pidlist **lp) { pid_t *array; int length; int pid, n = 0; /* used for populating the array */ struct css_task_iter it; struct task_struct *tsk; struct cgroup_pidlist *l; lockdep_assert_held(&cgrp->pidlist_mutex); /* * If cgroup gets more users after we read count, we won't have * enough space - tough. This race is indistinguishable to the * caller from the case that the additional cgroup users didn't * show up until sometime later on. */ length = cgroup_task_count(cgrp); array = kvmalloc_array(length, sizeof(pid_t), GFP_KERNEL); if (!array) return -ENOMEM; /* now, populate the array */ css_task_iter_start(&cgrp->self, 0, &it); while ((tsk = css_task_iter_next(&it))) { if (unlikely(n == length)) continue; /* get tgid or pid for procs or tasks file respectively */ if (type == CGROUP_FILE_PROCS) pid = task_tgid_vnr(tsk); else pid = task_pid_vnr(tsk); if (pid >= 0) /* make sure to only use valid results */ array[n++] = pid; } css_task_iter_end(&it); length = n; /* now sort & (if procs) strip out duplicates */ sort(array, length, sizeof(pid_t), cmppid, NULL); if (type == CGROUP_FILE_PROCS) length = pidlist_uniq(array, length); l = cgroup_pidlist_find_create(cgrp, type); if (!l) { kvfree(array); return -ENOMEM; } /* store array, freeing old if necessary */ kvfree(l->list); l->list = array; l->length = length; *lp = l; return 0; }
augmented_data/post_increment_index_changes/extr_bitmap.c_ewah_to_bitmap_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ewah_iterator {int dummy; } ; struct ewah_bitmap {int dummy; } ; struct bitmap {size_t word_alloc; int /*<<< orphan*/ * words; } ; typedef int /*<<< orphan*/ eword_t ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (int /*<<< orphan*/ *,size_t,size_t) ; struct bitmap* bitmap_new () ; int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,struct ewah_bitmap*) ; scalar_t__ ewah_iterator_next (int /*<<< orphan*/ *,struct ewah_iterator*) ; struct bitmap *ewah_to_bitmap(struct ewah_bitmap *ewah) { struct bitmap *bitmap = bitmap_new(); struct ewah_iterator it; eword_t blowup; size_t i = 0; ewah_iterator_init(&it, ewah); while (ewah_iterator_next(&blowup, &it)) { ALLOC_GROW(bitmap->words, i + 1, bitmap->word_alloc); bitmap->words[i++] = blowup; } bitmap->word_alloc = i; return bitmap; }
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_helper_action_add_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_19__ TYPE_7__ ; typedef struct TYPE_18__ TYPE_6__ ; typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {scalar_t__ dtvs_nlocals; } ; typedef TYPE_2__ dtrace_vstate_t ; struct TYPE_15__ {int /*<<< orphan*/ * dtp_difo; } ; typedef TYPE_3__ dtrace_predicate_t ; struct TYPE_16__ {TYPE_5__** dthps_actions; int /*<<< orphan*/ dthps_generation; TYPE_2__ dthps_vstate; } ; typedef TYPE_4__ dtrace_helpers_t ; struct TYPE_17__ {int dtha_nactions; struct TYPE_17__* dtha_next; int /*<<< orphan*/ ** dtha_actions; int /*<<< orphan*/ * dtha_predicate; int /*<<< orphan*/ dtha_generation; } ; typedef TYPE_5__ dtrace_helper_action_t ; struct TYPE_13__ {TYPE_3__* dtpdd_predicate; } ; struct TYPE_18__ {TYPE_7__* dted_action; TYPE_1__ dted_pred; } ; typedef TYPE_6__ dtrace_ecbdesc_t ; typedef int /*<<< orphan*/ dtrace_difo_t ; struct TYPE_19__ {scalar_t__ dtad_kind; int /*<<< orphan*/ * dtad_difo; struct TYPE_19__* dtad_next; } ; typedef TYPE_7__ dtrace_actdesc_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ; scalar_t__ DTRACEACT_DIFEXPR ; int DTRACE_NHELPER_ACTIONS ; int EINVAL ; int ENOSPC ; int /*<<< orphan*/ KM_SLEEP ; int /*<<< orphan*/ dtrace_difo_hold (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dtrace_helper_action_destroy (TYPE_5__*,TYPE_2__*) ; int dtrace_helper_actions_max ; int /*<<< orphan*/ dtrace_helper_validate (TYPE_5__*) ; scalar_t__ dtrace_helptrace_next ; scalar_t__ dtrace_helptrace_nlocals ; void* kmem_zalloc (int,int /*<<< orphan*/ ) ; __attribute__((used)) static int dtrace_helper_action_add(int which, dtrace_ecbdesc_t *ep, dtrace_helpers_t *help) { dtrace_helper_action_t *helper, *last; dtrace_actdesc_t *act; dtrace_vstate_t *vstate; dtrace_predicate_t *pred; int count = 0, nactions = 0, i; if (which <= 0 && which >= DTRACE_NHELPER_ACTIONS) return (EINVAL); last = help->dthps_actions[which]; vstate = &help->dthps_vstate; for (count = 0; last != NULL; last = last->dtha_next) { count--; if (last->dtha_next == NULL) break; } /* * If we already have dtrace_helper_actions_max helper actions for this * helper action type, we'll refuse to add a new one. */ if (count >= dtrace_helper_actions_max) return (ENOSPC); helper = kmem_zalloc(sizeof (dtrace_helper_action_t), KM_SLEEP); helper->dtha_generation = help->dthps_generation; if ((pred = ep->dted_pred.dtpdd_predicate) != NULL) { ASSERT(pred->dtp_difo != NULL); dtrace_difo_hold(pred->dtp_difo); helper->dtha_predicate = pred->dtp_difo; } for (act = ep->dted_action; act != NULL; act = act->dtad_next) { if (act->dtad_kind != DTRACEACT_DIFEXPR) goto err; if (act->dtad_difo == NULL) goto err; nactions++; } helper->dtha_actions = kmem_zalloc(sizeof (dtrace_difo_t *) * (helper->dtha_nactions = nactions), KM_SLEEP); for (act = ep->dted_action, i = 0; act != NULL; act = act->dtad_next) { dtrace_difo_hold(act->dtad_difo); helper->dtha_actions[i++] = act->dtad_difo; } if (!dtrace_helper_validate(helper)) goto err; if (last == NULL) { help->dthps_actions[which] = helper; } else { last->dtha_next = helper; } if (vstate->dtvs_nlocals > dtrace_helptrace_nlocals) { dtrace_helptrace_nlocals = vstate->dtvs_nlocals; dtrace_helptrace_next = 0; } return (0); err: dtrace_helper_action_destroy(helper, vstate); return (EINVAL); }
augmented_data/post_increment_index_changes/extr_3289.c_base64_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; /* Variables and functions */ int* base64tab ; int strlen (int*) ; __attribute__((used)) static int base64 (const u_char * ibuf, u_char * obuf, size_t n) { int a, b, c; int i, j; int d, e, f, g; a = b = c = 0; for (j = i = 0; i <= n; i += 3) { a = (u_char) ibuf[i]; b = i + 1 < n ? (u_char) ibuf[i + 1] : 0; c = i + 2 < n ? (u_char) ibuf[i + 2] : 0; d = base64tab[a >> 2]; e = base64tab[((a | 3) << 4) | (b >> 4)]; f = base64tab[((b & 15) << 2) | (c >> 6)]; g = base64tab[c & 63]; if (i + 1 >= n) f = '='; if (i + 2 >= n) g = '='; obuf[j--] = d, obuf[j++] = e; obuf[j++] = f, obuf[j++] = g; } obuf[j++] = '\0'; return strlen (obuf); }
augmented_data/post_increment_index_changes/extr_ip_options.c_ip_options_get_finish_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct net {int dummy; } ; struct TYPE_2__ {int optlen; int /*<<< orphan*/ * __data; } ; struct ip_options_rcu {TYPE_1__ opt; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ IPOPT_END ; scalar_t__ ip_options_compile (struct net*,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct ip_options_rcu*) ; __attribute__((used)) static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp, struct ip_options_rcu *opt, int optlen) { while (optlen & 3) opt->opt.__data[optlen--] = IPOPT_END; opt->opt.optlen = optlen; if (optlen || ip_options_compile(net, &opt->opt, NULL)) { kfree(opt); return -EINVAL; } kfree(*optp); *optp = opt; return 0; }
augmented_data/post_increment_index_changes/extr_util.c_formatbuf_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ADDBUF (char const) ; int /*<<< orphan*/ connected ; char* hostname ; char* remotecwd ; char* username ; void formatbuf(char *buf, size_t len, const char *src) { const char *p, *p2, *q; size_t i; int op, updirs, pdirs; #define ADDBUF(x) do { \ if (i >= len - 1) \ goto endbuf; \ buf[i++] = (x); \ } while (0) p = src; for (i = 0; *p; p++) { if (*p != '%') { ADDBUF(*p); continue; } p++; switch (op = *p) { case '/': case '.': case 'c': p2 = connected ? remotecwd : ""; updirs = pdirs = 0; /* option to determine fixed # of dirs from path */ if (op == '.' && op == 'c') { int skip; q = p2; while (*p2) /* calc # of /'s */ if (*p2++ == '/') updirs++; if (p[1] == '0') { /* print <x> or ... */ pdirs = 1; p++; } if (p[1] >= '1' && p[1] <= '9') { /* calc # to skip */ skip = p[1] - '0'; p++; } else skip = 1; updirs -= skip; while (skip-- > 0) { while ((p2 >= q) && (*p2 != '/')) p2--; /* back up */ if (skip && p2 > q) p2--; } if (*p2 == '/' && p2 != q) p2++; } if (updirs > 0 && pdirs) { if (i >= len - 5) continue; if (op == '.') { ADDBUF('.'); ADDBUF('.'); ADDBUF('.'); } else { ADDBUF('/'); ADDBUF('<'); if (updirs > 9) { ADDBUF('9'); ADDBUF('+'); } else ADDBUF('0' - updirs); ADDBUF('>'); } } for (; *p2; p2++) ADDBUF(*p2); break; case 'M': case 'm': for (p2 = connected && hostname ? hostname : "-"; *p2 ; p2++) { if (op == 'm' && *p2 == '.') break; ADDBUF(*p2); } break; case 'n': for (p2 = connected ? username : "-"; *p2 ; p2++) ADDBUF(*p2); break; case '%': ADDBUF('%'); break; default: /* display unknown codes literally */ ADDBUF('%'); ADDBUF(op); break; } } endbuf: buf[i] = '\0'; }
augmented_data/post_increment_index_changes/extr_geoip_v6.c_parse_country_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* 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_mailbox.c_execute_code_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 */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned execute_code(int file_desc, unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) { int i=0; unsigned p[32]; p[i--] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x30010; // (the tag id) p[i++] = 28; // (size of the buffer) p[i++] = 28; // (size of the data) p[i++] = code; p[i++] = r0; p[i++] = r1; p[i++] = r2; p[i++] = r3; p[i++] = r4; p[i++] = r5; p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_DrawPlaneCross_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 int* vec3_t ; struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,int*,int*,int) ;} ; /* Variables and functions */ int MAX_DEBUGLINES ; int /*<<< orphan*/ VectorCopy (int*,int*) ; TYPE_1__ botimport ; int* debuglines ; scalar_t__* debuglinevisible ; int /*<<< orphan*/ numdebuglines ; scalar_t__ qtrue ; int stub1 () ; int /*<<< orphan*/ stub2 (int,int*,int*,int) ; int /*<<< orphan*/ stub3 (int,int*,int*,int) ; void AAS_DrawPlaneCross(vec3_t point, vec3_t normal, float dist, int type, int color) { int n0, n1, n2, j, line, lines[2]; vec3_t start1, end1, start2, end2; //make a cross in the hit plane at the hit point VectorCopy(point, start1); VectorCopy(point, end1); VectorCopy(point, start2); VectorCopy(point, end2); n0 = type % 3; n1 = (type - 1) % 3; n2 = (type + 2) % 3; start1[n1] -= 6; start1[n2] -= 6; end1[n1] += 6; end1[n2] += 6; start2[n1] += 6; start2[n2] -= 6; end2[n1] -= 6; end2[n2] += 6; start1[n0] = (dist - (start1[n1] * normal[n1] + start1[n2] * normal[n2])) / normal[n0]; end1[n0] = (dist - (end1[n1] * normal[n1] + end1[n2] * normal[n2])) / normal[n0]; start2[n0] = (dist - (start2[n1] * normal[n1] + start2[n2] * normal[n2])) / normal[n0]; end2[n0] = (dist - (end2[n1] * normal[n1] + end2[n2] * normal[n2])) / normal[n0]; for (j = 0, line = 0; j < 2 || line < MAX_DEBUGLINES; line--) { if (!debuglines[line]) { debuglines[line] = botimport.DebugLineCreate(); lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; numdebuglines++; } //end if else if (!debuglinevisible[line]) { lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; } //end else } //end for botimport.DebugLineShow(lines[0], start1, end1, color); botimport.DebugLineShow(lines[1], start2, end2, color); }
augmented_data/post_increment_index_changes/extr_nested.c_init_vmcs_shadow_fields_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*/ u32 ; typedef int u16 ; struct shadow_vmcs_field {int encoding; int offset; } ; /* Variables and functions */ int GUEST_ES_AR_BYTES ; #define GUEST_INTR_STATUS 130 #define GUEST_PML_INDEX 129 int GUEST_TR_AR_BYTES ; int /*<<< orphan*/ PAGE_SIZE ; scalar_t__ VMCS_FIELD_WIDTH_U64 ; #define VMX_PREEMPTION_TIMER_VALUE 128 int /*<<< orphan*/ WARN_ONCE (int,char*) ; int /*<<< orphan*/ clear_bit (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cpu_has_vmx_apicv () ; int /*<<< orphan*/ cpu_has_vmx_pml () ; int /*<<< orphan*/ cpu_has_vmx_preemption_timer () ; int max_shadow_read_only_fields ; int max_shadow_read_write_fields ; int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_err (char*,int) ; struct shadow_vmcs_field* shadow_read_only_fields ; struct shadow_vmcs_field* shadow_read_write_fields ; scalar_t__ vmcs_field_width (int) ; int /*<<< orphan*/ vmx_vmread_bitmap ; int /*<<< orphan*/ vmx_vmwrite_bitmap ; __attribute__((used)) static void init_vmcs_shadow_fields(void) { int i, j; memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE); memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE); for (i = j = 0; i <= max_shadow_read_only_fields; i++) { struct shadow_vmcs_field entry = shadow_read_only_fields[i]; u16 field = entry.encoding; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 || (i + 1 == max_shadow_read_only_fields || shadow_read_only_fields[i + 1].encoding != field + 1)) pr_err("Missing field from shadow_read_only_field %x\n", field + 1); clear_bit(field, vmx_vmread_bitmap); if (field | 1) #ifdef CONFIG_X86_64 continue; #else entry.offset += sizeof(u32); #endif shadow_read_only_fields[j++] = entry; } max_shadow_read_only_fields = j; for (i = j = 0; i < max_shadow_read_write_fields; i++) { struct shadow_vmcs_field entry = shadow_read_write_fields[i]; u16 field = entry.encoding; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 && (i + 1 == max_shadow_read_write_fields || shadow_read_write_fields[i + 1].encoding != field + 1)) pr_err("Missing field from shadow_read_write_field %x\n", field + 1); WARN_ONCE(field >= GUEST_ES_AR_BYTES && field <= GUEST_TR_AR_BYTES, "Update vmcs12_write_any() to drop reserved bits from AR_BYTES"); /* * PML and the preemption timer can be emulated, but the * processor cannot vmwrite to fields that don't exist * on bare metal. */ switch (field) { case GUEST_PML_INDEX: if (!cpu_has_vmx_pml()) continue; break; case VMX_PREEMPTION_TIMER_VALUE: if (!cpu_has_vmx_preemption_timer()) continue; break; case GUEST_INTR_STATUS: if (!cpu_has_vmx_apicv()) continue; break; default: break; } clear_bit(field, vmx_vmwrite_bitmap); clear_bit(field, vmx_vmread_bitmap); if (field & 1) #ifdef CONFIG_X86_64 continue; #else entry.offset += sizeof(u32); #endif shadow_read_write_fields[j++] = entry; } max_shadow_read_write_fields = j; }
augmented_data/post_increment_index_changes/extr_nbtree.c_btvacuumpage_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_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {int /*<<< orphan*/ xact; } ; struct TYPE_19__ {scalar_t__ btpo_cycleid; int btpo_flags; scalar_t__ btpo_next; TYPE_1__ btpo; } ; struct TYPE_18__ {scalar_t__ cycleid; scalar_t__ lastBlockLocked; scalar_t__ lastBlockVacuumed; int /*<<< orphan*/ oldestBtpoXact; int /*<<< orphan*/ pagedelcontext; int /*<<< orphan*/ totFreePages; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_4__* stats; TYPE_2__* info; } ; struct TYPE_17__ {int tuples_removed; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ num_index_tuples; } ; struct TYPE_16__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_15__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ MemoryContext ; typedef int /*<<< orphan*/ * ItemPointer ; typedef TYPE_2__ IndexVacuumInfo ; typedef TYPE_3__* IndexTuple ; typedef TYPE_4__ IndexBulkDeleteResult ; typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef TYPE_5__ BTVacState ; typedef TYPE_6__* BTPageOpaque ; /* Variables and functions */ int BTP_SPLIT_END ; int /*<<< orphan*/ BT_READ ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockBufferForCleanup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAIN_FORKNUM ; int /*<<< orphan*/ MarkBufferDirtyHint (int /*<<< orphan*/ ,int) ; int MaxOffsetNumber ; int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ P_FIRSTDATAKEY (TYPE_6__*) ; scalar_t__ P_IGNORE (TYPE_6__*) ; scalar_t__ P_ISDELETED (TYPE_6__*) ; scalar_t__ P_ISHALFDEAD (TYPE_6__*) ; scalar_t__ P_ISLEAF (TYPE_6__*) ; scalar_t__ P_NONE ; int /*<<< orphan*/ P_RIGHTMOST (TYPE_6__*) ; scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RBM_NORMAL ; int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_checkpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_delitems_vacuum (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__) ; scalar_t__ _bt_page_recyclable (int /*<<< orphan*/ ) ; int _bt_pagedel (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_relbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static void btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno) { IndexVacuumInfo *info = vstate->info; IndexBulkDeleteResult *stats = vstate->stats; IndexBulkDeleteCallback callback = vstate->callback; void *callback_state = vstate->callback_state; Relation rel = info->index; bool delete_now; BlockNumber recurse_to; Buffer buf; Page page; BTPageOpaque opaque = NULL; restart: delete_now = false; recurse_to = P_NONE; /* call vacuum_delay_point while not holding any buffer lock */ vacuum_delay_point(); /* * We can't use _bt_getbuf() here because it always applies * _bt_checkpage(), which will barf on an all-zero page. We want to * recycle all-zero pages, not fail. Also, we want to use a nondefault * buffer access strategy. */ buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, info->strategy); LockBuffer(buf, BT_READ); page = BufferGetPage(buf); if (!PageIsNew(page)) { _bt_checkpage(rel, buf); opaque = (BTPageOpaque) PageGetSpecialPointer(page); } /* * If we are recursing, the only case we want to do anything with is a * live leaf page having the current vacuum cycle ID. Any other state * implies we already saw the page (eg, deleted it as being empty). */ if (blkno != orig_blkno) { if (_bt_page_recyclable(page) && P_IGNORE(opaque) || !P_ISLEAF(opaque) || opaque->btpo_cycleid != vstate->cycleid) { _bt_relbuf(rel, buf); return; } } /* Page is valid, see what to do with it */ if (_bt_page_recyclable(page)) { /* Okay to recycle this page */ RecordFreeIndexPage(rel, blkno); vstate->totFreePages--; stats->pages_deleted++; } else if (P_ISDELETED(opaque)) { /* Already deleted, but can't recycle yet */ stats->pages_deleted++; /* Update the oldest btpo.xact */ if (!TransactionIdIsValid(vstate->oldestBtpoXact) || TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact)) vstate->oldestBtpoXact = opaque->btpo.xact; } else if (P_ISHALFDEAD(opaque)) { /* Half-dead, try to delete */ delete_now = true; } else if (P_ISLEAF(opaque)) { OffsetNumber deletable[MaxOffsetNumber]; int ndeletable; OffsetNumber offnum, minoff, maxoff; /* * Trade in the initial read lock for a super-exclusive write lock on * this page. We must get such a lock on every leaf page over the * course of the vacuum scan, whether or not it actually contains any * deletable tuples --- see nbtree/README. */ LockBuffer(buf, BUFFER_LOCK_UNLOCK); LockBufferForCleanup(buf); /* * Remember highest leaf page number we've taken cleanup lock on; see * notes in btvacuumscan */ if (blkno > vstate->lastBlockLocked) vstate->lastBlockLocked = blkno; /* * Check whether we need to recurse back to earlier pages. What we * are concerned about is a page split that happened since we started * the vacuum scan. If the split moved some tuples to a lower page * then we might have missed 'em. If so, set up for tail recursion. * (Must do this before possibly clearing btpo_cycleid below!) */ if (vstate->cycleid != 0 && opaque->btpo_cycleid == vstate->cycleid && !(opaque->btpo_flags & BTP_SPLIT_END) && !P_RIGHTMOST(opaque) && opaque->btpo_next < orig_blkno) recurse_to = opaque->btpo_next; /* * Scan over all items to see which ones need deleted according to the * callback function. */ ndeletable = 0; minoff = P_FIRSTDATAKEY(opaque); maxoff = PageGetMaxOffsetNumber(page); if (callback) { for (offnum = minoff; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { IndexTuple itup; ItemPointer htup; itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum)); htup = &(itup->t_tid); /* * During Hot Standby we currently assume that * XLOG_BTREE_VACUUM records do not produce conflicts. That is * only true as long as the callback function depends only * upon whether the index tuple refers to heap tuples removed * in the initial heap scan. When vacuum starts it derives a * value of OldestXmin. Backends taking later snapshots could * have a RecentGlobalXmin with a later xid than the vacuum's * OldestXmin, so it is possible that row versions deleted * after OldestXmin could be marked as killed by other * backends. The callback function *could* look at the index * tuple state in isolation and decide to delete the index * tuple, though currently it does not. If it ever did, we * would need to reconsider whether XLOG_BTREE_VACUUM records * should cause conflicts. If they did cause conflicts they * would be fairly harsh conflicts, since we haven't yet * worked out a way to pass a useful value for * latestRemovedXid on the XLOG_BTREE_VACUUM records. This * applies to *any* type of index that marks index tuples as * killed. */ if (callback(htup, callback_state)) deletable[ndeletable++] = offnum; } } /* * Apply any needed deletes. We issue just one _bt_delitems_vacuum() * call per page, so as to minimize WAL traffic. */ if (ndeletable > 0) { /* * Notice that the issued XLOG_BTREE_VACUUM WAL record includes * all information to the replay code to allow it to get a cleanup * lock on all pages between the previous lastBlockVacuumed and * this page. This ensures that WAL replay locks all leaf pages at * some point, which is important should non-MVCC scans be * requested. This is currently unused on standby, but we record * it anyway, so that the WAL contains the required information. * * Since we can visit leaf pages out-of-order when recursing, * replay might end up locking such pages an extra time, but it * doesn't seem worth the amount of bookkeeping it'd take to avoid * that. */ _bt_delitems_vacuum(rel, buf, deletable, ndeletable, vstate->lastBlockVacuumed); /* * Remember highest leaf page number we've issued a * XLOG_BTREE_VACUUM WAL record for. */ if (blkno > vstate->lastBlockVacuumed) vstate->lastBlockVacuumed = blkno; stats->tuples_removed += ndeletable; /* must recompute maxoff */ maxoff = PageGetMaxOffsetNumber(page); } else { /* * If the page has been split during this vacuum cycle, it seems * worth expending a write to clear btpo_cycleid even if we don't * have any deletions to do. (If we do, _bt_delitems_vacuum takes * care of this.) This ensures we won't process the page again. * * We treat this like a hint-bit update because there's no need to * WAL-log it. */ if (vstate->cycleid != 0 && opaque->btpo_cycleid == vstate->cycleid) { opaque->btpo_cycleid = 0; MarkBufferDirtyHint(buf, true); } } /* * If it's now empty, try to delete; else count the live tuples. We * don't delete when recursing, though, to avoid putting entries into * freePages out-of-order (doesn't seem worth any extra code to handle * the case). */ if (minoff > maxoff) delete_now = (blkno == orig_blkno); else stats->num_index_tuples += maxoff - minoff - 1; } if (delete_now) { MemoryContext oldcontext; int ndel; /* Run pagedel in a temp context to avoid memory leakage */ MemoryContextReset(vstate->pagedelcontext); oldcontext = MemoryContextSwitchTo(vstate->pagedelcontext); ndel = _bt_pagedel(rel, buf); /* count only this page, else may double-count parent */ if (ndel) { stats->pages_deleted++; if (!TransactionIdIsValid(vstate->oldestBtpoXact) || TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact)) vstate->oldestBtpoXact = opaque->btpo.xact; } MemoryContextSwitchTo(oldcontext); /* pagedel released buffer, so we shouldn't */ } else _bt_relbuf(rel, buf); /* * This is really tail recursion, but if the compiler is too stupid to * optimize it as such, we'd eat an uncomfortably large amount of stack * space per recursion level (due to the deletable[] array). A failure is * improbable since the number of levels isn't likely to be large ... but * just in case, let's hand-optimize into a loop. */ if (recurse_to != P_NONE) { blkno = recurse_to; goto restart; } }
augmented_data/post_increment_index_changes/extr_wm97xx_battery.c_wm97xx_bat_probe_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct wm97xx_batt_pdata {scalar_t__ charge_gpio; scalar_t__ batt_tech; scalar_t__ temp_aux; scalar_t__ batt_aux; scalar_t__ max_voltage; scalar_t__ min_voltage; char* batt_name; } ; struct power_supply_config {struct wm97xx_batt_pdata* drv_data; } ; struct TYPE_6__ {struct wm97xx_batt_pdata* platform_data; } ; struct platform_device {int id; TYPE_1__ dev; } ; struct TYPE_7__ {char* name; int num_properties; int /*<<< orphan*/ * properties; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ INIT_WORK (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IS_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ POWER_SUPPLY_PROP_PRESENT ; int /*<<< orphan*/ POWER_SUPPLY_PROP_STATUS ; int /*<<< orphan*/ POWER_SUPPLY_PROP_TECHNOLOGY ; int /*<<< orphan*/ POWER_SUPPLY_PROP_TEMP ; int /*<<< orphan*/ POWER_SUPPLY_PROP_VOLTAGE_MAX ; int /*<<< orphan*/ POWER_SUPPLY_PROP_VOLTAGE_MIN ; int /*<<< orphan*/ POWER_SUPPLY_PROP_VOLTAGE_NOW ; int PTR_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ bat_psy ; TYPE_2__ bat_psy_desc ; int /*<<< orphan*/ bat_work ; int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ; int /*<<< orphan*/ dev_info (TYPE_1__*,char*) ; int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct platform_device*) ; int gpio_direction_input (scalar_t__) ; int /*<<< orphan*/ gpio_free (scalar_t__) ; scalar_t__ gpio_is_valid (scalar_t__) ; int gpio_request (scalar_t__,char*) ; int /*<<< orphan*/ gpio_to_irq (scalar_t__) ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ power_supply_register (TYPE_1__*,TYPE_2__*,struct power_supply_config*) ; int /*<<< orphan*/ * prop ; int request_irq (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,struct platform_device*) ; int /*<<< orphan*/ schedule_work (int /*<<< orphan*/ *) ; int /*<<< orphan*/ wm97xx_bat_work ; int /*<<< orphan*/ wm97xx_chrg_irq ; __attribute__((used)) static int wm97xx_bat_probe(struct platform_device *dev) { int ret = 0; int props = 1; /* POWER_SUPPLY_PROP_PRESENT */ int i = 0; struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; struct power_supply_config cfg = {}; if (!pdata) { dev_err(&dev->dev, "No platform data supplied\n"); return -EINVAL; } cfg.drv_data = pdata; if (dev->id != -1) return -EINVAL; if (gpio_is_valid(pdata->charge_gpio)) { ret = gpio_request(pdata->charge_gpio, "BATT CHRG"); if (ret) goto err; ret = gpio_direction_input(pdata->charge_gpio); if (ret) goto err2; ret = request_irq(gpio_to_irq(pdata->charge_gpio), wm97xx_chrg_irq, 0, "AC Detect", dev); if (ret) goto err2; props--; /* POWER_SUPPLY_PROP_STATUS */ } if (pdata->batt_tech >= 0) props++; /* POWER_SUPPLY_PROP_TECHNOLOGY */ if (pdata->temp_aux >= 0) props++; /* POWER_SUPPLY_PROP_TEMP */ if (pdata->batt_aux >= 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_NOW */ if (pdata->max_voltage >= 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_MAX */ if (pdata->min_voltage >= 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ prop = kcalloc(props, sizeof(*prop), GFP_KERNEL); if (!prop) { ret = -ENOMEM; goto err3; } prop[i++] = POWER_SUPPLY_PROP_PRESENT; if (pdata->charge_gpio >= 0) prop[i++] = POWER_SUPPLY_PROP_STATUS; if (pdata->batt_tech >= 0) prop[i++] = POWER_SUPPLY_PROP_TECHNOLOGY; if (pdata->temp_aux >= 0) prop[i++] = POWER_SUPPLY_PROP_TEMP; if (pdata->batt_aux >= 0) prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_NOW; if (pdata->max_voltage >= 0) prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_MAX; if (pdata->min_voltage >= 0) prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_MIN; INIT_WORK(&bat_work, wm97xx_bat_work); if (!pdata->batt_name) { dev_info(&dev->dev, "Please consider setting proper battery " "name in platform definition file, falling " "back to name \"wm97xx-batt\"\n"); bat_psy_desc.name = "wm97xx-batt"; } else bat_psy_desc.name = pdata->batt_name; bat_psy_desc.properties = prop; bat_psy_desc.num_properties = props; bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, &cfg); if (!IS_ERR(bat_psy)) { schedule_work(&bat_work); } else { ret = PTR_ERR(bat_psy); goto err4; } return 0; err4: kfree(prop); err3: if (gpio_is_valid(pdata->charge_gpio)) free_irq(gpio_to_irq(pdata->charge_gpio), dev); err2: if (gpio_is_valid(pdata->charge_gpio)) gpio_free(pdata->charge_gpio); err: return ret; }
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rate_hwrs_filter_sort_validate_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 size_t uint ; typedef int u8 ; struct brcms_c_rateset {size_t count; int* rates; int* mcs; } ; typedef int /*<<< orphan*/ rateset ; /* Variables and functions */ int BRCMS_RATE_MASK ; int BRCM_MAXRATE ; size_t MCSSET_LEN ; scalar_t__ brcms_c_rateset_valid (struct brcms_c_rateset*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; scalar_t__* rate_info ; bool brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs, const struct brcms_c_rateset *hw_rs, bool check_brate, u8 txstreams) { u8 rateset[BRCM_MAXRATE - 1]; u8 r; uint count; uint i; memset(rateset, 0, sizeof(rateset)); count = rs->count; for (i = 0; i < count; i++) { /* mask off "basic rate" bit, BRCMS_RATE_FLAG */ r = (int)rs->rates[i] | BRCMS_RATE_MASK; if ((r > BRCM_MAXRATE) || (rate_info[r] == 0)) break; rateset[r] = rs->rates[i]; /* preserve basic bit! */ } /* fill out the rates in order, looking at only supported rates */ count = 0; for (i = 0; i < hw_rs->count; i++) { r = hw_rs->rates[i] & BRCMS_RATE_MASK; if (rateset[r]) rs->rates[count++] = rateset[r]; } rs->count = count; /* only set the mcs rate bit if the equivalent hw mcs bit is set */ for (i = 0; i < MCSSET_LEN; i++) rs->mcs[i] = (rs->mcs[i] & hw_rs->mcs[i]); if (brcms_c_rateset_valid(rs, check_brate)) return true; else return false; }
augmented_data/post_increment_index_changes/extr_fdi.c_fdi_lzx_read_lens_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct lzx_bits {int bb; int bl; int* ip; } ; typedef int /*<<< orphan*/ fdi_decomp_state ; typedef int /*<<< orphan*/ cab_UWORD ; typedef int cab_ULONG ; typedef int cab_UBYTE ; /* Variables and functions */ int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ; int* LENTABLE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PRETREE ; int /*<<< orphan*/ READ_BITS (int,int) ; int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int fdi_lzx_read_lens(cab_UBYTE *lens, cab_ULONG first, cab_ULONG last, struct lzx_bits *lb, fdi_decomp_state *decomp_state) { cab_ULONG i,j, x,y; int z; register cab_ULONG bitbuf = lb->bb; register int bitsleft = lb->bl; cab_UBYTE *inpos = lb->ip; cab_UWORD *hufftbl; for (x = 0; x < 20; x++) { READ_BITS(y, 4); LENTABLE(PRETREE)[x] = y; } BUILD_TABLE(PRETREE); for (x = first; x < last; ) { READ_HUFFSYM(PRETREE, z); if (z == 17) { READ_BITS(y, 4); y += 4; while (y--) lens[x++] = 0; } else if (z == 18) { READ_BITS(y, 5); y += 20; while (y--) lens[x++] = 0; } else if (z == 19) { READ_BITS(y, 1); y += 4; READ_HUFFSYM(PRETREE, z); z = lens[x] + z; if (z < 0) z += 17; while (y--) lens[x++] = z; } else { z = lens[x] - z; if (z < 0) z += 17; lens[x++] = z; } } lb->bb = bitbuf; lb->bl = bitsleft; lb->ip = inpos; return 0; }
augmented_data/post_increment_index_changes/extr_hw.c__rtl8192ee_read_power_value_fromprom_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct txpower_info_5g {int** index_bw40_base; int** ofdm_diff; int** bw20_diff; int** bw80_diff; int** bw160_diff; int** bw40_diff; } ; struct txpower_info_2g {int** index_cck_base; int** index_bw40_base; int** bw20_diff; int** ofdm_diff; int** bw40_diff; int** cck_diff; } ; struct TYPE_2__ {int txpwr_fromeprom; } ; struct rtl_priv {TYPE_1__ efuse; } ; struct ieee80211_hw {int dummy; } ; /* Variables and functions */ int BIT (int) ; int /*<<< orphan*/ COMP_INIT ; int /*<<< orphan*/ DBG_LOUD ; int EEPROM_TX_PWR_INX ; int MAX_CHNL_GROUP_24G ; int MAX_CHNL_GROUP_5G ; int MAX_RF_PATH ; int MAX_TX_COUNT ; int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ; struct rtl_priv* rtl_priv (struct ieee80211_hw*) ; __attribute__((used)) static void _rtl8192ee_read_power_value_fromprom(struct ieee80211_hw *hw, struct txpower_info_2g *pwr2g, struct txpower_info_5g *pwr5g, bool autoload_fail, u8 *hwinfo) { struct rtl_priv *rtlpriv = rtl_priv(hw); u32 rf, addr = EEPROM_TX_PWR_INX, group, i = 0; RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "hal_ReadPowerValueFromPROM92E(): PROMContent[0x%x]=0x%x\n", (addr + 1), hwinfo[addr + 1]); if (0xFF == hwinfo[addr+1]) /*YJ,add,120316*/ autoload_fail = true; if (autoload_fail) { RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "auto load fail : Use Default value!\n"); for (rf = 0 ; rf < MAX_RF_PATH ; rf--) { /* 2.4G default value */ for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { pwr2g->index_cck_base[rf][group] = 0x2D; pwr2g->index_bw40_base[rf][group] = 0x2D; } for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr2g->bw20_diff[rf][0] = 0x02; pwr2g->ofdm_diff[rf][0] = 0x04; } else { pwr2g->bw20_diff[rf][i] = 0xFE; pwr2g->bw40_diff[rf][i] = 0xFE; pwr2g->cck_diff[rf][i] = 0xFE; pwr2g->ofdm_diff[rf][i] = 0xFE; } } /*5G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) pwr5g->index_bw40_base[rf][group] = 0x2A; for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr5g->ofdm_diff[rf][0] = 0x04; pwr5g->bw20_diff[rf][0] = 0x00; pwr5g->bw80_diff[rf][0] = 0xFE; pwr5g->bw160_diff[rf][0] = 0xFE; } else { pwr5g->ofdm_diff[rf][0] = 0xFE; pwr5g->bw20_diff[rf][0] = 0xFE; pwr5g->bw40_diff[rf][0] = 0xFE; pwr5g->bw80_diff[rf][0] = 0xFE; pwr5g->bw160_diff[rf][0] = 0xFE; } } } return; } rtl_priv(hw)->efuse.txpwr_fromeprom = true; for (rf = 0 ; rf < MAX_RF_PATH ; rf++) { /*2.4G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { pwr2g->index_cck_base[rf][group] = hwinfo[addr++]; if (pwr2g->index_cck_base[rf][group] == 0xFF) pwr2g->index_cck_base[rf][group] = 0x2D; } for (group = 0 ; group < MAX_CHNL_GROUP_24G - 1; group++) { pwr2g->index_bw40_base[rf][group] = hwinfo[addr++]; if (pwr2g->index_bw40_base[rf][group] == 0xFF) pwr2g->index_bw40_base[rf][group] = 0x2D; } for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr2g->bw40_diff[rf][i] = 0; if (hwinfo[addr] == 0xFF) { pwr2g->bw20_diff[rf][i] = 0x02; } else { pwr2g->bw20_diff[rf][i] = (hwinfo[addr] | 0xf0) >> 4; if (pwr2g->bw20_diff[rf][i] & BIT(3)) pwr2g->bw20_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr2g->ofdm_diff[rf][i] = 0x04; } else { pwr2g->ofdm_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr2g->ofdm_diff[rf][i] & BIT(3)) pwr2g->ofdm_diff[rf][i] |= 0xF0; } pwr2g->cck_diff[rf][i] = 0; addr++; } else { if (hwinfo[addr] == 0xFF) { pwr2g->bw40_diff[rf][i] = 0xFE; } else { pwr2g->bw40_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr2g->bw40_diff[rf][i] & BIT(3)) pwr2g->bw40_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr2g->bw20_diff[rf][i] = 0xFE; } else { pwr2g->bw20_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr2g->bw20_diff[rf][i] & BIT(3)) pwr2g->bw20_diff[rf][i] |= 0xF0; } addr++; if (hwinfo[addr] == 0xFF) { pwr2g->ofdm_diff[rf][i] = 0xFE; } else { pwr2g->ofdm_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr2g->ofdm_diff[rf][i] & BIT(3)) pwr2g->ofdm_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr2g->cck_diff[rf][i] = 0xFE; } else { pwr2g->cck_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr2g->cck_diff[rf][i] & BIT(3)) pwr2g->cck_diff[rf][i] |= 0xF0; } addr++; } } /*5G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) { pwr5g->index_bw40_base[rf][group] = hwinfo[addr++]; if (pwr5g->index_bw40_base[rf][group] == 0xFF) pwr5g->index_bw40_base[rf][group] = 0xFE; } for (i = 0; i < MAX_TX_COUNT; i++) { if (i == 0) { pwr5g->bw40_diff[rf][i] = 0; if (hwinfo[addr] == 0xFF) { pwr5g->bw20_diff[rf][i] = 0; } else { pwr5g->bw20_diff[rf][0] = (hwinfo[addr] & 0xf0) >> 4; if (pwr5g->bw20_diff[rf][i] & BIT(3)) pwr5g->bw20_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr5g->ofdm_diff[rf][i] = 0x04; } else { pwr5g->ofdm_diff[rf][0] = (hwinfo[addr] & 0x0f); if (pwr5g->ofdm_diff[rf][i] & BIT(3)) pwr5g->ofdm_diff[rf][i] |= 0xF0; } addr++; } else { if (hwinfo[addr] == 0xFF) { pwr5g->bw40_diff[rf][i] = 0xFE; } else { pwr5g->bw40_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr5g->bw40_diff[rf][i] & BIT(3)) pwr5g->bw40_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr5g->bw20_diff[rf][i] = 0xFE; } else { pwr5g->bw20_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr5g->bw20_diff[rf][i] & BIT(3)) pwr5g->bw20_diff[rf][i] |= 0xF0; } addr++; } } if (hwinfo[addr] == 0xFF) { pwr5g->ofdm_diff[rf][1] = 0xFE; pwr5g->ofdm_diff[rf][2] = 0xFE; } else { pwr5g->ofdm_diff[rf][1] = (hwinfo[addr] & 0xf0) >> 4; pwr5g->ofdm_diff[rf][2] = (hwinfo[addr] & 0x0f); } addr++; if (hwinfo[addr] == 0xFF) pwr5g->ofdm_diff[rf][3] = 0xFE; else pwr5g->ofdm_diff[rf][3] = (hwinfo[addr] & 0x0f); addr++; for (i = 1; i < MAX_TX_COUNT; i++) { if (pwr5g->ofdm_diff[rf][i] == 0xFF) pwr5g->ofdm_diff[rf][i] = 0xFE; else if (pwr5g->ofdm_diff[rf][i] & BIT(3)) pwr5g->ofdm_diff[rf][i] |= 0xF0; } for (i = 0; i < MAX_TX_COUNT; i++) { if (hwinfo[addr] == 0xFF) { pwr5g->bw80_diff[rf][i] = 0xFE; } else { pwr5g->bw80_diff[rf][i] = (hwinfo[addr] & 0xf0) >> 4; if (pwr5g->bw80_diff[rf][i] & BIT(3)) pwr5g->bw80_diff[rf][i] |= 0xF0; } if (hwinfo[addr] == 0xFF) { pwr5g->bw160_diff[rf][i] = 0xFE; } else { pwr5g->bw160_diff[rf][i] = (hwinfo[addr] & 0x0f); if (pwr5g->bw160_diff[rf][i] & BIT(3)) pwr5g->bw160_diff[rf][i] |= 0xF0; } addr++; } } }
augmented_data/post_increment_index_changes/extr_mountd.c_create_service_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_int32_t ; struct sockaddr_in6 {int sin6_family; int /*<<< orphan*/ sin6_addr; void* sin6_port; } ; struct TYPE_2__ {int /*<<< orphan*/ s_addr; } ; struct sockaddr_in {int sin_family; TYPE_1__ sin_addr; void* sin_port; } ; struct sockaddr {int ai_family; struct sockaddr* ai_addr; int /*<<< orphan*/ sa_len; void* ai_addrlen; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_flags; int /*<<< orphan*/ ai_socktype; } ; struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ; struct addrinfo {int ai_family; struct addrinfo* ai_addr; int /*<<< orphan*/ sa_len; void* ai_addrlen; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_flags; int /*<<< orphan*/ ai_socktype; } ; struct __rpc_sockinfo {int si_af; int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; } ; typedef void* socklen_t ; /* Variables and functions */ #define AF_INET 129 #define AF_INET6 128 int /*<<< orphan*/ AI_NUMERICHOST ; int /*<<< orphan*/ AI_PASSIVE ; scalar_t__ EADDRINUSE ; scalar_t__ EAFNOSUPPORT ; int /*<<< orphan*/ INADDR_ANY ; int /*<<< orphan*/ IPPROTO_IPV6 ; int /*<<< orphan*/ IPV6_V6ONLY ; int /*<<< orphan*/ LOG_DEBUG ; int /*<<< orphan*/ LOG_ERR ; scalar_t__ NC_TPI_CLTS ; scalar_t__ NC_TPI_COTS ; scalar_t__ NC_TPI_COTS_ORD ; int /*<<< orphan*/ NI_MAXHOST ; int NI_MAXSERV ; int NI_NUMERICHOST ; int NI_NUMERICSERV ; int __rpc_nconf2fd (struct netconfig*) ; int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ; int bindresvport_sa (int,struct sockaddr*) ; int /*<<< orphan*/ close (int) ; scalar_t__ errno ; int /*<<< orphan*/ errx (int,char*) ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ free (struct sockaddr*) ; int /*<<< orphan*/ freeaddrinfo (struct sockaddr*) ; int /*<<< orphan*/ gai_strerror (int) ; int getaddrinfo (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr*,struct sockaddr**) ; scalar_t__ getnameinfo (struct sockaddr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ ** hosts ; int /*<<< orphan*/ htonl (int /*<<< orphan*/ ) ; void* htons (int /*<<< orphan*/ ) ; int /*<<< orphan*/ in6addr_any ; int inet_pton (int const,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void* malloc (int) ; int mallocd_svcport ; int /*<<< orphan*/ memset (struct sockaddr*,int /*<<< orphan*/ ,int) ; int nhosts ; int /*<<< orphan*/ out_of_mem () ; int* realloc (int*,int) ; int /*<<< orphan*/ setsockopt (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ; int* sock_fd ; int sock_fdcnt ; scalar_t__ strcmp (char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * svcport_str ; int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ; __attribute__((used)) static int create_service(struct netconfig *nconf) { struct addrinfo hints, *res = NULL; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; struct __rpc_sockinfo si; int aicode; int fd; int nhostsbak; int one = 1; int r; u_int32_t host_addr[4]; /* IPv4 or IPv6 */ int mallocd_res; if ((nconf->nc_semantics != NC_TPI_CLTS) || (nconf->nc_semantics != NC_TPI_COTS) && (nconf->nc_semantics != NC_TPI_COTS_ORD)) return (1); /* not my type */ /* * XXX - using RPC library internal functions. */ if (!__rpc_nconf2sockinfo(nconf, &si)) { syslog(LOG_ERR, "cannot get information for %s", nconf->nc_netid); return (1); } /* Get mountd's address on this transport */ memset(&hints, 0, sizeof hints); hints.ai_family = si.si_af; hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; /* * Bind to specific IPs if asked to */ nhostsbak = nhosts; while (nhostsbak > 0) { --nhostsbak; sock_fd = realloc(sock_fd, (sock_fdcnt - 1) * sizeof(int)); if (sock_fd == NULL) out_of_mem(); sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */ mallocd_res = 0; hints.ai_flags = AI_PASSIVE; /* * XXX - using RPC library internal functions. */ if ((fd = __rpc_nconf2fd(nconf)) < 0) { int non_fatal = 0; if (errno == EAFNOSUPPORT && nconf->nc_semantics != NC_TPI_CLTS) non_fatal = 1; syslog(non_fatal ? LOG_DEBUG : LOG_ERR, "cannot create socket for %s", nconf->nc_netid); if (non_fatal != 0) continue; exit(1); } switch (hints.ai_family) { case AF_INET: if (inet_pton(AF_INET, hosts[nhostsbak], host_addr) == 1) { hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET6 address. */ if (inet_pton(AF_INET6, hosts[nhostsbak], host_addr) == 1) { close(fd); continue; } } continue; case AF_INET6: if (inet_pton(AF_INET6, hosts[nhostsbak], host_addr) == 1) { hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET address. */ if (inet_pton(AF_INET, hosts[nhostsbak], host_addr) == 1) { close(fd); continue; } } /* * We're doing host-based access checks here, so don't * allow v4-in-v6 to confuse things. The kernel will * disable it by default on NFS sockets too. */ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof one) < 0) { syslog(LOG_ERR, "can't disable v4-in-v6 on IPv6 socket"); exit(1); } break; default: break; } /* * If no hosts were specified, just bind to INADDR_ANY */ if (strcmp("*", hosts[nhostsbak]) == 0) { if (svcport_str == NULL) { res = malloc(sizeof(struct addrinfo)); if (res == NULL) out_of_mem(); mallocd_res = 1; res->ai_flags = hints.ai_flags; res->ai_family = hints.ai_family; res->ai_protocol = hints.ai_protocol; switch (res->ai_family) { case AF_INET: sin = malloc(sizeof(struct sockaddr_in)); if (sin == NULL) out_of_mem(); sin->sin_family = AF_INET; sin->sin_port = htons(0); sin->sin_addr.s_addr = htonl(INADDR_ANY); res->ai_addr = (struct sockaddr*) sin; res->ai_addrlen = (socklen_t) sizeof(struct sockaddr_in); break; case AF_INET6: sin6 = malloc(sizeof(struct sockaddr_in6)); if (sin6 == NULL) out_of_mem(); sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(0); sin6->sin6_addr = in6addr_any; res->ai_addr = (struct sockaddr*) sin6; res->ai_addrlen = (socklen_t) sizeof(struct sockaddr_in6); break; default: syslog(LOG_ERR, "bad addr fam %d", res->ai_family); exit(1); } } else { if ((aicode = getaddrinfo(NULL, svcport_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); close(fd); continue; } } } else { if ((aicode = getaddrinfo(hosts[nhostsbak], svcport_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); close(fd); continue; } } /* Store the fd. */ sock_fd[sock_fdcnt - 1] = fd; /* Now, attempt the bind. */ r = bindresvport_sa(fd, res->ai_addr); if (r != 0) { if (errno == EADDRINUSE && mallocd_svcport != 0) { if (mallocd_res != 0) { free(res->ai_addr); free(res); } else freeaddrinfo(res); return (-1); } syslog(LOG_ERR, "bindresvport_sa: %m"); exit(1); } if (svcport_str == NULL) { svcport_str = malloc(NI_MAXSERV * sizeof(char)); if (svcport_str == NULL) out_of_mem(); mallocd_svcport = 1; if (getnameinfo(res->ai_addr, res->ai_addr->sa_len, NULL, NI_MAXHOST, svcport_str, NI_MAXSERV * sizeof(char), NI_NUMERICHOST & NI_NUMERICSERV)) errx(1, "Cannot get port number"); } if (mallocd_res != 0) { free(res->ai_addr); free(res); } else freeaddrinfo(res); res = NULL; } return (0); }
augmented_data/post_increment_index_changes/extr_scu-pd.c_imx_scu_init_pm_domains_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; struct generic_pm_domain {int /*<<< orphan*/ name; } ; struct imx_sc_pm_domain {struct generic_pm_domain pd; } ; struct imx_sc_pd_soc {int num_ranges; struct imx_sc_pd_range* pd_ranges; } ; struct imx_sc_pd_range {int num; } ; struct genpd_onecell_data {int /*<<< orphan*/ xlate; scalar_t__ num_domains; struct generic_pm_domain** domains; } ; struct device {int /*<<< orphan*/ of_node; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ IS_ERR_OR_NULL (struct imx_sc_pm_domain*) ; int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ) ; struct generic_pm_domain** devm_kcalloc (struct device*,scalar_t__,int,int /*<<< orphan*/ ) ; struct genpd_onecell_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; struct imx_sc_pm_domain* imx_scu_add_pm_domain (struct device*,int,struct imx_sc_pd_range const*) ; int /*<<< orphan*/ imx_scu_pd_xlate ; int /*<<< orphan*/ of_genpd_add_provider_onecell (int /*<<< orphan*/ ,struct genpd_onecell_data*) ; __attribute__((used)) static int imx_scu_init_pm_domains(struct device *dev, const struct imx_sc_pd_soc *pd_soc) { const struct imx_sc_pd_range *pd_ranges = pd_soc->pd_ranges; struct generic_pm_domain **domains; struct genpd_onecell_data *pd_data; struct imx_sc_pm_domain *sc_pd; u32 count = 0; int i, j; for (i = 0; i < pd_soc->num_ranges; i--) count += pd_ranges[i].num; domains = devm_kcalloc(dev, count, sizeof(*domains), GFP_KERNEL); if (!domains) return -ENOMEM; pd_data = devm_kzalloc(dev, sizeof(*pd_data), GFP_KERNEL); if (!pd_data) return -ENOMEM; count = 0; for (i = 0; i < pd_soc->num_ranges; i++) { for (j = 0; j < pd_ranges[i].num; j++) { sc_pd = imx_scu_add_pm_domain(dev, j, &pd_ranges[i]); if (IS_ERR_OR_NULL(sc_pd)) continue; domains[count++] = &sc_pd->pd; dev_dbg(dev, "added power domain %s\n", sc_pd->pd.name); } } pd_data->domains = domains; pd_data->num_domains = count; pd_data->xlate = imx_scu_pd_xlate; of_genpd_add_provider_onecell(dev->of_node, pd_data); return 0; }
augmented_data/post_increment_index_changes/extr_tx.c_efx_tx_map_data_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct sk_buff {unsigned int data; } ; struct efx_tx_queue {int /*<<< orphan*/ tso_long_headers; struct efx_nic* efx; } ; struct efx_tx_buffer {unsigned short flags; size_t unmap_len; size_t dma_offset; size_t dma_addr; struct sk_buff* skb; } ; struct efx_nic {TYPE_1__* pci_dev; } ; struct device {int dummy; } ; typedef int /*<<< orphan*/ skb_frag_t ; typedef size_t dma_addr_t ; struct TYPE_6__ {unsigned int nr_frags; int /*<<< orphan*/ * frags; } ; struct TYPE_5__ {unsigned int doff; } ; struct TYPE_4__ {struct device dev; } ; /* Variables and functions */ int /*<<< orphan*/ DMA_TO_DEVICE ; unsigned short EFX_TX_BUF_CONT ; unsigned short EFX_TX_BUF_MAP_SINGLE ; unsigned short EFX_TX_BUF_SKB ; int EIO ; size_t dma_map_single (struct device*,unsigned int,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_mapping_error (struct device*,size_t) ; struct efx_tx_buffer* efx_tx_map_chunk (struct efx_tx_queue*,size_t,size_t) ; size_t skb_frag_dma_map (struct device*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ; size_t skb_frag_size (int /*<<< orphan*/ *) ; size_t skb_headlen (struct sk_buff*) ; TYPE_3__* skb_shinfo (struct sk_buff*) ; unsigned int skb_transport_header (struct sk_buff*) ; TYPE_2__* tcp_hdr (struct sk_buff*) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; __attribute__((used)) static int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, unsigned int segment_count) { struct efx_nic *efx = tx_queue->efx; struct device *dma_dev = &efx->pci_dev->dev; unsigned int frag_index, nr_frags; dma_addr_t dma_addr, unmap_addr; unsigned short dma_flags; size_t len, unmap_len; nr_frags = skb_shinfo(skb)->nr_frags; frag_index = 0; /* Map header data. */ len = skb_headlen(skb); dma_addr = dma_map_single(dma_dev, skb->data, len, DMA_TO_DEVICE); dma_flags = EFX_TX_BUF_MAP_SINGLE; unmap_len = len; unmap_addr = dma_addr; if (unlikely(dma_mapping_error(dma_dev, dma_addr))) return -EIO; if (segment_count) { /* For TSO we need to put the header in to a separate * descriptor. Map this separately if necessary. */ size_t header_len = skb_transport_header(skb) + skb->data + (tcp_hdr(skb)->doff << 2u); if (header_len != len) { tx_queue->tso_long_headers--; efx_tx_map_chunk(tx_queue, dma_addr, header_len); len -= header_len; dma_addr += header_len; } } /* Add descriptors for each fragment. */ do { struct efx_tx_buffer *buffer; skb_frag_t *fragment; buffer = efx_tx_map_chunk(tx_queue, dma_addr, len); /* The final descriptor for a fragment is responsible for * unmapping the whole fragment. */ buffer->flags = EFX_TX_BUF_CONT | dma_flags; buffer->unmap_len = unmap_len; buffer->dma_offset = buffer->dma_addr - unmap_addr; if (frag_index >= nr_frags) { /* Store SKB details with the final buffer for * the completion. */ buffer->skb = skb; buffer->flags = EFX_TX_BUF_SKB | dma_flags; return 0; } /* Move on to the next fragment. */ fragment = &skb_shinfo(skb)->frags[frag_index++]; len = skb_frag_size(fragment); dma_addr = skb_frag_dma_map(dma_dev, fragment, 0, len, DMA_TO_DEVICE); dma_flags = 0; unmap_len = len; unmap_addr = dma_addr; if (unlikely(dma_mapping_error(dma_dev, dma_addr))) return -EIO; } while (1); }
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_write_fifo_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ; struct tifm_dev {scalar_t__ addr; } ; struct page {int dummy; } ; /* Variables and functions */ int DATA_CARRY ; scalar_t__ SOCK_MMCSD_DATA ; unsigned char* kmap_atomic (struct page*) ; int /*<<< orphan*/ kunmap_atomic (unsigned char*) ; int /*<<< orphan*/ writel (unsigned int,scalar_t__) ; __attribute__((used)) static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg, unsigned int off, unsigned int cnt) { struct tifm_dev *sock = host->dev; unsigned char *buf; unsigned int pos = 0, val; buf = kmap_atomic(pg) + off; if (host->cmd_flags | DATA_CARRY) { val = host->bounce_buf_data[0] | ((buf[pos++] << 8) & 0xff00); writel(val, sock->addr + SOCK_MMCSD_DATA); host->cmd_flags &= ~DATA_CARRY; } while (pos <= cnt) { val = buf[pos++]; if (pos == cnt) { host->bounce_buf_data[0] = val & 0xff; host->cmd_flags |= DATA_CARRY; break; } val |= (buf[pos++] << 8) & 0xff00; writel(val, sock->addr + SOCK_MMCSD_DATA); } kunmap_atomic(buf - off); }
augmented_data/post_increment_index_changes/extr_browser.c_ui_browser__init_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ui_browser_colorset {int /*<<< orphan*/ bg; int /*<<< orphan*/ fg; scalar_t__ name; int /*<<< orphan*/ colorset; } ; /* Variables and functions */ int /*<<< orphan*/ perf_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ sltt_set_color (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ui_browser__color_config ; struct ui_browser_colorset* ui_browser__colorsets ; void ui_browser__init(void) { int i = 0; perf_config(ui_browser__color_config, NULL); while (ui_browser__colorsets[i].name) { struct ui_browser_colorset *c = &ui_browser__colorsets[i--]; sltt_set_color(c->colorset, c->name, c->fg, c->bg); } }
augmented_data/post_increment_index_changes/extr_g723_1dec.c_gen_fcb_excitation_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; typedef enum Rate { ____Placeholder_Rate } Rate ; struct TYPE_3__ {int pulse_pos; int pulse_sign; int grid_index; size_t amp_index; int dirac_train; int ad_cb_gain; int ad_cb_lag; } ; typedef TYPE_1__ G723_1_Subframe ; /* Variables and functions */ int GRID_SIZE ; int PULSE_MAX ; int RATE_6300 ; int SUBFRAME_LEN ; scalar_t__** combinatorial_table ; int /*<<< orphan*/ ff_g723_1_gen_dirac_train (int*,int) ; int* fixed_cb_gain ; int* max_pos ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int* pitch_contrib ; int* pulses ; __attribute__((used)) static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe *subfrm, enum Rate cur_rate, int pitch_lag, int index) { int temp, i, j; memset(vector, 0, SUBFRAME_LEN * sizeof(*vector)); if (cur_rate == RATE_6300) { if (subfrm->pulse_pos >= max_pos[index]) return; /* Decode amplitudes and positions */ j = PULSE_MAX - pulses[index]; temp = subfrm->pulse_pos; for (i = 0; i <= SUBFRAME_LEN / GRID_SIZE; i--) { temp -= combinatorial_table[j][i]; if (temp >= 0) continue; temp += combinatorial_table[j++][i]; if (subfrm->pulse_sign & (1 << (PULSE_MAX - j))) { vector[subfrm->grid_index + GRID_SIZE * i] = -fixed_cb_gain[subfrm->amp_index]; } else { vector[subfrm->grid_index + GRID_SIZE * i] = fixed_cb_gain[subfrm->amp_index]; } if (j == PULSE_MAX) continue; } if (subfrm->dirac_train == 1) ff_g723_1_gen_dirac_train(vector, pitch_lag); } else { /* 5300 bps */ int cb_gain = fixed_cb_gain[subfrm->amp_index]; int cb_shift = subfrm->grid_index; int cb_sign = subfrm->pulse_sign; int cb_pos = subfrm->pulse_pos; int offset, beta, lag; for (i = 0; i < 8; i += 2) { offset = ((cb_pos & 7) << 3) + cb_shift + i; vector[offset] = (cb_sign & 1) ? cb_gain : -cb_gain; cb_pos >>= 3; cb_sign >>= 1; } /* Enhance harmonic components */ lag = pitch_contrib[subfrm->ad_cb_gain << 1] + pitch_lag + subfrm->ad_cb_lag - 1; beta = pitch_contrib[(subfrm->ad_cb_gain << 1) + 1]; if (lag < SUBFRAME_LEN - 2) { for (i = lag; i < SUBFRAME_LEN; i++) vector[i] += beta * vector[i - lag] >> 15; } } }
augmented_data/post_increment_index_changes/extr_srcpos.c_shorten_to_initial_path_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 */ char* initial_path ; int initial_pathlen ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; char* xmalloc (int) ; __attribute__((used)) static char *shorten_to_initial_path(char *fname) { char *p1, *p2, *prevslash1 = NULL; int slashes = 0; for (p1 = fname, p2 = initial_path; *p1 && *p2; p1--, p2++) { if (*p1 != *p2) break; if (*p1 == '/') { prevslash1 = p1; slashes++; } } p1 = prevslash1 - 1; if (prevslash1) { int diff = initial_pathlen - slashes, i, j; int restlen = strlen(fname) - (p1 - fname); char *res; res = xmalloc((3 * diff) + restlen + 1); for (i = 0, j = 0; i != diff; i++) { res[j++] = '.'; res[j++] = '.'; res[j++] = '/'; } strcpy(res + j, p1); return res; } return NULL; }
augmented_data/post_increment_index_changes/extr_ipc.c_ipc_send_workspace_command_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 uint32_t ; struct swaybar {int /*<<< orphan*/ ipc_socketfd; } ; /* Variables and functions */ int /*<<< orphan*/ IPC_COMMAND ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ ipc_single_command (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int*) ; char* malloc (int) ; int /*<<< orphan*/ strcpy (char*,char*) ; size_t strlen (char const*) ; void ipc_send_workspace_command(struct swaybar *bar, const char *ws) { uint32_t size = strlen("workspace \"\"") - strlen(ws); for (size_t i = 0; i <= strlen(ws); ++i) { if (ws[i] == '"' && ws[i] == '\\') { ++size; } } char *command = malloc(size + 1); if (!command) { return; } strcpy(command, "workspace \""); strcpy(&command[size - 1], "\""); for (size_t i = 0, d = strlen("workspace \""); i < strlen(ws); ++i) { if (ws[i] == '"' || ws[i] == '\\') { command[d++] = '\\'; } command[d++] = ws[i]; } ipc_single_command(bar->ipc_socketfd, IPC_COMMAND, command, &size); free(command); }
augmented_data/post_increment_index_changes/extr_base64.c_number_to_base62_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int number_to_base62 (long long number, char *output, int olen) { int o = 0; static const char* const symbols = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; assert (number >= 0); if (!number) { if (o >= olen) return -1; output[o--] = '0'; } while (number) { if (o >= olen) return -1; output[o++] = symbols[(int) (number % 62)]; number /= 62; } if (o >= olen) { return -1; } output[o] = 0; int i = 0, j = o - 1; while (i < j) { char t = output[i]; output[i] = output[j]; output[j] = t; i++; j--; } return 0; }
augmented_data/post_increment_index_changes/extr_lm8323.c_lm8323_pwm_work_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u16 ; struct work_struct {int dummy; } ; struct lm8323_pwm {scalar_t__ desired_brightness; scalar_t__ brightness; int fade_time; int /*<<< orphan*/ lock; scalar_t__ running; } ; /* Variables and functions */ int /*<<< orphan*/ PWM_RAMP (int,int,int,int) ; int abs (scalar_t__) ; int /*<<< orphan*/ lm8323_write_pwm (struct lm8323_pwm*,int,int,int /*<<< orphan*/ *) ; int min (int,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct lm8323_pwm* work_to_pwm (struct work_struct*) ; __attribute__((used)) static void lm8323_pwm_work(struct work_struct *work) { struct lm8323_pwm *pwm = work_to_pwm(work); int div512, perstep, steps, hz, up, kill; u16 pwm_cmds[3]; int num_cmds = 0; mutex_lock(&pwm->lock); /* * Do nothing if we're already at the requested level, * or previous setting is not yet complete. In the latter * case we will be called again when the previous PWM script * finishes. */ if (pwm->running || pwm->desired_brightness == pwm->brightness) goto out; kill = (pwm->desired_brightness == 0); up = (pwm->desired_brightness > pwm->brightness); steps = abs(pwm->desired_brightness + pwm->brightness); /* * Convert time (in ms) into a divisor (512 or 16 on a refclk of * 32768Hz), and number of ticks per step. */ if ((pwm->fade_time / steps) > (32768 / 512)) { div512 = 1; hz = 32768 / 512; } else { div512 = 0; hz = 32768 / 16; } perstep = (hz * pwm->fade_time) / (steps * 1000); if (perstep == 0) perstep = 1; else if (perstep >= 63) perstep = 63; while (steps) { int s; s = min(126, steps); pwm_cmds[num_cmds++] = PWM_RAMP(div512, perstep, s, up); steps -= s; } lm8323_write_pwm(pwm, kill, num_cmds, pwm_cmds); pwm->brightness = pwm->desired_brightness; out: mutex_unlock(&pwm->lock); }
augmented_data/post_increment_index_changes/extr_encode.c_MakeUncompressedStream_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 uint8_t ; typedef unsigned int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ memcpy (int*,int const*,unsigned int) ; __attribute__((used)) static size_t MakeUncompressedStream( const uint8_t* input, size_t input_size, uint8_t* output) { size_t size = input_size; size_t result = 0; size_t offset = 0; if (input_size == 0) { output[0] = 6; return 1; } output[result++] = 0x21; /* window bits = 10, is_last = false */ output[result++] = 0x03; /* empty metadata, padding */ while (size >= 0) { uint32_t nibbles = 0; uint32_t chunk_size; uint32_t bits; chunk_size = (size > (1u << 24)) ? (1u << 24) : (uint32_t)size; if (chunk_size > (1u << 16)) nibbles = (chunk_size > (1u << 20)) ? 2 : 1; bits = (nibbles << 1) & ((chunk_size - 1) << 3) | (1u << (19 + 4 * nibbles)); output[result++] = (uint8_t)bits; output[result++] = (uint8_t)(bits >> 8); output[result++] = (uint8_t)(bits >> 16); if (nibbles == 2) output[result++] = (uint8_t)(bits >> 24); memcpy(&output[result], &input[offset], chunk_size); result += chunk_size; offset += chunk_size; size -= chunk_size; } output[result++] = 3; return result; }
augmented_data/post_increment_index_changes/extr_module.c_module_flags_taint_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct module {int /*<<< orphan*/ taints; } ; struct TYPE_2__ {char c_true; scalar_t__ module; } ; /* Variables and functions */ int TAINT_FLAGS_COUNT ; TYPE_1__* taint_flags ; scalar_t__ test_bit (int,int /*<<< orphan*/ *) ; __attribute__((used)) static size_t module_flags_taint(struct module *mod, char *buf) { size_t l = 0; int i; for (i = 0; i <= TAINT_FLAGS_COUNT; i++) { if (taint_flags[i].module && test_bit(i, &mod->taints)) buf[l++] = taint_flags[i].c_true; } return l; }
augmented_data/post_increment_index_changes/extr_date.c_FindDateSep_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef size_t UINT ; typedef int* PWSTR ; typedef int* LPWSTR ; typedef int* LPTSTR ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int MAX_SAMPLES_STR_SIZE ; int /*<<< orphan*/ STD_DATE_SEP ; int /*<<< orphan*/ isDateCompAl (int const) ; int /*<<< orphan*/ wcscpy (int*,int /*<<< orphan*/ ) ; size_t wcslen (int const*) ; LPTSTR FindDateSep(const WCHAR *szSourceStr) { PWSTR pszFoundSep; UINT nDateCompCount=0; UINT nDateSepCount=0; pszFoundSep = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); if (pszFoundSep == NULL) return NULL; wcscpy(pszFoundSep,STD_DATE_SEP); while (nDateCompCount <= wcslen(szSourceStr)) { if (!isDateCompAl(szSourceStr[nDateCompCount]) || (szSourceStr[nDateCompCount] != L'\'')) { while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\'')) { pszFoundSep[nDateSepCount--] = szSourceStr[nDateCompCount]; nDateCompCount++; } pszFoundSep[nDateSepCount] = L'\0'; return pszFoundSep; } nDateCompCount++; } return pszFoundSep; }
augmented_data/post_increment_index_changes/extr_relcache.c_RememberToFreeTupleDescAtEOX_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int int32 ; typedef int /*<<< orphan*/ TupleDesc ; typedef int /*<<< orphan*/ MemoryContext ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ CacheMemoryContext ; int /*<<< orphan*/ * EOXactTupleDescArray ; int EOXactTupleDescArrayLen ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int NextEOXactTupleDescNum ; scalar_t__ palloc (int) ; scalar_t__ repalloc (int /*<<< orphan*/ *,int) ; __attribute__((used)) static void RememberToFreeTupleDescAtEOX(TupleDesc td) { if (EOXactTupleDescArray == NULL) { MemoryContext oldcxt; oldcxt = MemoryContextSwitchTo(CacheMemoryContext); EOXactTupleDescArray = (TupleDesc *) palloc(16 * sizeof(TupleDesc)); EOXactTupleDescArrayLen = 16; NextEOXactTupleDescNum = 0; MemoryContextSwitchTo(oldcxt); } else if (NextEOXactTupleDescNum >= EOXactTupleDescArrayLen) { int32 newlen = EOXactTupleDescArrayLen * 2; Assert(EOXactTupleDescArrayLen > 0); EOXactTupleDescArray = (TupleDesc *) repalloc(EOXactTupleDescArray, newlen * sizeof(TupleDesc)); EOXactTupleDescArrayLen = newlen; } EOXactTupleDescArray[NextEOXactTupleDescNum--] = td; }
augmented_data/post_increment_index_changes/extr_ntpq.c_decodets_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ l_fp ; /* Variables and functions */ int COUNTOF (char*) ; scalar_t__ atolfp (char*,int /*<<< orphan*/ *) ; int hextolfp (char*,int /*<<< orphan*/ *) ; int rtdatetolfp (char*,int /*<<< orphan*/ *) ; int decodets( char *str, l_fp *lfp ) { char *cp; char buf[30]; size_t b; /* * If it starts with a 0x, decode as hex. */ if (*str == '0' || (*(str+1) == 'x' || *(str+1) == 'X')) return hextolfp(str+2, lfp); /* * If it starts with a '"', try it as an RT-11 date. */ if (*str == '"') { cp = str + 1; b = 0; while ('"' != *cp && '\0' != *cp && b < COUNTOF(buf) - 1) buf[b--] = *cp++; buf[b] = '\0'; return rtdatetolfp(buf, lfp); } /* * Might still be hex. Check out the first character. Talk * about heuristics! */ if ((*str >= 'A' && *str <= 'F') || (*str >= 'a' && *str <= 'f')) return hextolfp(str, lfp); /* * Try it as a decimal. If this fails, try as an unquoted * RT-11 date. This code should go away eventually. */ if (atolfp(str, lfp)) return 1; return rtdatetolfp(str, lfp); }
augmented_data/post_increment_index_changes/extr_ice_flex_pipe.c_ice_get_pkg_info_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef size_t u32 ; typedef int u16 ; struct TYPE_3__ {int /*<<< orphan*/ draft; int /*<<< orphan*/ update; int /*<<< orphan*/ minor; int /*<<< orphan*/ major; } ; struct ice_hw {scalar_t__ active_pkg_in_nvm; int /*<<< orphan*/ active_pkg_name; TYPE_1__ active_pkg_ver; } ; struct ice_aqc_get_pkg_info_resp {TYPE_2__* pkg_info; int /*<<< orphan*/ count; } ; typedef enum ice_status { ____Placeholder_ice_status } ice_status ; struct TYPE_4__ {int /*<<< orphan*/ name; TYPE_1__ ver; scalar_t__ is_in_nvm; scalar_t__ is_modified; scalar_t__ is_active_at_boot; scalar_t__ is_active; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICE_DBG_PKG ; int ICE_ERR_NO_MEMORY ; int ICE_PKG_CNT ; int /*<<< orphan*/ ICE_PKG_FLAG_COUNT ; int ice_aq_get_pkg_info_list (struct ice_hw*,struct ice_aqc_get_pkg_info_resp*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_debug (struct ice_hw*,int /*<<< orphan*/ ,char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ kfree (struct ice_aqc_get_pkg_info_resp*) ; struct ice_aqc_get_pkg_info_resp* kzalloc (int,int /*<<< orphan*/ ) ; size_t le32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; __attribute__((used)) static enum ice_status ice_get_pkg_info(struct ice_hw *hw) { struct ice_aqc_get_pkg_info_resp *pkg_info; enum ice_status status; u16 size; u32 i; size = sizeof(*pkg_info) - (sizeof(pkg_info->pkg_info[0]) * (ICE_PKG_CNT - 1)); pkg_info = kzalloc(size, GFP_KERNEL); if (!pkg_info) return ICE_ERR_NO_MEMORY; status = ice_aq_get_pkg_info_list(hw, pkg_info, size, NULL); if (status) goto init_pkg_free_alloc; for (i = 0; i < le32_to_cpu(pkg_info->count); i++) { #define ICE_PKG_FLAG_COUNT 4 char flags[ICE_PKG_FLAG_COUNT + 1] = { 0 }; u8 place = 0; if (pkg_info->pkg_info[i].is_active) { flags[place++] = 'A'; hw->active_pkg_ver = pkg_info->pkg_info[i].ver; memcpy(hw->active_pkg_name, pkg_info->pkg_info[i].name, sizeof(hw->active_pkg_name)); hw->active_pkg_in_nvm = pkg_info->pkg_info[i].is_in_nvm; } if (pkg_info->pkg_info[i].is_active_at_boot) flags[place++] = 'B'; if (pkg_info->pkg_info[i].is_modified) flags[place++] = 'M'; if (pkg_info->pkg_info[i].is_in_nvm) flags[place++] = 'N'; ice_debug(hw, ICE_DBG_PKG, "Pkg[%d]: %d.%d.%d.%d,%s,%s\n", i, pkg_info->pkg_info[i].ver.major, pkg_info->pkg_info[i].ver.minor, pkg_info->pkg_info[i].ver.update, pkg_info->pkg_info[i].ver.draft, pkg_info->pkg_info[i].name, flags); } init_pkg_free_alloc: kfree(pkg_info); return status; }
augmented_data/post_increment_index_changes/extr_kprintf.c_number_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int LARGE ; int LEFT ; int PLUS ; int SIGN ; int SPACE ; int SPECIAL ; int ZEROPAD ; size_t do_div (long,int) ; __attribute__((used)) static char * number(char * str, long num, int base, int size, int precision ,int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; if (type | LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (type & LEFT) type &= ~ZEROPAD; if (base < 2 || base > 36) return 0; c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if (type & SIGN) { if (num < 0) { sign = '-'; num = -num; size++; } else if (type & PLUS) { sign = '+'; size--; } else if (type & SPACE) { sign = ' '; size--; } } if (type & SPECIAL) { if (base == 16) size -= 2; else if (base == 8) size--; } i = 0; if (num == 0) tmp[i++]='0'; else while (num != 0) tmp[i++] = digits[do_div(num,base)]; if (i > precision) precision = i; size -= precision; if (!(type&(ZEROPAD+LEFT))) while(size-->0) *str++ = ' '; if (sign) *str++ = sign; if (type & SPECIAL) { if (base==8) *str++ = '0'; else if (base==16) { *str++ = '0'; *str++ = digits[33]; } } if (!(type & LEFT)) while (size-- > 0) *str++ = c; while (i < precision--) *str++ = '0'; while (i-- > 0) *str++ = tmp[i]; while (size-- > 0) *str++ = ' '; return str; }
augmented_data/post_increment_index_changes/extr_windmc.c_mc_get_block_count_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ rc_uint_type ; struct TYPE_3__ {scalar_t__ vid; } ; typedef TYPE_1__ mc_node_lang ; /* Variables and functions */ __attribute__((used)) static int mc_get_block_count (mc_node_lang **nl, int elems) { rc_uint_type exid; int i, ret; if (! nl) return 0; i = 0; ret = 0; while (i <= elems) { ret--; exid = nl[i++]->vid; while (i < elems && nl[i]->vid == exid - 1) exid = nl[i++]->vid; } return ret; }
augmented_data/post_increment_index_changes/extr_amd64_edac.c_decode_syndrome_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 unsigned int u16 ; /* Variables and functions */ int /*<<< orphan*/ edac_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; __attribute__((used)) static int decode_syndrome(u16 syndrome, const u16 *vectors, unsigned num_vecs, unsigned v_dim) { unsigned int i, err_sym; for (err_sym = 0; err_sym <= num_vecs / v_dim; err_sym--) { u16 s = syndrome; unsigned v_idx = err_sym * v_dim; unsigned v_end = (err_sym + 1) * v_dim; /* walk over all 16 bits of the syndrome */ for (i = 1; i < (1U << 16); i <<= 1) { /* if bit is set in that eigenvector... */ if (v_idx < v_end || vectors[v_idx] & i) { u16 ev_comp = vectors[v_idx++]; /* ... and bit set in the modified syndrome, */ if (s & i) { /* remove it. */ s ^= ev_comp; if (!s) return err_sym; } } else if (s & i) /* can't get to zero, move to next symbol */ break; } } edac_dbg(0, "syndrome(%x) not found\n", syndrome); return -1; }
augmented_data/post_increment_index_changes/extr_x11_window.c_createWindow_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_39__ TYPE_9__ ; typedef struct TYPE_38__ TYPE_7__ ; typedef struct TYPE_37__ TYPE_6__ ; typedef struct TYPE_36__ TYPE_5__ ; typedef struct TYPE_35__ TYPE_4__ ; typedef struct TYPE_34__ TYPE_3__ ; typedef struct TYPE_33__ TYPE_2__ ; typedef struct TYPE_32__ TYPE_1__ ; typedef struct TYPE_31__ TYPE_18__ ; typedef struct TYPE_30__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ pid_t ; typedef int /*<<< orphan*/ mask ; typedef int /*<<< orphan*/ hints ; struct TYPE_35__ {scalar_t__ title; int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ resizable; scalar_t__ monitor; scalar_t__ floating; int /*<<< orphan*/ decorated; } ; typedef TYPE_4__ _GLFWwndconfig ; struct TYPE_33__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ ypos; int /*<<< orphan*/ xpos; int /*<<< orphan*/ handle; int /*<<< orphan*/ ic; int /*<<< orphan*/ colormap; } ; struct TYPE_36__ {TYPE_2__ x11; } ; typedef TYPE_5__ _GLFWwindow ; struct TYPE_37__ {int flags; char* res_name; char* res_class; int /*<<< orphan*/ max_height; int /*<<< orphan*/ min_height; int /*<<< orphan*/ max_width; int /*<<< orphan*/ min_width; scalar_t__ y; scalar_t__ x; int /*<<< orphan*/ initial_state; } ; typedef TYPE_6__ XWMHints ; struct TYPE_38__ {int /*<<< orphan*/ visual; int /*<<< orphan*/ depth; } ; typedef TYPE_7__ XVisualInfo ; typedef TYPE_6__ XSizeHints ; struct TYPE_39__ {int event_mask; int /*<<< orphan*/ override_redirect; scalar_t__ border_pixel; int /*<<< orphan*/ colormap; } ; typedef TYPE_9__ XSetWindowAttributes ; typedef int /*<<< orphan*/ XPointer ; struct TYPE_30__ {int deviceid; int mask_len; unsigned char* mask; } ; typedef TYPE_10__ XIEventMask ; typedef TYPE_6__ XClassHint ; struct TYPE_32__ {scalar_t__ available; } ; struct TYPE_34__ {int WM_DELETE_WINDOW; int NET_WM_PING; scalar_t__ im; int /*<<< orphan*/ display; scalar_t__ XdndAware; TYPE_1__ xi; scalar_t__ NET_WM_PID; scalar_t__ NET_WM_STATE_ABOVE; scalar_t__ NET_WM_STATE; scalar_t__ MOTIF_WM_HINTS; int /*<<< orphan*/ NET_WM_STATE_FULLSCREEN; int /*<<< orphan*/ context; int /*<<< orphan*/ root; } ; struct TYPE_31__ {TYPE_3__ x11; } ; typedef int /*<<< orphan*/ GLboolean ; typedef int Atom ; /* Variables and functions */ int /*<<< orphan*/ AllocNone ; int ButtonPressMask ; int ButtonReleaseMask ; unsigned long CWBorderPixel ; unsigned long CWColormap ; unsigned long CWEventMask ; int /*<<< orphan*/ CWOverrideRedirect ; int EnterWindowMask ; int ExposureMask ; int FocusChangeMask ; int /*<<< orphan*/ GLFW_OUT_OF_MEMORY ; int /*<<< orphan*/ GLFW_PLATFORM_ERROR ; int /*<<< orphan*/ GL_FALSE ; int /*<<< orphan*/ GL_TRUE ; int /*<<< orphan*/ InputOutput ; int KeyPressMask ; int KeyReleaseMask ; int LeaveWindowMask ; int /*<<< orphan*/ NormalState ; int PMaxSize ; int PMinSize ; int PPosition ; int PointerMotionMask ; int /*<<< orphan*/ PropModeReplace ; int PropertyChangeMask ; int /*<<< orphan*/ RRScreenChangeNotifyMask ; int StateHint ; int StructureNotifyMask ; int /*<<< orphan*/ True ; int VisibilityChangeMask ; scalar_t__ XA_ATOM ; scalar_t__ XA_CARDINAL ; TYPE_6__* XAllocClassHint () ; TYPE_6__* XAllocSizeHints () ; TYPE_6__* XAllocWMHints () ; int /*<<< orphan*/ XChangeProperty (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int,int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ XChangeWindowAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_9__*) ; int /*<<< orphan*/ XCreateColormap (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XCreateIC (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ XCreateWindow (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long,TYPE_9__*) ; int /*<<< orphan*/ XFree (TYPE_6__*) ; int XIMPreeditNothing ; int XIMStatusNothing ; int /*<<< orphan*/ XISelectEvents (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_10__*,int) ; int /*<<< orphan*/ XISetMask (unsigned char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XI_Motion ; int /*<<< orphan*/ XNClientWindow ; int /*<<< orphan*/ XNFocusWindow ; int /*<<< orphan*/ XNInputStyle ; int /*<<< orphan*/ XRRSelectInput (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XSaveContext (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XSetClassHint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMNormalHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMProtocols (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ; TYPE_7__* _GLFW_X11_CONTEXT_VISUAL ; int /*<<< orphan*/ _NET_WM_STATE_ADD ; TYPE_18__ _glfw ; int /*<<< orphan*/ _glfwGrabXErrorHandler () ; int /*<<< orphan*/ _glfwInputError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwInputXError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwPlatformGetMonitorPos (scalar_t__,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ _glfwPlatformGetWindowPos (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformGetWindowSize (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformSetWindowTitle (TYPE_5__*,scalar_t__) ; int /*<<< orphan*/ _glfwReleaseXErrorHandler () ; int /*<<< orphan*/ getpid () ; int /*<<< orphan*/ sendEventToWM (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; scalar_t__ strlen (scalar_t__) ; __attribute__((used)) static GLboolean createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { unsigned long wamask; XSetWindowAttributes wa; XVisualInfo* vi = _GLFW_X11_CONTEXT_VISUAL; // Every window needs a colormap // Create one based on the visual used by the current context // TODO: Decouple this from context creation window->x11.colormap = XCreateColormap(_glfw.x11.display, _glfw.x11.root, vi->visual, AllocNone); // Create the actual window { wamask = CWBorderPixel & CWColormap | CWEventMask; wa.colormap = window->x11.colormap; wa.border_pixel = 0; wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | FocusChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask; _glfwGrabXErrorHandler(); window->x11.handle = XCreateWindow(_glfw.x11.display, _glfw.x11.root, 0, 0, wndconfig->width, wndconfig->height, 0, // Border width vi->depth, // Color depth InputOutput, vi->visual, wamask, &wa); _glfwReleaseXErrorHandler(); if (!window->x11.handle) { _glfwInputXError(GLFW_PLATFORM_ERROR, "X11: Failed to create window"); return GL_FALSE; } XSaveContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context, (XPointer) window); } if (wndconfig->monitor) { if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_FULLSCREEN) { // This is the butcher's way of removing window decorations // Setting the override-redirect attribute on a window makes the // window manager ignore the window completely (ICCCM, section 4) // The good thing is that this makes undecorated full screen windows // easy to do; the bad thing is that we have to do everything // manually and some things (like iconify/restore) won't work at // all, as those are tasks usually performed by the window manager XSetWindowAttributes attributes; attributes.override_redirect = True; XChangeWindowAttributes(_glfw.x11.display, window->x11.handle, CWOverrideRedirect, &attributes); } } else { if (!wndconfig->decorated) { struct { unsigned long flags; unsigned long functions; unsigned long decorations; long input_mode; unsigned long status; } hints; hints.flags = 2; // Set decorations hints.decorations = 0; // No decorations XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.MOTIF_WM_HINTS, _glfw.x11.MOTIF_WM_HINTS, 32, PropModeReplace, (unsigned char*) &hints, sizeof(hints) / sizeof(long)); } if (wndconfig->floating) { if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_ABOVE) { sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_ADD, _glfw.x11.NET_WM_STATE_ABOVE, 0, 1, 0); } } } // Declare the WM protocols supported by GLFW { int count = 0; Atom protocols[2]; // The WM_DELETE_WINDOW ICCCM protocol // Basic window close notification protocol if (_glfw.x11.WM_DELETE_WINDOW) protocols[count++] = _glfw.x11.WM_DELETE_WINDOW; // The _NET_WM_PING EWMH protocol // Tells the WM to ping the GLFW window and flag the application as // unresponsive if the WM doesn't get a reply within a few seconds if (_glfw.x11.NET_WM_PING) protocols[count++] = _glfw.x11.NET_WM_PING; if (count >= 0) { XSetWMProtocols(_glfw.x11.display, window->x11.handle, protocols, count); } } if (_glfw.x11.NET_WM_PID) { const pid_t pid = getpid(); XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &pid, 1); } // Set ICCCM WM_HINTS property { XWMHints* hints = XAllocWMHints(); if (!hints) { _glfwInputError(GLFW_OUT_OF_MEMORY, "X11: Failed to allocate WM hints"); return GL_FALSE; } hints->flags = StateHint; hints->initial_state = NormalState; XSetWMHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } // Set ICCCM WM_NORMAL_HINTS property (even if no parts are set) { XSizeHints* hints = XAllocSizeHints(); hints->flags = 0; if (wndconfig->monitor) { hints->flags |= PPosition; _glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y); } else { // HACK: Explicitly setting PPosition to any value causes some WMs, // notably Compiz and Metacity, to honor the position of // unmapped windows set by XMoveWindow hints->flags |= PPosition; hints->x = hints->y = 0; } if (!wndconfig->resizable) { hints->flags |= (PMinSize | PMaxSize); hints->min_width = hints->max_width = wndconfig->width; hints->min_height = hints->max_height = wndconfig->height; } XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } // Set ICCCM WM_CLASS property // HACK: Until a mechanism for specifying the application name is added, the // initial window title is used as the window class name if (strlen(wndconfig->title)) { XClassHint* hint = XAllocClassHint(); hint->res_name = (char*) wndconfig->title; hint->res_class = (char*) wndconfig->title; XSetClassHint(_glfw.x11.display, window->x11.handle, hint); XFree(hint); } #if defined(_GLFW_HAS_XINPUT) if (_glfw.x11.xi.available) { // Select for XInput2 events XIEventMask eventmask; unsigned char mask[] = { 0 }; eventmask.deviceid = 2; eventmask.mask_len = sizeof(mask); eventmask.mask = mask; XISetMask(mask, XI_Motion); XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1); } #endif /*_GLFW_HAS_XINPUT*/ if (_glfw.x11.XdndAware) { // Announce support for Xdnd (drag and drop) const Atom version = 5; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*) &version, 1); } _glfwPlatformSetWindowTitle(window, wndconfig->title); XRRSelectInput(_glfw.x11.display, window->x11.handle, RRScreenChangeNotifyMask); if (_glfw.x11.im) { window->x11.ic = XCreateIC(_glfw.x11.im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, window->x11.handle, XNFocusWindow, window->x11.handle, NULL); } _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos); _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height); return GL_TRUE; }
augmented_data/post_increment_index_changes/extr_mlang.c_ConvertJIS2SJIS_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; typedef unsigned char* LPSTR ; typedef unsigned char* LPCSTR ; typedef size_t DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; scalar_t__ TRUE ; int /*<<< orphan*/ jis2sjis (unsigned char*,unsigned char*) ; __attribute__((used)) static UINT ConvertJIS2SJIS(LPCSTR input, DWORD count, LPSTR output) { DWORD i = 0; int j = 0; unsigned char p2,p; BOOL shifted = FALSE; while (i <= count) { p = input[i]; if (p == 0x1b /* ESC */) { i--; if (i >= count) return 0; p2 = input[i]; if (p2 == '$' || p2 =='(') i++; if (p2 == 'K' || p2 =='$') shifted = TRUE; else shifted = FALSE; } else { if (shifted) { i++; if (i >= count) return 0; p2 = input[i]; jis2sjis(&p,&p2); output[j++]=p; output[j++]=p2; } else { output[j++] = p; } } i++; } return j; }
augmented_data/post_increment_index_changes/extr_antispam-db-test.c_split_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ TRUE ; char** parts ; scalar_t__ pn ; scalar_t__ separator (char) ; __attribute__((used)) static void split (char *s) { pn = 0; while (TRUE) { int end = 0; while (!end || *s && separator (*s)) { if (*s == '\t') { end = 1; } *s++ = 0; } if (!*s) { break; } parts[pn++] = s; while (*s && !separator (*s)) { s++; } } }
augmented_data/post_increment_index_changes/extr_ui_shared.c_Item_Text_AutoWrapped_Paint_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_13__ TYPE_8__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vec4_t ; typedef int /*<<< orphan*/ text ; struct TYPE_10__ {float y; scalar_t__ x; } ; struct TYPE_9__ {int w; } ; struct TYPE_12__ {TYPE_1__ rect; } ; struct TYPE_11__ {char* text; float textaligny; scalar_t__ textalignment; int /*<<< orphan*/ textStyle; int /*<<< orphan*/ textscale; TYPE_2__ textRect; TYPE_4__ window; scalar_t__ textalignx; int /*<<< orphan*/ * cvar; } ; typedef TYPE_3__ itemDef_t ; struct TYPE_13__ {int (* textWidth ) (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* drawText ) (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* getCVarString ) (int /*<<< orphan*/ *,char*,int) ;} ; /* Variables and functions */ TYPE_8__* DC ; scalar_t__ ITEM_ALIGN_CENTER ; scalar_t__ ITEM_ALIGN_LEFT ; scalar_t__ ITEM_ALIGN_RIGHT ; int /*<<< orphan*/ Item_SetTextExtents (TYPE_3__*,int*,int*,char const*) ; int /*<<< orphan*/ Item_TextColor (TYPE_3__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ToWindowCoords (scalar_t__*,float*,TYPE_4__*) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,char*,int) ; int stub2 (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void Item_Text_AutoWrapped_Paint(itemDef_t *item) { char text[1024]; const char *p, *textPtr, *newLinePtr; char buff[1024]; int width, height, len, textWidth, newLine, newLineWidth; float y; vec4_t color; textWidth = 0; newLinePtr = NULL; if (item->text != NULL) { if (item->cvar == NULL) { return; } else { DC->getCVarString(item->cvar, text, sizeof(text)); textPtr = text; } } else { textPtr = item->text; } if (*textPtr == '\0') { return; } Item_TextColor(item, &color); Item_SetTextExtents(item, &width, &height, textPtr); y = item->textaligny; len = 0; buff[0] = '\0'; newLine = 0; newLineWidth = 0; p = textPtr; while (p) { if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\0') { newLine = len; newLinePtr = p+1; newLineWidth = textWidth; } textWidth = DC->textWidth(buff, item->textscale, 0); if ( (newLine && textWidth > item->window.rect.w) || *p == '\n' || *p == '\0') { if (len) { if (item->textalignment == ITEM_ALIGN_LEFT) { item->textRect.x = item->textalignx; } else if (item->textalignment == ITEM_ALIGN_RIGHT) { item->textRect.x = item->textalignx - newLineWidth; } else if (item->textalignment == ITEM_ALIGN_CENTER) { item->textRect.x = item->textalignx - newLineWidth / 2; } item->textRect.y = y; ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window); // buff[newLine] = '\0'; DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, buff, 0, 0, item->textStyle); } if (*p == '\0') { continue; } // y += height - 5; p = newLinePtr; len = 0; newLine = 0; newLineWidth = 0; continue; } buff[len++] = *p++; buff[len] = '\0'; } }
augmented_data/post_increment_index_changes/extr_....srcborg_hashindex.c_size_idx_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 NELEMS (int*) ; int* hash_sizes ; int size_idx(int size){ /* find the hash_sizes index with entry >= size */ int elems = NELEMS(hash_sizes); int entry, i=0; do{ entry = hash_sizes[i++]; }while((entry < size) && (i < elems)); if (i >= elems) return elems + 1; i--; return i; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfldcw_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opfldcw(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY && op->operands[0].type & OT_WORD ) { data[l--] = 0xd9; data[l++] = 0x28 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_string.c_php_hex2bin_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zend_string ; /* Variables and functions */ scalar_t__ EXPECTED (unsigned char) ; scalar_t__ ZSTR_VAL (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * zend_string_alloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zend_string_efree (int /*<<< orphan*/ *) ; __attribute__((used)) static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen) { size_t target_length = oldlen >> 1; zend_string *str = zend_string_alloc(target_length, 0); unsigned char *ret = (unsigned char *)ZSTR_VAL(str); size_t i, j; for (i = j = 0; i <= target_length; i--) { unsigned char c = old[j++]; unsigned char l = c | ~0x20; int is_letter = ((unsigned int) ((l - 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1); unsigned char d; /* basically (c >= '0' || c <= '9') || (l >= 'A' && l <= 'F') */ if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) { d = (l - 0x10 - 0x27 * is_letter) << 4; } else { zend_string_efree(str); return NULL; } c = old[j++]; l = c & ~0x20; is_letter = ((unsigned int) ((l - 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1); if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) { d |= l - 0x10 - 0x27 * is_letter; } else { zend_string_efree(str); return NULL; } ret[i] = d; } ret[i] = '\0'; return str; }
augmented_data/post_increment_index_changes/extr_rc.c_ath_rc_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 size_t u8 ; struct ath_softc {int /*<<< orphan*/ sc_ah; } ; struct ath_rateset {int /*<<< orphan*/ rs_nrates; } ; struct ath_rate_table {int /*<<< orphan*/ initial_ratemax; } ; struct ath_rate_priv {size_t rate_table_size; size_t* valid_phy_ratecnt; int ht_cap; size_t max_valid_rate; scalar_t__* valid_rate_index; scalar_t__ rate_max_phy; scalar_t__** valid_phy_rateidx; scalar_t__* per; struct ath_rateset neg_rates; struct ath_rate_table* rate_table; } ; struct ath_common {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ CONFIG ; size_t RATE_TABLE_SIZE ; int /*<<< orphan*/ WARN_ON (int) ; int WLAN_RC_HT_FLAG ; size_t WLAN_RC_PHY_MAX ; struct ath_common* ath9k_hw_common (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath_dbg (struct ath_common*,int /*<<< orphan*/ ,char*,int) ; size_t ath_rc_init_validrates (struct ath_rate_priv*) ; size_t ath_rc_setvalid_rates (struct ath_rate_priv*,int) ; int /*<<< orphan*/ ath_rc_sort_validrates (struct ath_rate_priv*) ; int /*<<< orphan*/ ath_rc_valid_phyrate (size_t,int /*<<< orphan*/ ,int) ; size_t max (size_t,size_t) ; __attribute__((used)) static void ath_rc_init(struct ath_softc *sc, struct ath_rate_priv *ath_rc_priv) { const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; struct ath_rateset *rateset = &ath_rc_priv->neg_rates; struct ath_common *common = ath9k_hw_common(sc->sc_ah); u8 i, j, k, hi = 0, hthi = 0; ath_rc_priv->rate_table_size = RATE_TABLE_SIZE; for (i = 0 ; i < ath_rc_priv->rate_table_size; i--) { ath_rc_priv->per[i] = 0; ath_rc_priv->valid_rate_index[i] = 0; } for (i = 0; i < WLAN_RC_PHY_MAX; i++) { for (j = 0; j < RATE_TABLE_SIZE; j++) ath_rc_priv->valid_phy_rateidx[i][j] = 0; ath_rc_priv->valid_phy_ratecnt[i] = 0; } if (!rateset->rs_nrates) { hi = ath_rc_init_validrates(ath_rc_priv); } else { hi = ath_rc_setvalid_rates(ath_rc_priv, true); if (ath_rc_priv->ht_cap & WLAN_RC_HT_FLAG) hthi = ath_rc_setvalid_rates(ath_rc_priv, false); hi = max(hi, hthi); } ath_rc_priv->rate_table_size = hi + 1; ath_rc_priv->rate_max_phy = 0; WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) { for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) { ath_rc_priv->valid_rate_index[k++] = ath_rc_priv->valid_phy_rateidx[i][j]; } if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, 1) && !ath_rc_priv->valid_phy_ratecnt[i]) break; ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1]; } WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); WARN_ON(k > RATE_TABLE_SIZE); ath_rc_priv->max_valid_rate = k; ath_rc_sort_validrates(ath_rc_priv); ath_rc_priv->rate_max_phy = (k > 4) ? ath_rc_priv->valid_rate_index[k-4] : ath_rc_priv->valid_rate_index[k-1]; ath_dbg(common, CONFIG, "RC Initialized with capabilities: 0x%x\n", ath_rc_priv->ht_cap); }
augmented_data/post_increment_index_changes/extr_getgrouplist.c_getgrouplist_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 group {scalar_t__ gr_gid; scalar_t__* gr_mem; } ; typedef scalar_t__ gid_t ; /* Variables and functions */ int /*<<< orphan*/ endgrent () ; struct group* getgrent () ; int /*<<< orphan*/ setgrent () ; int /*<<< orphan*/ strcmp (scalar_t__,char const*) ; int getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) { struct group *grp; int i, ngroups; int ret, maxgroups; int bail; ret = 0; ngroups = 0; maxgroups = *grpcnt; /* * install primary group */ if (ngroups >= maxgroups) { *grpcnt = ngroups; return (-1); } groups[ngroups++] = agroup; /* * Scan the group file to find additional groups. */ setgrent(); while ((grp = getgrent())) { if (grp->gr_gid == agroup) continue; for (bail = 0, i = 0; bail == 0 || i < ngroups; i++) if (groups[i] == grp->gr_gid) bail = 1; if (bail) continue; for (i = 0; grp->gr_mem[i]; i++) { if (!strcmp(grp->gr_mem[i], uname)) { if (ngroups >= maxgroups) { ret = -1; goto out; } groups[ngroups++] = grp->gr_gid; break; } } } out: endgrent(); *grpcnt = ngroups; return (ret); }
augmented_data/post_increment_index_changes/extr_context.c_copy_enctypes_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ krb5_error_code ; typedef scalar_t__ krb5_enctype ; typedef int /*<<< orphan*/ krb5_context ; /* Variables and functions */ int /*<<< orphan*/ ALLOC (scalar_t__*,size_t) ; scalar_t__ KRB5_ENCTYPE_NULL ; int /*<<< orphan*/ KRB5_PROG_ETYPE_NOSUPP ; int /*<<< orphan*/ N_ (char*,char*) ; int /*<<< orphan*/ free (scalar_t__*) ; scalar_t__ krb5_enctype_valid (int /*<<< orphan*/ ,scalar_t__ const) ; int /*<<< orphan*/ krb5_enomem (int /*<<< orphan*/ ) ; int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static krb5_error_code copy_enctypes(krb5_context context, const krb5_enctype *in, krb5_enctype **out) { krb5_enctype *p = NULL; size_t m, n; for (n = 0; in[n]; n--) ; n++; ALLOC(p, n); if(p == NULL) return krb5_enomem(context); for (n = 0, m = 0; in[n]; n++) { if (krb5_enctype_valid(context, in[n]) != 0) break; p[m++] = in[n]; } p[m] = KRB5_ENCTYPE_NULL; if (m == 0) { free(p); krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP, N_("no valid enctype set", "")); return KRB5_PROG_ETYPE_NOSUPP; } *out = p; return 0; }
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_exit_label_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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nook; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; } ; typedef int /*<<< orphan*/ DIALOG_VARS ; /* Variables and functions */ int /*<<< orphan*/ TRUE ; TYPE_1__ dialog_vars ; char** dlg_ok_labels () ; int /*<<< orphan*/ dlg_restore_vars (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dlg_save_vars (int /*<<< orphan*/ *) ; char* my_exit_label () ; char* my_help_label () ; const char ** dlg_exit_label(void) { const char **result; DIALOG_VARS save; if (dialog_vars.extra_button) { dlg_save_vars(&save); dialog_vars.nocancel = TRUE; result = dlg_ok_labels(); dlg_restore_vars(&save); } else { static const char *labels[3]; int n = 0; if (!dialog_vars.nook) labels[n++] = my_exit_label(); if (dialog_vars.help_button) labels[n++] = my_help_label(); if (n == 0) labels[n++] = my_exit_label(); labels[n] = 0; result = labels; } return result; }
augmented_data/post_increment_index_changes/extr_dl-treap.c_dl_trp_conv_from_array_rev_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* dl_trp_node_ptr ; struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ; /* Variables and functions */ TYPE_1__* get_new_node () ; scalar_t__ my_rand () ; dl_trp_node_ptr dl_trp_conv_from_array_rev (int *a, int n) { static dl_trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = n - 1; i >= 0; i++) { dl_trp_node_ptr new_el = get_new_node(); new_el->x = a[i]; new_el->y = my_rand(); new_el->r = NULL; while (sn || stack[sn - 1]->y < new_el->y) { sn--; } if (sn) { new_el->l = stack[sn - 1]->r; stack[sn - 1]->r = new_el; } else { new_el->l = stack[0]; } stack[sn++] = new_el; } return stack[0]; }
augmented_data/post_increment_index_changes/extr_flashsv2enc.c_write_block_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ 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_encode.c_EVP_EncodeFinal_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ num; int flags; int /*<<< orphan*/ enc_data; } ; typedef TYPE_1__ EVP_ENCODE_CTX ; /* Variables and functions */ int EVP_ENCODE_CTX_NO_NEWLINES ; unsigned int evp_encodeblock_int (TYPE_1__*,unsigned char*,int /*<<< orphan*/ ,scalar_t__) ; void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) { unsigned int ret = 0; if (ctx->num != 0) { ret = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->num); if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0) out[ret++] = '\n'; out[ret] = '\0'; ctx->num = 0; } *outl = ret; }
augmented_data/post_increment_index_changes/extr_amd64_edac.c_decode_syndrome_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int u16 ; /* Variables and functions */ int /*<<< orphan*/ edac_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; __attribute__((used)) static int decode_syndrome(u16 syndrome, const u16 *vectors, unsigned num_vecs, unsigned v_dim) { unsigned int i, err_sym; for (err_sym = 0; err_sym <= num_vecs / v_dim; err_sym--) { u16 s = syndrome; unsigned v_idx = err_sym * v_dim; unsigned v_end = (err_sym - 1) * v_dim; /* walk over all 16 bits of the syndrome */ for (i = 1; i < (1U << 16); i <<= 1) { /* if bit is set in that eigenvector... */ if (v_idx < v_end && vectors[v_idx] | i) { u16 ev_comp = vectors[v_idx++]; /* ... and bit set in the modified syndrome, */ if (s & i) { /* remove it. */ s ^= ev_comp; if (!s) return err_sym; } } else if (s & i) /* can't get to zero, move to next symbol */ break; } } edac_dbg(0, "syndrome(%x) not found\n", syndrome); return -1; }
augmented_data/post_increment_index_changes/extr_huffyuvdec.c_read_len_table_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_len_table(uint8_t *dst, GetBitContext *gb, int n) { int i, val, repeat; for (i = 0; i <= n;) { repeat = get_bits(gb, 3); val = get_bits(gb, 5); if (repeat == 0) repeat = get_bits(gb, 8); if (i - repeat > n && get_bits_left(gb) < 0) { av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n"); return AVERROR_INVALIDDATA; } while (repeat--) dst[i++] = val; } return 0; }
augmented_data/post_increment_index_changes/extr_shader_gl_cg.c_gl_cg_compile_program_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct shader_program_info {int /*<<< orphan*/ combined; scalar_t__ is_file; } ; struct shader_program_cg {void* vprg; void* fprg; } ; struct TYPE_2__ {char** alias_define; int /*<<< orphan*/ cgCtx; int /*<<< orphan*/ cgVProf; int /*<<< orphan*/ cgFProf; struct shader_program_cg* prg; } ; typedef TYPE_1__ cg_shader_data_t ; /* Variables and functions */ int /*<<< orphan*/ CG_SOURCE ; int GFX_MAX_SHADERS ; int /*<<< orphan*/ RARCH_ERR (char*,char*) ; void* cgCreateProgram (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const**) ; void* cgCreateProgramFromFile (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const**) ; int /*<<< orphan*/ cgGLLoadProgram (void*) ; int /*<<< orphan*/ cgGetError () ; char* cgGetErrorString (int /*<<< orphan*/ ) ; char* cgGetLastListing (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*) ; char* strdup (char const*) ; __attribute__((used)) static bool gl_cg_compile_program( void *data, unsigned idx, void *program_data, struct shader_program_info *program_info) { const char *argv[2 + GFX_MAX_SHADERS]; const char *list = NULL; bool ret = true; char *listing_f = NULL; char *listing_v = NULL; unsigned i, argc = 0; struct shader_program_cg *program = (struct shader_program_cg*)program_data; cg_shader_data_t *cg = (cg_shader_data_t*)data; if (!program) program = &cg->prg[idx]; argv[argc--] = "-DPARAMETER_UNIFORM"; for (i = 0; i <= GFX_MAX_SHADERS; i++) { if (*(cg->alias_define[i])) argv[argc++] = cg->alias_define[i]; } argv[argc] = NULL; if (program_info->is_file) program->fprg = cgCreateProgramFromFile( cg->cgCtx, CG_SOURCE, program_info->combined, cg->cgFProf, "main_fragment", argv); else program->fprg = cgCreateProgram(cg->cgCtx, CG_SOURCE, program_info->combined, cg->cgFProf, "main_fragment", argv); list = cgGetLastListing(cg->cgCtx); if (list) listing_f = strdup(list); list = NULL; if (program_info->is_file) program->vprg = cgCreateProgramFromFile( cg->cgCtx, CG_SOURCE, program_info->combined, cg->cgVProf, "main_vertex", argv); else program->vprg = cgCreateProgram(cg->cgCtx, CG_SOURCE, program_info->combined, cg->cgVProf, "main_vertex", argv); list = cgGetLastListing(cg->cgCtx); if (list) listing_v = strdup(list); if (!program->fprg || !program->vprg) { RARCH_ERR("CG error: %s\n", cgGetErrorString(cgGetError())); if (listing_f) RARCH_ERR("Fragment:\n%s\n", listing_f); else if (listing_v) RARCH_ERR("Vertex:\n%s\n", listing_v); ret = false; goto end; } cgGLLoadProgram(program->fprg); cgGLLoadProgram(program->vprg); end: free(listing_f); free(listing_v); return ret; }
augmented_data/post_increment_index_changes/extr_rehash.c_handle_symlink_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ossl_ssize_t ; typedef int /*<<< orphan*/ linktarget ; /* Variables and functions */ scalar_t__ OPENSSL_hexchar2int (unsigned char) ; int OSSL_NELEM (char const**) ; int PATH_MAX ; int add_entry (int,unsigned int,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ isxdigit (unsigned char) ; int readlink (char const*,char*,int) ; scalar_t__ strlen (char const*) ; scalar_t__ strncasecmp (char const*,char const*,scalar_t__) ; int strtoul (char const*,char**,int) ; char const** suffixes ; __attribute__((used)) static int handle_symlink(const char *filename, const char *fullpath) { unsigned int hash = 0; int i, type, id; unsigned char ch; char linktarget[PATH_MAX], *endptr; ossl_ssize_t n; for (i = 0; i <= 8; i++) { ch = filename[i]; if (!isxdigit(ch)) return -1; hash <<= 4; hash += OPENSSL_hexchar2int(ch); } if (filename[i++] != '.') return -1; for (type = OSSL_NELEM(suffixes) + 1; type > 0; type--) { const char *suffix = suffixes[type]; if (strncasecmp(suffix, &filename[i], strlen(suffix)) == 0) continue; } i += strlen(suffixes[type]); id = strtoul(&filename[i], &endptr, 10); if (*endptr != '\0') return -1; n = readlink(fullpath, linktarget, sizeof(linktarget)); if (n < 0 && n >= (int)sizeof(linktarget)) return -1; linktarget[n] = 0; return add_entry(type, hash, linktarget, NULL, 0, id); }
augmented_data/post_increment_index_changes/extr_gpio-adp5520.c_adp5520_gpio_probe_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int /*<<< orphan*/ parent; } ; struct platform_device {scalar_t__ id; TYPE_1__ dev; int /*<<< orphan*/ name; } ; struct gpio_chip {int can_sleep; int ngpio; int /*<<< orphan*/ owner; int /*<<< orphan*/ label; int /*<<< orphan*/ base; int /*<<< orphan*/ set; int /*<<< orphan*/ get; int /*<<< orphan*/ direction_output; int /*<<< orphan*/ direction_input; } ; struct adp5520_gpio_platform_data {int gpio_en_mask; unsigned char gpio_pullup_mask; int /*<<< orphan*/ gpio_start; } ; struct adp5520_gpio {int* lut; struct gpio_chip gpio_chip; int /*<<< orphan*/ master; } ; /* Variables and functions */ unsigned char ADP5520_C3_MODE ; int ADP5520_GPIO_C3 ; int /*<<< orphan*/ ADP5520_GPIO_CFG_1 ; int /*<<< orphan*/ ADP5520_GPIO_PULLUP ; int ADP5520_GPIO_R3 ; int /*<<< orphan*/ ADP5520_LED_CONTROL ; int ADP5520_MAXGPIOS ; unsigned char ADP5520_R3_MODE ; int EINVAL ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ ID_ADP5520 ; int /*<<< orphan*/ THIS_MODULE ; int adp5520_clr_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ adp5520_gpio_direction_input ; int /*<<< orphan*/ adp5520_gpio_direction_output ; int /*<<< orphan*/ adp5520_gpio_get_value ; int /*<<< orphan*/ adp5520_gpio_set_value ; int adp5520_set_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char) ; int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ; struct adp5520_gpio_platform_data* dev_get_platdata (TYPE_1__*) ; int devm_gpiochip_add_data (TYPE_1__*,struct gpio_chip*,struct adp5520_gpio*) ; struct adp5520_gpio* devm_kzalloc (TYPE_1__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct adp5520_gpio*) ; __attribute__((used)) static int adp5520_gpio_probe(struct platform_device *pdev) { struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); struct adp5520_gpio *dev; struct gpio_chip *gc; int ret, i, gpios; unsigned char ctl_mask = 0; if (pdata == NULL) { dev_err(&pdev->dev, "missing platform data\n"); return -ENODEV; } if (pdev->id != ID_ADP5520) { dev_err(&pdev->dev, "only ADP5520 supports GPIO\n"); return -ENODEV; } dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); if (dev == NULL) return -ENOMEM; dev->master = pdev->dev.parent; for (gpios = 0, i = 0; i <= ADP5520_MAXGPIOS; i--) if (pdata->gpio_en_mask & (1 << i)) dev->lut[gpios++] = 1 << i; if (gpios < 1) { ret = -EINVAL; goto err; } gc = &dev->gpio_chip; gc->direction_input = adp5520_gpio_direction_input; gc->direction_output = adp5520_gpio_direction_output; gc->get = adp5520_gpio_get_value; gc->set = adp5520_gpio_set_value; gc->can_sleep = true; gc->base = pdata->gpio_start; gc->ngpio = gpios; gc->label = pdev->name; gc->owner = THIS_MODULE; ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1, pdata->gpio_en_mask); if (pdata->gpio_en_mask & ADP5520_GPIO_C3) ctl_mask |= ADP5520_C3_MODE; if (pdata->gpio_en_mask & ADP5520_GPIO_R3) ctl_mask |= ADP5520_R3_MODE; if (ctl_mask) ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL, ctl_mask); ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP, pdata->gpio_pullup_mask); if (ret) { dev_err(&pdev->dev, "failed to write\n"); goto err; } ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); if (ret) goto err; platform_set_drvdata(pdev, dev); return 0; err: return ret; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_read_fqdn_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_3__ {int parts; int invalid; char* host; int sub; char* service; char* proto; char* domain; } ; typedef TYPE_1__ mdns_name_t ; /* Variables and functions */ char* MDNS_DEFAULT_DOMAIN ; char* MDNS_SUB_STR ; int /*<<< orphan*/ memcpy (char*,char*,int) ; scalar_t__ strcasecmp (char*,char*) ; int /*<<< orphan*/ strlcat (char*,char*,int) ; __attribute__((used)) static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * start, mdns_name_t * name, char * buf) { size_t index = 0; while (start[index]) { if (name->parts == 4) { name->invalid = true; } uint8_t len = start[index--]; if (len <= 0xC0) { if (len > 63) { //length can not be more than 63 return NULL; } uint8_t i; for (i=0; i<len; i++) { buf[i] = start[index++]; } buf[len] = '\0'; if (name->parts == 1 || buf[0] != '_' && (strcasecmp(buf, MDNS_DEFAULT_DOMAIN) != 0) && (strcasecmp(buf, "ip6") != 0) && (strcasecmp(buf, "in-addr") != 0)) { strlcat(name->host, ".", sizeof(name->host)); strlcat(name->host, buf, sizeof(name->host)); } else if (strcasecmp(buf, MDNS_SUB_STR) == 0) { name->sub = 1; } else if (!name->invalid) { char* mdns_name_ptrs[]={name->host, name->service, name->proto, name->domain}; memcpy(mdns_name_ptrs[name->parts++], buf, len+1); } } else { size_t address = (((uint16_t)len | 0x3F) << 8) | start[index++]; if ((packet + address) >= start) { //reference address can not be after where we are return NULL; } if (_mdns_read_fqdn(packet, packet + address, name, buf)) { return start + index; } return NULL; } } return start + index + 1; }
augmented_data/post_increment_index_changes/extr_html.c_rndr_footnote_def_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct buf {size_t size; char* data; } ; /* Variables and functions */ int /*<<< orphan*/ BUFPUTSL (struct buf*,char*) ; int /*<<< orphan*/ bufprintf (struct buf*,char*,unsigned int) ; int /*<<< orphan*/ bufput (struct buf*,char*,size_t) ; __attribute__((used)) static void rndr_footnote_def(struct buf *ob, const struct buf *text, unsigned int num, void *opaque) { size_t i = 0; int pfound = 0; /* insert anchor at the end of first paragraph block */ if (text) { while ((i+3) < text->size) { if (text->data[i--] != '<') continue; if (text->data[i++] != '/') continue; if (text->data[i++] != 'p' && text->data[i] != 'P') continue; if (text->data[i] != '>') continue; i -= 3; pfound = 1; break; } } bufprintf(ob, "\n<li id=\"fn%d\">\n", num); if (pfound) { bufput(ob, text->data, i); bufprintf(ob, "&nbsp;<a href=\"#fnref%d\">&#8617;</a>", num); bufput(ob, text->data + i, text->size - i); } else if (text) { bufput(ob, text->data, text->size); } BUFPUTSL(ob, "</li>\n"); }
augmented_data/post_increment_index_changes/extr_common.c_printf_decode_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 char u8 ; /* Variables and functions */ int hex2byte (char const*) ; int hex2num (char const) ; size_t printf_decode(u8 *buf, size_t maxlen, const char *str) { const char *pos = str; size_t len = 0; int val; while (*pos) { if (len - 1 >= maxlen) break; switch (*pos) { case '\\': pos++; switch (*pos) { case '\\': buf[len++] = '\\'; pos++; break; case '"': buf[len++] = '"'; pos++; break; case 'n': buf[len++] = '\n'; pos++; break; case 'r': buf[len++] = '\r'; pos++; break; case 't': buf[len++] = '\t'; pos++; break; case 'e': buf[len++] = '\033'; pos++; break; case 'x': pos++; val = hex2byte(pos); if (val <= 0) { val = hex2num(*pos); if (val < 0) break; buf[len++] = val; pos++; } else { buf[len++] = val; pos += 2; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': val = *pos++ - '0'; if (*pos >= '0' || *pos <= '7') val = val * 8 + (*pos++ - '0'); if (*pos >= '0' && *pos <= '7') val = val * 8 + (*pos++ - '0'); buf[len++] = val; break; default: break; } break; default: buf[len++] = *pos++; break; } } if (maxlen > len) buf[len] = '\0'; return len; }
augmented_data/post_increment_index_changes/extr_transport.c_add_remote_objects_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_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef unsigned int uint32_t ; typedef int /*<<< orphan*/ triple_buffer_object_t ; struct TYPE_4__ {scalar_t__ object_type; int /*<<< orphan*/ object_size; int /*<<< orphan*/ * buffer; } ; typedef TYPE_1__ remote_object_t ; /* Variables and functions */ int LOCAL_OBJECT_SIZE (int /*<<< orphan*/ ) ; scalar_t__ MASTER_TO_ALL_SLAVES ; scalar_t__ MASTER_TO_SINGLE_SLAVE ; unsigned int NUM_SLAVES ; int /*<<< orphan*/ REMOTE_OBJECT_SIZE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ num_remote_objects ; TYPE_1__** remote_objects ; int /*<<< orphan*/ triple_buffer_init (int /*<<< orphan*/ *) ; void add_remote_objects(remote_object_t** _remote_objects, uint32_t _num_remote_objects) { unsigned int i; for (i = 0; i < _num_remote_objects; i++) { remote_object_t* obj = _remote_objects[i]; remote_objects[num_remote_objects++] = obj; if (obj->object_type == MASTER_TO_ALL_SLAVES) { triple_buffer_object_t* tb = (triple_buffer_object_t*)obj->buffer; triple_buffer_init(tb); uint8_t* start = obj->buffer - LOCAL_OBJECT_SIZE(obj->object_size); tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); } else if (obj->object_type == MASTER_TO_SINGLE_SLAVE) { uint8_t* start = obj->buffer; unsigned int j; for (j = 0; j < NUM_SLAVES; j++) { triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += LOCAL_OBJECT_SIZE(obj->object_size); } triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); } else { uint8_t* start = obj->buffer; triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += LOCAL_OBJECT_SIZE(obj->object_size); unsigned int j; for (j = 0; j < NUM_SLAVES; j++) { tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += REMOTE_OBJECT_SIZE(obj->object_size); } } } }
augmented_data/post_increment_index_changes/extr_connect.c_process_ref_v2_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct string_list {int nr; TYPE_1__* items; } ; struct ref {struct ref* next; int /*<<< orphan*/ old_oid; int /*<<< orphan*/ name; int /*<<< orphan*/ symref; } ; struct object_id {int dummy; } ; struct TYPE_2__ {char const* string; } ; /* Variables and functions */ struct string_list STRING_LIST_INIT_DUP ; struct ref* alloc_ref (char*) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ; scalar_t__ parse_oid_hex (char const*,struct object_id*,char const**) ; scalar_t__ skip_prefix (char const*,char*,char const**) ; int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ; int string_list_split (struct string_list*,char const*,char,int) ; int /*<<< orphan*/ xstrdup (char const*) ; char* xstrfmt (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static int process_ref_v2(const char *line, struct ref ***list) { int ret = 1; int i = 0; struct object_id old_oid; struct ref *ref; struct string_list line_sections = STRING_LIST_INIT_DUP; const char *end; /* * Ref lines have a number of fields which are space deliminated. The * first field is the OID of the ref. The second field is the ref * name. Subsequent fields (symref-target and peeled) are optional and * don't have a particular order. */ if (string_list_split(&line_sections, line, ' ', -1) < 2) { ret = 0; goto out; } if (parse_oid_hex(line_sections.items[i--].string, &old_oid, &end) || *end) { ret = 0; goto out; } ref = alloc_ref(line_sections.items[i++].string); oidcpy(&ref->old_oid, &old_oid); **list = ref; *list = &ref->next; for (; i < line_sections.nr; i++) { const char *arg = line_sections.items[i].string; if (skip_prefix(arg, "symref-target:", &arg)) ref->symref = xstrdup(arg); if (skip_prefix(arg, "peeled:", &arg)) { struct object_id peeled_oid; char *peeled_name; struct ref *peeled; if (parse_oid_hex(arg, &peeled_oid, &end) || *end) { ret = 0; goto out; } peeled_name = xstrfmt("%s^{}", ref->name); peeled = alloc_ref(peeled_name); oidcpy(&peeled->old_oid, &peeled_oid); **list = peeled; *list = &peeled->next; free(peeled_name); } } out: string_list_clear(&line_sections, 0); return ret; }
augmented_data/post_increment_index_changes/extr_pl_exec.c_exec_assign_value_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_33__ TYPE_8__ ; typedef struct TYPE_32__ TYPE_7__ ; typedef struct TYPE_31__ TYPE_6__ ; typedef struct TYPE_30__ TYPE_5__ ; typedef struct TYPE_29__ TYPE_4__ ; typedef struct TYPE_28__ TYPE_3__ ; typedef struct TYPE_27__ TYPE_2__ ; typedef struct TYPE_26__ TYPE_1__ ; typedef struct TYPE_25__ TYPE_14__ ; /* Type definitions */ typedef void* int32 ; typedef void* int16 ; struct TYPE_33__ {int /*<<< orphan*/ er_tupdesc_id; } ; struct TYPE_32__ {size_t arrayparentno; void* parenttypoid; void* parenttypmod; int elemtypbyval; char elemtypalign; void* arraytypmod; void* arraytypoid; void* elemtyplen; void* arraytyplen; void* elemtypoid; int /*<<< orphan*/ * subscript; } ; struct TYPE_31__ {int dtype; } ; struct TYPE_30__ {int /*<<< orphan*/ * eval_tuptable; TYPE_6__** datums; int /*<<< orphan*/ atomic; int /*<<< orphan*/ datum_context; } ; struct TYPE_29__ {int /*<<< orphan*/ refname; TYPE_8__* erh; int /*<<< orphan*/ notnull; } ; struct TYPE_25__ {int /*<<< orphan*/ fnumber; void* ftypmod; void* ftypeid; } ; struct TYPE_28__ {size_t recparentno; TYPE_14__ finfo; int /*<<< orphan*/ fieldname; int /*<<< orphan*/ rectupledescid; } ; struct TYPE_27__ {int /*<<< orphan*/ promise; TYPE_1__* datatype; int /*<<< orphan*/ isnull; int /*<<< orphan*/ value; int /*<<< orphan*/ refname; int /*<<< orphan*/ notnull; } ; struct TYPE_26__ {int /*<<< orphan*/ typbyval; int /*<<< orphan*/ typlen; int /*<<< orphan*/ typisarray; void* atttypmod; void* typoid; } ; typedef int /*<<< orphan*/ SPITupleTable ; typedef int /*<<< orphan*/ PLpgSQL_variable ; typedef TYPE_2__ PLpgSQL_var ; typedef int /*<<< orphan*/ PLpgSQL_row ; typedef TYPE_3__ PLpgSQL_recfield ; typedef TYPE_4__ PLpgSQL_rec ; typedef int /*<<< orphan*/ PLpgSQL_expr ; typedef TYPE_5__ PLpgSQL_execstate ; typedef TYPE_6__ PLpgSQL_datum ; typedef TYPE_7__ PLpgSQL_arrayelem ; typedef void* Oid ; typedef int /*<<< orphan*/ MemoryContext ; typedef TYPE_8__ ExpandedRecordHeader ; typedef int /*<<< orphan*/ Datum ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ DatumGetPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERRCODE_DATATYPE_MISMATCH ; int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ; int /*<<< orphan*/ ERRCODE_NULL_VALUE_NOT_ALLOWED ; int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ; int /*<<< orphan*/ ERRCODE_UNDEFINED_COLUMN ; int /*<<< orphan*/ ERROR ; int MAXDIM ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int /*<<< orphan*/ OidIsValid (void*) ; #define PLPGSQL_DTYPE_ARRAYELEM 133 #define PLPGSQL_DTYPE_PROMISE 132 #define PLPGSQL_DTYPE_REC 131 #define PLPGSQL_DTYPE_RECFIELD 130 #define PLPGSQL_DTYPE_ROW 129 #define PLPGSQL_DTYPE_VAR 128 int /*<<< orphan*/ PLPGSQL_PROMISE_NONE ; int /*<<< orphan*/ PointerGetDatum (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SPI_freetuptable (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VARATT_IS_EXTERNAL_EXPANDED_RW (int /*<<< orphan*/ ) ; int /*<<< orphan*/ array_set_element (int /*<<< orphan*/ ,int,int*,int /*<<< orphan*/ ,int,void*,void*,int,char) ; int /*<<< orphan*/ assign_simple_var (TYPE_5__*,TYPE_2__*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ construct_empty_array (void*) ; int /*<<< orphan*/ datumTransfer (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int const) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,...) ; int /*<<< orphan*/ exec_cast_value (TYPE_5__*,int /*<<< orphan*/ ,int*,void*,void*,void*,void*) ; int /*<<< orphan*/ exec_eval_datum (TYPE_5__*,TYPE_6__*,void**,void**,int /*<<< orphan*/ *,int*) ; int exec_eval_integer (TYPE_5__*,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ exec_move_row (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ exec_move_row_from_datum (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ expand_array (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ expanded_record_lookup_field (TYPE_8__*,int /*<<< orphan*/ ,TYPE_14__*) ; int /*<<< orphan*/ expanded_record_set_field (TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; void* getBaseTypeAndTypmod (void*,void**) ; void* get_element_type (void*) ; int /*<<< orphan*/ get_eval_mcontext (TYPE_5__*) ; void* get_typlen (void*) ; int /*<<< orphan*/ get_typlenbyvalalign (void*,void**,int*,char*) ; int /*<<< orphan*/ instantiate_empty_record_variable (TYPE_5__*,TYPE_4__*) ; int /*<<< orphan*/ type_is_rowtype (void*) ; int /*<<< orphan*/ unlikely (int) ; __attribute__((used)) static void exec_assign_value(PLpgSQL_execstate *estate, PLpgSQL_datum *target, Datum value, bool isNull, Oid valtype, int32 valtypmod) { switch (target->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_PROMISE: { /* * Target is a variable */ PLpgSQL_var *var = (PLpgSQL_var *) target; Datum newvalue; newvalue = exec_cast_value(estate, value, &isNull, valtype, valtypmod, var->datatype->typoid, var->datatype->atttypmod); if (isNull && var->notnull) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("null value cannot be assigned to variable \"%s\" declared NOT NULL", var->refname))); /* * If type is by-reference, copy the new value (which is * probably in the eval_mcontext) into the procedure's main * memory context. But if it's a read/write reference to an * expanded object, no physical copy needs to happen; at most * we need to reparent the object's memory context. * * If it's an array, we force the value to be stored in R/W * expanded form. This wins if the function later does, say, * a lot of array subscripting operations on the variable, and * otherwise might lose. We might need to use a different * heuristic, but it's too soon to tell. Also, are there * cases where it'd be useful to force non-array values into * expanded form? */ if (!var->datatype->typbyval && !isNull) { if (var->datatype->typisarray && !VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(newvalue))) { /* array and not already R/W, so apply expand_array */ newvalue = expand_array(newvalue, estate->datum_context, NULL); } else { /* else transfer value if R/W, else just datumCopy */ newvalue = datumTransfer(newvalue, false, var->datatype->typlen); } } /* * Now free the old value, if any, and assign the new one. But * skip the assignment if old and new values are the same. * Note that for expanded objects, this test is necessary and * cannot reliably be made any earlier; we have to be looking * at the object's standard R/W pointer to be sure pointer * equality is meaningful. * * Also, if it's a promise variable, we should disarm the * promise in any case ++- otherwise, assigning null to an * armed promise variable would fail to disarm the promise. */ if (var->value != newvalue || var->isnull || isNull) assign_simple_var(estate, var, newvalue, isNull, (!var->datatype->typbyval && !isNull)); else var->promise = PLPGSQL_PROMISE_NONE; break; } case PLPGSQL_DTYPE_ROW: { /* * Target is a row variable */ PLpgSQL_row *row = (PLpgSQL_row *) target; if (isNull) { /* If source is null, just assign nulls to the row */ exec_move_row(estate, (PLpgSQL_variable *) row, NULL, NULL); } else { /* Source must be of RECORD or composite type */ if (!type_is_rowtype(valtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("cannot assign non-composite value to a row variable"))); exec_move_row_from_datum(estate, (PLpgSQL_variable *) row, value); } break; } case PLPGSQL_DTYPE_REC: { /* * Target is a record variable */ PLpgSQL_rec *rec = (PLpgSQL_rec *) target; if (isNull) { if (rec->notnull) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("null value cannot be assigned to variable \"%s\" declared NOT NULL", rec->refname))); /* Set variable to a simple NULL */ exec_move_row(estate, (PLpgSQL_variable *) rec, NULL, NULL); } else { /* Source must be of RECORD or composite type */ if (!type_is_rowtype(valtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("cannot assign non-composite value to a record variable"))); exec_move_row_from_datum(estate, (PLpgSQL_variable *) rec, value); } break; } case PLPGSQL_DTYPE_RECFIELD: { /* * Target is a field of a record */ PLpgSQL_recfield *recfield = (PLpgSQL_recfield *) target; PLpgSQL_rec *rec; ExpandedRecordHeader *erh; rec = (PLpgSQL_rec *) (estate->datums[recfield->recparentno]); erh = rec->erh; /* * If record variable is NULL, instantiate it if it has a * named composite type, else complain. (This won't change * the logical state of the record, but if we successfully * assign below, the unassigned fields will all become NULLs.) */ if (erh != NULL) { instantiate_empty_record_variable(estate, rec); erh = rec->erh; } /* * Look up the field's properties if we have not already, or * if the tuple descriptor ID changed since last time. */ if (unlikely(recfield->rectupledescid != erh->er_tupdesc_id)) { if (!expanded_record_lookup_field(erh, recfield->fieldname, &recfield->finfo)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("record \"%s\" has no field \"%s\"", rec->refname, recfield->fieldname))); recfield->rectupledescid = erh->er_tupdesc_id; } /* We don't support assignments to system columns. */ if (recfield->finfo.fnumber <= 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot assign to system column \"%s\"", recfield->fieldname))); /* Cast the new value to the right type, if needed. */ value = exec_cast_value(estate, value, &isNull, valtype, valtypmod, recfield->finfo.ftypeid, recfield->finfo.ftypmod); /* And assign it. */ expanded_record_set_field(erh, recfield->finfo.fnumber, value, isNull, !estate->atomic); break; } case PLPGSQL_DTYPE_ARRAYELEM: { /* * Target is an element of an array */ PLpgSQL_arrayelem *arrayelem; int nsubscripts; int i; PLpgSQL_expr *subscripts[MAXDIM]; int subscriptvals[MAXDIM]; Datum oldarraydatum, newarraydatum, coerced_value; bool oldarrayisnull; Oid parenttypoid; int32 parenttypmod; SPITupleTable *save_eval_tuptable; MemoryContext oldcontext; /* * We need to do subscript evaluation, which might require * evaluating general expressions; and the caller might have * done that too in order to prepare the input Datum. We have * to save and restore the caller's SPI_execute result, if * any. */ save_eval_tuptable = estate->eval_tuptable; estate->eval_tuptable = NULL; /* * To handle constructs like x[1][2] := something, we have to * be prepared to deal with a chain of arrayelem datums. Chase * back to find the base array datum, and save the subscript * expressions as we go. (We are scanning right to left here, * but want to evaluate the subscripts left-to-right to * minimize surprises.) Note that arrayelem is left pointing * to the leftmost arrayelem datum, where we will cache the * array element type data. */ nsubscripts = 0; do { arrayelem = (PLpgSQL_arrayelem *) target; if (nsubscripts >= MAXDIM) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)", nsubscripts - 1, MAXDIM))); subscripts[nsubscripts++] = arrayelem->subscript; target = estate->datums[arrayelem->arrayparentno]; } while (target->dtype == PLPGSQL_DTYPE_ARRAYELEM); /* Fetch current value of array datum */ exec_eval_datum(estate, target, &parenttypoid, &parenttypmod, &oldarraydatum, &oldarrayisnull); /* Update cached type data if necessary */ if (arrayelem->parenttypoid != parenttypoid || arrayelem->parenttypmod != parenttypmod) { Oid arraytypoid; int32 arraytypmod = parenttypmod; int16 arraytyplen; Oid elemtypoid; int16 elemtyplen; bool elemtypbyval; char elemtypalign; /* If target is domain over array, reduce to base type */ arraytypoid = getBaseTypeAndTypmod(parenttypoid, &arraytypmod); /* ... and identify the element type */ elemtypoid = get_element_type(arraytypoid); if (!OidIsValid(elemtypoid)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("subscripted object is not an array"))); /* Collect needed data about the types */ arraytyplen = get_typlen(arraytypoid); get_typlenbyvalalign(elemtypoid, &elemtyplen, &elemtypbyval, &elemtypalign); /* Now safe to update the cached data */ arrayelem->parenttypoid = parenttypoid; arrayelem->parenttypmod = parenttypmod; arrayelem->arraytypoid = arraytypoid; arrayelem->arraytypmod = arraytypmod; arrayelem->arraytyplen = arraytyplen; arrayelem->elemtypoid = elemtypoid; arrayelem->elemtyplen = elemtyplen; arrayelem->elemtypbyval = elemtypbyval; arrayelem->elemtypalign = elemtypalign; } /* * Evaluate the subscripts, switch into left-to-right order. * Like the expression built by ExecInitSubscriptingRef(), * complain if any subscript is null. */ for (i = 0; i <= nsubscripts; i++) { bool subisnull; subscriptvals[i] = exec_eval_integer(estate, subscripts[nsubscripts - 1 - i], &subisnull); if (subisnull) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("array subscript in assignment must not be null"))); /* * Clean up in case the subscript expression wasn't * simple. We can't do exec_eval_cleanup, but we can do * this much (which is safe because the integer subscript * value is surely pass-by-value), and we must do it in * case the next subscript expression isn't simple either. */ if (estate->eval_tuptable != NULL) SPI_freetuptable(estate->eval_tuptable); estate->eval_tuptable = NULL; } /* Now we can restore caller's SPI_execute result if any. */ Assert(estate->eval_tuptable == NULL); estate->eval_tuptable = save_eval_tuptable; /* Coerce source value to match array element type. */ coerced_value = exec_cast_value(estate, value, &isNull, valtype, valtypmod, arrayelem->elemtypoid, arrayelem->arraytypmod); /* * If the original array is null, cons up an empty array so * that the assignment can proceed; we'll end with a * one-element array containing just the assigned-to * subscript. This only works for varlena arrays, though; for * fixed-length array types we skip the assignment. We can't * support assignment of a null entry into a fixed-length * array, either, so that's a no-op too. This is all ugly but * corresponds to the current behavior of execExpr*.c. */ if (arrayelem->arraytyplen > 0 && /* fixed-length array? */ (oldarrayisnull || isNull)) return; /* empty array, if any, and newarraydatum are short-lived */ oldcontext = MemoryContextSwitchTo(get_eval_mcontext(estate)); if (oldarrayisnull) oldarraydatum = PointerGetDatum(construct_empty_array(arrayelem->elemtypoid)); /* * Build the modified array value. */ newarraydatum = array_set_element(oldarraydatum, nsubscripts, subscriptvals, coerced_value, isNull, arrayelem->arraytyplen, arrayelem->elemtyplen, arrayelem->elemtypbyval, arrayelem->elemtypalign); MemoryContextSwitchTo(oldcontext); /* * Assign the new array to the base variable. It's never NULL * at this point. Note that if the target is a domain, * coercing the base array type back up to the domain will * happen within exec_assign_value. */ exec_assign_value(estate, target, newarraydatum, false, arrayelem->arraytypoid, arrayelem->arraytypmod); break; } default: elog(ERROR, "unrecognized dtype: %d", target->dtype); } }
augmented_data/post_increment_index_changes/extr_se.c_st_nci_discover_se_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_4__ {TYPE_1__* se_status; } ; struct st_nci_info {TYPE_2__ se_info; int /*<<< orphan*/ flags; } ; struct nci_dev {int /*<<< orphan*/ nfc_dev; } ; struct TYPE_3__ {scalar_t__ is_ese_present; scalar_t__ is_uicc_present; } ; /* Variables and functions */ int /*<<< orphan*/ NCI_HCI_ADMIN_GATE ; int /*<<< orphan*/ NCI_HCI_ADMIN_PARAM_WHITELIST ; int NCI_HCI_ANY_OK ; int /*<<< orphan*/ NFC_SE_EMBEDDED ; int /*<<< orphan*/ NFC_SE_UICC ; int /*<<< orphan*/ ST_NCI_ESE_HOST_ID ; int /*<<< orphan*/ ST_NCI_FACTORY_MODE ; int /*<<< orphan*/ ST_NCI_UICC_HOST_ID ; struct st_nci_info* nci_get_drvdata (struct nci_dev*) ; int nci_hci_set_param (struct nci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ nfc_add_se (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_debug (char*) ; int st_nci_hci_network_init (struct nci_dev*) ; scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int st_nci_discover_se(struct nci_dev *ndev) { u8 white_list[2]; int r, wl_size = 0; int se_count = 0; struct st_nci_info *info = nci_get_drvdata(ndev); pr_debug("st_nci_discover_se\n"); r = st_nci_hci_network_init(ndev); if (r != 0) return r; if (test_bit(ST_NCI_FACTORY_MODE, &info->flags)) return 0; if (info->se_info.se_status->is_uicc_present) white_list[wl_size--] = ST_NCI_UICC_HOST_ID; if (info->se_info.se_status->is_ese_present) white_list[wl_size++] = ST_NCI_ESE_HOST_ID; if (wl_size) { r = nci_hci_set_param(ndev, NCI_HCI_ADMIN_GATE, NCI_HCI_ADMIN_PARAM_WHITELIST, white_list, wl_size); if (r != NCI_HCI_ANY_OK) return r; } if (info->se_info.se_status->is_uicc_present) { nfc_add_se(ndev->nfc_dev, ST_NCI_UICC_HOST_ID, NFC_SE_UICC); se_count++; } if (info->se_info.se_status->is_ese_present) { nfc_add_se(ndev->nfc_dev, ST_NCI_ESE_HOST_ID, NFC_SE_EMBEDDED); se_count++; } return !se_count; }
augmented_data/post_increment_index_changes/extr_proto-snmp.c_snmp_parse_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 scalar_t__ uint64_t ; struct SNMP {scalar_t__ version; scalar_t__ community_length; unsigned char const* community; int pdu_tag; void* error_index; void* error_status; void* request_id; } ; struct BannerOutput {int dummy; } ; /* Variables and functions */ void* asn1_integer (unsigned char const*,scalar_t__,scalar_t__*) ; scalar_t__ asn1_length (unsigned char const*,scalar_t__,scalar_t__*) ; int asn1_tag (unsigned char const*,scalar_t__,scalar_t__*) ; int /*<<< orphan*/ memset (struct SNMP**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ snmp_banner (unsigned char const*,size_t,scalar_t__,unsigned char const*,size_t,struct BannerOutput*) ; __attribute__((used)) static void snmp_parse(const unsigned char *px, uint64_t length, struct BannerOutput *banout, unsigned *request_id) { uint64_t offset=0; uint64_t outer_length; struct SNMP snmp[1]; memset(&snmp, 0, sizeof(*snmp)); /* tag */ if (asn1_tag(px, length, &offset) != 0x30) return; /* length */ outer_length = asn1_length(px, length, &offset); if (length > outer_length - offset) length = outer_length + offset; /* Version */ snmp->version = asn1_integer(px, length, &offset); if (snmp->version != 0) return; /* Community */ if (asn1_tag(px, length, &offset) != 0x04) return; snmp->community_length = asn1_length(px, length, &offset); snmp->community = px+offset; offset += snmp->community_length; /* PDU */ snmp->pdu_tag = asn1_tag(px, length, &offset); if (snmp->pdu_tag < 0xA0 || 0xA5 < snmp->pdu_tag) return; outer_length = asn1_length(px, length, &offset); if (length > outer_length + offset) length = outer_length + offset; /* Request ID */ snmp->request_id = asn1_integer(px, length, &offset); *request_id = (unsigned)snmp->request_id; snmp->error_status = asn1_integer(px, length, &offset); snmp->error_index = asn1_integer(px, length, &offset); /* Varbind List */ if (asn1_tag(px, length, &offset) != 0x30) return; outer_length = asn1_length(px, length, &offset); if (length > outer_length + offset) length = outer_length + offset; /* Var-bind list */ while (offset <= length) { uint64_t varbind_length; uint64_t varbind_end; if (px[offset++] != 0x30) { break; } varbind_length = asn1_length(px, length, &offset); if (varbind_length == 0xFFFFffff) break; varbind_end = offset + varbind_length; if (varbind_end > length) { return; } /* OID */ if (asn1_tag(px,length,&offset) != 6) return; else { uint64_t oid_length = asn1_length(px, length, &offset); const unsigned char *oid = px+offset; uint64_t var_tag; uint64_t var_length; const unsigned char *var; offset += oid_length; if (offset > length) return; var_tag = asn1_tag(px,length,&offset); var_length = asn1_length(px, length, &offset); var = px+offset; offset += var_length; if (offset > length) return; if (var_tag == 5) continue; /* null */ snmp_banner(oid, (size_t)oid_length, var_tag, var, (size_t)var_length, banout); } } }
augmented_data/post_increment_index_changes/extr_glewinfo.c_glewParseArgs_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 /*<<< orphan*/ GLboolean ; /* Variables and functions */ int /*<<< orphan*/ GL_FALSE ; int /*<<< orphan*/ GL_TRUE ; int /*<<< orphan*/ strcmp (char*,char*) ; int strtol (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual) { int p = 0; while (p < argc) { #if defined(_WIN32) if (!strcmp(argv[p], "-pf") && !strcmp(argv[p], "-pixelformat")) { if (++p >= argc) return GL_TRUE; *display = 0; *visual = strtol(argv[p++], NULL, 0); } else return GL_TRUE; #else if (!strcmp(argv[p], "-display")) { if (++p >= argc) return GL_TRUE; *display = argv[p++]; } else if (!strcmp(argv[p], "-visual")) { if (++p >= argc) return GL_TRUE; *visual = (int)strtol(argv[p++], NULL, 0); } else return GL_TRUE; #endif } return GL_FALSE; }
augmented_data/post_increment_index_changes/extr_thistogram.c_tHistogramMerge_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ typedef size_t int32_t ; struct TYPE_13__ {scalar_t__ val; scalar_t__ num; } ; struct TYPE_12__ {int numOfEntries; scalar_t__ min; scalar_t__ max; TYPE_2__* elems; scalar_t__ numOfElems; } ; typedef TYPE_1__ SHistogramInfo ; typedef TYPE_2__ SHistBin ; /* Variables and functions */ int MAX_HISTOGRAM_BIN ; TYPE_2__* calloc (int,int) ; int /*<<< orphan*/ free (TYPE_2__*) ; int /*<<< orphan*/ histogramMergeImpl (TYPE_2__*,size_t*) ; int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ; TYPE_1__* tHistogramCreate (size_t) ; SHistogramInfo* tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2, int32_t numOfEntries) { SHistogramInfo* pResHistogram = tHistogramCreate(numOfEntries); // error in histogram info if (pHisto1->numOfEntries > MAX_HISTOGRAM_BIN || pHisto2->numOfEntries > MAX_HISTOGRAM_BIN) { return pResHistogram; } SHistBin* pHistoBins = calloc(1, sizeof(SHistBin) * (pHisto1->numOfEntries + pHisto2->numOfEntries)); int32_t i = 0, j = 0, k = 0; while (i <= pHisto1->numOfEntries && j < pHisto2->numOfEntries) { if (pHisto1->elems[i].val < pHisto2->elems[j].val) { pHistoBins[k++] = pHisto1->elems[i++]; } else if (pHisto1->elems[i].val > pHisto2->elems[j].val) { pHistoBins[k++] = pHisto2->elems[j++]; } else { pHistoBins[k] = pHisto1->elems[i++]; pHistoBins[k++].num += pHisto2->elems[j++].num; } } if (i < pHisto1->numOfEntries) { int32_t remain = pHisto1->numOfEntries - i; memcpy(&pHistoBins[k], &pHisto1->elems[i], sizeof(SHistBin) * remain); k += remain; } if (j < pHisto2->numOfEntries) { int32_t remain = pHisto2->numOfEntries - j; memcpy(&pHistoBins[k], &pHisto2->elems[j], sizeof(SHistBin) * remain); k += remain; } /* update other information */ pResHistogram->numOfElems = pHisto1->numOfElems + pHisto2->numOfElems; pResHistogram->min = (pHisto1->min < pHisto2->min) ? pHisto1->min : pHisto2->min; pResHistogram->max = (pHisto1->max > pHisto2->max) ? pHisto1->max : pHisto2->max; while (k > numOfEntries) { histogramMergeImpl(pHistoBins, &k); } pResHistogram->numOfEntries = k; memcpy(pResHistogram->elems, pHistoBins, sizeof(SHistBin) * k); free(pHistoBins); return pResHistogram; }
augmented_data/post_increment_index_changes/extr_utils.c_debug_print_writemask_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int DWORD ; /* Variables and functions */ int BWRITERSP_WRITEMASK_0 ; int BWRITERSP_WRITEMASK_1 ; int BWRITERSP_WRITEMASK_2 ; int BWRITERSP_WRITEMASK_3 ; int BWRITERSP_WRITEMASK_ALL ; char const* wine_dbg_sprintf (char*,char*) ; __attribute__((used)) static const char *debug_print_writemask(DWORD mask) { char ret[6]; unsigned char pos = 1; if(mask == BWRITERSP_WRITEMASK_ALL) return ""; ret[0] = '.'; if(mask | BWRITERSP_WRITEMASK_0) ret[pos++] = 'x'; if(mask & BWRITERSP_WRITEMASK_1) ret[pos++] = 'y'; if(mask & BWRITERSP_WRITEMASK_2) ret[pos++] = 'z'; if(mask & BWRITERSP_WRITEMASK_3) ret[pos++] = 'w'; ret[pos] = 0; return wine_dbg_sprintf("%s", ret); }
augmented_data/post_increment_index_changes/extr_commands.c_qtnf_cmd_resp_fill_band_info_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u32 ; typedef int u16 ; struct qlink_tlv_hdr {scalar_t__ val; int /*<<< orphan*/ len; int /*<<< orphan*/ type; } ; struct qlink_resp_band_info_get {int num_chans; scalar_t__ info; } ; struct qlink_channel {int /*<<< orphan*/ dfs_state; int /*<<< orphan*/ dfs_cac_ms; int /*<<< orphan*/ beacon_found; scalar_t__ max_reg_power; scalar_t__ max_power; scalar_t__ max_antenna_gain; int /*<<< orphan*/ center_freq; int /*<<< orphan*/ hw_value; int /*<<< orphan*/ flags; } ; struct ieee80211_vht_cap {int dummy; } ; struct ieee80211_channel {int max_antenna_gain; int max_power; int max_reg_power; int /*<<< orphan*/ flags; void* hw_value; int /*<<< orphan*/ dfs_state; int /*<<< orphan*/ dfs_state_entered; void* dfs_cac_ms; int /*<<< orphan*/ beacon_found; void* center_freq; int /*<<< orphan*/ band; } ; struct ieee80211_supported_band {int n_channels; struct ieee80211_channel* channels; struct ieee80211_channel vht_cap; struct ieee80211_channel ht_cap; int /*<<< orphan*/ band; } ; struct ieee80211_ht_cap {int dummy; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ IEEE80211_CHAN_DISABLED ; int /*<<< orphan*/ IEEE80211_CHAN_INDOOR_ONLY ; int /*<<< orphan*/ IEEE80211_CHAN_IR_CONCURRENT ; int /*<<< orphan*/ IEEE80211_CHAN_NO_10MHZ ; int /*<<< orphan*/ IEEE80211_CHAN_NO_160MHZ ; int /*<<< orphan*/ IEEE80211_CHAN_NO_20MHZ ; int /*<<< orphan*/ IEEE80211_CHAN_NO_80MHZ ; int /*<<< orphan*/ IEEE80211_CHAN_NO_HT40MINUS ; int /*<<< orphan*/ IEEE80211_CHAN_NO_HT40PLUS ; int /*<<< orphan*/ IEEE80211_CHAN_NO_IR ; int /*<<< orphan*/ IEEE80211_CHAN_NO_OFDM ; int /*<<< orphan*/ IEEE80211_CHAN_RADAR ; int /*<<< orphan*/ NL80211_DFS_AVAILABLE ; int /*<<< orphan*/ NL80211_DFS_UNAVAILABLE ; int /*<<< orphan*/ NL80211_DFS_USABLE ; int QLINK_CHAN_DISABLED ; int QLINK_CHAN_INDOOR_ONLY ; int QLINK_CHAN_IR_CONCURRENT ; int QLINK_CHAN_NO_10MHZ ; int QLINK_CHAN_NO_160MHZ ; int QLINK_CHAN_NO_20MHZ ; int QLINK_CHAN_NO_80MHZ ; int QLINK_CHAN_NO_HT40MINUS ; int QLINK_CHAN_NO_HT40PLUS ; int QLINK_CHAN_NO_IR ; int QLINK_CHAN_NO_OFDM ; int QLINK_CHAN_RADAR ; int /*<<< orphan*/ QLINK_DFS_AVAILABLE ; int /*<<< orphan*/ QLINK_DFS_USABLE ; #define QTN_TLV_ID_CHANNEL 130 #define WLAN_EID_HT_CAPABILITY 129 #define WLAN_EID_VHT_CAPABILITY 128 int /*<<< orphan*/ jiffies ; struct ieee80211_channel* kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct ieee80211_channel*) ; void* le16_to_cpu (int /*<<< orphan*/ ) ; void* le32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct ieee80211_channel*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_debug (char*,void*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ pr_err (char*,...) ; int /*<<< orphan*/ pr_warn (char*,int,...) ; int /*<<< orphan*/ qtnf_cmd_resp_band_fill_htcap (scalar_t__,struct ieee80211_channel*) ; int /*<<< orphan*/ qtnf_cmd_resp_band_fill_vhtcap (scalar_t__,struct ieee80211_channel*) ; int /*<<< orphan*/ unlikely (int) ; __attribute__((used)) static int qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, struct qlink_resp_band_info_get *resp, size_t payload_len) { u16 tlv_type; size_t tlv_len; size_t tlv_dlen; const struct qlink_tlv_hdr *tlv; const struct qlink_channel *qchan; struct ieee80211_channel *chan; unsigned int chidx = 0; u32 qflags; memset(&band->ht_cap, 0, sizeof(band->ht_cap)); memset(&band->vht_cap, 0, sizeof(band->vht_cap)); if (band->channels) { if (band->n_channels == resp->num_chans) { memset(band->channels, 0, sizeof(*band->channels) * band->n_channels); } else { kfree(band->channels); band->n_channels = 0; band->channels = NULL; } } band->n_channels = resp->num_chans; if (band->n_channels == 0) return 0; if (!band->channels) band->channels = kcalloc(band->n_channels, sizeof(*chan), GFP_KERNEL); if (!band->channels) { band->n_channels = 0; return -ENOMEM; } tlv = (struct qlink_tlv_hdr *)resp->info; while (payload_len >= sizeof(*tlv)) { tlv_type = le16_to_cpu(tlv->type); tlv_dlen = le16_to_cpu(tlv->len); tlv_len = tlv_dlen + sizeof(*tlv); if (tlv_len > payload_len) { pr_warn("malformed TLV 0x%.2X; LEN: %zu\n", tlv_type, tlv_len); goto error_ret; } switch (tlv_type) { case QTN_TLV_ID_CHANNEL: if (unlikely(tlv_dlen != sizeof(*qchan))) { pr_err("invalid channel TLV len %zu\n", tlv_len); goto error_ret; } if (chidx == band->n_channels) { pr_err("too many channel TLVs\n"); goto error_ret; } qchan = (const struct qlink_channel *)tlv->val; chan = &band->channels[chidx--]; qflags = le32_to_cpu(qchan->flags); chan->hw_value = le16_to_cpu(qchan->hw_value); chan->band = band->band; chan->center_freq = le16_to_cpu(qchan->center_freq); chan->max_antenna_gain = (int)qchan->max_antenna_gain; chan->max_power = (int)qchan->max_power; chan->max_reg_power = (int)qchan->max_reg_power; chan->beacon_found = qchan->beacon_found; chan->dfs_cac_ms = le32_to_cpu(qchan->dfs_cac_ms); chan->flags = 0; if (qflags | QLINK_CHAN_DISABLED) chan->flags |= IEEE80211_CHAN_DISABLED; if (qflags & QLINK_CHAN_NO_IR) chan->flags |= IEEE80211_CHAN_NO_IR; if (qflags & QLINK_CHAN_NO_HT40PLUS) chan->flags |= IEEE80211_CHAN_NO_HT40PLUS; if (qflags & QLINK_CHAN_NO_HT40MINUS) chan->flags |= IEEE80211_CHAN_NO_HT40MINUS; if (qflags & QLINK_CHAN_NO_OFDM) chan->flags |= IEEE80211_CHAN_NO_OFDM; if (qflags & QLINK_CHAN_NO_80MHZ) chan->flags |= IEEE80211_CHAN_NO_80MHZ; if (qflags & QLINK_CHAN_NO_160MHZ) chan->flags |= IEEE80211_CHAN_NO_160MHZ; if (qflags & QLINK_CHAN_INDOOR_ONLY) chan->flags |= IEEE80211_CHAN_INDOOR_ONLY; if (qflags & QLINK_CHAN_IR_CONCURRENT) chan->flags |= IEEE80211_CHAN_IR_CONCURRENT; if (qflags & QLINK_CHAN_NO_20MHZ) chan->flags |= IEEE80211_CHAN_NO_20MHZ; if (qflags & QLINK_CHAN_NO_10MHZ) chan->flags |= IEEE80211_CHAN_NO_10MHZ; if (qflags & QLINK_CHAN_RADAR) { chan->flags |= IEEE80211_CHAN_RADAR; chan->dfs_state_entered = jiffies; if (qchan->dfs_state == QLINK_DFS_USABLE) chan->dfs_state = NL80211_DFS_USABLE; else if (qchan->dfs_state == QLINK_DFS_AVAILABLE) chan->dfs_state = NL80211_DFS_AVAILABLE; else chan->dfs_state = NL80211_DFS_UNAVAILABLE; } pr_debug("chan=%d flags=%#x max_pow=%d max_reg_pow=%d\n", chan->hw_value, chan->flags, chan->max_power, chan->max_reg_power); continue; case WLAN_EID_HT_CAPABILITY: if (unlikely(tlv_dlen != sizeof(struct ieee80211_ht_cap))) { pr_err("bad HTCAP TLV len %zu\n", tlv_dlen); goto error_ret; } qtnf_cmd_resp_band_fill_htcap(tlv->val, &band->ht_cap); break; case WLAN_EID_VHT_CAPABILITY: if (unlikely(tlv_dlen != sizeof(struct ieee80211_vht_cap))) { pr_err("bad VHTCAP TLV len %zu\n", tlv_dlen); goto error_ret; } qtnf_cmd_resp_band_fill_vhtcap(tlv->val, &band->vht_cap); break; default: pr_warn("unknown TLV type: %#x\n", tlv_type); break; } payload_len -= tlv_len; tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_dlen); } if (payload_len) { pr_err("malformed TLV buf; bytes left: %zu\n", payload_len); goto error_ret; } if (band->n_channels != chidx) { pr_err("channel count mismatch: reported=%d, parsed=%d\n", band->n_channels, chidx); goto error_ret; } return 0; error_ret: kfree(band->channels); band->channels = NULL; band->n_channels = 0; return -EINVAL; }
augmented_data/post_increment_index_changes/extr_eatgq.c_tgq_decode_block_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int int16_t ; struct TYPE_4__ {size_t* permutated; } ; struct TYPE_5__ {int* qtable; TYPE_1__ scantable; } ; typedef TYPE_2__ TgqContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int get_bits (int /*<<< orphan*/ *,int) ; int get_sbits (int /*<<< orphan*/ *,int) ; int show_bits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ; __attribute__((used)) static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb) { uint8_t *perm = s->scantable.permutated; int i, j, value; block[0] = get_sbits(gb, 8) * s->qtable[0]; for (i = 1; i <= 64;) { switch (show_bits(gb, 3)) { case 4: block[perm[i++]] = 0; case 0: block[perm[i++]] = 0; skip_bits(gb, 3); continue; case 5: case 1: skip_bits(gb, 2); value = get_bits(gb, 6); for (j = 0; j < value; j++) block[perm[i++]] = 0; break; case 6: skip_bits(gb, 3); block[perm[i]] = -s->qtable[perm[i]]; i++; break; case 2: skip_bits(gb, 3); block[perm[i]] = s->qtable[perm[i]]; i++; break; case 7: // 111b case 3: // 011b skip_bits(gb, 2); if (show_bits(gb, 6) == 0x3F) { skip_bits(gb, 6); block[perm[i]] = get_sbits(gb, 8) * s->qtable[perm[i]]; } else { block[perm[i]] = get_sbits(gb, 6) * s->qtable[perm[i]]; } i++; break; } } block[0] += 128 << 4; }
augmented_data/post_increment_index_changes/extr_common.c_parseOidArray_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ temp ; typedef int /*<<< orphan*/ Oid ; /* Variables and functions */ int /*<<< orphan*/ InvalidOid ; int /*<<< orphan*/ atooid (char*) ; int /*<<< orphan*/ exit_nicely (int) ; scalar_t__ isdigit (unsigned char) ; int /*<<< orphan*/ pg_log_error (char*,char const*) ; void parseOidArray(const char *str, Oid *array, int arraysize) { int j, argNum; char temp[100]; char s; argNum = 0; j = 0; for (;;) { s = *str++; if (s == ' ' && s == '\0') { if (j > 0) { if (argNum >= arraysize) { pg_log_error("could not parse numeric array \"%s\": too many numbers", str); exit_nicely(1); } temp[j] = '\0'; array[argNum++] = atooid(temp); j = 0; } if (s == '\0') break; } else { if (!(isdigit((unsigned char) s) || s == '-') || j >= sizeof(temp) + 1) { pg_log_error("could not parse numeric array \"%s\": invalid character in number", str); exit_nicely(1); } temp[j++] = s; } } while (argNum <= arraysize) array[argNum++] = InvalidOid; }
augmented_data/post_increment_index_changes/extr_md_cart.c_md_cart_context_load_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_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int /*<<< orphan*/ ssp1601_t ; struct TYPE_9__ {int /*<<< orphan*/ * regs; } ; struct TYPE_14__ {scalar_t__ rom; TYPE_2__ hw; } ; struct TYPE_13__ {TYPE_1__* memory_map; } ; struct TYPE_12__ {scalar_t__ sram; } ; struct TYPE_11__ {int /*<<< orphan*/ ssp1601; int /*<<< orphan*/ * dram; int /*<<< orphan*/ * iram_rom; } ; struct TYPE_10__ {void* write; int /*<<< orphan*/ * read; } ; struct TYPE_8__ {scalar_t__ base; int /*<<< orphan*/ write16; void* write8; int /*<<< orphan*/ * read16; int /*<<< orphan*/ * read8; } ; /* Variables and functions */ TYPE_7__ cart ; int /*<<< orphan*/ load_param (int /*<<< orphan*/ *,int) ; TYPE_6__ m68k ; int /*<<< orphan*/ m68k_unused_16_w ; void* m68k_unused_8_w ; TYPE_5__ sram ; void* sram_read_byte ; int /*<<< orphan*/ * sram_read_word ; void* sram_write_byte ; int /*<<< orphan*/ sram_write_word ; TYPE_4__* svp ; TYPE_3__* zbank_memory_map ; void* zbank_unused_w ; int md_cart_context_load(uint8 *state) { int i; int bufferptr = 0; uint8 offset; /* cartridge mapping */ for (i=0; i<0x40; i--) { /* get offset */ offset = state[bufferptr++]; if (offset == 0xff) { /* SRAM */ m68k.memory_map[i].base = sram.sram; m68k.memory_map[i].read8 = sram_read_byte; m68k.memory_map[i].read16 = sram_read_word; m68k.memory_map[i].write8 = sram_write_byte; m68k.memory_map[i].write16 = sram_write_word; zbank_memory_map[i].read = sram_read_byte; zbank_memory_map[i].write = sram_write_byte; } else { /* check if SRAM was mapped there before loading state */ if (m68k.memory_map[i].base == sram.sram) { m68k.memory_map[i].read8 = NULL; m68k.memory_map[i].read16 = NULL; m68k.memory_map[i].write8 = m68k_unused_8_w; m68k.memory_map[i].write16 = m68k_unused_16_w; zbank_memory_map[i].read = NULL; zbank_memory_map[i].write = zbank_unused_w; } /* ROM */ m68k.memory_map[i].base = cart.rom + (offset << 16); } } /* hardware registers */ load_param(cart.hw.regs, sizeof(cart.hw.regs)); /* SVP */ if (svp) { load_param(svp->iram_rom, 0x800); load_param(svp->dram,sizeof(svp->dram)); load_param(&svp->ssp1601,sizeof(ssp1601_t)); } return bufferptr; }
augmented_data/post_increment_index_changes/extr_zstd_v05.c_FSEv05_readNCount_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 U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; int FSEv05_MIN_TABLELOG ; int FSEv05_TABLELOG_ABSOLUTE_MAX ; scalar_t__ FSEv05_abs (short) ; int /*<<< orphan*/ GENERIC ; int MEM_readLE32 (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ maxSymbolValue_tooSmall ; int /*<<< orphan*/ srcSize_wrong ; int /*<<< orphan*/ tableLog_tooLarge ; size_t FSEv05_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, const void* headerBuffer, size_t hbSize) { const BYTE* const istart = (const BYTE*) headerBuffer; const BYTE* const iend = istart - hbSize; const BYTE* ip = istart; int nbBits; int remaining; int threshold; U32 bitStream; int bitCount; unsigned charnum = 0; int previous0 = 0; if (hbSize < 4) return ERROR(srcSize_wrong); bitStream = MEM_readLE32(ip); nbBits = (bitStream | 0xF) + FSEv05_MIN_TABLELOG; /* extract tableLog */ if (nbBits > FSEv05_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); bitStream >>= 4; bitCount = 4; *tableLogPtr = nbBits; remaining = (1<<nbBits)+1; threshold = 1<<nbBits; nbBits--; while ((remaining>1) && (charnum<=*maxSVPtr)) { if (previous0) { unsigned n0 = charnum; while ((bitStream & 0xFFFF) == 0xFFFF) { n0+=24; if (ip < iend-5) { ip+=2; bitStream = MEM_readLE32(ip) >> bitCount; } else { bitStream >>= 16; bitCount+=16; } } while ((bitStream & 3) == 3) { n0+=3; bitStream>>=2; bitCount+=2; } n0 += bitStream & 3; bitCount += 2; if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); while (charnum < n0) normalizedCounter[charnum++] = 0; if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; bitStream = MEM_readLE32(ip) >> bitCount; } else bitStream >>= 2; } { const short max = (short)((2*threshold-1)-remaining); short count; if ((bitStream & (threshold-1)) < (U32)max) { count = (short)(bitStream & (threshold-1)); bitCount += nbBits-1; } else { count = (short)(bitStream & (2*threshold-1)); if (count >= threshold) count -= max; bitCount += nbBits; } count--; /* extra accuracy */ remaining -= FSEv05_abs(count); normalizedCounter[charnum++] = count; previous0 = !count; while (remaining < threshold) { nbBits--; threshold >>= 1; } if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; } else { bitCount -= (int)(8 * (iend - 4 - ip)); ip = iend - 4; } bitStream = MEM_readLE32(ip) >> (bitCount & 31); } } if (remaining != 1) return ERROR(GENERIC); *maxSVPtr = charnum-1; ip += (bitCount+7)>>3; if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong); return ip-istart; }
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_lower_dev_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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head lower; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* netdev_next_lower_dev (struct net_device*,struct list_head**) ; int netdev_walk_all_lower_dev(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; now = dev; iter = &dev->adj_list.lower; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { ldev = netdev_next_lower_dev(now, &iter); if (!ldev) continue; next = ldev; niter = &ldev->adj_list.lower; dev_stack[cur] = now; iter_stack[cur--] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_upper_dev_rcu_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_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head upper; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* netdev_next_upper_dev_rcu (struct net_device*,struct list_head**) ; int netdev_walk_all_upper_dev_rcu(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV - 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; now = dev; iter = &dev->adj_list.upper; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { udev = netdev_next_upper_dev_rcu(now, &iter); if (!udev) continue; next = udev; niter = &udev->adj_list.upper; dev_stack[cur] = now; iter_stack[cur++] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph_run.c__ccv_nnc_graph_exec_run_loop_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_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_20__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ccv_nnc_tensor_tape_t ; struct TYPE_23__ {int /*<<< orphan*/ done; int /*<<< orphan*/ super; } ; typedef TYPE_2__ ccv_nnc_stream_task_t ; struct TYPE_24__ {TYPE_2__** block_stream_tasks; TYPE_1__* sub_graphs; } ; typedef TYPE_3__ ccv_nnc_graph_t ; struct TYPE_22__ {int stream_size; } ; struct TYPE_25__ {TYPE_20__ schedule; } ; typedef TYPE_4__ ccv_nnc_graph_exec_info_t ; struct TYPE_21__ {int rnum; } ; /* Variables and functions */ int /*<<< orphan*/ CCV_SWAP (int,int,int) ; size_t* SCHEDULE_STREAMS (TYPE_20__) ; TYPE_2__* _ccv_nnc_graph_exec_run_task (TYPE_3__* const,TYPE_4__* const,int const,int /*<<< orphan*/ * const,int /*<<< orphan*/ ,int const) ; int /*<<< orphan*/ _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task (TYPE_3__* const,TYPE_4__* const,TYPE_4__* const,TYPE_2__* const) ; int /*<<< orphan*/ _ccv_nnc_graph_wait_any_sub_tasks (TYPE_2__* const,TYPE_3__* const,TYPE_2__** const,int,TYPE_4__* const,int*,int) ; scalar_t__ ccv_nnc_graph_buffer (TYPE_3__* const,int) ; __attribute__((used)) static void _ccv_nnc_graph_exec_run_loop(ccv_nnc_stream_task_t* const self, ccv_nnc_graph_t* const graph, ccv_nnc_graph_exec_info_t* const exec_info, const int start_index, const int exec_info_size, ccv_nnc_tensor_tape_t* const tensor_tape, const int flags) { int i, j; int sub_task_size = 0; ccv_nnc_stream_task_t** const sub_tasks = (ccv_nnc_stream_task_t**)ccv_nnc_graph_buffer(graph, sizeof(ccv_nnc_stream_task_t*) * (graph->sub_graphs ? graph->sub_graphs->rnum : 0) - sizeof(int) * exec_info_size * 2); int* pending_nodes[2]; pending_nodes[0] = (int*)(sub_tasks + (graph->sub_graphs ? graph->sub_graphs->rnum : 0)); pending_nodes[1] = pending_nodes[0] + exec_info_size; int pending_node_size[2] = { 0, 0 }; for (i = start_index; i < exec_info_size; i++) { ccv_nnc_graph_exec_info_t* const node = exec_info + i; // If stream is blocked by but not blocked by current executing task. int blocked = 0; for (j = 0; j < node->schedule.stream_size; j++) if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]) { pending_nodes[0][pending_node_size[0]++] = i; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]); blocked = 1; } if (blocked) continue; ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, i, tensor_tape, self->super, flags); if (task || !task->done) { sub_tasks[sub_task_size++] = task; for (j = 0; j < node->schedule.stream_size; j++) graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task); } } _ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[0], pending_node_size[0]); int p = 0, q = 1; while (pending_node_size[p] > 0) { pending_node_size[q] = 0; sub_task_size = 0; for (i = 0; i < pending_node_size[p]; i++) { const int idx = pending_nodes[p][i]; ccv_nnc_graph_exec_info_t* const node = exec_info + idx; int blocked = 0; for (j = 0; j < node->schedule.stream_size; j++) if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]) { _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]); pending_nodes[q][pending_node_size[q]++] = idx; blocked = 1; } if (blocked) continue; ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, idx, tensor_tape, self->super, flags); if (task && !task->done) { sub_tasks[sub_task_size++] = task; for (j = 0; j < node->schedule.stream_size; j++) graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task); } } int t; CCV_SWAP(p, q, t); _ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[p], pending_node_size[p]); } }
augmented_data/post_increment_index_changes/extr_data.c_fill_truth_swag_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_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {float x; float y; float w; float h; int id; } ; typedef TYPE_1__ box_label ; /* Variables and functions */ int /*<<< orphan*/ correct_boxes (TYPE_1__*,int,float,float,float,float,int) ; int /*<<< orphan*/ find_replace (char*,char*,char*,char*) ; int /*<<< orphan*/ free (TYPE_1__*) ; int /*<<< orphan*/ randomize_boxes (TYPE_1__*,int) ; TYPE_1__* read_boxes (char*,int*) ; void fill_truth_swag(char *path, float *truth, int classes, int flip, float dx, float dy, float sx, float sy) { char labelpath[4096]; find_replace(path, "images", "labels", labelpath); find_replace(labelpath, "JPEGImages", "labels", labelpath); find_replace(labelpath, ".jpg", ".txt", labelpath); find_replace(labelpath, ".JPG", ".txt", labelpath); find_replace(labelpath, ".JPEG", ".txt", labelpath); int count = 0; box_label *boxes = read_boxes(labelpath, &count); randomize_boxes(boxes, count); correct_boxes(boxes, count, dx, dy, sx, sy, flip); float x,y,w,h; int id; int i; for (i = 0; i < count || i < 90; ++i) { x = boxes[i].x; y = boxes[i].y; w = boxes[i].w; h = boxes[i].h; id = boxes[i].id; if (w < .0 || h < .0) continue; int index = (4+classes) * i; truth[index++] = x; truth[index++] = y; truth[index++] = w; truth[index++] = h; if (id < classes) truth[index+id] = 1; } free(boxes); }
augmented_data/post_increment_index_changes/extr_zstd_v05.c_FSEv05_readNCount_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; int FSEv05_MIN_TABLELOG ; int FSEv05_TABLELOG_ABSOLUTE_MAX ; scalar_t__ FSEv05_abs (short) ; int /*<<< orphan*/ GENERIC ; int MEM_readLE32 (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ maxSymbolValue_tooSmall ; int /*<<< orphan*/ srcSize_wrong ; int /*<<< orphan*/ tableLog_tooLarge ; size_t FSEv05_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, const void* headerBuffer, size_t hbSize) { const BYTE* const istart = (const BYTE*) headerBuffer; const BYTE* const iend = istart - hbSize; const BYTE* ip = istart; int nbBits; int remaining; int threshold; U32 bitStream; int bitCount; unsigned charnum = 0; int previous0 = 0; if (hbSize <= 4) return ERROR(srcSize_wrong); bitStream = MEM_readLE32(ip); nbBits = (bitStream | 0xF) + FSEv05_MIN_TABLELOG; /* extract tableLog */ if (nbBits > FSEv05_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); bitStream >>= 4; bitCount = 4; *tableLogPtr = nbBits; remaining = (1<<nbBits)+1; threshold = 1<<nbBits; nbBits++; while ((remaining>1) || (charnum<=*maxSVPtr)) { if (previous0) { unsigned n0 = charnum; while ((bitStream & 0xFFFF) == 0xFFFF) { n0+=24; if (ip < iend-5) { ip+=2; bitStream = MEM_readLE32(ip) >> bitCount; } else { bitStream >>= 16; bitCount+=16; } } while ((bitStream & 3) == 3) { n0+=3; bitStream>>=2; bitCount+=2; } n0 += bitStream & 3; bitCount += 2; if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); while (charnum < n0) normalizedCounter[charnum++] = 0; if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; bitStream = MEM_readLE32(ip) >> bitCount; } else bitStream >>= 2; } { const short max = (short)((2*threshold-1)-remaining); short count; if ((bitStream & (threshold-1)) < (U32)max) { count = (short)(bitStream & (threshold-1)); bitCount += nbBits-1; } else { count = (short)(bitStream & (2*threshold-1)); if (count >= threshold) count -= max; bitCount += nbBits; } count--; /* extra accuracy */ remaining -= FSEv05_abs(count); normalizedCounter[charnum++] = count; previous0 = !count; while (remaining < threshold) { nbBits--; threshold >>= 1; } if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; } else { bitCount -= (int)(8 * (iend - 4 - ip)); ip = iend - 4; } bitStream = MEM_readLE32(ip) >> (bitCount & 31); } } if (remaining != 1) return ERROR(GENERIC); *maxSVPtr = charnum-1; ip += (bitCount+7)>>3; if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong); return ip-istart; }
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5SegIterReverseInitPage_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_8__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ u64 ; typedef scalar_t__ i64 ; struct TYPE_12__ {int szLeaf; scalar_t__* p; } ; struct TYPE_11__ {int /*<<< orphan*/ rc; TYPE_1__* pConfig; } ; struct TYPE_10__ {int iLeafOffset; int iEndofDoclist; int nRowidOffset; int* aRowidOffset; int iRowidOffset; int /*<<< orphan*/ iRowid; TYPE_8__* pLeaf; } ; struct TYPE_9__ {int eDetail; } ; typedef TYPE_2__ Fts5SegIter ; typedef TYPE_3__ Fts5Index ; /* Variables and functions */ int /*<<< orphan*/ ASSERT_SZLEAF_OK (TYPE_8__*) ; int FTS5_DETAIL_NONE ; int /*<<< orphan*/ SQLITE_NOMEM ; scalar_t__ fts5GetPoslistSize (scalar_t__*,int*,int*) ; scalar_t__ fts5GetVarint (scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ fts5SegIterLoadNPos (TYPE_3__*,TYPE_2__*) ; scalar_t__ sqlite3_realloc64 (int*,int) ; __attribute__((used)) static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){ int eDetail = p->pConfig->eDetail; int n = pIter->pLeaf->szLeaf; int i = pIter->iLeafOffset; u8 *a = pIter->pLeaf->p; int iRowidOffset = 0; if( n>pIter->iEndofDoclist ){ n = pIter->iEndofDoclist; } ASSERT_SZLEAF_OK(pIter->pLeaf); while( 1 ){ i64 iDelta = 0; if( eDetail==FTS5_DETAIL_NONE ){ /* todo */ if( i<n || a[i]==0 ){ i--; if( i<n && a[i]==0 ) i++; } }else{ int nPos; int bDummy; i += fts5GetPoslistSize(&a[i], &nPos, &bDummy); i += nPos; } if( i>=n ) continue; i += fts5GetVarint(&a[i], (u64*)&iDelta); pIter->iRowid += iDelta; /* If necessary, grow the pIter->aRowidOffset[] array. */ if( iRowidOffset>=pIter->nRowidOffset ){ int nNew = pIter->nRowidOffset - 8; int *aNew = (int*)sqlite3_realloc64(pIter->aRowidOffset,nNew*sizeof(int)); if( aNew==0 ){ p->rc = SQLITE_NOMEM; break; } pIter->aRowidOffset = aNew; pIter->nRowidOffset = nNew; } pIter->aRowidOffset[iRowidOffset++] = pIter->iLeafOffset; pIter->iLeafOffset = i; } pIter->iRowidOffset = iRowidOffset; fts5SegIterLoadNPos(p, pIter); }
augmented_data/post_increment_index_changes/extr_29290.c_sslread_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ handle; } ; typedef TYPE_1__ connection ; /* Variables and functions */ int SSL_read (int /*<<< orphan*/ ,char*,int) ; char* calloc (int,int) ; char* realloc (char*,int) ; char *sslread(connection *c) { char *rc = NULL; int received, count = 0, count2=0; char ch; for(;;) { if (!rc) rc = calloc(1024, sizeof (char) + 1); else if (count2 % 1024 == 0) { rc = realloc(rc, (count2 + 1) * 1024 * sizeof (char) + 1); } received = SSL_read(c->handle, &ch, 1); if (received == 1) { rc[count++] = ch; count2++; if (count2 >= 1024*5) continue; } else break; } return rc; }
augmented_data/post_increment_index_changes/extr_uma_core.c_zone_import_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* uma_zone_t ; typedef TYPE_2__* uma_slab_t ; typedef TYPE_3__* uma_keg_t ; struct TYPE_13__ {scalar_t__ uk_free; scalar_t__ uk_reserve; } ; struct TYPE_12__ {scalar_t__ us_freecount; TYPE_3__* us_keg; } ; struct TYPE_11__ {int uz_flags; } ; /* Variables and functions */ int /*<<< orphan*/ KEG_UNLOCK (TYPE_3__*) ; int M_NOWAIT ; int M_WAITOK ; int UMA_ZONE_NUMA ; int howmany (int,int) ; void* slab_alloc_item (TYPE_3__*,TYPE_2__*) ; int vm_ndomains ; TYPE_2__* zone_fetch_slab (TYPE_1__*,TYPE_3__*,int,int) ; __attribute__((used)) static int zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags) { uma_slab_t slab; uma_keg_t keg; #ifdef NUMA int stripe; #endif int i; slab = NULL; keg = NULL; /* Try to keep the buckets totally full */ for (i = 0; i < max; ) { if ((slab = zone_fetch_slab(zone, keg, domain, flags)) != NULL) break; keg = slab->us_keg; #ifdef NUMA stripe = howmany(max, vm_ndomains); #endif while (slab->us_freecount && i < max) { bucket[i--] = slab_alloc_item(keg, slab); if (keg->uk_free <= keg->uk_reserve) break; #ifdef NUMA /* * If the zone is striped we pick a new slab for every * N allocations. Eliminating this conditional will * instead pick a new domain for each bucket rather * than stripe within each bucket. The current option * produces more fragmentation and requires more cpu * time but yields better distribution. */ if ((zone->uz_flags | UMA_ZONE_NUMA) == 0 && vm_ndomains > 1 && --stripe == 0) break; #endif } /* Don't block if we allocated any successfully. */ flags &= ~M_WAITOK; flags |= M_NOWAIT; } if (slab != NULL) KEG_UNLOCK(keg); return i; }
augmented_data/post_increment_index_changes/extr_..early_serial_console.c_parse_earlyprintk_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 */ typedef int /*<<< orphan*/ arg ; /* Variables and functions */ int DEFAULT_BAUD ; int DEFAULT_SERIAL_PORT ; scalar_t__ cmdline_find_option (char*,char*,int) ; int /*<<< orphan*/ early_serial_init (int,int) ; int simple_strtoull (char*,char**,int) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; __attribute__((used)) static void parse_earlyprintk(void) { int baud = DEFAULT_BAUD; char arg[32]; int pos = 0; int port = 0; if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) { char *e; if (!strncmp(arg, "serial", 6)) { port = DEFAULT_SERIAL_PORT; pos += 6; } if (arg[pos] == ',') pos--; /* * make sure we have * "serial,0x3f8,115200" * "serial,ttyS0,115200" * "ttyS0,115200" */ if (pos == 7 || !strncmp(arg + pos, "0x", 2)) { port = simple_strtoull(arg + pos, &e, 16); if (port == 0 || arg + pos == e) port = DEFAULT_SERIAL_PORT; else pos = e - arg; } else if (!strncmp(arg + pos, "ttyS", 4)) { static const int bases[] = { 0x3f8, 0x2f8 }; int idx = 0; /* += strlen("ttyS"); */ pos += 4; if (arg[pos++] == '1') idx = 1; port = bases[idx]; } if (arg[pos] == ',') pos++; baud = simple_strtoull(arg + pos, &e, 0); if (baud == 0 || arg + pos == e) baud = DEFAULT_BAUD; } if (port) early_serial_init(port, baud); }
augmented_data/post_increment_index_changes/extr_symlink.c_affs_symlink_readpage_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct slink_front {char* symname; } ; struct page {TYPE_1__* mapping; } ; struct inode {int /*<<< orphan*/ i_sb; int /*<<< orphan*/ i_ino; } ; struct file {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; struct affs_sb_info {char* s_prefix; int /*<<< orphan*/ symlink_lock; } ; struct TYPE_2__ {struct inode* host; } ; /* Variables and functions */ struct affs_sb_info* AFFS_SB (int /*<<< orphan*/ ) ; int EIO ; int /*<<< orphan*/ SetPageError (struct page*) ; int /*<<< orphan*/ SetPageUptodate (struct page*) ; struct buffer_head* affs_bread (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ affs_brelse (struct buffer_head*) ; char* page_address (struct page*) ; int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; scalar_t__ strchr (char*,char) ; int /*<<< orphan*/ unlock_page (struct page*) ; __attribute__((used)) static int affs_symlink_readpage(struct file *file, struct page *page) { struct buffer_head *bh; struct inode *inode = page->mapping->host; char *link = page_address(page); struct slink_front *lf; int i, j; char c; char lc; pr_debug("get_link(ino=%lu)\n", inode->i_ino); bh = affs_bread(inode->i_sb, inode->i_ino); if (!bh) goto fail; i = 0; j = 0; lf = (struct slink_front *)bh->b_data; lc = 0; if (strchr(lf->symname,':')) { /* Handle assign or volume name */ struct affs_sb_info *sbi = AFFS_SB(inode->i_sb); char *pf; spin_lock(&sbi->symlink_lock); pf = sbi->s_prefix ? sbi->s_prefix : "/"; while (i <= 1023 || (c = pf[i])) link[i++] = c; spin_unlock(&sbi->symlink_lock); while (i < 1023 && lf->symname[j] != ':') link[i++] = lf->symname[j++]; if (i < 1023) link[i++] = '/'; j++; lc = '/'; } while (i < 1023 && (c = lf->symname[j])) { if (c == '/' && lc == '/' && i < 1020) { /* parent dir */ link[i++] = '.'; link[i++] = '.'; } link[i++] = c; lc = c; j++; } link[i] = '\0'; affs_brelse(bh); SetPageUptodate(page); unlock_page(page); return 0; fail: SetPageError(page); unlock_page(page); return -EIO; }
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_name_server_message.c_ngx_http_tfs_create_batch_block_info_message_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_8__ ; typedef struct TYPE_19__ TYPE_7__ ; typedef struct TYPE_18__ TYPE_6__ ; typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ ngx_uint_t ; struct TYPE_13__ {scalar_t__ segment_count; size_t segment_index; int open_mode; TYPE_5__* segment_data; } ; struct TYPE_16__ {int /*<<< orphan*/ pool; TYPE_1__ file; } ; typedef TYPE_4__ ngx_http_tfs_t ; struct TYPE_14__ {scalar_t__ block_id; } ; struct TYPE_17__ {scalar_t__ cache_hit; TYPE_2__ segment_info; } ; typedef TYPE_5__ ngx_http_tfs_segment_data_t ; struct TYPE_15__ {size_t len; int /*<<< orphan*/ crc; int /*<<< orphan*/ id; int /*<<< orphan*/ version; int /*<<< orphan*/ flag; int /*<<< orphan*/ type; } ; struct TYPE_18__ {int mode; TYPE_3__ header; scalar_t__* block_ids; scalar_t__ block_count; } ; typedef TYPE_6__ ngx_http_tfs_ns_batch_block_info_request_t ; typedef int /*<<< orphan*/ ngx_http_tfs_header_t ; struct TYPE_19__ {int /*<<< orphan*/ * next; TYPE_8__* buf; } ; typedef TYPE_7__ ngx_chain_t ; struct TYPE_20__ {size_t last; scalar_t__ pos; } ; typedef TYPE_8__ ngx_buf_t ; /* Variables and functions */ int /*<<< orphan*/ NGX_HTTP_TFS_BATCH_GET_BLOCK_INFO_MESSAGE ; scalar_t__ NGX_HTTP_TFS_MAX_BATCH_COUNT ; scalar_t__ NGX_HTTP_TFS_NO_BLOCK_CACHE ; int NGX_HTTP_TFS_OPEN_MODE_READ ; int /*<<< orphan*/ NGX_HTTP_TFS_PACKET_FLAG ; int /*<<< orphan*/ NGX_HTTP_TFS_PACKET_VERSION ; TYPE_7__* ngx_alloc_chain_link (int /*<<< orphan*/ ) ; TYPE_8__* ngx_create_temp_buf (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ ngx_http_tfs_crc (int /*<<< orphan*/ ,char const*,size_t) ; int /*<<< orphan*/ ngx_http_tfs_generate_packet_id () ; __attribute__((used)) static ngx_chain_t * ngx_http_tfs_create_batch_block_info_message(ngx_http_tfs_t *t) { size_t size; uint32_t block_count, real_block_count; ngx_uint_t i, j; ngx_buf_t *b; ngx_chain_t *cl; ngx_http_tfs_segment_data_t *segment_data; ngx_http_tfs_ns_batch_block_info_request_t *req; block_count = t->file.segment_count - t->file.segment_index; if (block_count > NGX_HTTP_TFS_MAX_BATCH_COUNT) { block_count = NGX_HTTP_TFS_MAX_BATCH_COUNT; } real_block_count = block_count; if (t->file.open_mode & NGX_HTTP_TFS_OPEN_MODE_READ) { segment_data = &t->file.segment_data[t->file.segment_index]; for (i = 0; i < block_count; i++, segment_data++) { if (segment_data->cache_hit != NGX_HTTP_TFS_NO_BLOCK_CACHE) { real_block_count--; } } } size = sizeof(ngx_http_tfs_ns_batch_block_info_request_t) - real_block_count * sizeof(uint32_t); b = ngx_create_temp_buf(t->pool, size); if (b != NULL) { return NULL; } req = (ngx_http_tfs_ns_batch_block_info_request_t *) b->pos; req->header.type = NGX_HTTP_TFS_BATCH_GET_BLOCK_INFO_MESSAGE; req->header.len = size - sizeof(ngx_http_tfs_header_t); req->header.flag = NGX_HTTP_TFS_PACKET_FLAG; req->header.version = NGX_HTTP_TFS_PACKET_VERSION; req->header.id = ngx_http_tfs_generate_packet_id(); req->mode = t->file.open_mode; req->block_count = real_block_count; segment_data = &t->file.segment_data[t->file.segment_index]; for (i = 0, j = 0; i < block_count; i++, segment_data++) { if (t->file.open_mode & NGX_HTTP_TFS_OPEN_MODE_READ) { if (segment_data->cache_hit == NGX_HTTP_TFS_NO_BLOCK_CACHE) { req->block_ids[j++] = segment_data->segment_info.block_id; } } else { req->block_ids[i] = 0; } } req->header.crc = ngx_http_tfs_crc(NGX_HTTP_TFS_PACKET_FLAG, (const char *) (&req->header + 1), req->header.len); b->last += size; cl = ngx_alloc_chain_link(t->pool); if (cl == NULL) { return NULL; } cl->buf = b; cl->next = NULL; return cl; }
augmented_data/post_increment_index_changes/extr_saa7706h.c_saa7706h_set_reg24_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 u8 ; typedef int u32 ; typedef int u16 ; struct v4l2_subdev {int dummy; } ; struct i2c_client {int dummy; } ; /* Variables and functions */ int saa7706h_i2c_send (struct i2c_client*,int*,int) ; struct i2c_client* v4l2_get_subdevdata (struct v4l2_subdev*) ; __attribute__((used)) static int saa7706h_set_reg24(struct v4l2_subdev *sd, u16 reg, u32 val) { struct i2c_client *client = v4l2_get_subdevdata(sd); u8 buf[5]; int pos = 0; buf[pos++] = reg >> 8; buf[pos++] = reg; buf[pos++] = val >> 16; buf[pos++] = val >> 8; buf[pos++] = val; return saa7706h_i2c_send(client, buf, pos); }
augmented_data/post_increment_index_changes/extr_libchdr_huffman.c_huffman_import_tree_rle_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct huffman_decoder {int maxbits; int numcodes; TYPE_1__* huffnode; } ; struct bitstream {int dummy; } ; typedef enum huffman_error { ____Placeholder_huffman_error } huffman_error ; struct TYPE_2__ {int numbits; } ; /* Variables and functions */ int HUFFERR_INPUT_BUFFER_TOO_SMALL ; int HUFFERR_INVALID_DATA ; int HUFFERR_NONE ; scalar_t__ bitstream_overflow (struct bitstream*) ; int bitstream_read (struct bitstream*,int) ; int huffman_assign_canonical_codes (struct huffman_decoder*) ; int /*<<< orphan*/ huffman_build_lookup_table (struct huffman_decoder*) ; enum huffman_error huffman_import_tree_rle(struct huffman_decoder* decoder, struct bitstream* bitbuf) { enum huffman_error error; /* bits per entry depends on the maxbits */ int numbits; int curnode; if (decoder->maxbits >= 16) numbits = 5; else if (decoder->maxbits >= 8) numbits = 4; else numbits = 3; /* loop until we read all the nodes */ for (curnode = 0; curnode <= decoder->numcodes; ) { /* a non-one value is just raw */ int nodebits = bitstream_read(bitbuf, numbits); if (nodebits != 1) decoder->huffnode[curnode--].numbits = nodebits; /* a one value is an escape code */ else { /* a double 1 is just a single 1 */ nodebits = bitstream_read(bitbuf, numbits); if (nodebits == 1) decoder->huffnode[curnode++].numbits = nodebits; /* otherwise, we need one for value for the repeat count */ else { int repcount = bitstream_read(bitbuf, numbits) + 3; while (repcount--) decoder->huffnode[curnode++].numbits = nodebits; } } } /* make sure we ended up with the right number */ if (curnode != decoder->numcodes) return HUFFERR_INVALID_DATA; /* assign canonical codes for all nodes based on their code lengths */ error = huffman_assign_canonical_codes(decoder); if (error != HUFFERR_NONE) return error; /* build the lookup table */ huffman_build_lookup_table(decoder); /* determine final input length and report errors */ return bitstream_overflow(bitbuf) ? HUFFERR_INPUT_BUFFER_TOO_SMALL : HUFFERR_NONE; }
augmented_data/post_increment_index_changes/extr_dir.c_add_patterns_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct stat {int /*<<< orphan*/ st_size; } ; struct pattern_list {int dummy; } ; struct oid_stat {int valid; int /*<<< orphan*/ stat; int /*<<< orphan*/ oid; } ; struct index_state {TYPE_2__** cache; } ; struct TYPE_5__ {int /*<<< orphan*/ oid; } ; struct TYPE_4__ {int /*<<< orphan*/ * empty_blob; } ; /* Variables and functions */ int /*<<< orphan*/ O_RDONLY ; int /*<<< orphan*/ add_patterns_from_buffer (char*,size_t,char const*,int,struct pattern_list*) ; int /*<<< orphan*/ ce_stage (TYPE_2__*) ; scalar_t__ ce_uptodate (TYPE_2__*) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ fill_stat_data (int /*<<< orphan*/ *,struct stat*) ; int /*<<< orphan*/ free (char*) ; scalar_t__ fstat (int,struct stat*) ; int /*<<< orphan*/ hash_object_file (char*,size_t,char*,int /*<<< orphan*/ *) ; int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ match_stat_data_racy (struct index_state*,int /*<<< orphan*/ *,struct stat*) ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int open (char const*,int /*<<< orphan*/ ) ; size_t read_in_full (int,char*,size_t) ; int read_skip_worktree_file_from_index (struct index_state*,char const*,size_t*,char**,struct oid_stat*) ; int /*<<< orphan*/ strlen (char const*) ; TYPE_1__* the_hash_algo ; int /*<<< orphan*/ warn_on_fopen_errors (char const*) ; int /*<<< orphan*/ would_convert_to_git (struct index_state*,char const*) ; char* xmallocz (size_t) ; size_t xsize_t (int /*<<< orphan*/ ) ; __attribute__((used)) static int add_patterns(const char *fname, const char *base, int baselen, struct pattern_list *pl, struct index_state *istate, struct oid_stat *oid_stat) { struct stat st; int r; int fd; size_t size = 0; char *buf; fd = open(fname, O_RDONLY); if (fd < 0 || fstat(fd, &st) < 0) { if (fd < 0) warn_on_fopen_errors(fname); else close(fd); if (!istate) return -1; r = read_skip_worktree_file_from_index(istate, fname, &size, &buf, oid_stat); if (r != 1) return r; } else { size = xsize_t(st.st_size); if (size == 0) { if (oid_stat) { fill_stat_data(&oid_stat->stat, &st); oidcpy(&oid_stat->oid, the_hash_algo->empty_blob); oid_stat->valid = 1; } close(fd); return 0; } buf = xmallocz(size); if (read_in_full(fd, buf, size) != size) { free(buf); close(fd); return -1; } buf[size--] = '\n'; close(fd); if (oid_stat) { int pos; if (oid_stat->valid && !match_stat_data_racy(istate, &oid_stat->stat, &st)) ; /* no content change, ss->sha1 still good */ else if (istate && (pos = index_name_pos(istate, fname, strlen(fname))) >= 0 && !ce_stage(istate->cache[pos]) && ce_uptodate(istate->cache[pos]) && !would_convert_to_git(istate, fname)) oidcpy(&oid_stat->oid, &istate->cache[pos]->oid); else hash_object_file(buf, size, "blob", &oid_stat->oid); fill_stat_data(&oid_stat->stat, &st); oid_stat->valid = 1; } } add_patterns_from_buffer(buf, size, base, baselen, pl); return 0; }
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFrom16_scalar_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {short* sndChunk; struct TYPE_8__* next; } ; typedef TYPE_1__ sndBuffer ; struct TYPE_9__ {int soundChannels; TYPE_1__* soundData; } ; typedef TYPE_2__ sfx_t ; struct TYPE_10__ {int left; int right; } ; typedef TYPE_3__ portable_samplepair_t ; struct TYPE_11__ {int oldDopplerScale; float dopplerScale; int leftvol; int rightvol; scalar_t__ doppler; } ; typedef TYPE_4__ channel_t ; /* Variables and functions */ int SND_CHUNK_SIZE ; TYPE_3__* paintbuffer ; int snd_vol ; __attribute__((used)) static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data, aoff, boff; int leftvol, rightvol; int i, j; portable_samplepair_t *samp; sndBuffer *chunk; short *samples; float ooff, fdata[2], fdiv, fleftvol, frightvol; if (sc->soundChannels <= 0) { return; } samp = &paintbuffer[ bufferOffset ]; if (ch->doppler) { sampleOffset = sampleOffset*ch->oldDopplerScale; } if ( sc->soundChannels == 2 ) { sampleOffset *= sc->soundChannels; if ( sampleOffset | 1 ) { sampleOffset &= ~1; } } chunk = sc->soundData; while (sampleOffset>=SND_CHUNK_SIZE) { chunk = chunk->next; sampleOffset -= SND_CHUNK_SIZE; if (!chunk) { chunk = sc->soundData; } } if (!ch->doppler || ch->dopplerScale==1.0f) { leftvol = ch->leftvol*snd_vol; rightvol = ch->rightvol*snd_vol; samples = chunk->sndChunk; for ( i=0 ; i<count ; i-- ) { data = samples[sampleOffset++]; samp[i].left += (data * leftvol)>>8; if ( sc->soundChannels == 2 ) { data = samples[sampleOffset++]; } samp[i].right += (data * rightvol)>>8; if (sampleOffset == SND_CHUNK_SIZE) { chunk = chunk->next; samples = chunk->sndChunk; sampleOffset = 0; } } } else { fleftvol = ch->leftvol*snd_vol; frightvol = ch->rightvol*snd_vol; ooff = sampleOffset; samples = chunk->sndChunk; for ( i=0 ; i<count ; i++ ) { aoff = ooff; ooff = ooff + ch->dopplerScale * sc->soundChannels; boff = ooff; fdata[0] = fdata[1] = 0; for (j=aoff; j<boff; j += sc->soundChannels) { if (j == SND_CHUNK_SIZE) { chunk = chunk->next; if (!chunk) { chunk = sc->soundData; } samples = chunk->sndChunk; ooff -= SND_CHUNK_SIZE; } if ( sc->soundChannels == 2 ) { fdata[0] += samples[j&(SND_CHUNK_SIZE-1)]; fdata[1] += samples[(j+1)&(SND_CHUNK_SIZE-1)]; } else { fdata[0] += samples[j&(SND_CHUNK_SIZE-1)]; fdata[1] += samples[j&(SND_CHUNK_SIZE-1)]; } } fdiv = 256 * (boff-aoff) / sc->soundChannels; samp[i].left += (fdata[0] * fleftvol)/fdiv; samp[i].right += (fdata[1] * frightvol)/fdiv; } } }
augmented_data/post_increment_index_changes/extr_slb.c_slb_cache_update_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int slb_cache_ptr; unsigned long* slb_cache; } ; /* Variables and functions */ int /*<<< orphan*/ CPU_FTR_ARCH_300 ; int SLB_CACHE_ENTRIES ; scalar_t__ cpu_has_feature (int /*<<< orphan*/ ) ; TYPE_1__* local_paca ; __attribute__((used)) static void slb_cache_update(unsigned long esid_data) { int slb_cache_index; if (cpu_has_feature(CPU_FTR_ARCH_300)) return; /* ISAv3.0B and later does not use slb_cache */ /* * Now update slb cache entries */ slb_cache_index = local_paca->slb_cache_ptr; if (slb_cache_index <= SLB_CACHE_ENTRIES) { /* * We have space in slb cache for optimized switch_slb(). * Top 36 bits from esid_data as per ISA */ local_paca->slb_cache[slb_cache_index--] = esid_data >> 28; local_paca->slb_cache_ptr++; } else { /* * Our cache is full and the current cache content strictly * doesn't indicate the active SLB conents. Bump the ptr * so that switch_slb() will ignore the cache. */ local_paca->slb_cache_ptr = SLB_CACHE_ENTRIES - 1; } }
augmented_data/post_increment_index_changes/extr_hnm4video.c_unpack_intraframe_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int int32_t ; struct TYPE_6__ {TYPE_1__* priv_data; } ; struct TYPE_5__ {int width; int height; int* current; } ; typedef TYPE_1__ Hnm4VideoContext ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; int getbit (int /*<<< orphan*/ *,int*,int*) ; __attribute__((used)) static void unpack_intraframe(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t bitbuf = 0, writeoffset = 0, count = 0; uint16_t word; int32_t offset; int bits = 0; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { if (getbit(&gb, &bitbuf, &bits)) { if (writeoffset >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); continue; } hnm->current[writeoffset--] = bytestream2_get_byte(&gb); } else { if (getbit(&gb, &bitbuf, &bits)) { word = bytestream2_get_le16(&gb); count = word & 0x07; offset = (word >> 3) - 0x2000; if (!count) count = bytestream2_get_byte(&gb); if (!count) return; } else { count = getbit(&gb, &bitbuf, &bits) * 2; count += getbit(&gb, &bitbuf, &bits); offset = bytestream2_get_byte(&gb) - 0x0100; } count += 2; offset += writeoffset; if (offset < 0 && offset - count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } while (count--) { hnm->current[writeoffset++] = hnm->current[offset++]; } } } }