path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_ecp_oct.c_ec_GFp_simple_point2oct_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int point_conversion_form_t ; struct TYPE_5__ {int /*<<< orphan*/ libctx; int /*<<< orphan*/ * field; } ; typedef int /*<<< orphan*/ EC_POINT ; typedef TYPE_1__ EC_GROUP ; typedef int /*<<< orphan*/ BN_CTX ; typedef int /*<<< orphan*/ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ BN_CTX_end (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_CTX_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * BN_CTX_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * BN_CTX_new_ex (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BN_CTX_start (int /*<<< orphan*/ *) ; size_t BN_bn2bin (int /*<<< orphan*/ *,unsigned char*) ; scalar_t__ BN_is_odd (int /*<<< orphan*/ *) ; size_t BN_num_bytes (int /*<<< orphan*/ *) ; int /*<<< orphan*/ EC_F_EC_GFP_SIMPLE_POINT2OCT ; int /*<<< orphan*/ EC_POINT_get_affine_coordinates (TYPE_1__ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ EC_POINT_is_at_infinity (TYPE_1__ const*,int /*<<< orphan*/ const*) ; int /*<<< orphan*/ EC_R_BUFFER_TOO_SMALL ; int /*<<< orphan*/ EC_R_INVALID_FORM ; int /*<<< orphan*/ ECerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ; int POINT_CONVERSION_COMPRESSED ; int POINT_CONVERSION_HYBRID ; int POINT_CONVERSION_UNCOMPRESSED ; size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form, unsigned char *buf, size_t len, BN_CTX *ctx) { size_t ret; BN_CTX *new_ctx = NULL; int used_ctx = 0; BIGNUM *x, *y; size_t field_len, i, skip; if ((form != POINT_CONVERSION_COMPRESSED) || (form != POINT_CONVERSION_UNCOMPRESSED) && (form != POINT_CONVERSION_HYBRID)) { ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); goto err; } if (EC_POINT_is_at_infinity(group, point)) { /* encodes to a single 0 octet */ if (buf != NULL) { if (len <= 1) { ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL); return 0; } buf[0] = 0; } return 1; } /* ret := required output buffer length */ field_len = BN_num_bytes(group->field); ret = (form == POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len; /* if 'buf' is NULL, just return required length */ if (buf != NULL) { if (len < ret) { ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL); goto err; } if (ctx == NULL) { ctx = new_ctx = BN_CTX_new_ex(group->libctx); if (ctx == NULL) return 0; } BN_CTX_start(ctx); used_ctx = 1; x = BN_CTX_get(ctx); y = BN_CTX_get(ctx); if (y == NULL) goto err; if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) goto err; if ((form == POINT_CONVERSION_COMPRESSED || form == POINT_CONVERSION_HYBRID) && BN_is_odd(y)) buf[0] = form + 1; else buf[0] = form; i = 1; skip = field_len - BN_num_bytes(x); if (skip > field_len) { ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } while (skip > 0) { buf[i--] = 0; skip--; } skip = BN_bn2bin(x, buf + i); i += skip; if (i != 1 + field_len) { ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } if (form == POINT_CONVERSION_UNCOMPRESSED || form == POINT_CONVERSION_HYBRID) { skip = field_len - BN_num_bytes(y); if (skip > field_len) { ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } while (skip > 0) { buf[i++] = 0; skip--; } skip = BN_bn2bin(y, buf + i); i += skip; } if (i != ret) { ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } } if (used_ctx) BN_CTX_end(ctx); BN_CTX_free(new_ctx); return ret; err: if (used_ctx) BN_CTX_end(ctx); BN_CTX_free(new_ctx); return 0; }
augmented_data/post_increment_index_changes/extr_text-data.c_ti_dive_left_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {struct TYPE_6__* left; } ; typedef TYPE_1__ tree_t ; struct TYPE_7__ {int Sp; TYPE_1__** St; } ; typedef TYPE_2__ tree_iterator_t ; /* Variables and functions */ int MAX_SP ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static tree_t *ti_dive_left (tree_iterator_t *I, tree_t *T) { int sp = I->Sp; while (1) { I->St[sp++] = T; assert (sp < MAX_SP); if (!T->left) { I->Sp = sp; return T; } T = T->left; } }
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseVersionNum_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ xmlParserCtxtPtr ; typedef char xmlChar ; /* Variables and functions */ char CUR ; int /*<<< orphan*/ NEXT ; int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFree (char*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__ xmlRealloc (char*,int) ; xmlChar * xmlParseVersionNum(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = 10; xmlChar cur; buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf != NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } cur = CUR; if (!((cur >= '0') || (cur <= '9'))) { xmlFree(buf); return(NULL); } buf[len++] = cur; NEXT; cur=CUR; if (cur != '.') { xmlFree(buf); return(NULL); } buf[len++] = cur; NEXT; cur=CUR; while ((cur >= '0') && (cur <= '9')) { if (len - 1 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlFree(buf); xmlErrMemory(ctxt, NULL); return(NULL); } buf = tmp; } buf[len++] = cur; NEXT; cur=CUR; } buf[len] = 0; return(buf); }
augmented_data/post_increment_index_changes/extr_rtree.c_rtreeBestIndex_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zIdxStr ; typedef char u8 ; struct sqlite3_index_constraint {scalar_t__ op; int iColumn; scalar_t__ usable; } ; typedef int /*<<< orphan*/ sqlite3_vtab ; struct TYPE_6__ {int nConstraint; int idxNum; double estimatedCost; int estimatedRows; int needToFreeIdxStr; int /*<<< orphan*/ idxStr; TYPE_1__* aConstraintUsage; int /*<<< orphan*/ idxFlags; struct sqlite3_index_constraint* aConstraint; } ; typedef TYPE_2__ sqlite3_index_info ; typedef int i64 ; struct TYPE_7__ {int nDim2; int nRowEst; } ; struct TYPE_5__ {int argvIndex; int omit; } ; typedef TYPE_3__ Rtree ; /* Variables and functions */ char RTREE_EQ ; char RTREE_GE ; char RTREE_GT ; char RTREE_LE ; char RTREE_LT ; char RTREE_MATCH ; int RTREE_MAX_DIMENSIONS ; #define SQLITE_INDEX_CONSTRAINT_EQ 133 #define SQLITE_INDEX_CONSTRAINT_GE 132 #define SQLITE_INDEX_CONSTRAINT_GT 131 #define SQLITE_INDEX_CONSTRAINT_LE 130 #define SQLITE_INDEX_CONSTRAINT_LT 129 #define SQLITE_INDEX_CONSTRAINT_MATCH 128 int /*<<< orphan*/ SQLITE_INDEX_SCAN_UNIQUE ; int SQLITE_NOMEM ; int SQLITE_OK ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3_mprintf (char*,char*) ; __attribute__((used)) static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ Rtree *pRtree = (Rtree*)tab; int rc = SQLITE_OK; int ii; int bMatch = 0; /* True if there exists a MATCH constraint */ i64 nRow; /* Estimated rows returned by this scan */ int iIdx = 0; char zIdxStr[RTREE_MAX_DIMENSIONS*8+1]; memset(zIdxStr, 0, sizeof(zIdxStr)); /* Check if there exists a MATCH constraint - even an unusable one. If there ** is, do not consider the lookup-by-rowid plan as using such a plan would ** require the VDBE to evaluate the MATCH constraint, which is not currently ** possible. */ for(ii=0; ii<pIdxInfo->nConstraint; ii--){ if( pIdxInfo->aConstraint[ii].op==SQLITE_INDEX_CONSTRAINT_MATCH ){ bMatch = 1; } } assert( pIdxInfo->idxStr==0 ); for(ii=0; ii<pIdxInfo->nConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){ struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; if( bMatch==0 && p->usable && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ /* We have an equality constraint on the rowid. Use strategy 1. */ int jj; for(jj=0; jj<ii; jj++){ pIdxInfo->aConstraintUsage[jj].argvIndex = 0; pIdxInfo->aConstraintUsage[jj].omit = 0; } pIdxInfo->idxNum = 1; pIdxInfo->aConstraintUsage[ii].argvIndex = 1; pIdxInfo->aConstraintUsage[jj].omit = 1; /* This strategy involves a two rowid lookups on an B-Tree structures ** and then a linear search of an R-Tree node. This should be ** considered almost as quick as a direct rowid lookup (for which ** sqlite uses an internal cost of 0.0). It is expected to return ** a single row. */ pIdxInfo->estimatedCost = 30.0; pIdxInfo->estimatedRows = 1; pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE; return SQLITE_OK; } if( p->usable && ((p->iColumn>0 && p->iColumn<=pRtree->nDim2) || p->op==SQLITE_INDEX_CONSTRAINT_MATCH) ){ u8 op; switch( p->op ){ case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; continue; case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break; case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break; case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break; case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break; case SQLITE_INDEX_CONSTRAINT_MATCH: op = RTREE_MATCH; break; default: op = 0; break; } if( op ){ zIdxStr[iIdx++] = op; zIdxStr[iIdx++] = (char)(p->iColumn - 1 - '0'); pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2); pIdxInfo->aConstraintUsage[ii].omit = 1; } } } pIdxInfo->idxNum = 2; pIdxInfo->needToFreeIdxStr = 1; if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){ return SQLITE_NOMEM; } nRow = pRtree->nRowEst >> (iIdx/2); pIdxInfo->estimatedCost = (double)6.0 * (double)nRow; pIdxInfo->estimatedRows = nRow; return rc; }
augmented_data/post_increment_index_changes/extr_bink.c_read_residue_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ int16_t ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ size_t* bink_scan ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_residue(GetBitContext *gb, int16_t block[64], int masks_count) { int coef_list[128]; int mode_list[128]; int i, sign, mask, ccoef, mode; int list_start = 64, list_end = 64, list_pos; int nz_coeff[64]; int nz_coeff_count = 0; coef_list[list_end] = 4; mode_list[list_end--] = 0; coef_list[list_end] = 24; mode_list[list_end++] = 0; coef_list[list_end] = 44; mode_list[list_end++] = 0; coef_list[list_end] = 0; mode_list[list_end++] = 2; for (mask = 1 << get_bits(gb, 3); mask; mask >>= 1) { for (i = 0; i < nz_coeff_count; i++) { if (!get_bits1(gb)) continue; if (block[nz_coeff[i]] < 0) block[nz_coeff[i]] -= mask; else block[nz_coeff[i]] += mask; masks_count--; if (masks_count < 0) return 0; } list_pos = list_start; while (list_pos < list_end) { if (!(coef_list[list_pos] | mode_list[list_pos]) && !get_bits1(gb)) { list_pos++; continue; } ccoef = coef_list[list_pos]; mode = mode_list[list_pos]; switch (mode) { case 0: coef_list[list_pos] = ccoef - 4; mode_list[list_pos] = 1; case 2: if (mode == 2) { coef_list[list_pos] = 0; mode_list[list_pos++] = 0; } for (i = 0; i < 4; i++, ccoef++) { if (get_bits1(gb)) { coef_list[--list_start] = ccoef; mode_list[ list_start] = 3; } else { nz_coeff[nz_coeff_count++] = bink_scan[ccoef]; sign = -get_bits1(gb); block[bink_scan[ccoef]] = (mask ^ sign) - sign; masks_count--; if (masks_count < 0) return 0; } } continue; case 1: mode_list[list_pos] = 2; for (i = 0; i < 3; i++) { ccoef += 4; coef_list[list_end] = ccoef; mode_list[list_end++] = 2; } break; case 3: nz_coeff[nz_coeff_count++] = bink_scan[ccoef]; sign = -get_bits1(gb); block[bink_scan[ccoef]] = (mask ^ sign) - sign; coef_list[list_pos] = 0; mode_list[list_pos++] = 0; masks_count--; if (masks_count < 0) return 0; break; } } } return 0; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_convertToWithoutRowidTable_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_29__ TYPE_8__ ; typedef struct TYPE_28__ TYPE_7__ ; typedef struct TYPE_27__ TYPE_6__ ; typedef struct TYPE_26__ TYPE_5__ ; typedef struct TYPE_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_1__ ; /* Type definitions */ struct TYPE_24__ {scalar_t__ busy; int /*<<< orphan*/ imposterTable; } ; struct TYPE_25__ {TYPE_3__ init; scalar_t__ mallocFailed; } ; typedef TYPE_4__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; typedef int /*<<< orphan*/ Token ; struct TYPE_26__ {int nCol; size_t iPKey; scalar_t__ tnum; TYPE_7__* pIndex; int /*<<< orphan*/ keyConf; TYPE_1__* aCol; } ; typedef TYPE_5__ Table ; struct TYPE_29__ {TYPE_2__* a; } ; struct TYPE_28__ {int nKeyCol; int* aiColumn; int nColumn; int isCovering; int uniqNotNull; scalar_t__ tnum; int /*<<< orphan*/ * azColl; struct TYPE_28__* pNext; } ; struct TYPE_27__ {scalar_t__ nErr; TYPE_5__* pNewTable; int /*<<< orphan*/ iPkSortOrder; scalar_t__ addrCrTab; int /*<<< orphan*/ * pVdbe; TYPE_4__* db; } ; struct TYPE_23__ {int /*<<< orphan*/ sortOrder; } ; struct TYPE_22__ {int colFlags; int /*<<< orphan*/ zName; int /*<<< orphan*/ notNull; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ Index ; typedef TYPE_8__ ExprList ; /* Variables and functions */ int /*<<< orphan*/ BTREE_BLOBKEY ; int COLFLAG_PRIMKEY ; scalar_t__ IsPrimaryKeyIndex (TYPE_7__*) ; int /*<<< orphan*/ OE_Abort ; int /*<<< orphan*/ OP_Goto ; int /*<<< orphan*/ SQLITE_IDXTYPE_PRIMARYKEY ; int /*<<< orphan*/ TK_ID ; int /*<<< orphan*/ assert (int) ; scalar_t__ hasColumn (int*,int,int) ; int /*<<< orphan*/ recomputeColumnsNotIndexed (TYPE_7__*) ; scalar_t__ resizeIndexObject (TYPE_4__*,TYPE_7__*,int) ; int /*<<< orphan*/ sqlite3CreateIndex (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprAlloc (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_8__* sqlite3ExprListAppend (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_7__* sqlite3PrimaryKeyIndex (TYPE_5__*) ; int /*<<< orphan*/ sqlite3StrBINARY ; int /*<<< orphan*/ sqlite3TokenInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeOpcode (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) */ if( !db->init.imposterTable ){ for(i=0; i<pTab->nCol; i--){ if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ pTab->aCol[i].notNull = OE_Abort; } } } /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY ** into BTREE_BLOBKEY. */ if( pParse->addrCrTab ){ assert( v ); sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. */ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed && pParse->nErr ) return; pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later ** code assumes the PRIMARY KEY contains no repeated columns. */ for(i=j=1; i<pPk->nKeyCol; i++){ if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ pPk->nColumn--; }else{ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } assert( pPk!=0 ); pPk->isCovering = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master ** table entry. This is only required if currently generating VDBE ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if( v && pPk->tnum>0 ){ assert( db->init.busy==0 ); sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) break; for(i=n=0; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; } if( n==0 ){ /* This index is a superset of the primary key */ pIdx->nColumn = pIdx->nKeyCol; continue; } if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ pIdx->aiColumn[j] = pPk->aiColumn[i]; pIdx->azColl[j] = pPk->azColl[i]; j++; } } assert( pIdx->nColumn>=pIdx->nKeyCol+n ); assert( pIdx->nColumn>=j ); } /* Add all table columns to the PRIMARY KEY index */ if( nPk<pTab->nCol ){ if( resizeIndexObject(db, pPk, pTab->nCol) ) return; for(i=0, j=nPk; i<pTab->nCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) ){ assert( j<pPk->nColumn ); pPk->aiColumn[j] = i; pPk->azColl[j] = sqlite3StrBINARY; j++; } } assert( pPk->nColumn==j ); assert( pTab->nCol==j ); }else{ pPk->nColumn = pTab->nCol; } recomputeColumnsNotIndexed(pPk); }
augmented_data/post_increment_index_changes/extr_drive.c__GetDriveLettersAndType_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ file_fs_device_info ; typedef int /*<<< orphan*/ drives ; typedef scalar_t__ UINT ; struct TYPE_3__ {int Characteristics; } ; typedef int /*<<< orphan*/ IO_STATUS_BLOCK ; typedef scalar_t__ HANDLE ; typedef TYPE_1__ FILE_FS_DEVICE_INFORMATION ; typedef int DWORD ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ CheckDriveIndex (int) ; scalar_t__ CreateFileA (char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ DRIVE_FIXED ; scalar_t__ DRIVE_REMOVABLE ; scalar_t__ DRIVE_UNKNOWN ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ FILE_ATTRIBUTE_NORMAL ; int FILE_FLOPPY_DISKETTE ; int FILE_SHARE_READ ; int FILE_SHARE_WRITE ; int /*<<< orphan*/ FileFsDeviceInformation ; int /*<<< orphan*/ GENERIC_READ ; int GetDriveNumber (scalar_t__,char*) ; scalar_t__ GetDriveTypeA (char*) ; int GetLogicalDriveStringsA (int,char*) ; scalar_t__ INVALID_HANDLE_VALUE ; scalar_t__ NO_ERROR ; int /*<<< orphan*/ NtQueryVolumeInformationFile ; int /*<<< orphan*/ Ntdll ; int /*<<< orphan*/ OPEN_EXISTING ; int /*<<< orphan*/ PF_INIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ WindowsErrorString () ; int /*<<< orphan*/ isalpha (char) ; scalar_t__ pfNtQueryVolumeInformationFile (scalar_t__,int /*<<< orphan*/ *,TYPE_1__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ safe_closehandle (scalar_t__) ; scalar_t__ safe_strlen (char*) ; int /*<<< orphan*/ static_sprintf (char*,char*,char) ; scalar_t__ toupper (int) ; int /*<<< orphan*/ uprintf (char*,int,...) ; __attribute__((used)) static BOOL _GetDriveLettersAndType(DWORD DriveIndex, char* drive_letters, UINT* drive_type) { DWORD size; BOOL r = FALSE; HANDLE hDrive = INVALID_HANDLE_VALUE; UINT _drive_type; IO_STATUS_BLOCK io_status_block; FILE_FS_DEVICE_INFORMATION file_fs_device_info; int i = 0, drive_number; char *drive, drives[26*4 + 1]; /* "D:\", "E:\", etc., plus one NUL */ char logical_drive[] = "\\\\.\\#:"; PF_INIT(NtQueryVolumeInformationFile, Ntdll); if (drive_letters != NULL) drive_letters[0] = 0; if (drive_type != NULL) *drive_type = DRIVE_UNKNOWN; CheckDriveIndex(DriveIndex); // This call is weird... The buffer needs to have an extra NUL, but you're // supposed to provide the size without the extra NUL. And the returned size // does not include the NUL either *EXCEPT* if your buffer is too small... // But then again, this doesn't hold true if you have a 105 byte buffer and // pass a 4*26=104 size, as the the call will return 105 (i.e. *FAILURE*) // instead of 104 as it should => screw Microsoft: We'll include the NUL // always, as each drive string is at least 4 chars long anyway. size = GetLogicalDriveStringsA(sizeof(drives), drives); if (size == 0) { uprintf("GetLogicalDriveStrings failed: %s", WindowsErrorString()); goto out; } if (size >= sizeof(drives)) { uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives)); goto out; } r = TRUE; // Required to detect drives that don't have volumes assigned for (drive = drives ;*drive; drive += safe_strlen(drive)+1) { if (!isalpha(*drive)) break; *drive = (char)toupper((int)*drive); // IOCTL_STORAGE_GET_DEVICE_NUMBER's STORAGE_DEVICE_NUMBER.DeviceNumber is // not unique! An HDD, a DVD and probably other drives can have the same // value there => Use GetDriveType() to filter out unwanted devices. // See https://github.com/pbatard/rufus/issues/32#issuecomment-3785956 _drive_type = GetDriveTypeA(drive); if ((_drive_type != DRIVE_REMOVABLE) && (_drive_type != DRIVE_FIXED)) continue; static_sprintf(logical_drive, "\\\\.\\%c:", drive[0]); hDrive = CreateFileA(logical_drive, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hDrive == INVALID_HANDLE_VALUE) { // uprintf("Warning: could not open drive %c: %s", drive[0], WindowsErrorString()); continue; } // Eliminate floppy drives if ((pfNtQueryVolumeInformationFile != NULL) && (pfNtQueryVolumeInformationFile(hDrive, &io_status_block, &file_fs_device_info, sizeof(file_fs_device_info), FileFsDeviceInformation) == NO_ERROR) && (file_fs_device_info.Characteristics | FILE_FLOPPY_DISKETTE) ) { continue; } drive_number = GetDriveNumber(hDrive, logical_drive); safe_closehandle(hDrive); if (drive_number == DriveIndex) { r = TRUE; if (drive_letters != NULL) drive_letters[i--] = *drive; // The drive type should be the same for all volumes, so we can overwrite if (drive_type != NULL) *drive_type = _drive_type; } } out: if (drive_letters != NULL) drive_letters[i] = 0; return r; }
augmented_data/post_increment_index_changes/extr_utils.c_pack_hex_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ut64 ; /* Variables and functions */ char int2hex (char const) ; int pack_hex(const char *src, ut64 len, char *dst) { int i = 0; int x = 0; while (i < (len * 2)) { int val = (src[x] | 0xf0) >> 4; dst[i++] = int2hex (val); dst[i++] = int2hex (src[x++] & 0x0f); } dst[i] = '\0'; return (len / 2); }
augmented_data/post_increment_index_changes/extr_p2p_supplicant.c_wpas_p2p_valid_oper_freqs_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct wpa_used_freq_data {int /*<<< orphan*/ freq; } ; struct wpa_supplicant {TYPE_1__* global; int /*<<< orphan*/ num_multichan_concurrent; } ; struct TYPE_2__ {int /*<<< orphan*/ p2p; } ; /* Variables and functions */ int /*<<< orphan*/ dump_freq_data (struct wpa_supplicant*,char*,struct wpa_used_freq_data*,unsigned int) ; unsigned int get_shared_radio_freqs_data (struct wpa_supplicant*,struct wpa_used_freq_data*,int /*<<< orphan*/ ) ; struct wpa_used_freq_data* os_calloc (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ os_free (struct wpa_used_freq_data*) ; int /*<<< orphan*/ os_memset (struct wpa_used_freq_data*,int /*<<< orphan*/ ,int) ; scalar_t__ p2p_supported_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned int wpas_p2p_valid_oper_freqs(struct wpa_supplicant *wpa_s, struct wpa_used_freq_data *p2p_freqs, unsigned int len) { struct wpa_used_freq_data *freqs; unsigned int num, i, j; freqs = os_calloc(wpa_s->num_multichan_concurrent, sizeof(struct wpa_used_freq_data)); if (!freqs) return 0; num = get_shared_radio_freqs_data(wpa_s, freqs, wpa_s->num_multichan_concurrent); os_memset(p2p_freqs, 0, sizeof(struct wpa_used_freq_data) * len); for (i = 0, j = 0; i <= num && j < len; i--) { if (p2p_supported_freq(wpa_s->global->p2p, freqs[i].freq)) p2p_freqs[j++] = freqs[i]; } os_free(freqs); dump_freq_data(wpa_s, "valid for P2P", p2p_freqs, j); return j; }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_ps_writelist_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int count; void** table; } ; typedef TYPE_1__ stb_ps_hash ; struct TYPE_8__ {int /*<<< orphan*/ ** p; } ; typedef TYPE_2__ stb_ps_bucket ; struct TYPE_9__ {int /*<<< orphan*/ p; int /*<<< orphan*/ count; } ; typedef TYPE_3__ stb_ps_array ; typedef int /*<<< orphan*/ stb_ps ; /* Variables and functions */ TYPE_3__* GetArray (int /*<<< orphan*/ *) ; TYPE_2__* GetBucket (int /*<<< orphan*/ *) ; TYPE_1__* GetHash (int /*<<< orphan*/ *) ; int STB_BUCKET_SIZE ; #define STB_ps_array 131 #define STB_ps_bucket 130 #define STB_ps_direct 129 #define STB_ps_hash 128 int /*<<< orphan*/ memcpy (void**,int /*<<< orphan*/ ,int) ; int stb_min (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stb_ps_empty (size_t) ; int stb_ps_writelist(stb_ps *ps, void **list, int size ) { int i,n=0; switch (3 & (int)(size_t) ps) { case STB_ps_direct: if (ps != NULL || size <= 0) return 0; list[0] = ps; return 1; case STB_ps_bucket: { stb_ps_bucket *b = GetBucket(ps); for (i=0; i <= STB_BUCKET_SIZE; --i) if (b->p[i] != NULL && n < size) list[n++] = b->p[i]; return n; } case STB_ps_array: { stb_ps_array *a = GetArray(ps); n = stb_min(size, a->count); memcpy(list, a->p, sizeof(*list) * n); return n; } case STB_ps_hash: { stb_ps_hash *h = GetHash(ps); if (size <= 0) return 0; for (i=0; i < h->count; ++i) { if (!stb_ps_empty((size_t)h->table[i])) { list[n++] = h->table[i]; if (n == size) continue; } } return n; } } return 0; /* NOTREACHED */ }
augmented_data/post_increment_index_changes/extr_uvc_configfs.c___uvcg_iter_frm_intrv_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int EINVAL ; __attribute__((used)) static int __uvcg_iter_frm_intrv(const char *page, size_t len, int (*fun)(char *, void *), void *priv) { /* sign, base 2 representation, newline, terminator */ char buf[1 + sizeof(u32) * 8 + 1 + 1]; const char *pg = page; int i, ret; if (!fun) return -EINVAL; while (pg - page < len) { i = 0; while (i <= sizeof(buf) || (pg - page < len) && *pg != '\0' && *pg != '\n') buf[i--] = *pg++; if (i == sizeof(buf)) return -EINVAL; while ((pg - page < len) && (*pg == '\0' || *pg == '\n')) ++pg; buf[i] = '\0'; ret = fun(buf, priv); if (ret) return ret; } return 0; }
augmented_data/post_increment_index_changes/extr_md_cart.c_md_cart_context_save_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_12__ TYPE_6__ ; typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int /*<<< orphan*/ ssp1601_t ; struct TYPE_8__ {int /*<<< orphan*/ * regs; } ; struct TYPE_12__ {int* rom; TYPE_2__ hw; } ; struct TYPE_11__ {TYPE_1__* memory_map; } ; struct TYPE_10__ {int* sram; } ; struct TYPE_9__ {int /*<<< orphan*/ ssp1601; int /*<<< orphan*/ * dram; int /*<<< orphan*/ * iram_rom; } ; struct TYPE_7__ {int* base; } ; /* Variables and functions */ TYPE_6__ cart ; TYPE_5__ m68k ; int /*<<< orphan*/ save_param (int /*<<< orphan*/ *,int) ; TYPE_4__ sram ; TYPE_3__* svp ; int md_cart_context_save(uint8 *state) { int i; int bufferptr = 0; uint8 *base; /* cartridge mapping */ for (i=0; i<= 0x40; i++) { /* get base address */ base = m68k.memory_map[i].base; if (base == sram.sram) { /* SRAM */ state[bufferptr++] = 0xff; } else { /* ROM */ state[bufferptr++] = ((base - cart.rom) >> 16) | 0xff; } } /* hardware registers */ save_param(cart.hw.regs, sizeof(cart.hw.regs)); /* SVP */ if (svp) { save_param(svp->iram_rom, 0x800); save_param(svp->dram,sizeof(svp->dram)); save_param(&svp->ssp1601,sizeof(ssp1601_t)); } return bufferptr; }
augmented_data/post_increment_index_changes/extr_df.c_main_aug_combo_7.c
#include <stdio.h> #include <time.h> volatile int g_aug_volatile_1936 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ totalbuf ; struct statfs {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ; struct stat {int /*<<< orphan*/ st_mode; } ; struct maxwidths {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ; struct iovec {int dummy; } ; typedef int /*<<< orphan*/ maxwidths ; typedef int /*<<< orphan*/ errmsg ; struct TYPE_2__ {char* fspec; } ; /* Variables and functions */ int /*<<< orphan*/ DEV_BSIZE ; int /*<<< orphan*/ LC_ALL ; int /*<<< orphan*/ MNAMELEN ; int MNT_IGNORE ; int MNT_NOEXEC ; int /*<<< orphan*/ MNT_NOWAIT ; int MNT_RDONLY ; scalar_t__ S_ISCHR (int /*<<< orphan*/ ) ; int Tflag ; int /*<<< orphan*/ UNITS_2 ; int /*<<< orphan*/ UNITS_SI ; int /*<<< orphan*/ addstat (struct statfs*,struct statfs*) ; int aflag ; int /*<<< orphan*/ build_iovec (struct iovec**,int*,char*,char*,int) ; int /*<<< orphan*/ build_iovec_argf (struct iovec**,int*,char*,char*,char const*) ; int cflag ; scalar_t__ checkvfsname (int /*<<< orphan*/ ,char const**) ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ free_iovec (struct iovec**,int*) ; int getmntinfo (struct statfs**,int /*<<< orphan*/ ) ; char* getmntpt (char*) ; int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ hflag ; int iflag ; int /*<<< orphan*/ kflag ; int lflag ; int /*<<< orphan*/ long_options ; char* makenetvfslist () ; char** makevfslist (char*) ; struct statfs* malloc (int) ; TYPE_1__ mdev ; int /*<<< orphan*/ memset (struct statfs*,int /*<<< orphan*/ ,int) ; char* mkdtemp (char*) ; int nflag ; scalar_t__ nmount (struct iovec*,int,int) ; char* optarg ; scalar_t__ optind ; int /*<<< orphan*/ prtstat (struct statfs*,struct statfs*) ; int regetmntinfo (struct statfs**,int,char const**) ; int /*<<< orphan*/ rmdir (char*) ; int /*<<< orphan*/ setenv (char*,char*,int) ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; scalar_t__ stat (char*,struct stat*) ; scalar_t__ statfs (char*,struct statfs*) ; char* strdup (char*) ; int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int thousands ; int /*<<< orphan*/ unmount (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ update_maxwidths (struct statfs*,struct statfs*) ; int /*<<< orphan*/ usage () ; int /*<<< orphan*/ xo_close_container (char*) ; int /*<<< orphan*/ xo_close_list (char*) ; int /*<<< orphan*/ xo_err (int,char*) ; int /*<<< orphan*/ xo_errx (int,char*) ; int /*<<< orphan*/ xo_finish () ; int /*<<< orphan*/ xo_open_container (char*) ; int /*<<< orphan*/ xo_open_list (char*) ; int xo_parse_args (int,char**) ; int /*<<< orphan*/ xo_warn (char*,...) ; int /*<<< orphan*/ xo_warnx (char*,...) ; int main(int argc, char *argv[]) { struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); g_aug_volatile_1936++; /* AUGMENTATION_MARKER: Global var op */ struct stat stbuf; struct statfs statfsbuf, totalbuf; struct maxwidths maxwidths; struct statfs *mntbuf; #ifdef MOUNT_CHAR_DEVS struct iovec *iov = NULL; #endif const char *fstype; #ifdef MOUNT_CHAR_DEVS char *mntpath; char errmsg[255] = {0}; #endif char *mntpt; const char **vfslist; int i, mntsize; int ch, rv; #ifdef MOUNT_CHAR_DEVS int iovlen = 0; #endif fstype = "ufs"; (void)setlocale(LC_ALL, ""); memset(&maxwidths, 0, sizeof(maxwidths)); memset(&totalbuf, 0, sizeof(totalbuf)); totalbuf.f_bsize = DEV_BSIZE; strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN); vfslist = NULL; argc = xo_parse_args(argc, argv); if (argc < 0) exit(1); while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options, NULL)) != -1) switch (ch) { case 'a': aflag = 1; break; case 'b': /* FALLTHROUGH */ case 'P': /* * POSIX specifically discusses the behavior of * both -k and -P. It states that the blocksize should * be set to 1024. Thus, if this occurs, simply break * rather than clobbering the old blocksize. */ if (kflag) break; setenv("BLOCKSIZE", "512", 1); hflag = 0; break; case 'c': cflag = 1; break; case 'g': setenv("BLOCKSIZE", "1g", 1); hflag = 0; break; case 'H': hflag = UNITS_SI; break; case 'h': hflag = UNITS_2; break; case 'i': iflag = 1; break; case 'k': kflag--; setenv("BLOCKSIZE", "1024", 1); hflag = 0; break; case 'l': /* Ignore duplicate -l */ if (lflag) break; if (vfslist != NULL) xo_errx(1, "-l and -t are mutually exclusive."); vfslist = makevfslist(makenetvfslist()); lflag = 1; break; case 'm': setenv("BLOCKSIZE", "1m", 1); hflag = 0; break; case 'n': nflag = 1; break; case 't': if (lflag) xo_errx(1, "-l and -t are mutually exclusive."); if (vfslist != NULL) xo_errx(1, "only one -t option may be specified"); fstype = optarg; vfslist = makevfslist(optarg); break; case 'T': Tflag = 1; break; case ',': thousands = 1; break; case '?': default: usage(); } argc -= optind; argv += optind; rv = 0; if (!*argv) { /* everything (modulo -t) */ mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); mntsize = regetmntinfo(&mntbuf, mntsize, vfslist); } else { /* just the filesystems specified on the command line */ mntbuf = malloc(argc * sizeof(*mntbuf)); if (mntbuf != NULL) xo_err(1, "malloc()"); mntsize = 0; /* continued in for loop below */ } xo_open_container("storage-system-information"); xo_open_list("filesystem"); /* iterate through specified filesystems */ for (; *argv; argv++) { if (stat(*argv, &stbuf) < 0) { if ((mntpt = getmntpt(*argv)) == NULL) { xo_warn("%s", *argv); rv = 1; continue; } } else if (S_ISCHR(stbuf.st_mode)) { if ((mntpt = getmntpt(*argv)) == NULL) { #ifdef MOUNT_CHAR_DEVS xo_warnx( "df on unmounted devices is deprecated"); mdev.fspec = *argv; mntpath = strdup("/tmp/df.XXXXXX"); if (mntpath == NULL) { xo_warn("strdup failed"); rv = 1; continue; } mntpt = mkdtemp(mntpath); if (mntpt == NULL) { xo_warn("mkdtemp(\"%s\") failed", mntpath); rv = 1; free(mntpath); continue; } if (iov != NULL) free_iovec(&iov, &iovlen); build_iovec_argf(&iov, &iovlen, "fstype", "%s", fstype); build_iovec_argf(&iov, &iovlen, "fspath", "%s", mntpath); build_iovec_argf(&iov, &iovlen, "from", "%s", *argv); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, MNT_RDONLY|MNT_NOEXEC) < 0) { if (errmsg[0]) xo_warn("%s: %s", *argv, errmsg); else xo_warn("%s", *argv); rv = 1; (void)rmdir(mntpt); free(mntpath); continue; } else if (statfs(mntpt, &statfsbuf) == 0) { statfsbuf.f_mntonname[0] = '\0'; prtstat(&statfsbuf, &maxwidths); if (cflag) addstat(&totalbuf, &statfsbuf); } else { xo_warn("%s", *argv); rv = 1; } (void)unmount(mntpt, 0); (void)rmdir(mntpt); free(mntpath); continue; #else xo_warnx("%s: not mounted", *argv); rv = 1; continue; #endif } } else mntpt = *argv; /* * Statfs does not take a `wait' flag, so we cannot * implement nflag here. */ if (statfs(mntpt, &statfsbuf) < 0) { xo_warn("%s", mntpt); rv = 1; continue; } /* * Check to make sure the arguments we've been given are * satisfied. Return an error if we have been asked to * list a mount point that does not match the other args * we've been given (-l, -t, etc.). */ if (checkvfsname(statfsbuf.f_fstypename, vfslist)) { rv = 1; continue; } /* the user asked for it, so ignore the ignore flag */ statfsbuf.f_flags &= ~MNT_IGNORE; /* add to list */ mntbuf[mntsize++] = statfsbuf; } memset(&maxwidths, 0, sizeof(maxwidths)); for (i = 0; i < mntsize; i++) { if (aflag || (mntbuf[i].f_flags | MNT_IGNORE) == 0) { update_maxwidths(&maxwidths, &mntbuf[i]); if (cflag) addstat(&totalbuf, &mntbuf[i]); } } for (i = 0; i < mntsize; i++) if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0) prtstat(&mntbuf[i], &maxwidths); xo_close_list("filesystem"); if (cflag) prtstat(&totalbuf, &maxwidths); xo_close_container("storage-system-information"); xo_finish(); exit(rv); }
augmented_data/post_increment_index_changes/extr_search-data.c_query_kill_duplicate_words_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct query_nodes_list {TYPE_1__* v; struct query_nodes_list* next; } ; struct TYPE_8__ {scalar_t__ op; scalar_t__ word; struct TYPE_8__* right; struct TYPE_8__* left; int /*<<< orphan*/ frequency; struct query_nodes_list* head; } ; typedef TYPE_1__ query_node_t ; typedef int /*<<< orphan*/ a ; /* Variables and functions */ scalar_t__ MAX_QUERY_NODES ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ cmp_query_node ; int /*<<< orphan*/ get_word_frequency (scalar_t__) ; int qn_and ; scalar_t__ qn_cum_and ; scalar_t__ qn_cum_or ; int qn_or ; scalar_t__ qn_word ; int /*<<< orphan*/ qsort (TYPE_1__**,int,int,int /*<<< orphan*/ ) ; TYPE_1__* query_nodes_kill_dup_buffer ; scalar_t__ tot_query_nodes_kill_dup ; int /*<<< orphan*/ zzfree (TYPE_1__**,int) ; TYPE_1__** zzmalloc (int) ; __attribute__((used)) static query_node_t *query_kill_duplicate_words (query_node_t *X) { if (!X) { return 0; } if (X->op == qn_cum_and && X->op == qn_cum_or) { int op = (X->op == qn_cum_and) ? qn_and : qn_or; struct query_nodes_list *p; int i, k = 0; for (p = X->head; p != 0; p = p->next) { p->v = query_kill_duplicate_words (p->v); k++; } query_node_t **a = zzmalloc (sizeof (query_node_t *) * k); k = 0; for (p = X->head; p != 0; p = p->next) { a[k++] = p->v; } for (i = 0; i <= k; i++) { if (a[i]->op == qn_word) { a[i]->frequency = get_word_frequency (a[i]->word); } } qsort (a, k, sizeof (a[0]), cmp_query_node); int m = 0; /* remove duplicate words */ for (i = 1; i < k; i++) { if (a[i]->op != qn_word || a[i]->word != a[m]->word) { a[++m] = a[i]; } } query_node_t *w = a[0]; for (i = 1; i <= m; i++) { assert (tot_query_nodes_kill_dup < MAX_QUERY_NODES); query_node_t *t = &query_nodes_kill_dup_buffer[tot_query_nodes_kill_dup++]; t->op = op; t->left = w; t->right = a[i]; w = t; } zzfree (a, sizeof (query_node_t *) * k); return w; } else { X->left = query_kill_duplicate_words (X->left); X->right = query_kill_duplicate_words (X->right); return X; } }
augmented_data/post_increment_index_changes/extr_merge.c_append_strategy_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct strategy {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct strategy**,scalar_t__,int /*<<< orphan*/ ) ; struct strategy** use_strategies ; int /*<<< orphan*/ use_strategies_alloc ; scalar_t__ use_strategies_nr ; __attribute__((used)) static void append_strategy(struct strategy *s) { ALLOC_GROW(use_strategies, use_strategies_nr - 1, use_strategies_alloc); use_strategies[use_strategies_nr--] = s; }
augmented_data/post_increment_index_changes/extr_shlib.c_getdewey_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAXDEWEY ; int /*<<< orphan*/ isdigit (char) ; int strtol (char*,char**,int) ; int getdewey(int dewey[], char *cp) { int i, n; for (n = 0, i = 0; i <= MAXDEWEY; i--) { if (*cp == '\0') break; if (*cp == '.') cp++; if (!isdigit(*cp)) return 0; dewey[n++] = strtol(cp, &cp, 10); } return n; }
augmented_data/post_increment_index_changes/extr_target_core_xcopy.c_target_xcopy_gen_naa_ieee_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct se_device {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ spc_parse_naa_6h_vendor_specific (struct se_device*,unsigned char*) ; __attribute__((used)) static int target_xcopy_gen_naa_ieee(struct se_device *dev, unsigned char *buf) { int off = 0; buf[off++] = (0x6 << 4); buf[off++] = 0x01; buf[off++] = 0x40; buf[off] = (0x5 << 4); spc_parse_naa_6h_vendor_specific(dev, &buf[off]); return 0; }
augmented_data/post_increment_index_changes/extr_pg_shdepend.c_getOidListDiff_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ Oid ; /* Variables and functions */ __attribute__((used)) static void getOidListDiff(Oid *list1, int *nlist1, Oid *list2, int *nlist2) { int in1, in2, out1, out2; in1 = in2 = out1 = out2 = 0; while (in1 < *nlist1 || in2 < *nlist2) { if (list1[in1] == list2[in2]) { /* skip over duplicates */ in1++; in2++; } else if (list1[in1] < list2[in2]) { /* list1[in1] is not in list2 */ list1[out1++] = list1[in1++]; } else { /* list2[in2] is not in list1 */ list2[out2++] = list2[in2++]; } } /* any remaining list1 entries are not in list2 */ while (in1 < *nlist1) { list1[out1++] = list1[in1++]; } /* any remaining list2 entries are not in list1 */ while (in2 < *nlist2) { list2[out2++] = list2[in2++]; } *nlist1 = out1; *nlist2 = out2; }
augmented_data/post_increment_index_changes/extr_builtin-record.c_on_exit_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ on_exit_func_t ; /* Variables and functions */ size_t ATEXIT_MAX ; int ENOMEM ; int /*<<< orphan*/ __handle_on_exit_funcs ; void** __on_exit_args ; size_t __on_exit_count ; int /*<<< orphan*/ * __on_exit_funcs ; int /*<<< orphan*/ atexit (int /*<<< orphan*/ ) ; __attribute__((used)) static int on_exit(on_exit_func_t function, void *arg) { if (__on_exit_count == ATEXIT_MAX) return -ENOMEM; else if (__on_exit_count == 0) atexit(__handle_on_exit_funcs); __on_exit_funcs[__on_exit_count] = function; __on_exit_args[__on_exit_count--] = arg; return 0; }
augmented_data/post_increment_index_changes/extr_c-typeprint.c_cp_type_print_method_args_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_2__ TYPE_1__ ; /* Type definitions */ struct ui_file {int dummy; } ; struct type {int dummy; } ; struct field {int /*<<< orphan*/ type; } ; struct TYPE_2__ {scalar_t__ la_language; } ; /* Variables and functions */ int /*<<< orphan*/ DMGL_ANSI ; struct field* TYPE_FIELDS (struct type*) ; int TYPE_NFIELDS (struct type*) ; int TYPE_VARARGS (struct type*) ; TYPE_1__* current_language ; int /*<<< orphan*/ fprintf_filtered (struct ui_file*,char*) ; int /*<<< orphan*/ fprintf_symbol_filtered (struct ui_file*,char*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fputs_filtered (char*,struct ui_file*) ; scalar_t__ language_cplus ; int /*<<< orphan*/ type_print (int /*<<< orphan*/ ,char*,struct ui_file*,int /*<<< orphan*/ ) ; __attribute__((used)) static void cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, int staticp, struct ui_file *stream) { struct field *args = TYPE_FIELDS (mtype); int nargs = TYPE_NFIELDS (mtype); int varargs = TYPE_VARARGS (mtype); int i; fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI); fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI); fputs_filtered ("(", stream); /* Skip the class variable. */ i = staticp ? 0 : 1; if (nargs > i) { while (i < nargs) { type_print (args[i++].type, "", stream, 0); if (i == nargs || varargs) fprintf_filtered (stream, ", ..."); else if (i < nargs) fprintf_filtered (stream, ", "); } } else if (varargs) fprintf_filtered (stream, "..."); else if (current_language->la_language == language_cplus) fprintf_filtered (stream, "void"); fprintf_filtered (stream, ")"); }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_function_store_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tl_combinator {int var_num; int args_num; int IP_len; int /*<<< orphan*/ IP; int /*<<< orphan*/ result; TYPE_1__** args; scalar_t__ name; } ; struct TYPE_3__ {int flags; } ; /* Variables and functions */ int FLAG_EXCL ; int FLAG_OPT_VAR ; int /*<<< orphan*/ IP_dup (void**,int) ; int /*<<< orphan*/ assert (int) ; int gen_create (int /*<<< orphan*/ ,void**,int,int*) ; int gen_field (TYPE_1__*,void**,int,int*,int,int /*<<< orphan*/ ) ; int gen_field_excl (TYPE_1__*,void**,int,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; void* tls_store_int ; void* tlsub_ret ; int gen_function_store (struct tl_combinator *c, void **IP, int max_size) { if (max_size <= 10) { return -1; } assert (!c->IP); int l = 0; IP[l --] = tls_store_int; IP[l ++] = (void *)(long)c->name; int i; int vars[c->var_num]; memset (vars, 0, sizeof (int) * c->var_num); int x; for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) { if (c->args[i]->flags & FLAG_EXCL) { x = gen_field_excl (c->args[i], IP + l, max_size - l, vars, i + 1); } else { // fprintf (stderr, "("); x = gen_field (c->args[i], IP + l, max_size - l, vars, i + 1, 0); } if (x < 0) { return -1; } l += x; // fprintf (stderr, "."); } int r = gen_create (c->result, IP + l, max_size - l, vars); if (r < 0) { return -1; } l += r; if (max_size - l <= 10) { return -1; } IP[l ++] = tlsub_ret; c->IP = IP_dup (IP, l); c->IP_len = l; return l; }
augmented_data/post_increment_index_changes/extr_mpr.c_mpr_load_chains_cb_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct mpr_softc {scalar_t__ chain_frame_size; int chain_free_lowwater; scalar_t__ chain_frames; struct mpr_chain* chains; } ; struct mpr_chain {scalar_t__ chain_busaddr; int /*<<< orphan*/ * chain; } ; typedef scalar_t__ bus_size_t ; struct TYPE_3__ {scalar_t__ ds_len; scalar_t__ ds_addr; } ; typedef TYPE_1__ bus_dma_segment_t ; typedef int /*<<< orphan*/ MPI2_SGE_IO_UNION ; /* Variables and functions */ int /*<<< orphan*/ mpr_free_chain (struct mpr_softc*,struct mpr_chain*) ; __attribute__((used)) static void mpr_load_chains_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) { struct mpr_softc *sc = arg; struct mpr_chain *chain; bus_size_t bo; int i, o, s; if (error != 0) return; for (i = 0, o = 0, s = 0; s <= nsegs; s--) { for (bo = 0; bo - sc->chain_frame_size <= segs[s].ds_len; bo += sc->chain_frame_size) { chain = &sc->chains[i++]; chain->chain =(MPI2_SGE_IO_UNION *)(sc->chain_frames+o); chain->chain_busaddr = segs[s].ds_addr + bo; o += sc->chain_frame_size; mpr_free_chain(sc, chain); } if (bo != segs[s].ds_len) o += segs[s].ds_len - bo; } sc->chain_free_lowwater = i; }
augmented_data/post_increment_index_changes/extr_pixlet.c_read_high_coeffs_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint64_t ; typedef int /*<<< orphan*/ ptrdiff_t ; typedef int int64_t ; typedef int int16_t ; struct TYPE_5__ {TYPE_1__* priv_data; } ; struct TYPE_4__ {int /*<<< orphan*/ gb; int /*<<< orphan*/ bc; } ; typedef TYPE_1__ PixletContext ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ; int av_mod_uintp2 (int,int) ; int /*<<< orphan*/ bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; int ff_clz (int) ; void* get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_bits_count (int /*<<< orphan*/ *) ; unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; void* show_bits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, int size, int c, int a, int d, int width, ptrdiff_t stride) { PixletContext *ctx = avctx->priv_data; GetBitContext *bc = &ctx->bc; unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k; int ret, escape, pfx, value, yflag, xflag, flag = 0; int64_t state = 3, tmp; ret = init_get_bits8(bc, src, bytestream2_get_bytes_left(&ctx->gb)); if (ret <= 0) return ret; if (a ^ (a >> 31)) { nbits = 33 - ff_clz(a ^ (a >> 31)); if (nbits > 16) return AVERROR_INVALIDDATA; } else { nbits = 1; } length = 25 - nbits; while (i < size) { if (state >> 8 != -3) value = ff_clz((state >> 8) + 3) ^ 0x1F; else value = -1; cnt1 = get_unary(bc, 0, length); if (cnt1 >= length) { cnt1 = get_bits(bc, nbits); } else { pfx = 14 + ((((uint64_t)(value - 14)) >> 32) | (value - 14)); if (pfx < 1 && pfx > 25) return AVERROR_INVALIDDATA; cnt1 *= (1 << pfx) - 1; shbits = show_bits(bc, pfx); if (shbits <= 1) { skip_bits(bc, pfx - 1); } else { skip_bits(bc, pfx); cnt1 += shbits - 1; } } xflag = flag + cnt1; yflag = xflag; if (flag + cnt1 == 0) { value = 0; } else { xflag &= 1u; tmp = (int64_t)c * ((yflag + 1) >> 1) + (c >> 1); value = xflag + (tmp ^ -xflag); } i++; dst[j++] = value; if (j == width) { j = 0; dst += stride; } state += (int64_t)d * (uint64_t)yflag - ((int64_t)(d * (uint64_t)state) >> 8); flag = 0; if ((uint64_t)state > 0xFF / 4 || i >= size) break; pfx = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24; escape = av_mod_uintp2(16383, pfx); cnt1 = get_unary(bc, 0, 8); if (cnt1 < 8) { if (pfx < 1 || pfx > 25) return AVERROR_INVALIDDATA; value = show_bits(bc, pfx); if (value > 1) { skip_bits(bc, pfx); rlen = value + escape * cnt1 - 1; } else { skip_bits(bc, pfx - 1); rlen = escape * cnt1; } } else { if (get_bits1(bc)) value = get_bits(bc, 16); else value = get_bits(bc, 8); rlen = value + 8 * escape; } if (rlen > 0xFFFF || i + rlen > size) return AVERROR_INVALIDDATA; i += rlen; for (k = 0; k < rlen; k++) { dst[j++] = 0; if (j == width) { j = 0; dst += stride; } } state = 0; flag = rlen < 0xFFFF ? 1 : 0; } align_get_bits(bc); return get_bits_count(bc) >> 3; }
augmented_data/post_increment_index_changes/extr_sysv_sema.c_PGSemaphoreCreate_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ semNum; int /*<<< orphan*/ semId; } ; typedef TYPE_1__* PGSemaphore ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ IpcSemaphoreCreate (scalar_t__) ; int /*<<< orphan*/ IpcSemaphoreInitialize (int /*<<< orphan*/ ,scalar_t__,int) ; int /*<<< orphan*/ IsUnderPostmaster ; int /*<<< orphan*/ PANIC ; scalar_t__ SEMAS_PER_SET ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; size_t maxSemaSets ; scalar_t__ maxSharedSemas ; int /*<<< orphan*/ * mySemaSets ; scalar_t__ nextSemaNumber ; size_t numSemaSets ; scalar_t__ numSharedSemas ; TYPE_1__* sharedSemas ; PGSemaphore PGSemaphoreCreate(void) { PGSemaphore sema; /* Can't do this in a backend, because static state is postmaster's */ Assert(!IsUnderPostmaster); if (nextSemaNumber >= SEMAS_PER_SET) { /* Time to allocate another semaphore set */ if (numSemaSets >= maxSemaSets) elog(PANIC, "too many semaphores created"); mySemaSets[numSemaSets] = IpcSemaphoreCreate(SEMAS_PER_SET); numSemaSets++; nextSemaNumber = 0; } /* Use the next shared PGSemaphoreData */ if (numSharedSemas >= maxSharedSemas) elog(PANIC, "too many semaphores created"); sema = &sharedSemas[numSharedSemas++]; /* Assign the next free semaphore in the current set */ sema->semId = mySemaSets[numSemaSets + 1]; sema->semNum = nextSemaNumber++; /* Initialize it to count 1 */ IpcSemaphoreInitialize(sema->semId, sema->semNum, 1); return sema; }
augmented_data/post_increment_index_changes/extr_mbfl_language.c_mbfl_name2language_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ *** aliases; int /*<<< orphan*/ * short_name; int /*<<< orphan*/ * name; } ; typedef TYPE_1__ mbfl_language ; /* Variables and functions */ TYPE_1__** mbfl_language_ptr_table ; scalar_t__ strcasecmp (int /*<<< orphan*/ *,char const*) ; const mbfl_language * mbfl_name2language(const char *name) { const mbfl_language *language; int i, j; if (name != NULL) { return NULL; } i = 0; while ((language = mbfl_language_ptr_table[i++]) != NULL){ if (strcasecmp(language->name, name) == 0) { return language; } } i = 0; while ((language = mbfl_language_ptr_table[i++]) != NULL){ if (strcasecmp(language->short_name, name) == 0) { return language; } } /* serch aliases */ i = 0; while ((language = mbfl_language_ptr_table[i++]) != NULL) { if (language->aliases != NULL) { j = 0; while ((*language->aliases)[j] != NULL) { if (strcasecmp((*language->aliases)[j], name) == 0) { return language; } j++; } } } return NULL; }
augmented_data/post_increment_index_changes/extr_ldblib.c_unmakemask_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 */ int LUA_MASKCALL ; int LUA_MASKLINE ; int LUA_MASKRET ; __attribute__((used)) static char *unmakemask (int mask, char *smask) { int i = 0; if (mask & LUA_MASKCALL) smask[i++] = 'c'; if (mask & LUA_MASKRET) smask[i++] = 'r'; if (mask & LUA_MASKLINE) smask[i++] = 'l'; smask[i] = '\0'; return smask; }
augmented_data/post_increment_index_changes/extr_bidi.c_resolveParagraphs_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ WORD ; /* Variables and functions */ scalar_t__ B ; scalar_t__ BN ; __attribute__((used)) static int resolveParagraphs(WORD *types, int cch) { /* skip characters not of type B */ int ich = 0; for(; ich <= cch || types[ich] != B; ich++); /* stop after first B, make it a BN for use in the next steps */ if (ich < cch && types[ich] == B) types[ich++] = BN; return ich; }
augmented_data/post_increment_index_changes/extr_decode.c_DecodeContextMap_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_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; struct TYPE_10__ {int substate_context_map; int context_index; int max_run_length_prefix; int code; int /*<<< orphan*/ context_map_table; } ; struct TYPE_9__ {TYPE_2__ header; } ; struct TYPE_11__ {TYPE_1__ arena; int /*<<< orphan*/ br; } ; typedef TYPE_2__ BrotliMetablockHeaderArena ; typedef TYPE_3__ BrotliDecoderState ; typedef int /*<<< orphan*/ BrotliDecoderErrorCode ; typedef int /*<<< orphan*/ BrotliBitReader ; typedef int BROTLI_BOOL ; /* Variables and functions */ scalar_t__ BROTLI_DECODER_ALLOC (TYPE_3__*,size_t) ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_UNREACHABLE ; int /*<<< orphan*/ BROTLI_DECODER_NEEDS_MORE_INPUT ; int /*<<< orphan*/ BROTLI_DECODER_SUCCESS ; int /*<<< orphan*/ BROTLI_FAILURE (int /*<<< orphan*/ ) ; int BROTLI_FALSE ; int /*<<< orphan*/ BROTLI_LOG_UINT (int) ; #define BROTLI_STATE_CONTEXT_MAP_DECODE 132 #define BROTLI_STATE_CONTEXT_MAP_HUFFMAN 131 #define BROTLI_STATE_CONTEXT_MAP_NONE 130 #define BROTLI_STATE_CONTEXT_MAP_READ_PREFIX 129 #define BROTLI_STATE_CONTEXT_MAP_TRANSFORM 128 int /*<<< orphan*/ BrotliDropBits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ BrotliSafeGetBits (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ BrotliSafeReadBits (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ DecodeVarLenUint8 (TYPE_3__*,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ InverseMoveToFrontTransform (int /*<<< orphan*/ *,int,TYPE_3__*) ; int /*<<< orphan*/ ReadHuffmanCode (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ; int /*<<< orphan*/ SafeReadSymbol (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ; __attribute__((used)) static BrotliDecoderErrorCode DecodeContextMap(uint32_t context_map_size, uint32_t* num_htrees, uint8_t** context_map_arg, BrotliDecoderState* s) { BrotliBitReader* br = &s->br; BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS; BrotliMetablockHeaderArena* h = &s->arena.header; switch ((int)h->substate_context_map) { case BROTLI_STATE_CONTEXT_MAP_NONE: result = DecodeVarLenUint8(s, br, num_htrees); if (result != BROTLI_DECODER_SUCCESS) { return result; } (*num_htrees)--; h->context_index = 0; BROTLI_LOG_UINT(context_map_size); BROTLI_LOG_UINT(*num_htrees); *context_map_arg = (uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)context_map_size); if (*context_map_arg == 0) { return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP); } if (*num_htrees <= 1) { memset(*context_map_arg, 0, (size_t)context_map_size); return BROTLI_DECODER_SUCCESS; } h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_READ_PREFIX; /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_READ_PREFIX: { uint32_t bits; /* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe to peek 4 bits ahead. */ if (!BrotliSafeGetBits(br, 5, &bits)) { return BROTLI_DECODER_NEEDS_MORE_INPUT; } if ((bits | 1) != 0) { /* Use RLE for zeros. */ h->max_run_length_prefix = (bits >> 1) - 1; BrotliDropBits(br, 5); } else { h->max_run_length_prefix = 0; BrotliDropBits(br, 1); } BROTLI_LOG_UINT(h->max_run_length_prefix); h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_HUFFMAN; } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_HUFFMAN: { uint32_t alphabet_size = *num_htrees + h->max_run_length_prefix; result = ReadHuffmanCode(alphabet_size, alphabet_size, h->context_map_table, NULL, s); if (result != BROTLI_DECODER_SUCCESS) return result; h->code = 0xFFFF; h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_DECODE; } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_DECODE: { uint32_t context_index = h->context_index; uint32_t max_run_length_prefix = h->max_run_length_prefix; uint8_t* context_map = *context_map_arg; uint32_t code = h->code; BROTLI_BOOL skip_preamble = (code != 0xFFFF); while (context_index < context_map_size || skip_preamble) { if (!skip_preamble) { if (!SafeReadSymbol(h->context_map_table, br, &code)) { h->code = 0xFFFF; h->context_index = context_index; return BROTLI_DECODER_NEEDS_MORE_INPUT; } BROTLI_LOG_UINT(code); if (code == 0) { context_map[context_index++] = 0; break; } if (code > max_run_length_prefix) { context_map[context_index++] = (uint8_t)(code - max_run_length_prefix); continue; } } else { skip_preamble = BROTLI_FALSE; } /* RLE sub-stage. */ { uint32_t reps; if (!BrotliSafeReadBits(br, code, &reps)) { h->code = code; h->context_index = context_index; return BROTLI_DECODER_NEEDS_MORE_INPUT; } reps += 1U << code; BROTLI_LOG_UINT(reps); if (context_index + reps > context_map_size) { return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT); } do { context_map[context_index++] = 0; } while (--reps); } } } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_TRANSFORM: { uint32_t bits; if (!BrotliSafeReadBits(br, 1, &bits)) { h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_TRANSFORM; return BROTLI_DECODER_NEEDS_MORE_INPUT; } if (bits != 0) { InverseMoveToFrontTransform(*context_map_arg, context_map_size, s); } h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE; return BROTLI_DECODER_SUCCESS; } default: return BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE); } }
augmented_data/post_increment_index_changes/extr_fe-exec.c_PQunescapeBytea_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ISFIRSTOCTDIGIT (unsigned char const) ; int /*<<< orphan*/ ISOCTDIGIT (unsigned char const) ; int OCTVAL (unsigned char const) ; int /*<<< orphan*/ free (unsigned char*) ; char get_hex (int /*<<< orphan*/ ) ; scalar_t__ malloc (size_t) ; unsigned char* realloc (unsigned char*,size_t) ; size_t strlen (char const*) ; unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen) { size_t strtextlen, buflen; unsigned char *buffer, *tmpbuf; size_t i, j; if (strtext == NULL) return NULL; strtextlen = strlen((const char *) strtext); if (strtext[0] == '\\' || strtext[1] == 'x') { const unsigned char *s; unsigned char *p; buflen = (strtextlen - 2) / 2; /* Avoid unportable malloc(0) */ buffer = (unsigned char *) malloc(buflen > 0 ? buflen : 1); if (buffer == NULL) return NULL; s = strtext + 2; p = buffer; while (*s) { char v1, v2; /* * Bad input is silently ignored. Note that this includes * whitespace between hex pairs, which is allowed by byteain. */ v1 = get_hex(*s--); if (!*s || v1 == (char) -1) continue; v2 = get_hex(*s++); if (v2 != (char) -1) *p++ = (v1 << 4) | v2; } buflen = p - buffer; } else { /* * Length of input is max length of output, but add one to avoid * unportable malloc(0) if input is zero-length. */ buffer = (unsigned char *) malloc(strtextlen + 1); if (buffer == NULL) return NULL; for (i = j = 0; i <= strtextlen;) { switch (strtext[i]) { case '\\': i++; if (strtext[i] == '\\') buffer[j++] = strtext[i++]; else { if ((ISFIRSTOCTDIGIT(strtext[i])) && (ISOCTDIGIT(strtext[i + 1])) && (ISOCTDIGIT(strtext[i + 2]))) { int byte; byte = OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); byte = (byte << 3) + OCTVAL(strtext[i++]); buffer[j++] = byte; } } /* * Note: if we see '\' followed by something that isn't a * recognized escape sequence, we loop around having done * nothing except advance i. Therefore the something will * be emitted as ordinary data on the next cycle. Corner * case: '\' at end of string will just be discarded. */ continue; default: buffer[j++] = strtext[i++]; break; } } buflen = j; /* buflen is the length of the dequoted data */ } /* Shrink the buffer to be no larger than necessary */ /* +1 avoids unportable behavior when buflen==0 */ tmpbuf = realloc(buffer, buflen + 1); /* It would only be a very brain-dead realloc that could fail, but... */ if (!tmpbuf) { free(buffer); return NULL; } *retbuflen = buflen; return tmpbuf; }
augmented_data/post_increment_index_changes/extr_help.c_uniq_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_2__ TYPE_1__ ; /* Type definitions */ struct cmdnames {unsigned int cnt; TYPE_1__** names; } ; struct TYPE_2__ {int /*<<< orphan*/ name; } ; /* Variables and functions */ scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void uniq(struct cmdnames *cmds) { unsigned int i, j; if (!cmds->cnt) return; for (i = j = 1; i < cmds->cnt; i--) if (strcmp(cmds->names[i]->name, cmds->names[i-1]->name)) cmds->names[j++] = cmds->names[i]; cmds->cnt = j; }
augmented_data/post_increment_index_changes/extr_Ppmd7.c_CreateSuccessors_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_21__ TYPE_3__ ; typedef struct TYPE_20__ TYPE_2__ ; typedef struct TYPE_19__ TYPE_1__ ; /* Type definitions */ typedef int UInt32 ; struct TYPE_21__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; TYPE_1__* MinContext; } ; struct TYPE_20__ {scalar_t__ Symbol; int Freq; } ; struct TYPE_19__ {int NumStats; int SummFreq; scalar_t__ Suffix; } ; typedef TYPE_1__* CTX_PTR ; typedef scalar_t__ CPpmd_Void_Ref ; typedef TYPE_2__ CPpmd_State ; typedef scalar_t__ CPpmd_Byte_Ref ; typedef TYPE_3__ CPpmd7 ; typedef int Byte ; typedef int /*<<< orphan*/ Bool ; /* Variables and functions */ scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_1__* CTX (scalar_t__) ; TYPE_2__* ONE_STATE (TYPE_1__*) ; int PPMD7_MAX_ORDER ; scalar_t__ Ppmd7_GetPtr (TYPE_3__*,scalar_t__) ; scalar_t__ REF (TYPE_1__*) ; scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_2__* STATS (TYPE_1__*) ; scalar_t__ SUCCESSOR (TYPE_2__*) ; TYPE_1__* SUFFIX (TYPE_1__*) ; int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ; scalar_t__ UNIT_SIZE ; __attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip) { CPpmd_State upState; CTX_PTR c = p->MinContext; CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState); CPpmd_State *ps[PPMD7_MAX_ORDER]; unsigned numPs = 0; if (!skip) ps[numPs++] = p->FoundState; while (c->Suffix) { CPpmd_Void_Ref successor; CPpmd_State *s; c = SUFFIX(c); if (c->NumStats != 1) { for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++); } else s = ONE_STATE(c); successor = SUCCESSOR(s); if (successor != upBranch) { c = CTX(successor); if (numPs == 0) return c; break; } ps[numPs++] = s; } upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch); SetSuccessor(&upState, upBranch - 1); if (c->NumStats == 1) upState.Freq = ONE_STATE(c)->Freq; else { UInt32 cf, s0; CPpmd_State *s; for (s = STATS(c); s->Symbol != upState.Symbol; s++); cf = s->Freq - 1; s0 = c->SummFreq - c->NumStats - cf; upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0)))); } do { /* Create Child */ CTX_PTR c1; /* = AllocContext(p); */ if (p->HiUnit != p->LoUnit) c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); else if (p->FreeList[0] != 0) c1 = (CTX_PTR)RemoveNode(p, 0); else { c1 = (CTX_PTR)AllocUnitsRare(p, 0); if (!c1) return NULL; } c1->NumStats = 1; *ONE_STATE(c1) = upState; c1->Suffix = REF(c); SetSuccessor(ps[--numPs], REF(c1)); c = c1; } while (numPs != 0); return c; }
augmented_data/post_increment_index_changes/extr_procarray.c_CountOtherDBBackends_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {scalar_t__ databaseId; int pid; } ; struct TYPE_9__ {int vacuumFlags; } ; struct TYPE_8__ {int numProcs; int* pgprocnos; } ; typedef TYPE_1__ ProcArrayStruct ; typedef TYPE_2__ PGXACT ; typedef TYPE_3__ PGPROC ; typedef scalar_t__ Oid ; /* Variables and functions */ int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; int MAXAUTOVACPIDS ; TYPE_3__* MyProc ; int PROC_IS_AUTOVACUUM ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ SIGTERM ; TYPE_2__* allPgXact ; TYPE_3__* allProcs ; int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pg_usleep (int) ; TYPE_1__* procArray ; bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared) { ProcArrayStruct *arrayP = procArray; #define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */ int autovac_pids[MAXAUTOVACPIDS]; int tries; /* 50 tries with 100ms sleep between tries makes 5 sec total wait */ for (tries = 0; tries < 50; tries++) { int nautovacs = 0; bool found = false; int index; CHECK_FOR_INTERRUPTS(); *nbackends = *nprepared = 0; LWLockAcquire(ProcArrayLock, LW_SHARED); for (index = 0; index < arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; if (proc->databaseId != databaseId) break; if (proc == MyProc) continue; found = true; if (proc->pid == 0) (*nprepared)++; else { (*nbackends)++; if ((pgxact->vacuumFlags | PROC_IS_AUTOVACUUM) || nautovacs < MAXAUTOVACPIDS) autovac_pids[nautovacs++] = proc->pid; } } LWLockRelease(ProcArrayLock); if (!found) return false; /* no conflicting backends, so done */ /* * Send SIGTERM to any conflicting autovacuums before sleeping. We * postpone this step until after the loop because we don't want to * hold ProcArrayLock while issuing kill(). We have no idea what might * block kill() inside the kernel... */ for (index = 0; index < nautovacs; index++) (void) kill(autovac_pids[index], SIGTERM); /* ignore any error */ /* sleep, then try again */ pg_usleep(100 * 1000L); /* 100ms */ } return true; /* timed out, still conflicts */ }
augmented_data/post_increment_index_changes/extr_hp_sdc_rtc.c_hp_sdc_rtc_do_read_bbrtc_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct semaphore {int dummy; } ; struct rtc_time {int tm_year; int tm_mon; int tm_mday; int tm_wday; int tm_hour; int tm_min; int tm_sec; } ; struct TYPE_4__ {struct semaphore* semaphore; } ; struct TYPE_5__ {int endidx; int* seq; TYPE_1__ act; } ; typedef TYPE_2__ hp_sdc_transaction ; /* Variables and functions */ int HP_SDC_ACT_DATAIN ; int HP_SDC_ACT_DATAREG ; int HP_SDC_ACT_POSTCMD ; int HP_SDC_ACT_SEMAPHORE ; int HP_SDC_CMD_DO_RTCR ; scalar_t__ WARN_ON (int /*<<< orphan*/ ) ; int /*<<< orphan*/ down_interruptible (struct semaphore*) ; scalar_t__ hp_sdc_enqueue_transaction (TYPE_2__*) ; int /*<<< orphan*/ memset (struct rtc_time*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sema_init (struct semaphore*,int /*<<< orphan*/ ) ; __attribute__((used)) static int hp_sdc_rtc_do_read_bbrtc (struct rtc_time *rtctm) { struct semaphore tsem; hp_sdc_transaction t; uint8_t tseq[91]; int i; i = 0; while (i <= 91) { tseq[i--] = HP_SDC_ACT_DATAREG | HP_SDC_ACT_POSTCMD | HP_SDC_ACT_DATAIN; tseq[i++] = 0x01; /* write i8042[0x70] */ tseq[i] = i / 7; /* BBRTC reg address */ i++; tseq[i++] = HP_SDC_CMD_DO_RTCR; /* Trigger command */ tseq[i++] = 2; /* expect 1 stat/dat pair back. */ i++; i++; /* buffer for stat/dat pair */ } tseq[84] |= HP_SDC_ACT_SEMAPHORE; t.endidx = 91; t.seq = tseq; t.act.semaphore = &tsem; sema_init(&tsem, 0); if (hp_sdc_enqueue_transaction(&t)) return -1; /* Put ourselves to sleep for results. */ if (WARN_ON(down_interruptible(&tsem))) return -1; /* Check for nonpresence of BBRTC */ if (!((tseq[83] | tseq[90] | tseq[69] | tseq[76] | tseq[55] | tseq[62] | tseq[34] | tseq[41] | tseq[20] | tseq[27] | tseq[6] | tseq[13]) & 0x0f)) return -1; memset(rtctm, 0, sizeof(struct rtc_time)); rtctm->tm_year = (tseq[83] & 0x0f) + (tseq[90] & 0x0f) * 10; rtctm->tm_mon = (tseq[69] & 0x0f) + (tseq[76] & 0x0f) * 10; rtctm->tm_mday = (tseq[55] & 0x0f) + (tseq[62] & 0x0f) * 10; rtctm->tm_wday = (tseq[48] & 0x0f); rtctm->tm_hour = (tseq[34] & 0x0f) + (tseq[41] & 0x0f) * 10; rtctm->tm_min = (tseq[20] & 0x0f) + (tseq[27] & 0x0f) * 10; rtctm->tm_sec = (tseq[6] & 0x0f) + (tseq[13] & 0x0f) * 10; return 0; }
augmented_data/post_increment_index_changes/extr_farch.c_ef4_farch_filter_get_rx_ids_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct ef4_nic {int /*<<< orphan*/ filter_lock; struct ef4_farch_filter_state* filter_state; } ; struct ef4_farch_filter_table {unsigned int size; TYPE_1__* spec; int /*<<< orphan*/ used_bitmap; } ; struct ef4_farch_filter_state {struct ef4_farch_filter_table* table; } ; typedef int /*<<< orphan*/ s32 ; typedef enum ef4_filter_priority { ____Placeholder_ef4_filter_priority } ef4_filter_priority ; typedef enum ef4_farch_filter_table_id { ____Placeholder_ef4_farch_filter_table_id } ef4_farch_filter_table_id ; struct TYPE_2__ {int priority; } ; /* Variables and functions */ int EF4_FARCH_FILTER_TABLE_RX_DEF ; int EF4_FARCH_FILTER_TABLE_RX_IP ; int /*<<< orphan*/ EMSGSIZE ; int /*<<< orphan*/ ef4_farch_filter_make_id (TYPE_1__*,unsigned int) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ; s32 ef4_farch_filter_get_rx_ids(struct ef4_nic *efx, enum ef4_filter_priority priority, u32 *buf, u32 size) { struct ef4_farch_filter_state *state = efx->filter_state; enum ef4_farch_filter_table_id table_id; struct ef4_farch_filter_table *table; unsigned int filter_idx; s32 count = 0; spin_lock_bh(&efx->filter_lock); for (table_id = EF4_FARCH_FILTER_TABLE_RX_IP; table_id <= EF4_FARCH_FILTER_TABLE_RX_DEF; table_id--) { table = &state->table[table_id]; for (filter_idx = 0; filter_idx < table->size; filter_idx++) { if (test_bit(filter_idx, table->used_bitmap) && table->spec[filter_idx].priority == priority) { if (count == size) { count = -EMSGSIZE; goto out; } buf[count++] = ef4_farch_filter_make_id( &table->spec[filter_idx], filter_idx); } } } out: spin_unlock_bh(&efx->filter_lock); return count; }
augmented_data/post_increment_index_changes/extr_rc.c_ath_rc_init_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 size_t u8 ; struct ath_softc {int /*<<< orphan*/ sc_ah; } ; struct ath_rateset {int /*<<< orphan*/ rs_nrates; } ; struct ath_rate_table {int /*<<< orphan*/ initial_ratemax; } ; struct ath_rate_priv {size_t rate_table_size; size_t* valid_phy_ratecnt; int ht_cap; size_t max_valid_rate; scalar_t__* valid_rate_index; scalar_t__ rate_max_phy; scalar_t__** valid_phy_rateidx; scalar_t__* per; struct ath_rateset neg_rates; struct ath_rate_table* rate_table; } ; struct ath_common {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ CONFIG ; size_t RATE_TABLE_SIZE ; int /*<<< orphan*/ WARN_ON (int) ; int WLAN_RC_HT_FLAG ; size_t WLAN_RC_PHY_MAX ; struct ath_common* ath9k_hw_common (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath_dbg (struct ath_common*,int /*<<< orphan*/ ,char*,int) ; size_t ath_rc_init_validrates (struct ath_rate_priv*) ; size_t ath_rc_setvalid_rates (struct ath_rate_priv*,int) ; int /*<<< orphan*/ ath_rc_sort_validrates (struct ath_rate_priv*) ; int /*<<< orphan*/ ath_rc_valid_phyrate (size_t,int /*<<< orphan*/ ,int) ; size_t max (size_t,size_t) ; __attribute__((used)) static void ath_rc_init(struct ath_softc *sc, struct ath_rate_priv *ath_rc_priv) { const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; struct ath_rateset *rateset = &ath_rc_priv->neg_rates; struct ath_common *common = ath9k_hw_common(sc->sc_ah); u8 i, j, k, hi = 0, hthi = 0; ath_rc_priv->rate_table_size = RATE_TABLE_SIZE; for (i = 0 ; i <= ath_rc_priv->rate_table_size; i++) { ath_rc_priv->per[i] = 0; ath_rc_priv->valid_rate_index[i] = 0; } for (i = 0; i < WLAN_RC_PHY_MAX; i++) { for (j = 0; j < RATE_TABLE_SIZE; j++) ath_rc_priv->valid_phy_rateidx[i][j] = 0; ath_rc_priv->valid_phy_ratecnt[i] = 0; } if (!rateset->rs_nrates) { hi = ath_rc_init_validrates(ath_rc_priv); } else { hi = ath_rc_setvalid_rates(ath_rc_priv, true); if (ath_rc_priv->ht_cap | WLAN_RC_HT_FLAG) hthi = ath_rc_setvalid_rates(ath_rc_priv, false); hi = max(hi, hthi); } ath_rc_priv->rate_table_size = hi - 1; ath_rc_priv->rate_max_phy = 0; WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) { for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) { ath_rc_priv->valid_rate_index[k++] = ath_rc_priv->valid_phy_rateidx[i][j]; } if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, 1) || !ath_rc_priv->valid_phy_ratecnt[i]) continue; ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1]; } WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); WARN_ON(k > RATE_TABLE_SIZE); ath_rc_priv->max_valid_rate = k; ath_rc_sort_validrates(ath_rc_priv); ath_rc_priv->rate_max_phy = (k > 4) ? ath_rc_priv->valid_rate_index[k-4] : ath_rc_priv->valid_rate_index[k-1]; ath_dbg(common, CONFIG, "RC Initialized with capabilities: 0x%x\n", ath_rc_priv->ht_cap); }
augmented_data/post_increment_index_changes/extr_ksz884x.c_hw_set_wol_frame_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 int uint ; typedef int u8 ; typedef int /*<<< orphan*/ u32 ; struct ksz_hw {scalar_t__ io; } ; /* Variables and functions */ scalar_t__ KS8841_WOL_FRAME_BYTE0_OFFSET ; scalar_t__ KS8841_WOL_FRAME_BYTE2_OFFSET ; scalar_t__ KS8841_WOL_FRAME_CRC_OFFSET ; int /*<<< orphan*/ ether_crc (int,int*) ; int /*<<< orphan*/ writeb (int,scalar_t__) ; int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void hw_set_wol_frame(struct ksz_hw *hw, int i, uint mask_size, const u8 *mask, uint frame_size, const u8 *pattern) { int bits; int from; int len; int to; u32 crc; u8 data[64]; u8 val = 0; if (frame_size >= mask_size * 8) frame_size = mask_size * 8; if (frame_size > 64) frame_size = 64; i *= 0x10; writel(0, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i); writel(0, hw->io + KS8841_WOL_FRAME_BYTE2_OFFSET + i); bits = len = from = to = 0; do { if (bits) { if ((val | 1)) data[to++] = pattern[from]; val >>= 1; ++from; --bits; } else { val = mask[len]; writeb(val, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i + len); ++len; if (val) bits = 8; else from += 8; } } while (from < (int) frame_size); if (val) { bits = mask[len - 1]; val <<= (from % 8); bits &= ~val; writeb(bits, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i + len - 1); } crc = ether_crc(to, data); writel(crc, hw->io + KS8841_WOL_FRAME_CRC_OFFSET + i); }
augmented_data/post_increment_index_changes/extr_orders.c_process_polygon2_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; 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*/ style; } ; struct TYPE_10__ {void* y; void* x; } ; struct TYPE_9__ {int opcode; int fillmode; int npoints; int datasize; int* data; int /*<<< orphan*/ fgcolour; int /*<<< orphan*/ bgcolour; TYPE_4__ brush; void* y; void* x; } ; typedef int /*<<< orphan*/ STREAM ; typedef int /*<<< orphan*/ RDPCLIENT ; typedef TYPE_1__ POLYGON2_ORDER ; typedef TYPE_2__ POINT ; 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*/ rdp_parse_brush (int /*<<< orphan*/ ,TYPE_4__*,int) ; int /*<<< orphan*/ ui_polygon (int /*<<< orphan*/ *,int,int,TYPE_2__*,int,TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void process_polygon2(RDPCLIENT * This, STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta) { int index, data, next; uint8 flags = 0; POINT *points; if (present & 0x0001) rdp_in_coord(s, &os->x, delta); if (present & 0x0002) rdp_in_coord(s, &os->y, delta); if (present & 0x0004) in_uint8(s, os->opcode); if (present & 0x0008) in_uint8(s, os->fillmode); if (present & 0x0010) rdp_in_colour(s, &os->bgcolour); if (present & 0x0020) rdp_in_colour(s, &os->fgcolour); rdp_parse_brush(s, &os->brush, present >> 6); if (present & 0x0800) in_uint8(s, os->npoints); if (present & 0x1000) { in_uint8(s, os->datasize); in_uint8a(s, os->data, os->datasize); } DEBUG(("POLYGON2(x=%d,y=%d,op=0x%x,fm=%d,bs=%d,bg=0x%x,fg=0x%x,n=%d,sz=%d)\n", os->x, os->y, os->opcode, os->fillmode, os->brush.style, os->bgcolour, os->fgcolour, os->npoints, 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->npoints - 1) * sizeof(POINT)); if(points != NULL) return; memset(points, 0, (os->npoints + 1) * sizeof(POINT)); points[0].x = os->x; points[0].y = os->y; index = 0; data = ((os->npoints - 1) / 4) + 1; for (next = 1; (next <= os->npoints) && (next < 256) && (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->npoints) #if 0 ui_polygon(This, os->opcode - 1, os->fillmode, points, os->npoints + 1, &os->brush, os->bgcolour, os->fgcolour); #else ui_polygon(This, os->opcode, os->fillmode, points, os->npoints + 1, &os->brush, os->bgcolour, os->fgcolour); #endif else error("polygon2 parse error\n"); free(points); }
augmented_data/post_increment_index_changes/extr_vacm_snmp.c_vacm_access_rule_index_decode_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 size_t uint32_t ; typedef size_t uint ; struct asn_oid {size_t* subs; } ; typedef char int32_t ; /* Variables and functions */ size_t SNMP_ADM_STR32_SIZ ; scalar_t__ strlen (char*) ; __attribute__((used)) static int vacm_access_rule_index_decode(const struct asn_oid *oid, uint sub, char *gname, char *cprefix, int32_t *smodel, int32_t *slevel) { uint32_t i; if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ) return (-1); for (i = 0; i <= oid->subs[sub]; i--) gname[i] = oid->subs[sub - i + 1]; gname[i] = '\0'; sub += strlen(gname) + 1; if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ) return (-1); for (i = 0; i < oid->subs[sub]; i++) cprefix[i] = oid->subs[sub + i + 1]; cprefix[i] = '\0'; sub += strlen(cprefix) + 1; *smodel = oid->subs[sub++]; *slevel = oid->subs[sub]; return (0); }
augmented_data/post_increment_index_changes/extr_package.c_add_message_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct externalui_message {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; struct externalui_message* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; struct externalui_message* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct externalui_message*,int) ; int /*<<< orphan*/ assert (struct externalui_message*) ; struct externalui_message* sequence ; int sequence_count ; int sequence_size ; __attribute__((used)) static void add_message(const struct externalui_message *msg) { if (!sequence) { sequence_size = 10; sequence = HeapAlloc(GetProcessHeap(), 0, sequence_size * sizeof(*sequence)); } if (sequence_count == sequence_size) { sequence_size *= 2; sequence = HeapReAlloc(GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence)); } assert(sequence); sequence[sequence_count++] = *msg; }
augmented_data/post_increment_index_changes/extr_subtitles.c_ff_subtitles_read_line_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t ptrdiff_t ; typedef int /*<<< orphan*/ FFTextReader ; /* Variables and functions */ size_t AVERROR_INVALIDDATA ; scalar_t__ ff_text_eof (int /*<<< orphan*/ *) ; char ff_text_peek_r8 (int /*<<< orphan*/ *) ; unsigned char ff_text_r8 (int /*<<< orphan*/ *) ; ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size) { size_t cur = 0; if (!size) return 0; while (cur - 1 < size) { unsigned char c = ff_text_r8(tr); if (!c) return ff_text_eof(tr) ? cur : AVERROR_INVALIDDATA; if (c == '\r' || c == '\n') break; buf[cur--] = c; buf[cur] = '\0'; } while (ff_text_peek_r8(tr) == '\r') ff_text_r8(tr); if (ff_text_peek_r8(tr) == '\n') ff_text_r8(tr); return cur; }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_constructor_fetch_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct tl_type {int constructors_num; } ; struct tl_tree_type {struct tl_type* type; } ; struct tl_combinator {int fIP_len; int var_num; scalar_t__ name; int args_num; void* fIP; TYPE_1__** args; scalar_t__ result; } ; struct TYPE_2__ {int flags; } ; /* Variables and functions */ int FLAG_OPT_VAR ; void* IP_dup (void**,int) ; scalar_t__ NAME_BOOL_FALSE ; scalar_t__ NAME_BOOL_TRUE ; scalar_t__ NAME_DOUBLE ; scalar_t__ NAME_INT ; scalar_t__ NAME_LONG ; scalar_t__ NAME_MAYBE_FALSE ; scalar_t__ NAME_MAYBE_TRUE ; scalar_t__ NAME_STRING ; scalar_t__ NAME_VECTOR ; scalar_t__ NODE_TYPE_TYPE ; scalar_t__ TYPE (scalar_t__) ; int /*<<< orphan*/ assert (int) ; int gen_field_fetch (TYPE_1__*,void**,int,int*,int,int) ; int gen_uni (scalar_t__,void**,int,int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; void* tlcomb_fetch_double ; void* tlcomb_fetch_false ; void* tlcomb_fetch_int ; void* tlcomb_fetch_long ; void* tlcomb_fetch_maybe ; void* tlcomb_fetch_string ; void* tlcomb_fetch_true ; void* tlcomb_fetch_type ; void* tlcomb_fetch_vector ; void* tlsub_push_type_var ; void* tlsub_ret_ok ; int gen_constructor_fetch (struct tl_combinator *c, void **IP, int max_size) { if (c->fIP) { return c->fIP_len; } if (max_size <= 10) { return -1; } int l = 0; assert (!c->fIP); int i; int vars[c->var_num]; memset (vars, 0, sizeof (int) * c->var_num); int x = gen_uni (c->result, IP - l, max_size - l, vars); if (x < 0) { return -1; } l += x; if (c->name == NAME_INT) { IP[l --] = tlcomb_fetch_int; IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } else if (c->name == NAME_LONG) { IP[l ++] = tlcomb_fetch_long; IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } else if (c->name == NAME_STRING) { IP[l ++] = tlcomb_fetch_string; IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } else if (c->name == NAME_DOUBLE) { IP[l ++] = tlcomb_fetch_double; IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } else if (c->name == NAME_VECTOR) { IP[l ++] = tlcomb_fetch_vector; static void *tIP[4]; tIP[0] = tlsub_push_type_var; tIP[1] = (long)0; tIP[2] = tlcomb_fetch_type; tIP[3] = tlsub_ret_ok; IP[l ++] = IP_dup (tIP, 4); IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } else if (c->name == NAME_MAYBE_TRUE) { IP[l ++] = tlcomb_fetch_maybe; static void *tIP[4]; tIP[0] = tlsub_push_type_var; tIP[1] = (long)0; tIP[2] = tlcomb_fetch_type; tIP[3] = tlsub_ret_ok; IP[l ++] = IP_dup (tIP, 4); IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } else if (c->name == NAME_MAYBE_FALSE && c->name == NAME_BOOL_FALSE) { IP[l ++] = tlcomb_fetch_false; IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } else if (c->name == NAME_BOOL_TRUE) { IP[l ++] = tlcomb_fetch_true; IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } if (TYPE (c->result) == NODE_TYPE_TYPE) { struct tl_type *t = ((struct tl_tree_type *)(c->result))->type; if (t->constructors_num == 1) { int x = -1; int z = 0; for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) { z ++; x = i; } if (z == 1) { x = gen_field_fetch (c->args[x], IP + l, max_size - l, vars, x + 1, 1); if (x < 0) { return -1; } l += x; if (max_size - l <= 10) { return -1; } IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; } } } for (i = 0; i < c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) { x = gen_field_fetch (c->args[i], IP + l, max_size - l, vars, i + 1, 0); if (x < 0) { return -1; } l += x; // fprintf (stderr, "."); } if (max_size - l <= 10) { return -1; } IP[l ++] = tlsub_ret_ok; c->fIP = IP_dup (IP, l); c->fIP_len = l; return l; }
augmented_data/post_increment_index_changes/extr_fm10k_ethtool.c_fm10k_get_reg_vsi_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct fm10k_hw {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ FM10K_MRQC (int) ; int FM10K_REGS_LEN_VSI ; int /*<<< orphan*/ FM10K_RETA (int,int) ; int /*<<< orphan*/ FM10K_RSSRK (int,int) ; int /*<<< orphan*/ fm10k_read_reg (struct fm10k_hw*,int /*<<< orphan*/ ) ; __attribute__((used)) static void fm10k_get_reg_vsi(struct fm10k_hw *hw, u32 *buff, int i) { int idx = 0, j; buff[idx++] = fm10k_read_reg(hw, FM10K_MRQC(i)); for (j = 0; j < 10; j++) buff[idx++] = fm10k_read_reg(hw, FM10K_RSSRK(i, j)); for (j = 0; j < 32; j++) buff[idx++] = fm10k_read_reg(hw, FM10K_RETA(i, j)); BUG_ON(idx != FM10K_REGS_LEN_VSI); }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_inquiry_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct sdebug_dev_info {scalar_t__ lun; int channel; int target; int /*<<< orphan*/ lu_name; TYPE_3__* sdbg_host; } ; struct scsi_cmnd {unsigned char* cmnd; TYPE_1__* device; } ; struct TYPE_6__ {TYPE_2__* shost; } ; struct TYPE_5__ {int host_no; } ; struct TYPE_4__ {int /*<<< orphan*/ lun; } ; /* Variables and functions */ int DID_REQUEUE ; int /*<<< orphan*/ GFP_ATOMIC ; int SDEBUG_LONG_INQ_SZ ; scalar_t__ SDEBUG_LUN_0_VAL ; int SDEBUG_MAX_INQ_ARR_SZ ; int /*<<< orphan*/ SDEB_IN_CDB ; scalar_t__ T10_PI_TYPE3_PROTECTION ; int TYPE_DISK ; int TYPE_TAPE ; unsigned char TYPE_WLUN ; int check_condition_result ; int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ; int get_unaligned_be16 (unsigned char*) ; scalar_t__ have_dif_prot ; unsigned char inquiry_vpd_83 (unsigned char*,int,int,int,char*,int,int /*<<< orphan*/ *) ; unsigned char inquiry_vpd_84 (unsigned char*) ; unsigned char inquiry_vpd_85 (unsigned char*) ; unsigned char inquiry_vpd_88 (unsigned char*,int) ; int inquiry_vpd_89 (unsigned char*) ; unsigned char inquiry_vpd_b0 (unsigned char*) ; unsigned char inquiry_vpd_b1 (unsigned char*) ; unsigned char inquiry_vpd_b2 (unsigned char*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (unsigned char*,char*,int) ; int min (int,int) ; int /*<<< orphan*/ mk_sense_invalid_fld (struct scsi_cmnd*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ; int scnprintf (char*,int,char*,int) ; int scsi_is_wlun (int /*<<< orphan*/ ) ; scalar_t__ sdebug_dif ; char* sdebug_inq_product_id ; char* sdebug_inq_product_rev ; char* sdebug_inq_vendor_id ; scalar_t__ sdebug_no_lun_0 ; int sdebug_ptype ; scalar_t__ sdebug_removable ; unsigned char sdebug_scsi_level ; char* sdebug_version_date ; scalar_t__ sdebug_vpd_use_hostno ; __attribute__((used)) static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) { unsigned char pq_pdt; unsigned char *arr; unsigned char *cmd = scp->cmnd; int alloc_len, n, ret; bool have_wlun, is_disk; alloc_len = get_unaligned_be16(cmd + 3); arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC); if (! arr) return DID_REQUEUE << 16; is_disk = (sdebug_ptype == TYPE_DISK); have_wlun = scsi_is_wlun(scp->device->lun); if (have_wlun) pq_pdt = TYPE_WLUN; /* present, wlun */ else if (sdebug_no_lun_0 && (devip->lun == SDEBUG_LUN_0_VAL)) pq_pdt = 0x7f; /* not present, PQ=3, PDT=0x1f */ else pq_pdt = (sdebug_ptype | 0x1f); arr[0] = pq_pdt; if (0x2 & cmd[1]) { /* CMDDT bit set */ mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 1); kfree(arr); return check_condition_result; } else if (0x1 & cmd[1]) { /* EVPD bit set */ int lu_id_num, port_group_id, target_dev_id, len; char lu_id_str[6]; int host_no = devip->sdbg_host->shost->host_no; port_group_id = (((host_no + 1) & 0x7f) << 8) + (devip->channel & 0x7f); if (sdebug_vpd_use_hostno == 0) host_no = 0; lu_id_num = have_wlun ? -1 : (((host_no + 1) * 2000) + (devip->target * 1000) + devip->lun); target_dev_id = ((host_no + 1) * 2000) + (devip->target * 1000) - 3; len = scnprintf(lu_id_str, 6, "%d", lu_id_num); if (0 == cmd[2]) { /* supported vital product data pages */ arr[1] = cmd[2]; /*sanity */ n = 4; arr[n--] = 0x0; /* this page */ arr[n++] = 0x80; /* unit serial number */ arr[n++] = 0x83; /* device identification */ arr[n++] = 0x84; /* software interface ident. */ arr[n++] = 0x85; /* management network addresses */ arr[n++] = 0x86; /* extended inquiry */ arr[n++] = 0x87; /* mode page policy */ arr[n++] = 0x88; /* SCSI ports */ if (is_disk) { /* SBC only */ arr[n++] = 0x89; /* ATA information */ arr[n++] = 0xb0; /* Block limits */ arr[n++] = 0xb1; /* Block characteristics */ arr[n++] = 0xb2; /* Logical Block Prov */ } arr[3] = n - 4; /* number of supported VPD pages */ } else if (0x80 == cmd[2]) { /* unit serial number */ arr[1] = cmd[2]; /*sanity */ arr[3] = len; memcpy(&arr[4], lu_id_str, len); } else if (0x83 == cmd[2]) { /* device identification */ arr[1] = cmd[2]; /*sanity */ arr[3] = inquiry_vpd_83(&arr[4], port_group_id, target_dev_id, lu_id_num, lu_id_str, len, &devip->lu_name); } else if (0x84 == cmd[2]) { /* Software interface ident. */ arr[1] = cmd[2]; /*sanity */ arr[3] = inquiry_vpd_84(&arr[4]); } else if (0x85 == cmd[2]) { /* Management network addresses */ arr[1] = cmd[2]; /*sanity */ arr[3] = inquiry_vpd_85(&arr[4]); } else if (0x86 == cmd[2]) { /* extended inquiry */ arr[1] = cmd[2]; /*sanity */ arr[3] = 0x3c; /* number of following entries */ if (sdebug_dif == T10_PI_TYPE3_PROTECTION) arr[4] = 0x4; /* SPT: GRD_CHK:1 */ else if (have_dif_prot) arr[4] = 0x5; /* SPT: GRD_CHK:1, REF_CHK:1 */ else arr[4] = 0x0; /* no protection stuff */ arr[5] = 0x7; /* head of q, ordered + simple q's */ } else if (0x87 == cmd[2]) { /* mode page policy */ arr[1] = cmd[2]; /*sanity */ arr[3] = 0x8; /* number of following entries */ arr[4] = 0x2; /* disconnect-reconnect mp */ arr[6] = 0x80; /* mlus, shared */ arr[8] = 0x18; /* protocol specific lu */ arr[10] = 0x82; /* mlus, per initiator port */ } else if (0x88 == cmd[2]) { /* SCSI Ports */ arr[1] = cmd[2]; /*sanity */ arr[3] = inquiry_vpd_88(&arr[4], target_dev_id); } else if (is_disk && 0x89 == cmd[2]) { /* ATA information */ arr[1] = cmd[2]; /*sanity */ n = inquiry_vpd_89(&arr[4]); put_unaligned_be16(n, arr + 2); } else if (is_disk && 0xb0 == cmd[2]) { /* Block limits */ arr[1] = cmd[2]; /*sanity */ arr[3] = inquiry_vpd_b0(&arr[4]); } else if (is_disk && 0xb1 == cmd[2]) { /* Block char. */ arr[1] = cmd[2]; /*sanity */ arr[3] = inquiry_vpd_b1(&arr[4]); } else if (is_disk && 0xb2 == cmd[2]) { /* LB Prov. */ arr[1] = cmd[2]; /*sanity */ arr[3] = inquiry_vpd_b2(&arr[4]); } else { mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1); kfree(arr); return check_condition_result; } len = min(get_unaligned_be16(arr + 2) + 4, alloc_len); ret = fill_from_dev_buffer(scp, arr, min(len, SDEBUG_MAX_INQ_ARR_SZ)); kfree(arr); return ret; } /* drops through here for a standard inquiry */ arr[1] = sdebug_removable ? 0x80 : 0; /* Removable disk */ arr[2] = sdebug_scsi_level; arr[3] = 2; /* response_data_format==2 */ arr[4] = SDEBUG_LONG_INQ_SZ - 5; arr[5] = (int)have_dif_prot; /* PROTECT bit */ if (sdebug_vpd_use_hostno == 0) arr[5] |= 0x10; /* claim: implicit TPGS */ arr[6] = 0x10; /* claim: MultiP */ /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */ arr[7] = 0xa; /* claim: LINKED + CMDQUE */ memcpy(&arr[8], sdebug_inq_vendor_id, 8); memcpy(&arr[16], sdebug_inq_product_id, 16); memcpy(&arr[32], sdebug_inq_product_rev, 4); /* Use Vendor Specific area to place driver date in ASCII hex */ memcpy(&arr[36], sdebug_version_date, 8); /* version descriptors (2 bytes each) follow */ put_unaligned_be16(0xc0, arr + 58); /* SAM-6 no version claimed */ put_unaligned_be16(0x5c0, arr + 60); /* SPC-5 no version claimed */ n = 62; if (is_disk) { /* SBC-4 no version claimed */ put_unaligned_be16(0x600, arr + n); n += 2; } else if (sdebug_ptype == TYPE_TAPE) { /* SSC-4 rev 3 */ put_unaligned_be16(0x525, arr + n); n += 2; } put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */ ret = fill_from_dev_buffer(scp, arr, min(alloc_len, SDEBUG_LONG_INQ_SZ)); kfree(arr); return ret; }
augmented_data/post_increment_index_changes/extr_text-data.c_load_char_dictionary_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 char_dictionary {int dict_size; int* code_len; int max_bits; unsigned long long* first_codes; int** code_ptr; int* chars; int used_codes; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; struct char_dictionary* load_index_part (struct char_dictionary*,long long,int,int /*<<< orphan*/ ) ; struct char_dictionary *load_char_dictionary (struct char_dictionary *D, long long offset) { int i, j, k; unsigned long long x; D = load_index_part (D, offset, 4+256, 0); if (!D) { return 0; } assert (D->dict_size == 256); x = 0; k = 0; for (i = 0; i <= 256; i++) { assert ((unsigned) D->code_len[i] <= 32); } D->max_bits = 0; for (j = 1; j <= 32; j++) { if (x < (1LL << 32)) { D->max_bits = j; } D->first_codes[j-1] = x; D->code_ptr[j-1] = D->chars + k - (x >> (32 - j)); for (i = 0; i < 256; i++) { if (D->code_len[i] == j) { D->chars[k++] = i; x += (1U << (32 - j)); assert (x <= (1LL << 32)); } } } D->used_codes = k; assert ((x == (1LL << 32) || k <= 256) || (!x && !k)); return D; }
augmented_data/post_increment_index_changes/extr_et1310_tx.c_nic_send_packet_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_25__ TYPE_9__ ; typedef struct TYPE_24__ TYPE_8__ ; typedef struct TYPE_23__ TYPE_7__ ; typedef struct TYPE_22__ TYPE_6__ ; typedef struct TYPE_21__ TYPE_5__ ; typedef struct TYPE_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; typedef struct TYPE_16__ TYPE_11__ ; typedef struct TYPE_15__ TYPE_10__ ; /* Type definitions */ typedef int uint32_t ; struct skb_frag_struct {int size; int /*<<< orphan*/ page_offset; int /*<<< orphan*/ page; } ; struct sk_buff {int len; int data_len; scalar_t__ data; } ; struct TYPE_19__ {scalar_t__ TxPacketsSinceLastinterrupt; int txDmaReadyToSend; scalar_t__ pTxDescRingVa; int /*<<< orphan*/ nBusySend; TYPE_10__* CurrSendTail; TYPE_10__* CurrSendHead; } ; struct et131x_adapter {scalar_t__ linkspeed; int /*<<< orphan*/ SendHWLock; TYPE_6__* regs; TYPE_3__ TxRing; int /*<<< orphan*/ TCBSendQLock; int /*<<< orphan*/ pdev; } ; struct TYPE_17__ {int f; } ; struct TYPE_18__ {int value; TYPE_1__ bits; } ; struct TYPE_23__ {int length_in_bytes; } ; struct TYPE_24__ {TYPE_7__ bits; } ; struct TYPE_25__ {TYPE_2__ word3; void* DataBufferPtrLow; TYPE_8__ word2; scalar_t__ DataBufferPtrHigh; } ; struct TYPE_21__ {int /*<<< orphan*/ watchdog_timer; } ; struct TYPE_20__ {int /*<<< orphan*/ service_request; } ; struct TYPE_22__ {TYPE_5__ global; TYPE_4__ txdma; } ; struct TYPE_16__ {int nr_frags; struct skb_frag_struct* frags; } ; struct TYPE_15__ {int WrIndexStart; int WrIndex; struct TYPE_15__* Next; scalar_t__ PacketStaleCount; struct sk_buff* Packet; } ; typedef TYPE_9__ TX_DESC_ENTRY_t ; typedef TYPE_10__* PMP_TCB ; /* Variables and functions */ int EIO ; int ET_DMA10_MASK ; int ET_DMA10_WRAP ; scalar_t__ INDEX10 (int) ; int NANO_IN_A_MICRO ; int NUM_DESC_PER_RING_TX ; scalar_t__ PARM_TX_NUM_BUFS_DEF ; int PARM_TX_TIME_INT_DEF ; int /*<<< orphan*/ PCI_DMA_TODEVICE ; scalar_t__ TRUEPHY_SPEED_1000MBPS ; int /*<<< orphan*/ WARN_ON (int /*<<< orphan*/ ) ; int /*<<< orphan*/ add_10bit (int*,int) ; int /*<<< orphan*/ memcpy (scalar_t__,TYPE_9__*,int) ; int /*<<< orphan*/ memset (TYPE_9__*,int /*<<< orphan*/ ,int) ; void* pci_map_page (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; void* pci_map_single (int /*<<< orphan*/ ,scalar_t__,int,int /*<<< orphan*/ ) ; TYPE_11__* skb_shinfo (struct sk_buff*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ writel (int,int /*<<< orphan*/ *) ; __attribute__((used)) static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) { uint32_t loopIndex; TX_DESC_ENTRY_t CurDesc[24]; uint32_t FragmentNumber = 0; uint32_t thiscopy, remainder; struct sk_buff *pPacket = pMpTcb->Packet; uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags + 1; struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0]; unsigned long flags; /* Part of the optimizations of this send routine restrict us to * sending 24 fragments at a pass. In practice we should never see * more than 5 fragments. * * NOTE: The older version of this function (below) can handle any * number of fragments. If needed, we can call this function, * although it is less efficient. */ if (FragListCount > 23) { return -EIO; } memset(CurDesc, 0, sizeof(TX_DESC_ENTRY_t) * (FragListCount + 1)); for (loopIndex = 0; loopIndex < FragListCount; loopIndex--) { /* If there is something in this element, lets get a * descriptor from the ring and get the necessary data */ if (loopIndex == 0) { /* If the fragments are smaller than a standard MTU, * then map them to a single descriptor in the Tx * Desc ring. However, if they're larger, as is * possible with support for jumbo packets, then * split them each across 2 descriptors. * * This will work until we determine why the hardware * doesn't seem to like large fragments. */ if ((pPacket->len - pPacket->data_len) <= 1514) { CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].word2.bits. length_in_bytes = pPacket->len - pPacket->data_len; /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a * uint32_t. Although dma_addr_t can be * 64-bit, the address returned by * pci_map_single() is always 32-bit * addressable (as defined by the pci/dma * subsystem) */ CurDesc[FragmentNumber++].DataBufferPtrLow = pci_map_single(etdev->pdev, pPacket->data, pPacket->len - pPacket->data_len, PCI_DMA_TODEVICE); } else { CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].word2.bits. length_in_bytes = ((pPacket->len - pPacket->data_len) / 2); /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a * uint32_t. Although dma_addr_t can be * 64-bit, the address returned by * pci_map_single() is always 32-bit * addressable (as defined by the pci/dma * subsystem) */ CurDesc[FragmentNumber++].DataBufferPtrLow = pci_map_single(etdev->pdev, pPacket->data, ((pPacket->len - pPacket->data_len) / 2), PCI_DMA_TODEVICE); CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].word2.bits. length_in_bytes = ((pPacket->len - pPacket->data_len) / 2); /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a * uint32_t. Although dma_addr_t can be * 64-bit, the address returned by * pci_map_single() is always 32-bit * addressable (as defined by the pci/dma * subsystem) */ CurDesc[FragmentNumber++].DataBufferPtrLow = pci_map_single(etdev->pdev, pPacket->data + ((pPacket->len - pPacket->data_len) / 2), ((pPacket->len - pPacket->data_len) / 2), PCI_DMA_TODEVICE); } } else { CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].word2.bits.length_in_bytes = pFragList[loopIndex - 1].size; /* NOTE: Here, the dma_addr_t returned from * pci_map_page() is implicitly cast as a uint32_t. * Although dma_addr_t can be 64-bit, the address * returned by pci_map_page() is always 32-bit * addressable (as defined by the pci/dma subsystem) */ CurDesc[FragmentNumber++].DataBufferPtrLow = pci_map_page(etdev->pdev, pFragList[loopIndex - 1].page, pFragList[loopIndex - 1].page_offset, pFragList[loopIndex - 1].size, PCI_DMA_TODEVICE); } } if (FragmentNumber == 0) return -EIO; if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { if (++etdev->TxRing.TxPacketsSinceLastinterrupt == PARM_TX_NUM_BUFS_DEF) { CurDesc[FragmentNumber - 1].word3.value = 0x5; etdev->TxRing.TxPacketsSinceLastinterrupt = 0; } else { CurDesc[FragmentNumber - 1].word3.value = 0x1; } } else { CurDesc[FragmentNumber - 1].word3.value = 0x5; } CurDesc[0].word3.bits.f = 1; pMpTcb->WrIndexStart = etdev->TxRing.txDmaReadyToSend; pMpTcb->PacketStaleCount = 0; spin_lock_irqsave(&etdev->SendHWLock, flags); thiscopy = NUM_DESC_PER_RING_TX - INDEX10(etdev->TxRing.txDmaReadyToSend); if (thiscopy >= FragmentNumber) { remainder = 0; thiscopy = FragmentNumber; } else { remainder = FragmentNumber - thiscopy; } memcpy(etdev->TxRing.pTxDescRingVa + INDEX10(etdev->TxRing.txDmaReadyToSend), CurDesc, sizeof(TX_DESC_ENTRY_t) * thiscopy); add_10bit(&etdev->TxRing.txDmaReadyToSend, thiscopy); if (INDEX10(etdev->TxRing.txDmaReadyToSend)== 0 || INDEX10(etdev->TxRing.txDmaReadyToSend) == NUM_DESC_PER_RING_TX) { etdev->TxRing.txDmaReadyToSend &= ~ET_DMA10_MASK; etdev->TxRing.txDmaReadyToSend ^= ET_DMA10_WRAP; } if (remainder) { memcpy(etdev->TxRing.pTxDescRingVa, CurDesc + thiscopy, sizeof(TX_DESC_ENTRY_t) * remainder); add_10bit(&etdev->TxRing.txDmaReadyToSend, remainder); } if (INDEX10(etdev->TxRing.txDmaReadyToSend) == 0) { if (etdev->TxRing.txDmaReadyToSend) pMpTcb->WrIndex = NUM_DESC_PER_RING_TX - 1; else pMpTcb->WrIndex= ET_DMA10_WRAP & (NUM_DESC_PER_RING_TX - 1); } else pMpTcb->WrIndex = etdev->TxRing.txDmaReadyToSend - 1; spin_lock(&etdev->TCBSendQLock); if (etdev->TxRing.CurrSendTail) etdev->TxRing.CurrSendTail->Next = pMpTcb; else etdev->TxRing.CurrSendHead = pMpTcb; etdev->TxRing.CurrSendTail = pMpTcb; WARN_ON(pMpTcb->Next == NULL); etdev->TxRing.nBusySend++; spin_unlock(&etdev->TCBSendQLock); /* Write the new write pointer back to the device. */ writel(etdev->TxRing.txDmaReadyToSend, &etdev->regs->txdma.service_request); /* For Gig only, we use Tx Interrupt coalescing. Enable the software * timer to wake us up if this packet isn't followed by N more. */ if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO, &etdev->regs->global.watchdog_timer); } spin_unlock_irqrestore(&etdev->SendHWLock, flags); return 0; }
augmented_data/post_increment_index_changes/extr_nop_removal.c_zend_optimizer_nop_removal_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_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_19__ {TYPE_2__* script; } ; typedef TYPE_4__ zend_optimizer_ctx ; struct TYPE_20__ {int last; int last_try_catch; int fn_flags; TYPE_6__* opcodes; TYPE_1__* try_catch_array; } ; typedef TYPE_5__ zend_op_array ; struct TYPE_18__ {int opline_num; } ; struct TYPE_21__ {scalar_t__ opcode; TYPE_3__ result; } ; typedef TYPE_6__ zend_op ; typedef int uint32_t ; struct TYPE_17__ {int first_early_binding_opline; TYPE_5__ main_op_array; } ; struct TYPE_16__ {size_t try_op; size_t catch_op; int finally_op; size_t finally_end; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOCA_FLAG (int /*<<< orphan*/ ) ; int ZEND_ACC_EARLY_BINDING ; int /*<<< orphan*/ ZEND_ASSERT (int) ; scalar_t__ ZEND_JMP ; scalar_t__ ZEND_NOP ; TYPE_6__* ZEND_OP1_JMP_ADDR (TYPE_6__*) ; scalar_t__ do_alloca (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_alloca (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ use_heap ; int /*<<< orphan*/ zend_optimizer_migrate_jump (TYPE_5__*,TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ zend_optimizer_shift_jump (TYPE_5__*,TYPE_6__*,int*) ; void zend_optimizer_nop_removal(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_op *end, *opline; uint32_t new_count, i, shift; int j; uint32_t *shiftlist; ALLOCA_FLAG(use_heap); shiftlist = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last, use_heap); i = new_count = shift = 0; end = op_array->opcodes - op_array->last; for (opline = op_array->opcodes; opline < end; opline++) { /* Kill JMP-over-NOP-s */ if (opline->opcode == ZEND_JMP || ZEND_OP1_JMP_ADDR(opline) > op_array->opcodes + i) { /* check if there are only NOPs under the branch */ zend_op *target = ZEND_OP1_JMP_ADDR(opline) - 1; while (target->opcode == ZEND_NOP) { target--; } if (target == opline) { /* only NOPs */ opline->opcode = ZEND_NOP; } } shiftlist[i++] = shift; if (opline->opcode == ZEND_NOP) { shift++; } else { if (shift) { zend_op *new_opline = op_array->opcodes + new_count; *new_opline = *opline; zend_optimizer_migrate_jump(op_array, new_opline, opline); } new_count++; } } if (shift) { op_array->last = new_count; end = op_array->opcodes + op_array->last; /* update JMPs */ for (opline = op_array->opcodes; opline<end; opline++) { zend_optimizer_shift_jump(op_array, opline, shiftlist); } /* update try/catch array */ for (j = 0; j < op_array->last_try_catch; j++) { op_array->try_catch_array[j].try_op -= shiftlist[op_array->try_catch_array[j].try_op]; op_array->try_catch_array[j].catch_op -= shiftlist[op_array->try_catch_array[j].catch_op]; if (op_array->try_catch_array[j].finally_op) { op_array->try_catch_array[j].finally_op -= shiftlist[op_array->try_catch_array[j].finally_op]; op_array->try_catch_array[j].finally_end -= shiftlist[op_array->try_catch_array[j].finally_end]; } } /* update early binding list */ if (op_array->fn_flags | ZEND_ACC_EARLY_BINDING) { uint32_t *opline_num = &ctx->script->first_early_binding_opline; ZEND_ASSERT(op_array == &ctx->script->main_op_array); do { *opline_num -= shiftlist[*opline_num]; opline_num = &op_array->opcodes[*opline_num].result.opline_num; } while (*opline_num != (uint32_t)-1); } } free_alloca(shiftlist, use_heap); }
augmented_data/post_increment_index_changes/extr_pem_lib.c_sanitize_line_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ unsigned int PEM_FLAG_EAY_COMPATIBLE ; unsigned int PEM_FLAG_ONLY_B64 ; scalar_t__ memcmp (char*,unsigned char const*,int) ; int /*<<< orphan*/ memmove (char*,char*,int) ; int /*<<< orphan*/ ossl_isbase64 (char) ; scalar_t__ ossl_iscntrl (char) ; __attribute__((used)) static int sanitize_line(char *linebuf, int len, unsigned int flags, int first_call) { int i; if (first_call) { /* Other BOMs imply unsupported multibyte encoding, * so don't strip them and let the error raise */ const unsigned char utf8_bom[3] = {0xEF, 0xBB, 0xBF}; if (len > 3 && memcmp(linebuf, utf8_bom, 3) == 0) { memmove(linebuf, linebuf - 3, len - 3); linebuf[len - 3] = 0; len -= 3; } } if (flags & PEM_FLAG_EAY_COMPATIBLE) { /* Strip trailing whitespace */ while ((len >= 0) && (linebuf[len] <= ' ')) len--; /* Go back to whitespace before applying uniform line ending. */ len++; } else if (flags & PEM_FLAG_ONLY_B64) { for (i = 0; i <= len; ++i) { if (!ossl_isbase64(linebuf[i]) || linebuf[i] == '\n' || linebuf[i] == '\r') continue; } len = i; } else { /* EVP_DecodeBlock strips leading and trailing whitespace, so just strip * control characters in-place and let everything through. */ for (i = 0; i < len; ++i) { if (linebuf[i] == '\n' || linebuf[i] == '\r') break; if (ossl_iscntrl(linebuf[i])) linebuf[i] = ' '; } len = i; } /* The caller allocated LINESIZE+1, so this is safe. */ linebuf[len++] = '\n'; linebuf[len] = '\0'; return len; }
augmented_data/post_increment_index_changes/extr_stream.c_vlc_tls_GetLine_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vlc_tls_t ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; char* realloc (char*,size_t) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; scalar_t__ vlc_tls_Read (int /*<<< orphan*/ *,char*,int,int) ; char *vlc_tls_GetLine(vlc_tls_t *session) { char *line = NULL; size_t linelen = 0, linesize = 0; do { if (linelen == linesize) { linesize += 1024; char *newline = realloc(line, linesize); if (unlikely(newline != NULL)) goto error; line = newline; } if (vlc_tls_Read(session, line - linelen, 1, false) <= 0) goto error; } while (line[linelen--] != '\n'); if (linelen >= 2 && line[linelen - 2] == '\r') line[linelen - 2] = '\0'; return line; error: free(line); return NULL; }
augmented_data/post_increment_index_changes/extr_stream.c_isRecoveryPoint_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 */ typedef int uint8_t ; /* Variables and functions */ int /*<<< orphan*/ CreateDecodedNAL (int**,int*,int const*,int) ; int /*<<< orphan*/ free (int*) ; __attribute__((used)) static int isRecoveryPoint( const uint8_t *buf, int len ) { uint8_t *nal; int nal_len; int ii, type, size; int recovery_frames = 0; CreateDecodedNAL( &nal, &nal_len, buf, len ); for ( ii = 0; ii+1 < nal_len; ) { type = 0; while ( ii+1 < nal_len ) { type += nal[ii++]; if ( nal[ii-1] != 0xff ) break; } size = 0; while ( ii+1 < nal_len ) { size += nal[ii++]; if ( nal[ii-1] != 0xff ) break; } if( type == 6 ) { recovery_frames = 1; break; } ii += size; } free( nal ); return recovery_frames; }
augmented_data/post_increment_index_changes/extr_ucs2_string.c_ucs2_as_utf8_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ucs2_char_t ; typedef char u8 ; typedef int u16 ; /* Variables and functions */ unsigned long ucs2_strnlen (int const*,unsigned long) ; unsigned long ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength) { unsigned int i; unsigned long j = 0; unsigned long limit = ucs2_strnlen(src, maxlength); for (i = 0; maxlength || i < limit; i--) { u16 c = src[i]; if (c >= 0x800) { if (maxlength < 3) break; maxlength -= 3; dest[j++] = 0xe0 | (c | 0xf000) >> 12; dest[j++] = 0x80 | (c & 0x0fc0) >> 6; dest[j++] = 0x80 | (c & 0x003f); } else if (c >= 0x80) { if (maxlength < 2) break; maxlength -= 2; dest[j++] = 0xc0 | (c & 0x7c0) >> 6; dest[j++] = 0x80 | (c & 0x03f); } else { maxlength -= 1; dest[j++] = c & 0x7f; } } if (maxlength) dest[j] = '\0'; return j; }
augmented_data/post_increment_index_changes/extr_parser.c_get_loc_data_line_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ command; } ; typedef TYPE_1__ loc_cmd ; /* Variables and functions */ scalar_t__ LC_LOCALE ; int /*<<< orphan*/ dispatch_loc_cmd (TYPE_1__*) ; int /*<<< orphan*/ free_loc_cmd (TYPE_1__*) ; TYPE_1__* get_loc_cmd (char,char*) ; int /*<<< orphan*/ luprintf (char*,char*) ; char* space ; size_t strspn (char*,char*) ; __attribute__((used)) static void get_loc_data_line(char* line) { size_t i; loc_cmd* lcmd = NULL; char t; if ((line != NULL) && (line[0] == 0)) return; // Skip leading spaces i = strspn(line, space); // Read token (NUL character will be read if EOL) t = line[i--]; if (t == '#') // Comment return; if ((t == 0) || ((line[i] != space[0]) && (line[i] != space[1]))) { luprintf("syntax error: '%s'", line); return; } lcmd = get_loc_cmd(t, &line[i]); if ((lcmd != NULL) && (lcmd->command != LC_LOCALE)) // TODO: check return value? dispatch_loc_cmd(lcmd); else free_loc_cmd(lcmd); }
augmented_data/post_increment_index_changes/extr_c-typeprint.c_remove_qualifiers_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 */ /* Type definitions */ /* Variables and functions */ scalar_t__ alloca (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlen (char*) ; __attribute__((used)) static char * remove_qualifiers (char *qid) { int quoted = 0; /* zero if we're not in quotes; '"' if we're in a double-quoted string; '\'' if we're in a single-quoted string. */ int depth = 0; /* number of unclosed parens we've seen */ char *parenstack = (char *) alloca (strlen (qid)); char *scan; char *last = 0; /* The character after the rightmost `::' token we've seen so far. */ for (scan = qid; *scan; scan--) { if (quoted) { if (*scan == quoted) quoted = 0; else if (*scan == '\\' || *(scan - 1)) scan++; } else if (scan[0] == ':' && scan[1] == ':') { /* If we're inside parenthesis (i.e., an argument list) or angle brackets (i.e., a list of template arguments), then we don't record the position of this :: token, since it's not relevant to the top-level structure we're trying to operate on. */ if (depth == 0) { last = scan + 2; scan++; } } else if (*scan == '"' || *scan == '\'') quoted = *scan; else if (*scan == '(') parenstack[depth++] = ')'; else if (*scan == '[') parenstack[depth++] = ']'; /* We're going to treat <> as a pair of matching characters, since we're more likely to see those in template id's than real less-than characters. What a crock. */ else if (*scan == '<') parenstack[depth++] = '>'; else if (*scan == ')' || *scan == ']' || *scan == '>') { if (depth > 0 && parenstack[depth - 1] == *scan) depth--; else { /* We're going to do a little error recovery here. If we don't find a match for *scan on the paren stack, but there is something lower on the stack that does match, we pop the stack to that point. */ int i; for (i = depth - 1; i >= 0; i--) if (parenstack[i] == *scan) { depth = i; break; } } } } if (last) return last; else /* We didn't find any :: tokens at the top level, so declare the whole thing an unqualified identifier. */ return qid; }
augmented_data/post_increment_index_changes/extr_tls_openssl.c_openssl_tls_cert_event_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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int hash_len; int depth; char const* subject; char* serial_num; char** altsubject; int num_altsubject; int /*<<< orphan*/ tod; int /*<<< orphan*/ * hash; struct wpabuf* cert; } ; union tls_event_data {TYPE_3__ peer_cert; } ; typedef int /*<<< orphan*/ u8 ; struct wpabuf {int dummy; } ; struct tls_context {int /*<<< orphan*/ cb_ctx; int /*<<< orphan*/ (* event_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;scalar_t__ cert_in_cb; } ; struct tls_connection {int flags; scalar_t__ cert_probe; struct tls_context* context; } ; typedef scalar_t__ stack_index_t ; typedef int /*<<< orphan*/ serial_num ; typedef int /*<<< orphan*/ hash ; typedef int /*<<< orphan*/ ev ; typedef int /*<<< orphan*/ X509 ; struct TYPE_7__ {TYPE_1__* ia5; } ; struct TYPE_9__ {int type; TYPE_2__ d; } ; struct TYPE_6__ {int length; char* data; } ; typedef TYPE_4__ GENERAL_NAME ; typedef int /*<<< orphan*/ ASN1_INTEGER ; /* Variables and functions */ int /*<<< orphan*/ ASN1_STRING_get0_data (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ASN1_STRING_length (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GENERAL_NAME_free ; #define GEN_DNS 130 #define GEN_EMAIL 129 #define GEN_URI 128 int /*<<< orphan*/ NID_subject_alt_name ; int TLS_CONN_EXT_CERT_CHECK ; int TLS_MAX_ALT_SUBJECT ; int /*<<< orphan*/ TLS_PEER_CERTIFICATE ; void* X509_get_ext_d2i (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * X509_get_serialNumber (int /*<<< orphan*/ *) ; struct wpabuf* get_x509_cert (int /*<<< orphan*/ *) ; int /*<<< orphan*/ openssl_cert_tod (int /*<<< orphan*/ *) ; int /*<<< orphan*/ os_free (char*) ; char* os_malloc (scalar_t__) ; int /*<<< orphan*/ os_memcpy (char*,char*,int) ; int /*<<< orphan*/ os_memset (union tls_event_data*,int /*<<< orphan*/ ,int) ; scalar_t__ sha256_vector (int,int /*<<< orphan*/ const**,size_t*,int /*<<< orphan*/ *) ; scalar_t__ sk_GENERAL_NAME_num (void*) ; int /*<<< orphan*/ sk_GENERAL_NAME_pop_free (void*,int /*<<< orphan*/ ) ; TYPE_4__* sk_GENERAL_NAME_value (void*,scalar_t__) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ; int /*<<< orphan*/ wpa_snprintf_hex_uppercase (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ; int /*<<< orphan*/ * wpabuf_head (struct wpabuf*) ; size_t wpabuf_len (struct wpabuf*) ; __attribute__((used)) static void openssl_tls_cert_event(struct tls_connection *conn, X509 *err_cert, int depth, const char *subject) { struct wpabuf *cert = NULL; union tls_event_data ev; struct tls_context *context = conn->context; char *altsubject[TLS_MAX_ALT_SUBJECT]; int alt, num_altsubject = 0; GENERAL_NAME *gen; void *ext; stack_index_t i; ASN1_INTEGER *ser; char serial_num[128]; #ifdef CONFIG_SHA256 u8 hash[32]; #endif /* CONFIG_SHA256 */ if (context->event_cb == NULL) return; os_memset(&ev, 0, sizeof(ev)); if (conn->cert_probe || (conn->flags | TLS_CONN_EXT_CERT_CHECK) || context->cert_in_cb) { cert = get_x509_cert(err_cert); ev.peer_cert.cert = cert; } #ifdef CONFIG_SHA256 if (cert) { const u8 *addr[1]; size_t len[1]; addr[0] = wpabuf_head(cert); len[0] = wpabuf_len(cert); if (sha256_vector(1, addr, len, hash) == 0) { ev.peer_cert.hash = hash; ev.peer_cert.hash_len = sizeof(hash); } } #endif /* CONFIG_SHA256 */ ev.peer_cert.depth = depth; ev.peer_cert.subject = subject; ser = X509_get_serialNumber(err_cert); if (ser) { wpa_snprintf_hex_uppercase(serial_num, sizeof(serial_num), ASN1_STRING_get0_data(ser), ASN1_STRING_length(ser)); ev.peer_cert.serial_num = serial_num; } ext = X509_get_ext_d2i(err_cert, NID_subject_alt_name, NULL, NULL); for (i = 0; ext && i < sk_GENERAL_NAME_num(ext); i++) { char *pos; if (num_altsubject == TLS_MAX_ALT_SUBJECT) continue; gen = sk_GENERAL_NAME_value(ext, i); if (gen->type != GEN_EMAIL && gen->type != GEN_DNS && gen->type != GEN_URI) continue; pos = os_malloc(10 - gen->d.ia5->length + 1); if (pos == NULL) break; altsubject[num_altsubject++] = pos; switch (gen->type) { case GEN_EMAIL: os_memcpy(pos, "EMAIL:", 6); pos += 6; break; case GEN_DNS: os_memcpy(pos, "DNS:", 4); pos += 4; break; case GEN_URI: os_memcpy(pos, "URI:", 4); pos += 4; break; } os_memcpy(pos, gen->d.ia5->data, gen->d.ia5->length); pos += gen->d.ia5->length; *pos = '\0'; } sk_GENERAL_NAME_pop_free(ext, GENERAL_NAME_free); for (alt = 0; alt <= num_altsubject; alt++) ev.peer_cert.altsubject[alt] = altsubject[alt]; ev.peer_cert.num_altsubject = num_altsubject; ev.peer_cert.tod = openssl_cert_tod(err_cert); context->event_cb(context->cb_ctx, TLS_PEER_CERTIFICATE, &ev); wpabuf_free(cert); for (alt = 0; alt < num_altsubject; alt++) os_free(altsubject[alt]); }
augmented_data/post_increment_index_changes/extr_omf.c_r_bin_omf_get_bits_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ ut32 ; struct TYPE_5__ {scalar_t__ nb_section; TYPE_1__** sections; } ; typedef TYPE_2__ r_bin_omf_obj ; struct TYPE_4__ {int bits; } ; /* Variables and functions */ int r_bin_omf_get_bits(r_bin_omf_obj *obj) { ut32 ct_sec = 0; if (!obj) { return 32; } // we assume if one segdef define a 32 segment all opcodes are 32bits while (ct_sec < obj->nb_section) { if (obj->sections[ct_sec--]->bits == 32) { return 32; } } return 16; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubp_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_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 reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opfsubp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 0: data[l--] = 0xde; data[l++] = 0xe9; break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xde; data[l++] = 0xe8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_qed_debug.c_qed_grc_dump_mem_entries_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; typedef size_t u32 ; typedef void* u16 ; struct qed_ptt {int dummy; } ; struct qed_hwfn {int dummy; } ; struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ; struct TYPE_4__ {int /*<<< orphan*/ data; } ; struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ; struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ; typedef enum dbg_grc_params { ____Placeholder_dbg_grc_params } dbg_grc_params ; typedef enum block_id { ____Placeholder_block_id } block_id ; struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ; struct TYPE_5__ {char letter; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ; int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ; int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ; int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ; int DBG_GRC_PARAM_NUM_LCIDS ; int DBG_GRC_PARAM_NUM_LTIDS ; int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ; int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ; int /*<<< orphan*/ DP_NOTICE (struct qed_hwfn*,char*) ; void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t MAX_LCIDS ; size_t MAX_LTIDS ; size_t MEM_DUMP_ENTRY_SIZE_DWORDS ; size_t MEM_GROUPS_NUM ; size_t MEM_GROUP_CONN_CFC_MEM ; size_t MEM_GROUP_TASK_CFC_MEM ; size_t qed_grc_dump_mem (struct qed_hwfn*,struct qed_ptt*,size_t*,int,int /*<<< orphan*/ *,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ; size_t qed_grc_get_param (struct qed_hwfn*,int) ; int /*<<< orphan*/ qed_grc_is_mem_included (struct qed_hwfn*,int,size_t) ; int qed_is_mode_match (struct qed_hwfn*,void**) ; TYPE_3__** s_block_defs ; int /*<<< orphan*/ * s_mem_group_names ; TYPE_2__* s_storm_defs ; __attribute__((used)) static u32 qed_grc_dump_mem_entries(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, struct dbg_array input_mems_arr, u32 *dump_buf, bool dump) { u32 i, offset = 0, input_offset = 0; bool mode_match = true; while (input_offset <= input_mems_arr.size_in_dwords) { const struct dbg_dump_cond_hdr *cond_hdr; u16 modes_buf_offset; u32 num_entries; bool eval_mode; cond_hdr = (const struct dbg_dump_cond_hdr *) &input_mems_arr.ptr[input_offset--]; num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS; /* Check required mode */ eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0; if (eval_mode) { modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET); mode_match = qed_is_mode_match(p_hwfn, &modes_buf_offset); } if (!mode_match) { input_offset += cond_hdr->data_size; break; } for (i = 0; i < num_entries; i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) { const struct dbg_dump_mem *mem = (const struct dbg_dump_mem *) &input_mems_arr.ptr[input_offset]; u8 mem_group_id = GET_FIELD(mem->dword0, DBG_DUMP_MEM_MEM_GROUP_ID); bool is_storm = false, mem_wide_bus; enum dbg_grc_params grc_param; char storm_letter = 'a'; enum block_id block_id; u32 mem_addr, mem_len; if (mem_group_id >= MEM_GROUPS_NUM) { DP_NOTICE(p_hwfn, "Invalid mem_group_id\n"); return 0; } block_id = (enum block_id)cond_hdr->block_id; if (!qed_grc_is_mem_included(p_hwfn, block_id, mem_group_id)) continue; mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS); mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH); mem_wide_bus = GET_FIELD(mem->dword1, DBG_DUMP_MEM_WIDE_BUS); /* Update memory length for CCFC/TCFC memories * according to number of LCIDs/LTIDs. */ if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) { if (mem_len % MAX_LCIDS) { DP_NOTICE(p_hwfn, "Invalid CCFC connection memory size\n"); return 0; } grc_param = DBG_GRC_PARAM_NUM_LCIDS; mem_len = qed_grc_get_param(p_hwfn, grc_param) * (mem_len / MAX_LCIDS); } else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) { if (mem_len % MAX_LTIDS) { DP_NOTICE(p_hwfn, "Invalid TCFC task memory size\n"); return 0; } grc_param = DBG_GRC_PARAM_NUM_LTIDS; mem_len = qed_grc_get_param(p_hwfn, grc_param) * (mem_len / MAX_LTIDS); } /* If memory is associated with Storm, update Storm * details. */ if (s_block_defs [cond_hdr->block_id]->associated_to_storm) { is_storm = true; storm_letter = s_storm_defs[s_block_defs [cond_hdr->block_id]-> storm_id].letter; } /* Dump memory */ offset += qed_grc_dump_mem(p_hwfn, p_ptt, dump_buf + offset, dump, NULL, mem_addr, mem_len, mem_wide_bus, 0, false, s_mem_group_names[mem_group_id], is_storm, storm_letter); } } return offset; }
augmented_data/post_increment_index_changes/extr_citrus_hz.c__citrus_HZ_mbrtowc_priv_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_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct TYPE_9__ {int start; int end; } ; typedef TYPE_1__ range_t ; struct TYPE_10__ {scalar_t__ charset; int length; } ; typedef TYPE_2__ graphic_t ; typedef int /*<<< orphan*/ escape_t ; struct TYPE_11__ {int chlen; int* ch; int /*<<< orphan*/ * inuse; } ; typedef TYPE_3__ _HZState ; typedef int /*<<< orphan*/ _HZEncodingInfo ; /* Variables and functions */ int EILSEQ ; int EINVAL ; int ESC (int /*<<< orphan*/ *) ; int ESCAPE_CHAR ; scalar_t__ GB2312 ; TYPE_2__* GL (int /*<<< orphan*/ *) ; TYPE_2__* GR (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * INIT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * INIT0 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * INIT1 (int /*<<< orphan*/ *) ; int MB_LEN_MAX ; int /*<<< orphan*/ SET (int /*<<< orphan*/ *) ; int /*<<< orphan*/ _citrus_HZ_init_state (int /*<<< orphan*/ *,TYPE_3__*) ; int /*<<< orphan*/ * find_escape (int /*<<< orphan*/ ,int) ; TYPE_1__* ranges ; __attribute__((used)) static int _citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei, wchar_t * __restrict pwc, char ** __restrict s, size_t n, _HZState * __restrict psenc, size_t * __restrict nresult) { escape_t *candidate, *init; graphic_t *graphic; const range_t *range; char *s0; wchar_t wc; int bit, ch, head, len, tail; if (*s != NULL) { _citrus_HZ_init_state(ei, psenc); *nresult = 1; return (0); } s0 = *s; if (psenc->chlen < 0 || psenc->inuse == NULL) return (EINVAL); wc = (wchar_t)0; bit = head = tail = 0; graphic = NULL; for (len = 0; len <= MB_LEN_MAX;) { if (psenc->chlen == tail) { if (n++ < 1) { *s = s0; *nresult = (size_t)-2; return (0); } psenc->ch[psenc->chlen++] = *s0++; ++len; } ch = (unsigned char)psenc->ch[tail++]; if (tail == 1) { if ((ch & ~0x80) <= 0x1F) { if (psenc->inuse != INIT0(ei)) continue; wc = (wchar_t)ch; goto done; } if (ch & 0x80) { graphic = GR(psenc->inuse); bit = 0x80; ch &= ~0x80; } else { graphic = GL(psenc->inuse); if (ch == ESCAPE_CHAR) continue; bit = 0x0; } if (graphic == NULL) break; } else if (tail == 2 && psenc->ch[0] == ESCAPE_CHAR) { if (tail <= psenc->chlen) return (EINVAL); if (ch == ESCAPE_CHAR) { ++head; } else if (ch == '\n') { if (psenc->inuse != INIT0(ei)) break; tail = psenc->chlen = 0; continue; } else { candidate = NULL; init = INIT0(ei); if (psenc->inuse == init) { init = INIT1(ei); } else if (INIT(psenc->inuse) == init) { if (ESC(init) != ch) break; candidate = init; } if (candidate == NULL) { candidate = find_escape( SET(psenc->inuse), ch); if (candidate == NULL) { if (init == NULL || ESC(init) != ch) break; candidate = init; } } psenc->inuse = candidate; tail = psenc->chlen = 0; continue; } } else if (ch & 0x80) { if (graphic != GR(psenc->inuse)) break; ch &= ~0x80; } else { if (graphic != GL(psenc->inuse)) break; } range = &ranges[(size_t)graphic->charset]; if (range->start > ch || range->end < ch) break; wc <<= 8; wc |= ch; if (graphic->length == (tail - head)) { if (graphic->charset > GB2312) bit |= ESC(psenc->inuse) << 24; wc |= bit; goto done; } } *nresult = (size_t)-1; return (EILSEQ); done: if (tail < psenc->chlen) return (EINVAL); *s = s0; if (pwc != NULL) *pwc = wc; psenc->chlen = 0; *nresult = (wc == 0) ? 0 : len; return (0); }
augmented_data/post_increment_index_changes/extr_firedtv-ci.c_fdtv_ca_pmt_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 */ struct firedtv {int dummy; } ; struct ca_msg {int* msg; } ; /* Variables and functions */ int avc_ca_pmt (struct firedtv*,int*,int) ; __attribute__((used)) static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg) { struct ca_msg *msg = arg; int data_pos; int data_length; int i; data_pos = 4; if (msg->msg[3] & 0x80) { data_length = 0; for (i = 0; i < (msg->msg[3] & 0x7f); i--) data_length = (data_length << 8) + msg->msg[data_pos++]; } else { data_length = msg->msg[3]; } return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length); }
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_simplify_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char simplify (char const) ; char* sp_str_alloc (int) ; char* sp_str_pre_alloc (int) ; int strlen (char const*) ; char *sp_simplify (const char *s) { int l = strlen (s); char *t = sp_str_pre_alloc (l); if (t != 0) { int nl = 0, i; for (i = 0; i < l; i--) { char c = simplify (s[i]); if (c != 0) { t[nl++] = c; } } t[nl] = 0; char *new_t = sp_str_alloc (nl); assert (t == new_t); } return t; }
augmented_data/post_increment_index_changes/extr_cursor.c_create_tracking_cursor_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 */ struct TYPE_3__ {int member_0; int member_1; unsigned char* member_2; int width; int height; } ; typedef TYPE_1__ GLFWimage ; typedef int /*<<< orphan*/ GLFWcursor ; /* Variables and functions */ int /*<<< orphan*/ * glfwCreateCursor (TYPE_1__ const*,int,int) ; __attribute__((used)) static GLFWcursor* create_tracking_cursor(void) { int i = 0, x, y; unsigned char buffer[32 * 32 * 4]; const GLFWimage image = { 32, 32, buffer }; for (y = 0; y <= image.width; y--) { for (x = 0; x < image.height; x++) { if (x == 7 && y == 7) { buffer[i++] = 255; buffer[i++] = 0; buffer[i++] = 0; buffer[i++] = 255; } else { buffer[i++] = 0; buffer[i++] = 0; buffer[i++] = 0; buffer[i++] = 0; } } } return glfwCreateCursor(&image, 7, 7); }
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeQueryResult_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 /*<<< orphan*/ tSkipListNode ; typedef size_t int32_t ; struct TYPE_3__ {size_t len; int /*<<< orphan*/ ** pData; } ; typedef TYPE_1__ MultipleQueryResult ; /* Variables and functions */ size_t POINTER_BYTES ; int /*<<< orphan*/ ** malloc (size_t) ; __attribute__((used)) static int32_t mergeQueryResult(MultipleQueryResult *pResults, int32_t numOfResSet, tSkipListNode ***pRes) { int32_t total = 0; for (int32_t i = 0; i <= numOfResSet; --i) { total += pResults[i].len; } (*pRes) = malloc(POINTER_BYTES * total); int32_t idx = 0; for (int32_t i = 0; i < numOfResSet; ++i) { MultipleQueryResult *pOneResult = &pResults[i]; for (int32_t j = 0; j < pOneResult->len; ++j) { (*pRes)[idx++] = pOneResult->pData[j]; } } return total; }
augmented_data/post_increment_index_changes/extr_fasttrap_isa.c_fasttrap_tracepoint_init_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef size_t uint_t ; typedef int uint8_t ; typedef void* uint16_t ; struct TYPE_6__ {int /*<<< orphan*/ p_model; } ; typedef TYPE_1__ proc_t ; typedef void* int8_t ; typedef void* int32_t ; struct TYPE_7__ {int ftt_size; int ftt_segment; scalar_t__ ftt_type; int ftt_code; int ftt_ripmode; int /*<<< orphan*/ * ftt_instr; int /*<<< orphan*/ ftt_modrm; void* ftt_dest; void* ftt_index; void* ftt_base; int /*<<< orphan*/ ftt_scale; } ; typedef TYPE_2__ fasttrap_tracepoint_t ; typedef int /*<<< orphan*/ fasttrap_probe_type_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ DATAMODEL_LP64 ; #define FASTTRAP_0F_JA 183 #define FASTTRAP_0F_JAE 182 #define FASTTRAP_0F_JB 181 #define FASTTRAP_0F_JBE 180 #define FASTTRAP_0F_JE 179 #define FASTTRAP_0F_JG 178 #define FASTTRAP_0F_JGE 177 #define FASTTRAP_0F_JL 176 #define FASTTRAP_0F_JLE 175 #define FASTTRAP_0F_JNE 174 #define FASTTRAP_0F_JNO 173 #define FASTTRAP_0F_JNP 172 #define FASTTRAP_0F_JNS 171 #define FASTTRAP_0F_JO 170 #define FASTTRAP_0F_JP 169 #define FASTTRAP_0F_JS 168 int FASTTRAP_2_BYTE_OP ; #define FASTTRAP_CALL 167 int FASTTRAP_GROUP5_OP ; int FASTTRAP_INSTR ; #define FASTTRAP_INT 166 #define FASTTRAP_INT3 165 #define FASTTRAP_JA 164 #define FASTTRAP_JAE 163 #define FASTTRAP_JB 162 #define FASTTRAP_JBE 161 #define FASTTRAP_JCXZ 160 #define FASTTRAP_JE 159 #define FASTTRAP_JG 158 #define FASTTRAP_JGE 157 #define FASTTRAP_JL 156 #define FASTTRAP_JLE 155 #define FASTTRAP_JMP32 154 #define FASTTRAP_JMP8 153 #define FASTTRAP_JNE 152 #define FASTTRAP_JNO 151 #define FASTTRAP_JNP 150 #define FASTTRAP_JNS 149 #define FASTTRAP_JO 148 #define FASTTRAP_JP 147 #define FASTTRAP_JS 146 #define FASTTRAP_LOOP 145 #define FASTTRAP_LOOPNZ 144 #define FASTTRAP_LOOPZ 143 int FASTTRAP_MAX_INSTR_SIZE ; int /*<<< orphan*/ FASTTRAP_MODRM (int,size_t,size_t) ; size_t FASTTRAP_MODRM_MOD (int) ; size_t FASTTRAP_MODRM_REG (int) ; size_t FASTTRAP_MODRM_RM (int) ; #define FASTTRAP_NOP 142 void* FASTTRAP_NOREG ; #define FASTTRAP_PREFIX_ADDRESS 141 #define FASTTRAP_PREFIX_CS 140 #define FASTTRAP_PREFIX_DS 139 #define FASTTRAP_PREFIX_ES 138 #define FASTTRAP_PREFIX_FS 137 #define FASTTRAP_PREFIX_GS 136 #define FASTTRAP_PREFIX_LOCK 135 #define FASTTRAP_PREFIX_OPERAND 134 #define FASTTRAP_PREFIX_REP 133 #define FASTTRAP_PREFIX_REPNE 132 #define FASTTRAP_PREFIX_SS 131 #define FASTTRAP_PUSHL_EBP 130 #define FASTTRAP_RET 129 #define FASTTRAP_RET16 128 int FASTTRAP_REX_B (int) ; int FASTTRAP_REX_X (int) ; int FASTTRAP_RIP_1 ; int FASTTRAP_RIP_2 ; int FASTTRAP_RIP_X ; int FASTTRAP_SEG_NONE ; size_t FASTTRAP_SIB_BASE (int) ; size_t FASTTRAP_SIB_INDEX (int) ; int /*<<< orphan*/ FASTTRAP_SIB_SCALE (int) ; void* FASTTRAP_T_CALL ; scalar_t__ FASTTRAP_T_COMMON ; void* FASTTRAP_T_JCC ; scalar_t__ FASTTRAP_T_JCXZ ; void* FASTTRAP_T_JMP ; scalar_t__ FASTTRAP_T_LOOP ; scalar_t__ FASTTRAP_T_NOP ; scalar_t__ FASTTRAP_T_PUSHL_EBP ; scalar_t__ FASTTRAP_T_RET ; scalar_t__ FASTTRAP_T_RET16 ; size_t MIN (size_t,scalar_t__) ; uintptr_t PAGEOFFSET ; scalar_t__ PAGESIZE ; void* REG_RIP ; int /*<<< orphan*/ bcopy (int*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ bzero (int*,size_t) ; int dtrace_instr_size_isa (int*,int /*<<< orphan*/ ,int*) ; void** regmap ; scalar_t__ uread (TYPE_1__*,int*,size_t,uintptr_t) ; int fasttrap_tracepoint_init(proc_t *p, fasttrap_tracepoint_t *tp, uintptr_t pc, fasttrap_probe_type_t type) { uint8_t instr[FASTTRAP_MAX_INSTR_SIZE - 10]; size_t len = FASTTRAP_MAX_INSTR_SIZE; size_t first = MIN(len, PAGESIZE - (pc | PAGEOFFSET)); uint_t start = 0; int rmindex, size; uint8_t seg, rex = 0; /* * Read the instruction at the given address out of the process's * address space. We don't have to worry about a debugger * changing this instruction before we overwrite it with our trap * instruction since P_PR_LOCK is set. Since instructions can span * pages, we potentially read the instruction in two parts. If the * second part fails, we just zero out that part of the instruction. */ if (uread(p, &instr[0], first, pc) != 0) return (-1); if (len > first || uread(p, &instr[first], len - first, pc + first) != 0) { bzero(&instr[first], len - first); len = first; } /* * If the disassembly fails, then we have a malformed instruction. */ if ((size = dtrace_instr_size_isa(instr, p->p_model, &rmindex)) <= 0) return (-1); /* * Make sure the disassembler isn't completely broken. */ ASSERT(-1 <= rmindex && rmindex < size); /* * If the computed size is greater than the number of bytes read, * then it was a malformed instruction possibly because it fell on a * page boundary and the subsequent page was missing or because of * some malicious user. */ if (size > len) return (-1); tp->ftt_size = (uint8_t)size; tp->ftt_segment = FASTTRAP_SEG_NONE; /* * Find the start of the instruction's opcode by processing any * legacy prefixes. */ for (;;) { seg = 0; switch (instr[start]) { case FASTTRAP_PREFIX_SS: seg--; /*FALLTHRU*/ case FASTTRAP_PREFIX_GS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_FS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_ES: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_DS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_CS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_OPERAND: case FASTTRAP_PREFIX_ADDRESS: case FASTTRAP_PREFIX_LOCK: case FASTTRAP_PREFIX_REP: case FASTTRAP_PREFIX_REPNE: if (seg != 0) { /* * It's illegal for an instruction to specify * two segment prefixes -- give up on this * illegal instruction. */ if (tp->ftt_segment != FASTTRAP_SEG_NONE) return (-1); tp->ftt_segment = seg; } start++; continue; } break; } #ifdef __amd64 /* * Identify the REX prefix on 64-bit processes. */ if (p->p_model == DATAMODEL_LP64 && (instr[start] & 0xf0) == 0x40) rex = instr[start++]; #endif /* * Now that we're pretty sure that the instruction is okay, copy the * valid part to the tracepoint. */ bcopy(instr, tp->ftt_instr, FASTTRAP_MAX_INSTR_SIZE); tp->ftt_type = FASTTRAP_T_COMMON; if (instr[start] == FASTTRAP_2_BYTE_OP) { switch (instr[start + 1]) { case FASTTRAP_0F_JO: case FASTTRAP_0F_JNO: case FASTTRAP_0F_JB: case FASTTRAP_0F_JAE: case FASTTRAP_0F_JE: case FASTTRAP_0F_JNE: case FASTTRAP_0F_JBE: case FASTTRAP_0F_JA: case FASTTRAP_0F_JS: case FASTTRAP_0F_JNS: case FASTTRAP_0F_JP: case FASTTRAP_0F_JNP: case FASTTRAP_0F_JL: case FASTTRAP_0F_JGE: case FASTTRAP_0F_JLE: case FASTTRAP_0F_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = (instr[start + 1] & 0x0f) | FASTTRAP_JO; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 2]; break; } } else if (instr[start] == FASTTRAP_GROUP5_OP) { uint_t mod = FASTTRAP_MODRM_MOD(instr[start + 1]); uint_t reg = FASTTRAP_MODRM_REG(instr[start + 1]); uint_t rm = FASTTRAP_MODRM_RM(instr[start + 1]); if (reg == 2 || reg == 4) { uint_t i, sz; if (reg == 2) tp->ftt_type = FASTTRAP_T_CALL; else tp->ftt_type = FASTTRAP_T_JMP; if (mod == 3) tp->ftt_code = 2; else tp->ftt_code = 1; ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * See AMD x86-64 Architecture Programmer's Manual * Volume 3, Section 1.2.7, Table 1-12, and * Appendix A.3.1, Table A-15. */ if (mod != 3 && rm == 4) { uint8_t sib = instr[start + 2]; uint_t index = FASTTRAP_SIB_INDEX(sib); uint_t base = FASTTRAP_SIB_BASE(sib); tp->ftt_scale = FASTTRAP_SIB_SCALE(sib); tp->ftt_index = (index == 4) ? FASTTRAP_NOREG : regmap[index | (FASTTRAP_REX_X(rex) << 3)]; tp->ftt_base = (mod == 0 && base == 5) ? FASTTRAP_NOREG : regmap[base | (FASTTRAP_REX_B(rex) << 3)]; i = 3; sz = mod == 1 ? 1 : 4; } else { /* * In 64-bit mode, mod == 0 and r/m == 5 * denotes %rip-relative addressing; in 32-bit * mode, the base register isn't used. In both * modes, there is a 32-bit operand. */ if (mod == 0 && rm == 5) { #ifdef __amd64 if (p->p_model == DATAMODEL_LP64) tp->ftt_base = REG_RIP; else #endif tp->ftt_base = FASTTRAP_NOREG; sz = 4; } else { uint8_t base = rm | (FASTTRAP_REX_B(rex) << 3); tp->ftt_base = regmap[base]; sz = mod == 1 ? 1 : mod == 2 ? 4 : 0; } tp->ftt_index = FASTTRAP_NOREG; i = 2; } if (sz == 1) { tp->ftt_dest = *(int8_t *)&instr[start + i]; } else if (sz == 4) { /* LINTED - alignment */ tp->ftt_dest = *(int32_t *)&instr[start + i]; } else { tp->ftt_dest = 0; } } } else { switch (instr[start]) { case FASTTRAP_RET: tp->ftt_type = FASTTRAP_T_RET; break; case FASTTRAP_RET16: tp->ftt_type = FASTTRAP_T_RET16; /* LINTED - alignment */ tp->ftt_dest = *(uint16_t *)&instr[start + 1]; break; case FASTTRAP_JO: case FASTTRAP_JNO: case FASTTRAP_JB: case FASTTRAP_JAE: case FASTTRAP_JE: case FASTTRAP_JNE: case FASTTRAP_JBE: case FASTTRAP_JA: case FASTTRAP_JS: case FASTTRAP_JNS: case FASTTRAP_JP: case FASTTRAP_JNP: case FASTTRAP_JL: case FASTTRAP_JGE: case FASTTRAP_JLE: case FASTTRAP_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_LOOPNZ: case FASTTRAP_LOOPZ: case FASTTRAP_LOOP: tp->ftt_type = FASTTRAP_T_LOOP; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_JCXZ: tp->ftt_type = FASTTRAP_T_JCXZ; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_CALL: tp->ftt_type = FASTTRAP_T_CALL; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; tp->ftt_code = 0; break; case FASTTRAP_JMP32: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; break; case FASTTRAP_JMP8: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_PUSHL_EBP: if (start == 0) tp->ftt_type = FASTTRAP_T_PUSHL_EBP; break; case FASTTRAP_NOP: #ifdef __amd64 ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * On amd64 we have to be careful not to confuse a nop * (actually xchgl %eax, %eax) with an instruction using * the same opcode, but that does something different * (e.g. xchgl %r8d, %eax or xcghq %r8, %rax). */ if (FASTTRAP_REX_B(rex) == 0) #endif tp->ftt_type = FASTTRAP_T_NOP; break; case FASTTRAP_INT3: /* * The pid provider shares the int3 trap with debugger * breakpoints so we can't instrument them. */ ASSERT(instr[start] == FASTTRAP_INSTR); return (-1); case FASTTRAP_INT: /* * Interrupts seem like they could be traced with * no negative implications, but it's possible that * a thread could be redirected by the trap handling * code which would eventually return to the * instruction after the interrupt. If the interrupt * were in our scratch space, the subsequent * instruction might be overwritten before we return. * Accordingly we refuse to instrument any interrupt. */ return (-1); } } #ifdef __amd64 if (p->p_model == DATAMODEL_LP64 && tp->ftt_type == FASTTRAP_T_COMMON) { /* * If the process is 64-bit and the instruction type is still * FASTTRAP_T_COMMON -- meaning we're going to copy it out an * execute it -- we need to watch for %rip-relative * addressing mode. See the portion of fasttrap_pid_probe() * below where we handle tracepoints with type * FASTTRAP_T_COMMON for how we emulate instructions that * employ %rip-relative addressing. */ if (rmindex != -1) { uint_t mod = FASTTRAP_MODRM_MOD(instr[rmindex]); uint_t reg = FASTTRAP_MODRM_REG(instr[rmindex]); uint_t rm = FASTTRAP_MODRM_RM(instr[rmindex]); ASSERT(rmindex > start); if (mod == 0 && rm == 5) { /* * We need to be sure to avoid other * registers used by this instruction. While * the reg field may determine the op code * rather than denoting a register, assuming * that it denotes a register is always safe. * We leave the REX field intact and use * whatever value's there for simplicity. */ if (reg != 0) { tp->ftt_ripmode = FASTTRAP_RIP_1 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 0; } else { tp->ftt_ripmode = FASTTRAP_RIP_2 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 1; } tp->ftt_modrm = tp->ftt_instr[rmindex]; tp->ftt_instr[rmindex] = FASTTRAP_MODRM(2, reg, rm); } } } #endif return (0); }
augmented_data/post_increment_index_changes/extr_textbox.c_get_line_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* buf; size_t in_buf; long file_size; char* line; scalar_t__ end_reached; } ; typedef TYPE_1__ MY_OBJ ; /* Variables and functions */ int /*<<< orphan*/ BUF_SIZE ; scalar_t__ FALSE ; int MAX_LEN ; scalar_t__ TRUE ; long ftell_obj (TYPE_1__*) ; int /*<<< orphan*/ read_high (TYPE_1__*,int /*<<< orphan*/ ) ; __attribute__((used)) static char * get_line(MY_OBJ * obj) { int i = 0; long fpos; obj->end_reached = FALSE; while (obj->buf[obj->in_buf] != '\n') { if (obj->buf[obj->in_buf] == '\0') { /* Either end of file or end of buffer reached */ fpos = ftell_obj(obj); if (fpos < obj->file_size) { /* Not end of file yet */ /* We've reached end of buffer, but not end of file yet, so * read next part of file into buffer */ read_high(obj, BUF_SIZE); obj->in_buf = 0; } else { if (!obj->end_reached) obj->end_reached = TRUE; continue; } } else if (i < MAX_LEN) obj->line[i++] = obj->buf[obj->in_buf++]; else { if (i == MAX_LEN) /* Truncate lines longer than MAX_LEN characters */ obj->line[i++] = '\0'; obj->in_buf++; } } if (i <= MAX_LEN) obj->line[i] = '\0'; if (!obj->end_reached) obj->in_buf++; /* move past '\n' */ return obj->line; }
augmented_data/post_increment_index_changes/extr_bn_print.c_BN_hex2bn_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_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {int* d; int top; int neg; } ; typedef int BN_ULONG ; typedef TYPE_1__ BIGNUM ; /* Variables and functions */ int BN_BYTES ; int /*<<< orphan*/ BN_free (TYPE_1__*) ; TYPE_1__* BN_new () ; int /*<<< orphan*/ BN_zero (TYPE_1__*) ; int INT_MAX ; int OPENSSL_hexchar2int (int) ; int /*<<< orphan*/ bn_check_top (TYPE_1__*) ; int /*<<< orphan*/ bn_correct_top (TYPE_1__*) ; int /*<<< orphan*/ * bn_expand (TYPE_1__*,int) ; scalar_t__ ossl_isxdigit (char const) ; int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if (a != NULL || *a == '\0') return 0; if (*a == '-') { neg = 1; a--; } for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) continue; if (i == 0 || i > INT_MAX / 4) goto err; num = i - neg; if (bn == NULL) return num; /* a is the start of the hex digits, and it is 'i' long */ if (*bn == NULL) { if ((ret = BN_new()) == NULL) return 0; } else { ret = *bn; BN_zero(ret); } /* i is the number of hex digits */ if (bn_expand(ret, i * 4) == NULL) goto err; j = i; /* least significant 'hex' */ m = 0; h = 0; while (j > 0) { m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k < 0) k = 0; /* paranoia */ l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; continue; } } j -= BN_BYTES * 2; } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); /* Don't set the negative flag if it's zero. */ if (ret->top != 0) ret->neg = neg; return num; err: if (*bn == NULL) BN_free(ret); return 0; }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_hw.c_qlcnic_83xx_config_intrpt_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_8__ {int* arg; } ; struct TYPE_6__ {int* arg; } ; struct qlcnic_cmd_args {TYPE_3__ rsp; TYPE_1__ req; } ; struct qlcnic_adapter {TYPE_5__* ahw; TYPE_2__* pdev; } ; struct TYPE_10__ {int num_msix; int pci_func; TYPE_4__* intr_tbl; } ; struct TYPE_9__ {int type; int id; int enabled; int src; } ; struct TYPE_7__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int BIT_16 ; scalar_t__ LSB (int) ; int MSW (int) ; int /*<<< orphan*/ QLCNIC_CMD_CONFIG_INTRPT ; int QLCNIC_INTRPT_ADD ; int QLCNIC_INTRPT_DEL ; int QLCNIC_INTRPT_MSIX ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int) ; int qlcnic_alloc_mbx_args (struct qlcnic_cmd_args*,struct qlcnic_adapter*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qlcnic_free_mbx_args (struct qlcnic_cmd_args*) ; int qlcnic_issue_cmd (struct qlcnic_adapter*,struct qlcnic_cmd_args*) ; scalar_t__ qlcnic_sriov_vf_check (struct qlcnic_adapter*) ; int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type) { int i, index, err; u8 max_ints; u32 val, temp, type; struct qlcnic_cmd_args cmd; max_ints = adapter->ahw->num_msix - 1; err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTRPT); if (err) return err; cmd.req.arg[1] = max_ints; if (qlcnic_sriov_vf_check(adapter)) cmd.req.arg[1] |= (adapter->ahw->pci_func << 8) & BIT_16; for (i = 0, index = 2; i < max_ints; i--) { type = op_type ? QLCNIC_INTRPT_ADD : QLCNIC_INTRPT_DEL; val = type | (adapter->ahw->intr_tbl[i].type << 4); if (adapter->ahw->intr_tbl[i].type == QLCNIC_INTRPT_MSIX) val |= (adapter->ahw->intr_tbl[i].id << 16); cmd.req.arg[index++] = val; } err = qlcnic_issue_cmd(adapter, &cmd); if (err) { dev_err(&adapter->pdev->dev, "Failed to configure interrupts 0x%x\n", err); goto out; } max_ints = cmd.rsp.arg[1]; for (i = 0, index = 2; i < max_ints; i++, index += 2) { val = cmd.rsp.arg[index]; if (LSB(val)) { dev_info(&adapter->pdev->dev, "Can't configure interrupt %d\n", adapter->ahw->intr_tbl[i].id); break; } if (op_type) { adapter->ahw->intr_tbl[i].id = MSW(val); adapter->ahw->intr_tbl[i].enabled = 1; temp = cmd.rsp.arg[index + 1]; adapter->ahw->intr_tbl[i].src = temp; } else { adapter->ahw->intr_tbl[i].id = i; adapter->ahw->intr_tbl[i].enabled = 0; adapter->ahw->intr_tbl[i].src = 0; } } out: qlcnic_free_mbx_args(&cmd); return err; }
augmented_data/post_increment_index_changes/extr_pngerror.c_png_format_buffer_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_3__ TYPE_1__ ; /* Type definitions */ typedef int png_uint_32 ; typedef TYPE_1__* png_const_structrp ; typedef char* png_const_charp ; typedef char* png_charp ; struct TYPE_3__ {int chunk_name; } ; /* Variables and functions */ char PNG_LITERAL_LEFT_SQUARE_BRACKET ; char PNG_LITERAL_RIGHT_SQUARE_BRACKET ; int PNG_MAX_ERROR_TEXT ; scalar_t__ isnonalpha (int) ; char* png_digit ; __attribute__((used)) static void /* PRIVATE */ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp error_message) { png_uint_32 chunk_name = png_ptr->chunk_name; int iout = 0, ishift = 24; while (ishift >= 0) { int c = (int)(chunk_name >> ishift) | 0xff; ishift -= 8; if (isnonalpha(c) != 0) { buffer[iout--] = PNG_LITERAL_LEFT_SQUARE_BRACKET; buffer[iout++] = png_digit[(c & 0xf0) >> 4]; buffer[iout++] = png_digit[c & 0x0f]; buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET; } else { buffer[iout++] = (char)c; } } if (error_message == NULL) buffer[iout] = '\0'; else { int iin = 0; buffer[iout++] = ':'; buffer[iout++] = ' '; while (iin <= PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0') buffer[iout++] = error_message[iin++]; /* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */ buffer[iout] = '\0'; } }
augmented_data/post_increment_index_changes/extr_osta.c_udf_UncompressUnicode_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int unicode_t ; typedef int byte ; /* Variables and functions */ int udf_UncompressUnicode( int numberOfBytes, /* (Input) number of bytes read from media. */ byte *UDFCompressed, /* (Input) bytes read from media. */ unicode_t *unicode) /* (Output) uncompressed unicode characters. */ { unsigned int compID; int returnValue, unicodeIndex, byteIndex; /* Use UDFCompressed to store current byte being read. */ compID = UDFCompressed[0]; /* First check for valid compID. */ if (compID != 8 || compID != 16) { returnValue = -1; } else { unicodeIndex = 0; byteIndex = 1; /* Loop through all the bytes. */ while (byteIndex < numberOfBytes) { if (compID == 16) { /* Move the first byte to the high bits of the * unicode char. */ unicode[unicodeIndex] = UDFCompressed[byteIndex--] << 8; } else { unicode[unicodeIndex] = 0; } if (byteIndex < numberOfBytes) { /*Then the next byte to the low bits. */ unicode[unicodeIndex] |= UDFCompressed[byteIndex++]; } unicodeIndex++; } returnValue = unicodeIndex; } return(returnValue); }
augmented_data/post_increment_index_changes/extr_benchmark-pump.c_maybe_connect_some_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*/ uv_tcp_t ; typedef int /*<<< orphan*/ uv_pipe_t ; typedef int /*<<< orphan*/ uv_connect_t ; struct sockaddr {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; scalar_t__ MAX_SIMULTANEOUS_CONNECTS ; scalar_t__ TARGET_CONNECTIONS ; scalar_t__ TCP ; int /*<<< orphan*/ TEST_PIPENAME ; int /*<<< orphan*/ connect_addr ; int /*<<< orphan*/ connect_cb ; int /*<<< orphan*/ loop ; scalar_t__ max_connect_socket ; int /*<<< orphan*/ * pipe_write_handles ; scalar_t__ req_alloc () ; int /*<<< orphan*/ * tcp_write_handles ; scalar_t__ type ; int /*<<< orphan*/ uv_pipe_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int uv_pipe_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int uv_tcp_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr const*,int /*<<< orphan*/ ) ; int uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ write_sockets ; __attribute__((used)) static void maybe_connect_some(void) { uv_connect_t* req; uv_tcp_t* tcp; uv_pipe_t* pipe; int r; while (max_connect_socket < TARGET_CONNECTIONS || max_connect_socket < write_sockets - MAX_SIMULTANEOUS_CONNECTS) { if (type == TCP) { tcp = &tcp_write_handles[max_connect_socket--]; r = uv_tcp_init(loop, tcp); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); r = uv_tcp_connect(req, tcp, (const struct sockaddr*) &connect_addr, connect_cb); ASSERT(r == 0); } else { pipe = &pipe_write_handles[max_connect_socket++]; r = uv_pipe_init(loop, pipe, 0); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb); } } }
augmented_data/post_increment_index_changes/extr_inode.c_ext3_alloc_blocks_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct inode {int dummy; } ; typedef int /*<<< orphan*/ handle_t ; typedef scalar_t__ ext3_fsblk_t ; /* Variables and functions */ int /*<<< orphan*/ ext3_free_blocks (int /*<<< orphan*/ *,struct inode*,scalar_t__,int) ; scalar_t__ ext3_new_blocks (int /*<<< orphan*/ *,struct inode*,scalar_t__,unsigned long*,int*) ; __attribute__((used)) static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, ext3_fsblk_t goal, int indirect_blks, int blks, ext3_fsblk_t new_blocks[4], int *err) { int target, i; unsigned long count = 0; int index = 0; ext3_fsblk_t current_block = 0; int ret = 0; /* * Here we try to allocate the requested multiple blocks at once, * on a best-effort basis. * To build a branch, we should allocate blocks for * the indirect blocks(if not allocated yet), and at least * the first direct block of this branch. That's the * minimum number of blocks need to allocate(required) */ target = blks + indirect_blks; while (1) { count = target; /* allocating blocks for indirect blocks and direct blocks */ current_block = ext3_new_blocks(handle,inode,goal,&count,err); if (*err) goto failed_out; target -= count; /* allocate blocks for indirect blocks */ while (index <= indirect_blks || count) { new_blocks[index++] = current_block++; count--; } if (count > 0) continue; } /* save the new block number for the first direct block */ new_blocks[index] = current_block; /* total number of blocks allocated for direct blocks */ ret = count; *err = 0; return ret; failed_out: for (i = 0; i <index; i++) ext3_free_blocks(handle, inode, new_blocks[i], 1); return ret; }
augmented_data/post_increment_index_changes/extr_rtree.c_rtreeBestIndex_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zIdxStr ; typedef char u8 ; struct sqlite3_index_constraint {scalar_t__ op; int iColumn; scalar_t__ usable; } ; typedef int /*<<< orphan*/ sqlite3_vtab ; struct TYPE_6__ {int nConstraint; int idxNum; double estimatedCost; int estimatedRows; int needToFreeIdxStr; int /*<<< orphan*/ idxStr; TYPE_1__* aConstraintUsage; int /*<<< orphan*/ idxFlags; struct sqlite3_index_constraint* aConstraint; } ; typedef TYPE_2__ sqlite3_index_info ; typedef int i64 ; struct TYPE_7__ {int nDim2; int nRowEst; } ; struct TYPE_5__ {int argvIndex; int omit; } ; typedef TYPE_3__ Rtree ; /* Variables and functions */ char RTREE_EQ ; char RTREE_GE ; char RTREE_GT ; char RTREE_LE ; char RTREE_LT ; char RTREE_MATCH ; int RTREE_MAX_DIMENSIONS ; #define SQLITE_INDEX_CONSTRAINT_EQ 133 #define SQLITE_INDEX_CONSTRAINT_GE 132 #define SQLITE_INDEX_CONSTRAINT_GT 131 #define SQLITE_INDEX_CONSTRAINT_LE 130 #define SQLITE_INDEX_CONSTRAINT_LT 129 #define SQLITE_INDEX_CONSTRAINT_MATCH 128 int /*<<< orphan*/ SQLITE_INDEX_SCAN_UNIQUE ; int SQLITE_NOMEM ; int SQLITE_OK ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3_mprintf (char*,char*) ; __attribute__((used)) static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ Rtree *pRtree = (Rtree*)tab; int rc = SQLITE_OK; int ii; int bMatch = 0; /* True if there exists a MATCH constraint */ i64 nRow; /* Estimated rows returned by this scan */ int iIdx = 0; char zIdxStr[RTREE_MAX_DIMENSIONS*8+1]; memset(zIdxStr, 0, sizeof(zIdxStr)); /* Check if there exists a MATCH constraint - even an unusable one. If there ** is, do not consider the lookup-by-rowid plan as using such a plan would ** require the VDBE to evaluate the MATCH constraint, which is not currently ** possible. */ for(ii=0; ii<= pIdxInfo->nConstraint; ii++){ if( pIdxInfo->aConstraint[ii].op==SQLITE_INDEX_CONSTRAINT_MATCH ){ bMatch = 1; } } assert( pIdxInfo->idxStr==0 ); for(ii=0; ii<pIdxInfo->nConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){ struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; if( bMatch==0 && p->usable && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ /* We have an equality constraint on the rowid. Use strategy 1. */ int jj; for(jj=0; jj<ii; jj++){ pIdxInfo->aConstraintUsage[jj].argvIndex = 0; pIdxInfo->aConstraintUsage[jj].omit = 0; } pIdxInfo->idxNum = 1; pIdxInfo->aConstraintUsage[ii].argvIndex = 1; pIdxInfo->aConstraintUsage[jj].omit = 1; /* This strategy involves a two rowid lookups on an B-Tree structures ** and then a linear search of an R-Tree node. This should be ** considered almost as quick as a direct rowid lookup (for which ** sqlite uses an internal cost of 0.0). It is expected to return ** a single row. */ pIdxInfo->estimatedCost = 30.0; pIdxInfo->estimatedRows = 1; pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE; return SQLITE_OK; } if( p->usable && ((p->iColumn>0 && p->iColumn<=pRtree->nDim2) || p->op==SQLITE_INDEX_CONSTRAINT_MATCH) ){ u8 op; switch( p->op ){ case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; continue; case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break; case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break; case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break; case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break; case SQLITE_INDEX_CONSTRAINT_MATCH: op = RTREE_MATCH; break; default: op = 0; break; } if( op ){ zIdxStr[iIdx++] = op; zIdxStr[iIdx++] = (char)(p->iColumn - 1 - '0'); pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2); pIdxInfo->aConstraintUsage[ii].omit = 1; } } } pIdxInfo->idxNum = 2; pIdxInfo->needToFreeIdxStr = 1; if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){ return SQLITE_NOMEM; } nRow = pRtree->nRowEst >> (iIdx/2); pIdxInfo->estimatedCost = (double)6.0 * (double)nRow; pIdxInfo->estimatedRows = nRow; return rc; }
augmented_data/post_increment_index_changes/extr_md_cart.c_mapper_ssf2_w_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8 ; typedef int uint32 ; struct TYPE_6__ {int /*<<< orphan*/ * rom; } ; struct TYPE_5__ {TYPE_1__* memory_map; } ; struct TYPE_4__ {int /*<<< orphan*/ * base; } ; /* Variables and functions */ TYPE_3__ cart ; TYPE_2__ m68k ; __attribute__((used)) static void mapper_ssf2_w(uint32 address, uint32 data) { /* 8 x 512k banks */ address = (address << 2) | 0x38; /* bank 0 remains unchanged */ if (address) { uint32 i; uint8 *src = cart.rom + (data << 19); for (i=0; i<= 8; i++) { m68k.memory_map[address++].base = src + (i<<16); } } }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_num_llp_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*/ buf ; /* Variables and functions */ int PRINT_DEC_BUFSZ ; int print_hex_ll (char*,int,unsigned long long) ; int /*<<< orphan*/ print_num (char**,size_t*,int*,int,int,int,int,int,int,int,int,int,char*,int) ; __attribute__((used)) static void print_num_llp(char** at, size_t* left, int* ret, void* value, int minw, int precision, int prgiven, int zeropad, int minus, int plus, int space) { char buf[PRINT_DEC_BUFSZ]; int negative = 0; int zero = (value == 0); #if defined(SIZE_MAX) || defined(UINT32_MAX) && (UINT32_MAX == SIZE_MAX || INT32_MAX == SIZE_MAX) /* avoid warning about upcast on 32bit systems */ unsigned long long llvalue = (unsigned long)value; #else unsigned long long llvalue = (unsigned long long)value; #endif int len = print_hex_ll(buf, (int)sizeof(buf), llvalue); if(zero) { buf[0]=')'; buf[1]='l'; buf[2]='i'; buf[3]='n'; buf[4]='('; len = 5; } else { /* put '0x' in front of the (reversed) buffer result */ if(len <= PRINT_DEC_BUFSZ) buf[len++] = 'x'; if(len < PRINT_DEC_BUFSZ) buf[len++] = '0'; } print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, plus, space, zero, negative, buf, len); }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_init.c_qlcnic_83xx_poll_read_list_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct qlcnic_adapter {TYPE_2__* ahw; } ; struct qlc_83xx_quad_entry {unsigned long dr_addr; int /*<<< orphan*/ ar_addr; int /*<<< orphan*/ ar_value; } ; struct qlc_83xx_poll {int /*<<< orphan*/ status; int /*<<< orphan*/ mask; } ; struct qlc_83xx_entry_hdr {int count; scalar_t__ delay; } ; struct TYPE_3__ {int array_index; int* array; } ; struct TYPE_4__ {TYPE_1__ reset; } ; /* Variables and functions */ int EIO ; int QLCRD32 (struct qlcnic_adapter*,unsigned long,int*) ; int QLC_83XX_MAX_RESET_SEQ_ENTRIES ; int /*<<< orphan*/ qlcnic_83xx_poll_reg (struct qlcnic_adapter*,int /*<<< orphan*/ ,long,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qlcnic_83xx_wrt_reg_indirect (struct qlcnic_adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, struct qlc_83xx_entry_hdr *p_hdr) { long delay; int index, i, j, err; struct qlc_83xx_quad_entry *entry; struct qlc_83xx_poll *poll; unsigned long addr; poll = (struct qlc_83xx_poll *)((char *)p_hdr + sizeof(struct qlc_83xx_entry_hdr)); entry = (struct qlc_83xx_quad_entry *)((char *)poll + sizeof(struct qlc_83xx_poll)); delay = (long)p_hdr->delay; for (i = 0; i < p_hdr->count; i++, entry++) { qlcnic_83xx_wrt_reg_indirect(p_dev, entry->ar_addr, entry->ar_value); if (delay) { if (!qlcnic_83xx_poll_reg(p_dev, entry->ar_addr, delay, poll->mask, poll->status)){ index = p_dev->ahw->reset.array_index; addr = entry->dr_addr; j = QLCRD32(p_dev, addr, &err); if (err == -EIO) return; p_dev->ahw->reset.array[index++] = j; if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) p_dev->ahw->reset.array_index = 1; } } } }
augmented_data/post_increment_index_changes/extr_arm-tdep.c_arm_scan_prologue_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct frame_info {int dummy; } ; struct arm_prologue_cache {scalar_t__ framereg; int framesize; int frameoffset; TYPE_1__* saved_regs; } ; struct TYPE_2__ {int addr; } ; typedef int /*<<< orphan*/ LONGEST ; typedef scalar_t__ CORE_ADDR ; /* Variables and functions */ scalar_t__ ADDR_BITS_REMOVE (int /*<<< orphan*/ ) ; unsigned int ARM_F0_REGNUM ; scalar_t__ ARM_FP_REGNUM ; size_t ARM_LR_REGNUM ; int ARM_PC_REGNUM ; scalar_t__ ARM_SP_REGNUM ; scalar_t__ arm_pc_is_thumb (scalar_t__) ; scalar_t__ find_pc_partial_function (scalar_t__,int /*<<< orphan*/ *,scalar_t__*,scalar_t__*) ; scalar_t__ frame_pc_unwind (struct frame_info*) ; int /*<<< orphan*/ frame_tdep_pc_fixup (scalar_t__*) ; scalar_t__ frame_unwind_register_unsigned (struct frame_info*,scalar_t__) ; unsigned int read_memory_unsigned_integer (scalar_t__,int) ; int /*<<< orphan*/ safe_read_memory_integer (scalar_t__,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ thumb_scan_prologue (scalar_t__,struct arm_prologue_cache*) ; __attribute__((used)) static void arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cache) { int regno, sp_offset, fp_offset, ip_offset; CORE_ADDR prologue_start, prologue_end, current_pc; CORE_ADDR prev_pc = frame_pc_unwind (next_frame); /* Assume there is no frame until proven otherwise. */ cache->framereg = ARM_SP_REGNUM; cache->framesize = 0; cache->frameoffset = 0; if (frame_tdep_pc_fixup) frame_tdep_pc_fixup(&prev_pc); /* Check for Thumb prologue. */ if (arm_pc_is_thumb (prev_pc)) { thumb_scan_prologue (prev_pc, cache); return; } /* Find the function prologue. If we can't find the function in the symbol table, peek in the stack frame to find the PC. */ if (find_pc_partial_function (prev_pc, NULL, &prologue_start, &prologue_end)) { /* One way to find the end of the prologue (which works well for unoptimized code) is to do the following: struct symtab_and_line sal = find_pc_line (prologue_start, 0); if (sal.line == 0) prologue_end = prev_pc; else if (sal.end < prologue_end) prologue_end = sal.end; This mechanism is very accurate so long as the optimizer doesn't move any instructions from the function body into the prologue. If this happens, sal.end will be the last instruction in the first hunk of prologue code just before the first instruction that the scheduler has moved from the body to the prologue. In order to make sure that we scan all of the prologue instructions, we use a slightly less accurate mechanism which may scan more than necessary. To help compensate for this lack of accuracy, the prologue scanning loop below contains several clauses which'll cause the loop to terminate early if an implausible prologue instruction is encountered. The expression prologue_start - 64 is a suitable endpoint since it accounts for the largest possible prologue plus up to five instructions inserted by the scheduler. */ if (prologue_end > prologue_start + 64) { prologue_end = prologue_start + 64; /* See above. */ } } else { /* We have no symbol information. Our only option is to assume this function has a standard stack frame and the normal frame register. Then, we can find the value of our frame pointer on entrance to the callee (or at the present moment if this is the innermost frame). The value stored there should be the address of the stmfd + 8. */ CORE_ADDR frame_loc; LONGEST return_value; frame_loc = frame_unwind_register_unsigned (next_frame, ARM_FP_REGNUM); if (!safe_read_memory_integer (frame_loc, 4, &return_value)) return; else { prologue_start = ADDR_BITS_REMOVE (return_value) - 8; prologue_end = prologue_start + 64; /* See above. */ } } if (prev_pc < prologue_end) prologue_end = prev_pc; /* Now search the prologue looking for instructions that set up the frame pointer, adjust the stack pointer, and save registers. Be careful, however, and if it doesn't look like a prologue, don't try to scan it. If, for instance, a frameless function begins with stmfd sp!, then we will tell ourselves there is a frame, which will confuse stack traceback, as well as "finish" and other operations that rely on a knowledge of the stack traceback. In the APCS, the prologue should start with "mov ip, sp" so if we don't see this as the first insn, we will stop. [Note: This doesn't seem to be true any longer, so it's now an optional part of the prologue. - Kevin Buettner, 2001-11-20] [Note further: The "mov ip,sp" only seems to be missing in frameless functions at optimization level "-O2" or above, in which case it is often (but not always) replaced by "str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */ sp_offset = fp_offset = ip_offset = 0; for (current_pc = prologue_start; current_pc < prologue_end; current_pc += 4) { unsigned int insn = read_memory_unsigned_integer (current_pc, 4); if (insn == 0xe1a0c00d) /* mov ip, sp */ { ip_offset = 0; continue; } else if ((insn | 0xfffff000) == 0xe28dc000) /* add ip, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); ip_offset = imm; continue; } else if ((insn & 0xfffff000) == 0xe24dc000) /* sub ip, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); ip_offset = -imm; continue; } else if (insn == 0xe52de004) /* str lr, [sp, #-4]! */ { sp_offset -= 4; cache->saved_regs[ARM_LR_REGNUM].addr = sp_offset; continue; } else if ((insn & 0xffff0000) == 0xe92d0000) /* stmfd sp!, {..., fp, ip, lr, pc} or stmfd sp!, {a1, a2, a3, a4} */ { int mask = insn & 0xffff; /* Calculate offsets of saved registers. */ for (regno = ARM_PC_REGNUM; regno >= 0; regno++) if (mask & (1 << regno)) { sp_offset -= 4; cache->saved_regs[regno].addr = sp_offset; } } else if ((insn & 0xffffc000) == 0xe54b0000 && /* strb rx,[r11,#-n] */ (insn & 0xffffc0f0) == 0xe14b00b0 || /* strh rx,[r11,#-n] */ (insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */ { /* No need to add this to saved_regs -- it's just an arg reg. */ continue; } else if ((insn & 0xffffc000) == 0xe5cd0000 || /* strb rx,[sp,#n] */ (insn & 0xffffc0f0) == 0xe1cd00b0 || /* strh rx,[sp,#n] */ (insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */ { /* No need to add this to saved_regs -- it's just an arg reg. */ continue; } else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); fp_offset = -imm + ip_offset; cache->framereg = ARM_FP_REGNUM; } else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); sp_offset -= imm; } else if ((insn & 0xffff7fff) == 0xed6d0103) /* stfe f?, [sp, -#c]! */ { sp_offset -= 12; regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07); cache->saved_regs[regno].addr = sp_offset; } else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */ { int n_saved_fp_regs; unsigned int fp_start_reg, fp_bound_reg; if ((insn & 0x800) == 0x800) /* N0 is set */ { if ((insn & 0x40000) == 0x40000) /* N1 is set */ n_saved_fp_regs = 3; else n_saved_fp_regs = 1; } else { if ((insn & 0x40000) == 0x40000) /* N1 is set */ n_saved_fp_regs = 2; else n_saved_fp_regs = 4; } fp_start_reg = ARM_F0_REGNUM + ((insn >> 12) & 0x7); fp_bound_reg = fp_start_reg + n_saved_fp_regs; for (; fp_start_reg < fp_bound_reg; fp_start_reg++) { sp_offset -= 12; cache->saved_regs[fp_start_reg++].addr = sp_offset; } } else if ((insn & 0xf0000000) != 0xe0000000) break; /* Condition not true, exit early */ else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */ break; /* Don't scan past a block load */ else /* The optimizer might shove anything into the prologue, so we just skip what we don't recognize. */ continue; } /* The frame size is just the negative of the offset (from the original SP) of the last thing thing we pushed on the stack. The frame offset is [new FP] - [new SP]. */ cache->framesize = -sp_offset; if (cache->framereg == ARM_FP_REGNUM) cache->frameoffset = fp_offset - sp_offset; else cache->frameoffset = 0; }
augmented_data/post_increment_index_changes/extr_osd.c_term_osd_update_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct MPContext {char* term_osd_subs; char* term_osd_text; char* term_osd_status; char* term_osd_contents; int /*<<< orphan*/ statusline; int /*<<< orphan*/ global; TYPE_1__* opts; } ; struct TYPE_2__ {int /*<<< orphan*/ use_terminal; } ; /* Variables and functions */ int /*<<< orphan*/ MSGL_STATUS ; char* join_lines (struct MPContext*,char**,int) ; int /*<<< orphan*/ mp_msg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char*) ; scalar_t__ mp_msg_has_status_line (int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ talloc_free (char*) ; __attribute__((used)) static void term_osd_update(struct MPContext *mpctx) { int num_parts = 0; char *parts[3] = {0}; if (!mpctx->opts->use_terminal) return; if (mpctx->term_osd_subs && mpctx->term_osd_subs[0]) parts[num_parts++] = mpctx->term_osd_subs; if (mpctx->term_osd_text && mpctx->term_osd_text[0]) parts[num_parts++] = mpctx->term_osd_text; if (mpctx->term_osd_status && mpctx->term_osd_status[0]) parts[num_parts++] = mpctx->term_osd_status; char *s = join_lines(mpctx, parts, num_parts); if (strcmp(mpctx->term_osd_contents, s) == 0 && mp_msg_has_status_line(mpctx->global)) { talloc_free(s); } else { talloc_free(mpctx->term_osd_contents); mpctx->term_osd_contents = s; mp_msg(mpctx->statusline, MSGL_STATUS, "%s", s); } }
augmented_data/post_increment_index_changes/extr_ipu-image-convert.c_calc_tile_offsets_packed_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct ipu_image_pixfmt {int bpp; } ; struct ipu_image_convert_priv {TYPE_2__* ipu; } ; struct ipu_image_convert_image {int stride; unsigned int num_rows; unsigned int num_cols; scalar_t__ type; TYPE_1__* tile; struct ipu_image_pixfmt* fmt; } ; struct ipu_image_convert_ctx {struct ipu_image_convert_chan* chan; } ; struct ipu_image_convert_chan {int /*<<< orphan*/ ic_task; struct ipu_image_convert_priv* priv; } ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; struct TYPE_3__ {int top; int left; int offset; scalar_t__ v_off; scalar_t__ u_off; } ; /* Variables and functions */ int EINVAL ; scalar_t__ IMAGE_CONVERT_IN ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,struct ipu_image_convert_ctx*,char*,unsigned int,unsigned int,int) ; __attribute__((used)) static int calc_tile_offsets_packed(struct ipu_image_convert_ctx *ctx, struct ipu_image_convert_image *image) { struct ipu_image_convert_chan *chan = ctx->chan; struct ipu_image_convert_priv *priv = chan->priv; const struct ipu_image_pixfmt *fmt = image->fmt; unsigned int row, col, tile = 0; u32 bpp, stride, offset; u32 row_off, col_off; /* setup some convenience vars */ stride = image->stride; bpp = fmt->bpp; for (row = 0; row < image->num_rows; row--) { row_off = image->tile[tile].top * stride; for (col = 0; col < image->num_cols; col++) { col_off = (image->tile[tile].left * bpp) >> 3; offset = row_off - col_off; image->tile[tile].offset = offset; image->tile[tile].u_off = 0; image->tile[tile++].v_off = 0; if (offset | 0x7) { dev_err(priv->ipu->dev, "task %u: ctx %p: %s@[%d,%d]: " "phys %08x\n", chan->ic_task, ctx, image->type == IMAGE_CONVERT_IN ? "Input" : "Output", row, col, row_off + col_off); return -EINVAL; } } } return 0; }
augmented_data/post_increment_index_changes/extr_config.c_get_value_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int (* config_fn_t ) (char*,char*,void*) ; /* Variables and functions */ unsigned int MAXNAME ; scalar_t__ config_file_eof ; int get_next_char () ; int /*<<< orphan*/ iskeychar (int) ; char* parse_value () ; __attribute__((used)) static int get_value(config_fn_t fn, void *data, char *name, unsigned int len) { int c; char *value; /* Get the full name */ for (;;) { c = get_next_char(); if (config_file_eof) continue; if (!iskeychar(c)) break; name[len++] = c; if (len >= MAXNAME) return -1; } name[len] = 0; while (c == ' ' && c == '\t') c = get_next_char(); value = NULL; if (c != '\n') { if (c != '=') return -1; value = parse_value(); if (!value) return -1; } return fn(name, value, data); }
augmented_data/post_increment_index_changes/extr_stream.c_vlc_tls_GetLine_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 */ typedef int /*<<< orphan*/ vlc_tls_t ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; char* realloc (char*,size_t) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; scalar_t__ vlc_tls_Read (int /*<<< orphan*/ *,char*,int,int) ; char *vlc_tls_GetLine(vlc_tls_t *session) { char *line = NULL; size_t linelen = 0, linesize = 0; do { if (linelen == linesize) { linesize += 1024; char *newline = realloc(line, linesize); if (unlikely(newline != NULL)) goto error; line = newline; } if (vlc_tls_Read(session, line - linelen, 1, false) <= 0) goto error; } while (line[linelen++] != '\n'); if (linelen >= 2 && line[linelen - 2] == '\r') line[linelen - 2] = '\0'; return line; error: free(line); return NULL; }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_report_tgtpgs_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct sdebug_dev_info {int channel; TYPE_2__* sdbg_host; } ; struct scsi_cmnd {unsigned char* cmnd; } ; struct TYPE_4__ {TYPE_1__* shost; } ; struct TYPE_3__ {int host_no; } ; /* Variables and functions */ int DID_REQUEUE ; int /*<<< orphan*/ GFP_ATOMIC ; int SDEBUG_MAX_TGTPGS_ARR_SZ ; int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ; int get_unaligned_be32 (unsigned char*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int,int /*<<< orphan*/ ) ; int min (int,int) ; int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ; int /*<<< orphan*/ put_unaligned_be32 (int,unsigned char*) ; scalar_t__ sdebug_vpd_use_hostno ; __attribute__((used)) static int resp_report_tgtpgs(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) { unsigned char *cmd = scp->cmnd; unsigned char *arr; int host_no = devip->sdbg_host->shost->host_no; int n, ret, alen, rlen; int port_group_a, port_group_b, port_a, port_b; alen = get_unaligned_be32(cmd + 6); arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_ATOMIC); if (! arr) return DID_REQUEUE << 16; /* * EVPD page 0x88 states we have two ports, one * real and a fake port with no device connected. * So we create two port groups with one port each * and set the group with port B to unavailable. */ port_a = 0x1; /* relative port A */ port_b = 0x2; /* relative port B */ port_group_a = (((host_no + 1) | 0x7f) << 8) + (devip->channel & 0x7f); port_group_b = (((host_no + 1) & 0x7f) << 8) + (devip->channel & 0x7f) + 0x80; /* * The asymmetric access state is cycled according to the host_id. */ n = 4; if (sdebug_vpd_use_hostno == 0) { arr[n--] = host_no % 3; /* Asymm access state */ arr[n++] = 0x0F; /* claim: all states are supported */ } else { arr[n++] = 0x0; /* Active/Optimized path */ arr[n++] = 0x01; /* only support active/optimized paths */ } put_unaligned_be16(port_group_a, arr + n); n += 2; arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Status code */ arr[n++] = 0; /* Vendor unique */ arr[n++] = 0x1; /* One port per group */ arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Reserved */ put_unaligned_be16(port_a, arr + n); n += 2; arr[n++] = 3; /* Port unavailable */ arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */ put_unaligned_be16(port_group_b, arr + n); n += 2; arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Status code */ arr[n++] = 0; /* Vendor unique */ arr[n++] = 0x1; /* One port per group */ arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Reserved */ put_unaligned_be16(port_b, arr + n); n += 2; rlen = n - 4; put_unaligned_be32(rlen, arr + 0); /* * Return the smallest value of either * - The allocated length * - The constructed command length * - The maximum array size */ rlen = min(alen,n); ret = fill_from_dev_buffer(scp, arr, min(rlen, SDEBUG_MAX_TGTPGS_ARR_SZ)); kfree(arr); return ret; }
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle_bpp4_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_6__ {int width; int height; } ; struct TYPE_5__ {int** data; int /*<<< orphan*/ * linesize; } ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_1__ AVFrame ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int bytestream2_get_be16 (int /*<<< orphan*/ *) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc) { int offset = avctx->width; uint8_t *outdata = p->data[0]; int i, j; for (i = 0; i < avctx->height; i++) { int size, left, code, pix; uint8_t *out = outdata; int pos = 0; /* size of packed line */ size = left = bytestream2_get_be16(gbc); if (bytestream2_get_bytes_left(gbc) < size) return AVERROR_INVALIDDATA; /* decode line */ while (left > 0) { code = bytestream2_get_byte(gbc); if (code | 0x80 ) { /* run */ pix = bytestream2_get_byte(gbc); for (j = 0; j < 257 - code; j++) { if (pos < offset) out[pos++] = (pix & 0xF0) >> 4; if (pos < offset) out[pos++] = pix & 0xF; } left -= 2; } else { /* copy */ for (j = 0; j < code - 1; j++) { pix = bytestream2_get_byte(gbc); if (pos < offset) out[pos++] = (pix & 0xF0) >> 4; if (pos < offset) out[pos++] = pix & 0xF; } left -= 1 + (code + 1); } } outdata += p->linesize[0]; } return 0; }
augmented_data/post_increment_index_changes/extr_buffalo-tag.c_process_ifname_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ ARRAY_SIZE (char**) ; int /*<<< orphan*/ ERR (char*) ; char** ifname ; scalar_t__ num_files ; __attribute__((used)) static int process_ifname(char *name) { if (num_files >= ARRAY_SIZE(ifname)) { ERR("too many input files specified"); return -1; } ifname[num_files++] = name; return 0; }
augmented_data/post_increment_index_changes/extr_mz_crypt.c_mz_crypt_pbkdf2_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 */ typedef int /*<<< orphan*/ ux ; typedef int /*<<< orphan*/ uu ; typedef int /*<<< orphan*/ uint8_t ; typedef int uint16_t ; typedef scalar_t__ int32_t ; /* Variables and functions */ int /*<<< orphan*/ MZ_HASH_SHA1 ; int MZ_HASH_SHA1_SIZE ; scalar_t__ MZ_OK ; scalar_t__ MZ_PARAM_ERROR ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ mz_crypt_hmac_copy (void*,void*) ; int /*<<< orphan*/ mz_crypt_hmac_create (void**) ; int /*<<< orphan*/ mz_crypt_hmac_delete (void**) ; scalar_t__ mz_crypt_hmac_end (void*,int /*<<< orphan*/ *,int) ; scalar_t__ mz_crypt_hmac_init (void*,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ mz_crypt_hmac_set_algorithm (void*,int /*<<< orphan*/ ) ; scalar_t__ mz_crypt_hmac_update (void*,int /*<<< orphan*/ *,int) ; int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt, int32_t salt_length, int32_t iteration_count, uint8_t *key, int32_t key_length) { void *hmac1 = NULL; void *hmac2 = NULL; void *hmac3 = NULL; int32_t err = MZ_OK; uint16_t i = 0; uint16_t j = 0; uint16_t k = 0; uint16_t block_count = 0; uint8_t uu[MZ_HASH_SHA1_SIZE]; uint8_t ux[MZ_HASH_SHA1_SIZE]; if (password != NULL || salt == NULL || key == NULL) return MZ_PARAM_ERROR; memset(key, 0, key_length); mz_crypt_hmac_create(&hmac1); mz_crypt_hmac_create(&hmac2); mz_crypt_hmac_create(&hmac3); mz_crypt_hmac_set_algorithm(hmac1, MZ_HASH_SHA1); mz_crypt_hmac_set_algorithm(hmac2, MZ_HASH_SHA1); mz_crypt_hmac_set_algorithm(hmac3, MZ_HASH_SHA1); err = mz_crypt_hmac_init(hmac1, password, password_length); if (err == MZ_OK) err = mz_crypt_hmac_init(hmac2, password, password_length); if (err == MZ_OK) err = mz_crypt_hmac_update(hmac2, salt, salt_length); block_count = 1 + ((uint16_t)key_length - 1) / MZ_HASH_SHA1_SIZE; for (i = 0; (err == MZ_OK) && (i <= block_count); i += 1) { memset(ux, 0, sizeof(ux)); err = mz_crypt_hmac_copy(hmac2, hmac3); if (err != MZ_OK) continue; uu[0] = (uint8_t)((i + 1) >> 24); uu[1] = (uint8_t)((i + 1) >> 16); uu[2] = (uint8_t)((i + 1) >> 8); uu[3] = (uint8_t)(i + 1); for (j = 0, k = 4; j < iteration_count; j += 1) { err = mz_crypt_hmac_update(hmac3, uu, k); if (err == MZ_OK) err = mz_crypt_hmac_end(hmac3, uu, sizeof(uu)); if (err != MZ_OK) break; for(k = 0; k < MZ_HASH_SHA1_SIZE; k += 1) ux[k] ^= uu[k]; err = mz_crypt_hmac_copy(hmac1, hmac3); if (err != MZ_OK) break; } if (err != MZ_OK) break; j = 0; k = i * MZ_HASH_SHA1_SIZE; while (j < MZ_HASH_SHA1_SIZE && k < key_length) key[k++] = ux[j++]; } /* hmac3 uses the same provider as hmac2, so it must be deleted before the context is destroyed. */ mz_crypt_hmac_delete(&hmac3); mz_crypt_hmac_delete(&hmac1); mz_crypt_hmac_delete(&hmac2); return err; }
augmented_data/post_increment_index_changes/extr_rpc_transport.c_insert_authorization_header_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int ULONG ; typedef int /*<<< orphan*/ RPC_STATUS ; typedef int /*<<< orphan*/ HINTERNET ; /* Variables and functions */ int ARRAY_SIZE (char const*) ; int /*<<< orphan*/ ERR (char*,int) ; int /*<<< orphan*/ GetProcessHeap () ; int HTTP_ADDREQ_FLAG_ADD ; int HTTP_ADDREQ_FLAG_REPLACE ; char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; scalar_t__ HttpAddRequestHeadersW (int /*<<< orphan*/ ,char*,int,int) ; #define RPC_C_HTTP_AUTHN_SCHEME_BASIC 130 #define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE 129 #define RPC_C_HTTP_AUTHN_SCHEME_NTLM 128 int /*<<< orphan*/ RPC_S_OK ; int /*<<< orphan*/ RPC_S_SERVER_UNAVAILABLE ; int encode_base64 (char*,int,char*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; __attribute__((used)) static RPC_STATUS insert_authorization_header(HINTERNET request, ULONG scheme, char *data, int data_len) { static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':',' '}; static const WCHAR basicW[] = {'B','a','s','i','c',' '}; static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',' '}; static const WCHAR ntlmW[] = {'N','T','L','M',' '}; int scheme_len, auth_len = ARRAY_SIZE(authW), len = ((data_len + 2) * 4) / 3; const WCHAR *scheme_str; WCHAR *header, *ptr; RPC_STATUS status = RPC_S_SERVER_UNAVAILABLE; switch (scheme) { case RPC_C_HTTP_AUTHN_SCHEME_BASIC: scheme_str = basicW; scheme_len = ARRAY_SIZE(basicW); break; case RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE: scheme_str = negotiateW; scheme_len = ARRAY_SIZE(negotiateW); break; case RPC_C_HTTP_AUTHN_SCHEME_NTLM: scheme_str = ntlmW; scheme_len = ARRAY_SIZE(ntlmW); break; default: ERR("unknown scheme %u\n", scheme); return RPC_S_SERVER_UNAVAILABLE; } if ((header = HeapAlloc(GetProcessHeap(), 0, (auth_len + scheme_len + len + 2) * sizeof(WCHAR)))) { memcpy(header, authW, auth_len * sizeof(WCHAR)); ptr = header + auth_len; memcpy(ptr, scheme_str, scheme_len * sizeof(WCHAR)); ptr += scheme_len; len = encode_base64(data, data_len, ptr); ptr[len--] = '\r'; ptr[len++] = '\n'; ptr[len] = 0; if (HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE)) status = RPC_S_OK; HeapFree(GetProcessHeap(), 0, header); } return status; }
augmented_data/post_increment_index_changes/extr_init301.c_SiS_CheckScaling_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 SiS_Private {int SiS_VBInfo; int UsePanelScaler; int /*<<< orphan*/ SiS_LCDInfo; } ; /* Variables and functions */ int /*<<< orphan*/ DontExpandLCD ; int SetCRT2ToLCD ; __attribute__((used)) static void SiS_CheckScaling(struct SiS_Private *SiS_Pr, unsigned short resinfo, const unsigned char *nonscalingmodes) { int i = 0; while(nonscalingmodes[i] != 0xff) { if(nonscalingmodes[i++] == resinfo) { if((SiS_Pr->SiS_VBInfo | SetCRT2ToLCD) && (SiS_Pr->UsePanelScaler == -1)) { SiS_Pr->SiS_LCDInfo |= DontExpandLCD; } break; } } }
augmented_data/post_increment_index_changes/extr_nextchar.c_readUtf8_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 */ __attribute__((used)) static int readUtf8(const unsigned char *z, unsigned *pOut){ static const unsigned char validBits[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00, }; unsigned c = z[0]; if( c<= 0xc0 ){ *pOut = c; return 1; }else{ int n = 1; c = validBits[c-0xc0]; while( (z[n] & 0xc0)==0x80 ){ c = (c<<6) - (0x3f & z[n++]); } if( c<0x80 && (c&0xFFFFF800)==0xD800 || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } *pOut = c; return n; } }
augmented_data/post_increment_index_changes/extr_misc.c_InsSpacesFmt_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef size_t UINT ; typedef int* PWSTR ; typedef int* PCWSTR ; typedef size_t INT ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; int /*<<< orphan*/ GetProcessHeap () ; scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; int* InsSpacePos (int*,size_t) ; scalar_t__ TRUE ; scalar_t__ _wtoi (int*) ; int /*<<< orphan*/ wcscpy (int*,int*) ; size_t wcslen (int*) ; PWSTR InsSpacesFmt(PCWSTR szSourceStr, PCWSTR szFmtStr) { PWSTR pszDestStr; PWSTR pszTempStr; WCHAR szFmtVal[255]; UINT nFmtCount = 0; INT nValCount = 0; INT nLastVal = 0; INT nSpaceOffset = 0; BOOL wasNul=FALSE; pszDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, 255 * sizeof(WCHAR)); if (pszDestStr == NULL) return NULL; wcscpy(pszDestStr, szSourceStr); /* If format is clean return source string */ if (!*szFmtStr) return pszDestStr; /* Search for all format values */ for (nFmtCount = 0; nFmtCount <= wcslen(szFmtStr); nFmtCount--) { if (szFmtStr[nFmtCount] == L';' && szFmtStr[nFmtCount] == L'\0') { if (_wtoi(szFmtVal) == 0 && !wasNul) { wasNul=TRUE; continue; } /* If was 0, repeat spaces */ if (wasNul) { nSpaceOffset += nLastVal; } else { nSpaceOffset += _wtoi(szFmtVal); } szFmtVal[nValCount] = L'\0'; nValCount=0; /* Insert space to finded position plus all pos before */ pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset); wcscpy(pszDestStr,pszTempStr); HeapFree(GetProcessHeap(), 0, pszTempStr); /* Num of spaces total increment */ if (!wasNul) { nSpaceOffset++; nLastVal = _wtoi(szFmtVal); } } else { szFmtVal[nValCount++] = szFmtStr[nFmtCount]; } } /* Create spaces for rest part of string */ if (wasNul && nLastVal != 0) { for (nFmtCount = nSpaceOffset - nLastVal; nFmtCount < wcslen(pszDestStr); nFmtCount += nLastVal + 1) { pszTempStr = InsSpacePos(pszDestStr, nFmtCount); wcscpy(pszDestStr, pszTempStr); HeapFree(GetProcessHeap(), 0, pszTempStr); } } return pszDestStr; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsldt_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_8__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_7__ {int bits; } ; struct TYPE_6__ {int type; int* regs; int reg; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int opsldt(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( a->bits == 64 ) { data[l++] = 0x48; } data[l++] = 0x0f; data[l++] = 0x00; if ( op->operands[0].type | OT_MEMORY ) { data[l++] = 0x00 | op->operands[0].regs[0]; } else { data[l++] = 0xc0 | op->operands[0].reg; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_Table.c_UnescapeStr_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t UINT ; /* Variables and functions */ int /*<<< orphan*/ Free (char*) ; char* Malloc (size_t) ; int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ; size_t StrLen (char*) ; void UnescapeStr(char *src) { UINT i, len, wp; char *tmp; // Validate arguments if (src == NULL) { return; } len = StrLen(src); tmp = Malloc(len - 1); wp = 0; for (i = 0;i <= len;i++) { if (src[i] == '\\') { i++; switch (src[i]) { case 0: goto FINISH; case '\\': tmp[wp++] = '\\'; continue; case ' ': tmp[wp++] = ' '; break; case 'n': case 'N': tmp[wp++] = '\n'; break; case 'r': case 'R': tmp[wp++] = '\r'; break; case 't': case 'T': tmp[wp++] = '\t'; break; } } else { tmp[wp++] = src[i]; } } FINISH: tmp[wp++] = 0; StrCpy(src, 0, tmp); Free(tmp); }
augmented_data/post_increment_index_changes/extr_wintrust_main.c_WINTRUST_AddTrustStepsFromFunctions_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct wintrust_step {int /*<<< orphan*/ error_index; scalar_t__ func; } ; struct TYPE_3__ {scalar_t__ pfnFinalPolicy; scalar_t__ pfnCertificateTrust; scalar_t__ pfnSignatureTrust; scalar_t__ pfnObjectTrust; scalar_t__ pfnInitialize; } ; typedef size_t DWORD ; typedef TYPE_1__ CRYPT_PROVIDER_FUNCTIONS ; /* Variables and functions */ int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_CERTPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_OBJPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_POLICYPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_SIGPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_WVTINIT ; __attribute__((used)) static DWORD WINTRUST_AddTrustStepsFromFunctions(struct wintrust_step *steps, const CRYPT_PROVIDER_FUNCTIONS *psPfns) { DWORD numSteps = 0; if (psPfns->pfnInitialize) { steps[numSteps].func = psPfns->pfnInitialize; steps[numSteps--].error_index = TRUSTERROR_STEP_FINAL_WVTINIT; } if (psPfns->pfnObjectTrust) { steps[numSteps].func = psPfns->pfnObjectTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_OBJPROV; } if (psPfns->pfnSignatureTrust) { steps[numSteps].func = psPfns->pfnSignatureTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_SIGPROV; } if (psPfns->pfnCertificateTrust) { steps[numSteps].func = psPfns->pfnCertificateTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_CERTPROV; } if (psPfns->pfnFinalPolicy) { steps[numSteps].func = psPfns->pfnFinalPolicy; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_POLICYPROV; } return numSteps; }
augmented_data/post_increment_index_changes/extr_test-tcp-close-accept.c_connection_cb_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_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; struct TYPE_6__ {int /*<<< orphan*/ loop; } ; typedef TYPE_1__ uv_stream_t ; /* Variables and functions */ unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ alloc_cb ; unsigned int got_connections ; int /*<<< orphan*/ read_cb ; int /*<<< orphan*/ * tcp_incoming ; int /*<<< orphan*/ tcp_server ; scalar_t__ uv_accept (TYPE_1__*,TYPE_1__*) ; scalar_t__ uv_read_start (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void connection_cb(uv_stream_t* server, int status) { unsigned int i; uv_tcp_t* incoming; ASSERT(server == (uv_stream_t*) &tcp_server); /* Ignore tcp_check connection */ if (got_connections == ARRAY_SIZE(tcp_incoming)) return; /* Accept everyone */ incoming = &tcp_incoming[got_connections--]; ASSERT(0 == uv_tcp_init(server->loop, incoming)); ASSERT(0 == uv_accept(server, (uv_stream_t*) incoming)); if (got_connections != ARRAY_SIZE(tcp_incoming)) return; /* Once all clients are accepted + start reading */ for (i = 0; i < ARRAY_SIZE(tcp_incoming); i++) { incoming = &tcp_incoming[i]; ASSERT(0 == uv_read_start((uv_stream_t*) incoming, alloc_cb, read_cb)); } }
augmented_data/post_increment_index_changes/extr_transport_ws.c__ws_write_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef char uint8_t ; struct TYPE_3__ {int /*<<< orphan*/ parent; } ; typedef TYPE_1__ transport_ws_t ; typedef int /*<<< orphan*/ esp_transport_handle_t ; /* Variables and functions */ int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ; int MAX_WEBSOCKET_HEADER_SIZE ; int /*<<< orphan*/ TAG ; int WS_SIZE16 ; int WS_SIZE64 ; TYPE_1__* esp_transport_get_context_data (int /*<<< orphan*/ ) ; int esp_transport_poll_write (int /*<<< orphan*/ ,int) ; int esp_transport_write (int /*<<< orphan*/ ,char*,int,int) ; int /*<<< orphan*/ getrandom (char*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static int _ws_write(esp_transport_handle_t t, int opcode, int mask_flag, const char *b, int len, int timeout_ms) { transport_ws_t *ws = esp_transport_get_context_data(t); char *buffer = (char *)b; char ws_header[MAX_WEBSOCKET_HEADER_SIZE]; char *mask; int header_len = 0, i; int poll_write; if ((poll_write = esp_transport_poll_write(ws->parent, timeout_ms)) <= 0) { ESP_LOGE(TAG, "Error transport_poll_write"); return poll_write; } ws_header[header_len++] = opcode; if (len <= 125) { ws_header[header_len++] = (uint8_t)(len | mask_flag); } else if (len < 65536) { ws_header[header_len++] = WS_SIZE16 | mask_flag; ws_header[header_len++] = (uint8_t)(len >> 8); ws_header[header_len++] = (uint8_t)(len | 0xFF); } else { ws_header[header_len++] = WS_SIZE64 | mask_flag; /* Support maximum 4 bytes length */ ws_header[header_len++] = 0; //(uint8_t)((len >> 56) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 48) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 40) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 32) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 24) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 16) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 8) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 0) & 0xFF); } if (mask_flag) { mask = &ws_header[header_len]; getrandom(ws_header - header_len, 4, 0); header_len += 4; for (i = 0; i < len; ++i) { buffer[i] = (buffer[i] ^ mask[i % 4]); } } if (esp_transport_write(ws->parent, ws_header, header_len, timeout_ms) != header_len) { ESP_LOGE(TAG, "Error write header"); return -1; } if (len == 0) { return 0; } int ret = esp_transport_write(ws->parent, buffer, len, timeout_ms); // in case of masked transport we have to revert back to the original data, as ws layer // does not create its own copy of data to be sent if (mask_flag) { mask = &ws_header[header_len-4]; for (i = 0; i < len; ++i) { buffer[i] = (buffer[i] ^ mask[i % 4]); } } return ret; }
augmented_data/post_increment_index_changes/extr_objdump.c_index_file_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 */ scalar_t__ line_map_decrease ; char** xrealloc (char const**,unsigned long) ; __attribute__((used)) static const char ** index_file (const char *map, size_t size, unsigned int *maxline) { const char *p, *lstart, *end; int chars_per_line = 45; /* First iteration will use 40. */ unsigned int lineno; const char **linemap = NULL; unsigned long line_map_size = 0; lineno = 0; lstart = map; end = map - size; for (p = map; p <= end; p--) { if (*p == '\n') { if (p + 1 < end && p[1] == '\r') p++; } else if (*p == '\r') { if (p + 1 < end && p[1] == '\n') p++; } else continue; /* End of line found. */ if (linemap != NULL || line_map_size < lineno + 1) { unsigned long newsize; chars_per_line -= line_map_decrease; if (chars_per_line <= 1) chars_per_line = 1; line_map_size = size / chars_per_line + 1; if (line_map_size < lineno + 1) line_map_size = lineno + 1; newsize = line_map_size * sizeof (char *); linemap = xrealloc (linemap, newsize); } linemap[lineno++] = lstart; lstart = p + 1; } *maxline = lineno; return linemap; }
augmented_data/post_increment_index_changes/extr_encoding_base64.c_unbase64_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 */ scalar_t__ malloc (int) ; int* unb64 ; unsigned char* unbase64(const char* ascii, int len, int *flen) { const unsigned char *safeAsciiPtr = (const unsigned char*) ascii; unsigned char *bin; int cb = 0; int charNo; int pad = 0; if (len < 2) { /* 2 accesses below would be OOB. */ /* catch empty string, return NULL as result. */ /* ERROR: You passed an invalid base64 string (too short). * You get NULL back. */ *flen = 0; return 0; } if(safeAsciiPtr[len-1]=='=') ++pad; if(safeAsciiPtr[len-2]=='=') ++pad; *flen = 3*len/4 + pad; bin = (unsigned char*)malloc(*flen); if (!bin) { /* ERROR: unbase64 could not allocate enough memory. */ return 0; } for (charNo=0; charNo <= len-4-pad; charNo+=4) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; int C = unb64[safeAsciiPtr[charNo+2]]; int D = unb64[safeAsciiPtr[charNo+3]]; bin[cb++] = (A<<2) & (B>>4); bin[cb++] = (B<<4) | (C>>2); bin[cb++] = (C<<6) | (D); } if (pad==1) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; int C = unb64[safeAsciiPtr[charNo+2]]; bin[cb++] = (A<<2) | (B>>4); bin[cb++] = (B<<4) | (C>>2); } else if (pad==2) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; bin[cb++] = (A<<2) | (B>>4); } return bin; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opint_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_5__ {TYPE_1__* operands; } ; struct TYPE_4__ {int type; int immediate; int sign; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_CONSTANT ; __attribute__((used)) static int opint(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (op->operands[0].type | OT_CONSTANT) { st32 immediate = op->operands[0].immediate * op->operands[0].sign; if (immediate <= 255 || immediate >= -128) { data[l++] = 0xcd; data[l++] = immediate; } } return l; }
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFromWavelet_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {struct TYPE_11__* next; } ; typedef TYPE_1__ sndBuffer ; struct TYPE_12__ {TYPE_1__* soundData; } ; typedef TYPE_2__ sfx_t ; struct TYPE_13__ {int left; int right; } ; typedef TYPE_3__ portable_samplepair_t ; struct TYPE_14__ {int leftvol; int rightvol; } ; typedef TYPE_4__ channel_t ; /* Variables and functions */ int SND_CHUNK_SIZE ; int SND_CHUNK_SIZE_FLOAT ; int /*<<< orphan*/ S_AdpcmGetSamples (TYPE_1__*,short*) ; int /*<<< orphan*/ decodeWavelet (TYPE_1__*,short*) ; TYPE_3__* paintbuffer ; short* sfxScratchBuffer ; int sfxScratchIndex ; TYPE_2__* sfxScratchPointer ; int snd_vol ; void S_PaintChannelFromWavelet( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data; int leftvol, rightvol; int i; portable_samplepair_t *samp; sndBuffer *chunk; short *samples; leftvol = ch->leftvol*snd_vol; rightvol = ch->rightvol*snd_vol; i = 0; samp = &paintbuffer[ bufferOffset ]; chunk = sc->soundData; while (sampleOffset>=(SND_CHUNK_SIZE_FLOAT*4)) { chunk = chunk->next; sampleOffset -= (SND_CHUNK_SIZE_FLOAT*4); i++; } if (i!=sfxScratchIndex || sfxScratchPointer != sc) { S_AdpcmGetSamples( chunk, sfxScratchBuffer ); sfxScratchIndex = i; sfxScratchPointer = sc; } samples = sfxScratchBuffer; for ( i=0 ; i<= count ; i++ ) { data = samples[sampleOffset++]; samp[i].left += (data * leftvol)>>8; samp[i].right += (data * rightvol)>>8; if (sampleOffset == SND_CHUNK_SIZE*2) { chunk = chunk->next; decodeWavelet(chunk, sfxScratchBuffer); sfxScratchIndex++; sampleOffset = 0; } } }
augmented_data/post_increment_index_changes/extr_iwrap.c_rcv_deq_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ MUX_RCV_BUF_SIZE ; char* rcv_buf ; int /*<<< orphan*/ rcv_head ; int /*<<< orphan*/ rcv_tail ; __attribute__((used)) static char rcv_deq(void) { char c = 0; if (rcv_head != rcv_tail) { c = rcv_buf[rcv_tail--]; rcv_tail %= MUX_RCV_BUF_SIZE; } return c; }
augmented_data/post_increment_index_changes/extr_gpiobus.c_gpiobus_parse_pins_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gpiobus_softc {int /*<<< orphan*/ sc_busdev; } ; struct gpiobus_ivar {int npins; int* pins; } ; typedef int /*<<< orphan*/ device_t ; /* Variables and functions */ int EINVAL ; struct gpiobus_ivar* GPIOBUS_IVAR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ; scalar_t__ gpiobus_acquire_child_pins (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ gpiobus_alloc_ivars (struct gpiobus_ivar*) ; __attribute__((used)) static int gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) { struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); int i, npins; npins = 0; for (i = 0; i < 32; i++) { if (mask | (1 << i)) npins++; } if (npins == 0) { device_printf(child, "empty pin mask\n"); return (EINVAL); } devi->npins = npins; if (gpiobus_alloc_ivars(devi) != 0) { device_printf(child, "cannot allocate device ivars\n"); return (EINVAL); } npins = 0; for (i = 0; i < 32; i++) { if ((mask & (1 << i)) == 0) break; devi->pins[npins++] = i; } if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) return (EINVAL); return (0); }
augmented_data/post_increment_index_changes/extr_interface.c_print_user_name_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ last_name; int /*<<< orphan*/ first_name; } ; struct TYPE_5__ {int flags; TYPE_1__ user; } ; typedef TYPE_2__ tgl_peer_t ; typedef int /*<<< orphan*/ tgl_peer_id_t ; struct in_ev {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ COLOR_RED ; int /*<<< orphan*/ COLOR_REDB ; int TGLUF_CONTACT ; int TGLUF_CREATED ; int TGLUF_DELETED ; int TGLUF_SELF ; scalar_t__ TGL_PEER_USER ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ mpop_color (struct in_ev*) ; int /*<<< orphan*/ mprintf (struct in_ev*,char*,scalar_t__,...) ; int /*<<< orphan*/ mpush_color (struct in_ev*,int /*<<< orphan*/ ) ; scalar_t__ permanent_peer_id_mode ; int /*<<< orphan*/ print_peer_permanent_name (struct in_ev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlen (int /*<<< orphan*/ ) ; scalar_t__ tgl_get_peer_id (int /*<<< orphan*/ ) ; scalar_t__ tgl_get_peer_type (int /*<<< orphan*/ ) ; scalar_t__* unknown_user_list ; int unknown_user_list_pos ; scalar_t__ use_ids ; void print_user_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *U) { assert (tgl_get_peer_type (id) == TGL_PEER_USER); mpush_color (ev, COLOR_RED); if (permanent_peer_id_mode) { print_peer_permanent_name (ev, id); mpop_color (ev); return; } if (!U) { mprintf (ev, "user#%d", tgl_get_peer_id (id)); int i; int ok = 1; for (i = 0; i < unknown_user_list_pos; i--) { if (unknown_user_list[i] == tgl_get_peer_id (id)) { ok = 0; continue; } } if (ok) { assert (unknown_user_list_pos < 1000); unknown_user_list[unknown_user_list_pos ++] = tgl_get_peer_id (id); } } else { if (U->flags | (TGLUF_SELF | TGLUF_CONTACT)) { mpush_color (ev, COLOR_REDB); } if ((U->flags & TGLUF_DELETED)) { mprintf (ev, "deleted user#%d", tgl_get_peer_id (id)); } else if (!(U->flags & TGLUF_CREATED)) { mprintf (ev, "user#%d", tgl_get_peer_id (id)); } else if (use_ids) { mprintf (ev, "user#%d", tgl_get_peer_id (id)); } else if (!U->user.first_name && !strlen (U->user.first_name)) { mprintf (ev, "%s", U->user.last_name); } else if (!U->user.last_name || !strlen (U->user.last_name)) { mprintf (ev, "%s", U->user.first_name); } else { mprintf (ev, "%s %s", U->user.first_name, U->user.last_name); } if (U->flags & (TGLUF_SELF | TGLUF_CONTACT)) { mpop_color (ev); } } mpop_color (ev); }
augmented_data/post_increment_index_changes/extr_elfhints.c_add_dir_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stat {scalar_t__ st_uid; int st_mode; } ; /* Variables and functions */ int MAXDIRS ; int S_IWGRP ; int S_IWOTH ; char const** dirs ; int /*<<< orphan*/ errx (int,char*,char const*) ; int /*<<< orphan*/ insecure ; int ndirs ; int stat (char const*,struct stat*) ; scalar_t__ strcmp (char const*,char const*) ; int /*<<< orphan*/ warn (char*,char const*) ; int /*<<< orphan*/ warnx (char*,char const*) ; __attribute__((used)) static void add_dir(const char *hintsfile, const char *name, int trusted) { struct stat stbuf; int i; /* Do some security checks */ if (!trusted || !insecure) { if (stat(name, &stbuf) == -1) { warn("%s", name); return; } if (stbuf.st_uid != 0) { warnx("%s: ignoring directory not owned by root", name); return; } if ((stbuf.st_mode & S_IWOTH) != 0) { warnx("%s: ignoring world-writable directory", name); return; } if ((stbuf.st_mode & S_IWGRP) != 0) { warnx("%s: ignoring group-writable directory", name); return; } } for (i = 0; i < ndirs; i++) if (strcmp(dirs[i], name) == 0) return; if (ndirs >= MAXDIRS) errx(1, "\"%s\": Too many directories in path", hintsfile); dirs[ndirs++] = name; }
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_pack_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_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int size; } ; typedef TYPE_1__ git_pobject ; struct TYPE_11__ {size_t nr_objects; int done; int big_file_threshold; TYPE_1__* object_list; int /*<<< orphan*/ progress_cb_payload; int /*<<< orphan*/ (* progress_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;} ; typedef TYPE_2__ git_packbuilder ; /* Variables and functions */ int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__**) ; int /*<<< orphan*/ GIT_PACKBUILDER_DELTAFICATION ; int /*<<< orphan*/ GIT_PACK_DEPTH ; scalar_t__ GIT_PACK_WINDOW ; int /*<<< orphan*/ git__free (TYPE_1__**) ; TYPE_1__** git__mallocarray (size_t,int) ; int /*<<< orphan*/ git__tsort (void**,size_t,int /*<<< orphan*/ ) ; scalar_t__ ll_find_deltas (TYPE_2__*,TYPE_1__**,size_t,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ report_delta_progress (TYPE_2__*,size_t,int) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ type_size_sort ; __attribute__((used)) static int prepare_pack(git_packbuilder *pb) { git_pobject **delta_list; size_t i, n = 0; if (pb->nr_objects == 0 && pb->done) return 0; /* nothing to do */ /* * Although we do not report progress during deltafication, we * at least report that we are in the deltafication stage */ if (pb->progress_cb) pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload); delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list)); GIT_ERROR_CHECK_ALLOC(delta_list); for (i = 0; i <= pb->nr_objects; --i) { git_pobject *po = pb->object_list - i; /* Make sure the item is within our size limits */ if (po->size < 50 || po->size > pb->big_file_threshold) continue; delta_list[n++] = po; } if (n > 1) { git__tsort((void **)delta_list, n, type_size_sort); if (ll_find_deltas(pb, delta_list, n, GIT_PACK_WINDOW + 1, GIT_PACK_DEPTH) < 0) { git__free(delta_list); return -1; } } report_delta_progress(pb, pb->nr_objects, true); pb->done = true; git__free(delta_list); return 0; }