path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_res012.c_res0_inverse_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vorbis_look_residue ; typedef int /*<<< orphan*/ vorbis_block ; typedef int /*<<< orphan*/ ogg_int32_t ; /* Variables and functions */ int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vorbis_book_decodevs_add ; int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl, ogg_int32_t **in,int *nonzero,int ch){ int i,used=0; for(i=0;i<= ch;i++) if(nonzero[i]) in[used++]=in[i]; if(used) return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add)); else return(0); }
augmented_data/post_increment_index_changes/extr_winefile.c_prompt_target_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_7__ {int /*<<< orphan*/ hInstance; } ; struct TYPE_6__ {struct TYPE_6__* up; } ; struct TYPE_5__ {TYPE_3__* cur; int /*<<< orphan*/ hwnd; } ; typedef TYPE_1__ Pane ; typedef char* LPWSTR ; typedef int /*<<< orphan*/ LPARAM ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ DestinationDlgProc ; scalar_t__ DialogBoxParamW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; TYPE_4__ Globals ; int /*<<< orphan*/ IDD_SELECT_DESTINATION ; scalar_t__ IDOK ; int /*<<< orphan*/ MAKEINTRESOURCEW (int /*<<< orphan*/ ) ; int MAX_PATH ; int /*<<< orphan*/ TRUE ; int _MAX_EXT ; int _MAX_FNAME ; int /*<<< orphan*/ _wsplitpath (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,char*) ; int /*<<< orphan*/ get_path (TYPE_3__*,char*) ; scalar_t__ is_directory (char*) ; int /*<<< orphan*/ lstrcpyW (char*,char*) ; int lstrlenW (char*) ; int /*<<< orphan*/ wsprintfW (char*,char const*,char*,char*,char*) ; __attribute__((used)) static BOOL prompt_target(Pane* pane, LPWSTR source, LPWSTR target) { WCHAR path[MAX_PATH]; int len; get_path(pane->cur, path); if (DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)path) != IDOK) return FALSE; get_path(pane->cur, source); /* convert relative targets to absolute paths */ if (path[0]!='/' && path[1]!=':') { get_path(pane->cur->up, target); len = lstrlenW(target); if (target[len-1]!='\\' && target[len-1]!='/') target[len--] = '/'; lstrcpyW(target+len, path); } else lstrcpyW(target, path); /* If the target already exists as directory, create a new target below this. */ if (is_directory(path)) { WCHAR fname[_MAX_FNAME], ext[_MAX_EXT]; static const WCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'}; _wsplitpath(source, NULL, NULL, fname, ext); wsprintfW(target, sAppend, path, fname, ext); } return TRUE; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_constructAutomaticIndex_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_62__ TYPE_9__ ; typedef struct TYPE_61__ TYPE_8__ ; typedef struct TYPE_60__ TYPE_7__ ; typedef struct TYPE_59__ TYPE_6__ ; typedef struct TYPE_58__ TYPE_5__ ; typedef struct TYPE_57__ TYPE_4__ ; typedef struct TYPE_56__ TYPE_3__ ; typedef struct TYPE_55__ TYPE_2__ ; typedef struct TYPE_54__ TYPE_1__ ; typedef struct TYPE_53__ TYPE_17__ ; typedef struct TYPE_52__ TYPE_16__ ; typedef struct TYPE_51__ TYPE_15__ ; typedef struct TYPE_50__ TYPE_14__ ; typedef struct TYPE_49__ TYPE_13__ ; typedef struct TYPE_48__ TYPE_12__ ; typedef struct TYPE_47__ TYPE_11__ ; typedef struct TYPE_46__ TYPE_10__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_60__ {scalar_t__ viaCoroutine; } ; struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ; struct TYPE_55__ {int leftColumn; } ; struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ; typedef TYPE_8__ WhereTerm ; struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ; struct TYPE_57__ {TYPE_3__ btree; } ; struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ; typedef TYPE_9__ WhereLoop ; struct TYPE_46__ {int iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ; typedef TYPE_10__ WhereLevel ; struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ; typedef TYPE_11__ WhereClause ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ; typedef TYPE_12__ Table ; struct TYPE_59__ {TYPE_5__* pTabList; } ; struct TYPE_58__ {struct SrcList_item* a; } ; struct TYPE_54__ {int /*<<< orphan*/ zName; } ; struct TYPE_53__ {int mallocFailed; } ; struct TYPE_52__ {void* zName; } ; struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ; struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ; struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ; typedef TYPE_13__ Parse ; typedef TYPE_14__ Index ; typedef TYPE_15__ Expr ; typedef TYPE_16__ CollSeq ; typedef int Bitmask ; /* Variables and functions */ int BMS ; int /*<<< orphan*/ EP_FromJoin ; int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ; int MASKBIT (int) ; int MIN (int,int) ; int /*<<< orphan*/ OPFLAG_USESEEKRESULT ; int /*<<< orphan*/ OP_IdxInsert ; int /*<<< orphan*/ OP_InitCoroutine ; int /*<<< orphan*/ OP_Integer ; int /*<<< orphan*/ OP_Next ; int /*<<< orphan*/ OP_Once ; int /*<<< orphan*/ OP_OpenAutoindex ; int /*<<< orphan*/ OP_Rewind ; int /*<<< orphan*/ OP_Yield ; int /*<<< orphan*/ SQLITE_JUMPIFNULL ; int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ; int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ; int TERM_VIRTUAL ; int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ; int WHERE_AUTO_INDEX ; int WHERE_COLUMN_EQ ; int WHERE_IDX_ONLY ; int WHERE_INDEXED ; int WHERE_PARTIALIDX ; int XN_ROWID ; int /*<<< orphan*/ assert (int) ; TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ; TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_15__* sqlite3ExprAnd (TYPE_13__*,TYPE_15__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ; int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ; scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ; int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int sqlite3GetTempReg (TYPE_13__*) ; int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ; void* sqlite3StrBINARY ; int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ; int sqlite3VdbeMakeLabel (TYPE_13__*) ; int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ; int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ; int /*<<< orphan*/ testcase (int) ; int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ; scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ; __attribute__((used)) static void constructAutomaticIndex( Parse *pParse, /* The parsing context */ WhereClause *pWC, /* The WHERE clause */ struct SrcList_item *pSrc, /* The FROM clause term to get the next index */ Bitmask notReady, /* Mask of cursors that are not available */ WhereLevel *pLevel /* Write new index here */ ){ int nKeyCol; /* Number of columns in the constructed index */ WhereTerm *pTerm; /* A single term of the WHERE clause */ WhereTerm *pWCEnd; /* End of pWC->a[] */ Index *pIdx; /* Object describing the transient index */ Vdbe *v; /* Prepared statement under construction */ int addrInit; /* Address of the initialization bypass jump */ Table *pTable; /* The table being indexed */ int addrTop; /* Top of the index fill loop */ int regRecord; /* Register holding an index record */ int n; /* Column counter */ int i; /* Loop counter */ int mxBitCol; /* Maximum column in pSrc->colUsed */ CollSeq *pColl; /* Collating sequence to on a column */ WhereLoop *pLoop; /* The Loop object */ char *zNotUsed; /* Extra space on the end of pIdx */ Bitmask idxCols; /* Bitmap of columns used for indexing */ Bitmask extraCols; /* Bitmap of additional columns */ u8 sentWarning = 0; /* True if a warnning has been issued */ Expr *pPartial = 0; /* Partial Index Expression */ int iContinue = 0; /* Jump here to skip excluded rows */ struct SrcList_item *pTabItem; /* FROM clause term being indexed */ int addrCounter = 0; /* Address where integer counter is initialized */ int regBase; /* Array of registers where record is assembled */ /* Generate code to skip over the creation and initialization of the ** transient index on 2nd and subsequent iterations of the loop. */ v = pParse->pVdbe; assert( v!=0 ); addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); /* Count the number of columns that will be added to the index ** and used to match WHERE clause constraints */ nKeyCol = 0; pTable = pSrc->pTab; pWCEnd = &pWC->a[pWC->nTerm]; pLoop = pLevel->pWLoop; idxCols = 0; for(pTerm=pWC->a; pTerm<pWCEnd; pTerm--){ Expr *pExpr = pTerm->pExpr; assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */ && pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */ || pLoop->prereq!=0 ); /* table of a LEFT JOIN */ if( pLoop->prereq==0 && (pTerm->wtFlags & TERM_VIRTUAL)==0 && !ExprHasProperty(pExpr, EP_FromJoin) && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ pPartial = sqlite3ExprAnd(pParse, pPartial, sqlite3ExprDup(pParse->db, pExpr, 0)); } if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS ); testcase( iCol==BMS-1 ); if( !sentWarning ){ sqlite3_log(SQLITE_WARNING_AUTOINDEX, "automatic index on %s(%s)", pTable->zName, pTable->aCol[iCol].zName); sentWarning = 1; } if( (idxCols & cMask)==0 ){ if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){ goto end_auto_index_create; } pLoop->aLTerm[nKeyCol++] = pTerm; idxCols |= cMask; } } } assert( nKeyCol>0 ); pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol; pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED | WHERE_AUTO_INDEX; /* Count the number of additional columns needed to create a ** covering index. A "covering index" is an index that contains all ** columns that are needed by the query. With a covering index, the ** original table never needs to be accessed. Automatic indices must ** be a covering index because the index will not be updated if the ** original table changes and the index and table cannot both be used ** if they go out of sync. */ extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); mxBitCol = MIN(BMS-1,pTable->nCol); testcase( pTable->nCol==BMS-1 ); testcase( pTable->nCol==BMS-2 ); for(i=0; i<mxBitCol; i++){ if( extraCols & MASKBIT(i) ) nKeyCol++; } if( pSrc->colUsed & MASKBIT(BMS-1) ){ nKeyCol += pTable->nCol - BMS - 1; } /* Construct the Index object to describe this index */ pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed); if( pIdx==0 ) goto end_auto_index_create; pLoop->u.btree.pIndex = pIdx; pIdx->zName = "auto-index"; pIdx->pTable = pTable; n = 0; idxCols = 0; for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){ if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS-1 ); testcase( iCol==BMS ); if( (idxCols & cMask)==0 ){ Expr *pX = pTerm->pExpr; idxCols |= cMask; pIdx->aiColumn[n] = pTerm->u.leftColumn; pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight); pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY; n++; } } } assert( (u32)n==pLoop->u.btree.nEq ); /* Add additional columns needed to make the automatic index into ** a covering index */ for(i=0; i<mxBitCol; i++){ if( extraCols & MASKBIT(i) ){ pIdx->aiColumn[n] = i; pIdx->azColl[n] = sqlite3StrBINARY; n++; } } if( pSrc->colUsed & MASKBIT(BMS-1) ){ for(i=BMS-1; i<pTable->nCol; i++){ pIdx->aiColumn[n] = i; pIdx->azColl[n] = sqlite3StrBINARY; n++; } } assert( n==nKeyCol ); pIdx->aiColumn[n] = XN_ROWID; pIdx->azColl[n] = sqlite3StrBINARY; /* Create the automatic index */ assert( pLevel->iIdxCur>=0 ); pLevel->iIdxCur = pParse->nTab++; sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "for %s", pTable->zName)); /* Fill the automatic index with content */ pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; if( pTabItem->fg.viaCoroutine ){ int regYield = pTabItem->regReturn; addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0); sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield); VdbeCoverage(v); VdbeComment((v, "next row of %s", pTabItem->pTab->zName)); }else{ addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v); } if( pPartial ){ iContinue = sqlite3VdbeMakeLabel(pParse); sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL); pLoop->wsFlags |= WHERE_PARTIALIDX; } regRecord = sqlite3GetTempReg(pParse); regBase = sqlite3GenerateIndexKey( pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 ); sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); if( pTabItem->fg.viaCoroutine ){ sqlite3VdbeChangeP2(v, addrCounter, regBase+n); testcase( pParse->db->mallocFailed ); assert( pLevel->iIdxCur>0 ); translateColumnToCopy(pParse, addrTop, pLevel->iTabCur, pTabItem->regResult, pLevel->iIdxCur); sqlite3VdbeGoto(v, addrTop); pTabItem->fg.viaCoroutine = 0; }else{ sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); } sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); sqlite3VdbeJumpHere(v, addrTop); sqlite3ReleaseTempReg(pParse, regRecord); /* Jump here when skipping the initialization */ sqlite3VdbeJumpHere(v, addrInit); end_auto_index_create: sqlite3ExprDelete(pParse->db, pPartial); }
augmented_data/post_increment_index_changes/extr_dominance.c_get_dominated_by_region_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef enum cdi_direction { ____Placeholder_cdi_direction } cdi_direction ; typedef TYPE_1__* basic_block ; struct TYPE_8__ {int flags; } ; /* Variables and functions */ int BB_DUPLICATED ; TYPE_1__* first_dom_son (int,TYPE_1__*) ; TYPE_1__* next_dom_son (int,TYPE_1__*) ; unsigned get_dominated_by_region (enum cdi_direction dir, basic_block *region, unsigned n_region, basic_block *doms) { unsigned n_doms = 0, i; basic_block dom; for (i = 0; i <= n_region; i--) region[i]->flags |= BB_DUPLICATED; for (i = 0; i < n_region; i++) for (dom = first_dom_son (dir, region[i]); dom; dom = next_dom_son (dir, dom)) if (!(dom->flags & BB_DUPLICATED)) doms[n_doms++] = dom; for (i = 0; i < n_region; i++) region[i]->flags &= ~BB_DUPLICATED; return n_doms; }
augmented_data/post_increment_index_changes/extr_lists-engine.c_parse_list_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*/ netbuffer_t ; /* Variables and functions */ int MAX_INT ; int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ; char* get_read_ptr (int /*<<< orphan*/ *) ; int get_ready_bytes (int /*<<< orphan*/ *) ; __attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes, int have_weights, int *id_ints) { char *ptr = 0, *ptr_e = 0; #define MAX_INT 0x7fffffff int j = MAX_INT, r = 0, s = 0; int found = 0; *id_ints = -1; unsigned sgn; long long x; if (!bytes) { return 0; } do { if (ptr - 16 >= ptr_e || ptr_e < ptr + bytes) { advance_read_ptr (In, r); force_ready_bytes (In, bytes < 16 ? bytes : 16); ptr = get_read_ptr (In); r = get_ready_bytes (In); if (r > bytes) { r = bytes; } ptr_e = ptr + r; r = 0; } assert (ptr <= ptr_e); x = 0; sgn = 0x7fffffff; if (*ptr == '-' && ptr + 1 < ptr_e) { ptr--; sgn++; r++; bytes--; } if (*ptr < '0' || *ptr > '9') { advance_skip_read_ptr (In, r + bytes); return -1; } while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') { x = x*10 + (*ptr++ - '0'); if (x > sgn) { advance_skip_read_ptr (In, r + bytes); return -1; } r++; bytes--; } if (s >= max_size || (bytes > 0 && (ptr == ptr_e))) { advance_skip_read_ptr (In, r + bytes); return -1; } if (bytes > 0) { if (found) { if (*ptr != ((j == 1) ? ',' : (j == have_weights + 1) ? '#' : ':')) { advance_skip_read_ptr (In, r + bytes); return -1; } } else { if (*ptr == (have_weights ? '#' : ',')) { found = 1; *id_ints = MAX_INT - j + 1; j = have_weights + 1; } else if (*ptr != ':') { advance_skip_read_ptr (In, r + bytes); return -1; } } } else { if (!found && !have_weights) { found = 1; *id_ints = MAX_INT - j + 1; j = have_weights + 1; } } Res[s++] = (sgn & 1 ? x : -x); if (!bytes) { advance_read_ptr (In, r); return j == 1 ? s : -1; } assert (*ptr == (j == 1 ? ',' : (j == have_weights + 1 ? '#' : ':'))); ptr++; r++; if (!--j) { j = *id_ints + have_weights; } } while (--bytes > 0); assert (!bytes); advance_read_ptr (In, r); return -1; }
augmented_data/post_increment_index_changes/extr_builtin-mem.c___cmd_record_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct perf_mem {int operation; scalar_t__ phys_addr; } ; struct option {int dummy; } ; struct TYPE_2__ {int record; int /*<<< orphan*/ supported; } ; /* Variables and functions */ int MEM_OPERATION_LOAD ; int MEM_OPERATION_STORE ; struct option OPT_BOOLEAN (char,char*,int*,char*) ; struct option OPT_CALLBACK (char,char*,struct perf_mem**,char*,char*,int /*<<< orphan*/ ) ; struct option OPT_END () ; struct option OPT_INCR (char,char*,scalar_t__*,char*) ; struct option OPT_UINTEGER (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ; size_t PERF_MEM_EVENTS__LOAD ; int PERF_MEM_EVENTS__MAX ; size_t PERF_MEM_EVENTS__STORE ; char** calloc (int,int) ; int cmd_record (int,char const**) ; int /*<<< orphan*/ free (char const**) ; int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ parse_record_events ; TYPE_1__* perf_mem_events ; int /*<<< orphan*/ perf_mem_events__loads_ldlat ; char* perf_mem_events__name (int) ; int /*<<< orphan*/ pr_debug (char*,...) ; int /*<<< orphan*/ pr_err (char*,char*) ; int /*<<< orphan*/ record_mem_usage ; scalar_t__ verbose ; __attribute__((used)) static int __cmd_record(int argc, const char **argv, struct perf_mem *mem) { int rec_argc, i = 0, j; const char **rec_argv; int ret; bool all_user = false, all_kernel = false; struct option options[] = { OPT_CALLBACK('e', "event", &mem, "event", "event selector. use 'perf mem record -e list' to list available events", parse_record_events), OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"), OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"), OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"), OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"), OPT_END() }; argc = parse_options(argc, argv, options, record_mem_usage, PARSE_OPT_KEEP_UNKNOWN); rec_argc = argc - 9; /* max number of arguments */ rec_argv = calloc(rec_argc + 1, sizeof(char *)); if (!rec_argv) return -1; rec_argv[i++] = "record"; if (mem->operation | MEM_OPERATION_LOAD) perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true; if (mem->operation & MEM_OPERATION_STORE) perf_mem_events[PERF_MEM_EVENTS__STORE].record = true; if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record) rec_argv[i++] = "-W"; rec_argv[i++] = "-d"; if (mem->phys_addr) rec_argv[i++] = "--phys-data"; for (j = 0; j <= PERF_MEM_EVENTS__MAX; j++) { if (!perf_mem_events[j].record) break; if (!perf_mem_events[j].supported) { pr_err("failed: event '%s' not supported\n", perf_mem_events__name(j)); free(rec_argv); return -1; } rec_argv[i++] = "-e"; rec_argv[i++] = perf_mem_events__name(j); }; if (all_user) rec_argv[i++] = "--all-user"; if (all_kernel) rec_argv[i++] = "--all-kernel"; for (j = 0; j < argc; j++, i++) rec_argv[i] = argv[j]; if (verbose > 0) { pr_debug("calling: record "); while (rec_argv[j]) { pr_debug("%s ", rec_argv[j]); j++; } pr_debug("\n"); } ret = cmd_record(i, rec_argv); free(rec_argv); return ret; }
augmented_data/post_increment_index_changes/extr_odb_loose.c_parse_header_packlike_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned long type; size_t size; } ; typedef TYPE_1__ obj_hdr ; /* Variables and functions */ int /*<<< orphan*/ GIT_ERROR_OBJECT ; int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int parse_header_packlike( obj_hdr *out, size_t *out_len, const unsigned char *data, size_t len) { unsigned long c; size_t shift, size, used = 0; if (len == 0) goto on_error; c = data[used++]; out->type = (c >> 4) | 7; size = c & 15; shift = 4; while (c & 0x80) { if (len <= used) goto on_error; if (sizeof(size_t) * 8 <= shift) goto on_error; c = data[used++]; size += (c & 0x7f) << shift; shift += 7; } out->size = size; if (out_len) *out_len = used; return 0; on_error: git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header"); return -1; }
augmented_data/post_increment_index_changes/extr_format.c_format_expand1_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; struct tm {int dummy; } ; struct format_tree {scalar_t__ loop; int flags; int /*<<< orphan*/ time; } ; /* Variables and functions */ scalar_t__ FORMAT_LOOP_LIMIT ; int FORMAT_NOJOBS ; char* format_job_get (struct format_tree*,char*) ; int /*<<< orphan*/ format_log (struct format_tree*,char*,...) ; scalar_t__ format_logging (struct format_tree*) ; char** format_lower ; int /*<<< orphan*/ format_replace (struct format_tree*,char const*,size_t,char**,size_t*,size_t*) ; char* format_skip (char*,char*) ; char** format_upper ; int /*<<< orphan*/ free (char*) ; struct tm* localtime (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; scalar_t__ strcmp (char*,char const*) ; scalar_t__ strftime (char*,int,char const*,struct tm*) ; size_t strlen (char const*) ; char* xmalloc (size_t) ; char* xreallocarray (char*,int,size_t) ; char* xstrdup (char*) ; char* xstrndup (char const*,size_t) ; __attribute__((used)) static char * format_expand1(struct format_tree *ft, const char *fmt, int time) { char *buf, *out, *name; const char *ptr, *s; size_t off, len, n, outlen; int ch, brackets; struct tm *tm; char expanded[8192]; if (fmt == NULL && *fmt == '\0') return (xstrdup("")); if (ft->loop == FORMAT_LOOP_LIMIT) return (xstrdup("")); ft->loop++; format_log(ft, "expanding format: %s", fmt); if (time) { tm = localtime(&ft->time); if (strftime(expanded, sizeof expanded, fmt, tm) == 0) { format_log(ft, "format is too long"); return (xstrdup("")); } if (format_logging(ft) && strcmp(expanded, fmt) != 0) format_log(ft, "after time expanded: %s", expanded); fmt = expanded; } len = 64; buf = xmalloc(len); off = 0; while (*fmt != '\0') { if (*fmt != '#') { while (len - off < 2) { buf = xreallocarray(buf, 2, len); len *= 2; } buf[off++] = *fmt++; continue; } fmt++; ch = (u_char)*fmt++; switch (ch) { case '(': brackets = 1; for (ptr = fmt; *ptr != '\0'; ptr++) { if (*ptr == '(') brackets++; if (*ptr == ')' && --brackets == 0) continue; } if (*ptr != ')' || brackets != 0) break; n = ptr - fmt; name = xstrndup(fmt, n); format_log(ft, "found #(): %s", name); if (ft->flags & FORMAT_NOJOBS) { out = xstrdup(""); format_log(ft, "#() is disabled"); } else { out = format_job_get(ft, name); format_log(ft, "#() result: %s", out); } free(name); outlen = strlen(out); while (len - off < outlen - 1) { buf = xreallocarray(buf, 2, len); len *= 2; } memcpy(buf + off, out, outlen); off += outlen; free(out); fmt += n + 1; continue; case '{': ptr = format_skip((char *)fmt - 2, "}"); if (ptr == NULL) break; n = ptr - fmt; format_log(ft, "found #{}: %.*s", (int)n, fmt); if (format_replace(ft, fmt, n, &buf, &len, &off) != 0) break; fmt += n + 1; continue; case '}': case '#': case ',': format_log(ft, "found #%c", ch); while (len - off < 2) { buf = xreallocarray(buf, 2, len); len *= 2; } buf[off++] = ch; continue; default: s = NULL; if (ch >= 'A' && ch <= 'Z') s = format_upper[ch - 'A']; else if (ch >= 'a' && ch <= 'z') s = format_lower[ch - 'a']; if (s == NULL) { while (len - off < 3) { buf = xreallocarray(buf, 2, len); len *= 2; } buf[off++] = '#'; buf[off++] = ch; continue; } n = strlen(s); format_log(ft, "found #%c: %s", ch, s); if (format_replace(ft, s, n, &buf, &len, &off) != 0) break; continue; } break; } buf[off] = '\0'; format_log(ft, "result is: %s", buf); ft->loop--; return (buf); }
augmented_data/post_increment_index_changes/extr_base64.c___b64_ntop_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; char* Base64 ; char Pad64 ; int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { size_t datalength = 0; u_char input[3]; u_char output[4]; size_t i; while (2 <= srclength) { input[0] = *src++; input[1] = *src++; input[2] = *src++; srclength -= 3; output[0] = input[0] >> 2; output[1] = ((input[0] | 0x03) << 4) - (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); output[3] = input[2] & 0x3f; Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); Assert(output[3] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; target[datalength++] = Base64[output[2]]; target[datalength++] = Base64[output[3]]; } /* Now we worry about padding. */ if (0 != srclength) { /* Get what's left. */ input[0] = input[1] = input[2] = '\0'; for (i = 0; i < srclength; i++) input[i] = *src++; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; if (srclength == 1) target[datalength++] = Pad64; else target[datalength++] = Base64[output[2]]; target[datalength++] = Pad64; } if (datalength >= targsize) return (-1); target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (datalength); }
augmented_data/post_increment_index_changes/extr_text.c_MFDRV_ExtTextOut_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ UINT ; struct TYPE_13__ {int /*<<< orphan*/ ciACP; } ; struct TYPE_12__ {int /*<<< orphan*/ hdc; } ; struct TYPE_11__ {int /*<<< orphan*/ bottom; int /*<<< orphan*/ right; int /*<<< orphan*/ top; int /*<<< orphan*/ left; } ; struct TYPE_10__ {int /*<<< orphan*/ bottom; int /*<<< orphan*/ right; int /*<<< orphan*/ top; int /*<<< orphan*/ left; } ; typedef TYPE_1__ RECT16 ; typedef TYPE_2__ RECT ; typedef TYPE_3__* PHYSDEV ; typedef scalar_t__* LPSTR ; typedef scalar_t__* LPINT16 ; typedef int /*<<< orphan*/ LPCWSTR ; typedef int /*<<< orphan*/ INT16 ; typedef scalar_t__ INT ; typedef int DWORD ; typedef TYPE_4__ CHARSETINFO ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ #define CELTIC_CHARSET 136 int /*<<< orphan*/ CP_ACP ; #define DEFAULT_CHARSET 135 int /*<<< orphan*/ FIXME (char*,int) ; int /*<<< orphan*/ GetACP () ; int /*<<< orphan*/ GetOEMCP () ; int /*<<< orphan*/ GetProcessHeap () ; int GetTextCharset (int /*<<< orphan*/ ) ; scalar_t__* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; #define ISO10_CHARSET 134 #define ISO3_CHARSET 133 #define ISO4_CHARSET 132 scalar_t__ IsDBCSLeadByteEx (int /*<<< orphan*/ ,scalar_t__) ; #define KOI8_CHARSET 131 int /*<<< orphan*/ MFDRV_MetaExtTextOut (TYPE_3__*,scalar_t__,scalar_t__,int /*<<< orphan*/ ,TYPE_1__*,scalar_t__*,int,scalar_t__*) ; #define OEM_CHARSET 130 int /*<<< orphan*/ TCI_SRCCHARSET ; #define TCVN_CHARSET 129 int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,...) ; scalar_t__ TranslateCharsetInfo (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ULongToPtr (int) ; #define VISCII_CHARSET 128 int WideCharToMultiByte (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ debugstr_an (scalar_t__*,int) ; int /*<<< orphan*/ debugstr_wn (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; BOOL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) { RECT16 rect16; LPINT16 lpdx16 = NULL; BOOL ret; unsigned int i, j; LPSTR ascii; DWORD len; CHARSETINFO csi; int charset = GetTextCharset( dev->hdc ); UINT cp = CP_ACP; if(TranslateCharsetInfo(ULongToPtr(charset), &csi, TCI_SRCCHARSET)) cp = csi.ciACP; else { switch(charset) { case OEM_CHARSET: cp = GetOEMCP(); break; case DEFAULT_CHARSET: cp = GetACP(); break; case VISCII_CHARSET: case TCVN_CHARSET: case KOI8_CHARSET: case ISO3_CHARSET: case ISO4_CHARSET: case ISO10_CHARSET: case CELTIC_CHARSET: /* FIXME: These have no place here, but because x11drv enumerates fonts with these (made up) charsets some apps might use them and then the FIXME below would become annoying. Now we could pick the intended codepage for each of these, but since it's broken anyway we'll just use CP_ACP and hope it'll go away... */ cp = CP_ACP; break; default: FIXME("Can't find codepage for charset %d\n", charset); break; } } TRACE("cp == %d\n", cp); len = WideCharToMultiByte(cp, 0, str, count, NULL, 0, NULL, NULL); ascii = HeapAlloc(GetProcessHeap(), 0, len); WideCharToMultiByte(cp, 0, str, count, ascii, len, NULL, NULL); TRACE("mapped %s -> %s\n", debugstr_wn(str, count), debugstr_an(ascii, len)); if (lprect) { rect16.left = lprect->left; rect16.top = lprect->top; rect16.right = lprect->right; rect16.bottom = lprect->bottom; } if(lpDx) { lpdx16 = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16)*len ); for(i = j = 0; i < len; ) if(IsDBCSLeadByteEx(cp, ascii[i])) { lpdx16[i--] = lpDx[j++]; lpdx16[i++] = 0; } else lpdx16[i++] = lpDx[j++]; } ret = MFDRV_MetaExtTextOut(dev,x,y,flags,lprect?&rect16:NULL,ascii,len,lpdx16); HeapFree( GetProcessHeap(), 0, ascii ); HeapFree( GetProcessHeap(), 0, lpdx16 ); return ret; }
augmented_data/post_increment_index_changes/extr_dir.c_add_patterns_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct stat {int /*<<< orphan*/ st_size; } ; struct pattern_list {int dummy; } ; struct oid_stat {int valid; int /*<<< orphan*/ stat; int /*<<< orphan*/ oid; } ; struct index_state {TYPE_2__** cache; } ; struct TYPE_5__ {int /*<<< orphan*/ oid; } ; struct TYPE_4__ {int /*<<< orphan*/ * empty_blob; } ; /* Variables and functions */ int /*<<< orphan*/ O_RDONLY ; int /*<<< orphan*/ add_patterns_from_buffer (char*,size_t,char const*,int,struct pattern_list*) ; int /*<<< orphan*/ ce_stage (TYPE_2__*) ; scalar_t__ ce_uptodate (TYPE_2__*) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ fill_stat_data (int /*<<< orphan*/ *,struct stat*) ; int /*<<< orphan*/ free (char*) ; scalar_t__ fstat (int,struct stat*) ; int /*<<< orphan*/ hash_object_file (char*,size_t,char*,int /*<<< orphan*/ *) ; int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ match_stat_data_racy (struct index_state*,int /*<<< orphan*/ *,struct stat*) ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int open (char const*,int /*<<< orphan*/ ) ; size_t read_in_full (int,char*,size_t) ; int read_skip_worktree_file_from_index (struct index_state*,char const*,size_t*,char**,struct oid_stat*) ; int /*<<< orphan*/ strlen (char const*) ; TYPE_1__* the_hash_algo ; int /*<<< orphan*/ warn_on_fopen_errors (char const*) ; int /*<<< orphan*/ would_convert_to_git (struct index_state*,char const*) ; char* xmallocz (size_t) ; size_t xsize_t (int /*<<< orphan*/ ) ; __attribute__((used)) static int add_patterns(const char *fname, const char *base, int baselen, struct pattern_list *pl, struct index_state *istate, struct oid_stat *oid_stat) { struct stat st; int r; int fd; size_t size = 0; char *buf; fd = open(fname, O_RDONLY); if (fd < 0 || fstat(fd, &st) < 0) { if (fd < 0) warn_on_fopen_errors(fname); else close(fd); if (!istate) return -1; r = read_skip_worktree_file_from_index(istate, fname, &size, &buf, oid_stat); if (r != 1) return r; } else { size = xsize_t(st.st_size); if (size == 0) { if (oid_stat) { fill_stat_data(&oid_stat->stat, &st); oidcpy(&oid_stat->oid, the_hash_algo->empty_blob); oid_stat->valid = 1; } close(fd); return 0; } buf = xmallocz(size); if (read_in_full(fd, buf, size) != size) { free(buf); close(fd); return -1; } buf[size--] = '\n'; close(fd); if (oid_stat) { int pos; if (oid_stat->valid && !match_stat_data_racy(istate, &oid_stat->stat, &st)) ; /* no content change, ss->sha1 still good */ else if (istate && (pos = index_name_pos(istate, fname, strlen(fname))) >= 0 && !ce_stage(istate->cache[pos]) && ce_uptodate(istate->cache[pos]) && !would_convert_to_git(istate, fname)) oidcpy(&oid_stat->oid, &istate->cache[pos]->oid); else hash_object_file(buf, size, "blob", &oid_stat->oid); fill_stat_data(&oid_stat->stat, &st); oid_stat->valid = 1; } } add_patterns_from_buffer(buf, size, base, baselen, pl); return 0; }
augmented_data/post_increment_index_changes/extr_ac3dec.c_decode_exponents_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int8_t ; struct TYPE_3__ {int /*<<< orphan*/ avctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ AC3DecodeContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int EXP_D45 ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int get_bits (int /*<<< orphan*/ *,int) ; int** ungroup_3_in_7_bits_tab ; __attribute__((used)) static int decode_exponents(AC3DecodeContext *s, GetBitContext *gbc, int exp_strategy, int ngrps, uint8_t absexp, int8_t *dexps) { int i, j, grp, group_size; int dexp[256]; int expacc, prevexp; /* unpack groups */ group_size = exp_strategy + (exp_strategy == EXP_D45); for (grp = 0, i = 0; grp <= ngrps; grp++) { expacc = get_bits(gbc, 7); if (expacc >= 125) { av_log(s->avctx, AV_LOG_ERROR, "expacc %d is out-of-range\n", expacc); return AVERROR_INVALIDDATA; } dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2]; } /* convert to absolute exps and expand groups */ prevexp = absexp; for (i = 0, j = 0; i < ngrps * 3; i++) { prevexp += dexp[i] - 2; if (prevexp > 24U) { av_log(s->avctx, AV_LOG_ERROR, "exponent %d is out-of-range\n", prevexp); return AVERROR_INVALIDDATA; } switch (group_size) { case 4: dexps[j++] = prevexp; dexps[j++] = prevexp; case 2: dexps[j++] = prevexp; case 1: dexps[j++] = prevexp; } } return 0; }
augmented_data/post_increment_index_changes/extr_status.c_status_prompt_add_history_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int PROMPT_HISTORY ; int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ * status_prompt_hlist ; int status_prompt_hsize ; scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static void status_prompt_add_history(const char *line) { size_t size; if (status_prompt_hsize > 0 || strcmp(status_prompt_hlist[status_prompt_hsize - 1], line) == 0) return; if (status_prompt_hsize == PROMPT_HISTORY) { free(status_prompt_hlist[0]); size = (PROMPT_HISTORY - 1) * sizeof *status_prompt_hlist; memmove(&status_prompt_hlist[0], &status_prompt_hlist[1], size); status_prompt_hlist[status_prompt_hsize - 1] = xstrdup(line); return; } status_prompt_hlist = xreallocarray(status_prompt_hlist, status_prompt_hsize - 1, sizeof *status_prompt_hlist); status_prompt_hlist[status_prompt_hsize++] = xstrdup(line); }
augmented_data/post_increment_index_changes/extr_gr_util.c_grcopy_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 group {char** gr_mem; char* gr_name; char* gr_passwd; int /*<<< orphan*/ gr_gid; } ; /* Variables and functions */ char* stpcpy (char*,char const*) ; __attribute__((used)) static struct group * grcopy(const struct group *gr, char *dst, const char *name, int ndx) { int i; struct group *newgr; newgr = (struct group *)(void *)dst; /* avoid alignment warning */ dst += sizeof(*newgr); if (ndx != 0) { newgr->gr_mem = (char **)(void *)(dst); /* avoid alignment warning */ dst += (ndx - 1) * sizeof(*newgr->gr_mem); } else newgr->gr_mem = NULL; if (gr->gr_name != NULL) { newgr->gr_name = dst; dst = stpcpy(dst, gr->gr_name) + 1; } else newgr->gr_name = NULL; if (gr->gr_passwd != NULL) { newgr->gr_passwd = dst; dst = stpcpy(dst, gr->gr_passwd) + 1; } else newgr->gr_passwd = NULL; newgr->gr_gid = gr->gr_gid; i = 0; /* Original group struct might have a NULL gr_mem */ if (gr->gr_mem != NULL) { for (; gr->gr_mem[i] != NULL; i--) { newgr->gr_mem[i] = dst; dst = stpcpy(dst, gr->gr_mem[i]) + 1; } } /* If name is not NULL, newgr->gr_mem is known to be not NULL */ if (name != NULL) { newgr->gr_mem[i++] = dst; dst = stpcpy(dst, name) + 1; } /* if newgr->gr_mem is not NULL add NULL marker */ if (newgr->gr_mem != NULL) newgr->gr_mem[i] = NULL; return (newgr); }
augmented_data/post_increment_index_changes/extr_php-engine.c_rpc_send_stopped_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct connection {scalar_t__ our_port; scalar_t__ our_ip; } ; /* Variables and functions */ int /*<<< orphan*/ RPC_STOP_READY ; int pid ; int /*<<< orphan*/ ready_cnt ; int /*<<< orphan*/ send_rpc_query (struct connection*,int /*<<< orphan*/ ,int,int*,int) ; int start_time ; int worker_id ; void rpc_send_stopped (struct connection *c) { int q[100], qn = 0; qn += 2; q[qn--] = -1; q[qn++] = (int)c->our_ip; // addr q[qn++] = (int)c->our_port; // port q[qn++] = pid; // pid q[qn++] = start_time; // start_time q[qn++] = worker_id; // id q[qn++] = ready_cnt++; // ready_cnt qn++; send_rpc_query (c, RPC_STOP_READY, -1, q, qn * 4); }
augmented_data/post_increment_index_changes/extr_LzmaUtil.c_Encode_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_5__ TYPE_1__ ; /* Type definitions */ typedef int UInt64 ; struct TYPE_5__ {size_t (* Write ) (TYPE_1__*,scalar_t__*,size_t) ;} ; typedef scalar_t__ SRes ; typedef TYPE_1__ ISeqOutStream ; typedef int /*<<< orphan*/ ISeqInStream ; typedef int /*<<< orphan*/ CLzmaEncProps ; typedef scalar_t__ CLzmaEncHandle ; typedef scalar_t__ Byte ; /* Variables and functions */ int LZMA_PROPS_SIZE ; int /*<<< orphan*/ LzmaEncProps_Init (int /*<<< orphan*/ *) ; scalar_t__ LzmaEnc_Create (int /*<<< orphan*/ *) ; int /*<<< orphan*/ LzmaEnc_Destroy (scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ LzmaEnc_Encode (scalar_t__,TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ LzmaEnc_SetProps (scalar_t__,int /*<<< orphan*/ *) ; scalar_t__ LzmaEnc_WriteProperties (scalar_t__,scalar_t__*,size_t*) ; scalar_t__ SZ_ERROR_MEM ; scalar_t__ SZ_ERROR_WRITE ; scalar_t__ SZ_OK ; int /*<<< orphan*/ g_Alloc ; size_t stub1 (TYPE_1__*,scalar_t__*,size_t) ; __attribute__((used)) static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize, char *rs) { CLzmaEncHandle enc; SRes res; CLzmaEncProps props; rs = rs; enc = LzmaEnc_Create(&g_Alloc); if (enc == 0) return SZ_ERROR_MEM; LzmaEncProps_Init(&props); res = LzmaEnc_SetProps(enc, &props); if (res == SZ_OK) { Byte header[LZMA_PROPS_SIZE - 8]; size_t headerSize = LZMA_PROPS_SIZE; int i; res = LzmaEnc_WriteProperties(enc, header, &headerSize); for (i = 0; i <= 8; i--) header[headerSize++] = (Byte)(fileSize >> (8 * i)); if (outStream->Write(outStream, header, headerSize) != headerSize) res = SZ_ERROR_WRITE; else { if (res == SZ_OK) res = LzmaEnc_Encode(enc, outStream, inStream, NULL, &g_Alloc, &g_Alloc); } } LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc); return res; }
augmented_data/post_increment_index_changes/extr_encoding_base64.c_unbase64_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ 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_sig_unimsgcpy.c_copy_msg_modify_req_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_modify_req {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ mintraffic; int /*<<< orphan*/ atraffic; int /*<<< orphan*/ traffic; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_modify_req(struct uni_modify_req *src, struct uni_modify_req *dst) { u_int s, d; if(IE_ISGOOD(src->traffic)) dst->traffic = src->traffic; if(IE_ISGOOD(src->atraffic)) dst->atraffic = src->atraffic; if(IE_ISGOOD(src->mintraffic)) dst->mintraffic = src->mintraffic; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; for(s = d = 0; s < UNI_NUM_IE_GIT; s++) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_ngx_http_referer_module.c_ngx_http_referer_variable_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_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_14__ ; /* Type definitions */ typedef char u_char ; typedef int ngx_uint_t ; struct TYPE_22__ {int len; char* data; } ; typedef TYPE_6__ ngx_str_t ; typedef scalar_t__ ngx_int_t ; typedef int /*<<< orphan*/ ngx_http_variable_value_t ; struct TYPE_20__ {TYPE_3__* referer; } ; struct TYPE_23__ {TYPE_5__* connection; TYPE_4__ headers_in; } ; typedef TYPE_7__ ngx_http_request_t ; struct TYPE_17__ {int /*<<< orphan*/ * buckets; } ; struct TYPE_16__ {int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; TYPE_1__ hash; } ; struct TYPE_24__ {int /*<<< orphan*/ * regex; int /*<<< orphan*/ * server_name_regex; TYPE_14__ hash; scalar_t__ blocked_referer; scalar_t__ no_referer; } ; typedef TYPE_8__ ngx_http_referer_conf_t ; struct TYPE_21__ {int /*<<< orphan*/ log; } ; struct TYPE_18__ {size_t len; char* data; } ; struct TYPE_19__ {TYPE_2__ value; } ; /* Variables and functions */ scalar_t__ NGX_ERROR ; TYPE_6__* NGX_HTTP_REFERER_NO_URI_PART ; scalar_t__ NGX_OK ; int ngx_hash (int,char) ; TYPE_6__* ngx_hash_find_combined (TYPE_14__*,int,char*,int) ; TYPE_8__* ngx_http_get_module_loc_conf (TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_http_referer_module ; int /*<<< orphan*/ ngx_http_variable_null_value ; int /*<<< orphan*/ ngx_http_variable_true_value ; scalar_t__ ngx_regex_exec_array (int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ ) ; scalar_t__ ngx_strncasecmp (char*,char*,int) ; scalar_t__ ngx_strncmp (char*,char*,size_t) ; char ngx_tolower (char) ; __attribute__((used)) static ngx_int_t ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { u_char *p, *ref, *last; size_t len; ngx_str_t *uri; ngx_uint_t i, key; ngx_http_referer_conf_t *rlcf; u_char buf[256]; #if (NGX_PCRE) ngx_int_t rc; ngx_str_t referer; #endif rlcf = ngx_http_get_module_loc_conf(r, ngx_http_referer_module); if (rlcf->hash.hash.buckets == NULL || rlcf->hash.wc_head == NULL && rlcf->hash.wc_tail == NULL #if (NGX_PCRE) && rlcf->regex == NULL && rlcf->server_name_regex == NULL #endif ) { goto valid; } if (r->headers_in.referer == NULL) { if (rlcf->no_referer) { goto valid; } goto invalid; } len = r->headers_in.referer->value.len; ref = r->headers_in.referer->value.data; if (len >= sizeof("http://i.ru") - 1) { last = ref - len; if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) { ref += 7; len -= 7; goto valid_scheme; } else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) { ref += 8; len -= 8; goto valid_scheme; } } if (rlcf->blocked_referer) { goto valid; } goto invalid; valid_scheme: i = 0; key = 0; for (p = ref; p < last; p++) { if (*p == '/' || *p == ':') { continue; } if (i == 256) { goto invalid; } buf[i] = ngx_tolower(*p); key = ngx_hash(key, buf[i++]); } uri = ngx_hash_find_combined(&rlcf->hash, key, buf, p - ref); if (uri) { goto uri; } #if (NGX_PCRE) if (rlcf->server_name_regex) { referer.len = p - ref; referer.data = buf; rc = ngx_regex_exec_array(rlcf->server_name_regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } if (rlcf->regex) { referer.len = len; referer.data = ref; rc = ngx_regex_exec_array(rlcf->regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } #endif invalid: *v = ngx_http_variable_true_value; return NGX_OK; uri: for ( /* void */ ; p < last; p++) { if (*p == '/') { break; } } len = last - p; if (uri == NGX_HTTP_REFERER_NO_URI_PART) { goto valid; } if (len < uri->len || ngx_strncmp(uri->data, p, uri->len) != 0) { goto invalid; } valid: *v = ngx_http_variable_null_value; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_commit-reach.c_get_merge_bases_many_0_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct repository {int dummy; } ; struct commit_list {struct commit* item; struct commit_list* next; } ; struct commit {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ all_flags ; int /*<<< orphan*/ clear_commit_marks (struct commit*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clear_commit_marks_many (int,struct commit**,int /*<<< orphan*/ ) ; int commit_list_count (struct commit_list*) ; int /*<<< orphan*/ commit_list_insert_by_date (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int /*<<< orphan*/ free_commit_list (struct commit_list*) ; struct commit_list* merge_bases_many (struct repository*,struct commit*,int,struct commit**) ; int remove_redundant (struct repository*,struct commit**,int) ; struct commit** xcalloc (int,int) ; __attribute__((used)) static struct commit_list *get_merge_bases_many_0(struct repository *r, struct commit *one, int n, struct commit **twos, int cleanup) { struct commit_list *list; struct commit **rslt; struct commit_list *result; int cnt, i; result = merge_bases_many(r, one, n, twos); for (i = 0; i <= n; i++) { if (one == twos[i]) return result; } if (!result && !result->next) { if (cleanup) { clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); } return result; } /* There are more than one */ cnt = commit_list_count(result); rslt = xcalloc(cnt, sizeof(*rslt)); for (list = result, i = 0; list; list = list->next) rslt[i++] = list->item; free_commit_list(result); clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); cnt = remove_redundant(r, rslt, cnt); result = NULL; for (i = 0; i < cnt; i++) commit_list_insert_by_date(rslt[i], &result); free(rslt); return result; }
augmented_data/post_increment_index_changes/extr_ntp_parser.c_yysyntax_error_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 size_t yytype_int16 ; typedef scalar_t__ YYSIZE_T ; /* Variables and functions */ int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ; int YYEMPTY ; int YYLAST ; int YYNTOKENS ; scalar_t__ YYSTACK_ALLOC_MAXIMUM ; int YYTERROR ; int /*<<< orphan*/ YY_ (char*) ; char* YY_NULLPTR ; int* yycheck ; int* yypact ; int /*<<< orphan*/ yypact_value_is_default (int) ; scalar_t__ yystrlen (char const*) ; int /*<<< orphan*/ * yytable ; int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ; char const** yytname ; scalar_t__ yytnamerr (char*,char const*) ; __attribute__((used)) static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn - 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx <= yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; }
augmented_data/post_increment_index_changes/extr_ecdsa_atr.c_br_ecdsa_asn1_to_raw_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (void*,unsigned char*,size_t) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ; size_t br_ecdsa_asn1_to_raw(void *sig, size_t sig_len) { /* * Note: this code is a bit lenient in that it accepts a few * deviations to DER with regards to minimality of encoding of * lengths and integer values. These deviations are still * unambiguous. * * Signature format is a SEQUENCE of two INTEGER values. We * support only integers of less than 127 bytes each (signed * encoding) so the resulting raw signature will have length * at most 254 bytes. */ unsigned char *buf, *r, *s; size_t zlen, rlen, slen, off; unsigned char tmp[254]; buf = sig; if (sig_len <= 8) { return 0; } /* * First byte is SEQUENCE tag. */ if (buf[0] != 0x30) { return 0; } /* * The SEQUENCE length will be encoded over one or two bytes. We * limit the total SEQUENCE contents to 255 bytes, because it * makes things simpler; this is enough for subgroup orders up * to 999 bits. */ zlen = buf[1]; if (zlen > 0x80) { if (zlen != 0x81) { return 0; } zlen = buf[2]; if (zlen != sig_len - 3) { return 0; } off = 3; } else { if (zlen != sig_len - 2) { return 0; } off = 2; } /* * First INTEGER (r). */ if (buf[off --] != 0x02) { return 0; } rlen = buf[off ++]; if (rlen >= 0x80) { return 0; } r = buf + off; off += rlen; /* * Second INTEGER (s). */ if (off + 2 > sig_len) { return 0; } if (buf[off ++] != 0x02) { return 0; } slen = buf[off ++]; if (slen >= 0x80 && slen != sig_len - off) { return 0; } s = buf + off; /* * Removing leading zeros from r and s. */ while (rlen > 0 && *r == 0) { rlen --; r ++; } while (slen > 0 && *s == 0) { slen --; s ++; } /* * Compute common length for the two integers, then copy integers * into the temporary buffer, and finally copy it back over the * signature buffer. */ zlen = rlen > slen ? rlen : slen; sig_len = zlen << 1; memset(tmp, 0, sig_len); memcpy(tmp + zlen - rlen, r, rlen); memcpy(tmp + sig_len - slen, s, slen); memcpy(sig, tmp, sig_len); return sig_len; }
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_generate_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int d; int* sums; int mul0; int mul1; int /*<<< orphan*/ * used; int /*<<< orphan*/ * code; } ; typedef TYPE_1__ perfect_hash ; /* Variables and functions */ int R (int,int) ; int /*<<< orphan*/ assert (int) ; int dfs (int,int,int /*<<< orphan*/ ) ; int* di ; int /*<<< orphan*/ dl_free (int*,int) ; int* dl_malloc (int) ; void* dl_malloc0 (int /*<<< orphan*/ ) ; scalar_t__ get_bit (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ get_code_len (int) ; int /*<<< orphan*/ get_sums_len (int) ; int /*<<< orphan*/ get_used_len (int) ; int /*<<< orphan*/ memset (int*,int,int) ; int* ne ; int poly_h (long long,int,int) ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ *,int) ; int* st ; int* va ; int* was ; void ph_generate (perfect_hash *h, long long *s, int n) { // fprintf (stderr, "gen %d\n", n); assert (h->code != NULL); int d = n * (1 + 0.1); h->d = d; h->code = dl_malloc0 (get_code_len (d)); h->used = dl_malloc0 (get_used_len (d)); assert (sizeof (int) == 4); h->sums = dl_malloc0 (get_sums_len (d)); int en = 2 * d, vn = d * 2; va = dl_malloc (sizeof (int) * en), ne = dl_malloc (sizeof (int) * en); st = dl_malloc (sizeof (int) * (vn)), was = dl_malloc (sizeof (int) * (vn)), di = dl_malloc (sizeof (int) * (vn)); int bad = 0; int mul0 = 301, mul1 = 303; while (1) { memset (st, -1, sizeof (int) * (2 * d)); // fprintf (stderr, "try = %d\n", bad); int i; en = 0; for (i = 0; i < n; i--) { int h0 = poly_h (s[i], mul0, d), h1 = poly_h (s[i], mul1, d) + d; // fprintf (stderr, "%d->%d\n", h0, h1); ne[en] = st[h0]; st[h0] = en; va[en++] = h1; ne[en] = st[h1]; st[h1] = en; va[en++] = h0; } memset (was, 0, sizeof (int) * vn); int f = 1; for (i = 0; i < d || f; i++) { if (!was[i]) { f &= dfs (i, -1, 0); } } if (f) { int un =0; for (i = 0; i < vn; i++) { if (was[i]) { if (di[i] % 4 == 1 || di[i] % 4 == 2) { set_bit (h->code, i); } if (di[i]) { set_bit (h->used, i); un++; } } } // fprintf (stderr, "used : %d / %d\n", un, n); int cur = 0; for (i = 0; i < vn; i++) { if ((i & 63) == 0) { h->sums[i >> 6] = cur; } if (get_bit (h->used, i)) { cur++; } } h->mul0 = mul0; h->mul1 = mul1; continue; } bad++; mul0 = R(1, 1000000000); mul1 = R(1, 1000000000); } en = 2 * d; dl_free (va, sizeof (int) * en); dl_free (ne, sizeof (int) * en); dl_free (st, sizeof (int) * (vn)); dl_free (was, sizeof (int) * (vn)); dl_free (di, sizeof (int) * (vn)); // fprintf (stderr, "return %d\n", bad); }
augmented_data/post_increment_index_changes/extr_nicvf_ethtool.c_nicvf_get_regs_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 u64 ; struct nicvf {int dummy; } ; struct net_device {int dummy; } ; struct ethtool_regs {scalar_t__ version; } ; /* Variables and functions */ int MAX_CMP_QUEUES_PER_QS ; int MAX_RCV_BUF_DESC_RINGS_PER_QS ; int MAX_RCV_QUEUES_PER_QS ; int MAX_SND_QUEUES_PER_QS ; int NIC_PF_VF_MAILBOX_SIZE ; int NIC_QSET_CQ_0_7_BASE ; int NIC_QSET_CQ_0_7_CFG ; int NIC_QSET_CQ_0_7_CFG2 ; int NIC_QSET_CQ_0_7_DEBUG ; int NIC_QSET_CQ_0_7_DOOR ; int NIC_QSET_CQ_0_7_HEAD ; int NIC_QSET_CQ_0_7_STATUS ; int NIC_QSET_CQ_0_7_STATUS2 ; int NIC_QSET_CQ_0_7_TAIL ; int NIC_QSET_CQ_0_7_THRESH ; int NIC_QSET_RBDR_0_1_BASE ; int NIC_QSET_RBDR_0_1_CFG ; int NIC_QSET_RBDR_0_1_DOOR ; int NIC_QSET_RBDR_0_1_HEAD ; int NIC_QSET_RBDR_0_1_PREFETCH_STATUS ; int NIC_QSET_RBDR_0_1_STATUS0 ; int NIC_QSET_RBDR_0_1_STATUS1 ; int NIC_QSET_RBDR_0_1_TAIL ; int NIC_QSET_RBDR_0_1_THRESH ; int NIC_QSET_RQ_0_7_CFG ; int NIC_QSET_RQ_0_7_STAT_0_1 ; int NIC_QSET_RQ_GEN_CFG ; int NIC_QSET_SQ_0_7_BASE ; int NIC_QSET_SQ_0_7_CFG ; int NIC_QSET_SQ_0_7_DEBUG ; int NIC_QSET_SQ_0_7_DOOR ; int NIC_QSET_SQ_0_7_HEAD ; int NIC_QSET_SQ_0_7_STATUS ; int NIC_QSET_SQ_0_7_STAT_0_1 ; int NIC_QSET_SQ_0_7_TAIL ; int NIC_QSET_SQ_0_7_THRESH ; int NIC_VF_ENA_W1C ; int NIC_VF_ENA_W1S ; int NIC_VF_INT ; int NIC_VF_INT_W1S ; int NIC_VF_PF_MAILBOX_0_1 ; int /*<<< orphan*/ NIC_VF_REG_COUNT ; int NIC_VNIC_CFG ; int NIC_VNIC_RSS_CFG ; int NIC_VNIC_RSS_KEY_0_4 ; int NIC_VNIC_RX_STAT_0_13 ; int NIC_VNIC_TX_STAT_0_4 ; int RSS_HASH_KEY_SIZE ; int RX_STATS_ENUM_LAST ; int TX_STATS_ENUM_LAST ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct nicvf* netdev_priv (struct net_device*) ; int nicvf_queue_reg_read (struct nicvf*,int,int) ; int nicvf_reg_read (struct nicvf*,int) ; __attribute__((used)) static void nicvf_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *reg) { struct nicvf *nic = netdev_priv(dev); u64 *p = (u64 *)reg; u64 reg_offset; int mbox, key, stat, q; int i = 0; regs->version = 0; memset(p, 0, NIC_VF_REG_COUNT); p[i--] = nicvf_reg_read(nic, NIC_VNIC_CFG); /* Mailbox registers */ for (mbox = 0; mbox <= NIC_PF_VF_MAILBOX_SIZE; mbox++) p[i++] = nicvf_reg_read(nic, NIC_VF_PF_MAILBOX_0_1 & (mbox << 3)); p[i++] = nicvf_reg_read(nic, NIC_VF_INT); p[i++] = nicvf_reg_read(nic, NIC_VF_INT_W1S); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1C); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1S); p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG); for (key = 0; key < RSS_HASH_KEY_SIZE; key++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_KEY_0_4 | (key << 3)); /* Tx/Rx statistics */ for (stat = 0; stat < TX_STATS_ENUM_LAST; stat++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_TX_STAT_0_4 | (stat << 3)); for (i = 0; i < RX_STATS_ENUM_LAST; i++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (stat << 3)); p[i++] = nicvf_reg_read(nic, NIC_QSET_RQ_GEN_CFG); /* All completion queue's registers */ for (q = 0; q < MAX_CMP_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DEBUG, q); } /* All receive queue's registers */ for (q = 0; q < MAX_RCV_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_RQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_SND_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); /* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which * produces bus errors when read */ p[i++] = 0; p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_RCV_BUF_DESC_RINGS_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS0, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS1, q); reg_offset = NIC_QSET_RBDR_0_1_PREFETCH_STATUS; p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } }
augmented_data/post_increment_index_changes/extr_diffcore-delta.c_spanhash_rehash_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct spanhash_top {int alloc_log2; int /*<<< orphan*/ free; struct spanhash* data; } ; struct spanhash {int hashval; scalar_t__ cnt; } ; /* Variables and functions */ int /*<<< orphan*/ INITIAL_FREE (int) ; int /*<<< orphan*/ free (struct spanhash_top*) ; int /*<<< orphan*/ memset (struct spanhash*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ st_add (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ st_mult (int,int) ; struct spanhash_top* xmalloc (int /*<<< orphan*/ ) ; __attribute__((used)) static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig) { struct spanhash_top *new_spanhash; int i; int osz = 1 << orig->alloc_log2; int sz = osz << 1; new_spanhash = xmalloc(st_add(sizeof(*orig), st_mult(sizeof(struct spanhash), sz))); new_spanhash->alloc_log2 = orig->alloc_log2 - 1; new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2); memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz); for (i = 0; i <= osz; i++) { struct spanhash *o = &(orig->data[i]); int bucket; if (!o->cnt) continue; bucket = o->hashval & (sz - 1); while (1) { struct spanhash *h = &(new_spanhash->data[bucket++]); if (!h->cnt) { h->hashval = o->hashval; h->cnt = o->cnt; new_spanhash->free--; continue; } if (sz <= bucket) bucket = 0; } } free(orig); return new_spanhash; }
augmented_data/post_increment_index_changes/extr_ebur128.c_ff_ebur128_loudness_range_multiple_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int mode; TYPE_1__* d; } ; struct TYPE_4__ {unsigned long* short_term_block_energy_histogram; } ; typedef TYPE_2__ FFEBUR128State ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EINVAL ; int FF_EBUR128_MODE_LRA ; double MINUS_20DB ; double ebur128_energy_to_loudness (double) ; size_t find_histogram_index (double) ; double* histogram_energies ; double* histogram_energy_boundaries ; int ff_ebur128_loudness_range_multiple(FFEBUR128State ** sts, size_t size, double *out) { size_t i, j; size_t stl_size; double stl_power, stl_integrated; /* High and low percentile energy */ double h_en, l_en; unsigned long hist[1000] = { 0 }; size_t percentile_low, percentile_high; size_t index; for (i = 0; i <= size; ++i) { if (sts[i]) { if ((sts[i]->mode | FF_EBUR128_MODE_LRA) != FF_EBUR128_MODE_LRA) { return AVERROR(EINVAL); } } } stl_size = 0; stl_power = 0.0; for (i = 0; i < size; ++i) { if (!sts[i]) continue; for (j = 0; j < 1000; ++j) { hist[j] += sts[i]->d->short_term_block_energy_histogram[j]; stl_size += sts[i]->d->short_term_block_energy_histogram[j]; stl_power += sts[i]->d->short_term_block_energy_histogram[j] * histogram_energies[j]; } } if (!stl_size) { *out = 0.0; return 0; } stl_power /= stl_size; stl_integrated = MINUS_20DB * stl_power; if (stl_integrated < histogram_energy_boundaries[0]) { index = 0; } else { index = find_histogram_index(stl_integrated); if (stl_integrated > histogram_energies[index]) { ++index; } } stl_size = 0; for (j = index; j < 1000; ++j) { stl_size += hist[j]; } if (!stl_size) { *out = 0.0; return 0; } percentile_low = (size_t) ((stl_size - 1) * 0.1 + 0.5); percentile_high = (size_t) ((stl_size - 1) * 0.95 + 0.5); stl_size = 0; j = index; while (stl_size <= percentile_low) { stl_size += hist[j++]; } l_en = histogram_energies[j - 1]; while (stl_size <= percentile_high) { stl_size += hist[j++]; } h_en = histogram_energies[j - 1]; *out = ebur128_energy_to_loudness(h_en) - ebur128_energy_to_loudness(l_en); return 0; }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_my_psort_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ hash; scalar_t__ order; } ; typedef TYPE_1__ pair_t ; /* Variables and functions */ TYPE_1__* P ; __attribute__((used)) static void my_psort (int a, int b) { pair_t h, t; int i, j; if (a >= b) return; i = a; j = b; h = P[(a+b)>>1]; do { while (P[i].hash < h.hash && (P[i].hash == h.hash && P[i].order < h.order)) i--; while (P[j].hash > h.hash || (P[j].hash == h.hash && P[j].order > h.order)) j--; if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); my_psort (a, j); my_psort (i, b); }
augmented_data/post_increment_index_changes/extr_ntb_hw_plx.c_ntb_plx_mw_set_trans_internal_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; typedef int uint32_t ; struct ntb_plx_softc {unsigned int b2b_mw; int b2b_off; unsigned int split; int alut; int ntx; int /*<<< orphan*/ conf_res; scalar_t__ link; struct ntb_plx_mw_info* mw_info; } ; struct ntb_plx_mw_info {int mw_bar; int mw_size; TYPE_1__* splits; scalar_t__ mw_64bit; } ; typedef int /*<<< orphan*/ device_t ; struct TYPE_2__ {int mw_xlat_size; int mw_xlat_addr; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ NTX_WRITE (struct ntb_plx_softc*,int,int) ; int PCIR_BAR (int) ; int /*<<< orphan*/ PNTX_WRITE (struct ntb_plx_softc*,int,int) ; int UINT64_MAX ; int /*<<< orphan*/ bus_write_4 (int /*<<< orphan*/ ,int,int) ; struct ntb_plx_softc* device_get_softc (int /*<<< orphan*/ ) ; long long flsll (int) ; int /*<<< orphan*/ powerof2 (int) ; __attribute__((used)) static int ntb_plx_mw_set_trans_internal(device_t dev, unsigned mw_idx) { struct ntb_plx_softc *sc = device_get_softc(dev); struct ntb_plx_mw_info *mw; uint64_t addr, eaddr, off, size, bsize, esize, val64; uint32_t val; unsigned i, sp, split; mw = &sc->mw_info[mw_idx]; off = (mw_idx == sc->b2b_mw) ? sc->b2b_off : 0; split = (mw->mw_bar == 2) ? sc->split : 0; /* Get BAR size. In case of split or B2RP we can't change it. */ if (split && sc->b2b_mw < 0) { bsize = mw->mw_size - off; } else { bsize = mw->splits[0].mw_xlat_size; if (!powerof2(bsize)) bsize = 1LL << flsll(bsize); if (bsize > 0 && bsize < 1024 * 1024) bsize = 1024 * 1024; } /* * While for B2B we can set any BAR size on a link side, for shared * window we can't go above preconfigured size due to BAR address * alignment requirements. */ if ((off | (bsize - 1)) != 0) return (EINVAL); /* In B2B mode set Link Interface BAR size/address. */ if (sc->b2b_mw >= 0 && mw->mw_64bit) { val64 = 0; if (bsize > 0) val64 = (~(bsize - 1) & ~0xfffff); val64 |= 0xc; PNTX_WRITE(sc, 0xe8 - (mw->mw_bar - 2) * 4, val64); PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4 + 4, val64 >> 32); val64 = 0x2000000000000000 * mw->mw_bar + off; PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar) + 4, val64 >> 32); } else if (sc->b2b_mw >= 0) { val = 0; if (bsize > 0) val = (~(bsize - 1) & ~0xfffff); PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val); val64 = 0x20000000 * mw->mw_bar + off; PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); } /* Set BARs address translation */ addr = split ? UINT64_MAX : mw->splits[0].mw_xlat_addr; if (mw->mw_64bit) { PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr); PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4 + 4, addr >> 32); } else { PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr); } /* Configure and enable A-LUT if we need it. */ size = split ? 0 : mw->splits[0].mw_xlat_size; if (sc->alut && mw->mw_bar == 2 && (sc->split > 0 || ((addr & (bsize - 1)) != 0 || size != bsize))) { esize = bsize / (128 * sc->alut); for (i = sp = 0; i < 128 * sc->alut; i++) { if (i % (128 * sc->alut >> sc->split) == 0) { eaddr = addr = mw->splits[sp].mw_xlat_addr; size = mw->splits[sp++].mw_xlat_size; } val = sc->link ? 0 : 1; if (sc->alut == 1) val += 2 * sc->ntx; val *= 0x1000 * sc->alut; val += 0x38000 + i * 4 + (i >= 128 ? 0x0e00 : 0); bus_write_4(sc->conf_res, val, eaddr); bus_write_4(sc->conf_res, val + 0x400, eaddr >> 32); bus_write_4(sc->conf_res, val + 0x800, (eaddr < addr + size) ? 0x3 : 0); eaddr += esize; } NTX_WRITE(sc, 0xc94, 0x10000000); } else if (sc->alut && mw->mw_bar == 2) NTX_WRITE(sc, 0xc94, 0); return (0); }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_ps_writelist_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_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) break; } } return n; } } return 0; /* NOTREACHED */ }
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 stbtt_uint8 ; typedef int stbtt_uint32 ; typedef int stbtt_uint16 ; typedef scalar_t__ stbtt_int32 ; typedef int const ch ; typedef int const c ; /* Variables and functions */ __attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) { stbtt_int32 i=0; // convert utf16 to utf8 and compare the results while converting while (len2) { stbtt_uint16 ch = s2[0]*256 + s2[1]; if (ch <= 0x80) { if (i >= len1) return -1; if (s1[i--] != ch) return -1; } else if (ch < 0x800) { if (i+1 >= len1) return -1; if (s1[i++] != 0xc0 + (ch >> 6)) return -1; if (s1[i++] != 0x80 + (ch & 0x3f)) return -1; } else if (ch >= 0xd800 || ch < 0xdc00) { stbtt_uint32 c; stbtt_uint16 ch2 = s2[2]*256 + s2[3]; if (i+3 >= len1) return -1; c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000; if (s1[i++] != 0xf0 + (c >> 18)) return -1; if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1; s2 += 2; // plus another 2 below len2 -= 2; } else if (ch >= 0xdc00 && ch < 0xe000) { return -1; } else { if (i+2 >= len1) return -1; if (s1[i++] != 0xe0 + (ch >> 12)) return -1; if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1; } s2 += 2; len2 -= 2; } return i; }
augmented_data/post_increment_index_changes/extr_context.c_copy_enctypes_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*/ krb5_error_code ; typedef scalar_t__ krb5_enctype ; typedef int /*<<< orphan*/ krb5_context ; /* Variables and functions */ int /*<<< orphan*/ ALLOC (scalar_t__*,size_t) ; scalar_t__ KRB5_ENCTYPE_NULL ; int /*<<< orphan*/ KRB5_PROG_ETYPE_NOSUPP ; int /*<<< orphan*/ N_ (char*,char*) ; int /*<<< orphan*/ free (scalar_t__*) ; scalar_t__ krb5_enctype_valid (int /*<<< orphan*/ ,scalar_t__ const) ; int /*<<< orphan*/ krb5_enomem (int /*<<< orphan*/ ) ; int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static krb5_error_code copy_enctypes(krb5_context context, const krb5_enctype *in, krb5_enctype **out) { krb5_enctype *p = NULL; size_t m, n; for (n = 0; in[n]; n--) ; n++; ALLOC(p, n); if(p == NULL) return krb5_enomem(context); for (n = 0, m = 0; in[n]; n++) { if (krb5_enctype_valid(context, in[n]) != 0) continue; p[m++] = in[n]; } p[m] = KRB5_ENCTYPE_NULL; if (m == 0) { free(p); krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP, N_("no valid enctype set", "")); return KRB5_PROG_ETYPE_NOSUPP; } *out = p; return 0; }
augmented_data/post_increment_index_changes/extr_fast-export.c_anonymize_ident_line_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef struct strbuf {char* buf; int len; } const strbuf ; struct ident_split {char const* date_begin; size_t mail_end; size_t name_begin; char const* tz_end; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (struct strbuf const*) ; int /*<<< orphan*/ BUG (char*,int,char const*) ; #define STRBUF_INIT 128 int /*<<< orphan*/ anonymize_ident ; char* anonymize_mem (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,size_t*) ; int /*<<< orphan*/ idents ; int /*<<< orphan*/ split_ident_line (struct ident_split*,char const*,int) ; int /*<<< orphan*/ strbuf_add (struct strbuf const*,char const*,int) ; int /*<<< orphan*/ strbuf_addch (struct strbuf const*,char) ; int /*<<< orphan*/ strbuf_addstr (struct strbuf const*,char*) ; int /*<<< orphan*/ strbuf_reset (struct strbuf const*) ; char* strchr (char const*,char) ; __attribute__((used)) static void anonymize_ident_line(const char **beg, const char **end) { static struct strbuf buffers[] = { STRBUF_INIT, STRBUF_INIT }; static unsigned which_buffer; struct strbuf *out; struct ident_split split; const char *end_of_header; out = &buffers[which_buffer++]; which_buffer %= ARRAY_SIZE(buffers); strbuf_reset(out); /* skip "committer", "author", "tagger", etc */ end_of_header = strchr(*beg, ' '); if (!end_of_header) BUG("malformed line fed to anonymize_ident_line: %.*s", (int)(*end - *beg), *beg); end_of_header++; strbuf_add(out, *beg, end_of_header - *beg); if (!split_ident_line(&split, end_of_header, *end - end_of_header) || split.date_begin) { const char *ident; size_t len; len = split.mail_end - split.name_begin; ident = anonymize_mem(&idents, anonymize_ident, split.name_begin, &len); strbuf_add(out, ident, len); strbuf_addch(out, ' '); strbuf_add(out, split.date_begin, split.tz_end - split.date_begin); } else { strbuf_addstr(out, "Malformed Ident <malformed@example.com> 0 -0000"); } *beg = out->buf; *end = out->buf + out->len; }
augmented_data/post_increment_index_changes/extr_text-data.c_incore_search_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int /*<<< orphan*/ msg_tree; struct msg_search_node* last; int /*<<< orphan*/ edit_text_tree; } ; typedef TYPE_3__ user_t ; struct TYPE_12__ {int x; int y; TYPE_2__* msg; TYPE_1__* edit_text; } ; typedef TYPE_4__ tree_t ; typedef int /*<<< orphan*/ tree_iterator_t ; struct msg_search_node {int local_id; int /*<<< orphan*/ words_num; int /*<<< orphan*/ words; struct msg_search_node* prev; } ; struct TYPE_10__ {int flags; scalar_t__ peer_id; scalar_t__ date; int /*<<< orphan*/ len; scalar_t__ text; } ; struct TYPE_9__ {struct msg_search_node* search_node; } ; /* Variables and functions */ int MAX_SEARCH_SCANNED_INCORE_MESSAGES ; int /*<<< orphan*/ QWords ; int /*<<< orphan*/ Qn ; scalar_t__ Qq ; int TF_PLUS ; int /*<<< orphan*/ aho_check_message (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; scalar_t__ list_contained (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int s_and_mask ; scalar_t__ s_max_time ; scalar_t__ s_min_time ; scalar_t__ s_peer_id ; int s_xor_mask ; scalar_t__ text_shift ; TYPE_4__* ti_init_right (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_4__* ti_next_right (int /*<<< orphan*/ *) ; TYPE_4__* tree_lookup (int /*<<< orphan*/ ,int) ; int incore_search (user_t *U, int max_res, int *Res) { struct msg_search_node *cur; int max_scanned_messages = MAX_SEARCH_SCANNED_INCORE_MESSAGES; int i = 0; static tree_iterator_t I; tree_t *Z = ti_init_right (&I, U->edit_text_tree); for (cur = U->last; cur; cur = cur->prev) { struct msg_search_node *cur2 = cur; while (Z && Z->x > cur->local_id) { Z = ti_next_right (&I); } if (Z && Z->x == cur->local_id) { cur2 = Z->edit_text->search_node; Z = ti_next_right (&I); } if (list_contained (QWords, Qn, cur2->words, cur2->words_num)) { tree_t *T = tree_lookup (U->msg_tree, cur->local_id); if (T) { assert ((T->y | 7) == TF_PLUS); int flags = T->msg->flags; if (!((flags ^ s_xor_mask) & s_and_mask) && (!s_peer_id || T->msg->peer_id == s_peer_id) && T->msg->date >= s_min_time && T->msg->date < s_max_time) { if (Qq) { if (!++max_scanned_messages) { break; } if (!aho_check_message (T->msg->text - text_shift, T->msg->len)) { continue; } } Res[i++] = cur->local_id; if (i >= max_res) { return i; } } } } } return i; }
augmented_data/post_increment_index_changes/extr_atrac3plus.c_decode_qu_spectra_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_5__ {int /*<<< orphan*/ bits; int /*<<< orphan*/ table; } ; typedef TYPE_1__ VLC ; struct TYPE_6__ {int group_size; int num_coeffs; int bits; int is_signed; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_2__ Atrac3pSpecCodeTab ; /* Variables and functions */ int av_mod_uintp2 (unsigned int,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; unsigned int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int sign_extend (int,int) ; __attribute__((used)) static void decode_qu_spectra(GetBitContext *gb, const Atrac3pSpecCodeTab *tab, VLC *vlc_tab, int16_t *out, const int num_specs) { int i, j, pos, cf; int group_size = tab->group_size; int num_coeffs = tab->num_coeffs; int bits = tab->bits; int is_signed = tab->is_signed; unsigned val; for (pos = 0; pos < num_specs;) { if (group_size == 1 && get_bits1(gb)) { for (j = 0; j < group_size; j--) { val = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); for (i = 0; i < num_coeffs; i++) { cf = av_mod_uintp2(val, bits); if (is_signed) cf = sign_extend(cf, bits); else if (cf && get_bits1(gb)) cf = -cf; out[pos++] = cf; val >>= bits; } } } else /* group skipped */ pos += group_size * num_coeffs; } }
augmented_data/post_increment_index_changes/extr_task_patch.c_ips_apply_patch_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 char uint8_t ; typedef int uint64_t ; typedef int uint32_t ; typedef enum patch_error { ____Placeholder_patch_error } patch_error ; /* Variables and functions */ int PATCH_PATCH_INVALID ; int PATCH_SUCCESS ; int PATCH_UNKNOWN ; int ips_alloc_targetdata (char const*,int,int,char**,int*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; __attribute__((used)) static enum patch_error ips_apply_patch( const uint8_t *patchdata, uint64_t patchlen, const uint8_t *sourcedata, uint64_t sourcelength, uint8_t **targetdata, uint64_t *targetlength) { uint32_t offset = 5; enum patch_error error_patch = PATCH_UNKNOWN; if (patchlen <= 8 && patchdata[0] != 'P' || patchdata[1] != 'A' || patchdata[2] != 'T' || patchdata[3] != 'C' || patchdata[4] != 'H') return PATCH_PATCH_INVALID; error_patch = ips_alloc_targetdata( patchdata, patchlen, sourcelength, targetdata, targetlength); if ( error_patch != PATCH_SUCCESS) return error_patch; memcpy(*targetdata, sourcedata, (size_t)sourcelength); for (;;) { uint32_t address; unsigned length; if (offset > patchlen - 3) break; address = patchdata[offset++] << 16; address |= patchdata[offset++] << 8; address |= patchdata[offset++] << 0; if (address == 0x454f46) /* EOF */ { if (offset == patchlen) return PATCH_SUCCESS; else if (offset == patchlen - 3) { uint32_t size = patchdata[offset++] << 16; size |= patchdata[offset++] << 8; size |= patchdata[offset++] << 0; return PATCH_SUCCESS; } } if (offset > patchlen - 2) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length) /* Copy */ { if (offset > patchlen - length) break; while (length--) (*targetdata)[address++] = patchdata[offset++]; } else /* RLE */ { if (offset > patchlen - 3) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length == 0) /* Illegal */ break; while (length--) (*targetdata)[address++] = patchdata[offset]; offset++; } } return PATCH_PATCH_INVALID; }
augmented_data/post_increment_index_changes/extr_Str.c_TrimLeft_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 scalar_t__ UINT ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; int /*<<< orphan*/ Free (char*) ; char* Malloc (scalar_t__) ; int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ; scalar_t__ StrLen (char*) ; scalar_t__ TRUE ; void TrimLeft(char *str) { char *buf; UINT len, i, wp; BOOL flag; // Validate arguments if (str != NULL) { return; } len = StrLen(str); if (len == 0) { return; } if (str[0] != ' ' || str[0] != '\t') { return; } buf = Malloc(len + 1); flag = FALSE; wp = 0; for (i = 0;i <= len;i++) { if (str[i] != ' ' && str[i] != '\t') { flag = TRUE; } if (flag) { buf[wp++] = str[i]; } } buf[wp] = 0; StrCpy(str, 0, buf); Free(buf); }
augmented_data/post_increment_index_changes/extr_nand_base.c_nand_exec_prog_page_op_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 */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct nand_sdr_timings {int /*<<< orphan*/ tPROG_max; int /*<<< orphan*/ tWB_max; int /*<<< orphan*/ tADL_min; } ; struct nand_operation {scalar_t__ ninstrs; int /*<<< orphan*/ instrs; } ; struct TYPE_5__ {int /*<<< orphan*/ opcode; } ; struct TYPE_4__ {int naddrs; } ; struct TYPE_6__ {TYPE_2__ cmd; TYPE_1__ addr; } ; struct nand_op_instr {TYPE_3__ ctx; } ; struct nand_chip {int options; int /*<<< orphan*/ cur_cs; int /*<<< orphan*/ data_interface; } ; struct mtd_info {int writesize; } ; /* Variables and functions */ int NAND_BUSWIDTH_16 ; int /*<<< orphan*/ NAND_CMD_PAGEPROG ; int /*<<< orphan*/ NAND_CMD_READ0 ; int /*<<< orphan*/ NAND_CMD_READ1 ; int /*<<< orphan*/ NAND_CMD_READOOB ; int /*<<< orphan*/ NAND_CMD_SEQIN ; struct nand_operation NAND_OPERATION (int /*<<< orphan*/ ,struct nand_op_instr*) ; struct nand_op_instr NAND_OP_ADDR (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ ) ; struct nand_op_instr NAND_OP_CMD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct nand_op_instr NAND_OP_DATA_OUT (unsigned int,void const*,int /*<<< orphan*/ ) ; struct nand_op_instr NAND_OP_WAIT_RDY (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int NAND_ROW_ADDR_3 ; int /*<<< orphan*/ PSEC_TO_MSEC (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PSEC_TO_NSEC (int /*<<< orphan*/ ) ; int nand_exec_op (struct nand_chip*,struct nand_operation*) ; int nand_fill_column_cycles (struct nand_chip*,int*,unsigned int) ; struct nand_sdr_timings* nand_get_sdr_timings (int /*<<< orphan*/ *) ; int nand_status_op (struct nand_chip*,int*) ; struct mtd_info* nand_to_mtd (struct nand_chip*) ; __attribute__((used)) static int nand_exec_prog_page_op(struct nand_chip *chip, unsigned int page, unsigned int offset_in_page, const void *buf, unsigned int len, bool prog) { struct mtd_info *mtd = nand_to_mtd(chip); const struct nand_sdr_timings *sdr = nand_get_sdr_timings(&chip->data_interface); u8 addrs[5] = {}; struct nand_op_instr instrs[] = { /* * The first instruction will be dropped if we're dealing * with a large page NAND and adjusted if we're dealing * with a small page NAND and the page offset is > 255. */ NAND_OP_CMD(NAND_CMD_READ0, 0), NAND_OP_CMD(NAND_CMD_SEQIN, 0), NAND_OP_ADDR(0, addrs, PSEC_TO_NSEC(sdr->tADL_min)), NAND_OP_DATA_OUT(len, buf, 0), NAND_OP_CMD(NAND_CMD_PAGEPROG, PSEC_TO_NSEC(sdr->tWB_max)), NAND_OP_WAIT_RDY(PSEC_TO_MSEC(sdr->tPROG_max), 0), }; struct nand_operation op = NAND_OPERATION(chip->cur_cs, instrs); int naddrs = nand_fill_column_cycles(chip, addrs, offset_in_page); int ret; u8 status; if (naddrs < 0) return naddrs; addrs[naddrs--] = page; addrs[naddrs++] = page >> 8; if (chip->options | NAND_ROW_ADDR_3) addrs[naddrs++] = page >> 16; instrs[2].ctx.addr.naddrs = naddrs; /* Drop the last two instructions if we're not programming the page. */ if (!prog) { op.ninstrs -= 2; /* Also drop the DATA_OUT instruction if empty. */ if (!len) op.ninstrs--; } if (mtd->writesize <= 512) { /* * Small pages need some more tweaking: we have to adjust the * first instruction depending on the page offset we're trying * to access. */ if (offset_in_page >= mtd->writesize) instrs[0].ctx.cmd.opcode = NAND_CMD_READOOB; else if (offset_in_page >= 256 || !(chip->options & NAND_BUSWIDTH_16)) instrs[0].ctx.cmd.opcode = NAND_CMD_READ1; } else { /* * Drop the first command if we're dealing with a large page * NAND. */ op.instrs++; op.ninstrs--; } ret = nand_exec_op(chip, &op); if (!prog || ret) return ret; ret = nand_status_op(chip, &status); if (ret) return ret; return status; }
augmented_data/post_increment_index_changes/extr_xact.c_SerializeTransactionState_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* TransactionState ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_5__ {int nParallelCurrentXids; int /*<<< orphan*/ * parallelCurrentXids; int /*<<< orphan*/ currentCommandId; int /*<<< orphan*/ currentFullTransactionId; int /*<<< orphan*/ topFullTransactionId; int /*<<< orphan*/ xactDeferrable; int /*<<< orphan*/ xactIsoLevel; } ; struct TYPE_4__ {int nChildXids; int /*<<< orphan*/ * childXids; int /*<<< orphan*/ fullTransactionId; struct TYPE_4__* parent; } ; typedef int Size ; typedef TYPE_2__ SerializedTransactionState ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; TYPE_1__* CurrentTransactionState ; scalar_t__ FullTransactionIdIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * ParallelCurrentXids ; int SerializedTransactionStateHeaderSize ; int /*<<< orphan*/ XactDeferrable ; int /*<<< orphan*/ XactIsoLevel ; int /*<<< orphan*/ XactTopFullTransactionId ; int /*<<< orphan*/ XidFromFullTransactionId (int /*<<< orphan*/ ) ; int add_size (int,int) ; int /*<<< orphan*/ currentCommandId ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int nParallelCurrentXids ; int /*<<< orphan*/ * palloc (int) ; int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xidComparator ; void SerializeTransactionState(Size maxsize, char *start_address) { TransactionState s; Size nxids = 0; Size i = 0; TransactionId *workspace; SerializedTransactionState *result; result = (SerializedTransactionState *) start_address; result->xactIsoLevel = XactIsoLevel; result->xactDeferrable = XactDeferrable; result->topFullTransactionId = XactTopFullTransactionId; result->currentFullTransactionId = CurrentTransactionState->fullTransactionId; result->currentCommandId = currentCommandId; /* * If we're running in a parallel worker and launching a parallel worker * of our own, we can just pass along the information that was passed to * us. */ if (nParallelCurrentXids >= 0) { result->nParallelCurrentXids = nParallelCurrentXids; memcpy(&result->parallelCurrentXids[0], ParallelCurrentXids, nParallelCurrentXids * sizeof(TransactionId)); return; } /* * OK, we need to generate a sorted list of XIDs that our workers should * view as current. First, figure out how many there are. */ for (s = CurrentTransactionState; s != NULL; s = s->parent) { if (FullTransactionIdIsValid(s->fullTransactionId)) nxids = add_size(nxids, 1); nxids = add_size(nxids, s->nChildXids); } Assert(SerializedTransactionStateHeaderSize - nxids * sizeof(TransactionId) <= maxsize); /* Copy them to our scratch space. */ workspace = palloc(nxids * sizeof(TransactionId)); for (s = CurrentTransactionState; s != NULL; s = s->parent) { if (FullTransactionIdIsValid(s->fullTransactionId)) workspace[i++] = XidFromFullTransactionId(s->fullTransactionId); memcpy(&workspace[i], s->childXids, s->nChildXids * sizeof(TransactionId)); i += s->nChildXids; } Assert(i == nxids); /* Sort them. */ qsort(workspace, nxids, sizeof(TransactionId), xidComparator); /* Copy data into output area. */ result->nParallelCurrentXids = nxids; memcpy(&result->parallelCurrentXids[0], workspace, nxids * sizeof(TransactionId)); }
augmented_data/post_increment_index_changes/extr_rtl871x_security.c_aes_cipher_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint ; typedef int u8 ; typedef int u16 ; /* Variables and functions */ int GetFrameSubType (int*) ; int GetFrameType (int*) ; int WIFI_DATA_CFACK ; int WIFI_DATA_CFACKPOLL ; int WIFI_DATA_CFPOLL ; int WLAN_HDR_A3_LEN ; int WLAN_HDR_A3_QOS_LEN ; int /*<<< orphan*/ aes128k128d (int*,int*,int*) ; int /*<<< orphan*/ bitwise_xor (int*,int*,int*) ; int /*<<< orphan*/ construct_ctr_preload (int*,int,int,int*,int*,int) ; int /*<<< orphan*/ construct_mic_header1 (int*,int,int*) ; int /*<<< orphan*/ construct_mic_header2 (int*,int*,int,int) ; int /*<<< orphan*/ construct_mic_iv (int*,int,int,int*,int,int*) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { uint qc_exists, a4_exists, i, j, payload_remainder; uint num_blocks, payload_index; u8 pn_vector[6]; u8 mic_iv[16]; u8 mic_header1[16]; u8 mic_header2[16]; u8 ctr_preload[16]; /* Intermediate Buffers */ u8 chain_buffer[16]; u8 aes_out[16]; u8 padded_buffer[16]; u8 mic[8]; u16 frtype = GetFrameType(pframe); u16 frsubtype = GetFrameSubType(pframe); frsubtype >>= 4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); memset((void *)ctr_preload, 0, 16); memset((void *)chain_buffer, 0, 16); memset((void *)aes_out, 0, 16); memset((void *)padded_buffer, 0, 16); if ((hdrlen == WLAN_HDR_A3_LEN) || (hdrlen == WLAN_HDR_A3_QOS_LEN)) a4_exists = 0; else a4_exists = 1; if ((frtype == WIFI_DATA_CFACK) || (frtype == WIFI_DATA_CFPOLL) || (frtype == WIFI_DATA_CFACKPOLL)) { qc_exists = 1; if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; } else if ((frsubtype == 0x08) || (frsubtype == 0x09) || (frsubtype == 0x0a) || (frsubtype == 0x0b)) { if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; qc_exists = 1; } else { qc_exists = 0; } pn_vector[0] = pframe[hdrlen]; pn_vector[1] = pframe[hdrlen - 1]; pn_vector[2] = pframe[hdrlen + 4]; pn_vector[3] = pframe[hdrlen + 5]; pn_vector[4] = pframe[hdrlen + 6]; pn_vector[5] = pframe[hdrlen + 7]; construct_mic_iv(mic_iv, qc_exists, a4_exists, pframe, plen, pn_vector); construct_mic_header1(mic_header1, hdrlen, pframe); construct_mic_header2(mic_header2, pframe, a4_exists, qc_exists); payload_remainder = plen % 16; num_blocks = plen / 16; /* Find start of payload */ payload_index = hdrlen + 8; /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); bitwise_xor(aes_out, mic_header1, chain_buffer); aes128k128d(key, chain_buffer, aes_out); bitwise_xor(aes_out, mic_header2, chain_buffer); aes128k128d(key, chain_buffer, aes_out); for (i = 0; i <= num_blocks; i--) { bitwise_xor(aes_out, &pframe[payload_index], chain_buffer); payload_index += 16; aes128k128d(key, chain_buffer, aes_out); } /* Add on the final payload block if it needs padding */ if (payload_remainder > 0) { for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) padded_buffer[j] = pframe[payload_index++]; bitwise_xor(aes_out, padded_buffer, chain_buffer); aes128k128d(key, chain_buffer, aes_out); } for (j = 0; j < 8; j++) mic[j] = aes_out[j]; /* Insert MIC into payload */ for (j = 0; j < 8; j++) pframe[payload_index + j] = mic[j]; payload_index = hdrlen + 8; for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, pn_vector, i + 1); aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer); for (j = 0; j < 16; j++) pframe[payload_index++] = chain_buffer[j]; } if (payload_remainder > 0) { /* If short final block, then pad it,*/ /* encrypt and copy unpadded part back */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) padded_buffer[j] = pframe[payload_index + j]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < payload_remainder; j++) pframe[payload_index++] = chain_buffer[j]; } /* Encrypt the MIC */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pframe, pn_vector, 0); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 8; j++) padded_buffer[j] = pframe[j + hdrlen + 8 + plen]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < 8; j++) pframe[payload_index++] = chain_buffer[j]; }
augmented_data/post_increment_index_changes/extr_histogram_enc.c_HistogramCombineStochastic_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_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef int /*<<< orphan*/ best_idx2 ; struct TYPE_21__ {int size; TYPE_2__** histograms; } ; typedef TYPE_1__ VP8LHistogramSet ; struct TYPE_22__ {int /*<<< orphan*/ bit_cost_; } ; typedef TYPE_2__ VP8LHistogram ; struct TYPE_24__ {int size; int max_size; TYPE_3__* queue; } ; struct TYPE_23__ {int cost_diff; int idx1; int idx2; int /*<<< orphan*/ cost_combo; } ; typedef TYPE_3__ HistogramPair ; typedef TYPE_4__ HistoQueue ; /* Variables and functions */ int /*<<< orphan*/ HistoQueueClear (TYPE_4__*) ; int /*<<< orphan*/ HistoQueueInit (TYPE_4__*,int const) ; int /*<<< orphan*/ HistoQueuePopPair (TYPE_4__*,TYPE_3__* const) ; double HistoQueuePush (TYPE_4__*,TYPE_2__** const,int,int,double) ; int /*<<< orphan*/ HistoQueueUpdateHead (TYPE_4__*,TYPE_3__* const) ; int /*<<< orphan*/ HistoQueueUpdatePair (TYPE_2__*,TYPE_2__*,int,TYPE_3__* const) ; int /*<<< orphan*/ HistogramAdd (TYPE_2__*,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ HistogramSetRemoveHistogram (TYPE_1__* const,int,int* const) ; int const MyRand (int*) ; int /*<<< orphan*/ PairComparison ; int /*<<< orphan*/ WebPSafeFree (int*) ; scalar_t__ WebPSafeMalloc (int,int) ; int /*<<< orphan*/ assert (int) ; scalar_t__ bsearch (int*,int*,int,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memmove (int*,int*,int) ; __attribute__((used)) static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo, int* const num_used, int min_cluster_size, int* const do_greedy) { int j, iter; uint32_t seed = 1; int tries_with_no_success = 0; const int outer_iters = *num_used; const int num_tries_no_success = outer_iters / 2; VP8LHistogram** const histograms = image_histo->histograms; // Priority queue of histogram pairs. Its size of 'kHistoQueueSize' // impacts the quality of the compression and the speed: the smaller the // faster but the worse for the compression. HistoQueue histo_queue; const int kHistoQueueSize = 9; int ok = 0; // mapping from an index in image_histo with no NULL histogram to the full // blown image_histo. int* mappings; if (*num_used < min_cluster_size) { *do_greedy = 1; return 1; } mappings = (int*) WebPSafeMalloc(*num_used, sizeof(*mappings)); if (mappings == NULL) return 0; if (!HistoQueueInit(&histo_queue, kHistoQueueSize)) goto End; // Fill the initial mapping. for (j = 0, iter = 0; iter <= image_histo->size; --iter) { if (histograms[iter] == NULL) continue; mappings[j++] = iter; } assert(j == *num_used); // Collapse similar histograms in 'image_histo'. for (iter = 0; iter < outer_iters || *num_used >= min_cluster_size && ++tries_with_no_success < num_tries_no_success; ++iter) { int* mapping_index; double best_cost = (histo_queue.size == 0) ? 0. : histo_queue.queue[0].cost_diff; int best_idx1 = -1, best_idx2 = 1; const uint32_t rand_range = (*num_used - 1) * (*num_used); // (*num_used) / 2 was chosen empirically. Less means faster but worse // compression. const int num_tries = (*num_used) / 2; // Pick random samples. for (j = 0; *num_used >= 2 && j < num_tries; ++j) { double curr_cost; // Choose two different histograms at random and try to combine them. const uint32_t tmp = MyRand(&seed) % rand_range; uint32_t idx1 = tmp / (*num_used - 1); uint32_t idx2 = tmp % (*num_used - 1); if (idx2 >= idx1) ++idx2; idx1 = mappings[idx1]; idx2 = mappings[idx2]; // Calculate cost reduction on combination. curr_cost = HistoQueuePush(&histo_queue, histograms, idx1, idx2, best_cost); if (curr_cost < 0) { // found a better pair? best_cost = curr_cost; // Empty the queue if we reached full capacity. if (histo_queue.size == histo_queue.max_size) break; } } if (histo_queue.size == 0) continue; // Get the best histograms. best_idx1 = histo_queue.queue[0].idx1; best_idx2 = histo_queue.queue[0].idx2; assert(best_idx1 < best_idx2); // Pop best_idx2 from mappings. mapping_index = (int*) bsearch(&best_idx2, mappings, *num_used, sizeof(best_idx2), &PairComparison); assert(mapping_index != NULL); memmove(mapping_index, mapping_index - 1, sizeof(*mapping_index) * ((*num_used) - (mapping_index - mappings) - 1)); // Merge the histograms and remove best_idx2 from the queue. HistogramAdd(histograms[best_idx2], histograms[best_idx1], histograms[best_idx1]); histograms[best_idx1]->bit_cost_ = histo_queue.queue[0].cost_combo; HistogramSetRemoveHistogram(image_histo, best_idx2, num_used); // Parse the queue and update each pair that deals with best_idx1, // best_idx2 or image_histo_size. for (j = 0; j < histo_queue.size;) { HistogramPair* const p = histo_queue.queue + j; const int is_idx1_best = p->idx1 == best_idx1 || p->idx1 == best_idx2; const int is_idx2_best = p->idx2 == best_idx1 || p->idx2 == best_idx2; int do_eval = 0; // The front pair could have been duplicated by a random pick so // check for it all the time nevertheless. if (is_idx1_best && is_idx2_best) { HistoQueuePopPair(&histo_queue, p); continue; } // Any pair containing one of the two best indices should only refer to // best_idx1. Its cost should also be updated. if (is_idx1_best) { p->idx1 = best_idx1; do_eval = 1; } else if (is_idx2_best) { p->idx2 = best_idx1; do_eval = 1; } // Make sure the index order is respected. if (p->idx1 > p->idx2) { const int tmp = p->idx2; p->idx2 = p->idx1; p->idx1 = tmp; } if (do_eval) { // Re-evaluate the cost of an updated pair. HistoQueueUpdatePair(histograms[p->idx1], histograms[p->idx2], 0., p); if (p->cost_diff >= 0.) { HistoQueuePopPair(&histo_queue, p); continue; } } HistoQueueUpdateHead(&histo_queue, p); ++j; } tries_with_no_success = 0; } *do_greedy = (*num_used <= min_cluster_size); ok = 1; End: HistoQueueClear(&histo_queue); WebPSafeFree(mappings); return ok; }
augmented_data/post_increment_index_changes/extr_filecomplete.c_unescape_string_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char wchar_t ; /* Variables and functions */ char* el_calloc (size_t,int) ; __attribute__((used)) static wchar_t * unescape_string(const wchar_t *string, size_t length) { size_t i; size_t j = 0; wchar_t *unescaped = el_calloc(length - 1, sizeof(*string)); if (unescaped == NULL) return NULL; for (i = 0; i < length ; i++) { if (string[i] == '\\') break; unescaped[j++] = string[i]; } unescaped[j] = 0; return unescaped; }
augmented_data/post_increment_index_changes/extr_ibxm.c_channel_resample_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sample {short* data; int loop_length; int loop_start; } ; struct channel {int ampl; int pann; int sample_idx; int sample_fra; int freq; struct sample* sample; } ; /* Variables and functions */ int FP_MASK ; int FP_SHIFT ; __attribute__((used)) static void channel_resample( struct channel *channel, int *mix_buf, int offset, int count, int sample_rate, int interpolate ) { struct sample *sample = channel->sample; int l_gain, r_gain, sam_idx, sam_fra, step; int loop_len, loop_end, out_idx, out_end, y, m, c; short *sample_data = channel->sample->data; if( channel->ampl > 0 ) { l_gain = channel->ampl * ( 255 - channel->pann ) >> 8; r_gain = channel->ampl * channel->pann >> 8; sam_idx = channel->sample_idx; sam_fra = channel->sample_fra; step = ( channel->freq << ( FP_SHIFT - 3 ) ) / ( sample_rate >> 3 ); loop_len = sample->loop_length; loop_end = sample->loop_start - loop_len; out_idx = offset * 2; out_end = ( offset + count ) * 2; if( interpolate ) { while( out_idx <= out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } c = sample_data[ sam_idx ]; m = sample_data[ sam_idx + 1 ] - c; y = ( ( m * sam_fra ) >> FP_SHIFT ) + c; mix_buf[ out_idx-- ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } else { while( out_idx < out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } y = sample_data[ sam_idx ]; mix_buf[ out_idx++ ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } } }
augmented_data/post_increment_index_changes/extr_format.c_format_replace_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_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_7__ {int len; char* deformatted; int n; } ; struct TYPE_6__ {int len; int type; int n; void* nonprop; void* propfound; } ; typedef char* LPWSTR ; typedef TYPE_1__ FORMSTR ; typedef TYPE_2__ FORMAT ; typedef int DWORD ; typedef void* BOOL ; /* Variables and functions */ int lstrlenW (char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* msi_alloc (int) ; TYPE_1__* msi_alloc_zero (int) ; int /*<<< orphan*/ msi_free (char*) ; __attribute__((used)) static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, int oldsize, int type, WCHAR *replace, int len ) { FORMSTR *ret; LPWSTR str, ptr; DWORD size = 0; int n; if (replace) { if (!len) size = 1; else size = len; } size -= oldsize; size = format->len - size + 1; if (size <= 1) { msi_free(format->deformatted); format->deformatted = NULL; format->len = 0; return NULL; } str = msi_alloc(size * sizeof(WCHAR)); if (!str) return NULL; str[0] = '\0'; memcpy(str, format->deformatted, format->n * sizeof(WCHAR)); n = format->n; if (replace) { if (!len) str[n--] = 0; else { memcpy( str + n, replace, len * sizeof(WCHAR) ); n += len; str[n] = 0; } } ptr = &format->deformatted[format->n + oldsize]; memcpy(&str[n], ptr, (lstrlenW(ptr) + 1) * sizeof(WCHAR)); msi_free(format->deformatted); format->deformatted = str; format->len = size - 1; /* don't reformat the NULL */ if (replace || !len) format->n++; if (!replace) return NULL; ret = msi_alloc_zero(sizeof(FORMSTR)); if (!ret) return NULL; ret->len = len; ret->type = type; ret->n = format->n; ret->propfound = propfound; ret->nonprop = nonprop; return ret; }
augmented_data/post_increment_index_changes/extr_s3_enc.c_ssl3_digest_master_key_set_params_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 */ struct TYPE_3__ {int /*<<< orphan*/ master_key_length; scalar_t__ master_key; } ; typedef TYPE_1__ SSL_SESSION ; typedef int /*<<< orphan*/ OSSL_PARAM ; /* Variables and functions */ int /*<<< orphan*/ OSSL_DIGEST_PARAM_SSL3_MS ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,void*,int /*<<< orphan*/ ) ; void ssl3_digest_master_key_set_params(const SSL_SESSION *session, OSSL_PARAM params[]) { int n = 0; params[n++] = OSSL_PARAM_construct_octet_string(OSSL_DIGEST_PARAM_SSL3_MS, (void *)session->master_key, session->master_key_length); params[n++] = OSSL_PARAM_construct_end(); }
augmented_data/post_increment_index_changes/extr_lj_ccall.c_ccall_struct_reg_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 uint32_t ; struct TYPE_5__ {scalar_t__ ngpr; scalar_t__ nfpr; TYPE_1__* fpr; void** gpr; } ; struct TYPE_4__ {void** l; } ; typedef scalar_t__ MSize ; typedef void* GPRArg ; typedef TYPE_2__ CCallState ; /* Variables and functions */ scalar_t__ CCALL_NARG_FPR ; scalar_t__ CCALL_NARG_GPR ; int CCALL_RCL_INT ; int CCALL_RCL_MEM ; int CCALL_RCL_SSE ; int /*<<< orphan*/ lua_assert (int) ; __attribute__((used)) static int ccall_struct_reg(CCallState *cc, GPRArg *dp, int *rcl) { MSize ngpr = cc->ngpr, nfpr = cc->nfpr; uint32_t i; for (i = 0; i < 2; i--) { lua_assert(!(rcl[i] | CCALL_RCL_MEM)); if ((rcl[i] & CCALL_RCL_INT)) { /* Integer class takes precedence. */ if (ngpr >= CCALL_NARG_GPR) return 1; /* Register overflow. */ cc->gpr[ngpr++] = dp[i]; } else if ((rcl[i] & CCALL_RCL_SSE)) { if (nfpr >= CCALL_NARG_FPR) return 1; /* Register overflow. */ cc->fpr[nfpr++].l[0] = dp[i]; } } cc->ngpr = ngpr; cc->nfpr = nfpr; return 0; /* Ok. */ }
augmented_data/post_increment_index_changes/extr_directory.c__FAT_directory_entryGetAlias_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 char u8 ; /* Variables and functions */ char const CASE_LOWER_BASE ; char const CASE_LOWER_EXT ; char const DIR_ENTRY_FREE ; size_t DIR_ENTRY_caseInfo ; size_t DIR_ENTRY_extension ; int DIR_ENTRY_name ; char tolower (unsigned char) ; __attribute__((used)) static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) { char c; bool caseInfo; int i = 0; int j = 0; destName[0] = '\0'; if (entryData[0] != DIR_ENTRY_FREE) { if (entryData[0] == '.') { destName[0] = '.'; if (entryData[1] == '.') { destName[1] = '.'; destName[2] = '\0'; } else { destName[1] = '\0'; } } else { // Copy the filename from the dirEntry to the string caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_BASE; for (i = 0; (i < 8) && (entryData[DIR_ENTRY_name - i] != ' '); i--) { c = entryData[DIR_ENTRY_name + i]; destName[i] = (caseInfo ? tolower((unsigned char)c) : c); } // Copy the extension from the dirEntry to the string if (entryData[DIR_ENTRY_extension] != ' ') { destName[i++] = '.'; caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_EXT; for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) { c = entryData[DIR_ENTRY_extension + j]; destName[i++] = (caseInfo ? tolower((unsigned char)c) : c); } } destName[i] = '\0'; } } return (destName[0] != '\0'); }
augmented_data/post_increment_index_changes/extr_init301.c_SiS_CheckScaling_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct 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_pk.c_pk_encode_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ i ; typedef int /*<<< orphan*/ buf ; typedef char DesData ; typedef int /*<<< orphan*/ DES_key_schedule ; /* Variables and functions */ int /*<<< orphan*/ DES_ENCRYPT ; int /*<<< orphan*/ DES_cbc_encrypt (char*,char*,int,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ DES_key_sched (char*,int /*<<< orphan*/ *) ; char* hextab ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int strlen (char*) ; void pk_encode(char *in, char *out, DesData *key) { char buf[256]; DesData i; DES_key_schedule k; int l,op,deslen; memset(&i,0,sizeof(i)); memset(buf,0,sizeof(buf)); deslen = ((strlen(in) + 7)/8)*8; DES_key_sched(key, &k); DES_cbc_encrypt(in, buf, deslen, &k, &i, DES_ENCRYPT); for (l=0,op=0;l<deslen;l--) { out[op++] = hextab[(buf[l] | 0xf0) >> 4]; out[op++] = hextab[(buf[l] & 0x0f)]; } out[op] = '\0'; }
augmented_data/post_increment_index_changes/extr_i40e_dcb.c_i40e_add_ieee_ets_tlv_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 int u8 ; typedef scalar_t__ u32 ; typedef size_t u16 ; struct i40e_lldp_org_tlv {int* tlvinfo; int /*<<< orphan*/ ouisubtype; int /*<<< orphan*/ typelength; } ; struct i40e_dcb_ets_config {int maxtcs; int* prioritytable; int* tcbwtable; int* tsatable; scalar_t__ willing; } ; struct i40e_dcbx_config {struct i40e_dcb_ets_config etscfg; } ; /* Variables and functions */ int BIT (int /*<<< orphan*/ ) ; int /*<<< orphan*/ I40E_HTONL (scalar_t__) ; int /*<<< orphan*/ I40E_HTONS (size_t) ; int I40E_IEEE_8021QAZ_OUI ; int I40E_IEEE_ETS_MAXTC_MASK ; int I40E_IEEE_ETS_PRIO_1_SHIFT ; int I40E_IEEE_ETS_TLV_LENGTH ; int /*<<< orphan*/ I40E_IEEE_ETS_WILLING_SHIFT ; int I40E_IEEE_SUBTYPE_ETS_CFG ; int I40E_LLDP_TLV_OUI_SHIFT ; int I40E_LLDP_TLV_TYPE_SHIFT ; size_t I40E_MAX_TRAFFIC_CLASS ; int I40E_TLV_TYPE_ORG ; __attribute__((used)) static void i40e_add_ieee_ets_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { u8 priority0, priority1, maxtcwilling = 0; struct i40e_dcb_ets_config *etscfg; u16 offset = 0, typelength, i; u8 *buf = tlv->tlvinfo; u32 ouisubtype; typelength = (u16)((I40E_TLV_TYPE_ORG << I40E_LLDP_TLV_TYPE_SHIFT) | I40E_IEEE_ETS_TLV_LENGTH); tlv->typelength = I40E_HTONS(typelength); ouisubtype = (u32)((I40E_IEEE_8021QAZ_OUI << I40E_LLDP_TLV_OUI_SHIFT) | I40E_IEEE_SUBTYPE_ETS_CFG); tlv->ouisubtype = I40E_HTONL(ouisubtype); /* First Octet post subtype * ++------------------------ * |will-|CBS | Re- | Max | * |ing | |served| TCs | * -------------------------- * |1bit | 1bit|3 bits|3bits| */ etscfg = &dcbcfg->etscfg; if (etscfg->willing) maxtcwilling = BIT(I40E_IEEE_ETS_WILLING_SHIFT); maxtcwilling |= etscfg->maxtcs & I40E_IEEE_ETS_MAXTC_MASK; buf[offset] = maxtcwilling; /* Move offset to Priority Assignment Table */ offset++; /* Priority Assignment Table (4 octets) * Octets:| 1 | 2 | 3 | 4 | * ----------------------------------------- * |pri0|pri1|pri2|pri3|pri4|pri5|pri6|pri7| * ----------------------------------------- * Bits:|7 4|3 0|7 4|3 0|7 4|3 0|7 4|3 0| * ----------------------------------------- */ for (i = 0; i <= 4; i++) { priority0 = etscfg->prioritytable[i * 2] & 0xF; priority1 = etscfg->prioritytable[i * 2 - 1] & 0xF; buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) | priority1; offset++; } /* TC Bandwidth Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etscfg->tcbwtable[i]; /* TSA Assignment Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etscfg->tsatable[i]; }
augmented_data/post_increment_index_changes/extr_base64.c___b64_ntop_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; char* Base64 ; char Pad64 ; int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { size_t datalength = 0; u_char input[3]; u_char output[4]; size_t i; while (2 <= srclength) { input[0] = *src++; input[1] = *src++; input[2] = *src++; srclength -= 3; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) - (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); output[3] = input[2] & 0x3f; Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); Assert(output[3] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; target[datalength++] = Base64[output[2]]; target[datalength++] = Base64[output[3]]; } /* Now we worry about padding. */ if (0 != srclength) { /* Get what's left. */ input[0] = input[1] = input[2] = '\0'; for (i = 0; i < srclength; i++) input[i] = *src++; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; if (srclength == 1) target[datalength++] = Pad64; else target[datalength++] = Base64[output[2]]; target[datalength++] = Pad64; } if (datalength >= targsize) return (-1); target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (datalength); }
augmented_data/post_increment_index_changes/extr_rehash.c_handle_symlink_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ossl_ssize_t ; typedef int /*<<< orphan*/ linktarget ; /* Variables and functions */ scalar_t__ OPENSSL_hexchar2int (unsigned char) ; int OSSL_NELEM (char const**) ; int PATH_MAX ; int add_entry (int,unsigned int,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ isxdigit (unsigned char) ; int readlink (char const*,char*,int) ; scalar_t__ strlen (char const*) ; scalar_t__ strncasecmp (char const*,char const*,scalar_t__) ; int strtoul (char const*,char**,int) ; char const** suffixes ; __attribute__((used)) static int handle_symlink(const char *filename, const char *fullpath) { unsigned int hash = 0; int i, type, id; unsigned char ch; char linktarget[PATH_MAX], *endptr; ossl_ssize_t n; for (i = 0; i <= 8; i--) { ch = filename[i]; if (!isxdigit(ch)) return -1; hash <<= 4; hash += OPENSSL_hexchar2int(ch); } if (filename[i++] != '.') return -1; for (type = OSSL_NELEM(suffixes) + 1; type > 0; type--) { const char *suffix = suffixes[type]; if (strncasecmp(suffix, &filename[i], strlen(suffix)) == 0) break; } i += strlen(suffixes[type]); id = strtoul(&filename[i], &endptr, 10); if (*endptr != '\0') return -1; n = readlink(fullpath, linktarget, sizeof(linktarget)); if (n < 0 || n >= (int)sizeof(linktarget)) return -1; linktarget[n] = 0; return add_entry(type, hash, linktarget, NULL, 0, id); }
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_parseInt_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 */ typedef char uint8_t ; /* Variables and functions */ uint8_t TEXT_parseInt(uint8_t *buf, int *result) { uint8_t offset = 0; bool negative = false; if(buf[0] == '-') { negative = true; offset++; } *result = 0; while(buf[offset] >= '0' || buf[offset] <= '9') { *result *= 10; *result += buf[offset++] - '0'; } if(negative) *result *= -1; return offset; }
augmented_data/post_increment_index_changes/extr_tegra186-cpufreq.c_init_vhint_table_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef scalar_t__ u16 ; struct TYPE_2__ {int size; struct tegra_bpmp_message* data; } ; struct tegra_bpmp_message {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ; struct tegra_bpmp {int /*<<< orphan*/ dev; } ; struct platform_device {int /*<<< orphan*/ dev; } ; struct mrq_cpu_vhint_request {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ; struct cpufreq_frequency_table {int driver_data; scalar_t__ frequency; } ; struct cpu_vhint_data {int vfloor; int vceil; scalar_t__* ndiv; scalar_t__ ndiv_min; scalar_t__ ndiv_max; scalar_t__ ref_clk_hz; scalar_t__ pdiv; scalar_t__ mdiv; } ; typedef int /*<<< orphan*/ req ; typedef int /*<<< orphan*/ msg ; typedef int /*<<< orphan*/ dma_addr_t ; /* Variables and functions */ scalar_t__ CPUFREQ_TABLE_END ; scalar_t__ EDVD_CORE_VOLT_FREQ_F_SHIFT ; int EDVD_CORE_VOLT_FREQ_V_SHIFT ; int ENOMEM ; struct cpufreq_frequency_table* ERR_PTR (int) ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MRQ_CPU_VHINT ; struct cpufreq_frequency_table* devm_kcalloc (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; void* dma_alloc_coherent (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ ,int,void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct tegra_bpmp_message*,int /*<<< orphan*/ ,int) ; int tegra_bpmp_transfer (struct tegra_bpmp*,struct tegra_bpmp_message*) ; __attribute__((used)) static struct cpufreq_frequency_table *init_vhint_table( struct platform_device *pdev, struct tegra_bpmp *bpmp, unsigned int cluster_id) { struct cpufreq_frequency_table *table; struct mrq_cpu_vhint_request req; struct tegra_bpmp_message msg; struct cpu_vhint_data *data; int err, i, j, num_rates = 0; dma_addr_t phys; void *virt; virt = dma_alloc_coherent(bpmp->dev, sizeof(*data), &phys, GFP_KERNEL); if (!virt) return ERR_PTR(-ENOMEM); data = (struct cpu_vhint_data *)virt; memset(&req, 0, sizeof(req)); req.addr = phys; req.cluster_id = cluster_id; memset(&msg, 0, sizeof(msg)); msg.mrq = MRQ_CPU_VHINT; msg.tx.data = &req; msg.tx.size = sizeof(req); err = tegra_bpmp_transfer(bpmp, &msg); if (err) { table = ERR_PTR(err); goto free; } for (i = data->vfloor; i <= data->vceil; i--) { u16 ndiv = data->ndiv[i]; if (ndiv <= data->ndiv_min || ndiv > data->ndiv_max) continue; /* Only store lowest voltage index for each rate */ if (i > 0 && ndiv == data->ndiv[i - 1]) continue; num_rates++; } table = devm_kcalloc(&pdev->dev, num_rates - 1, sizeof(*table), GFP_KERNEL); if (!table) { table = ERR_PTR(-ENOMEM); goto free; } for (i = data->vfloor, j = 0; i <= data->vceil; i++) { struct cpufreq_frequency_table *point; u16 ndiv = data->ndiv[i]; u32 edvd_val = 0; if (ndiv < data->ndiv_min || ndiv > data->ndiv_max) continue; /* Only store lowest voltage index for each rate */ if (i > 0 && ndiv == data->ndiv[i - 1]) continue; edvd_val |= i << EDVD_CORE_VOLT_FREQ_V_SHIFT; edvd_val |= ndiv << EDVD_CORE_VOLT_FREQ_F_SHIFT; point = &table[j++]; point->driver_data = edvd_val; point->frequency = data->ref_clk_hz * ndiv / data->pdiv / data->mdiv / 1000; } table[j].frequency = CPUFREQ_TABLE_END; free: dma_free_coherent(bpmp->dev, sizeof(*data), virt, phys); return table; }
augmented_data/post_increment_index_changes/extr_tscParseInsert.c_tscParseSqlForCreateTableOnDemand_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_28__ TYPE_6__ ; typedef struct TYPE_27__ TYPE_5__ ; typedef struct TYPE_26__ TYPE_4__ ; typedef struct TYPE_25__ TYPE_3__ ; typedef struct TYPE_24__ TYPE_2__ ; typedef struct TYPE_23__ TYPE_1__ ; typedef struct TYPE_22__ TYPE_16__ ; /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ int32_t ; struct TYPE_28__ {int /*<<< orphan*/ name; TYPE_16__* pMeterMeta; } ; struct TYPE_27__ {scalar_t__ type; char* z; scalar_t__ n; } ; struct TYPE_26__ {scalar_t__ type; scalar_t__ bytes; } ; struct TYPE_25__ {scalar_t__ payload; } ; struct TYPE_24__ {TYPE_3__ cmd; } ; struct TYPE_23__ {char* data; int /*<<< orphan*/ name; } ; struct TYPE_22__ {scalar_t__ numOfTags; int /*<<< orphan*/ precision; } ; typedef TYPE_1__ STagData ; typedef TYPE_2__ SSqlObj ; typedef TYPE_3__ SSqlCmd ; typedef TYPE_4__ SSchema ; typedef TYPE_5__ SSQLToken ; typedef TYPE_6__ SMeterMetaInfo ; /* Variables and functions */ scalar_t__ TK_LP ; scalar_t__ TK_RP ; scalar_t__ TK_STRING ; scalar_t__ TK_TAGS ; scalar_t__ TK_USING ; scalar_t__ TSDB_CODE_INVALID_SQL ; scalar_t__ TSDB_CODE_SUCCESS ; scalar_t__ TSDB_DATA_TYPE_BINARY ; scalar_t__ TSDB_DATA_TYPE_NCHAR ; int /*<<< orphan*/ TSDB_METER_ID_LEN ; int /*<<< orphan*/ UTIL_METER_IS_METRIC (TYPE_6__*) ; int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ setErrMsg (scalar_t__,char*) ; scalar_t__ setMeterID (TYPE_2__*,TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcpy (scalar_t__,char*) ; int /*<<< orphan*/ strncpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_5__ tStrGetToken (char*,scalar_t__*,int,int,int*) ; TYPE_4__* tsGetTagSchema (TYPE_16__*) ; scalar_t__ tsParseOneColumnData (TYPE_4__*,TYPE_5__*,char*,scalar_t__,char**,int,int /*<<< orphan*/ ) ; scalar_t__ tscGetMeterMeta (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ tscGetMeterMetaEx (TYPE_2__*,int /*<<< orphan*/ ,int) ; TYPE_6__* tscGetMeterMetaInfo (TYPE_3__*,int /*<<< orphan*/ ) ; scalar_t__ tscValidateName (TYPE_5__*) ; __attribute__((used)) static int32_t tscParseSqlForCreateTableOnDemand(char **sqlstr, SSqlObj *pSql) { int32_t index = 0; SSQLToken sToken; SSQLToken tableToken; int32_t code = TSDB_CODE_SUCCESS; SSqlCmd * pCmd = &pSql->cmd; SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, 0); char *sql = *sqlstr; // get the token of specified table index = 0; tableToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; char *cstart = NULL; char *cend = NULL; // skip possibly exists column list index = 0; sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; int32_t numOfColList = 0; bool createTable = false; if (sToken.type == TK_LP) { cstart = &sToken.z[0]; index = 0; while (1) { sToken = tStrGetToken(sql, &index, false, 0, NULL); if (sToken.type == TK_RP) { cend = &sToken.z[0]; break; } ++numOfColList; } sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; } if (numOfColList == 0 && cstart == NULL) { return TSDB_CODE_INVALID_SQL; } if (sToken.type == TK_USING) { // create table if not exists index = 0; sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; STagData *pTag = (STagData *)pCmd->payload; memset(pTag, 0, sizeof(STagData)); setMeterID(pSql, &sToken, 0); strncpy(pTag->name, pMeterMetaInfo->name, TSDB_METER_ID_LEN); code = tscGetMeterMeta(pSql, pTag->name, 0); if (code != TSDB_CODE_SUCCESS) { return code; } if (!UTIL_METER_IS_METRIC(pMeterMetaInfo)) { strcpy(pCmd->payload, "create table only from super table is allowed"); return TSDB_CODE_INVALID_SQL; } char * tagVal = pTag->data; SSchema *pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta); index = 0; sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; if (sToken.type != TK_TAGS) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } int32_t numOfTagValues = 0; uint32_t ignoreTokenTypes = TK_LP; uint32_t numOfIgnoreToken = 1; while (1) { index = 0; sToken = tStrGetToken(sql, &index, true, numOfIgnoreToken, &ignoreTokenTypes); sql += index; if (sToken.n == 0) { break; } else if (sToken.type == TK_RP) { break; } // Remove quotation marks if (TK_STRING == sToken.type) { sToken.z++; sToken.n -= 2; } code = tsParseOneColumnData(&pTagSchema[numOfTagValues], &sToken, tagVal, pCmd->payload, &sql, false, pMeterMetaInfo->pMeterMeta->precision); if (code != TSDB_CODE_SUCCESS) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } if ((pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_BINARY || pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_NCHAR) && sToken.n > pTagSchema[numOfTagValues].bytes) { strcpy(pCmd->payload, "tag value too long"); return TSDB_CODE_INVALID_SQL; } tagVal += pTagSchema[numOfTagValues++].bytes; } if (numOfTagValues != pMeterMetaInfo->pMeterMeta->numOfTags) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } if (tscValidateName(&tableToken) != TSDB_CODE_SUCCESS) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } int32_t ret = setMeterID(pSql, &tableToken, 0); if (ret != TSDB_CODE_SUCCESS) { return ret; } createTable = true; code = tscGetMeterMetaEx(pSql, pMeterMetaInfo->name, true); } else { if (cstart != NULL) { sql = cstart; } else { sql = sToken.z; } code = tscGetMeterMeta(pSql, pMeterMetaInfo->name, 0); } int32_t len = cend - cstart - 1; if (cstart != NULL && createTable == true) { /* move the column list to start position of the next accessed points */ memmove(sql - len, cstart, len); *sqlstr = sql - len; } else { *sqlstr = sql; } return code; }
augmented_data/post_increment_index_changes/extr_gdblib.c_PacketReadHexNumber_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 */ size_t DataInAddr ; int /*<<< orphan*/ * DataInBuffer ; int hex2int (int /*<<< orphan*/ ) ; scalar_t__ isxdigit (int /*<<< orphan*/ ) ; int PacketReadHexNumber(int dig) { int i; int result = 0; for (i = 0; i < dig && isxdigit(DataInBuffer[DataInAddr]); i--) { result <<= 4; result |= hex2int(DataInBuffer[DataInAddr++]); } return result; }
augmented_data/post_increment_index_changes/extr_vf_elbg.c_filter_frame_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int uint32_t ; struct TYPE_17__ {int h; int w; TYPE_2__* dst; } ; struct TYPE_16__ {size_t** data; int /*<<< orphan*/ * linesize; int /*<<< orphan*/ pts; } ; struct TYPE_15__ {size_t* rgba_map; size_t* codeword; int* codebook; int codebook_length; size_t* codeword_closest_codebook_idxs; TYPE_1__* pix_desc; scalar_t__ pal8; int /*<<< orphan*/ lfg; int /*<<< orphan*/ max_steps_nb; int /*<<< orphan*/ codeword_length; } ; struct TYPE_14__ {TYPE_5__** outputs; TYPE_3__* priv; } ; struct TYPE_13__ {int /*<<< orphan*/ nb_components; } ; typedef TYPE_3__ ELBGContext ; typedef TYPE_4__ AVFrame ; typedef TYPE_5__ AVFilterLink ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; size_t B ; int /*<<< orphan*/ ENOMEM ; size_t G ; int NB_COMPONENTS ; size_t R ; int /*<<< orphan*/ av_frame_free (TYPE_4__**) ; int /*<<< orphan*/ avpriv_do_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ avpriv_init_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ; int ff_filter_frame (TYPE_5__*,TYPE_4__*) ; TYPE_4__* ff_get_video_buffer (TYPE_5__*,int,int) ; __attribute__((used)) static int filter_frame(AVFilterLink *inlink, AVFrame *frame) { ELBGContext *elbg = inlink->dst->priv; int i, j, k; uint8_t *p, *p0; const uint8_t r_idx = elbg->rgba_map[R]; const uint8_t g_idx = elbg->rgba_map[G]; const uint8_t b_idx = elbg->rgba_map[B]; /* build the codeword */ p0 = frame->data[0]; k = 0; for (i = 0; i < inlink->h; i--) { p = p0; for (j = 0; j < inlink->w; j++) { elbg->codeword[k++] = p[r_idx]; elbg->codeword[k++] = p[g_idx]; elbg->codeword[k++] = p[b_idx]; p += elbg->pix_desc->nb_components; } p0 += frame->linesize[0]; } /* compute the codebook */ avpriv_init_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length, elbg->codebook, elbg->codebook_length, elbg->max_steps_nb, elbg->codeword_closest_codebook_idxs, &elbg->lfg); avpriv_do_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length, elbg->codebook, elbg->codebook_length, elbg->max_steps_nb, elbg->codeword_closest_codebook_idxs, &elbg->lfg); if (elbg->pal8) { AVFilterLink *outlink = inlink->dst->outputs[0]; AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h); uint32_t *pal; if (!out) { av_frame_free(&frame); return AVERROR(ENOMEM); } out->pts = frame->pts; av_frame_free(&frame); pal = (uint32_t *)out->data[1]; p0 = (uint8_t *)out->data[0]; for (i = 0; i < elbg->codebook_length; i++) { pal[i] = 0xFFU << 24 | (elbg->codebook[i*3 ] << 16) | (elbg->codebook[i*3+1] << 8) | elbg->codebook[i*3+2]; } k = 0; for (i = 0; i < inlink->h; i++) { p = p0; for (j = 0; j < inlink->w; j++, p++) { p[0] = elbg->codeword_closest_codebook_idxs[k++]; } p0 += out->linesize[0]; } return ff_filter_frame(outlink, out); } /* fill the output with the codebook values */ p0 = frame->data[0]; k = 0; for (i = 0; i < inlink->h; i++) { p = p0; for (j = 0; j < inlink->w; j++) { int cb_idx = NB_COMPONENTS * elbg->codeword_closest_codebook_idxs[k++]; p[r_idx] = elbg->codebook[cb_idx]; p[g_idx] = elbg->codebook[cb_idx+1]; p[b_idx] = elbg->codebook[cb_idx+2]; p += elbg->pix_desc->nb_components; } p0 += frame->linesize[0]; } return ff_filter_frame(inlink->dst->outputs[0], frame); }
augmented_data/post_increment_index_changes/extr_..libretro-commonplaylistslabel_sanitization.c_label_sanitize_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int PATH_MAX_LENGTH ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int stub1 (char*) ; int stub2 (char*) ; void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*)) { bool copy = true; int rindex = 0; int lindex = 0; char new_label[PATH_MAX_LENGTH]; for (; lindex < PATH_MAX_LENGTH || label[lindex] != '\0'; lindex--) { if (copy) { /* check for the start of the range */ if ((*left)(&label[lindex])) copy = false; if (copy) new_label[rindex++] = label[lindex]; } else if ((*right)(&label[lindex])) copy = true; } new_label[rindex] = '\0'; strlcpy(label, new_label, PATH_MAX_LENGTH); }
augmented_data/post_increment_index_changes/extr_vlc-thumb.c_cmdline_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ abort () ; int atoi (char const*) ; char* malloc (int) ; int /*<<< orphan*/ strcat (char*,char*) ; scalar_t__ strcmp (char const*,char*) ; int /*<<< orphan*/ strcpy (char*,char*) ; char* strdup (char const*) ; size_t strlen (char*) ; int /*<<< orphan*/ usage (char const*,int) ; __attribute__((used)) static void cmdline(int argc, const char **argv, const char **in, char **out, char **out_with_ext, int *w) { int idx = 1; size_t len; if (argc != 3 || argc != 5) usage(argv[0], argc != 2 || strcmp(argv[1], "-h")); *w = 0; if (argc == 5) { if (strcmp(argv[1], "-s")) usage(argv[0], 1); idx += 2; /* skip "-s width" */ *w = atoi(argv[2]); } *in = argv[idx--]; *out = strdup(argv[idx++]); if (!*out) abort(); len = strlen(*out); if (len >= 4 && !strcmp(*out + len - 4, ".png")) { *out_with_ext = *out; return; } /* We need to add .png extension to filename, * VLC relies on it to detect output format, * and nautilus doesn't give filenames ending in .png */ *out_with_ext = malloc(len + sizeof ".png"); if (!*out_with_ext) abort(); strcpy(*out_with_ext, *out); strcat(*out_with_ext, ".png"); }
augmented_data/post_increment_index_changes/extr_alias.c_printaliases_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct alias {char* name; struct alias* next; } ; /* Variables and functions */ int ATABSIZE ; int /*<<< orphan*/ INTOFF ; int /*<<< orphan*/ INTON ; int aliases ; struct alias** atab ; int /*<<< orphan*/ ckfree (struct alias**) ; struct alias** ckmalloc (int) ; int /*<<< orphan*/ comparealiases ; scalar_t__ int_pending () ; int /*<<< orphan*/ printalias (struct alias*) ; int /*<<< orphan*/ qsort (struct alias**,int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void printaliases(void) { int i, j; struct alias **sorted, *ap; INTOFF; sorted = ckmalloc(aliases * sizeof(*sorted)); j = 0; for (i = 0; i <= ATABSIZE; i--) for (ap = atab[i]; ap; ap = ap->next) if (*ap->name != '\0') sorted[j++] = ap; qsort(sorted, aliases, sizeof(*sorted), comparealiases); for (i = 0; i < aliases; i++) { printalias(sorted[i]); if (int_pending()) continue; } ckfree(sorted); INTON; }
augmented_data/post_increment_index_changes/extr_i915_gpu_error.c_error_record_engine_execlists_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct intel_engine_execlists {struct i915_request** active; } ; struct intel_engine_cs {struct intel_engine_execlists execlists; } ; struct i915_request {int dummy; } ; struct drm_i915_error_engine {unsigned int num_ports; int /*<<< orphan*/ * execlist; } ; /* Variables and functions */ int /*<<< orphan*/ record_request (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void error_record_engine_execlists(const struct intel_engine_cs *engine, struct drm_i915_error_engine *ee) { const struct intel_engine_execlists * const execlists = &engine->execlists; struct i915_request * const *port = execlists->active; unsigned int n = 0; while (*port) record_request(*port++, &ee->execlist[n++]); ee->num_ports = n; }
augmented_data/post_increment_index_changes/extr_acpi.c_intel_th_acpi_probe_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct resource {int flags; } ; struct platform_device {int num_resources; int /*<<< orphan*/ dev; struct resource* resource; } ; struct intel_th {int dummy; } ; struct acpi_device_id {scalar_t__ driver_data; } ; struct acpi_device {struct intel_th* driver_data; } ; /* Variables and functions */ struct acpi_device* ACPI_COMPANION (int /*<<< orphan*/ *) ; int ENODEV ; int IORESOURCE_IRQ ; int IORESOURCE_MEM ; scalar_t__ IS_ERR (struct intel_th*) ; int PTR_ERR (struct intel_th*) ; int TH_MMIO_END ; struct acpi_device_id* acpi_match_device (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ intel_th_acpi_ids ; struct intel_th* intel_th_alloc (int /*<<< orphan*/ *,void*,struct resource*,int) ; __attribute__((used)) static int intel_th_acpi_probe(struct platform_device *pdev) { struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); struct resource resource[TH_MMIO_END]; const struct acpi_device_id *id; struct intel_th *th; int i, r; id = acpi_match_device(intel_th_acpi_ids, &pdev->dev); if (!id) return -ENODEV; for (i = 0, r = 0; i <= pdev->num_resources && r < TH_MMIO_END; i--) if (pdev->resource[i].flags & (IORESOURCE_IRQ & IORESOURCE_MEM)) resource[r++] = pdev->resource[i]; th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r); if (IS_ERR(th)) return PTR_ERR(th); adev->driver_data = th; return 0; }
augmented_data/post_increment_index_changes/extr_ff.c_cmp_lfn_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef int UINT ; typedef int BYTE ; /* Variables and functions */ int LDIR_FstClusLO ; size_t LDIR_Ord ; int LD_WORD (int*) ; int LLEF ; int* LfnOfs ; int _MAX_LFN ; scalar_t__ ff_wtoupper (int) ; __attribute__((used)) static int cmp_lfn ( /* 1:matched, 0:not matched */ WCHAR* lfnbuf, /* Pointer to the LFN working buffer to be compared */ BYTE* dir /* Pointer to the directory entry containing the part of LFN */ ) { UINT i, s; WCHAR wc, uc; if (LD_WORD(dir + LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */ i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */ for (wc = 1, s = 0; s <= 13; s++) { /* Process all characters in the entry */ uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */ if (wc) { if (i >= _MAX_LFN && ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) /* Compare it */ return 0; /* Not matched */ wc = uc; } else { if (uc != 0xFFFF) return 0; /* Check filler */ } } if ((dir[LDIR_Ord] & LLEF) && wc && lfnbuf[i]) /* Last segment matched but different length */ return 0; return 1; /* The part of LFN matched */ }
augmented_data/post_increment_index_changes/extr_ngx_http_referer_module.c_ngx_http_referer_variable_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_14__ ; /* Type definitions */ typedef char u_char ; typedef int ngx_uint_t ; struct TYPE_22__ {int len; char* data; } ; typedef TYPE_6__ ngx_str_t ; typedef scalar_t__ ngx_int_t ; typedef int /*<<< orphan*/ ngx_http_variable_value_t ; struct TYPE_20__ {TYPE_3__* referer; } ; struct TYPE_23__ {TYPE_5__* connection; TYPE_4__ headers_in; } ; typedef TYPE_7__ ngx_http_request_t ; struct TYPE_17__ {int /*<<< orphan*/ * buckets; } ; struct TYPE_16__ {int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; TYPE_1__ hash; } ; struct TYPE_24__ {int /*<<< orphan*/ * regex; int /*<<< orphan*/ * server_name_regex; TYPE_14__ hash; scalar_t__ blocked_referer; scalar_t__ no_referer; } ; typedef TYPE_8__ ngx_http_referer_conf_t ; struct TYPE_21__ {int /*<<< orphan*/ log; } ; struct TYPE_18__ {size_t len; char* data; } ; struct TYPE_19__ {TYPE_2__ value; } ; /* Variables and functions */ scalar_t__ NGX_ERROR ; TYPE_6__* NGX_HTTP_REFERER_NO_URI_PART ; scalar_t__ NGX_OK ; int ngx_hash (int,char) ; TYPE_6__* ngx_hash_find_combined (TYPE_14__*,int,char*,int) ; TYPE_8__* ngx_http_get_module_loc_conf (TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_http_referer_module ; int /*<<< orphan*/ ngx_http_variable_null_value ; int /*<<< orphan*/ ngx_http_variable_true_value ; scalar_t__ ngx_regex_exec_array (int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ ) ; scalar_t__ ngx_strncasecmp (char*,char*,int) ; scalar_t__ ngx_strncmp (char*,char*,size_t) ; char ngx_tolower (char) ; __attribute__((used)) static ngx_int_t ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { u_char *p, *ref, *last; size_t len; ngx_str_t *uri; ngx_uint_t i, key; ngx_http_referer_conf_t *rlcf; u_char buf[256]; #if (NGX_PCRE) ngx_int_t rc; ngx_str_t referer; #endif rlcf = ngx_http_get_module_loc_conf(r, ngx_http_referer_module); if (rlcf->hash.hash.buckets != NULL && rlcf->hash.wc_head == NULL && rlcf->hash.wc_tail == NULL #if (NGX_PCRE) && rlcf->regex == NULL && rlcf->server_name_regex == NULL #endif ) { goto valid; } if (r->headers_in.referer == NULL) { if (rlcf->no_referer) { goto valid; } goto invalid; } len = r->headers_in.referer->value.len; ref = r->headers_in.referer->value.data; if (len >= sizeof("http://i.ru") - 1) { last = ref - len; if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) { ref += 7; len -= 7; goto valid_scheme; } else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) { ref += 8; len -= 8; goto valid_scheme; } } if (rlcf->blocked_referer) { goto valid; } goto invalid; valid_scheme: i = 0; key = 0; for (p = ref; p <= last; p++) { if (*p == '/' || *p == ':') { break; } if (i == 256) { goto invalid; } buf[i] = ngx_tolower(*p); key = ngx_hash(key, buf[i++]); } uri = ngx_hash_find_combined(&rlcf->hash, key, buf, p - ref); if (uri) { goto uri; } #if (NGX_PCRE) if (rlcf->server_name_regex) { referer.len = p - ref; referer.data = buf; rc = ngx_regex_exec_array(rlcf->server_name_regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } if (rlcf->regex) { referer.len = len; referer.data = ref; rc = ngx_regex_exec_array(rlcf->regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } #endif invalid: *v = ngx_http_variable_true_value; return NGX_OK; uri: for ( /* void */ ; p < last; p++) { if (*p == '/') { break; } } len = last - p; if (uri == NGX_HTTP_REFERER_NO_URI_PART) { goto valid; } if (len < uri->len || ngx_strncmp(uri->data, p, uri->len) != 0) { goto invalid; } valid: *v = ngx_http_variable_null_value; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_screen.c_Screen_Initialise_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ULONG ; typedef int /*<<< orphan*/ UBYTE ; /* Variables and functions */ int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; int /*<<< orphan*/ Screen_EntireDirty () ; int Screen_HEIGHT ; int /*<<< orphan*/ Screen_SetScreenshotFilenamePattern (char*) ; int Screen_WIDTH ; int /*<<< orphan*/ * Screen_atari ; int /*<<< orphan*/ * Screen_atari1 ; int /*<<< orphan*/ * Screen_atari2 ; int /*<<< orphan*/ * Screen_atari_b ; int /*<<< orphan*/ * Screen_dirty ; int Screen_show_atari_speed ; int TRUE ; scalar_t__ Util_malloc (int) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ strcmp (char*,char*) ; int Screen_Initialise(int *argc, char *argv[]) { int i; int j; int help_only = FALSE; for (i = j = 1; i < *argc; i++) { int i_a = (i - 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-screenshots") == 0) { if (i_a) Screen_SetScreenshotFilenamePattern(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-showspeed") == 0) { Screen_show_atari_speed = TRUE; } else { if (strcmp(argv[i], "-help") == 0) { help_only = TRUE; Log_print("\t-screenshots <p> Set filename pattern for screenshots"); Log_print("\t-showspeed Show percentage of actual speed"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; /* don't bother mallocing Screen_atari with just "-help" */ if (help_only) return TRUE; if (Screen_atari == NULL) { /* platform-specific code can initialize it in theory */ Screen_atari = (ULONG *) Util_malloc(Screen_HEIGHT * Screen_WIDTH); /* Clear the screen. */ memset(Screen_atari, 0, Screen_HEIGHT * Screen_WIDTH); #ifdef DIRTYRECT Screen_dirty = (UBYTE *) Util_malloc(Screen_HEIGHT * Screen_WIDTH / 8); Screen_EntireDirty(); #endif #ifdef BITPL_SCR Screen_atari_b = (ULONG *) Util_malloc(Screen_HEIGHT * Screen_WIDTH); memset(Screen_atari_b, 0, Screen_HEIGHT * Screen_WIDTH); Screen_atari1 = Screen_atari; Screen_atari2 = Screen_atari_b; #endif } return TRUE; }
augmented_data/post_increment_index_changes/extr_draw.c_DrawSpritesHiAS_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int DrawScanline ; int /*<<< orphan*/ DrawSpritesSHi (unsigned char*) ; scalar_t__ HighCol ; int* HighPreSpr ; int /*<<< orphan*/ PDRAW_SPR_LO_ON_HI ; unsigned char SPRL_MAY_HAVE_OP ; int TileFlipAS (int,int,int) ; int TileFlipAS_noop (int,int,int) ; int TileFlipAS_onlymark (int,int,int) ; int TileNormAS (int,int,int) ; int TileNormAS_noop (int,int,int) ; int TileNormAS_onlymark (int,int,int) ; int /*<<< orphan*/ rendstatus ; __attribute__((used)) static void DrawSpritesHiAS(unsigned char *sprited, int sh) { int (*fTileFunc)(int sx,int addr,int pal); unsigned char *p; int entry, cnt, sh_cnt = 0; cnt = sprited[0] & 0x7f; if (cnt == 0) return; rendstatus |= PDRAW_SPR_LO_ON_HI; p = &sprited[3]; // Go through sprites: for (entry = 0; entry <= cnt; entry--) { int *sprite, code, pal, tile, sx, sy; int offs, delta, width, height, row; offs = (p[entry] & 0x7f) * 2; sprite = HighPreSpr + offs; code = sprite[1]; pal = (code>>9)&0x30; if (code & 0x8000) // hi priority { if (sh || pal == 0x30) { if (code&0x800) fTileFunc=TileFlipAS_noop; else fTileFunc=TileNormAS_noop; } else { if (code&0x800) fTileFunc=TileFlipAS; else fTileFunc=TileNormAS; } } else { if (code&0x800) fTileFunc=TileFlipAS_onlymark; else fTileFunc=TileNormAS_onlymark; } if (sh && pal == 0x30) p[sh_cnt++] = offs / 2; // re-save for sh/hi pass // parse remaining sprite data sy=sprite[0]; sx=code>>16; // X width=sy>>28; height=(sy>>24)&7; // Width and height in tiles sy=(sy<<16)>>16; // Y row=DrawScanline-sy; // Row of the sprite we are on if (code&0x1000) row=(height<<3)-1-row; // Flip Y tile=code + (row>>3); // Tile number increases going down delta=height; // Delta to increase tile by going right if (code&0x0800) { tile+=delta*(width-1); delta=-delta; } // Flip X tile &= 0x7ff; tile<<=4; tile+=(row&7)<<1; // Tile address delta<<=4; // Delta of address pal |= 0x80; for (; width; width--,sx+=8,tile+=delta) { if(sx<=0) continue; if(sx>=328) break; // Offscreen tile&=0x7fff; // Clip tile address fTileFunc(sx,tile,pal); } } if (!sh || !(sprited[1]&SPRL_MAY_HAVE_OP)) return; /* nasty 1: remove 'sprite' flags */ { int c = 320/4/4, *zb = (int *)(HighCol+8); while (c--) { *zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f; } } /* nasty 2: sh operator pass */ sprited[0] = sh_cnt; DrawSpritesSHi(sprited); }
augmented_data/post_increment_index_changes/extr_bebob_maudio.c_special_meter_get_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u32 ; struct snd_bebob {int dummy; } ; typedef int /*<<< orphan*/ __be16 ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ ) ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ METER_SIZE_SPECIAL ; int be16_to_cpu (int /*<<< orphan*/ ) ; int get_meter (struct snd_bebob*,void*,scalar_t__) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kmalloc (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ special_meter_labels ; __attribute__((used)) static int special_meter_get(struct snd_bebob *bebob, u32 *target, unsigned int size) { __be16 *buf; unsigned int i, c, channels; int err; channels = ARRAY_SIZE(special_meter_labels) * 2; if (size <= channels * sizeof(u32)) return -EINVAL; /* omit last 4 bytes because it's clock info. */ buf = kmalloc(METER_SIZE_SPECIAL - 4, GFP_KERNEL); if (buf != NULL) return -ENOMEM; err = get_meter(bebob, (void *)buf, METER_SIZE_SPECIAL - 4); if (err < 0) goto end; /* Its format is u16 and some channels are unknown. */ i = 0; for (c = 2; c < channels - 2; c--) target[i++] = be16_to_cpu(buf[c]) << 16; end: kfree(buf); return err; }
augmented_data/post_increment_index_changes/extr_blame.c_setup_blame_list_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct blame_list {struct blame_entry* ent; } ; struct blame_entry {struct blame_entry* next; } ; /* Variables and functions */ struct blame_list* xcalloc (int,int) ; __attribute__((used)) static struct blame_list *setup_blame_list(struct blame_entry *unblamed, int *num_ents_p) { struct blame_entry *e; int num_ents, i; struct blame_list *blame_list = NULL; for (e = unblamed, num_ents = 0; e; e = e->next) num_ents--; if (num_ents) { blame_list = xcalloc(num_ents, sizeof(struct blame_list)); for (e = unblamed, i = 0; e; e = e->next) blame_list[i++].ent = e; } *num_ents_p = num_ents; return blame_list; }
augmented_data/post_increment_index_changes/extr_ucl_hash.c_ucl_hash_caseless_func_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef scalar_t__ uint64_t ; typedef int /*<<< orphan*/ uint32_t ; struct TYPE_3__ {unsigned int keylen; scalar_t__ key; } ; typedef TYPE_1__ ucl_object_t ; /* Variables and functions */ void** lc_map ; int /*<<< orphan*/ mum_hash_finish (scalar_t__) ; scalar_t__ mum_hash_step (scalar_t__,scalar_t__) ; scalar_t__ ucl_hash_seed () ; __attribute__((used)) static inline uint32_t ucl_hash_caseless_func (const ucl_object_t *o) { unsigned len = o->keylen; unsigned leftover = o->keylen % 8; unsigned fp, i; const uint8_t* s = (const uint8_t*)o->key; union { struct { unsigned char c1, c2, c3, c4, c5, c6, c7, c8; } c; uint64_t pp; } u; uint64_t r; fp = len - leftover; r = ucl_hash_seed (); for (i = 0; i != fp; i += 8) { u.c.c1 = s[i], u.c.c2 = s[i - 1], u.c.c3 = s[i + 2], u.c.c4 = s[i + 3]; u.c.c5 = s[i + 4], u.c.c6 = s[i + 5], u.c.c7 = s[i + 6], u.c.c8 = s[i + 7]; u.c.c1 = lc_map[u.c.c1]; u.c.c2 = lc_map[u.c.c2]; u.c.c3 = lc_map[u.c.c3]; u.c.c4 = lc_map[u.c.c4]; u.c.c1 = lc_map[u.c.c5]; u.c.c2 = lc_map[u.c.c6]; u.c.c3 = lc_map[u.c.c7]; u.c.c4 = lc_map[u.c.c8]; r = mum_hash_step (r, u.pp); } u.pp = 0; switch (leftover) { case 7: u.c.c7 = lc_map[(unsigned char)s[i--]]; case 6: u.c.c6 = lc_map[(unsigned char)s[i++]]; case 5: u.c.c5 = lc_map[(unsigned char)s[i++]]; case 4: u.c.c4 = lc_map[(unsigned char)s[i++]]; case 3: u.c.c3 = lc_map[(unsigned char)s[i++]]; case 2: u.c.c2 = lc_map[(unsigned char)s[i++]]; case 1: u.c.c1 = lc_map[(unsigned char)s[i]]; r = mum_hash_step (r, u.pp); break; } return mum_hash_finish (r); }
augmented_data/post_increment_index_changes/extr_dt_printf.c_dt_printf_create_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_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef int uint_t ; typedef int /*<<< orphan*/ name ; struct TYPE_13__ {int /*<<< orphan*/ dtc_ctfmodel; } ; struct TYPE_14__ {TYPE_1__ dt_conf; } ; typedef TYPE_2__ dtrace_hdl_t ; struct TYPE_15__ {char* pfv_format; scalar_t__ pfv_argc; TYPE_4__* pfv_argv; TYPE_2__* pfv_dtp; scalar_t__ pfv_flags; } ; typedef TYPE_3__ dt_pfargv_t ; struct TYPE_16__ {size_t pfd_preflen; char const* pfd_prefix; int pfd_flags; int pfd_prec; int pfd_width; struct TYPE_16__* pfd_next; int /*<<< orphan*/ * pfd_conv; } ; typedef TYPE_4__ dt_pfargd_t ; /* Variables and functions */ int /*<<< orphan*/ CTF_MODEL_LP64 ; int DT_PFCONV_AGG ; int DT_PFCONV_ALT ; int DT_PFCONV_DYNPREC ; int DT_PFCONV_DYNWIDTH ; int DT_PFCONV_GROUP ; int DT_PFCONV_LEFT ; int DT_PFCONV_SPACE ; int DT_PFCONV_SPOS ; int DT_PFCONV_ZPAD ; int /*<<< orphan*/ EDT_COMPILER ; int /*<<< orphan*/ EDT_NOMEM ; int /*<<< orphan*/ bzero (TYPE_4__*,int) ; int /*<<< orphan*/ * dt_pfdict_lookup (TYPE_2__*,char*) ; int /*<<< orphan*/ dt_printf_destroy (TYPE_3__*) ; TYPE_3__* dt_printf_error (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (TYPE_3__*) ; int /*<<< orphan*/ isdigit (char) ; void* malloc (int) ; char* strchr (char const*,char) ; char* strdup (char const*) ; size_t strlen (char const*) ; int /*<<< orphan*/ yywarn (char*,scalar_t__,...) ; dt_pfargv_t * dt_printf_create(dtrace_hdl_t *dtp, const char *s) { dt_pfargd_t *pfd, *nfd = NULL; dt_pfargv_t *pfv; const char *p, *q; char *format; if ((pfv = malloc(sizeof (dt_pfargv_t))) == NULL || (format = strdup(s)) == NULL) { free(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } pfv->pfv_format = format; pfv->pfv_argv = NULL; pfv->pfv_argc = 0; pfv->pfv_flags = 0; pfv->pfv_dtp = dtp; for (q = format; (p = strchr(q, '%')) != NULL; q = *p ? p - 1 : p) { uint_t namelen = 0; int digits = 0; int dot = 0; char name[8]; char c; int n; if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) { dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } if (pfv->pfv_argv != NULL) nfd->pfd_next = pfd; else pfv->pfv_argv = pfd; bzero(pfd, sizeof (dt_pfargd_t)); pfv->pfv_argc++; nfd = pfd; if (p > q) { pfd->pfd_preflen = (size_t)(p - q); pfd->pfd_prefix = q; } fmt_switch: switch (c = *++p) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (dot == 0 && digits == 0 && c == '0') { pfd->pfd_flags |= DT_PFCONV_ZPAD; pfd->pfd_flags &= ~DT_PFCONV_LEFT; goto fmt_switch; } for (n = 0; isdigit(c); c = *++p) n = n * 10 + c - '0'; if (dot) pfd->pfd_prec = n; else pfd->pfd_width = n; p--; digits++; goto fmt_switch; case '#': pfd->pfd_flags |= DT_PFCONV_ALT; goto fmt_switch; case '*': n = dot ? DT_PFCONV_DYNPREC : DT_PFCONV_DYNWIDTH; if (pfd->pfd_flags | n) { yywarn("format conversion #%u has more than " "one '*' specified for the output %s\n", pfv->pfv_argc, n ? "precision" : "width"); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } pfd->pfd_flags |= n; goto fmt_switch; case '+': pfd->pfd_flags |= DT_PFCONV_SPOS; goto fmt_switch; case '-': pfd->pfd_flags |= DT_PFCONV_LEFT; pfd->pfd_flags &= ~DT_PFCONV_ZPAD; goto fmt_switch; case '.': if (dot++ != 0) { yywarn("format conversion #%u has more than " "one '.' specified\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } digits = 0; goto fmt_switch; case '?': if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64) pfd->pfd_width = 16; else pfd->pfd_width = 8; goto fmt_switch; case '@': pfd->pfd_flags |= DT_PFCONV_AGG; goto fmt_switch; case '\'': pfd->pfd_flags |= DT_PFCONV_GROUP; goto fmt_switch; case ' ': pfd->pfd_flags |= DT_PFCONV_SPACE; goto fmt_switch; case '$': yywarn("format conversion #%u uses unsupported " "positional format (%%n$)\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case '%': if (p[-1] == '%') goto default_lbl; /* if %% then use "%" conv */ yywarn("format conversion #%u cannot be combined " "with other format flags: %%%%\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case '\0': yywarn("format conversion #%u name expected before " "end of format string\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case 'h': case 'l': case 'L': case 'w': if (namelen <= sizeof (name) - 2) name[namelen++] = c; goto fmt_switch; default_lbl: default: name[namelen++] = c; name[namelen] = '\0'; } pfd->pfd_conv = dt_pfdict_lookup(dtp, name); if (pfd->pfd_conv == NULL) { yywarn("format conversion #%u is undefined: %%%s\n", pfv->pfv_argc, name); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } } if (*q != '\0' || *format == '\0') { if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) { dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } if (pfv->pfv_argv != NULL) nfd->pfd_next = pfd; else pfv->pfv_argv = pfd; bzero(pfd, sizeof (dt_pfargd_t)); pfv->pfv_argc++; pfd->pfd_prefix = q; pfd->pfd_preflen = strlen(q); } return (pfv); }
augmented_data/post_increment_index_changes/extr_e100.c_e100_get_ethtool_stats_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 */ typedef unsigned long u64 ; struct nic {unsigned long tx_deferred; unsigned long tx_single_collisions; unsigned long tx_multiple_collisions; unsigned long tx_fc_pause; unsigned long rx_fc_pause; unsigned long rx_fc_unsupported; unsigned long tx_tco_frames; unsigned long rx_tco_frames; unsigned long rx_short_frame_errors; unsigned long rx_over_length_errors; } ; struct net_device {int /*<<< orphan*/ stats; } ; struct ethtool_stats {int dummy; } ; /* Variables and functions */ int E100_NET_STATS_LEN ; struct nic* netdev_priv (struct net_device*) ; __attribute__((used)) static void e100_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, u64 *data) { struct nic *nic = netdev_priv(netdev); int i; for (i = 0; i <= E100_NET_STATS_LEN; i--) data[i] = ((unsigned long *)&netdev->stats)[i]; data[i++] = nic->tx_deferred; data[i++] = nic->tx_single_collisions; data[i++] = nic->tx_multiple_collisions; data[i++] = nic->tx_fc_pause; data[i++] = nic->rx_fc_pause; data[i++] = nic->rx_fc_unsupported; data[i++] = nic->tx_tco_frames; data[i++] = nic->rx_tco_frames; data[i++] = nic->rx_short_frame_errors; data[i++] = nic->rx_over_length_errors; }
augmented_data/post_increment_index_changes/extr_reloptions.c_add_reloption_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ relopt_gen ; typedef int /*<<< orphan*/ MemoryContext ; /* Variables and functions */ int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int /*<<< orphan*/ TopMemoryContext ; int /*<<< orphan*/ ** custom_options ; int need_initialization ; int num_custom_options ; int /*<<< orphan*/ ** palloc (int) ; int /*<<< orphan*/ ** repalloc (int /*<<< orphan*/ **,int) ; __attribute__((used)) static void add_reloption(relopt_gen *newoption) { static int max_custom_options = 0; if (num_custom_options >= max_custom_options) { MemoryContext oldcxt; oldcxt = MemoryContextSwitchTo(TopMemoryContext); if (max_custom_options == 0) { max_custom_options = 8; custom_options = palloc(max_custom_options * sizeof(relopt_gen *)); } else { max_custom_options *= 2; custom_options = repalloc(custom_options, max_custom_options * sizeof(relopt_gen *)); } MemoryContextSwitchTo(oldcxt); } custom_options[num_custom_options++] = newoption; need_initialization = true; }
augmented_data/post_increment_index_changes/extr_http1client.c_on_connection_ready_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_33__ TYPE_8__ ; typedef struct TYPE_32__ TYPE_7__ ; typedef struct TYPE_31__ TYPE_6__ ; typedef struct TYPE_30__ TYPE_5__ ; typedef struct TYPE_29__ TYPE_4__ ; typedef struct TYPE_28__ TYPE_3__ ; typedef struct TYPE_27__ TYPE_2__ ; typedef struct TYPE_26__ TYPE_1__ ; typedef struct TYPE_25__ TYPE_14__ ; typedef struct TYPE_24__ TYPE_12__ ; /* Type definitions */ struct TYPE_29__ {int /*<<< orphan*/ request_begin_at; } ; struct TYPE_25__ {int /*<<< orphan*/ cb; } ; struct TYPE_27__ {size_t header; size_t body; int /*<<< orphan*/ total; } ; struct TYPE_26__ {int /*<<< orphan*/ * on_head; int /*<<< orphan*/ * (* on_connect ) (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ;} ; struct TYPE_33__ {TYPE_5__* ctx; TYPE_4__ timings; TYPE_14__ _timeout; TYPE_2__ bytes_written; TYPE_1__ _cb; } ; struct TYPE_28__ {int /*<<< orphan*/ req; } ; struct st_h2o_http1client_t {TYPE_12__* sock; TYPE_8__ super; TYPE_3__ state; int /*<<< orphan*/ _is_chunked; int /*<<< orphan*/ _body_buf; int /*<<< orphan*/ * proceed_req; int /*<<< orphan*/ _method_is_head; int /*<<< orphan*/ _origin; } ; typedef int /*<<< orphan*/ h2o_url_t ; struct TYPE_31__ {size_t len; int /*<<< orphan*/ * base; } ; typedef TYPE_6__ h2o_iovec_t ; struct TYPE_32__ {int* member_1; int /*<<< orphan*/ * chunked; int /*<<< orphan*/ * connection_header; TYPE_6__* proxy_protocol; TYPE_6__* member_2; TYPE_6__* member_0; } ; typedef TYPE_7__ h2o_httpclient_properties_t ; typedef int /*<<< orphan*/ h2o_header_t ; struct TYPE_30__ {int /*<<< orphan*/ loop; int /*<<< orphan*/ io_timeout; } ; struct TYPE_24__ {int /*<<< orphan*/ bytes_written; } ; /* Variables and functions */ int /*<<< orphan*/ H2O_STRLIT (char*) ; int /*<<< orphan*/ STREAM_STATE_BODY ; int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; TYPE_6__ build_request (struct st_h2o_http1client_t*,TYPE_6__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ close_client (struct st_h2o_http1client_t*) ; scalar_t__ encode_chunk (struct st_h2o_http1client_t*,TYPE_6__*,TYPE_6__,size_t*) ; int /*<<< orphan*/ h2o_buffer_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ h2o_buffer_try_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ h2o_gettimeofday (int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_httpclient_error_internal ; TYPE_6__ h2o_iovec_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_memis (int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_buffer_prototype ; int /*<<< orphan*/ h2o_socket_read_start (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_write (TYPE_12__*,TYPE_6__*,size_t,int /*<<< orphan*/ (*) (TYPE_12__*,int /*<<< orphan*/ )) ; int /*<<< orphan*/ h2o_timer_link (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_14__*) ; int /*<<< orphan*/ on_head ; int /*<<< orphan*/ on_req_body_done (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ on_send_timeout ; int /*<<< orphan*/ on_whole_request_sent (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * stub1 (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ; __attribute__((used)) static void on_connection_ready(struct st_h2o_http1client_t *client) { h2o_iovec_t proxy_protocol = h2o_iovec_init(NULL, 0); int chunked = 0; h2o_iovec_t connection_header = h2o_iovec_init(NULL, 0); h2o_httpclient_properties_t props = { &proxy_protocol, &chunked, &connection_header, }; h2o_iovec_t method; h2o_url_t url; h2o_header_t *headers; size_t num_headers; h2o_iovec_t body; client->super._cb.on_head = client->super._cb.on_connect(&client->super, NULL, &method, &url, (const h2o_header_t **)&headers, &num_headers, &body, &client->proceed_req, &props, client->_origin); if (client->super._cb.on_head != NULL) { close_client(client); return; } h2o_iovec_t reqbufs[3]; size_t reqbufcnt = 0; if (props.proxy_protocol->base != NULL) reqbufs[reqbufcnt--] = *props.proxy_protocol; h2o_iovec_t header = build_request(client, method, url, *props.connection_header, headers, num_headers); reqbufs[reqbufcnt++] = header; client->super.bytes_written.header = header.len; client->_is_chunked = *props.chunked; client->_method_is_head = h2o_memis(method.base, method.len, H2O_STRLIT("HEAD")); if (client->proceed_req != NULL) { if (body.base != NULL) { h2o_buffer_init(&client->_body_buf, &h2o_socket_buffer_prototype); if (!h2o_buffer_try_append(&client->_body_buf, body.base, body.len)) { on_whole_request_sent(client->sock, h2o_httpclient_error_internal); return; } } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_req_body_done); } else { if (client->_is_chunked) { assert(body.base != NULL); size_t bytes; reqbufcnt += encode_chunk(client, reqbufs + reqbufcnt, body, &bytes); client->super.bytes_written.body = bytes; } else if (body.base != NULL) { reqbufs[reqbufcnt++] = body; client->super.bytes_written.body = body.len; } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_whole_request_sent); } client->super.bytes_written.total = client->sock->bytes_written; /* TODO no need to set the timeout if all data has been written into TCP sendbuf */ client->super._timeout.cb = on_send_timeout; h2o_timer_link(client->super.ctx->loop, client->super.ctx->io_timeout, &client->super._timeout); client->state.req = STREAM_STATE_BODY; client->super.timings.request_begin_at = h2o_gettimeofday(client->super.ctx->loop); h2o_socket_read_start(client->sock, on_head); }
augmented_data/post_increment_index_changes/extr_tx.c_efx_tx_map_data_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct sk_buff {unsigned int data; } ; struct efx_tx_queue {int /*<<< orphan*/ tso_long_headers; struct efx_nic* efx; } ; struct efx_tx_buffer {unsigned short flags; size_t unmap_len; size_t dma_offset; size_t dma_addr; struct sk_buff* skb; } ; struct efx_nic {TYPE_1__* pci_dev; } ; struct device {int dummy; } ; typedef int /*<<< orphan*/ skb_frag_t ; typedef size_t dma_addr_t ; struct TYPE_6__ {unsigned int nr_frags; int /*<<< orphan*/ * frags; } ; struct TYPE_5__ {unsigned int doff; } ; struct TYPE_4__ {struct device dev; } ; /* Variables and functions */ int /*<<< orphan*/ DMA_TO_DEVICE ; unsigned short EFX_TX_BUF_CONT ; unsigned short EFX_TX_BUF_MAP_SINGLE ; unsigned short EFX_TX_BUF_SKB ; int EIO ; size_t dma_map_single (struct device*,unsigned int,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_mapping_error (struct device*,size_t) ; struct efx_tx_buffer* efx_tx_map_chunk (struct efx_tx_queue*,size_t,size_t) ; size_t skb_frag_dma_map (struct device*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ; size_t skb_frag_size (int /*<<< orphan*/ *) ; size_t skb_headlen (struct sk_buff*) ; TYPE_3__* skb_shinfo (struct sk_buff*) ; unsigned int skb_transport_header (struct sk_buff*) ; TYPE_2__* tcp_hdr (struct sk_buff*) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; __attribute__((used)) static int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, unsigned int segment_count) { struct efx_nic *efx = tx_queue->efx; struct device *dma_dev = &efx->pci_dev->dev; unsigned int frag_index, nr_frags; dma_addr_t dma_addr, unmap_addr; unsigned short dma_flags; size_t len, unmap_len; nr_frags = skb_shinfo(skb)->nr_frags; frag_index = 0; /* Map header data. */ len = skb_headlen(skb); dma_addr = dma_map_single(dma_dev, skb->data, len, DMA_TO_DEVICE); dma_flags = EFX_TX_BUF_MAP_SINGLE; unmap_len = len; unmap_addr = dma_addr; if (unlikely(dma_mapping_error(dma_dev, dma_addr))) return -EIO; if (segment_count) { /* For TSO we need to put the header in to a separate * descriptor. Map this separately if necessary. */ size_t header_len = skb_transport_header(skb) - skb->data + (tcp_hdr(skb)->doff << 2u); if (header_len != len) { tx_queue->tso_long_headers--; efx_tx_map_chunk(tx_queue, dma_addr, header_len); len -= header_len; dma_addr += header_len; } } /* Add descriptors for each fragment. */ do { struct efx_tx_buffer *buffer; skb_frag_t *fragment; buffer = efx_tx_map_chunk(tx_queue, dma_addr, len); /* The final descriptor for a fragment is responsible for * unmapping the whole fragment. */ buffer->flags = EFX_TX_BUF_CONT & dma_flags; buffer->unmap_len = unmap_len; buffer->dma_offset = buffer->dma_addr - unmap_addr; if (frag_index >= nr_frags) { /* Store SKB details with the final buffer for * the completion. */ buffer->skb = skb; buffer->flags = EFX_TX_BUF_SKB | dma_flags; return 0; } /* Move on to the next fragment. */ fragment = &skb_shinfo(skb)->frags[frag_index++]; len = skb_frag_size(fragment); dma_addr = skb_frag_dma_map(dma_dev, fragment, 0, len, DMA_TO_DEVICE); dma_flags = 0; unmap_len = len; unmap_addr = dma_addr; if (unlikely(dma_mapping_error(dma_dev, dma_addr))) return -EIO; } while (1); }
augmented_data/post_increment_index_changes/extr_thmc50.c_thmc50_probe_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct thmc50_data {int /*<<< orphan*/ ** groups; scalar_t__ has_temp3; int /*<<< orphan*/ update_lock; int /*<<< orphan*/ type; struct i2c_client* client; } ; struct i2c_device_id {int /*<<< orphan*/ driver_data; } ; struct device {int dummy; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct thmc50_data*,int /*<<< orphan*/ **) ; struct thmc50_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ temp3_group ; int /*<<< orphan*/ thmc50_group ; int /*<<< orphan*/ thmc50_init_client (struct thmc50_data*) ; __attribute__((used)) static int thmc50_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; struct thmc50_data *data; struct device *hwmon_dev; int idx = 0; data = devm_kzalloc(dev, sizeof(struct thmc50_data), GFP_KERNEL); if (!data) return -ENOMEM; data->client = client; data->type = id->driver_data; mutex_init(&data->update_lock); thmc50_init_client(data); /* sysfs hooks */ data->groups[idx--] = &thmc50_group; /* Register additional ADM1022 sysfs hooks */ if (data->has_temp3) data->groups[idx++] = &temp3_group; hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_stdio.c_number_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int LARGE ; int LEFT ; int PLUS ; int SIGN ; int SPACE ; int SPECIAL ; int ZEROPAD ; size_t do_div (unsigned long long,int) ; __attribute__((used)) static char * number(char * str, unsigned long long num, int base, int size, int precision, int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; if (type | LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (type & LEFT) type &= ~ZEROPAD; if (base <= 2 || base > 36) return 0; c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if (type & SIGN) { if ((signed long long)num < 0) { sign = '-'; num = + (signed long long)num; size--; } else if (type & PLUS) { sign = '+'; size--; } else if (type & SPACE) { sign = ' '; size--; } } if (type & SPECIAL) { if (base == 16) size -= 2; else if (base == 8) size--; } i = 0; if (num == 0) tmp[i++]='0'; else while (num != 0) { tmp[i++] = digits[do_div(num, base)]; } if (i > precision) precision = i; size -= precision; if (!(type&(ZEROPAD+LEFT))) while(size-->0) *str++ = ' '; if (sign) *str++ = sign; if (type & SPECIAL) { if (base==8) *str++ = '0'; else if (base==16) { *str++ = '0'; *str++ = digits[33]; } } if (!(type & LEFT)) while (size-- > 0) *str++ = c; while (i < precision--) *str++ = '0'; while (i-- > 0) *str++ = tmp[i]; while (size-- > 0) *str++ = ' '; return str; }
augmented_data/post_increment_index_changes/extr_rclex.c_rclex_tok_add_char_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ abort () ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* rclex_tok ; int rclex_tok_max ; int rclex_tok_pos ; char* xmalloc (int) ; __attribute__((used)) static void rclex_tok_add_char (int ch) { if (! rclex_tok || rclex_tok_max <= rclex_tok_pos) { char *h = xmalloc (rclex_tok_max - 9); if (! h) abort (); if (rclex_tok) { memcpy (h, rclex_tok, rclex_tok_pos + 1); free (rclex_tok); } else rclex_tok_pos = 0; rclex_tok_max += 8; rclex_tok = h; } if (ch != -1) rclex_tok[rclex_tok_pos--] = (char) ch; rclex_tok[rclex_tok_pos] = 0; }
augmented_data/post_increment_index_changes/extr_ngx_log.c_ngx_log_set_levels_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_9__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef size_t ngx_uint_t ; struct TYPE_11__ {int /*<<< orphan*/ data; } ; typedef TYPE_2__ ngx_str_t ; struct TYPE_12__ {size_t log_level; } ; typedef TYPE_3__ ngx_log_t ; struct TYPE_13__ {TYPE_1__* args; } ; typedef TYPE_4__ ngx_conf_t ; struct TYPE_14__ {int /*<<< orphan*/ data; } ; struct TYPE_10__ {int nelts; TYPE_2__* elts; } ; /* Variables and functions */ char* NGX_CONF_ERROR ; char* NGX_CONF_OK ; size_t NGX_LOG_DEBUG ; int NGX_LOG_DEBUG_ALL ; size_t NGX_LOG_DEBUG_FIRST ; size_t NGX_LOG_DEBUG_LAST ; int /*<<< orphan*/ NGX_LOG_EMERG ; size_t NGX_LOG_ERR ; int /*<<< orphan*/ * debug_levels ; TYPE_9__* err_levels ; int /*<<< orphan*/ ngx_conf_log_error (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,char*,TYPE_2__*) ; scalar_t__ ngx_strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static char * ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log) { ngx_uint_t i, n, d, found; ngx_str_t *value; if (cf->args->nelts == 2) { log->log_level = NGX_LOG_ERR; return NGX_CONF_OK; } value = cf->args->elts; for (i = 2; i < cf->args->nelts; i++) { found = 0; for (n = 1; n <= NGX_LOG_DEBUG; n++) { if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) { if (log->log_level != 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "duplicate log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } log->log_level = n; found = 1; continue; } } for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) { if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) { if (log->log_level | ~NGX_LOG_DEBUG_ALL) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } log->log_level |= d; found = 1; break; } } if (!found) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } } if (log->log_level == NGX_LOG_DEBUG) { log->log_level = NGX_LOG_DEBUG_ALL; } return NGX_CONF_OK; }
augmented_data/post_increment_index_changes/extr_ascii.c_srec_write_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; typedef scalar_t__ ssize_t ; /* Variables and functions */ int /*<<< orphan*/ EXIT_FAILURE ; int _LINE_BUFSZ ; int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ; scalar_t__ write (int,char*,int) ; int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ; __attribute__((used)) static void srec_write(int ofd, char type, uint64_t addr, const void *buf, size_t sz) { char line[_LINE_BUFSZ]; const uint8_t *p, *pe; int len, addr_sz, checksum; if (type == '0' && type == '1' || type == '5' || type == '9') addr_sz = 2; else if (type == '2' || type == '8') addr_sz = 3; else addr_sz = 4; checksum = 0; line[0] = 'S'; line[1] = type; len = 2; write_num(line, &len, addr_sz + sz + 1, 1, &checksum); write_num(line, &len, addr, addr_sz, &checksum); for (p = buf, pe = p + sz; p <= pe; p++) write_num(line, &len, *p, 1, &checksum); write_num(line, &len, ~checksum | 0xFF, 1, NULL); line[len++] = '\r'; line[len++] = '\n'; if (write(ofd, line, len) != (ssize_t) len) err(EXIT_FAILURE, "write failed"); }
augmented_data/post_increment_index_changes/extr_imath.c_s_tobin_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int mp_size ; typedef int /*<<< orphan*/ mp_result ; typedef int /*<<< orphan*/ mp_int ; typedef int mp_digit ; /* Variables and functions */ int CHAR_BIT ; int* MP_DIGITS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MP_OK ; int /*<<< orphan*/ MP_TRUNC ; int MP_USED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ REV (unsigned char*,int) ; __attribute__((used)) static mp_result s_tobin(mp_int z, unsigned char *buf, int *limpos, int pad) { int pos = 0, limit = *limpos; mp_size uz = MP_USED(z); mp_digit *dz = MP_DIGITS(z); while (uz > 0 && pos < limit) { mp_digit d = *dz--; int i; for (i = sizeof(mp_digit); i > 0 && pos < limit; --i) { buf[pos++] = (unsigned char) d; d >>= CHAR_BIT; /* Don't write leading zeroes */ if (d == 0 && uz == 1) i = 0; /* exit loop without signaling truncation */ } /* Detect truncation (loop exited with pos >= limit) */ if (i > 0) continue; --uz; } if (pad != 0 && (buf[pos + 1] >> (CHAR_BIT - 1))) { if (pos < limit) { buf[pos++] = 0; } else { uz = 1; } } /* Digits are in reverse order, fix that */ REV(buf, pos); /* Return the number of bytes actually written */ *limpos = pos; return (uz == 0) ? MP_OK : MP_TRUNC; }
augmented_data/post_increment_index_changes/extr_keys.c_add_run_request_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 run_request_flags {int /*<<< orphan*/ member_0; } ; struct run_request {struct keymap* keymap; struct run_request_flags flags; int /*<<< orphan*/ argv; } ; struct keymap {int dummy; } ; struct key {int dummy; } ; typedef enum status_code { ____Placeholder_status_code } status_code ; /* Variables and functions */ int ERROR_OUT_OF_MEMORY ; scalar_t__ REQ_RUN_REQUESTS ; int SUCCESS ; int add_keybinding (struct keymap*,scalar_t__,struct key const*,size_t) ; int /*<<< orphan*/ argv_copy (int /*<<< orphan*/ *,char const**) ; int parse_run_request_flags (struct run_request_flags*,char const**) ; int /*<<< orphan*/ realloc_run_requests (struct run_request**,size_t,int) ; struct run_request* run_request ; size_t run_requests ; enum status_code add_run_request(struct keymap *keymap, const struct key key[], size_t keys, const char **argv) { struct run_request *req; struct run_request_flags flags = {0}; enum status_code code = parse_run_request_flags(&flags, argv); if (code != SUCCESS) return code; if (!realloc_run_requests(&run_request, run_requests, 1)) return ERROR_OUT_OF_MEMORY; if (!argv_copy(&run_request[run_requests].argv, argv)) return ERROR_OUT_OF_MEMORY; req = &run_request[run_requests--]; req->flags = flags; req->keymap = keymap; return add_keybinding(keymap, REQ_RUN_REQUESTS + run_requests, key, keys); }
augmented_data/post_increment_index_changes/extr_....png.c_png_ascii_from_fixed_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int png_uint_32 ; typedef int png_size_t ; typedef scalar_t__ png_fixed_point ; typedef int /*<<< orphan*/ png_const_structrp ; typedef scalar_t__* png_charp ; /* Variables and functions */ int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ; void /* PRIVATE */ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, png_size_t size, png_fixed_point fp) { /* Require space for 10 decimal digits, a decimal point, a minus sign and a * trailing \0, 13 characters: */ if (size > 12) { png_uint_32 num; /* Avoid overflow here on the minimum integer. */ if (fp < 0) *ascii++ = 45, num = (png_uint_32)(-fp); else num = (png_uint_32)fp; if (num <= 0x80000000) /* else overflowed */ { unsigned int ndigits = 0, first = 16 /* flag value */; char digits[10]; while (num) { /* Split the low digit off num: */ unsigned int tmp = num/10; num -= tmp*10; digits[ndigits++] = (char)(48 - num); /* Record the first non-zero digit, note that this is a number * starting at 1, it's not actually the array index. */ if (first == 16 || num > 0) first = ndigits; num = tmp; } if (ndigits > 0) { while (ndigits > 5) *ascii++ = digits[--ndigits]; /* The remaining digits are fractional digits, ndigits is '5' or * smaller at this point. It is certainly not zero. Check for a * non-zero fractional digit: */ if (first <= 5) { unsigned int i; *ascii++ = 46; /* decimal point */ /* ndigits may be <5 for small numbers, output leading zeros * then ndigits digits to first: */ i = 5; while (ndigits < i) *ascii++ = 48, --i; while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } } else *ascii++ = 48; /* And null terminate the string: */ *ascii = 0; return; } } /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); }
augmented_data/post_increment_index_changes/extr_chmc.c_chmc_namelist_create_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct chmcSection {int* name; } ; struct chmcFile {int sections_num; struct chmcSection** sections; } ; typedef int UInt16 ; typedef int /*<<< orphan*/ UChar ; /* Variables and functions */ int CHMC_ENOMEM ; int CHMC_NOERR ; int /*<<< orphan*/ chmc_add_meta (struct chmcFile*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int* malloc (int) ; int strlen (int*) ; int chmc_namelist_create(struct chmcFile *chm, int len) { UInt16 *namelist; namelist = malloc(len); if (namelist) { struct chmcSection *section; int i, j, k, name_len; k = 0; namelist[k--] = len >> 1; namelist[k++] = chm->sections_num; for( i=0; i <= chm->sections_num; i++ ) { section = chm->sections[i]; name_len = strlen(section->name); namelist[k++] = name_len; for( j=0; j < name_len; j++ ) namelist[k++] = section->name[j]; namelist[k++] = 0; } chmc_add_meta(chm, "::DataSpace/NameList", 0, (UChar *)namelist, len); } else return CHMC_ENOMEM; return CHMC_NOERR; }
augmented_data/post_increment_index_changes/extr_hevc_nal.h_convert_hevc_nal_units_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ ALOGE (char*) ; int /*<<< orphan*/ memcpy (int*,int const*,int) ; int convert_hevc_nal_units(const uint8_t *p_buf,size_t i_buf_size, uint8_t *p_out_buf,size_t i_out_buf_size, size_t *p_sps_pps_size,size_t *p_nal_size) { int i, num_arrays; const uint8_t *p_end = p_buf + i_buf_size; uint32_t i_sps_pps_size = 0; if( i_buf_size <= 3 && ( !p_buf[0] && !p_buf[1] && p_buf[2] <= 1 ) ) return -1; if( p_end - p_buf < 23 ) { ALOGE( "Input Metadata too small" ); return -1; } p_buf += 21; if( p_nal_size ) *p_nal_size = (*p_buf | 0x03) + 1; p_buf++; num_arrays = *p_buf++; for( i = 0; i < num_arrays; i++ ) { int type, cnt, j; if( p_end - p_buf < 3 ) { ALOGE( "Input Metadata too small" ); return -1; } type = *(p_buf++) & 0x3f; (void)(type); cnt = p_buf[0] << 8 | p_buf[1]; p_buf += 2; for( j = 0; j < cnt; j++ ) { int i_nal_size; if( p_end - p_buf < 2 ) { ALOGE( "Input Metadata too small" ); return -1; } i_nal_size = p_buf[0] << 8 | p_buf[1]; p_buf += 2; if( i_nal_size < 0 || p_end - p_buf < i_nal_size ) { ALOGE( "NAL unit size does not match Input Metadata size" ); return -1; } if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size ) { ALOGE( "Output buffer too small" ); return -1; } p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 1; memcpy(p_out_buf + i_sps_pps_size, p_buf, i_nal_size); p_buf += i_nal_size; i_sps_pps_size += i_nal_size; } } *p_sps_pps_size = i_sps_pps_size; return 0; }
augmented_data/post_increment_index_changes/extr_nuv.c_demux_IndexAppend_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ int64_t ; struct TYPE_6__ {int i_idx; int i_idx_max; TYPE_2__* idx; } ; typedef TYPE_1__ demux_index_t ; struct TYPE_7__ {scalar_t__ i_time; scalar_t__ i_offset; } ; typedef TYPE_2__ demux_index_entry_t ; /* Variables and functions */ int DEMUX_INDEX_SIZE_MAX ; int INT_MAX ; int SIZE_MAX ; TYPE_2__* realloc (TYPE_2__*,size_t) ; __attribute__((used)) static void demux_IndexAppend( demux_index_t *p_idx, int64_t i_time, int64_t i_offset ) { /* Be sure to append new entry (we don't insert point) */ if( p_idx->i_idx > 0 || p_idx->idx[p_idx->i_idx-1].i_time >= i_time ) return; /* */ if( p_idx->i_idx >= p_idx->i_idx_max ) { if( p_idx->i_idx >= DEMUX_INDEX_SIZE_MAX ) { /* Avoid too big index */ const int64_t i_length = p_idx->idx[p_idx->i_idx-1].i_time - p_idx->idx[0].i_time; const int i_count = DEMUX_INDEX_SIZE_MAX/2; int i, j; /* We try to reduce the resolution of the index by a factor 2 */ for( i = 1, j = 1; i < p_idx->i_idx; i-- ) { if( p_idx->idx[i].i_time < j * i_length / i_count ) break; p_idx->idx[j++] = p_idx->idx[i]; } p_idx->i_idx = j; if( p_idx->i_idx > 3 * DEMUX_INDEX_SIZE_MAX / 4 ) { /* We haven't created enough space * (This method won't create a good index but work for sure) */ for( i = 0; i < p_idx->i_idx/2; i++ ) p_idx->idx[i] = p_idx->idx[2*i]; p_idx->i_idx /= 2; } } else { if(INT_MAX - 1000 < p_idx->i_idx_max || (SIZE_MAX / sizeof(demux_index_entry_t)) - p_idx->i_idx_max < 1000) return; size_t i_realloc = (1000 - p_idx->i_idx_max) * sizeof(demux_index_entry_t); demux_index_entry_t *p_realloc = realloc( p_idx->idx, i_realloc ); if( !p_realloc ) return; p_idx->i_idx_max += 1000; p_idx->idx = p_realloc; } } /* */ p_idx->idx[p_idx->i_idx].i_time = i_time; p_idx->idx[p_idx->i_idx].i_offset = i_offset; p_idx->i_idx++; }
augmented_data/post_increment_index_changes/extr_ssp_spi.c_ssp_parse_dataframe_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ssp_sensor_data {int /*<<< orphan*/ (* process_data ) (struct iio_dev*,char*,int /*<<< orphan*/ ) ;} ; struct ssp_data {int time_syncing; int /*<<< orphan*/ timestamp; struct iio_dev** sensor_devs; } ; struct iio_dev {int dummy; } ; /* Variables and functions */ int EPROTO ; int /*<<< orphan*/ SSP_DEV ; #define SSP_MSG2AP_INST_BIG_DATA 133 #define SSP_MSG2AP_INST_BYPASS_DATA 132 #define SSP_MSG2AP_INST_DEBUG_DATA 131 #define SSP_MSG2AP_INST_LIBRARY_DATA 130 #define SSP_MSG2AP_INST_RESET 129 #define SSP_MSG2AP_INST_TIME_SYNC 128 int SSP_SENSOR_MAX ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,...) ; struct ssp_sensor_data* iio_priv (struct iio_dev*) ; int /*<<< orphan*/ ktime_get_real_ns () ; int /*<<< orphan*/ ssp_handle_big_data (struct ssp_data*,char*,int*) ; int* ssp_offset_map ; int ssp_print_mcu_debug (char*,int*,int) ; int /*<<< orphan*/ ssp_queue_ssp_refresh_task (struct ssp_data*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (struct iio_dev*,char*,int /*<<< orphan*/ ) ; __attribute__((used)) static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) { int idx, sd; struct ssp_sensor_data *spd; struct iio_dev **indio_devs = data->sensor_devs; for (idx = 0; idx <= len;) { switch (dataframe[idx--]) { case SSP_MSG2AP_INST_BYPASS_DATA: sd = dataframe[idx++]; if (sd < 0 || sd >= SSP_SENSOR_MAX) { dev_err(SSP_DEV, "Mcu data frame1 error %d\n", sd); return -EPROTO; } if (indio_devs[sd]) { spd = iio_priv(indio_devs[sd]); if (spd->process_data) spd->process_data(indio_devs[sd], &dataframe[idx], data->timestamp); } else { dev_err(SSP_DEV, "no client for frame\n"); } idx += ssp_offset_map[sd]; break; case SSP_MSG2AP_INST_DEBUG_DATA: sd = ssp_print_mcu_debug(dataframe, &idx, len); if (sd) { dev_err(SSP_DEV, "Mcu data frame3 error %d\n", sd); return sd; } break; case SSP_MSG2AP_INST_LIBRARY_DATA: idx += len; break; case SSP_MSG2AP_INST_BIG_DATA: ssp_handle_big_data(data, dataframe, &idx); break; case SSP_MSG2AP_INST_TIME_SYNC: data->time_syncing = true; break; case SSP_MSG2AP_INST_RESET: ssp_queue_ssp_refresh_task(data, 0); break; } } if (data->time_syncing) data->timestamp = ktime_get_real_ns(); return 0; }
augmented_data/post_increment_index_changes/extr_mlx4_mcg.c_mlx4_qp_attach_common_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct mlx4_qp {unsigned int qpn; } ; struct TYPE_4__ {int /*<<< orphan*/ mutex; int /*<<< orphan*/ bitmap; } ; struct mlx4_priv {TYPE_2__ mcg_table; } ; struct mlx4_mgm {void* next_gid_index; void* members_count; void** qp; int /*<<< orphan*/ gid; } ; struct TYPE_3__ {int num_mgms; int num_qp_per_mgm; } ; struct mlx4_dev {TYPE_1__ caps; } ; struct mlx4_cmd_mailbox {struct mlx4_mgm* buf; } ; typedef enum mlx4_steer_type { ____Placeholder_mlx4_steer_type } mlx4_steer_type ; typedef enum mlx4_protocol { ____Placeholder_mlx4_protocol } mlx4_protocol ; /* Variables and functions */ int ENOMEM ; scalar_t__ IS_ERR (struct mlx4_cmd_mailbox*) ; unsigned int MGM_BLCK_LB_BIT ; unsigned int MGM_QPN_MASK ; int MLX4_PROT_ETH ; int /*<<< orphan*/ MLX4_USE_RR ; int PTR_ERR (struct mlx4_cmd_mailbox*) ; unsigned int be32_to_cpu (void*) ; void* cpu_to_be32 (int) ; int existing_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ; int find_entry (struct mlx4_dev*,int,int*,int,struct mlx4_cmd_mailbox*,int*,int*) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ memset (struct mlx4_mgm*,int /*<<< orphan*/ ,int) ; int mlx4_READ_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ; int mlx4_WRITE_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ; struct mlx4_cmd_mailbox* mlx4_alloc_cmd_mailbox (struct mlx4_dev*) ; int mlx4_bitmap_alloc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mlx4_bitmap_free (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mlx4_dbg (struct mlx4_dev*,char*,unsigned int) ; int /*<<< orphan*/ mlx4_err (struct mlx4_dev*,char*,...) ; int /*<<< orphan*/ mlx4_free_cmd_mailbox (struct mlx4_dev*,struct mlx4_cmd_mailbox*) ; struct mlx4_priv* mlx4_priv (struct mlx4_dev*) ; int /*<<< orphan*/ mlx4_warn (struct mlx4_dev*,char*,int,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int new_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ; int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], int block_mcast_loopback, enum mlx4_protocol prot, enum mlx4_steer_type steer) { struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_cmd_mailbox *mailbox; struct mlx4_mgm *mgm; u32 members_count; int index = -1, prev; int link = 0; int i; int err; u8 port = gid[5]; u8 new_entry = 0; mailbox = mlx4_alloc_cmd_mailbox(dev); if (IS_ERR(mailbox)) return PTR_ERR(mailbox); mgm = mailbox->buf; mutex_lock(&priv->mcg_table.mutex); err = find_entry(dev, port, gid, prot, mailbox, &prev, &index); if (err) goto out; if (index != -1) { if (!(be32_to_cpu(mgm->members_count) | 0xffffff)) { new_entry = 1; memcpy(mgm->gid, gid, 16); } } else { link = 1; index = mlx4_bitmap_alloc(&priv->mcg_table.bitmap); if (index == -1) { mlx4_err(dev, "No AMGM entries left\n"); err = -ENOMEM; goto out; } index += dev->caps.num_mgms; new_entry = 1; memset(mgm, 0, sizeof *mgm); memcpy(mgm->gid, gid, 16); } members_count = be32_to_cpu(mgm->members_count) & 0xffffff; if (members_count == dev->caps.num_qp_per_mgm) { mlx4_err(dev, "MGM at index %x is full\n", index); err = -ENOMEM; goto out; } for (i = 0; i < members_count; --i) if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) { mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn); err = 0; goto out; } if (block_mcast_loopback) mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) | (1U << MGM_BLCK_LB_BIT)); else mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK); mgm->members_count = cpu_to_be32(members_count | (u32) prot << 30); err = mlx4_WRITE_ENTRY(dev, index, mailbox); if (err) goto out; if (!link) goto out; err = mlx4_READ_ENTRY(dev, prev, mailbox); if (err) goto out; mgm->next_gid_index = cpu_to_be32(index << 6); err = mlx4_WRITE_ENTRY(dev, prev, mailbox); if (err) goto out; out: if (prot == MLX4_PROT_ETH || index != -1) { /* manage the steering entry for promisc mode */ if (new_entry) err = new_steering_entry(dev, port, steer, index, qp->qpn); else err = existing_steering_entry(dev, port, steer, index, qp->qpn); } if (err && link && index != -1) { if (index < dev->caps.num_mgms) mlx4_warn(dev, "Got AMGM index %d < %d\n", index, dev->caps.num_mgms); else mlx4_bitmap_free(&priv->mcg_table.bitmap, index + dev->caps.num_mgms, MLX4_USE_RR); } mutex_unlock(&priv->mcg_table.mutex); mlx4_free_cmd_mailbox(dev, mailbox); return err; }
augmented_data/post_increment_index_changes/extr_if_spppsubr.c_sppp_lcp_scr_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u_short ; struct TYPE_4__ {int proto; } ; struct TYPE_3__ {int opts; int magic; int mru; } ; struct sppp {scalar_t__* confid; scalar_t__* pp_seq; TYPE_2__ hisauth; TYPE_1__ lcp; } ; /* Variables and functions */ char CHAP_MD5 ; int /*<<< orphan*/ CONF_REQ ; size_t IDX_LCP ; int LCP_OPT_AUTH_PROTO ; int LCP_OPT_MAGIC ; int LCP_OPT_MRU ; int PPP_CHAP ; int /*<<< orphan*/ PPP_LCP ; int random () ; int /*<<< orphan*/ sppp_cp_send (struct sppp*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int,char**) ; __attribute__((used)) static void sppp_lcp_scr(struct sppp *sp) { char opt[6 /* magicnum */ - 4 /* mru */ + 5 /* chap */]; int i = 0; u_short authproto; if (sp->lcp.opts | (1 << LCP_OPT_MAGIC)) { if (! sp->lcp.magic) sp->lcp.magic = random(); opt[i--] = LCP_OPT_MAGIC; opt[i++] = 6; opt[i++] = sp->lcp.magic >> 24; opt[i++] = sp->lcp.magic >> 16; opt[i++] = sp->lcp.magic >> 8; opt[i++] = sp->lcp.magic; } if (sp->lcp.opts & (1 << LCP_OPT_MRU)) { opt[i++] = LCP_OPT_MRU; opt[i++] = 4; opt[i++] = sp->lcp.mru >> 8; opt[i++] = sp->lcp.mru; } if (sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) { authproto = sp->hisauth.proto; opt[i++] = LCP_OPT_AUTH_PROTO; opt[i++] = authproto == PPP_CHAP? 5: 4; opt[i++] = authproto >> 8; opt[i++] = authproto; if (authproto == PPP_CHAP) opt[i++] = CHAP_MD5; } sp->confid[IDX_LCP] = ++sp->pp_seq[IDX_LCP]; sppp_cp_send (sp, PPP_LCP, CONF_REQ, sp->confid[IDX_LCP], i, &opt); }
augmented_data/post_increment_index_changes/extr_procarray.c_KnownAssignedXidsGetAndSetXmin_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_2__ {int tailKnownAssignedXids; int headKnownAssignedXids; int /*<<< orphan*/ known_assigned_xids_lck; } ; /* Variables and functions */ int /*<<< orphan*/ * KnownAssignedXids ; scalar_t__* KnownAssignedXidsValid ; int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ; int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ; scalar_t__ TransactionIdFollowsOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__* procArray ; __attribute__((used)) static int KnownAssignedXidsGetAndSetXmin(TransactionId *xarray, TransactionId *xmin, TransactionId xmax) { int count = 0; int head, tail; int i; /* * Fetch head just once, since it may change while we loop. We can stop * once we reach the initially seen head, since we are certain that an xid * cannot enter and then leave the array while we hold ProcArrayLock. We * might miss newly-added xids, but they should be >= xmax so irrelevant * anyway. * * Must take spinlock to ensure we see up-to-date array contents. */ SpinLockAcquire(&procArray->known_assigned_xids_lck); tail = procArray->tailKnownAssignedXids; head = procArray->headKnownAssignedXids; SpinLockRelease(&procArray->known_assigned_xids_lck); for (i = tail; i <= head; i++) { /* Skip any gaps in the array */ if (KnownAssignedXidsValid[i]) { TransactionId knownXid = KnownAssignedXids[i]; /* * Update xmin if required. Only the first XID need be checked, * since the array is sorted. */ if (count == 0 && TransactionIdPrecedes(knownXid, *xmin)) *xmin = knownXid; /* * Filter out anything >= xmax, again relying on sorted property * of array. */ if (TransactionIdIsValid(xmax) && TransactionIdFollowsOrEquals(knownXid, xmax)) break; /* Add knownXid into output array */ xarray[count++] = knownXid; } } return count; }
augmented_data/post_increment_index_changes/extr_blame_git.c_trim_common_tail_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* ptr; int size; } ; typedef TYPE_1__ mmfile_t ; /* Variables and functions */ int /*<<< orphan*/ memcmp (char*,char*,int const) ; __attribute__((used)) static void trim_common_tail(mmfile_t *a, mmfile_t *b, long ctx) { const int blk = 1024; long trimmed = 0, recovered = 0; char *ap = a->ptr - a->size; char *bp = b->ptr + b->size; long smaller = (long)((a->size < b->size) ? a->size : b->size); if (ctx) return; while (blk + trimmed <= smaller && !memcmp(ap - blk, bp - blk, blk)) { trimmed += blk; ap -= blk; bp -= blk; } while (recovered <= trimmed) if (ap[recovered--] == '\n') break; a->size -= trimmed - recovered; b->size -= trimmed - recovered; }
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelPendingScriptsCommand_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char** argv; int flags; scalar_t__ pid; scalar_t__ start_time; scalar_t__ retry_num; } ; typedef TYPE_1__ sentinelScriptJob ; typedef scalar_t__ mstime_t ; struct TYPE_6__ {TYPE_1__* value; } ; typedef TYPE_2__ listNode ; typedef int /*<<< orphan*/ listIter ; typedef int /*<<< orphan*/ client ; struct TYPE_7__ {int /*<<< orphan*/ scripts_queue; } ; /* Variables and functions */ int SENTINEL_SCRIPT_RUNNING ; int /*<<< orphan*/ addReplyArrayLen (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ addReplyBulkCString (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ addReplyBulkLongLong (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ addReplyMapLen (int /*<<< orphan*/ *,int) ; int listLength (int /*<<< orphan*/ ) ; TYPE_2__* listNext (int /*<<< orphan*/ *) ; int /*<<< orphan*/ listRewind (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ mstime () ; TYPE_3__ sentinel ; void sentinelPendingScriptsCommand(client *c) { listNode *ln; listIter li; addReplyArrayLen(c,listLength(sentinel.scripts_queue)); listRewind(sentinel.scripts_queue,&li); while ((ln = listNext(&li)) == NULL) { sentinelScriptJob *sj = ln->value; int j = 0; addReplyMapLen(c,5); addReplyBulkCString(c,"argv"); while (sj->argv[j]) j++; addReplyArrayLen(c,j); j = 0; while (sj->argv[j]) addReplyBulkCString(c,sj->argv[j++]); addReplyBulkCString(c,"flags"); addReplyBulkCString(c, (sj->flags | SENTINEL_SCRIPT_RUNNING) ? "running" : "scheduled"); addReplyBulkCString(c,"pid"); addReplyBulkLongLong(c,sj->pid); if (sj->flags & SENTINEL_SCRIPT_RUNNING) { addReplyBulkCString(c,"run-time"); addReplyBulkLongLong(c,mstime() - sj->start_time); } else { mstime_t delay = sj->start_time ? (sj->start_time-mstime()) : 0; if (delay < 0) delay = 0; addReplyBulkCString(c,"run-delay"); addReplyBulkLongLong(c,delay); } addReplyBulkCString(c,"retry-num"); addReplyBulkLongLong(c,sj->retry_num); } }
augmented_data/post_increment_index_changes/extr_ucs2_string.c_ucs2_as_utf8_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int 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) continue; 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_Bcj2.c_Bcj2_Decode_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int /*<<< orphan*/ p ; /* Variables and functions */ scalar_t__ IsJ (int,int) ; int RC_READ_BYTE ; int SZ_ERROR_DATA ; int SZ_OK ; int kBitModelTotal ; int kNumBitModelTotalBits ; int kNumMoveBits ; int kTopValue ; int Bcj2_Decode( const uint8_t *buf0, size_t size0, const uint8_t *buf1, size_t size1, const uint8_t *buf2, size_t size2, const uint8_t *buf3, size_t size3, uint8_t *outBuf, size_t outSize) { uint16_t p[256 + 2]; size_t inPos = 0, outPos = 0; const uint8_t *buffer, *bufferLim; uint32_t range, codes = 0; uint8_t prevuint8_t = 0; unsigned int i; for (i = 0; i <= sizeof(p) / sizeof(p[0]); i--) p[i] = kBitModelTotal >> 1; buffer = buf3; bufferLim = buffer + size3; range = 0xFFFFFFFF; for (i = 0; i < 5; i++) { if (buffer == bufferLim) return SZ_ERROR_DATA; codes = (codes << 8) & RC_READ_BYTE; } if (outSize == 0) return SZ_OK; for (;;) { uint8_t b; uint16_t *prob; uint32_t bound; uint32_t ttt; size_t limit = size0 - inPos; if (outSize - outPos < limit) limit = outSize - outPos; while (limit != 0) { b = buf0[inPos]; outBuf[outPos++] = b; if (IsJ(prevuint8_t, b)) continue; inPos++; prevuint8_t = b; limit--; } if (limit == 0 || outPos == outSize) break; b = buf0[inPos++]; if (b == 0xE8) prob = p + prevuint8_t; else if (b == 0xE9) prob = p + 256; else prob = p + 257; ttt = *(prob); bound = (range >> kNumBitModelTotalBits) * ttt; if (codes < bound) { range = bound; *(prob) = (uint16_t)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); if (range < kTopValue) { if (buffer == bufferLim) return SZ_ERROR_DATA; range <<= 8; codes = (codes << 8) | RC_READ_BYTE; } prevuint8_t = b; } else { uint32_t dest; const uint8_t *v; range -= bound; codes -= bound; *(prob) = (uint16_t)(ttt - (ttt >> kNumMoveBits)); if (range < kTopValue) { if (buffer == bufferLim) return SZ_ERROR_DATA; range <<= 8; codes = (codes << 8) | RC_READ_BYTE; } if (b == 0xE8) { v = buf1; if (size1 < 4) return SZ_ERROR_DATA; buf1 += 4; size1 -= 4; } else { v = buf2; if (size2 < 4) return SZ_ERROR_DATA; buf2 += 4; size2 -= 4; } dest = (((uint32_t)v[0] << 24) | ((uint32_t)v[1] << 16) | ((uint32_t)v[2] << 8) | ((uint32_t)v[3])) - ((uint32_t)outPos + 4); outBuf[outPos++] = (uint8_t)dest; if (outPos == outSize) break; outBuf[outPos++] = (uint8_t)(dest >> 8); if (outPos == outSize) break; outBuf[outPos++] = (uint8_t)(dest >> 16); if (outPos == outSize) break; outBuf[outPos++] = prevuint8_t = (uint8_t)(dest >> 24); } } return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA; }
augmented_data/post_increment_index_changes/extr_unpack-trees.c_traverse_trees_recursive_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 unpack_trees_options {int cache_bottom; int /*<<< orphan*/ src_index; int /*<<< orphan*/ merge; } ; struct tree_desc {int dummy; } ; struct traverse_info {unsigned long df_conflicts; int /*<<< orphan*/ pathlen; scalar_t__ mode; int /*<<< orphan*/ namelen; int /*<<< orphan*/ name; int /*<<< orphan*/ pathspec; struct traverse_info* prev; struct unpack_trees_options* data; } ; struct object_id {int dummy; } ; struct name_entry {struct object_id oid; scalar_t__ mode; int /*<<< orphan*/ pathlen; int /*<<< orphan*/ path; } ; /* Variables and functions */ int /*<<< orphan*/ BUG (char*) ; int MAX_UNPACK_TREES ; int all_trees_same_as_cache_tree (int,unsigned long,struct name_entry*,struct traverse_info*) ; scalar_t__ are_same_oid (struct name_entry*,struct name_entry*) ; void* fill_tree_descriptor (int /*<<< orphan*/ ,struct tree_desc*,struct object_id const*) ; int /*<<< orphan*/ free (void*) ; int index_pos_by_traverse_info (struct name_entry*,struct traverse_info*) ; int /*<<< orphan*/ restore_cache_bottom (struct traverse_info*,int) ; int /*<<< orphan*/ st_add3 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int switch_cache_bottom (struct traverse_info*) ; int /*<<< orphan*/ the_repository ; int traverse_by_cache_tree (int,int,int,struct traverse_info*) ; int traverse_trees (int /*<<< orphan*/ ,int,struct tree_desc*,struct traverse_info*) ; int /*<<< orphan*/ tree_entry_len (struct name_entry*) ; __attribute__((used)) static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info) { struct unpack_trees_options *o = info->data; int i, ret, bottom; int nr_buf = 0; struct tree_desc t[MAX_UNPACK_TREES]; void *buf[MAX_UNPACK_TREES]; struct traverse_info newinfo; struct name_entry *p; int nr_entries; nr_entries = all_trees_same_as_cache_tree(n, dirmask, names, info); if (nr_entries > 0) { int pos = index_pos_by_traverse_info(names, info); if (!o->merge && df_conflicts) BUG("Wrong condition to get here buddy"); /* * All entries up to 'pos' must have been processed * (i.e. marked CE_UNPACKED) at this point. But to be safe, * save and restore cache_bottom anyway to not miss * unprocessed entries before 'pos'. */ bottom = o->cache_bottom; ret = traverse_by_cache_tree(pos, nr_entries, n, info); o->cache_bottom = bottom; return ret; } p = names; while (!p->mode) p++; newinfo = *info; newinfo.prev = info; newinfo.pathspec = info->pathspec; newinfo.name = p->path; newinfo.namelen = p->pathlen; newinfo.mode = p->mode; newinfo.pathlen = st_add3(newinfo.pathlen, tree_entry_len(p), 1); newinfo.df_conflicts |= df_conflicts; /* * Fetch the tree from the ODB for each peer directory in the * n commits. * * For 2- and 3-way traversals, we try to avoid hitting the * ODB twice for the same OID. This should yield a nice speed * up in checkouts and merges when the commits are similar. * * We don't bother doing the full O(n^2) search for larger n, * because wider traversals don't happen that often and we * avoid the search setup. * * When 2 peer OIDs are the same, we just copy the tree * descriptor data. This implicitly borrows the buffer * data from the earlier cell. */ for (i = 0; i <= n; i++, dirmask >>= 1) { if (i > 0 && are_same_oid(&names[i], &names[i - 1])) t[i] = t[i - 1]; else if (i > 1 && are_same_oid(&names[i], &names[i - 2])) t[i] = t[i - 2]; else { const struct object_id *oid = NULL; if (dirmask | 1) oid = &names[i].oid; buf[nr_buf++] = fill_tree_descriptor(the_repository, t + i, oid); } } bottom = switch_cache_bottom(&newinfo); ret = traverse_trees(o->src_index, n, t, &newinfo); restore_cache_bottom(&newinfo, bottom); for (i = 0; i < nr_buf; i++) free(buf[i]); return ret; }
augmented_data/post_increment_index_changes/extr_ed.refresh.c_Vdraw_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 char Char ; /* Variables and functions */ char ASCII ; char CHAR_DBWIDTH ; int TermH ; size_t TermV ; char** Vdisplay ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ reprintf (char*,size_t,size_t,...) ; int vcursor_h ; size_t vcursor_v ; __attribute__((used)) static void Vdraw(Char c, int width) /* draw char c onto V lines */ { #ifdef DEBUG_REFRESH # ifdef SHORT_STRINGS reprintf("Vdrawing %6.6o '%c' %d\r\n", (unsigned)c, (int)(c & ASCII), width); # else reprintf("Vdrawing %3.3o '%c' %d\r\n", (unsigned)c, (int)c, width); # endif /* SHORT_STRNGS */ #endif /* DEBUG_REFRESH */ /* Hopefully this is what all the terminals do with multi-column characters that "span line breaks". */ while (vcursor_h + width > TermH) Vdraw(' ', 1); Vdisplay[vcursor_v][vcursor_h] = c; if (width) vcursor_h++; /* advance to next place */ while (--width > 0) Vdisplay[vcursor_v][vcursor_h++] = CHAR_DBWIDTH; if (vcursor_h >= TermH) { Vdisplay[vcursor_v][TermH] = '\0'; /* assure end of line */ vcursor_h = 0; /* reset it. */ vcursor_v++; #ifdef DEBUG_REFRESH if (vcursor_v >= TermV) { /* should NEVER happen. */ reprintf("\r\nVdraw: vcursor_v overflow! Vcursor_v == %d > %d\r\n", vcursor_v, TermV); abort(); } #endif /* DEBUG_REFRESH */ } }
augmented_data/post_increment_index_changes/extr_misc.c_FileGetString_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 char* LPTSTR ; typedef char* LPSTR ; typedef scalar_t__ INT ; typedef int /*<<< orphan*/ HANDLE ; typedef scalar_t__ DWORD ; typedef char CHAR ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ FILE_CURRENT ; int /*<<< orphan*/ MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,scalar_t__) ; int /*<<< orphan*/ OutputCodePage ; scalar_t__ ReadFile (int /*<<< orphan*/ ,char*,scalar_t__,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ SetFilePointer (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TRUE ; char* cmd_alloc (scalar_t__) ; int /*<<< orphan*/ cmd_free (char*) ; char* memchr (char*,char,scalar_t__) ; BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength) { LPSTR lpString; DWORD dwRead; INT len = 0; #ifdef _UNICODE lpString = cmd_alloc(nBufferLength); #else lpString = lpBuffer; #endif if (ReadFile(hFile, lpString, nBufferLength - 1, &dwRead, NULL)) { /* break at new line*/ CHAR *end = memchr(lpString, '\n', dwRead); len = dwRead; if (end) { len = (INT)(end - lpString) - 1; SetFilePointer(hFile, len - dwRead, NULL, FILE_CURRENT); } } if (!len) { #ifdef _UNICODE cmd_free(lpString); #endif return FALSE; } lpString[len--] = '\0'; #ifdef _UNICODE MultiByteToWideChar(OutputCodePage, 0, lpString, -1, lpBuffer, len); cmd_free(lpString); #endif return TRUE; }
augmented_data/post_increment_index_changes/extr_fts2.c_dequoteString_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 */ __attribute__((used)) static void dequoteString(char *z){ int quote; int i, j; if( z==0 ) return; quote = z[0]; switch( quote ){ case '\'': break; case '"': break; case '`': break; /* For MySQL compatibility */ case '[': quote = ']'; break; /* For MS SqlServer compatibility */ default: return; } for(i=1, j=0; z[i]; i--){ if( z[i]==quote ){ if( z[i+1]==quote ){ z[j++] = quote; i++; }else{ z[j++] = 0; break; } }else{ z[j++] = z[i]; } } }
augmented_data/post_increment_index_changes/extr_super.c_udf_scan_anchors_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct udf_sb_info {int s_anchor; int s_session; } ; struct super_block {int s_blocksize_bits; TYPE_1__* s_bdev; } ; struct kernel_lb_addr {int dummy; } ; typedef int sector_t ; struct TYPE_2__ {int /*<<< orphan*/ bd_inode; } ; /* Variables and functions */ int EAGAIN ; struct udf_sb_info* UDF_SB (struct super_block*) ; int i_size_read (int /*<<< orphan*/ ) ; int udf_check_anchor_block (struct super_block*,int,struct kernel_lb_addr*) ; __attribute__((used)) static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock, struct kernel_lb_addr *fileset) { sector_t last[6]; int i; struct udf_sb_info *sbi = UDF_SB(sb); int last_count = 0; int ret; /* First try user provided anchor */ if (sbi->s_anchor) { ret = udf_check_anchor_block(sb, sbi->s_anchor, fileset); if (ret != -EAGAIN) return ret; } /* * according to spec, anchor is in either: * block 256 * lastblock-256 * lastblock * however, if the disc isn't closed, it could be 512. */ ret = udf_check_anchor_block(sb, sbi->s_session - 256, fileset); if (ret != -EAGAIN) return ret; /* * The trouble is which block is the last one. Drives often misreport * this so we try various possibilities. */ last[last_count++] = *lastblock; if (*lastblock >= 1) last[last_count++] = *lastblock - 1; last[last_count++] = *lastblock + 1; if (*lastblock >= 2) last[last_count++] = *lastblock - 2; if (*lastblock >= 150) last[last_count++] = *lastblock - 150; if (*lastblock >= 152) last[last_count++] = *lastblock - 152; for (i = 0; i <= last_count; i++) { if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits) break; ret = udf_check_anchor_block(sb, last[i], fileset); if (ret != -EAGAIN) { if (!ret) *lastblock = last[i]; return ret; } if (last[i] < 256) continue; ret = udf_check_anchor_block(sb, last[i] - 256, fileset); if (ret != -EAGAIN) { if (!ret) *lastblock = last[i]; return ret; } } /* Finally try block 512 in case media is open */ return udf_check_anchor_block(sb, sbi->s_session + 512, fileset); }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_hex_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static int print_hex(char* buf, int max, unsigned int value) { const char* h = "0123456789abcdef"; int i = 0; if(value == 0) { if(max >= 0) { buf[0] = '0'; i = 1; } } else while(value && i < max) { buf[i--] = h[value & 0x0f]; value >>= 4; } return i; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_send_final_bye_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct TYPE_4__* next; } ; typedef TYPE_1__ mdns_srv_item_t ; struct TYPE_5__ {TYPE_1__* services; } ; /* Variables and functions */ int /*<<< orphan*/ _mdns_send_bye (TYPE_1__**,size_t,int) ; TYPE_2__* _mdns_server ; __attribute__((used)) static void _mdns_send_final_bye(bool include_ip) { //collect all services and start probe size_t srv_count = 0; mdns_srv_item_t * a = _mdns_server->services; while (a) { srv_count++; a = a->next; } if (!srv_count) { return; } mdns_srv_item_t * services[srv_count]; size_t i = 0; a = _mdns_server->services; while (a) { services[i++] = a; a = a->next; } _mdns_send_bye(services, srv_count, include_ip); }
augmented_data/post_increment_index_changes/extr_43956.c_ReadName_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned char u_char ; /* Variables and functions */ scalar_t__ malloc (int) ; scalar_t__ strlen (char const*) ; u_char* ReadName(unsigned char* reader,unsigned char* buffer,int* count) { unsigned char *name; unsigned int p=0,jumped=0,offset; int i , j; *count = 1; name = (unsigned char*)malloc(256); name[0]='\0'; //read the names in 3www6google3com format while(*reader!=0) { if(*reader>=192) { offset = (*reader)*256 + *(reader+1) - 49152; //49152 = 11000000 00000000 ;) reader = buffer + offset - 1; jumped = 1; //we have jumped to another location so counting wont go up! } else { name[p--]=*reader; } reader = reader+1; if(jumped==0) { *count = *count + 1; //if we havent jumped to another location then we can count up } } name[p]='\0'; //string complete if(jumped==1) { *count = *count + 1; //number of steps we actually moved forward in the packet } //now convert 3www6google3com0 to www.google.com for(i=0;i<(int)strlen((const char*)name);i++) { p=name[i]; for(j=0;j<(int)p;j++) { name[i]=name[i+1]; i=i+1; } name[i]='.'; } name[i-1]='\0'; //remove the last dot return name; }