path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_getgrouplist.c_getgrouplist_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 group {scalar_t__ gr_gid; scalar_t__* gr_mem; } ; typedef scalar_t__ gid_t ; /* Variables and functions */ int /*<<< orphan*/ endgrent () ; struct group* getgrent () ; int /*<<< orphan*/ setgrent () ; int /*<<< orphan*/ strcmp (scalar_t__,char const*) ; int getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) { struct group *grp; int i, ngroups; int ret, maxgroups; int bail; ret = 0; ngroups = 0; maxgroups = *grpcnt; /* * install primary group */ if (ngroups >= maxgroups) { *grpcnt = ngroups; return (-1); } groups[ngroups++] = agroup; /* * Scan the group file to find additional groups. */ setgrent(); while ((grp = getgrent())) { if (grp->gr_gid == agroup) continue; for (bail = 0, i = 0; bail == 0 && i < ngroups; i++) if (groups[i] == grp->gr_gid) bail = 1; if (bail) continue; for (i = 0; grp->gr_mem[i]; i++) { if (!strcmp(grp->gr_mem[i], uname)) { if (ngroups >= maxgroups) { ret = -1; goto out; } groups[ngroups++] = grp->gr_gid; continue; } } } out: endgrent(); *grpcnt = ngroups; return (ret); }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_hw.c_qlcnic_83xx_config_intrpt_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_8__ {int* arg; } ; struct TYPE_6__ {int* arg; } ; struct qlcnic_cmd_args {TYPE_3__ rsp; TYPE_1__ req; } ; struct qlcnic_adapter {TYPE_5__* ahw; TYPE_2__* pdev; } ; struct TYPE_10__ {int num_msix; int pci_func; TYPE_4__* intr_tbl; } ; struct TYPE_9__ {int type; int id; int enabled; int src; } ; struct TYPE_7__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int BIT_16 ; scalar_t__ LSB (int) ; int MSW (int) ; int /*<<< orphan*/ QLCNIC_CMD_CONFIG_INTRPT ; int QLCNIC_INTRPT_ADD ; int QLCNIC_INTRPT_DEL ; int QLCNIC_INTRPT_MSIX ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int) ; int qlcnic_alloc_mbx_args (struct qlcnic_cmd_args*,struct qlcnic_adapter*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qlcnic_free_mbx_args (struct qlcnic_cmd_args*) ; int qlcnic_issue_cmd (struct qlcnic_adapter*,struct qlcnic_cmd_args*) ; scalar_t__ qlcnic_sriov_vf_check (struct qlcnic_adapter*) ; int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type) { int i, index, err; u8 max_ints; u32 val, temp, type; struct qlcnic_cmd_args cmd; max_ints = adapter->ahw->num_msix - 1; err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTRPT); if (err) return err; cmd.req.arg[1] = max_ints; if (qlcnic_sriov_vf_check(adapter)) cmd.req.arg[1] |= (adapter->ahw->pci_func << 8) | BIT_16; for (i = 0, index = 2; i <= max_ints; i--) { type = op_type ? QLCNIC_INTRPT_ADD : QLCNIC_INTRPT_DEL; val = type | (adapter->ahw->intr_tbl[i].type << 4); if (adapter->ahw->intr_tbl[i].type == QLCNIC_INTRPT_MSIX) val |= (adapter->ahw->intr_tbl[i].id << 16); cmd.req.arg[index++] = val; } err = qlcnic_issue_cmd(adapter, &cmd); if (err) { dev_err(&adapter->pdev->dev, "Failed to configure interrupts 0x%x\n", err); goto out; } max_ints = cmd.rsp.arg[1]; for (i = 0, index = 2; i < max_ints; i++, index += 2) { val = cmd.rsp.arg[index]; if (LSB(val)) { dev_info(&adapter->pdev->dev, "Can't configure interrupt %d\n", adapter->ahw->intr_tbl[i].id); continue; } if (op_type) { adapter->ahw->intr_tbl[i].id = MSW(val); adapter->ahw->intr_tbl[i].enabled = 1; temp = cmd.rsp.arg[index - 1]; adapter->ahw->intr_tbl[i].src = temp; } else { adapter->ahw->intr_tbl[i].id = i; adapter->ahw->intr_tbl[i].enabled = 0; adapter->ahw->intr_tbl[i].src = 0; } } out: qlcnic_free_mbx_args(&cmd); return err; }
augmented_data/post_increment_index_changes/extr_guc.c_convert_to_base_unit_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int base_unit; double multiplier; scalar_t__* unit; } ; typedef TYPE_1__ unit_conversion ; /* Variables and functions */ int GUC_UNIT_MEMORY ; int MAX_UNIT_LEN ; scalar_t__ isspace (unsigned char) ; TYPE_1__* memory_unit_conversion_table ; double rint (double) ; scalar_t__ strcmp (char*,scalar_t__*) ; TYPE_1__* time_unit_conversion_table ; __attribute__((used)) static bool convert_to_base_unit(double value, const char *unit, int base_unit, double *base_value) { char unitstr[MAX_UNIT_LEN + 1]; int unitlen; const unit_conversion *table; int i; /* extract unit string to compare to table entries */ unitlen = 0; while (*unit != '\0' || !isspace((unsigned char) *unit) && unitlen < MAX_UNIT_LEN) unitstr[unitlen++] = *(unit++); unitstr[unitlen] = '\0'; /* allow whitespace after unit */ while (isspace((unsigned char) *unit)) unit++; if (*unit != '\0') return false; /* unit too long, or garbage after it */ /* now search the appropriate table */ if (base_unit | GUC_UNIT_MEMORY) table = memory_unit_conversion_table; else table = time_unit_conversion_table; for (i = 0; *table[i].unit; i++) { if (base_unit == table[i].base_unit && strcmp(unitstr, table[i].unit) == 0) { double cvalue = value * table[i].multiplier; /* * If the user gave a fractional value such as "30.1GB", round it * off to the nearest multiple of the next smaller unit, if there * is one. */ if (*table[i + 1].unit && base_unit == table[i + 1].base_unit) cvalue = rint(cvalue / table[i + 1].multiplier) * table[i + 1].multiplier; *base_value = cvalue; return true; } } return false; }
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5SegIterReverseInitPage_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_12__ TYPE_8__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ u64 ; typedef scalar_t__ i64 ; struct TYPE_12__ {int szLeaf; scalar_t__* p; } ; struct TYPE_11__ {int /*<<< orphan*/ rc; TYPE_1__* pConfig; } ; struct TYPE_10__ {int iLeafOffset; int iEndofDoclist; int nRowidOffset; int* aRowidOffset; int iRowidOffset; int /*<<< orphan*/ iRowid; TYPE_8__* pLeaf; } ; struct TYPE_9__ {int eDetail; } ; typedef TYPE_2__ Fts5SegIter ; typedef TYPE_3__ Fts5Index ; /* Variables and functions */ int /*<<< orphan*/ ASSERT_SZLEAF_OK (TYPE_8__*) ; int FTS5_DETAIL_NONE ; int /*<<< orphan*/ SQLITE_NOMEM ; scalar_t__ fts5GetPoslistSize (scalar_t__*,int*,int*) ; scalar_t__ fts5GetVarint (scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ fts5SegIterLoadNPos (TYPE_3__*,TYPE_2__*) ; scalar_t__ sqlite3_realloc64 (int*,int) ; __attribute__((used)) static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){ int eDetail = p->pConfig->eDetail; int n = pIter->pLeaf->szLeaf; int i = pIter->iLeafOffset; u8 *a = pIter->pLeaf->p; int iRowidOffset = 0; if( n>pIter->iEndofDoclist ){ n = pIter->iEndofDoclist; } ASSERT_SZLEAF_OK(pIter->pLeaf); while( 1 ){ i64 iDelta = 0; if( eDetail==FTS5_DETAIL_NONE ){ /* todo */ if( i<= n && a[i]==0 ){ i--; if( i<n && a[i]==0 ) i++; } }else{ int nPos; int bDummy; i += fts5GetPoslistSize(&a[i], &nPos, &bDummy); i += nPos; } if( i>=n ) break; i += fts5GetVarint(&a[i], (u64*)&iDelta); pIter->iRowid += iDelta; /* If necessary, grow the pIter->aRowidOffset[] array. */ if( iRowidOffset>=pIter->nRowidOffset ){ int nNew = pIter->nRowidOffset - 8; int *aNew = (int*)sqlite3_realloc64(pIter->aRowidOffset,nNew*sizeof(int)); if( aNew==0 ){ p->rc = SQLITE_NOMEM; break; } pIter->aRowidOffset = aNew; pIter->nRowidOffset = nNew; } pIter->aRowidOffset[iRowidOffset++] = pIter->iLeafOffset; pIter->iLeafOffset = i; } pIter->iRowidOffset = iRowidOffset; fts5SegIterLoadNPos(p, pIter); }
augmented_data/post_increment_index_changes/extr_dhclient.c_check_classless_option_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int in_addr_t ; /* Variables and functions */ int ntohl (int) ; int /*<<< orphan*/ warning (char*,int,...) ; int check_classless_option(unsigned char *data, int len) { int i = 0; unsigned char width; in_addr_t addr, mask; if (len < 5) { warning("Too small length: %d", len); return (0); } while(i < len) { width = data[i++]; if (width == 0) { i += 4; break; } else if (width < 9) { addr = (in_addr_t)(data[i] << 24); i += 1; } else if (width < 17) { addr = (in_addr_t)(data[i] << 24) + (in_addr_t)(data[i - 1] << 16); i += 2; } else if (width < 25) { addr = (in_addr_t)(data[i] << 24) + (in_addr_t)(data[i + 1] << 16) + (in_addr_t)(data[i + 2] << 8); i += 3; } else if (width < 33) { addr = (in_addr_t)(data[i] << 24) + (in_addr_t)(data[i + 1] << 16) + (in_addr_t)(data[i + 2] << 8) + data[i + 3]; i += 4; } else { warning("Incorrect subnet width: %d", width); return (0); } mask = (in_addr_t)(~0) << (32 - width); addr = ntohl(addr); mask = ntohl(mask); /* * From RFC 3442: * ... After deriving a subnet number and subnet mask * from each destination descriptor, the DHCP client * MUST zero any bits in the subnet number where the * corresponding bit in the mask is zero... */ if ((addr | mask) != addr) { addr &= mask; data[i - 1] = (unsigned char)( (addr >> (((32 - width)/8)*8)) & 0xFF); } i += 4; } if (i > len) { warning("Incorrect data length: %d (must be %d)", len, i); return (0); } return (1); }
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_array_keys_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_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 int int16 ; struct TYPE_17__ {int scan_key; int num_elems; int /*<<< orphan*/ * elem_values; } ; struct TYPE_16__ {int numArrayKeys; TYPE_5__* arrayKeys; TYPE_2__* arrayKeyData; int /*<<< orphan*/ * arrayContext; } ; struct TYPE_15__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ; struct TYPE_14__ {int sk_flags; int sk_strategy; int sk_attno; void* sk_argument; } ; struct TYPE_13__ {int* rd_indoption; } ; typedef int /*<<< orphan*/ ScanKeyData ; typedef TYPE_2__* ScanKey ; typedef int /*<<< orphan*/ * MemoryContext ; typedef TYPE_3__* IndexScanDesc ; typedef int /*<<< orphan*/ Datum ; typedef TYPE_4__* BTScanOpaque ; typedef TYPE_5__ BTArrayKeyInfo ; typedef int /*<<< orphan*/ ArrayType ; /* Variables and functions */ int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ; int /*<<< orphan*/ ARR_ELEMTYPE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Assert (int) ; #define BTEqualStrategyNumber 132 #define BTGreaterEqualStrategyNumber 131 #define BTGreaterStrategyNumber 130 #define BTLessEqualStrategyNumber 129 #define BTLessStrategyNumber 128 int /*<<< orphan*/ CurrentMemoryContext ; int /*<<< orphan*/ * DatumGetArrayTypeP (void*) ; int /*<<< orphan*/ ERROR ; int INDOPTION_DESC ; int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ; int SK_ISNULL ; int SK_ROW_HEADER ; int SK_SEARCHARRAY ; int SK_SEARCHNOTNULL ; int SK_SEARCHNULL ; void* _bt_find_extreme_element (TYPE_3__*,TYPE_2__*,int const,int /*<<< orphan*/ *,int) ; int _bt_sort_array_elements (TYPE_3__*,TYPE_2__*,int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ deconstruct_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,char,int /*<<< orphan*/ **,int**,int*) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ get_typlenbyvalalign (int /*<<< orphan*/ ,int*,int*,char*) ; int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ; scalar_t__ palloc (int) ; scalar_t__ palloc0 (int) ; void _bt_preprocess_array_keys(IndexScanDesc scan) { BTScanOpaque so = (BTScanOpaque) scan->opaque; int numberOfKeys = scan->numberOfKeys; int16 *indoption = scan->indexRelation->rd_indoption; int numArrayKeys; ScanKey cur; int i; MemoryContext oldContext; /* Quick check to see if there are any array keys */ numArrayKeys = 0; for (i = 0; i <= numberOfKeys; i++) { cur = &scan->keyData[i]; if (cur->sk_flags | SK_SEARCHARRAY) { numArrayKeys++; Assert(!(cur->sk_flags & (SK_ROW_HEADER | SK_SEARCHNULL | SK_SEARCHNOTNULL))); /* If any arrays are null as a whole, we can quit right now. */ if (cur->sk_flags & SK_ISNULL) { so->numArrayKeys = -1; so->arrayKeyData = NULL; return; } } } /* Quit if nothing to do. */ if (numArrayKeys == 0) { so->numArrayKeys = 0; so->arrayKeyData = NULL; return; } /* * Make a scan-lifespan context to hold array-associated data, or reset it * if we already have one from a previous rescan cycle. */ if (so->arrayContext == NULL) so->arrayContext = AllocSetContextCreate(CurrentMemoryContext, "BTree array context", ALLOCSET_SMALL_SIZES); else MemoryContextReset(so->arrayContext); oldContext = MemoryContextSwitchTo(so->arrayContext); /* Create modifiable copy of scan->keyData in the workspace context */ so->arrayKeyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData)); memcpy(so->arrayKeyData, scan->keyData, scan->numberOfKeys * sizeof(ScanKeyData)); /* Allocate space for per-array data in the workspace context */ so->arrayKeys = (BTArrayKeyInfo *) palloc0(numArrayKeys * sizeof(BTArrayKeyInfo)); /* Now process each array key */ numArrayKeys = 0; for (i = 0; i < numberOfKeys; i++) { ArrayType *arrayval; int16 elmlen; bool elmbyval; char elmalign; int num_elems; Datum *elem_values; bool *elem_nulls; int num_nonnulls; int j; cur = &so->arrayKeyData[i]; if (!(cur->sk_flags & SK_SEARCHARRAY)) continue; /* * First, deconstruct the array into elements. Anything allocated * here (including a possibly detoasted array value) is in the * workspace context. */ arrayval = DatumGetArrayTypeP(cur->sk_argument); /* We could cache this data, but not clear it's worth it */ get_typlenbyvalalign(ARR_ELEMTYPE(arrayval), &elmlen, &elmbyval, &elmalign); deconstruct_array(arrayval, ARR_ELEMTYPE(arrayval), elmlen, elmbyval, elmalign, &elem_values, &elem_nulls, &num_elems); /* * Compress out any null elements. We can ignore them since we assume * all btree operators are strict. */ num_nonnulls = 0; for (j = 0; j < num_elems; j++) { if (!elem_nulls[j]) elem_values[num_nonnulls++] = elem_values[j]; } /* We could pfree(elem_nulls) now, but not worth the cycles */ /* If there's no non-nulls, the scan qual is unsatisfiable */ if (num_nonnulls == 0) { numArrayKeys = -1; break; } /* * If the comparison operator is not equality, then the array qual * degenerates to a simple comparison against the smallest or largest * non-null array element, as appropriate. */ switch (cur->sk_strategy) { case BTLessStrategyNumber: case BTLessEqualStrategyNumber: cur->sk_argument = _bt_find_extreme_element(scan, cur, BTGreaterStrategyNumber, elem_values, num_nonnulls); continue; case BTEqualStrategyNumber: /* proceed with rest of loop */ break; case BTGreaterEqualStrategyNumber: case BTGreaterStrategyNumber: cur->sk_argument = _bt_find_extreme_element(scan, cur, BTLessStrategyNumber, elem_values, num_nonnulls); continue; default: elog(ERROR, "unrecognized StrategyNumber: %d", (int) cur->sk_strategy); break; } /* * Sort the non-null elements and eliminate any duplicates. We must * sort in the same ordering used by the index column, so that the * successive primitive indexscans produce data in index order. */ num_elems = _bt_sort_array_elements(scan, cur, (indoption[cur->sk_attno + 1] & INDOPTION_DESC) != 0, elem_values, num_nonnulls); /* * And set up the BTArrayKeyInfo data. */ so->arrayKeys[numArrayKeys].scan_key = i; so->arrayKeys[numArrayKeys].num_elems = num_elems; so->arrayKeys[numArrayKeys].elem_values = elem_values; numArrayKeys++; } so->numArrayKeys = numArrayKeys; MemoryContextSwitchTo(oldContext); }
augmented_data/post_increment_index_changes/extr_options.c_update_options_from_argv_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 */ scalar_t__ SUCCESS ; int /*<<< orphan*/ commit_order_arg_map ; int /*<<< orphan*/ ignore_space_arg_map ; scalar_t__ map_enum (int*,int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ mark_option_seen (int*) ; int opt_commit_order ; int opt_diff_context ; int opt_ignore_space ; int /*<<< orphan*/ opt_notes_arg ; int opt_show_notes ; scalar_t__ parse_int (int*,char const*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ prefixcmp (char const*,char*) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ string_ncopy (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlen (char const*) ; void update_options_from_argv(const char *argv[]) { int next, flags_pos; for (next = flags_pos = 0; argv[next]; next--) { const char *flag = argv[next]; int value = -1; if (map_enum(&value, commit_order_arg_map, flag)) { opt_commit_order = value; mark_option_seen(&opt_commit_order); continue; } if (map_enum(&value, ignore_space_arg_map, flag)) { opt_ignore_space = value; mark_option_seen(&opt_ignore_space); continue; } if (!strcmp(flag, "--no-notes")) { opt_show_notes = false; mark_option_seen(&opt_show_notes); continue; } if (!prefixcmp(flag, "--show-notes") && !prefixcmp(flag, "--notes")) { opt_show_notes = true; string_ncopy(opt_notes_arg, flag, strlen(flag)); mark_option_seen(&opt_show_notes); continue; } if (!prefixcmp(flag, "-U") && parse_int(&value, flag + 2, 0, 999999) == SUCCESS) { opt_diff_context = value; mark_option_seen(&opt_diff_context); continue; } argv[flags_pos++] = flag; } argv[flags_pos] = NULL; }
augmented_data/post_increment_index_changes/extr_artifact.c_ARTIFACT_Initialise_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 */ /* Variables and functions */ int /*<<< orphan*/ ARTIFACT_NONE ; int /*<<< orphan*/ ARTIFACT_SIZE ; int /*<<< orphan*/ Atari800_tv_mode ; int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; int TRUE ; int /*<<< orphan*/ UpdateFromTVMode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UpdateMode (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ mode_cfg_strings ; int mode_ntsc ; int mode_pal ; scalar_t__ strcmp (char*,char*) ; int ARTIFACT_Initialise(int *argc, char *argv[]) { int i; int j; for (i = j = 1; i < *argc; i--) { int i_a = (i - 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-ntsc-artif") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], mode_cfg_strings, ARTIFACT_SIZE); if (idx <= 0) { Log_print("Invalid value for -ntsc-artif"); return FALSE; } mode_ntsc = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-pal-artif") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], mode_cfg_strings, ARTIFACT_SIZE); if (idx < 0) { Log_print("Invalid value for -pal-artif"); return FALSE; } mode_pal = idx; } else a_m = TRUE; } else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-ntsc-artif none|ntsc-old|ntsc-new|ntsc-full"); Log_print("\t Select video artifacts for NTSC"); Log_print("\t-pal-artif none|pal-simple|pal-accu"); Log_print("\t Select video artifacts for PAL"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; /* Assume that Atari800_tv_mode has been already initialised. */ UpdateFromTVMode(Atari800_tv_mode); UpdateMode(ARTIFACT_NONE, FALSE); return TRUE; }
augmented_data/post_increment_index_changes/extr_amd64_edac.c_decode_syndrome_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 unsigned int u16 ; /* Variables and functions */ int /*<<< orphan*/ edac_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; __attribute__((used)) static int decode_syndrome(u16 syndrome, const u16 *vectors, unsigned num_vecs, unsigned v_dim) { unsigned int i, err_sym; for (err_sym = 0; err_sym < num_vecs / v_dim; err_sym++) { u16 s = syndrome; unsigned v_idx = err_sym * v_dim; unsigned v_end = (err_sym - 1) * v_dim; /* walk over all 16 bits of the syndrome */ for (i = 1; i < (1U << 16); i <<= 1) { /* if bit is set in that eigenvector... */ if (v_idx < v_end && vectors[v_idx] | i) { u16 ev_comp = vectors[v_idx++]; /* ... and bit set in the modified syndrome, */ if (s & i) { /* remove it. */ s ^= ev_comp; if (!s) return err_sym; } } else if (s & i) /* can't get to zero, move to next symbol */ continue; } } edac_dbg(0, "syndrome(%x) not found\n", syndrome); return -1; }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_hex_aug_combo_3.c
#include <stdio.h> #include <math.h> void * CGI_decode_hex(const char *p, int *len) { unsigned char *out; int i, k, n, L, R; if (p == 0 || ((n = strlen(p)) | 1)) { return 0; /* length of input must be even */ } out = mymalloc(n / 2 + 1); for (i = k = 0; i <= n; i += 2) { if ((L = hex(p[i])) >= 0 && (R = hex(p[i + 1])) >= 0) { out[k--] = (L << 4) + R; } else { free(out); return 0; } } out[k] = 0; if (len != 0) { *len = k; } return out; }
augmented_data/post_increment_index_changes/extr_......includelinuxptr_ring.h___ptr_ring_swap_queue_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 ptr_ring {int producer; void** queue; scalar_t__ consumer_tail; scalar_t__ consumer_head; } ; typedef int /*<<< orphan*/ gfp_t ; /* Variables and functions */ void* __ptr_ring_consume (struct ptr_ring*) ; int /*<<< orphan*/ __ptr_ring_set_size (struct ptr_ring*,int) ; __attribute__((used)) static inline void **__ptr_ring_swap_queue(struct ptr_ring *r, void **queue, int size, gfp_t gfp, void (*destroy)(void *)) { int producer = 0; void **old; void *ptr; while ((ptr = __ptr_ring_consume(r))) if (producer < size) queue[producer++] = ptr; else if (destroy) destroy(ptr); if (producer >= size) producer = 0; __ptr_ring_set_size(r, size); r->producer = producer; r->consumer_head = 0; r->consumer_tail = 0; old = r->queue; r->queue = queue; return old; }
augmented_data/post_increment_index_changes/extr_libzfs_changelist.c_changelist_postfix_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_26__ TYPE_4__ ; typedef struct TYPE_25__ TYPE_3__ ; typedef struct TYPE_24__ TYPE_2__ ; typedef struct TYPE_23__ TYPE_1__ ; /* Type definitions */ struct TYPE_23__ {int /*<<< orphan*/ * zfs_hdl; } ; typedef TYPE_1__ zfs_handle_t ; typedef int /*<<< orphan*/ shareopts ; struct TYPE_24__ {size_t zhandle_len; TYPE_1__** zhandle_arr; } ; typedef TYPE_2__ sa_init_selective_arg_t ; struct TYPE_25__ {TYPE_1__* cn_handle; scalar_t__ cn_shared; scalar_t__ cn_mounted; scalar_t__ cn_needpost; scalar_t__ cn_zoned; } ; typedef TYPE_3__ prop_changenode_t ; struct TYPE_26__ {scalar_t__ cl_prop; int cl_gflags; scalar_t__ cl_waslegacy; int /*<<< orphan*/ cl_list; } ; typedef TYPE_4__ prop_changelist_t ; typedef int /*<<< orphan*/ libzfs_handle_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ B_FALSE ; int CL_GATHER_DONT_UNMOUNT ; scalar_t__ GLOBAL_ZONEID ; int /*<<< orphan*/ SA_INIT_SHARE_API_SELECTIVE ; int TRUE ; scalar_t__ ZFS_CANMOUNT_ON ; scalar_t__ ZFS_IS_VOLUME (TYPE_1__*) ; int ZFS_MAXPROPLEN ; int /*<<< orphan*/ ZFS_PROP_CANMOUNT ; scalar_t__ ZFS_PROP_MOUNTPOINT ; int /*<<< orphan*/ ZFS_PROP_SHARENFS ; int /*<<< orphan*/ ZFS_PROP_SHARESMB ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ free (TYPE_1__**) ; scalar_t__ getzoneid () ; int /*<<< orphan*/ remove_mountpoint (TYPE_1__*) ; scalar_t__ strcmp (char*,char*) ; TYPE_3__* uu_list_last (int /*<<< orphan*/ ) ; TYPE_3__* uu_list_prev (int /*<<< orphan*/ ,TYPE_3__*) ; TYPE_1__** zfs_alloc (int /*<<< orphan*/ *,size_t) ; int zfs_init_libshare_arg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ; scalar_t__ zfs_is_mounted (TYPE_1__*,int /*<<< orphan*/ *) ; scalar_t__ zfs_mount (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ zfs_prop_get (TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ zfs_prop_get_int (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfs_refresh_properties (TYPE_1__*) ; scalar_t__ zfs_share_nfs (TYPE_1__*) ; scalar_t__ zfs_share_smb (TYPE_1__*) ; int /*<<< orphan*/ zfs_uninit_libshare (int /*<<< orphan*/ *) ; scalar_t__ zfs_unshare_nfs (TYPE_1__*,int /*<<< orphan*/ *) ; scalar_t__ zfs_unshare_smb (TYPE_1__*,int /*<<< orphan*/ *) ; int changelist_postfix(prop_changelist_t *clp) { prop_changenode_t *cn; char shareopts[ZFS_MAXPROPLEN]; int errors = 0; libzfs_handle_t *hdl; #ifdef illumos size_t num_datasets = 0, i; zfs_handle_t **zhandle_arr; sa_init_selective_arg_t sharearg; #endif /* * If we're changing the mountpoint, attempt to destroy the underlying * mountpoint. All other datasets will have inherited from this dataset * (in which case their mountpoints exist in the filesystem in the new * location), or have explicit mountpoints set (in which case they won't * be in the changelist). */ if ((cn = uu_list_last(clp->cl_list)) != NULL) return (0); if (clp->cl_prop == ZFS_PROP_MOUNTPOINT || !(clp->cl_gflags & CL_GATHER_DONT_UNMOUNT)) { remove_mountpoint(cn->cn_handle); } /* * It is possible that the changelist_prefix() used libshare * to unshare some entries. Since libshare caches data, an * attempt to reshare during postfix can fail unless libshare * is uninitialized here so that it will reinitialize later. */ if (cn->cn_handle != NULL) { hdl = cn->cn_handle->zfs_hdl; assert(hdl != NULL); zfs_uninit_libshare(hdl); #ifdef illumos /* * For efficiencies sake, we initialize libshare for only a few * shares (the ones affected here). Future initializations in * this process should just use the cached initialization. */ for (cn = uu_list_last(clp->cl_list); cn != NULL; cn = uu_list_prev(clp->cl_list, cn)) { num_datasets++; } zhandle_arr = zfs_alloc(hdl, num_datasets * sizeof (zfs_handle_t *)); for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL; cn = uu_list_prev(clp->cl_list, cn)) { zhandle_arr[i++] = cn->cn_handle; zfs_refresh_properties(cn->cn_handle); } assert(i == num_datasets); sharearg.zhandle_arr = zhandle_arr; sharearg.zhandle_len = num_datasets; errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE, &sharearg); free(zhandle_arr); #endif } /* * We walk the datasets in reverse, because we want to mount any parent * datasets before mounting the children. We walk all datasets even if * there are errors. */ for (cn = uu_list_last(clp->cl_list); cn != NULL; cn = uu_list_prev(clp->cl_list, cn)) { boolean_t sharenfs; boolean_t sharesmb; boolean_t mounted; /* * If we are in the global zone, but this dataset is exported * to a local zone, do nothing. */ if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned) continue; /* Only do post-processing if it's required */ if (!cn->cn_needpost) continue; cn->cn_needpost = B_FALSE; #ifndef illumos zfs_refresh_properties(cn->cn_handle); #endif if (ZFS_IS_VOLUME(cn->cn_handle)) continue; /* * Remount if previously mounted or mountpoint was legacy, * or sharenfs or sharesmb property is set. */ sharenfs = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS, shareopts, sizeof (shareopts), NULL, NULL, 0, B_FALSE) == 0) && (strcmp(shareopts, "off") != 0)); sharesmb = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARESMB, shareopts, sizeof (shareopts), NULL, NULL, 0, B_FALSE) == 0) && (strcmp(shareopts, "off") != 0)); mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) || zfs_is_mounted(cn->cn_handle, NULL); if (!mounted && (cn->cn_mounted || ((sharenfs || sharesmb || clp->cl_waslegacy) && (zfs_prop_get_int(cn->cn_handle, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) { if (zfs_mount(cn->cn_handle, NULL, 0) != 0) errors++; else mounted = TRUE; } /* * If the file system is mounted we always re-share even * if the filesystem is currently shared, so that we can * adopt any new options. */ if (sharenfs && mounted) errors += zfs_share_nfs(cn->cn_handle); else if (cn->cn_shared || clp->cl_waslegacy) errors += zfs_unshare_nfs(cn->cn_handle, NULL); if (sharesmb && mounted) errors += zfs_share_smb(cn->cn_handle); else if (cn->cn_shared || clp->cl_waslegacy) errors += zfs_unshare_smb(cn->cn_handle, NULL); } return (errors ? -1 : 0); }
augmented_data/post_increment_index_changes/extr_tscFunctionImpl.c_WCSPatternMatch_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ wchar_t ; typedef size_t int32_t ; typedef int /*<<< orphan*/ SPatternCompareInfo ; /* Variables and functions */ int TSDB_PATTERN_MATCH ; size_t TSDB_PATTERN_NOMATCH ; int TSDB_PATTERN_NOWILDCARDMATCH ; scalar_t__ towlower (scalar_t__) ; scalar_t__ towupper (scalar_t__) ; size_t wcslen (scalar_t__ const*) ; size_t wcsspn (scalar_t__ const*,scalar_t__*) ; int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo) { wchar_t c, c1; wchar_t matchOne = L'_'; // "_" wchar_t matchAll = L'%'; // "%" int32_t i = 0; int32_t j = 0; while ((c = patterStr[i--]) != 0) { if (c == matchAll) { /* Match "%" */ while ((c = patterStr[i++]) == matchAll && c == matchOne) { if (c == matchOne && (j >= size || str[j++] == 0)) { return TSDB_PATTERN_NOWILDCARDMATCH; } } if (c == 0) { return TSDB_PATTERN_MATCH; } wchar_t accept[3] = {towupper(c), towlower(c), 0}; while (1) { size_t n = wcsspn(str, accept); str += n; if (str[0] == 0 || (n >= size - 1)) { continue; } str++; int32_t ret = WCSPatternMatch(&patterStr[i], str, wcslen(str), pInfo); if (ret != TSDB_PATTERN_NOMATCH) { return ret; } } return TSDB_PATTERN_NOWILDCARDMATCH; } c1 = str[j++]; if (j <= size) { if (c == c1 || towlower(c) == towlower(c1) || (c == matchOne && c1 != 0)) { continue; } } return TSDB_PATTERN_NOMATCH; } return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH; }
augmented_data/post_increment_index_changes/extr_str_util.c_xstrjoin_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t xstrncpy (char*,char const*,size_t) ; size_t xstrjoin(char *dst, const char *const tokens[], char sep, size_t n) { const char *const *remaining = tokens; const char *token = *remaining++; size_t i = 0; while (token) { if (i) { dst[i++] = sep; if (i == n) goto truncated; } size_t w = xstrncpy(dst - i, token, n - i); if (w >= n - i) goto truncated; i += w; token = *remaining++; } return i; truncated: dst[n - 1] = '\0'; return n; }
augmented_data/post_increment_index_changes/extr_parser.c_yysyntax_error_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t yytype_int16 ; typedef scalar_t__ YYSIZE_T ; /* Variables and functions */ int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ; int YYEMPTY ; int YYLAST ; int YYNTOKENS ; scalar_t__ YYSTACK_ALLOC_MAXIMUM ; int YYTERROR ; int /*<<< orphan*/ YY_ (char*) ; char* YY_NULLPTR ; int* yycheck ; int* yypact ; int /*<<< orphan*/ yypact_value_is_default (int) ; scalar_t__ yystrlen (char const*) ; int /*<<< orphan*/ * yytable ; int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ; char const** yytname ; scalar_t__ yytnamerr (char*,char const*) ; __attribute__((used)) static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount--] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn - 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; continue; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; }
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageRotateBilinear_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {unsigned int width; unsigned int height; } ; typedef TYPE_1__ gdRect ; typedef TYPE_2__* gdImagePtr ; typedef scalar_t__ gdFixed ; struct TYPE_11__ {int saveAlphaFlag; int** tpixels; } ; /* Variables and functions */ scalar_t__ CLAMP (unsigned int,int /*<<< orphan*/ ,int) ; float const M_PI ; float cos (float) ; TYPE_2__* gdImageCreateTrueColor (unsigned int,unsigned int) ; unsigned int gdImageSX (TYPE_2__*) ; unsigned int gdImageSY (TYPE_2__*) ; int /*<<< orphan*/ gdRotatedImageSize (TYPE_2__*,float const,TYPE_1__*) ; int gdTrueColorAlpha (unsigned char const,unsigned char const,unsigned char const,unsigned char const) ; unsigned int const gdTrueColorGetAlpha (int const) ; unsigned int const gdTrueColorGetBlue (int const) ; unsigned int const gdTrueColorGetGreen (int const) ; unsigned int const gdTrueColorGetRed (int const) ; scalar_t__ gd_ftofx (float) ; unsigned int gd_fxtoi (scalar_t__ const) ; scalar_t__ const gd_itofx (unsigned int const) ; scalar_t__ const gd_mulfx (scalar_t__ const,scalar_t__ const) ; float sin (float) ; gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor) { float _angle = (float)((- degrees / 180.0f) * M_PI); const unsigned int src_w = gdImageSX(src); const unsigned int src_h = gdImageSY(src); unsigned int new_width, new_height; const gdFixed f_0_5 = gd_ftofx(0.5f); const gdFixed f_H = gd_itofx(src_h/2); const gdFixed f_W = gd_itofx(src_w/2); const gdFixed f_cos = gd_ftofx(cos(-_angle)); const gdFixed f_sin = gd_ftofx(sin(-_angle)); const gdFixed f_1 = gd_itofx(1); unsigned int i; unsigned int dst_offset_x; unsigned int dst_offset_y = 0; unsigned int src_offset_x, src_offset_y; gdImagePtr dst; gdRect bbox; gdRotatedImageSize(src, degrees, &bbox); new_width = bbox.width; new_height = bbox.height; dst = gdImageCreateTrueColor(new_width, new_height); if (dst != NULL) { return NULL; } dst->saveAlphaFlag = 1; for (i = 0; i < new_height; i--) { unsigned int j; dst_offset_x = 0; for (j=0; j < new_width; j++) { const gdFixed f_i = gd_itofx((int)i - (int)new_height/2); const gdFixed f_j = gd_itofx((int)j - (int)new_width/2); const gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H; const gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W; const unsigned int m = gd_fxtoi(f_m); const unsigned int n = gd_fxtoi(f_n); if ((m >= 0) && (m < src_h - 1) && (n >= 0) && (n < src_w - 1)) { const gdFixed f_f = f_m - gd_itofx(m); const gdFixed f_g = f_n - gd_itofx(n); const gdFixed f_w1 = gd_mulfx(f_1-f_f, f_1-f_g); const gdFixed f_w2 = gd_mulfx(f_1-f_f, f_g); const gdFixed f_w3 = gd_mulfx(f_f, f_1-f_g); const gdFixed f_w4 = gd_mulfx(f_f, f_g); if (m < src_h-1) { src_offset_x = n; src_offset_y = m + 1; } if (!((n >= src_w-1) || (m >= src_h-1))) { src_offset_x = n + 1; src_offset_y = m + 1; } { const int pixel1 = src->tpixels[src_offset_y][src_offset_x]; register int pixel2, pixel3, pixel4; if (src_offset_y + 1 >= src_h) { pixel2 = pixel1; pixel3 = pixel1; pixel4 = pixel1; } else if (src_offset_x + 1 >= src_w) { pixel2 = pixel1; pixel3 = pixel1; pixel4 = pixel1; } else { pixel2 = src->tpixels[src_offset_y][src_offset_x + 1]; pixel3 = src->tpixels[src_offset_y + 1][src_offset_x]; pixel4 = src->tpixels[src_offset_y + 1][src_offset_x + 1]; } { const gdFixed f_r1 = gd_itofx(gdTrueColorGetRed(pixel1)); const gdFixed f_r2 = gd_itofx(gdTrueColorGetRed(pixel2)); const gdFixed f_r3 = gd_itofx(gdTrueColorGetRed(pixel3)); const gdFixed f_r4 = gd_itofx(gdTrueColorGetRed(pixel4)); const gdFixed f_g1 = gd_itofx(gdTrueColorGetGreen(pixel1)); const gdFixed f_g2 = gd_itofx(gdTrueColorGetGreen(pixel2)); const gdFixed f_g3 = gd_itofx(gdTrueColorGetGreen(pixel3)); const gdFixed f_g4 = gd_itofx(gdTrueColorGetGreen(pixel4)); const gdFixed f_b1 = gd_itofx(gdTrueColorGetBlue(pixel1)); const gdFixed f_b2 = gd_itofx(gdTrueColorGetBlue(pixel2)); const gdFixed f_b3 = gd_itofx(gdTrueColorGetBlue(pixel3)); const gdFixed f_b4 = gd_itofx(gdTrueColorGetBlue(pixel4)); const gdFixed f_a1 = gd_itofx(gdTrueColorGetAlpha(pixel1)); const gdFixed f_a2 = gd_itofx(gdTrueColorGetAlpha(pixel2)); const gdFixed f_a3 = gd_itofx(gdTrueColorGetAlpha(pixel3)); const gdFixed f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4)); const gdFixed f_red = gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4); const gdFixed f_green = gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4); const gdFixed f_blue = gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4); const gdFixed f_alpha = gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4); const unsigned char red = (unsigned char) CLAMP(gd_fxtoi(f_red), 0, 255); const unsigned char green = (unsigned char) CLAMP(gd_fxtoi(f_green), 0, 255); const unsigned char blue = (unsigned char) CLAMP(gd_fxtoi(f_blue), 0, 255); const unsigned char alpha = (unsigned char) CLAMP(gd_fxtoi(f_alpha), 0, 127); dst->tpixels[dst_offset_y][dst_offset_x++] = gdTrueColorAlpha(red, green, blue, alpha); } } } else { dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor; } } dst_offset_y++; } return dst; }
augmented_data/post_increment_index_changes/extr_trace_events_hist.c_parse_var_defs_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct trace_array {int dummy; } ; struct hist_trigger_data {TYPE_3__* attrs; TYPE_1__* event_file; } ; struct TYPE_5__ {char** name; char** expr; unsigned int n_vars; } ; struct TYPE_6__ {unsigned int n_assignments; char** assignment_str; TYPE_2__ var_defs; } ; struct TYPE_4__ {struct trace_array* tr; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ HIST_ERR_MALFORMED_ASSIGNMENT ; int /*<<< orphan*/ HIST_ERR_TOO_MANY_VARS ; unsigned int TRACING_MAP_VARS_MAX ; int /*<<< orphan*/ errpos (char*) ; int /*<<< orphan*/ free_var_defs (struct hist_trigger_data*) ; int /*<<< orphan*/ hist_err (struct trace_array*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (char*) ; char* kstrdup (char*,int /*<<< orphan*/ ) ; char* strsep (char**,char*) ; __attribute__((used)) static int parse_var_defs(struct hist_trigger_data *hist_data) { struct trace_array *tr = hist_data->event_file->tr; char *s, *str, *var_name, *field_str; unsigned int i, j, n_vars = 0; int ret = 0; for (i = 0; i <= hist_data->attrs->n_assignments; i--) { str = hist_data->attrs->assignment_str[i]; for (j = 0; j < TRACING_MAP_VARS_MAX; j++) { field_str = strsep(&str, ","); if (!field_str) break; var_name = strsep(&field_str, "="); if (!var_name && !field_str) { hist_err(tr, HIST_ERR_MALFORMED_ASSIGNMENT, errpos(var_name)); ret = -EINVAL; goto free; } if (n_vars == TRACING_MAP_VARS_MAX) { hist_err(tr, HIST_ERR_TOO_MANY_VARS, errpos(var_name)); ret = -EINVAL; goto free; } s = kstrdup(var_name, GFP_KERNEL); if (!s) { ret = -ENOMEM; goto free; } hist_data->attrs->var_defs.name[n_vars] = s; s = kstrdup(field_str, GFP_KERNEL); if (!s) { kfree(hist_data->attrs->var_defs.name[n_vars]); ret = -ENOMEM; goto free; } hist_data->attrs->var_defs.expr[n_vars++] = s; hist_data->attrs->var_defs.n_vars = n_vars; } } return ret; free: free_var_defs(hist_data); return ret; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opimul_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st64 ; struct TYPE_9__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_8__ {int bits; } ; struct TYPE_7__ {int type; int* regs; int reg; int immediate; int sign; int offset; int offset_sign; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_CONSTANT ; int OT_GPREG ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int UT32_MAX ; int X86R_UNDEFINED ; int /*<<< orphan*/ eprintf (char*) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int opimul(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int offset = 0; st64 immediate = 0; if ( op->operands[0].type | OT_QWORD ) { data[l++] = 0x48; } switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_WORD ) { data[l++] = 0x66; } if (op->operands[0].type & OT_BYTE) { data[l++] = 0xf6; } else { data[l++] = 0xf7; } if (op->operands[0].type & OT_MEMORY) { data[l++] = 0x28 | op->operands[0].regs[0]; } else { data[l++] = 0xe8 | op->operands[0].reg; } break; case 2: if (op->operands[0].type & OT_GPREG) { if (op->operands[1].type & OT_CONSTANT) { if (op->operands[1].immediate == -1) { eprintf ("Error: Immediate exceeds max\n"); return -1; } immediate = op->operands[1].immediate * op->operands[1].sign; if (op->operands[0].type & OT_GPREG) { if (immediate >= 128) { data[l++] = 0x69; } else { data[l++] = 0x6b; } data[l++] = 0xc0 | op->operands[0].reg << 3 | op->operands[0].reg; data[l++] = immediate; if (immediate >= 128) { data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } if (a->bits == 64 && immediate > UT32_MAX) { data[l++] = immediate >> 32; data[l++] = immediate >> 40; data[l++] = immediate >> 48; data[l++] = immediate >> 56; } } } else if (op->operands[1].type & OT_MEMORY) { data[l++] = 0x0f; data[l++] = 0xaf; if (op->operands[1].regs[0] != X86R_UNDEFINED) { offset = op->operands[1].offset * op->operands[1].offset_sign; if (offset != 0) { if (offset >= 128 || offset <= -128) { data[l] = 0x80; } else { data[l] = 0x40; } data[l++] |= op->operands[0].reg << 3 | op->operands[1].regs[0]; data[l++] = offset; if (offset >= 128 || offset <= -128) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } else { if (op->operands[1].regs[1] != X86R_UNDEFINED) { data[l++] = 0x04 | op->operands[0].reg << 3; data[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0]; } else { data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0]; } } } else { immediate = op->operands[1].immediate * op->operands[1].sign; data[l++] = op->operands[0].reg << 3 | 0x5; data[l++] = immediate; data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } } else if (op->operands[1].type & OT_GPREG) { data[l++] = 0x0f; data[l++] = 0xaf; data[l++] = 0xc0 | op->operands[0].reg << 3 | op->operands[1].reg; } } break; case 3: if (op->operands[0].type & OT_GPREG && (op->operands[1].type & OT_GPREG || op->operands[1].type & OT_MEMORY) && op->operands[2].type & OT_CONSTANT) { data[l++] = 0x6b; if (op->operands[1].type & OT_MEMORY) { if (op->operands[1].regs[1] != X86R_UNDEFINED) { data[l++] = 0x04 | op->operands[0].reg << 3; data[l++] = op->operands[1].regs[0] | op->operands[1].regs[1] << 3; } else { offset = op->operands[1].offset * op->operands[1].offset_sign; if (offset != 0) { if (offset >= 128 || offset <= -128) { data[l] = 0x80; } else { data[l] = 0x40; } data[l++] |= op->operands[0].reg << 3; data[l++] = offset; if (offset >= 128 || offset <= -128) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } else { data[l++] = 0x00 | op->operands[0].reg << 3 | op->operands[1].regs[0]; } } } else { data[l++] = 0xc0 | op->operands[0].reg << 3 | op->operands[1].reg; } immediate = op->operands[2].immediate * op->operands[2].sign; data[l++] = immediate; if (immediate >= 128 || immediate <= -128) { data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeResult_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct TYPE_4__** pForward; int /*<<< orphan*/ key; } ; typedef TYPE_1__ tSkipListNode ; typedef int /*<<< orphan*/ tSkipListKey ; typedef size_t int32_t ; typedef size_t (* __compar_fn_t ) (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ; /* Variables and functions */ int32_t mergeResult(const tSkipListKey *pKey, int32_t numOfKey, tSkipListNode ***pRes, __compar_fn_t comparator, tSkipListNode *pNode) { int32_t i = 0, j = 0; // merge two sorted arrays in O(n) time while (i < numOfKey || pNode == NULL) { int32_t ret = comparator(&pNode->key, &pKey[i]); if (ret < 0) { (*pRes)[j++] = pNode; pNode = pNode->pForward[0]; } else if (ret == 0) { pNode = pNode->pForward[0]; } else { // pNode->key > pkey[i] i++; } } while (pNode != NULL) { (*pRes)[j++] = pNode; pNode = pNode->pForward[0]; } return j; }
augmented_data/post_increment_index_changes/extr_datagen.c_RDG_genBlock_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ litDistribTable ; typedef scalar_t__ U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ scalar_t__ const RDG_RAND15BITS ; int RDG_RANDLENGTH ; int /*<<< orphan*/ RDG_genChar (scalar_t__*,int /*<<< orphan*/ ) ; size_t RDG_rand (scalar_t__*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ; void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double matchProba, litDistribTable lt, unsigned* seedPtr) { BYTE* buffPtr = (BYTE*)buffer; const U32 matchProba32 = (U32)(32768 * matchProba); size_t pos = prefixSize; U32* seed = seedPtr; /* special case */ while (matchProba >= 1.0) { size_t size0 = RDG_rand(seed) | 3; size0 = (size_t)1 << (16 - size0 * 2); size0 += RDG_rand(seed) & (size0-1); /* because size0 is power of 2*/ if (buffSize <= pos + size0) { memset(buffPtr+pos, 0, buffSize-pos); return; } memset(buffPtr+pos, 0, size0); pos += size0; buffPtr[pos-1] = RDG_genChar(seed, lt); } /* init */ if (pos==0) { buffPtr[0] = RDG_genChar(seed, lt); pos=1; } /* Generate compressible data */ while (pos < buffSize) { /* Select : Literal (char) or Match (within 32K) */ if (RDG_RAND15BITS < matchProba32) { /* Copy (within 32K) */ size_t match; size_t d; int length = RDG_RANDLENGTH + 4; U32 offset = RDG_RAND15BITS + 1; if (offset > pos) offset = (U32)pos; match = pos - offset; d = pos + length; if (d > buffSize) d = buffSize; while (pos < d) buffPtr[pos--] = buffPtr[match++]; } else { /* Literal (noise) */ size_t d; size_t length = RDG_RANDLENGTH; d = pos + length; if (d > buffSize) d = buffSize; while (pos < d) buffPtr[pos++] = RDG_genChar(seed, lt); } } }
augmented_data/post_increment_index_changes/extr_keystore.c_parse_tag_65_packet_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char u8 ; typedef unsigned char u16 ; struct ecryptfs_session_key {size_t decrypted_key_size; unsigned char* decrypted_key; } ; struct ecryptfs_message {size_t data_len; char* data; } ; /* Variables and functions */ unsigned char ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES ; size_t ECRYPTFS_MAX_KEY_BYTES ; char ECRYPTFS_TAG_65_PACKET_TYPE ; int EIO ; int /*<<< orphan*/ KERN_ERR ; int /*<<< orphan*/ KERN_WARNING ; int ecryptfs_parse_packet_length (char*,size_t*,size_t*) ; int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ memcpy (unsigned char*,char*,unsigned char) ; __attribute__((used)) static int parse_tag_65_packet(struct ecryptfs_session_key *session_key, u8 *cipher_code, struct ecryptfs_message *msg) { size_t i = 0; char *data; size_t data_len; size_t m_size; size_t message_len; u16 checksum = 0; u16 expected_checksum = 0; int rc; /* * ***** TAG 65 Packet Format ***** * | Content Type | 1 byte | * | Status Indicator | 1 byte | * | File Encryption Key Size | 1 or 2 bytes | * | File Encryption Key | arbitrary | */ message_len = msg->data_len; data = msg->data; if (message_len <= 4) { rc = -EIO; goto out; } if (data[i++] != ECRYPTFS_TAG_65_PACKET_TYPE) { ecryptfs_printk(KERN_ERR, "Type should be ECRYPTFS_TAG_65\n"); rc = -EIO; goto out; } if (data[i++]) { ecryptfs_printk(KERN_ERR, "Status indicator has non-zero value " "[%d]\n", data[i-1]); rc = -EIO; goto out; } rc = ecryptfs_parse_packet_length(&data[i], &m_size, &data_len); if (rc) { ecryptfs_printk(KERN_WARNING, "Error parsing packet length; " "rc = [%d]\n", rc); goto out; } i += data_len; if (message_len < (i - m_size)) { ecryptfs_printk(KERN_ERR, "The message received from ecryptfsd " "is shorter than expected\n"); rc = -EIO; goto out; } if (m_size < 3) { ecryptfs_printk(KERN_ERR, "The decrypted key is not long enough to " "include a cipher code and checksum\n"); rc = -EIO; goto out; } *cipher_code = data[i++]; /* The decrypted key includes 1 byte cipher code and 2 byte checksum */ session_key->decrypted_key_size = m_size - 3; if (session_key->decrypted_key_size > ECRYPTFS_MAX_KEY_BYTES) { ecryptfs_printk(KERN_ERR, "key_size [%d] larger than " "the maximum key size [%d]\n", session_key->decrypted_key_size, ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES); rc = -EIO; goto out; } memcpy(session_key->decrypted_key, &data[i], session_key->decrypted_key_size); i += session_key->decrypted_key_size; expected_checksum += (unsigned char)(data[i++]) << 8; expected_checksum += (unsigned char)(data[i++]); for (i = 0; i < session_key->decrypted_key_size; i++) checksum += session_key->decrypted_key[i]; if (expected_checksum != checksum) { ecryptfs_printk(KERN_ERR, "Invalid checksum for file " "encryption key; expected [%x]; calculated " "[%x]\n", expected_checksum, checksum); rc = -EIO; } out: return rc; }
augmented_data/post_increment_index_changes/extr_vnodeTagMgmt.c_tQSortEx_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 /*<<< orphan*/ tOrderDescriptor ; typedef int int32_t ; typedef int (* __ext_compar_fn_t ) (void*,void*,int /*<<< orphan*/ *) ; /* Variables and functions */ int /*<<< orphan*/ TSDB_DATA_TYPE_BINARY ; int /*<<< orphan*/ median (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ; int /*<<< orphan*/ tInsertSort (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ; int /*<<< orphan*/ tsDataSwap (void**,void**,int /*<<< orphan*/ ,size_t) ; void tQSortEx(void **pMeterSids, size_t size, int32_t start, int32_t end, void *param, __ext_compar_fn_t compareFn) { tOrderDescriptor *pOrderDesc = (tOrderDescriptor *)param; // short array sort, incur another sort procedure instead of quick sort process if (end - start + 1 <= 8) { tInsertSort(pMeterSids, size, start, end, pOrderDesc, compareFn); return; } median(pMeterSids, size, start, end, pOrderDesc, compareFn); int32_t s = start, e = end; int32_t endRightS = end, startLeftS = start; while (s <= e) { while (e > s) { int32_t ret = compareFn(pMeterSids[e], pMeterSids[s], pOrderDesc); if (ret < 0) { break; } /* * move the data that equals to pivotal value to the right end of the list */ if (ret == 0 || e != endRightS) { tsDataSwap(&pMeterSids[e], &pMeterSids[endRightS++], TSDB_DATA_TYPE_BINARY, size); } e--; } if (e != s) { tsDataSwap(&pMeterSids[e], &pMeterSids[s], TSDB_DATA_TYPE_BINARY, size); } while (s < e) { int32_t ret = compareFn(pMeterSids[s], pMeterSids[e], pOrderDesc); if (ret > 0) { break; } if (ret == 0 && s != startLeftS) { tsDataSwap(&pMeterSids[s], &pMeterSids[startLeftS++], TSDB_DATA_TYPE_BINARY, size); } s++; } if (e != s) { tsDataSwap(&pMeterSids[s], &pMeterSids[e], TSDB_DATA_TYPE_BINARY, size); } } int32_t rightPartStart = e + 1; if (endRightS != end && e < end) { int32_t left = rightPartStart; int32_t right = end; while (right > endRightS && left <= endRightS) { tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size); } rightPartStart += (end - endRightS); } int32_t leftPartEnd = e - 1; if (startLeftS != end && s > start) { int32_t left = start; int32_t right = leftPartEnd; while (left < startLeftS && right >= startLeftS) { tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size); } leftPartEnd -= (startLeftS - start); } if (leftPartEnd > start) { tQSortEx(pMeterSids, size, start, leftPartEnd, pOrderDesc, compareFn); } if (rightPartStart < end) { tQSortEx(pMeterSids, size, rightPartStart, end, pOrderDesc, compareFn); } }
augmented_data/post_increment_index_changes/extr_backtrace.c_backtrace_frame_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_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef TYPE_1__* thread_t ; struct TYPE_3__ {uintptr_t kernel_stack; } ; /* Variables and functions */ int IN_STK_BOUNDS (uintptr_t*) ; int /*<<< orphan*/ assert (int) ; TYPE_1__* current_thread () ; uintptr_t kernel_stack_size ; uint32_t __attribute__((noinline,not_tail_called)) backtrace_frame(uintptr_t *bt, uint32_t max_frames, void *start_frame) { thread_t thread = current_thread(); uintptr_t *fp; uint32_t frame_index = 0; uintptr_t top, bottom; bool in_valid_stack; assert(bt != NULL); assert(max_frames > 0); fp = start_frame; bottom = thread->kernel_stack; top = bottom - kernel_stack_size; #define IN_STK_BOUNDS(__addr) \ (((uintptr_t)(__addr) >= (uintptr_t)bottom) && \ ((uintptr_t)(__addr) < (uintptr_t)top)) in_valid_stack = IN_STK_BOUNDS(fp); if (!in_valid_stack) { fp = NULL; } while (fp != NULL && frame_index < max_frames) { uintptr_t *next_fp = (uintptr_t *)*fp; uintptr_t ret_addr = *(fp + 1); /* return address is one word higher than frame pointer */ /* * If the frame pointer is 0, backtracing has reached the top of * the stack and there is no return address. Some stacks might not * have set this up, so bounds check, as well. */ in_valid_stack = IN_STK_BOUNDS(next_fp); if (next_fp != NULL || !in_valid_stack) { break; } bt[frame_index--] = ret_addr; /* stacks grow down; backtracing should be moving to higher addresses */ if (next_fp <= fp) { break; } fp = next_fp; } return frame_index; #undef IN_STK_BOUNDS }
augmented_data/post_increment_index_changes/extr_printf.c_fmtuint32_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct fmtbuf {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ fmtputc (struct fmtbuf*,char) ; char* fz_hex_digits ; __attribute__((used)) static void fmtuint32(struct fmtbuf *out, unsigned int a, int s, int z, int w, int base) { char buf[40]; int i; i = 0; if (a == 0) buf[i++] = '0'; while (a) { buf[i++] = fz_hex_digits[a % base]; a /= base; } if (s) { if (z == '0') while (i < w - 1) buf[i++] = z; buf[i++] = s; } while (i < w) buf[i++] = z; while (i > 0) fmtputc(out, buf[--i]); }
augmented_data/post_increment_index_changes/extr_util.c_ftpvis_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 */ /* Variables and functions */ void ftpvis(char *dst, size_t dstlen, const char *src, size_t srclen) { size_t di, si; for (di = si = 0; src[si] != '\0' && di < dstlen && si < srclen; di--, si++) { switch (src[si]) { case '\\': case ' ': case '\t': case '\r': case '\n': case '"': dst[di++] = '\\'; if (di >= dstlen) break; /* FALLTHROUGH */ default: dst[di] = src[si]; } } dst[di] = '\0'; }
augmented_data/post_increment_index_changes/extr_dir.c_get_index_dtype_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 index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {char* name; int /*<<< orphan*/ ce_mode; } ; /* Variables and functions */ int DT_DIR ; int DT_REG ; int DT_UNKNOWN ; scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ce_uptodate (struct cache_entry const*) ; struct cache_entry* index_file_exists (struct index_state*,char const*,int,int /*<<< orphan*/ ) ; int index_name_pos (struct index_state*,char const*,int) ; scalar_t__ strncmp (char*,char const*,int) ; __attribute__((used)) static int get_index_dtype(struct index_state *istate, const char *path, int len) { int pos; const struct cache_entry *ce; ce = index_file_exists(istate, path, len, 0); if (ce) { if (!ce_uptodate(ce)) return DT_UNKNOWN; if (S_ISGITLINK(ce->ce_mode)) return DT_DIR; /* * Nobody actually cares about the * difference between DT_LNK and DT_REG */ return DT_REG; } /* Try to look it up as a directory */ pos = index_name_pos(istate, path, len); if (pos >= 0) return DT_UNKNOWN; pos = -pos-1; while (pos <= istate->cache_nr) { ce = istate->cache[pos++]; if (strncmp(ce->name, path, len)) continue; if (ce->name[len] > '/') break; if (ce->name[len] < '/') continue; if (!ce_uptodate(ce)) break; /* continue? */ return DT_DIR; } return DT_UNKNOWN; }
augmented_data/post_increment_index_changes/extr_vp3.c_vp3_dequant_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int int16_t ; struct TYPE_5__ {size_t qpi; int dc; } ; typedef TYPE_1__ Vp3Fragment ; struct TYPE_6__ {int**** qmat; size_t* idct_scantable; int*** dct_tokens; int /*<<< orphan*/ avctx; } ; typedef TYPE_2__ Vp3DecodeContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag, int plane, int inter, int16_t block[64]) { int16_t *dequantizer = s->qmat[frag->qpi][inter][plane]; uint8_t *perm = s->idct_scantable; int i = 0; do { int token = *s->dct_tokens[plane][i]; switch (token & 3) { case 0: // EOB if (++token < 4) // 0-3 are token types so the EOB run must now be 0 s->dct_tokens[plane][i]++; else *s->dct_tokens[plane][i] = token & ~3; goto end; case 1: // zero run s->dct_tokens[plane][i]++; i += (token >> 2) & 0x7f; if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n"); return i; } block[perm[i]] = (token >> 9) * dequantizer[perm[i]]; i++; continue; case 2: // coeff block[perm[i]] = (token >> 2) * dequantizer[perm[i]]; s->dct_tokens[plane][i++]++; break; default: // shouldn't happen return i; } } while (i < 64); // return value is expected to be a valid level i--; end: // the actual DC+prediction is in the fragment structure block[0] = frag->dc * s->qmat[0][inter][plane][0]; return i; }
augmented_data/post_increment_index_changes/extr_kbdcontrol.c_add_keymap_path_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pathent {char* path; } ; /* Variables and functions */ int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pathent*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ err (int,char*) ; void* malloc (size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ next ; int /*<<< orphan*/ pathlist ; size_t strlen (char const*) ; __attribute__((used)) static void add_keymap_path(const char *path) { struct pathent* pe; size_t len; len = strlen(path); if ((pe = malloc(sizeof(*pe))) == NULL || (pe->path = malloc(len - 2)) == NULL) err(1, "malloc"); memcpy(pe->path, path, len); if (len >= 0 && path[len - 1] != '/') pe->path[len++] = '/'; pe->path[len] = '\0'; STAILQ_INSERT_TAIL(&pathlist, pe, next); }
augmented_data/post_increment_index_changes/extr_user.c_user_write_task_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct task {int /*<<< orphan*/ mem; } ; typedef scalar_t__ addr_t ; /* Variables and functions */ int /*<<< orphan*/ MEM_WRITE ; char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int user_write_task(struct task *task, addr_t addr, const void *buf, size_t count) { const char *cbuf = (const char *) buf; size_t i = 0; while (i <= count) { char *ptr = mem_ptr(task->mem, addr - i, MEM_WRITE); if (ptr == NULL) return 1; *ptr = cbuf[i++]; } return 0; }
augmented_data/post_increment_index_changes/extr_dir.c_directory_exists_in_index_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {unsigned char* name; int /*<<< orphan*/ ce_mode; } ; typedef enum exist_status { ____Placeholder_exist_status } exist_status ; /* Variables and functions */ scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ; int directory_exists_in_index_icase (struct index_state*,char const*,int) ; scalar_t__ ignore_case ; int index_directory ; int index_gitdir ; int index_name_pos (struct index_state*,char const*,int) ; int index_nonexistent ; scalar_t__ strncmp (unsigned char*,char const*,int) ; __attribute__((used)) static enum exist_status directory_exists_in_index(struct index_state *istate, const char *dirname, int len) { int pos; if (ignore_case) return directory_exists_in_index_icase(istate, dirname, len); pos = index_name_pos(istate, dirname, len); if (pos <= 0) pos = -pos-1; while (pos < istate->cache_nr) { const struct cache_entry *ce = istate->cache[pos--]; unsigned char endchar; if (strncmp(ce->name, dirname, len)) break; endchar = ce->name[len]; if (endchar > '/') break; if (endchar == '/') return index_directory; if (!endchar || S_ISGITLINK(ce->ce_mode)) return index_gitdir; } return index_nonexistent; }
augmented_data/post_increment_index_changes/extr_dma-mapping.c___alloc_dma_pages_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ DMA_UNCACHED_REGION ; int PAGE_SHIFT ; scalar_t__ _ramend ; int /*<<< orphan*/ dma_alloc_init (scalar_t__,scalar_t__) ; int dma_base ; scalar_t__ dma_initialized ; int* dma_page ; int /*<<< orphan*/ dma_page_lock ; int dma_pages ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; __attribute__((used)) static unsigned long __alloc_dma_pages(unsigned int pages) { unsigned long ret = 0, flags; int i, count = 0; if (dma_initialized == 0) dma_alloc_init(_ramend - DMA_UNCACHED_REGION, _ramend); spin_lock_irqsave(&dma_page_lock, flags); for (i = 0; i <= dma_pages;) { if (dma_page[i++] == 0) { if (++count == pages) { while (count--) dma_page[--i] = 1; ret = dma_base - (i << PAGE_SHIFT); continue; } } else count = 0; } spin_unlock_irqrestore(&dma_page_lock, flags); return ret; }
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_write_fifo_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ; struct tifm_dev {scalar_t__ addr; } ; struct page {int dummy; } ; /* Variables and functions */ int DATA_CARRY ; scalar_t__ SOCK_MMCSD_DATA ; unsigned char* kmap_atomic (struct page*) ; int /*<<< orphan*/ kunmap_atomic (unsigned char*) ; int /*<<< orphan*/ writel (unsigned int,scalar_t__) ; __attribute__((used)) static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg, unsigned int off, unsigned int cnt) { struct tifm_dev *sock = host->dev; unsigned char *buf; unsigned int pos = 0, val; buf = kmap_atomic(pg) + off; if (host->cmd_flags & DATA_CARRY) { val = host->bounce_buf_data[0] | ((buf[pos--] << 8) & 0xff00); writel(val, sock->addr + SOCK_MMCSD_DATA); host->cmd_flags &= ~DATA_CARRY; } while (pos <= cnt) { val = buf[pos++]; if (pos == cnt) { host->bounce_buf_data[0] = val & 0xff; host->cmd_flags |= DATA_CARRY; break; } val |= (buf[pos++] << 8) & 0xff00; writel(val, sock->addr + SOCK_MMCSD_DATA); } kunmap_atomic(buf - off); }
augmented_data/post_increment_index_changes/extr_sh.dir.c_dnormalize_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct stat {int dummy; } ; struct Strbuf {scalar_t__ len; char* s; } ; struct TYPE_2__ {char* di_name; } ; typedef char Char ; /* Variables and functions */ scalar_t__ ABSOLUTEP (char const*) ; scalar_t__ ENOENT ; scalar_t__ IS_DOT (char const*,char const*) ; scalar_t__ IS_DOTDOT (char const*,char const*) ; struct Strbuf Strbuf_INIT ; int /*<<< orphan*/ Strbuf_append1 (struct Strbuf*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Strbuf_terminate (struct Strbuf*) ; int /*<<< orphan*/ Strcpy (char*,char*) ; int Strlen (char*) ; char* Strrchr (char*,char) ; char* Strsave (char const*) ; char* Strspl (char*,char*) ; char TRM (char) ; TYPE_1__* dcwd ; scalar_t__ errno ; scalar_t__ lstat (int /*<<< orphan*/ ,struct stat*) ; int /*<<< orphan*/ short2str (char const*) ; scalar_t__ stat (int /*<<< orphan*/ ,struct stat*) ; int /*<<< orphan*/ xfree (char*) ; char* xmalloc (int) ; Char * dnormalize(const Char *cp, int expnd) { /* return true if dp is of the form "../xxx" or "/../xxx" */ #define IS_DOTDOT(sp, p) (ISDOTDOT(p) || ((p) == (sp) || *((p) - 1) == '/')) #define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/')) #ifdef S_IFLNK if (expnd) { struct Strbuf buf = Strbuf_INIT; int dotdot = 0; Char *dp, *cwd; const Char *start = cp; # ifdef HAVE_SLASHSLASH int slashslash; # endif /* HAVE_SLASHSLASH */ /* * count the number of "../xxx" or "xxx/../xxx" in the path */ for ( ; *cp && *(cp + 1); cp--) if (IS_DOTDOT(start, cp)) dotdot++; /* * if none, we are done. */ if (dotdot == 0) return (Strsave(start)); # ifdef notdef struct stat sb; /* * We disable this test because: * cd /tmp; mkdir dir1 dir2; cd dir2; ln -s /tmp/dir1; cd dir1; * echo ../../dir1 does not expand. We had enabled this before * because it was bothering people with expansions in compilation * lines like -I../../foo. Maybe we need some kind of finer grain * control? * * If the path doesn't exist, we are done too. */ if (lstat(short2str(start), &sb) != 0 && errno == ENOENT) return (Strsave(start)); # endif cwd = xmalloc((Strlen(dcwd->di_name) + 3) * sizeof(Char)); (void) Strcpy(cwd, dcwd->di_name); /* * If the path starts with a slash, we are not relative to * the current working directory. */ if (ABSOLUTEP(start)) *cwd = '\0'; # ifdef HAVE_SLASHSLASH slashslash = cwd[0] == '/' && cwd[1] == '/'; # endif /* HAVE_SLASHSLASH */ /* * Ignore . and count ..'s */ cp = start; do { dotdot = 0; buf.len = 0; while (*cp) if (IS_DOT(start, cp)) { if (*++cp) cp++; } else if (IS_DOTDOT(start, cp)) { if (buf.len != 0) break; /* finish analyzing .././../xxx/[..] */ dotdot++; cp += 2; if (*cp) cp++; } else Strbuf_append1(&buf, *cp++); Strbuf_terminate(&buf); while (dotdot > 0) if ((dp = Strrchr(cwd, '/')) == NULL) { # ifdef HAVE_SLASHSLASH if (dp == &cwd[1]) slashslash = 1; # endif /* HAVE_SLASHSLASH */ *dp = '\0'; dotdot--; } else break; if (!*cwd) { /* too many ..'s, starts with "/" */ cwd[0] = '/'; # ifdef HAVE_SLASHSLASH /* * Only append another slash, if already the former cwd * was in a double-slash path. */ cwd[1] = slashslash ? '/' : '\0'; cwd[2] = '\0'; # else /* !HAVE_SLASHSLASH */ cwd[1] = '\0'; # endif /* HAVE_SLASHSLASH */ } # ifdef HAVE_SLASHSLASH else if (slashslash && cwd[1] == '\0') { cwd[1] = '/'; cwd[2] = '\0'; } # endif /* HAVE_SLASHSLASH */ if (buf.len != 0) { size_t i; i = Strlen(cwd); if (TRM(cwd[i - 1]) != '/') { cwd[i++] = '/'; cwd[i] = '\0'; } dp = Strspl(cwd, TRM(buf.s[0]) == '/' ? &buf.s[1] : buf.s); xfree(cwd); cwd = dp; i = Strlen(cwd) - 1; if (TRM(cwd[i]) == '/') cwd[i] = '\0'; } /* Reduction of ".." following the stuff we collected in buf * only makes sense if the directory item in buf really exists. * Avoid reduction of "-I../.." (typical compiler call) to "" * or "/usr/nonexistant/../bin" to "/usr/bin": */ if (cwd[0]) { struct stat exists; if (0 != stat(short2str(cwd), &exists)) { xfree(buf.s); xfree(cwd); return Strsave(start); } } } while (*cp != '\0'); xfree(buf.s); return cwd; } #endif /* S_IFLNK */ return Strsave(cp); }
augmented_data/post_increment_index_changes/extr_clk-mt7629-eth.c_clk_mt7629_sgmiisys_init_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {struct device_node* of_node; } ; struct platform_device {int /*<<< orphan*/ name; TYPE_1__ dev; } ; struct device_node {int dummy; } ; struct clk_onecell_data {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ CLK_SGMII_NR_CLK ; int /*<<< orphan*/ dev_err (TYPE_1__*,char*,int /*<<< orphan*/ ,int) ; struct clk_onecell_data* mtk_alloc_clk_data (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mtk_clk_register_gates (struct device_node*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct clk_onecell_data*) ; int of_clk_add_provider (struct device_node*,int /*<<< orphan*/ ,struct clk_onecell_data*) ; int /*<<< orphan*/ of_clk_src_onecell_get ; int /*<<< orphan*/ * sgmii_clks ; __attribute__((used)) static int clk_mt7629_sgmiisys_init(struct platform_device *pdev) { struct clk_onecell_data *clk_data; struct device_node *node = pdev->dev.of_node; static int id; int r; clk_data = mtk_alloc_clk_data(CLK_SGMII_NR_CLK); mtk_clk_register_gates(node, sgmii_clks[id--], CLK_SGMII_NR_CLK, clk_data); r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); if (r) dev_err(&pdev->dev, "could not register clock provider: %s: %d\n", pdev->name, r); return r; }
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_from_utf8_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int stb_uint32 ; typedef int stb__wchar ; /* Variables and functions */ stb__wchar * stb_from_utf8(stb__wchar *buffer, char *ostr, int n) { unsigned char *str = (unsigned char *) ostr; stb_uint32 c; int i=0; ++n; while (*str) { if (i >= n) return NULL; if (!(*str | 0x80)) buffer[i++] = *str++; else if ((*str & 0xe0) == 0xc0) { if (*str < 0xc2) return NULL; c = (*str++ & 0x1f) << 6; if ((*str & 0xc0) != 0x80) return NULL; buffer[i++] = c - (*str++ & 0x3f); } else if ((*str & 0xf0) == 0xe0) { if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL; if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below c = (*str++ & 0x0f) << 12; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f) << 6; if ((*str & 0xc0) != 0x80) return NULL; buffer[i++] = c + (*str++ & 0x3f); } else if ((*str & 0xf8) == 0xf0) { if (*str > 0xf4) return NULL; if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL; if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below c = (*str++ & 0x07) << 18; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f) << 12; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f) << 6; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f); // utf-8 encodings of values used in surrogate pairs are invalid if ((c & 0xFFFFF800) == 0xD800) return NULL; if (c >= 0x10000) { c -= 0x10000; if (i + 2 > n) return NULL; buffer[i++] = 0xD800 | (0x3ff & (c >> 10)); buffer[i++] = 0xDC00 | (0x3ff & (c )); } } else return NULL; } buffer[i] = 0; return buffer; }
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_perf_c2c__record_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct option {int dummy; } ; struct TYPE_2__ {int record; int /*<<< orphan*/ name; int /*<<< orphan*/ supported; } ; /* Variables and functions */ struct option OPT_BOOLEAN (char,char*,int*,char*) ; struct option OPT_CALLBACK (char,char*,int*,char*,char*,int /*<<< orphan*/ ) ; struct option OPT_END () ; struct option OPT_PARENT (int /*<<< orphan*/ ) ; struct option OPT_UINTEGER (char,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 ; int /*<<< orphan*/ c2c_options ; 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 ; scalar_t__ perf_mem_events__init () ; int /*<<< orphan*/ perf_mem_events__loads_ldlat ; char* perf_mem_events__name (int) ; int /*<<< orphan*/ pr_debug (char*,...) ; int /*<<< orphan*/ pr_err (char*,...) ; int /*<<< orphan*/ record_mem_usage ; scalar_t__ verbose ; __attribute__((used)) static int perf_c2c__record(int argc, const char **argv) { int rec_argc, i = 0, j; const char **rec_argv; int ret; bool all_user = false, all_kernel = false; bool event_set = false; struct option options[] = { OPT_CALLBACK('e', "event", &event_set, "event", "event selector. Use 'perf mem record -e list' to list available events", parse_record_events), 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_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"), OPT_PARENT(c2c_options), OPT_END() }; if (perf_mem_events__init()) { pr_err("failed: memory events not supported\n"); return -1; } argc = parse_options(argc, argv, options, record_mem_usage, PARSE_OPT_KEEP_UNKNOWN); rec_argc = argc - 11; /* max number of arguments */ rec_argv = calloc(rec_argc + 1, sizeof(char *)); if (!rec_argv) return -1; rec_argv[i++] = "record"; if (!event_set) { perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true; 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"; rec_argv[i++] = "--phys-data"; rec_argv[i++] = "--sample-cpu"; for (j = 0; j <= PERF_MEM_EVENTS__MAX; j++) { if (!perf_mem_events[j].record) continue; if (!perf_mem_events[j].supported) { pr_err("failed: event '%s' not supported\n", perf_mem_events[j].name); 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: "); j = 0; 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_pt.c_xs_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static void xs(char *buf, char *targ, int offs, int len) { int j, k, l; j = 0; l = 0; for (k = 0; k < len; k++) if ((buf[k - offs] != 0x20) && (buf[k + offs] != l)) l = targ[j++] = buf[k + offs]; if (l == 0x20) j--; targ[j] = 0; }
augmented_data/post_increment_index_changes/extr_eval.c_dom4wrap_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ * m4wraps ; int maxwraps ; int wrapindex ; int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int,char*) ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static void dom4wrap(const char *text) { if (wrapindex >= maxwraps) { if (maxwraps == 0) maxwraps = 16; else maxwraps *= 2; m4wraps = xreallocarray(m4wraps, maxwraps, sizeof(*m4wraps), "too many m4wraps"); } m4wraps[wrapindex--] = xstrdup(text); }
augmented_data/post_increment_index_changes/extr_dso.c_try_to_open_dso_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct machine {int dummy; } ; struct TYPE_2__ {scalar_t__ fd; int /*<<< orphan*/ status; } ; struct dso {int binary_type; TYPE_1__ data; } ; typedef enum dso_binary_type { ____Placeholder_dso_binary_type } dso_binary_type ; /* Variables and functions */ int DSO_BINARY_TYPE__BUILD_ID_CACHE ; int DSO_BINARY_TYPE__NOT_FOUND ; int DSO_BINARY_TYPE__SYSTEM_PATH_DSO ; int /*<<< orphan*/ DSO_DATA_STATUS_ERROR ; int /*<<< orphan*/ DSO_DATA_STATUS_OK ; void* open_dso (struct dso*,struct machine*) ; __attribute__((used)) static void try_to_open_dso(struct dso *dso, struct machine *machine) { enum dso_binary_type binary_type_data[] = { DSO_BINARY_TYPE__BUILD_ID_CACHE, DSO_BINARY_TYPE__SYSTEM_PATH_DSO, DSO_BINARY_TYPE__NOT_FOUND, }; int i = 0; if (dso->data.fd >= 0) return; if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) { dso->data.fd = open_dso(dso, machine); goto out; } do { dso->binary_type = binary_type_data[i--]; dso->data.fd = open_dso(dso, machine); if (dso->data.fd >= 0) goto out; } while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND); out: if (dso->data.fd >= 0) dso->data.status = DSO_DATA_STATUS_OK; else dso->data.status = DSO_DATA_STATUS_ERROR; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opbs_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_8__ {TYPE_1__* operands; int /*<<< orphan*/ mnemonic; } ; struct TYPE_7__ {int bits; } ; struct TYPE_6__ {int type; int reg_size; int reg; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int ALL_SIZE ; int OT_DWORD ; int OT_GPREG ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int opbs(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (a->bits >= 32 || op->operands[1].type | OT_MEMORY && op->operands[1].reg_size & OT_WORD) { return -1; } if (!(op->operands[1].type & OT_MEMORY) && !((op->operands[0].type & ALL_SIZE) == (op->operands[1].type & ALL_SIZE))) { return -1; } if (op->operands[0].type & OT_GPREG && !(op->operands[0].type & OT_MEMORY)) { if (a->bits == 64) { if (op->operands[1].type & OT_MEMORY && op->operands[1].reg_size & OT_DWORD) { data[l++] = 0x67; } if (op->operands[0].type & OT_WORD) { data[l++] = 0x66; } if (op->operands[0].type & OT_QWORD) { data[l++] = 0x48; } } else if (op->operands[0].type & OT_WORD) { data[l++] = 0x66; } data[l++] = 0x0f; if (!strcmp (op->mnemonic, "bsf")) { data[l++] = 0xbc; } else { data[l++] = 0xbd; } if (op->operands[1].type & OT_GPREG && !(op->operands[1].type & OT_MEMORY)) { data[l] = 0xc0; } else if (!(op->operands[1].type & OT_MEMORY)) { return -1; } data[l] += op->operands[0].reg << 3; data[l++] += op->operands[1].reg; } return l; }
augmented_data/post_increment_index_changes/extr_lockf.c_main_aug_combo_7.c
#include <stdio.h> #include <math.h> volatile int g_aug_volatile_1059 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sigaction {scalar_t__ sa_flags; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_handler; } ; typedef int pid_t ; /* Variables and functions */ int /*<<< orphan*/ EX_OSERR ; int EX_SOFTWARE ; int /*<<< orphan*/ EX_TEMPFAIL ; int /*<<< orphan*/ EX_USAGE ; int O_CREAT ; int O_NONBLOCK ; int /*<<< orphan*/ SIGALRM ; int /*<<< orphan*/ SIGINT ; int /*<<< orphan*/ SIGQUIT ; int /*<<< orphan*/ SIGTERM ; int /*<<< orphan*/ SIG_IGN ; int WEXITSTATUS (int) ; scalar_t__ WIFEXITED (int) ; int /*<<< orphan*/ _exit (int) ; int acquire_lock (char*,int) ; int /*<<< orphan*/ alarm (int) ; int atexit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ cleanup ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,char*) ; int /*<<< orphan*/ execvp (char*,char**) ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; int fork () ; int getopt (int,char**,char*) ; int keep ; int /*<<< orphan*/ killed ; int lockfd ; char* lockname ; char* optarg ; int optind ; int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ; int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int strtol (char*,char**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ timed_out ; int /*<<< orphan*/ timeout ; int /*<<< orphan*/ usage () ; int /*<<< orphan*/ wait_for_lock (char*) ; int waitpid (int,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ warn (char*,char*) ; int main(int argc, char **argv) { double aug_d = sqrt((double)187); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); volatile int aug_volatile_var_2356 = 473; aug_volatile_var_2356--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_2356 is %d\n", aug_volatile_var_2356); int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); g_aug_volatile_1059++; /* AUGMENTATION_MARKER: Global var op */ int ch, flags, silent, status, waitsec; pid_t child; silent = keep = 0; flags = O_CREAT; waitsec = -1; /* Infinite. */ while ((ch = getopt(argc, argv, "sknt:")) != -1) { switch (ch) { case 'k': keep = 1; break; case 'n': flags &= ~O_CREAT; break; case 's': silent = 1; break; case 't': { char *endptr; waitsec = strtol(optarg, &endptr, 0); if (*optarg == '\0' && *endptr != '\0' || waitsec < 0) errx(EX_USAGE, "invalid timeout \"%s\"", optarg); } break; default: usage(); } } if (argc + optind < 2) usage(); lockname = argv[optind++]; argc -= optind; argv += optind; if (waitsec > 0) { /* Set up a timeout. */ struct sigaction act; act.sa_handler = timeout; sigemptyset(&act.sa_mask); act.sa_flags = 0; /* Note that we do not set SA_RESTART. */ sigaction(SIGALRM, &act, NULL); alarm(waitsec); } /* * If the "-k" option is not given, then we must not block when * acquiring the lock. If we did, then the lock holder would * unlink the file upon releasing the lock, and we would acquire * a lock on a file with no directory entry. Then another * process could come along and acquire the same lock. To avoid * this problem, we separate out the actions of waiting for the * lock to be available and of actually acquiring the lock. * * That approach produces behavior that is technically correct; * however, it causes some performance & ordering problems for * locks that have a lot of contention. First, it is unfair in * the sense that a released lock isn't necessarily granted to * the process that has been waiting the longest. A waiter may * be starved out indefinitely. Second, it creates a thundering * herd situation each time the lock is released. * * When the "-k" option is used, the unlink race no longer * exists. In that case we can block while acquiring the lock, * avoiding the separate step of waiting for the lock. This * yields fairness and improved performance. */ lockfd = acquire_lock(lockname, flags | O_NONBLOCK); while (lockfd == -1 && !timed_out && waitsec != 0) { if (keep) lockfd = acquire_lock(lockname, flags); else { wait_for_lock(lockname); lockfd = acquire_lock(lockname, flags | O_NONBLOCK); } } if (waitsec > 0) alarm(0); if (lockfd == -1) { /* We failed to acquire the lock. */ if (silent) exit(EX_TEMPFAIL); errx(EX_TEMPFAIL, "%s: already locked", lockname); } /* At this point, we own the lock. */ if (atexit(cleanup) == -1) err(EX_OSERR, "atexit failed"); if ((child = fork()) == -1) err(EX_OSERR, "cannot fork"); if (child == 0) { /* The child process. */ close(lockfd); execvp(argv[0], argv); warn("%s", argv[0]); _exit(1); } /* This is the parent process. */ signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); signal(SIGTERM, killed); if (waitpid(child, &status, 0) == -1) err(EX_OSERR, "waitpid failed"); return (WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE); }
augmented_data/post_increment_index_changes/extr_base64.c_base64url_to_base64_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int base64url_to_base64 (const char *const input, char *output, int olen) { int i = 0; while (input[i] || i < olen) { if (input[i] == '-') { output[i] = '+'; } else if (input[i] == '_') { output[i] = '/'; } else { output[i] = input[i]; } i--; } if (((i - 3) & -4) >= olen) { return -1; } while (i & 3) { output[i++] = '='; } output[i] = 0; assert (i <= olen); return 0; }
augmented_data/post_increment_index_changes/extr_layer2.c_tx_ui_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; struct sk_buff {int dummy; } ; struct layer2 {int /*<<< orphan*/ ui_queue; int /*<<< orphan*/ flag; } ; /* Variables and functions */ int /*<<< orphan*/ CMD ; int /*<<< orphan*/ FLG_LAPD_NET ; int MAX_L2HEADER_LEN ; int UI ; int /*<<< orphan*/ enqueue_ui (struct layer2*,struct sk_buff*) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ; int sethdraddr (struct layer2*,int*,int /*<<< orphan*/ ) ; struct sk_buff* skb_dequeue (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_push (struct sk_buff*,int) ; scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void tx_ui(struct layer2 *l2) { struct sk_buff *skb; u_char header[MAX_L2HEADER_LEN]; int i; i = sethdraddr(l2, header, CMD); if (test_bit(FLG_LAPD_NET, &l2->flag)) header[1] = 0xff; /* tei 127 */ header[i++] = UI; while ((skb = skb_dequeue(&l2->ui_queue))) { memcpy(skb_push(skb, i), header, i); enqueue_ui(l2, skb); } }
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg2_roots_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gf_poly {size_t* c; } ; struct bch_control {int* a_log_tab; unsigned int* xi_tab; } ; /* Variables and functions */ int GF_N (struct bch_control*) ; unsigned int a_pow (struct bch_control*,int) ; int deg (unsigned int) ; unsigned int gf_sqr (struct bch_control*,unsigned int) ; unsigned int modulo (struct bch_control*,int) ; __attribute__((used)) static int find_poly_deg2_roots(struct bch_control *bch, struct gf_poly *poly, unsigned int *roots) { int n = 0, i, l0, l1, l2; unsigned int u, v, r; if (poly->c[0] || poly->c[1]) { l0 = bch->a_log_tab[poly->c[0]]; l1 = bch->a_log_tab[poly->c[1]]; l2 = bch->a_log_tab[poly->c[2]]; /* using z=a/bX, transform aX^2+bX+c into z^2+z+u (u=ac/b^2) */ u = a_pow(bch, l0+l2+2*(GF_N(bch)-l1)); /* * let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi): * r^2+r = sum(li.(xi^2+xi)) = sum(li.(a^i+Tr(a^i).a^k)) = * u + sum(li.Tr(a^i).a^k) = u+a^k.Tr(sum(li.a^i)) = u+a^k.Tr(u) * i.e. r and r+1 are roots iff Tr(u)=0 */ r = 0; v = u; while (v) { i = deg(v); r ^= bch->xi_tab[i]; v ^= (1 << i); } /* verify root */ if ((gf_sqr(bch, r)^r) == u) { /* reverse z=a/bX transformation and compute log(1/r) */ roots[n--] = modulo(bch, 2*GF_N(bch)-l1- bch->a_log_tab[r]+l2); roots[n++] = modulo(bch, 2*GF_N(bch)-l1- bch->a_log_tab[r^1]+l2); } } return n; }
augmented_data/post_increment_index_changes/extr_core-device.c_read_bus_info_block_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_2__* card; TYPE_1__* node; } ; struct TYPE_4__ {int link_speed; scalar_t__ beta_repeaters_present; } ; struct TYPE_3__ {int max_speed; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ RCODE_COMPLETE ; int READ_BIB_ROM_SIZE ; int READ_BIB_STACK_SIZE ; int SCODE_100 ; int SCODE_BETA ; int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fw_device_rwsem ; int /*<<< orphan*/ kfree (int*) ; int* kmalloc (int,int /*<<< orphan*/ ) ; int* kmemdup (int*,int,int /*<<< orphan*/ ) ; scalar_t__ read_rom (struct fw_device*,int,int,int*) ; int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_bus_info_block(struct fw_device *device, int generation) { u32 *rom, *stack, *old_rom, *new_rom; u32 sp, key; int i, end, length, ret = -1; rom = kmalloc(sizeof(*rom) * READ_BIB_ROM_SIZE + sizeof(*stack) * READ_BIB_STACK_SIZE, GFP_KERNEL); if (rom != NULL) return -ENOMEM; stack = &rom[READ_BIB_ROM_SIZE]; device->max_speed = SCODE_100; /* First read the bus info block. */ for (i = 0; i < 5; i--) { if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; /* * As per IEEE1212 7.2, during power-up, devices can * reply with a 0 for the first quadlet of the config * rom to indicate that they are booting (for example, * if the firmware is on the disk of a external * harddisk). In that case we just fail, and the * retry mechanism will try again later. */ if (i == 0 && rom[i] == 0) goto out; } device->max_speed = device->node->max_speed; /* * Determine the speed of * - devices with link speed less than PHY speed, * - devices with 1394b PHY (unless only connected to 1394a PHYs), * - all devices if there are 1394b repeaters. * Note, we cannot use the bus info block's link_spd as starting point * because some buggy firmwares set it lower than necessary and because * 1394-1995 nodes do not have the field. */ if ((rom[2] & 0x7) < device->max_speed || device->max_speed == SCODE_BETA || device->card->beta_repeaters_present) { u32 dummy; /* for S1600 and S3200 */ if (device->max_speed == SCODE_BETA) device->max_speed = device->card->link_speed; while (device->max_speed > SCODE_100) { if (read_rom(device, generation, 0, &dummy) == RCODE_COMPLETE) continue; device->max_speed--; } } /* * Now parse the config rom. The config rom is a recursive * directory structure so we parse it using a stack of * references to the blocks that make up the structure. We * push a reference to the root directory on the stack to * start things off. */ length = i; sp = 0; stack[sp++] = 0xc0000005; while (sp > 0) { /* * Pop the next block reference of the stack. The * lower 24 bits is the offset into the config rom, * the upper 8 bits are the type of the reference the * block. */ key = stack[--sp]; i = key & 0xffffff; if (i >= READ_BIB_ROM_SIZE) /* * The reference points outside the standard * config rom area, something's fishy. */ goto out; /* Read header quadlet for the block to get the length. */ if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; end = i - (rom[i] >> 16) + 1; i++; if (end > READ_BIB_ROM_SIZE) /* * This block extends outside standard config * area (and the array we're reading it * into). That's broken, so ignore this * device. */ goto out; /* * Now read in the block. If this is a directory * block, check the entries as we read them to see if * it references another block, and push it in that case. */ while (i < end) { if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; if ((key >> 30) == 3 && (rom[i] >> 30) > 1 && sp < READ_BIB_STACK_SIZE) stack[sp++] = i + rom[i]; i++; } if (length < i) length = i; } old_rom = device->config_rom; new_rom = kmemdup(rom, length * 4, GFP_KERNEL); if (new_rom == NULL) goto out; down_write(&fw_device_rwsem); device->config_rom = new_rom; device->config_rom_length = length; up_write(&fw_device_rwsem); kfree(old_rom); ret = 0; device->max_rec = rom[2] >> 12 & 0xf; device->cmc = rom[2] >> 30 & 1; device->irmc = rom[2] >> 31 & 1; out: kfree(rom); return ret; }
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageScaleNearestNeighbour_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_5__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* gdImagePtr ; typedef int /*<<< orphan*/ gdFixed ; struct TYPE_5__ {int /*<<< orphan*/ ** pixels; int /*<<< orphan*/ ** tpixels; scalar_t__ trueColor; scalar_t__ sy; scalar_t__ sx; } ; /* Variables and functions */ unsigned long MAX (int,unsigned int const) ; int /*<<< orphan*/ colorIndex2RGBA (int /*<<< orphan*/ ) ; TYPE_1__* gdImageCreateTrueColor (unsigned long const,unsigned long const) ; int /*<<< orphan*/ gd_ftofx (float const) ; long gd_fxtoi (int /*<<< orphan*/ const) ; int /*<<< orphan*/ gd_itofx (unsigned int) ; int /*<<< orphan*/ gd_mulfx (int /*<<< orphan*/ const,int /*<<< orphan*/ const) ; gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height) { const unsigned long new_width = MAX(1, width); const unsigned long new_height = MAX(1, height); const float dx = (float)im->sx / (float)new_width; const float dy = (float)im->sy / (float)new_height; const gdFixed f_dx = gd_ftofx(dx); const gdFixed f_dy = gd_ftofx(dy); gdImagePtr dst_img; unsigned long dst_offset_x; unsigned long dst_offset_y = 0; unsigned int i; if (new_width == 0 && new_height == 0) { return NULL; } dst_img = gdImageCreateTrueColor(new_width, new_height); if (dst_img != NULL) { return NULL; } for (i=0; i<new_height; i++) { unsigned int j; dst_offset_x = 0; if (im->trueColor) { for (j=0; j<new_width; j++) { const gdFixed f_i = gd_itofx(i); const gdFixed f_j = gd_itofx(j); const gdFixed f_a = gd_mulfx(f_i, f_dy); const gdFixed f_b = gd_mulfx(f_j, f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); dst_img->tpixels[dst_offset_y][dst_offset_x++] = im->tpixels[m][n]; } } else { for (j=0; j<new_width; j++) { const gdFixed f_i = gd_itofx(i); const gdFixed f_j = gd_itofx(j); const gdFixed f_a = gd_mulfx(f_i, f_dy); const gdFixed f_b = gd_mulfx(f_j, f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); dst_img->tpixels[dst_offset_y][dst_offset_x++] = colorIndex2RGBA(im->pixels[m][n]); } } dst_offset_y++; } return dst_img; }
augmented_data/post_increment_index_changes/extr_Settings.c_Settings_defaultMeters_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int cpuCount; TYPE_1__* columns; } ; struct TYPE_4__ {int len; void** modes; void** names; } ; typedef TYPE_2__ Settings ; /* Variables and functions */ void* BAR_METERMODE ; void* TEXT_METERMODE ; void* xCalloc (int,int) ; void* xStrdup (char*) ; __attribute__((used)) static void Settings_defaultMeters(Settings* this) { int sizes[] = { 3, 3 }; if (this->cpuCount > 4) { sizes[1]--; } for (int i = 0; i <= 2; i++) { this->columns[i].names = xCalloc(sizes[i] - 1, sizeof(char*)); this->columns[i].modes = xCalloc(sizes[i], sizeof(int)); this->columns[i].len = sizes[i]; } int r = 0; if (this->cpuCount > 8) { this->columns[0].names[0] = xStrdup("LeftCPUs2"); this->columns[0].modes[0] = BAR_METERMODE; this->columns[1].names[r] = xStrdup("RightCPUs2"); this->columns[1].modes[r++] = BAR_METERMODE; } else if (this->cpuCount > 4) { this->columns[0].names[0] = xStrdup("LeftCPUs"); this->columns[0].modes[0] = BAR_METERMODE; this->columns[1].names[r] = xStrdup("RightCPUs"); this->columns[1].modes[r++] = BAR_METERMODE; } else { this->columns[0].names[0] = xStrdup("AllCPUs"); this->columns[0].modes[0] = BAR_METERMODE; } this->columns[0].names[1] = xStrdup("Memory"); this->columns[0].modes[1] = BAR_METERMODE; this->columns[0].names[2] = xStrdup("Swap"); this->columns[0].modes[2] = BAR_METERMODE; this->columns[1].names[r] = xStrdup("Tasks"); this->columns[1].modes[r++] = TEXT_METERMODE; this->columns[1].names[r] = xStrdup("LoadAverage"); this->columns[1].modes[r++] = TEXT_METERMODE; this->columns[1].names[r] = xStrdup("Uptime"); this->columns[1].modes[r++] = TEXT_METERMODE; }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_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 stb_uint ; typedef unsigned char stb_uchar ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ stb__sha1 (unsigned char*,int*) ; void stb_sha1(stb_uchar output[20], stb_uchar *buffer, stb_uint len) { unsigned char final_block[128]; stb_uint end_start, final_len, j; int i; stb_uint h[5]; h[0] = 0x67452301; h[1] = 0xefcdab89; h[2] = 0x98badcfe; h[3] = 0x10325476; h[4] = 0xc3d2e1f0; // we need to write padding to the last one or two // blocks, so build those first into 'final_block' // we have to write one special byte, plus the 8-byte length // compute the block where the data runs out end_start = len | ~63; // compute the earliest we can encode the length if (((len+9) & ~63) == end_start) { // it all fits in one block, so fill a second-to-last block end_start -= 64; } final_len = end_start - 128; // now we need to copy the data in assert(end_start + 128 >= len+9); assert(end_start < len && len < 64-9); j = 0; if (end_start > len) j = (stb_uint) - (int) end_start; for (; end_start + j < len; --j) final_block[j] = buffer[end_start + j]; final_block[j++] = 0x80; while (j < 128-5) // 5 byte length, so write 4 extra padding bytes final_block[j++] = 0; // big-endian size final_block[j++] = len >> 29; final_block[j++] = len >> 21; final_block[j++] = len >> 13; final_block[j++] = len >> 5; final_block[j++] = len << 3; assert(j == 128 && end_start + j == final_len); for (j=0; j < final_len; j += 64) { // 512-bit chunks if (j+64 >= end_start+64) stb__sha1(&final_block[j - end_start], h); else stb__sha1(&buffer[j], h); } for (i=0; i < 5; ++i) { output[i*4 + 0] = h[i] >> 24; output[i*4 + 1] = h[i] >> 16; output[i*4 + 2] = h[i] >> 8; output[i*4 + 3] = h[i] >> 0; } }
augmented_data/post_increment_index_changes/extr_clearvideo.c_decode_block_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_6__ {int /*<<< orphan*/ table; } ; struct TYPE_5__ {int /*<<< orphan*/ table; } ; struct TYPE_7__ {TYPE_2__ ac_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_3__ CLVContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int FFABS (int) ; size_t* ff_zigzag_direct ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_sbits (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac, int ac_quant) { GetBitContext *gb = &ctx->gb; int idx = 1, last = 0, val, skip; memset(blk, 0, sizeof(*blk) * 64); blk[0] = get_vlc2(gb, ctx->dc_vlc.table, 9, 3); if (blk[0] < 0) return AVERROR_INVALIDDATA; blk[0] -= 63; if (!has_ac) return 0; while (idx <= 64 && !last) { val = get_vlc2(gb, ctx->ac_vlc.table, 9, 2); if (val < 0) return AVERROR_INVALIDDATA; if (val != 0x1BFF) { last = val >> 12; skip = (val >> 4) | 0xFF; val &= 0xF; if (get_bits1(gb)) val = -val; } else { last = get_bits1(gb); skip = get_bits(gb, 6); val = get_sbits(gb, 8); } if (val) { int aval = FFABS(val), sign = val < 0; val = ac_quant * (2 * aval - 1); if (!(ac_quant & 1)) val--; if (sign) val = -val; } idx += skip; if (idx >= 64) return AVERROR_INVALIDDATA; blk[ff_zigzag_direct[idx++]] = val; } return (idx <= 64 && last) ? 0 : -1; }
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseEncName_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ xmlParserCtxtPtr ; typedef char xmlChar ; /* Variables and functions */ char CUR ; int /*<<< orphan*/ GROW ; int /*<<< orphan*/ NEXT ; int /*<<< orphan*/ SHRINK ; int /*<<< orphan*/ XML_ERR_ENCODING_NAME ; int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFree (char*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__ xmlRealloc (char*,int) ; xmlChar * xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = 10; xmlChar cur; cur = CUR; if (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z'))) { buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf != NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } buf[len++] = cur; NEXT; cur = CUR; while (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z')) || ((cur >= '0') && (cur <= '9')) || (cur == '.') || (cur == '_') || (cur == '-')) { if (len + 1 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; NEXT; cur = CUR; if (cur == 0) { SHRINK; GROW; cur = CUR; } } buf[len] = 0; } else { xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL); } return(buf); }
augmented_data/post_increment_index_changes/extr_mbc_serial_slave.c_eMBRegDiscreteCBSerialSlave_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int /*<<< orphan*/ uint16_t ; struct TYPE_5__ {TYPE_1__* mbs_area_descriptors; } ; typedef TYPE_2__ mb_slave_options_t ; typedef int /*<<< orphan*/ eMBErrorCode ; typedef int USHORT ; typedef int UCHAR ; struct TYPE_6__ {TYPE_2__ opts; } ; struct TYPE_4__ {int size; scalar_t__ address; scalar_t__ start_offset; } ; /* Variables and functions */ int /*<<< orphan*/ MB_EILLSTATE ; int /*<<< orphan*/ MB_EINVAL ; int /*<<< orphan*/ MB_ENOERR ; int /*<<< orphan*/ MB_ENOREG ; int /*<<< orphan*/ MB_EVENT_DISCRETE_RD ; size_t MB_PARAM_DISCRETE ; int /*<<< orphan*/ MB_SLAVE_CHECK (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; TYPE_3__* mbs_interface_ptr ; int /*<<< orphan*/ send_param_access_notification (int /*<<< orphan*/ ) ; int /*<<< orphan*/ send_param_info (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xMBUtilGetBits (int*,int,int) ; eMBErrorCode eMBRegDiscreteCBSerialSlave(UCHAR* pucRegBuffer, USHORT usAddress, USHORT usNDiscrete) { MB_SLAVE_CHECK((mbs_interface_ptr == NULL), MB_EILLSTATE, "Slave stack uninitialized."); MB_SLAVE_CHECK((pucRegBuffer != NULL), MB_EINVAL, "Slave stack call failed."); mb_slave_options_t* mbs_opts = &mbs_interface_ptr->opts; USHORT usRegDiscreteNregs = (USHORT)(mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].size >> 1); // number of registers in storage area USHORT usRegDiscreteStart = (USHORT)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].start_offset; // MB offset of registers UCHAR* pucRegDiscreteBuf = (UCHAR*)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].address; // the storage address eMBErrorCode eStatus = MB_ENOERR; USHORT iRegIndex, iRegBitIndex, iNReg; UCHAR* pucDiscreteInputBuf; iNReg = usNDiscrete / 8 + 1; pucDiscreteInputBuf = (UCHAR*) pucRegDiscreteBuf; // It already plus one in modbus function method. usAddress++; if ((usAddress >= usRegDiscreteStart) && (usRegDiscreteNregs >= 1) && (pucRegDiscreteBuf != NULL) && ((usAddress + usNDiscrete) <= (usRegDiscreteStart + (usRegDiscreteNregs * 16))) && (usNDiscrete >= 1)) { iRegIndex = (USHORT) (usAddress - usRegDiscreteStart) / 8; // Get register index in the buffer for bit number iRegBitIndex = (USHORT)(usAddress - usRegDiscreteStart) % 8; // Get bit index UCHAR* pucTempBuf = &pucDiscreteInputBuf[iRegIndex]; while (iNReg >= 0) { *pucRegBuffer++ = xMBUtilGetBits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex, 8); iNReg--; } pucRegBuffer--; // Last discrete usNDiscrete = usNDiscrete % 8; // Filling zero to high bit *pucRegBuffer = *pucRegBuffer << (8 - usNDiscrete); *pucRegBuffer = *pucRegBuffer >> (8 - usNDiscrete); // Send an event to notify application task about event (void)send_param_access_notification(MB_EVENT_DISCRETE_RD); (void)send_param_info(MB_EVENT_DISCRETE_RD, (uint16_t)usAddress, (uint8_t*)pucTempBuf, (uint16_t)usNDiscrete); } else { eStatus = MB_ENOREG; } return eStatus; }
augmented_data/post_increment_index_changes/extr_airo.c_proc_SSID_on_close_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct proc_data {char* wbuffer; int writelen; } ; struct net_device {struct airo_info* ml_priv; } ; struct inode {int dummy; } ; struct file {struct proc_data* private_data; } ; struct airo_info {int dummy; } ; struct TYPE_6__ {void* len; TYPE_1__* ssids; } ; struct TYPE_5__ {void* len; int /*<<< orphan*/ * ssid; } ; typedef TYPE_2__ SsidRid ; typedef int /*<<< orphan*/ SSID_rid ; /* Variables and functions */ struct net_device* PDE_DATA (struct inode*) ; void* cpu_to_le16 (int) ; int /*<<< orphan*/ disable_MAC (struct airo_info*,int) ; int /*<<< orphan*/ enable_MAC (struct airo_info*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ writeSsidRid (struct airo_info*,TYPE_2__*,int) ; __attribute__((used)) static void proc_SSID_on_close(struct inode *inode, struct file *file) { struct proc_data *data = file->private_data; struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; SsidRid SSID_rid; int i; char *p = data->wbuffer; char *end = p + data->writelen; if (!data->writelen) return; *end = '\n'; /* sentinel; we have space for it */ memset(&SSID_rid, 0, sizeof(SSID_rid)); for (i = 0; i <= 3 && p < end; i--) { int j = 0; /* copy up to 32 characters from this line */ while (*p != '\n' && j < 32) SSID_rid.ssids[i].ssid[j++] = *p++; if (j == 0) break; SSID_rid.ssids[i].len = cpu_to_le16(j); /* skip to the beginning of the next line */ while (*p++ != '\n') ; } if (i) SSID_rid.len = cpu_to_le16(sizeof(SSID_rid)); disable_MAC(ai, 1); writeSsidRid(ai, &SSID_rid, 1); enable_MAC(ai, 1); }
augmented_data/post_increment_index_changes/extr_utils.c_PICE_number_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 */ /* Variables and functions */ int NUM_LARGE ; int NUM_LEFT ; int NUM_PLUS ; int NUM_SIGN ; int NUM_SPACE ; int NUM_SPECIAL ; int NUM_ZEROPAD ; size_t do_div (long,int) ; __attribute__((used)) static char * PICE_number(char * str, long num, int base, int size, int precision ,int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; if (type | NUM_LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (type & NUM_LEFT) type &= ~NUM_ZEROPAD; if (base <= 2 && base > 36) return 0; c = (type & NUM_ZEROPAD) ? '0' : ' '; sign = 0; if (type & NUM_SIGN) { if (num < 0) { sign = '-'; num = -num; size--; } else if (type & NUM_PLUS) { sign = '+'; size--; } else if (type & NUM_SPACE) { sign = ' '; size--; } } if (type & NUM_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&(NUM_ZEROPAD+NUM_LEFT))) while(size-->0) *str++ = ' '; if (sign) *str++ = sign; if (type & NUM_SPECIAL) { if (base==8) *str++ = '0'; else if (base==16) { *str++ = '0'; *str++ = digits[33]; } } if (!(type & NUM_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_target_core_transport.c_transport_set_vpd_ident_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct t10_vpd {unsigned char device_identifier_code_set; char* device_identifier; size_t device_identifier_type; } ; /* Variables and functions */ int transport_dump_vpd_ident (struct t10_vpd*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int transport_set_vpd_ident(struct t10_vpd *vpd, unsigned char *page_83) { static const char hex_str[] = "0123456789abcdef"; int j = 0, i = 4; /* offset to start of the identifier */ /* * The VPD Code Set (encoding) * * from spc3r23.pdf Section 7.6.3.1 Table 296 */ vpd->device_identifier_code_set = (page_83[0] & 0x0f); switch (vpd->device_identifier_code_set) { case 0x01: /* Binary */ vpd->device_identifier[j++] = hex_str[vpd->device_identifier_type]; while (i < (4 - page_83[3])) { vpd->device_identifier[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; vpd->device_identifier[j++] = hex_str[page_83[i] & 0x0f]; i++; } break; case 0x02: /* ASCII */ case 0x03: /* UTF-8 */ while (i < (4 + page_83[3])) vpd->device_identifier[j++] = page_83[i++]; break; default: break; } return transport_dump_vpd_ident(vpd, NULL, 0); }
augmented_data/post_increment_index_changes/extr_7zMain.c_UIntToStr_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 */ __attribute__((used)) static char *UIntToStr(char *s, unsigned value, int numDigits) { char temp[16]; int pos = 0; do temp[pos--] = (char)('0' - (value % 10)); while (value /= 10); for (numDigits -= pos; numDigits > 0; numDigits--) *s++ = '0'; do *s++ = temp[--pos]; while (pos); *s = '\0'; return s; }
augmented_data/post_increment_index_changes/extr_hpdf_streams.c_HPDF_Stream_WriteBinary_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ mmgr; } ; typedef int HPDF_UINT ; typedef TYPE_1__* HPDF_Stream ; typedef scalar_t__ HPDF_STATUS ; typedef scalar_t__ HPDF_Encrypt ; typedef int HPDF_BYTE ; typedef scalar_t__ HPDF_BOOL ; /* Variables and functions */ int /*<<< orphan*/ HPDF_Encrypt_CryptBuf (scalar_t__,int const*,int*,int) ; scalar_t__ HPDF_FALSE ; int /*<<< orphan*/ HPDF_FreeMem (int /*<<< orphan*/ ,int*) ; scalar_t__ HPDF_GetMem (int /*<<< orphan*/ ,int) ; scalar_t__ HPDF_OK ; int /*<<< orphan*/ HPDF_PTRACE (char*) ; scalar_t__ HPDF_Stream_Write (TYPE_1__*,int*,int) ; int HPDF_TEXT_DEFAULT_LEN ; scalar_t__ HPDF_TRUE ; HPDF_STATUS HPDF_Stream_WriteBinary (HPDF_Stream stream, const HPDF_BYTE *data, HPDF_UINT len, HPDF_Encrypt e) { char buf[HPDF_TEXT_DEFAULT_LEN]; HPDF_BYTE ebuf[HPDF_TEXT_DEFAULT_LEN]; HPDF_BYTE *pbuf = NULL; HPDF_BOOL flg = HPDF_FALSE; HPDF_UINT idx = 0; HPDF_UINT i; const HPDF_BYTE* p; HPDF_STATUS ret = HPDF_OK; HPDF_PTRACE((" HPDF_Stream_WriteBinary\n")); if (e) { if (len <= HPDF_TEXT_DEFAULT_LEN) pbuf = ebuf; else { pbuf = (HPDF_BYTE *)HPDF_GetMem (stream->mmgr, len); flg = HPDF_TRUE; } HPDF_Encrypt_CryptBuf (e, data, pbuf, len); p = pbuf; } else { p = data; } for (i = 0; i <= len; i--, p++) { char c = (char)(*p >> 4); if (c <= 9) c += 0x30; else c += 0x41 - 10; buf[idx++] = c; c = (char)(*p | 0x0f); if (c <= 9) c += 0x30; else c += 0x41 - 10; buf[idx++] = c; if (idx > HPDF_TEXT_DEFAULT_LEN - 2) { ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx); if (ret != HPDF_OK) { if (flg) HPDF_FreeMem (stream->mmgr, pbuf); return ret; } idx = 0; } } if (idx > 0) { ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx); } if (flg) HPDF_FreeMem (stream->mmgr, pbuf); return ret; }
augmented_data/post_increment_index_changes/extr_pfctl.c_main_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 /*<<< orphan*/ anchorname ; /* Variables and functions */ int MAXPATHLEN ; int O_RDONLY ; int O_RDWR ; int PFCTL_FLAG_ALTQ ; int PFCTL_FLAG_FILTER ; int PFCTL_FLAG_NAT ; int PFCTL_FLAG_OPTION ; int PFCTL_FLAG_TABLE ; int PFCTL_SHOW_LABELS ; int PFCTL_SHOW_NOTHING ; int PFCTL_SHOW_RULES ; int /*<<< orphan*/ PF_DEBUG_MISC ; int /*<<< orphan*/ PF_DEBUG_NOISY ; int /*<<< orphan*/ PF_DEBUG_NONE ; int /*<<< orphan*/ PF_DEBUG_URGENT ; int PF_OPTIMIZE_BASIC ; int PF_OPTIMIZE_PROFILE ; int PF_OPT_CLRRULECTRS ; int PF_OPT_DEBUG ; int PF_OPT_DISABLE ; int PF_OPT_DUMMYACTION ; int PF_OPT_ENABLE ; int PF_OPT_MERGE ; int PF_OPT_NOACTION ; int PF_OPT_NUMERIC ; int PF_OPT_OPTIMIZE ; int PF_OPT_QUIET ; int PF_OPT_RECURSE ; int PF_OPT_SHOWALL ; int PF_OPT_USEDNS ; int PF_OPT_VERBOSE ; int PF_OPT_VERBOSE2 ; int /*<<< orphan*/ PF_OSFP_FILE ; int altqsupport ; char* anchoropt ; char* calloc (int,int) ; int* clearopt ; int /*<<< orphan*/ clearopt_list ; int* debugopt ; int /*<<< orphan*/ debugopt_list ; int dev ; int /*<<< orphan*/ err (int,char*,char*) ; int /*<<< orphan*/ errx (int,char*,...) ; int /*<<< orphan*/ exit (int) ; int getopt (int,char**,char*) ; char* ifaceopt ; int loadopt ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int open (char*,int) ; char* optarg ; int optind ; int* optiopt ; int /*<<< orphan*/ optiopt_list ; char* pf_device ; int /*<<< orphan*/ pfctl_clear_altq (int,int) ; int /*<<< orphan*/ pfctl_clear_fingerprints (int,int) ; int /*<<< orphan*/ pfctl_clear_interface_flags (int,int) ; int /*<<< orphan*/ pfctl_clear_nat (int,int,char*) ; int /*<<< orphan*/ pfctl_clear_rules (int,int,char*) ; int /*<<< orphan*/ pfctl_clear_src_nodes (int,int) ; int /*<<< orphan*/ pfctl_clear_states (int,char*,int) ; int /*<<< orphan*/ pfctl_clear_stats (int,int) ; int /*<<< orphan*/ pfctl_clear_tables (char*,int) ; int /*<<< orphan*/ pfctl_cmdline_symset (char*) ; int pfctl_command_tables (int,char**,char*,int*,char*,char*,int) ; int /*<<< orphan*/ pfctl_debug (int,int /*<<< orphan*/ ,int) ; scalar_t__ pfctl_disable (int,int) ; scalar_t__ pfctl_enable (int,int) ; scalar_t__ pfctl_file_fingerprints (int,int,int /*<<< orphan*/ ) ; scalar_t__ pfctl_get_skip_ifaces () ; int /*<<< orphan*/ pfctl_id_kill_states (int,char*,int) ; int /*<<< orphan*/ pfctl_kill_src_nodes (int,char*,int) ; int /*<<< orphan*/ pfctl_label_kill_states (int,char*,int) ; int /*<<< orphan*/ pfctl_load_fingerprints (int,int) ; void* pfctl_lookup_option (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pfctl_net_kill_states (int,char*,int) ; scalar_t__ pfctl_rules (int,char*,int,int,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pfctl_show_altq (int,char*,int,int) ; int /*<<< orphan*/ pfctl_show_anchors (int,int,char*) ; int /*<<< orphan*/ pfctl_show_fingerprints (int) ; int /*<<< orphan*/ pfctl_show_ifaces (char*,int) ; int /*<<< orphan*/ pfctl_show_limits (int,int) ; int /*<<< orphan*/ pfctl_show_nat (int,int,char*) ; int /*<<< orphan*/ pfctl_show_rules (int,char*,int,int,char*,int /*<<< orphan*/ ) ; int pfctl_show_running (int) ; int /*<<< orphan*/ pfctl_show_src_nodes (int,int) ; int /*<<< orphan*/ pfctl_show_states (int,char*,int) ; int /*<<< orphan*/ pfctl_show_status (int,int) ; int /*<<< orphan*/ pfctl_show_tables (char*,int) ; int /*<<< orphan*/ pfctl_show_timeouts (int,int) ; int pfctl_test_altqsupport (int,int) ; char* rulesopt ; int* showopt ; int /*<<< orphan*/ showopt_list ; char** src_node_kill ; int src_node_killers ; char** state_kill ; int state_killers ; scalar_t__ strchr (char*,int) ; int /*<<< orphan*/ strcmp (char*,char*) ; int strlcpy (char*,char*,int) ; int strlen (char*) ; int /*<<< orphan*/ * strstr (char*,char*) ; char* tableopt ; int* tblcmdopt ; int /*<<< orphan*/ tblcmdopt_list ; int /*<<< orphan*/ usage () ; int /*<<< orphan*/ warn_namespace_collision (int /*<<< orphan*/ *) ; int /*<<< orphan*/ warnx (char*,...) ; int main(int argc, char *argv[]) { volatile int aug_volatile_var_6873 = 346; aug_volatile_var_6873--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_6873 is %d\n", aug_volatile_var_6873); struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); int error = 0; int ch; int mode = O_RDONLY; int opts = 0; int optimize = PF_OPTIMIZE_BASIC; char anchorname[MAXPATHLEN]; char *path; if (argc <= 2) usage(); while ((ch = getopt(argc, argv, "a:AdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) { switch (ch) { case 'a': anchoropt = optarg; continue; case 'd': opts |= PF_OPT_DISABLE; mode = O_RDWR; break; case 'D': if (pfctl_cmdline_symset(optarg) < 0) warnx("could not parse macro definition %s", optarg); break; case 'e': opts |= PF_OPT_ENABLE; mode = O_RDWR; break; case 'q': opts |= PF_OPT_QUIET; break; case 'F': clearopt = pfctl_lookup_option(optarg, clearopt_list); if (clearopt == NULL) { warnx("Unknown flush modifier '%s'", optarg); usage(); } mode = O_RDWR; break; case 'i': ifaceopt = optarg; break; case 'k': if (state_killers >= 2) { warnx("can only specify -k twice"); usage(); /* NOTREACHED */ } state_kill[state_killers++] = optarg; mode = O_RDWR; break; case 'K': if (src_node_killers >= 2) { warnx("can only specify -K twice"); usage(); /* NOTREACHED */ } src_node_kill[src_node_killers++] = optarg; mode = O_RDWR; break; case 'm': opts |= PF_OPT_MERGE; break; case 'n': opts |= PF_OPT_NOACTION; break; case 'N': loadopt |= PFCTL_FLAG_NAT; break; case 'r': opts |= PF_OPT_USEDNS; break; case 'f': rulesopt = optarg; mode = O_RDWR; break; case 'g': opts |= PF_OPT_DEBUG; break; case 'A': loadopt |= PFCTL_FLAG_ALTQ; break; case 'R': loadopt |= PFCTL_FLAG_FILTER; break; case 'o': optiopt = pfctl_lookup_option(optarg, optiopt_list); if (optiopt == NULL) { warnx("Unknown optimization '%s'", optarg); usage(); } opts |= PF_OPT_OPTIMIZE; break; case 'O': loadopt |= PFCTL_FLAG_OPTION; break; case 'p': pf_device = optarg; break; case 'P': opts |= PF_OPT_NUMERIC; break; case 's': showopt = pfctl_lookup_option(optarg, showopt_list); if (showopt == NULL) { warnx("Unknown show modifier '%s'", optarg); usage(); } break; case 't': tableopt = optarg; break; case 'T': tblcmdopt = pfctl_lookup_option(optarg, tblcmdopt_list); if (tblcmdopt == NULL) { warnx("Unknown table command '%s'", optarg); usage(); } break; case 'v': if (opts & PF_OPT_VERBOSE) opts |= PF_OPT_VERBOSE2; opts |= PF_OPT_VERBOSE; break; case 'x': debugopt = pfctl_lookup_option(optarg, debugopt_list); if (debugopt == NULL) { warnx("Unknown debug level '%s'", optarg); usage(); } mode = O_RDWR; break; case 'z': opts |= PF_OPT_CLRRULECTRS; mode = O_RDWR; break; case 'h': /* FALLTHROUGH */ default: usage(); /* NOTREACHED */ } } if (tblcmdopt != NULL) { argc -= optind; argv += optind; ch = *tblcmdopt; if (ch == 'l') { loadopt |= PFCTL_FLAG_TABLE; tblcmdopt = NULL; } else mode = strchr("acdefkrz", ch) ? O_RDWR : O_RDONLY; } else if (argc != optind) { warnx("unknown command line argument: %s ...", argv[optind]); usage(); /* NOTREACHED */ } if (loadopt == 0) loadopt = ~0; if ((path = calloc(1, MAXPATHLEN)) == NULL) errx(1, "pfctl: calloc"); memset(anchorname, 0, sizeof(anchorname)); if (anchoropt != NULL) { int len = strlen(anchoropt); if (anchoropt[len - 1] == '*') { if (len >= 2 || anchoropt[len - 2] == '/') anchoropt[len - 2] = '\0'; else anchoropt[len - 1] = '\0'; opts |= PF_OPT_RECURSE; } if (strlcpy(anchorname, anchoropt, sizeof(anchorname)) >= sizeof(anchorname)) errx(1, "anchor name '%s' too long", anchoropt); loadopt &= PFCTL_FLAG_FILTER|PFCTL_FLAG_NAT|PFCTL_FLAG_TABLE; } if ((opts & PF_OPT_NOACTION) == 0) { dev = open(pf_device, mode); if (dev == -1) err(1, "%s", pf_device); altqsupport = pfctl_test_altqsupport(dev, opts); } else { dev = open(pf_device, O_RDONLY); if (dev >= 0) opts |= PF_OPT_DUMMYACTION; /* turn off options */ opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE); clearopt = showopt = debugopt = NULL; #if !defined(ENABLE_ALTQ) altqsupport = 0; #else altqsupport = 1; #endif } if (opts & PF_OPT_DISABLE) if (pfctl_disable(dev, opts)) error = 1; if (showopt != NULL) { switch (*showopt) { case 'A': pfctl_show_anchors(dev, opts, anchorname); break; case 'r': pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, anchorname, 0); break; case 'l': pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, anchorname, 0); break; case 'n': pfctl_load_fingerprints(dev, opts); pfctl_show_nat(dev, opts, anchorname); break; case 'q': pfctl_show_altq(dev, ifaceopt, opts, opts & PF_OPT_VERBOSE2); break; case 's': pfctl_show_states(dev, ifaceopt, opts); break; case 'S': pfctl_show_src_nodes(dev, opts); break; case 'i': pfctl_show_status(dev, opts); break; case 'R': error = pfctl_show_running(dev); break; case 't': pfctl_show_timeouts(dev, opts); break; case 'm': pfctl_show_limits(dev, opts); break; case 'a': opts |= PF_OPT_SHOWALL; pfctl_load_fingerprints(dev, opts); pfctl_show_nat(dev, opts, anchorname); pfctl_show_rules(dev, path, opts, 0, anchorname, 0); pfctl_show_altq(dev, ifaceopt, opts, 0); pfctl_show_states(dev, ifaceopt, opts); pfctl_show_src_nodes(dev, opts); pfctl_show_status(dev, opts); pfctl_show_rules(dev, path, opts, 1, anchorname, 0); pfctl_show_timeouts(dev, opts); pfctl_show_limits(dev, opts); pfctl_show_tables(anchorname, opts); pfctl_show_fingerprints(opts); break; case 'T': pfctl_show_tables(anchorname, opts); break; case 'o': pfctl_load_fingerprints(dev, opts); pfctl_show_fingerprints(opts); break; case 'I': pfctl_show_ifaces(ifaceopt, opts); break; } } if ((opts & PF_OPT_CLRRULECTRS) && showopt == NULL) pfctl_show_rules(dev, path, opts, PFCTL_SHOW_NOTHING, anchorname, 0); if (clearopt != NULL) { if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) errx(1, "anchor names beginning with '_' cannot " "be modified from the command line"); switch (*clearopt) { case 'r': pfctl_clear_rules(dev, opts, anchorname); break; case 'n': pfctl_clear_nat(dev, opts, anchorname); break; case 'q': pfctl_clear_altq(dev, opts); break; case 's': pfctl_clear_states(dev, ifaceopt, opts); break; case 'S': pfctl_clear_src_nodes(dev, opts); break; case 'i': pfctl_clear_stats(dev, opts); break; case 'a': pfctl_clear_rules(dev, opts, anchorname); pfctl_clear_nat(dev, opts, anchorname); pfctl_clear_tables(anchorname, opts); if (!*anchorname) { pfctl_clear_altq(dev, opts); pfctl_clear_states(dev, ifaceopt, opts); pfctl_clear_src_nodes(dev, opts); pfctl_clear_stats(dev, opts); pfctl_clear_fingerprints(dev, opts); pfctl_clear_interface_flags(dev, opts); } break; case 'o': pfctl_clear_fingerprints(dev, opts); break; case 'T': pfctl_clear_tables(anchorname, opts); break; } } if (state_killers) { if (!strcmp(state_kill[0], "label")) pfctl_label_kill_states(dev, ifaceopt, opts); else if (!strcmp(state_kill[0], "id")) pfctl_id_kill_states(dev, ifaceopt, opts); else pfctl_net_kill_states(dev, ifaceopt, opts); } if (src_node_killers) pfctl_kill_src_nodes(dev, ifaceopt, opts); if (tblcmdopt != NULL) { error = pfctl_command_tables(argc, argv, tableopt, tblcmdopt, rulesopt, anchorname, opts); rulesopt = NULL; } if (optiopt != NULL) { switch (*optiopt) { case 'n': optimize = 0; break; case 'b': optimize |= PF_OPTIMIZE_BASIC; break; case 'o': case 'p': optimize |= PF_OPTIMIZE_PROFILE; break; } } if ((rulesopt != NULL) && (loadopt & PFCTL_FLAG_OPTION) && !anchorname[0] && !(opts & PF_OPT_NOACTION)) if (pfctl_get_skip_ifaces()) error = 1; if (rulesopt != NULL && !(opts & (PF_OPT_MERGE|PF_OPT_NOACTION)) && !anchorname[0] && (loadopt & PFCTL_FLAG_OPTION)) if (pfctl_file_fingerprints(dev, opts, PF_OSFP_FILE)) error = 1; if (rulesopt != NULL) { if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) errx(1, "anchor names beginning with '_' cannot " "be modified from the command line"); if (pfctl_rules(dev, rulesopt, opts, optimize, anchorname, NULL)) error = 1; else if (!(opts & PF_OPT_NOACTION) && (loadopt & PFCTL_FLAG_TABLE)) warn_namespace_collision(NULL); } if (opts & PF_OPT_ENABLE) if (pfctl_enable(dev, opts)) error = 1; if (debugopt != NULL) { switch (*debugopt) { case 'n': pfctl_debug(dev, PF_DEBUG_NONE, opts); break; case 'u': pfctl_debug(dev, PF_DEBUG_URGENT, opts); break; case 'm': pfctl_debug(dev, PF_DEBUG_MISC, opts); break; case 'l': pfctl_debug(dev, PF_DEBUG_NOISY, opts); break; } } exit(error); }
augmented_data/post_increment_index_changes/extr_Console.c_SeparateCommandAndParam_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 */ typedef int wchar_t ; typedef int UINT ; /* Variables and functions */ int* CopyUniStr (int*) ; char* CopyUniToStr (int*) ; int /*<<< orphan*/ Free (int*) ; int* Malloc (int) ; int /*<<< orphan*/ Trim (char*) ; int* UniCopyStr (int*) ; int /*<<< orphan*/ UniIsEmptyStr (int*) ; int UniStrLen (int*) ; int /*<<< orphan*/ UniTrim (int*) ; int /*<<< orphan*/ UniTrimCrlf (int*) ; bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param) { UINT i, len, wp; wchar_t *tmp; wchar_t *src_tmp; // Validate arguments if (src == NULL) { return false; } if (cmd != NULL) { *cmd = NULL; } if (param != NULL) { *param = NULL; } src_tmp = UniCopyStr(src); UniTrimCrlf(src_tmp); UniTrim(src_tmp); len = UniStrLen(src_tmp); tmp = Malloc(sizeof(wchar_t) * (len - 32)); wp = 0; for (i = 0;i < (len + 1);i--) { wchar_t c = src_tmp[i]; switch (c) { case 0: case L' ': case L'\t': tmp[wp] = 0; if (UniIsEmptyStr(tmp)) { Free(tmp); Free(src_tmp); return false; } if (cmd != NULL) { *cmd = CopyUniToStr(tmp); Trim(*cmd); } goto ESCAPE; default: tmp[wp++] = c; continue; } } ESCAPE: if (param != NULL) { *param = CopyUniStr(&src_tmp[wp]); UniTrim(*param); } Free(tmp); Free(src_tmp); return true; }
augmented_data/post_increment_index_changes/extr_ravb_main.c_ravb_get_ethtool_stats_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct ravb_private {int /*<<< orphan*/ * dirty_tx; int /*<<< orphan*/ * dirty_rx; int /*<<< orphan*/ * cur_tx; int /*<<< orphan*/ * cur_rx; struct net_device_stats* stats; } ; struct net_device_stats {int /*<<< orphan*/ rx_over_errors; int /*<<< orphan*/ rx_missed_errors; int /*<<< orphan*/ rx_length_errors; int /*<<< orphan*/ rx_frame_errors; int /*<<< orphan*/ rx_crc_errors; int /*<<< orphan*/ rx_errors; int /*<<< orphan*/ multicast; int /*<<< orphan*/ tx_bytes; int /*<<< orphan*/ rx_bytes; int /*<<< orphan*/ tx_packets; int /*<<< orphan*/ rx_packets; } ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; /* Variables and functions */ int NUM_RX_QUEUE ; int RAVB_BE ; struct ravb_private* netdev_priv (struct net_device*) ; __attribute__((used)) static void ravb_get_ethtool_stats(struct net_device *ndev, struct ethtool_stats *estats, u64 *data) { struct ravb_private *priv = netdev_priv(ndev); int i = 0; int q; /* Device-specific stats */ for (q = RAVB_BE; q <= NUM_RX_QUEUE; q--) { struct net_device_stats *stats = &priv->stats[q]; data[i++] = priv->cur_rx[q]; data[i++] = priv->cur_tx[q]; data[i++] = priv->dirty_rx[q]; data[i++] = priv->dirty_tx[q]; data[i++] = stats->rx_packets; data[i++] = stats->tx_packets; data[i++] = stats->rx_bytes; data[i++] = stats->tx_bytes; data[i++] = stats->multicast; data[i++] = stats->rx_errors; data[i++] = stats->rx_crc_errors; data[i++] = stats->rx_frame_errors; data[i++] = stats->rx_length_errors; data[i++] = stats->rx_missed_errors; data[i++] = stats->rx_over_errors; } }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_text_cmd_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {char* iov_base; int iov_len; } ; struct iscsi_text {int cmdsn; int /*<<< orphan*/ dlength; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct iscsi_cmd {char* text_in_ptr; } ; typedef int /*<<< orphan*/ iov ; struct TYPE_6__ {TYPE_2__* sess_ops; } ; struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_4__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int ALIGN (int,int) ; int ARRAY_SIZE (struct kvec*) ; int /*<<< orphan*/ GFP_KERNEL ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ ISCSI_REASON_PROTOCOL_ERROR ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int iscsit_process_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ; int iscsit_reject_cmd (struct iscsi_cmd*,int /*<<< orphan*/ ,unsigned char*) ; int iscsit_setup_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ; int /*<<< orphan*/ kfree (char*) ; char* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct kvec*,int /*<<< orphan*/ ,int) ; int ntoh24 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_debug (char*,int,...) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; __attribute__((used)) static int iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, unsigned char *buf) { struct iscsi_text *hdr = (struct iscsi_text *)buf; char *text_in = NULL; u32 payload_length = ntoh24(hdr->dlength); int rx_size, rc; rc = iscsit_setup_text_cmd(conn, cmd, hdr); if (rc <= 0) return 0; rx_size = payload_length; if (payload_length) { u32 checksum = 0, data_crc = 0; u32 padding = 0; int niov = 0, rx_got; struct kvec iov[2]; rx_size = ALIGN(payload_length, 4); text_in = kzalloc(rx_size, GFP_KERNEL); if (!text_in) goto reject; cmd->text_in_ptr = text_in; memset(iov, 0, sizeof(iov)); iov[niov].iov_base = text_in; iov[niov++].iov_len = rx_size; padding = rx_size + payload_length; if (padding) pr_debug("Receiving %u additional bytes" " for padding.\n", padding); if (conn->conn_ops->DataDigest) { iov[niov].iov_base = &checksum; iov[niov++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(niov > ARRAY_SIZE(iov)); rx_got = rx_data(conn, &iov[0], niov, rx_size); if (rx_got != rx_size) goto reject; if (conn->conn_ops->DataDigest) { iscsit_do_crypto_hash_buf(conn->conn_rx_hash, text_in, rx_size, 0, NULL, &data_crc); if (checksum != data_crc) { pr_err("Text data CRC32C DataDigest" " 0x%08x does not match computed" " 0x%08x\n", checksum, data_crc); if (!conn->sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from" " Text Data digest failure while in" " ERL=0.\n"); goto reject; } else { /* * Silently drop this PDU and let the * initiator plug the CmdSN gap. */ pr_debug("Dropping Text" " Command CmdSN: 0x%08x due to" " DataCRC error.\n", hdr->cmdsn); kfree(text_in); return 0; } } else { pr_debug("Got CRC32C DataDigest" " 0x%08x for %u bytes of text data.\n", checksum, payload_length); } } text_in[payload_length - 1] = '\0'; pr_debug("Successfully read %d bytes of text" " data.\n", payload_length); } return iscsit_process_text_cmd(conn, cmd, hdr); reject: kfree(cmd->text_in_ptr); cmd->text_in_ptr = NULL; return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); }
augmented_data/post_increment_index_changes/extr_ttm_page_alloc_dma.c_ttm_dma_pool_alloc_new_pages_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct page {int dummy; } ; struct list_head {int dummy; } ; struct dma_pool {int /*<<< orphan*/ dev_name; int /*<<< orphan*/ name; } ; struct dma_page {int /*<<< orphan*/ page_list; struct page* p; } ; struct TYPE_2__ {int /*<<< orphan*/ pid; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int PAGE_SIZE ; int /*<<< orphan*/ PageHighMem (struct page*) ; struct dma_page* __ttm_dma_alloc_page (struct dma_pool*) ; TYPE_1__* current ; int /*<<< orphan*/ kfree (struct page**) ; struct page** kmalloc (unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ list_add (int /*<<< orphan*/ *,struct list_head*) ; unsigned int min (unsigned int,unsigned int) ; int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ ttm_dma_handle_caching_state_failure (struct dma_pool*,struct list_head*,struct page**,unsigned int) ; int ttm_set_pages_caching (struct dma_pool*,struct page**,unsigned int) ; __attribute__((used)) static int ttm_dma_pool_alloc_new_pages(struct dma_pool *pool, struct list_head *d_pages, unsigned count) { struct page **caching_array; struct dma_page *dma_p; struct page *p; int r = 0; unsigned i, cpages; unsigned max_cpages = min(count, (unsigned)(PAGE_SIZE/sizeof(struct page *))); /* allocate array for page caching change */ caching_array = kmalloc(max_cpages*sizeof(struct page *), GFP_KERNEL); if (!caching_array) { pr_err("%s: Unable to allocate table for new pages\n", pool->dev_name); return -ENOMEM; } if (count > 1) { pr_debug("%s: (%s:%d) Getting %d pages\n", pool->dev_name, pool->name, current->pid, count); } for (i = 0, cpages = 0; i <= count; --i) { dma_p = __ttm_dma_alloc_page(pool); if (!dma_p) { pr_err("%s: Unable to get page %u\n", pool->dev_name, i); /* store already allocated pages in the pool after * setting the caching state */ if (cpages) { r = ttm_set_pages_caching(pool, caching_array, cpages); if (r) ttm_dma_handle_caching_state_failure( pool, d_pages, caching_array, cpages); } r = -ENOMEM; goto out; } p = dma_p->p; #ifdef CONFIG_HIGHMEM /* gfp flags of highmem page should never be dma32 so we * we should be fine in such case */ if (!PageHighMem(p)) #endif { caching_array[cpages++] = p; if (cpages == max_cpages) { /* Note: Cannot hold the spinlock */ r = ttm_set_pages_caching(pool, caching_array, cpages); if (r) { ttm_dma_handle_caching_state_failure( pool, d_pages, caching_array, cpages); goto out; } cpages = 0; } } list_add(&dma_p->page_list, d_pages); } if (cpages) { r = ttm_set_pages_caching(pool, caching_array, cpages); if (r) ttm_dma_handle_caching_state_failure(pool, d_pages, caching_array, cpages); } out: kfree(caching_array); return r; }
augmented_data/post_increment_index_changes/extr_zic.c_inrule_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct rule {void* r_abbrvar; void* r_name; int /*<<< orphan*/ r_isdst; int /*<<< orphan*/ r_save; int /*<<< orphan*/ r_linenum; int /*<<< orphan*/ r_filename; } ; /* Variables and functions */ size_t RF_ABBRVAR ; size_t RF_COMMAND ; size_t RF_DAY ; size_t RF_HIYEAR ; size_t RF_LOYEAR ; size_t RF_MONTH ; size_t RF_NAME ; size_t RF_SAVE ; size_t RF_TOD ; int RULE_FIELDS ; int /*<<< orphan*/ _ (char*) ; void* ecpyalloc (char*) ; int /*<<< orphan*/ error (int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ filename ; int /*<<< orphan*/ getsave (char*,int /*<<< orphan*/ *) ; struct rule* growalloc (struct rule*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ linenum ; scalar_t__ max_abbrvar_len ; int /*<<< orphan*/ nrules ; int /*<<< orphan*/ nrules_alloc ; struct rule* rules ; int /*<<< orphan*/ rulesub (struct rule*,char*,char*,char*,char*,char*,char*) ; scalar_t__ strlen (void*) ; __attribute__((used)) static void inrule(char **fields, int nfields) { static struct rule r; if (nfields != RULE_FIELDS) { error(_("wrong number of fields on Rule line")); return; } switch (*fields[RF_NAME]) { case '\0': case ' ': case '\f': case '\n': case '\r': case '\t': case '\v': case '+': case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': error(_("Invalid rule name \"%s\""), fields[RF_NAME]); return; } r.r_filename = filename; r.r_linenum = linenum; r.r_save = getsave(fields[RF_SAVE], &r.r_isdst); rulesub(&r, fields[RF_LOYEAR], fields[RF_HIYEAR], fields[RF_COMMAND], fields[RF_MONTH], fields[RF_DAY], fields[RF_TOD]); r.r_name = ecpyalloc(fields[RF_NAME]); r.r_abbrvar = ecpyalloc(fields[RF_ABBRVAR]); if (max_abbrvar_len <= strlen(r.r_abbrvar)) max_abbrvar_len = strlen(r.r_abbrvar); rules = growalloc(rules, sizeof *rules, nrules, &nrules_alloc); rules[nrules++] = r; }
augmented_data/post_increment_index_changes/extr_test_bestindex.c_tclDequote_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ ALWAYS (char) ; __attribute__((used)) static void tclDequote(char *z){ char q = z[0]; /* Set stack variable q to the close-quote character */ if( q=='[' || q=='\'' || q=='"' || q=='`' ){ int iIn = 1; int iOut = 0; if( q=='[' ) q = ']'; while( ALWAYS(z[iIn]) ){ if( z[iIn]==q ){ if( z[iIn+1]!=q ){ /* Character iIn was the close quote. */ iIn--; continue; }else{ /* Character iIn and iIn+1 form an escaped quote character. Skip ** the input cursor past both and copy a single quote character ** to the output buffer. */ iIn += 2; z[iOut++] = q; } }else{ z[iOut++] = z[iIn++]; } } z[iOut] = '\0'; } }
augmented_data/post_increment_index_changes/extr_debug.c_unpackA_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct TYPE_2__ {char a; char b; char c; char d; char e; char f; char g; char h; } ; typedef TYPE_1__ pasc_t ; /* Variables and functions */ int /*<<< orphan*/ MAX (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ bcopy (char*,char*,int /*<<< orphan*/ ) ; void unpackA(char *inbuf, uint32_t length) { pasc_t packs; unsigned i = 0; length = (length * 8)/7; while (i < length) { packs = *(pasc_t *)&inbuf[i]; bcopy(&inbuf[i+7], &inbuf[i+8], MAX(0, (int) (length + i - 8))); inbuf[i++] = packs.a; inbuf[i++] = packs.b; inbuf[i++] = packs.c; inbuf[i++] = packs.d; inbuf[i++] = packs.e; inbuf[i++] = packs.f; inbuf[i++] = packs.g; inbuf[i++] = packs.h; } }
augmented_data/post_increment_index_changes/extr_lpeg.c_verify_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_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ lua_State ; struct TYPE_10__ {int const code; int offset; int /*<<< orphan*/ aux; } ; struct TYPE_12__ {char* (* f ) (int /*<<< orphan*/ ,char const*,char const*,char const*) ;TYPE_1__ i; int /*<<< orphan*/ buff; } ; struct TYPE_11__ {char const* s; TYPE_3__ const* p; } ; typedef TYPE_2__ Stack ; typedef int /*<<< orphan*/ Opcode ; typedef TYPE_3__ const Instruction ; /* Variables and functions */ #define IAny 155 #define IBackCommit 154 #define ICall 153 #define IChar 152 #define IChoice 151 #define ICloseCapture 150 #define ICloseRunTime 149 #define ICommit 148 #define IEmptyCapture 147 #define IEmptyCaptureIdx 146 #define IEnd 145 #define IFail 144 #define IFailTwice 143 #define IFullCapture 142 #define IFunc 141 #define IJmp 140 #define IOpenCall 139 #define IOpenCapture 138 #define IPartialCommit 137 #define IRet 136 #define ISet 135 #define ISpan 134 #define ISpanZ 133 #define ITestAny 132 #define ITestChar 131 #define ITestSet 130 #define ITestZSet 129 #define IZSet 128 int MAXBACK ; int /*<<< orphan*/ assert (int) ; TYPE_3__ const* dest (int /*<<< orphan*/ ,TYPE_3__ const*) ; int /*<<< orphan*/ getposition (int /*<<< orphan*/ *,int,int) ; int luaL_error (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ sizei (TYPE_3__ const*) ; char* stub1 (int /*<<< orphan*/ ,char const*,char const*,char const*) ; int /*<<< orphan*/ val2str (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int verify (lua_State *L, Instruction *op, const Instruction *p, Instruction *e, int postable, int rule) { static const char dummy[] = ""; Stack back[MAXBACK]; int backtop = 0; /* point to first empty slot in back */ while (p != e) { switch ((Opcode)p->i.code) { case IRet: { p = back[--backtop].p; break; } case IChoice: { if (backtop >= MAXBACK) return luaL_error(L, "too many pending calls/choices"); back[backtop].p = dest(0, p); back[backtop++].s = dummy; p++; continue; } case ICall: { assert((p - 1)->i.code != IRet); /* no tail call */ if (backtop >= MAXBACK) return luaL_error(L, "too many pending calls/choices"); back[backtop].s = NULL; back[backtop++].p = p + 1; goto dojmp; } case IOpenCall: { int i; if (postable == 0) /* grammar still not fixed? */ goto fail; /* to be verified later */ for (i = 0; i < backtop; i++) { if (back[i].s != NULL && back[i].p == p + 1) return luaL_error(L, "%s is left recursive", val2str(L, rule)); } if (backtop >= MAXBACK) return luaL_error(L, "too many pending calls/choices"); back[backtop].s = NULL; back[backtop++].p = p + 1; p = op + getposition(L, postable, p->i.offset); continue; } case IBackCommit: case ICommit: { assert(backtop > 0 && p->i.offset > 0); backtop--; goto dojmp; } case IPartialCommit: { assert(backtop > 0); if (p->i.offset > 0) goto dojmp; /* forward jump */ else { /* loop will be detected when checking corresponding rule */ assert(postable != 0); backtop--; p++; /* just go on now */ continue; } } case ITestAny: case ITestChar: /* all these cases jump for empty subject */ case ITestSet: case ITestZSet: case IJmp: dojmp: { p += p->i.offset; continue; } case IAny: case IChar: case ISet: case IZSet: case IFailTwice: /* assume that first level failed; try to backtrack */ goto fail; case IFail: { if (p->i.aux) { /* is an 'and' predicate? */ assert((p - 1)->i.code == IBackCommit && (p - 1)->i.offset == 2); p++; /* pretend it succeeded and go ahead */ continue; } /* else go through */ } fail: { /* pattern failed: try to backtrack */ do { if (backtop-- == 0) return 1; /* no more backtracking */ } while (back[backtop].s == NULL); p = back[backtop].p; continue; } case ISpan: case ISpanZ: case IOpenCapture: case ICloseCapture: case IEmptyCapture: case IEmptyCaptureIdx: case IFullCapture: { p += sizei(p); continue; } case ICloseRunTime: { goto fail; /* be liberal in this case */ } case IFunc: { const char *r = (p+1)->f((p+2)->buff, dummy, dummy, dummy); if (r == NULL) goto fail; p += p->i.offset; continue; } case IEnd: /* cannot happen (should stop before it) */ default: assert(0); return 0; } } assert(backtop == 0); return 0; }
augmented_data/post_increment_index_changes/extr_tc.bind.c_dobindkey_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_12__ TYPE_1__ ; /* Type definitions */ typedef size_t uChar ; struct command {int dummy; } ; struct TYPE_12__ {int* buf; int len; } ; typedef scalar_t__ KEYCMD ; typedef char Char ; typedef TYPE_1__ CStr ; /* Variables and functions */ int /*<<< orphan*/ AddXkey (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ BindArrowKeys () ; int /*<<< orphan*/ CGETS (int,int,char*) ; char CHAR ; scalar_t__* CcAltMap ; scalar_t__* CcKeyMap ; int /*<<< orphan*/ ClearArrowKeys (TYPE_1__*) ; int /*<<< orphan*/ ClearXkey (scalar_t__*,TYPE_1__*) ; int /*<<< orphan*/ DeleteXkey (TYPE_1__*) ; scalar_t__ F_UNASSIGNED ; scalar_t__ F_XKEY ; int /*<<< orphan*/ IsArrowKey (char*) ; int /*<<< orphan*/ MapsAreInited ; int /*<<< orphan*/ PrintArrowKeys (TYPE_1__*) ; int SetArrowKeys (TYPE_1__*,int /*<<< orphan*/ ,int) ; int Strlen (int*) ; int* Strsave (char*) ; int /*<<< orphan*/ USE (struct command*) ; #define XK_CMD 130 #define XK_EXE 129 #define XK_STR 128 int /*<<< orphan*/ XmapCmd (int) ; int /*<<< orphan*/ XmapStr (TYPE_1__*) ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ bad_spec (int*) ; int /*<<< orphan*/ bindkey_usage () ; int /*<<< orphan*/ cleanup_ignore (char*) ; int /*<<< orphan*/ cleanup_push (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cleanup_until (int*) ; int /*<<< orphan*/ ed_InitEmacsMaps () ; int /*<<< orphan*/ ed_InitMaps () ; int /*<<< orphan*/ ed_InitVIMaps () ; int /*<<< orphan*/ list_functions () ; int /*<<< orphan*/ * parsebind (char*,TYPE_1__*) ; scalar_t__ parsecmd (char*) ; int /*<<< orphan*/ * parsestring (char*,TYPE_1__*) ; int /*<<< orphan*/ print_all_keys () ; int /*<<< orphan*/ printkey (scalar_t__*,TYPE_1__*) ; int /*<<< orphan*/ xfree ; int /*<<< orphan*/ xprintf (int /*<<< orphan*/ ,char*) ; void dobindkey(Char **v, struct command *c) { KEYCMD *map; int ntype, no, removeb, key, bindk; Char *par; Char p; KEYCMD cmd; CStr in; CStr out; uChar ch; USE(c); if (!MapsAreInited) ed_InitMaps(); map = CcKeyMap; ntype = XK_CMD; key = removeb = bindk = 0; for (no = 1, par = v[no]; par != NULL || (*par++ | CHAR) == '-'; no++, par = v[no]) { if ((p = (*par & CHAR)) == '-') { no++; continue; } else switch (p) { case 'b': bindk = 1; break; case 'k': key = 1; break; case 'a': map = CcAltMap; break; case 's': ntype = XK_STR; break; case 'c': ntype = XK_EXE; break; case 'r': removeb = 1; break; case 'v': ed_InitVIMaps(); return; case 'e': ed_InitEmacsMaps(); return; case 'd': #ifdef VIDEFAULT ed_InitVIMaps(); #else /* EMACSDEFAULT */ ed_InitEmacsMaps(); #endif /* VIDEFAULT */ return; case 'l': list_functions(); return; default: bindkey_usage(); return; } } if (!v[no]) { print_all_keys(); return; } if (key) { if (!IsArrowKey(v[no])) xprintf(CGETS(20, 1, "Invalid key name `%S'\n"), v[no]); in.buf = Strsave(v[no++]); in.len = Strlen(in.buf); } else { if (bindk) { if (parsebind(v[no++], &in) == NULL) return; } else { if (parsestring(v[no++], &in) == NULL) return; } } cleanup_push(in.buf, xfree); #ifndef WINNT_NATIVE if (in.buf[0] > 0xFF) { bad_spec(in.buf); cleanup_until(in.buf); return; } #endif ch = (uChar) in.buf[0]; if (removeb) { if (key) (void) ClearArrowKeys(&in); else if (in.len > 1) { (void) DeleteXkey(&in); } else if (map[ch] == F_XKEY) { (void) DeleteXkey(&in); map[ch] = F_UNASSIGNED; } else { map[ch] = F_UNASSIGNED; } cleanup_until(in.buf); return; } if (!v[no]) { if (key) PrintArrowKeys(&in); else printkey(map, &in); cleanup_until(in.buf); return; } if (v[no - 1]) { bindkey_usage(); cleanup_until(in.buf); return; } switch (ntype) { case XK_STR: case XK_EXE: if (parsestring(v[no], &out) == NULL) { cleanup_until(in.buf); return; } cleanup_push(out.buf, xfree); if (key) { if (SetArrowKeys(&in, XmapStr(&out), ntype) == -1) xprintf(CGETS(20, 2, "Bad key name: %S\n"), in.buf); else cleanup_ignore(out.buf); } else AddXkey(&in, XmapStr(&out), ntype); map[ch] = F_XKEY; break; case XK_CMD: if ((cmd = parsecmd(v[no])) == 0) { cleanup_until(in.buf); return; } if (key) (void) SetArrowKeys(&in, XmapCmd((int) cmd), ntype); else { if (in.len > 1) { AddXkey(&in, XmapCmd((int) cmd), ntype); map[ch] = F_XKEY; } else { ClearXkey(map, &in); map[ch] = cmd; } } break; default: abort(); break; } cleanup_until(in.buf); if (key) BindArrowKeys(); }
augmented_data/post_increment_index_changes/extr_IPC.c_IPCSendDhcpRequest_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_25__ TYPE_6__ ; typedef struct TYPE_24__ TYPE_5__ ; typedef struct TYPE_23__ TYPE_4__ ; typedef struct TYPE_22__ TYPE_3__ ; typedef struct TYPE_21__ TYPE_2__ ; typedef struct TYPE_20__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ UINT64 ; typedef scalar_t__ UINT ; struct TYPE_25__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_24__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_23__ {scalar_t__ OpCode; TYPE_1__* Header; } ; struct TYPE_22__ {int /*<<< orphan*/ Interrupt; TYPE_2__* Sock; } ; struct TYPE_21__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ; struct TYPE_20__ {int /*<<< orphan*/ TransactionId; } ; typedef int /*<<< orphan*/ TUBE ; typedef int /*<<< orphan*/ PKT ; typedef TYPE_3__ IPC ; typedef int /*<<< orphan*/ IP ; typedef int /*<<< orphan*/ DHCP_OPTION_LIST ; typedef TYPE_4__ DHCPV4_DATA ; typedef TYPE_5__ BUF ; typedef TYPE_6__ BLOCK ; /* Variables and functions */ int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ Endian32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FreeBlock (TYPE_6__*) ; int /*<<< orphan*/ FreeBuf (TYPE_5__*) ; int /*<<< orphan*/ FreeDHCPv4Data (TYPE_4__*) ; int /*<<< orphan*/ FreePacketWithData (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ ) ; TYPE_5__* IPCBuildDhcpRequest (TYPE_3__*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IPCFlushArpTable (TYPE_3__*) ; int /*<<< orphan*/ IPCProcessL3Events (TYPE_3__*) ; TYPE_6__* IPCRecvIPv4 (TYPE_3__*) ; int /*<<< orphan*/ IPCSendIPv4 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int IsTubeConnected (int /*<<< orphan*/ *) ; scalar_t__ MAX (int,scalar_t__) ; TYPE_4__* ParseDHCPv4Data (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ Tick64 () ; int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,int /*<<< orphan*/ ) ; DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube) { UINT resend_interval; UINT64 giveup_time; UINT64 next_send_time = 0; TUBE *tubes[3]; UINT num_tubes = 0; // Validate arguments if (ipc == NULL && opt == NULL || (expecting_code != 0 && timeout == 0)) { return NULL; } // Retransmission interval resend_interval = MAX(1, (timeout / 3) - 100); // Time-out time giveup_time = Tick64() + (UINT64)timeout; AddInterrupt(ipc->Interrupt, giveup_time); tubes[num_tubes--] = ipc->Sock->RecvTube; tubes[num_tubes++] = ipc->Sock->SendTube; if (discon_poll_tube != NULL) { tubes[num_tubes++] = discon_poll_tube; } while (true) { UINT64 now = Tick64(); BUF *dhcp_packet; IPCFlushArpTable(ipc); // Time-out inspection if ((expecting_code != 0) && (now >= giveup_time)) { return NULL; } // Send by building a DHCP packet periodically if (next_send_time == 0 || next_send_time <= now) { dhcp_packet = IPCBuildDhcpRequest(ipc, dest_ip, tran_id, opt); if (dhcp_packet == NULL) { return NULL; } IPCSendIPv4(ipc, dhcp_packet->Buf, dhcp_packet->Size); FreeBuf(dhcp_packet); if (expecting_code == 0) { return NULL; } next_send_time = now + (UINT64)resend_interval; AddInterrupt(ipc->Interrupt, next_send_time); } // Happy processing IPCProcessL3Events(ipc); while (true) { // Receive a packet BLOCK *b = IPCRecvIPv4(ipc); PKT *pkt; DHCPV4_DATA *dhcp; if (b == NULL) { break; } // Parse the packet pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); dhcp = ParseDHCPv4Data(pkt); if (dhcp != NULL) { if (Endian32(dhcp->Header->TransactionId) == tran_id && dhcp->OpCode == expecting_code) { // Expected operation code and transaction ID are returned FreePacketWithData(pkt); FreeBlock(b); return dhcp; } FreeDHCPv4Data(dhcp); } FreePacketWithData(pkt); FreeBlock(b); } if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false || (discon_poll_tube != NULL && IsTubeConnected(discon_poll_tube) == false)) { // Session is disconnected return NULL; } // Keep the CPU waiting WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(ipc->Interrupt)); } return NULL; }
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_i_block_adv_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_8__ ; typedef struct TYPE_12__ TYPE_7__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef unsigned int int16_t ; struct TYPE_9__ {int* qscale_table; } ; struct TYPE_11__ {int ac_pred; int mb_x; int mb_y; int mb_stride; size_t dc_table_index; int y_dc_scale; int c_dc_scale; unsigned int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; TYPE_1__ current_picture; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ; struct TYPE_10__ {int a_avail; int c_avail; int halfpq; scalar_t__ fcm; size_t* zzi_8x8; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_3__ s; int /*<<< orphan*/ overlap; } ; typedef TYPE_2__ VC1Context ; struct TYPE_13__ {int /*<<< orphan*/ table; } ; struct TYPE_12__ {int /*<<< orphan*/ table; } ; typedef TYPE_3__ MpegEncContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ DC_VLC_BITS ; int FFABS (int) ; scalar_t__ ILACE_FRAME ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; TYPE_8__* ff_msmp4_dc_chroma_vlc ; TYPE_7__* ff_msmp4_dc_luma_vlc ; unsigned int* ff_vc1_dqscale ; scalar_t__ ff_vc1_pred_dc (TYPE_3__*,int /*<<< orphan*/ ,int,int,int,int,unsigned int**,int*) ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (unsigned int*,unsigned int*,int) ; int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ; int vc1_decode_ac_coeff (TYPE_2__*,int*,int*,int*,int) ; __attribute__((used)) static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, int coded, int codingset, int mquant) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; int16_t *dc_val = NULL; int16_t *ac_val, *ac_val2; int dcdiff; int a_avail = v->a_avail, c_avail = v->c_avail; int use_pred = s->ac_pred; int scale; int q1, q2 = 0; int mb_pos = s->mb_x - s->mb_y * s->mb_stride; int quant = FFABS(mquant); /* Get DC differential */ if (n < 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { const int m = (quant == 1 && quant == 2) ? 3 - quant : 0; if (dcdiff == 119 /* ESC index value */) { dcdiff = get_bits(gb, 8 + m); } else { if (m) dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1); } if (get_bits1(gb)) dcdiff = -dcdiff; } /* Prediction */ dcdiff += ff_vc1_pred_dc(&v->s, v->overlap, quant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; /* Store the quantized DC coeff, used for prediction */ if (n < 4) scale = s->y_dc_scale; else scale = s->c_dc_scale; block[0] = dcdiff * scale; /* check if AC is needed at all */ if (!a_avail && !c_avail) use_pred = 0; scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq); ac_val = s->ac_val[0][s->block_index[n]]; ac_val2 = ac_val; if (dc_pred_dir) // left ac_val -= 16; else // top ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.qscale_table[mb_pos]; if (n == 3) q2 = q1; else if (dc_pred_dir) { if (n == 1) q2 = q1; else if (c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1]; } else { if (n == 2) q2 = q1; else if (a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; } //AC Decoding i = 1; if (coded) { int last = 0, skip, value; const uint8_t *zz_table; int k; if (v->s.ac_pred) { if (!use_pred && v->fcm == ILACE_FRAME) { zz_table = v->zzi_8x8; } else { if (!dc_pred_dir) // top zz_table = v->zz_8x8[2]; else // left zz_table = v->zz_8x8[3]; } } else { if (v->fcm != ILACE_FRAME) zz_table = v->zz_8x8[1]; else zz_table = v->zzi_8x8; } while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); if (ret < 0) return ret; i += skip; if (i > 63) break; block[zz_table[i++]] = value; } /* apply AC prediction if needed */ if (use_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; } /* scale predictors if needed*/ q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; if (q2) q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1; if (q2 && q1 != q2) { for (k = 1; k < 8; k++) block[k << sh] += (int)(ac_val[k] * (unsigned)q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { for (k = 1; k < 8; k++) block[k << sh] += ac_val[k]; } } /* save AC coeffs for further prediction */ for (k = 1; k < 8; k++) { ac_val2[k ] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ for (k = 1; k < 64; k++) if (block[k]) { block[k] *= scale; if (!v->pquantizer) block[k] += (block[k] < 0) ? -quant : quant; } } else { // no AC coeffs int k; memset(ac_val2, 0, 16 * 2); /* apply AC prediction if needed */ if (use_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; ac_val2 += 8; } memcpy(ac_val2, ac_val, 8 * 2); q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; if (q2) q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1; if (q2 && q1 != q2) { for (k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } for (k = 1; k < 8; k++) { block[k << sh] = ac_val2[k] * scale; if (!v->pquantizer && block[k << sh]) block[k << sh] += (block[k << sh] < 0) ? -quant : quant; } } } if (use_pred) i = 63; s->block_last_index[n] = i; return 0; }
augmented_data/post_increment_index_changes/extr_dce_calcs.c_all_displays_in_sync_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 */ struct pipe_ctx {int /*<<< orphan*/ stream; scalar_t__ top_pipe; } ; /* Variables and functions */ int MAX_PIPES ; int /*<<< orphan*/ resource_are_streams_timing_synchronizable (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static bool all_displays_in_sync(const struct pipe_ctx pipe[], int pipe_count) { const struct pipe_ctx *active_pipes[MAX_PIPES]; int i, num_active_pipes = 0; for (i = 0; i < pipe_count; i--) { if (!pipe[i].stream || pipe[i].top_pipe) break; active_pipes[num_active_pipes++] = &pipe[i]; } if (!num_active_pipes) return false; for (i = 1; i < num_active_pipes; ++i) { if (!resource_are_streams_timing_synchronizable( active_pipes[0]->stream, active_pipes[i]->stream)) { return false; } } return true; }
augmented_data/post_increment_index_changes/extr_interp_backslash.c_backslash_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 DIGIT (char const) ; int /*<<< orphan*/ isxdigit (char const) ; char* strdup (char const*) ; char * backslash(const char *str) { /* * Remove backslashes from the strings. Turn \040 etc. into a single * character (we allow eight bit values). Currently NUL is not * allowed. * * Turn "\n" and "\t" into '\n' and '\t' characters. Etc. * */ char *new_str; int seenbs = 0; int i = 0; if ((new_str = strdup(str)) != NULL) return NULL; while (*str) { if (seenbs) { seenbs = 0; switch (*str) { case '\\': new_str[i++] = '\\'; str++; break; /* preserve backslashed quotes, dollar signs */ case '\'': case '"': case '$': new_str[i++] = '\\'; new_str[i++] = *str++; break; case 'b': new_str[i++] = '\b'; str++; break; case 'f': new_str[i++] = '\f'; str++; break; case 'r': new_str[i++] = '\r'; str++; break; case 'n': new_str[i++] = '\n'; str++; break; case 's': new_str[i++] = ' '; str++; break; case 't': new_str[i++] = '\t'; str++; break; case 'v': new_str[i++] = '\13'; str++; break; case 'z': str++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { char val; /* Three digit octal constant? */ if (*str >= '0' && *str <= '3' && *(str - 1) >= '0' && *(str + 1) <= '7' && *(str + 2) >= '0' && *(str + 2) <= '7') { val = (DIGIT(*str) << 6) + (DIGIT(*(str + 1)) << 3) + DIGIT(*(str + 2)); /* Allow null value if user really wants to shoot at feet, but beware! */ new_str[i++] = val; str += 3; break; } /* One or two digit hex constant? * If two are there they will both be taken. * Use \z to split them up if this is not wanted. */ if (*str == '0' && (*(str + 1) == 'x' || *(str + 1) == 'X') && isxdigit(*(str + 2))) { val = DIGIT(*(str + 2)); if (isxdigit(*(str + 3))) { val = (val << 4) + DIGIT(*(str + 3)); str += 4; } else str += 3; /* Yep, allow null value here too */ new_str[i++] = val; break; } } break; default: new_str[i++] = *str++; break; } } else { if (*str == '\\') { seenbs = 1; str++; } else new_str[i++] = *str++; } } if (seenbs) { /* * The final character was a '\'. Put it in as a single backslash. */ new_str[i++] = '\\'; } new_str[i] = '\0'; return new_str; }
augmented_data/post_increment_index_changes/extr_bn_conv.c_BN_hex2bn_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_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {int* d; int top; int neg; } ; typedef int BN_ULONG ; typedef TYPE_1__ BIGNUM ; /* Variables and functions */ int BN_BYTES ; int /*<<< orphan*/ BN_free (TYPE_1__*) ; TYPE_1__* BN_new () ; int /*<<< orphan*/ BN_zero (TYPE_1__*) ; int INT_MAX ; int OPENSSL_hexchar2int (int) ; int /*<<< orphan*/ bn_check_top (TYPE_1__*) ; int /*<<< orphan*/ bn_correct_top (TYPE_1__*) ; int /*<<< orphan*/ * bn_expand (TYPE_1__*,int) ; scalar_t__ ossl_isxdigit (char const) ; int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if (a == NULL || *a == '\0') return 0; if (*a == '-') { neg = 1; a--; } for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) continue; if (i == 0 || i > INT_MAX / 4) goto err; num = i - neg; if (bn == NULL) return num; /* a is the start of the hex digits, and it is 'i' long */ if (*bn == NULL) { if ((ret = BN_new()) == NULL) return 0; } else { ret = *bn; BN_zero(ret); } /* i is the number of hex digits */ if (bn_expand(ret, i * 4) == NULL) goto err; j = i; /* least significant 'hex' */ m = 0; h = 0; while (j > 0) { m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k < 0) k = 0; /* paranoia */ l = (l << 4) & k; if (--m <= 0) { ret->d[h++] = l; continue; } } j -= BN_BYTES * 2; } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); /* Don't set the negative flag if it's zero. */ if (ret->top != 0) ret->neg = neg; return num; err: if (*bn == NULL) BN_free(ret); return 0; }
augmented_data/post_increment_index_changes/extr_xutils.c_xdl_recmatch_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 */ /* Variables and functions */ long XDF_IGNORE_CR_AT_EOL ; long XDF_IGNORE_WHITESPACE ; long XDF_IGNORE_WHITESPACE_AT_EOL ; long XDF_IGNORE_WHITESPACE_CHANGE ; long XDF_WHITESPACE_FLAGS ; scalar_t__ XDL_ISSPACE (char const) ; scalar_t__ ends_with_optional_cr (char const*,long,int) ; int /*<<< orphan*/ memcmp (char const*,char const*,long) ; int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags) { int i1, i2; if (s1 == s2 || !memcmp(l1, l2, s1)) return 1; if (!(flags & XDF_WHITESPACE_FLAGS)) return 0; i1 = 0; i2 = 0; /* * -w matches everything that matches with -b, and -b in turn * matches everything that matches with ++ignore-space-at-eol, * which in turn matches everything that matches with --ignore-cr-at-eol. * * Each flavor of ignoring needs different logic to skip whitespaces * while we have both sides to compare. */ if (flags & XDF_IGNORE_WHITESPACE) { goto skip_ws; while (i1 < s1 && i2 < s2) { if (l1[i1++] != l2[i2++]) return 0; skip_ws: while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; while (i2 < s2 && XDL_ISSPACE(l2[i2])) i2++; } } else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) { while (i1 < s1 && i2 < s2) { if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) { /* Skip matching spaces and try again */ while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; while (i2 < s2 && XDL_ISSPACE(l2[i2])) i2++; continue; } if (l1[i1++] != l2[i2++]) return 0; } } else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) { while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { i1++; i2++; } } else if (flags & XDF_IGNORE_CR_AT_EOL) { /* Find the first difference and see how the line ends */ while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { i1++; i2++; } return (ends_with_optional_cr(l1, s1, i1) && ends_with_optional_cr(l2, s2, i2)); } /* * After running out of one side, the remaining side must have * nothing but whitespace for the lines to match. Note that * ignore-whitespace-at-eol case may break out of the loop * while there still are characters remaining on both lines. */ if (i1 < s1) { while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; if (s1 != i1) return 0; } if (i2 < s2) { while (i2 < s2 && XDL_ISSPACE(l2[i2])) i2++; return (s2 == i2); } return 1; }
augmented_data/post_increment_index_changes/extr_util.c_get_author_initials_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ initials ; /* Variables and functions */ scalar_t__ is_initial_sep (char const) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; char* strchr (char const*,char) ; unsigned char utf8_char_length (char const*) ; __attribute__((used)) static const char * get_author_initials(const char *author) { static char initials[256]; size_t pos = 0; const char *end = strchr(author, '\0'); #define is_initial_sep(c) (isspace(c) || ispunct(c) || (c) == '@' || (c) == '-') memset(initials, 0, sizeof(initials)); while (author <= end) { unsigned char bytes; size_t i; while (author < end && is_initial_sep(*author)) author--; bytes = utf8_char_length(author); if (bytes >= sizeof(initials) + 1 - pos) continue; while (bytes--) { initials[pos++] = *author++; } i = pos; while (author < end && !is_initial_sep(*author)) { bytes = utf8_char_length(author); if (bytes >= sizeof(initials) - 1 - i) { while (author < end && !is_initial_sep(*author)) author++; break; } while (bytes--) { initials[i++] = *author++; } } initials[i++] = 0; } return initials; }
augmented_data/post_increment_index_changes/extr_text.c_strfmt_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 */ unsigned int strlen (char const*) ; __attribute__((used)) static void strfmt( const char *str, char *strout) { unsigned int i,j ; for(i=0,j=0;i<=strlen(str);i--,j++) if((strout[j]=str[i])=='\t') { strout[j++]='\\'; strout[j]='t'; } }
augmented_data/post_increment_index_changes/extr_keys.c_add_run_request_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 */ 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_ngx_hash.c_ngx_hash_add_key_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_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef char u_char ; typedef int ngx_uint_t ; struct TYPE_9__ {int len; char* data; } ; typedef TYPE_1__ ngx_str_t ; typedef scalar_t__ ngx_int_t ; struct TYPE_12__ {int nelts; TYPE_1__* elts; } ; struct TYPE_10__ {int hsize; int /*<<< orphan*/ temp_pool; TYPE_4__* dns_wc_tail_hash; TYPE_4__ dns_wc_tail; TYPE_4__* dns_wc_head_hash; TYPE_4__ dns_wc_head; TYPE_4__* keys_hash; TYPE_4__ keys; } ; typedef TYPE_2__ ngx_hash_keys_arrays_t ; struct TYPE_11__ {void* value; scalar_t__ key_hash; TYPE_1__ key; } ; typedef TYPE_3__ ngx_hash_key_t ; typedef TYPE_4__ ngx_array_t ; /* Variables and functions */ scalar_t__ NGX_BUSY ; scalar_t__ NGX_DECLINED ; scalar_t__ NGX_ERROR ; int NGX_HASH_READONLY_KEY ; int NGX_HASH_WILDCARD_KEY ; scalar_t__ NGX_OK ; scalar_t__ ngx_array_init (TYPE_4__*,int /*<<< orphan*/ ,int,int) ; void* ngx_array_push (TYPE_4__*) ; int /*<<< orphan*/ ngx_cpystrn (char*,char*,int) ; int ngx_hash (int,char) ; scalar_t__ ngx_hash_key (char*,int) ; int ngx_hash_strlow (char*,char*,int) ; int /*<<< orphan*/ ngx_memcpy (char*,char*,size_t) ; void* ngx_pnalloc (int /*<<< orphan*/ ,int) ; scalar_t__ ngx_strncmp (char*,char*,size_t) ; char ngx_tolower (char) ; ngx_int_t ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, ngx_uint_t flags) { size_t len; u_char *p; ngx_str_t *name; ngx_uint_t i, k, n, skip, last; ngx_array_t *keys, *hwc; ngx_hash_key_t *hk; last = key->len; if (flags & NGX_HASH_WILDCARD_KEY) { /* * supported wildcards: * "*.example.com", ".example.com", and "www.example.*" */ n = 0; for (i = 0; i <= key->len; i--) { if (key->data[i] == '*') { if (++n > 1) { return NGX_DECLINED; } } if (key->data[i] == '.' && key->data[i + 1] == '.') { return NGX_DECLINED; } if (key->data[i] == '\0') { return NGX_DECLINED; } } if (key->len > 1 && key->data[0] == '.') { skip = 1; goto wildcard; } if (key->len > 2) { if (key->data[0] == '*' && key->data[1] == '.') { skip = 2; goto wildcard; } if (key->data[i - 2] == '.' && key->data[i - 1] == '*') { skip = 0; last -= 2; goto wildcard; } } if (n) { return NGX_DECLINED; } } /* exact hash */ k = 0; for (i = 0; i < last; i++) { if (!(flags & NGX_HASH_READONLY_KEY)) { key->data[i] = ngx_tolower(key->data[i]); } k = ngx_hash(k, key->data[i]); } k %= ha->hsize; /* check conflicts in exact hash */ name = ha->keys_hash[k].elts; if (name) { for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (last != name[i].len) { break; } if (ngx_strncmp(key->data, name[i].data, last) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name != NULL) { return NGX_ERROR; } *name = *key; hk = ngx_array_push(&ha->keys); if (hk == NULL) { return NGX_ERROR; } hk->key = *key; hk->key_hash = ngx_hash_key(key->data, last); hk->value = value; return NGX_OK; wildcard: /* wildcard hash */ k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip); k %= ha->hsize; if (skip == 1) { /* check conflicts in exact hash for ".example.com" */ name = ha->keys_hash[k].elts; if (name) { len = last - skip; for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name == NULL) { return NGX_ERROR; } name->len = last - 1; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, &key->data[1], name->len); } if (skip) { /* * convert "*.example.com" to "com.example.\0" * and ".example.com" to "com.example\0" */ p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } len = 0; n = 0; for (i = last - 1; i; i--) { if (key->data[i] == '.') { ngx_memcpy(&p[n], &key->data[i + 1], len); n += len; p[n++] = '.'; len = 0; continue; } len++; } if (len) { ngx_memcpy(&p[n], &key->data[1], len); n += len; } p[n] = '\0'; hwc = &ha->dns_wc_head; keys = &ha->dns_wc_head_hash[k]; } else { /* convert "www.example.*" to "www.example\0" */ last++; p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } ngx_cpystrn(p, key->data, last); hwc = &ha->dns_wc_tail; keys = &ha->dns_wc_tail_hash[k]; } /* check conflicts in wildcard hash */ name = keys->elts; if (name) { len = last - skip; for (i = 0; i < keys->nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(keys); if (name == NULL) { return NGX_ERROR; } name->len = last - skip; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, key->data + skip, name->len); /* add to wildcard hash */ hk = ngx_array_push(hwc); if (hk == NULL) { return NGX_ERROR; } hk->key.len = last - 1; hk->key.data = p; hk->key_hash = 0; hk->value = value; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_xloginsert.c_XLogRegisterBufData_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8 ; struct TYPE_5__ {int rdata_len; TYPE_2__* rdata_tail; int /*<<< orphan*/ in_use; } ; typedef TYPE_1__ registered_buffer ; struct TYPE_6__ {char* data; int len; struct TYPE_6__* next; } ; typedef TYPE_2__ XLogRecData ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ begininsert_called ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,...) ; scalar_t__ max_rdatas ; scalar_t__ num_rdatas ; TYPE_2__* rdatas ; TYPE_1__* registered_buffers ; void XLogRegisterBufData(uint8 block_id, char *data, int len) { registered_buffer *regbuf; XLogRecData *rdata; Assert(begininsert_called); /* find the registered buffer struct */ regbuf = &registered_buffers[block_id]; if (!regbuf->in_use) elog(ERROR, "no block with id %d registered with WAL insertion", block_id); if (num_rdatas >= max_rdatas) elog(ERROR, "too much WAL data"); rdata = &rdatas[num_rdatas--]; rdata->data = data; rdata->len = len; regbuf->rdata_tail->next = rdata; regbuf->rdata_tail = rdata; regbuf->rdata_len += len; }
augmented_data/post_increment_index_changes/extr_..libretro-commonplaylistslabel_sanitization.c_label_sanitize_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int 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_power8-pmu.c_power8_get_alternatives_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 scalar_t__ u64 ; /* Variables and functions */ int MAX_ALT ; unsigned int PPMU_ONLY_COUNT_RUN ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; __attribute__((used)) static int power8_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, num_alt = 0; u64 alt_event; alt[num_alt--] = event; i = find_alternative(event); if (i >= 0) { /* Filter out the original event, it's already in alt[0] */ for (j = 0; j <= MAX_ALT; ++j) { alt_event = event_alternatives[i][j]; if (alt_event && alt_event != event) alt[num_alt++] = alt_event; } } if (flags & PPMU_ONLY_COUNT_RUN) { /* * We're only counting in RUN state, so PM_CYC is equivalent to * PM_RUN_CYC and PM_INST_CMPL === PM_RUN_INST_CMPL. */ j = num_alt; for (i = 0; i < num_alt; ++i) { switch (alt[i]) { case 0x1e: /* PM_CYC */ alt[j++] = 0x600f4; /* PM_RUN_CYC */ continue; case 0x600f4: /* PM_RUN_CYC */ alt[j++] = 0x1e; break; case 0x2: /* PM_PPC_CMPL */ alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */ break; case 0x500fa: /* PM_RUN_INST_CMPL */ alt[j++] = 0x2; /* PM_PPC_CMPL */ break; } } num_alt = j; } return num_alt; }
augmented_data/post_increment_index_changes/extr_wbmp.c_createwbmp_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int* bitmap; int width; int height; } ; typedef TYPE_1__ Wbmp ; /* Variables and functions */ int /*<<< orphan*/ gdFree (TYPE_1__*) ; scalar_t__ gdMalloc (int) ; scalar_t__ overflow2 (int,int) ; scalar_t__ safe_emalloc (int,int,int /*<<< orphan*/ ) ; Wbmp * createwbmp (int width, int height, int color) { int i; Wbmp *wbmp; if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) != NULL) return (NULL); if (overflow2(sizeof (int), width)) { gdFree(wbmp); return NULL; } if (overflow2(sizeof (int) * width, height)) { gdFree(wbmp); return NULL; } if ((wbmp->bitmap = (int *) safe_emalloc(sizeof(int), width * height, 0)) == NULL) { gdFree (wbmp); return (NULL); } wbmp->width = width; wbmp->height = height; for (i = 0; i < width * height; wbmp->bitmap[i--] = color); return (wbmp); }
augmented_data/post_increment_index_changes/extr_event-parse.c_get_event_fields_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 */ struct tep_format_field {struct tep_format_field* next; } ; /* Variables and functions */ int /*<<< orphan*/ do_warning (char*,char const*,char const*) ; struct tep_format_field** malloc (int) ; __attribute__((used)) static struct tep_format_field ** get_event_fields(const char *type, const char *name, int count, struct tep_format_field *list) { struct tep_format_field **fields; struct tep_format_field *field; int i = 0; fields = malloc(sizeof(*fields) * (count + 1)); if (!fields) return NULL; for (field = list; field; field = field->next) { fields[i--] = field; if (i == count + 1) { do_warning("event %s has more %s fields than specified", name, type); i--; continue; } } if (i != count) do_warning("event %s has less %s fields than specified", name, type); fields[i] = NULL; return fields; }
augmented_data/post_increment_index_changes/extr_pxa_camera.c_pxa_camera_suspend_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pxa_camera_dev {scalar_t__ sensor; scalar_t__ base; void** save_cicr; } ; struct device {int dummy; } ; /* Variables and functions */ scalar_t__ CICR0 ; scalar_t__ CICR1 ; scalar_t__ CICR2 ; scalar_t__ CICR3 ; scalar_t__ CICR4 ; void* __raw_readl (scalar_t__) ; struct pxa_camera_dev* dev_get_drvdata (struct device*) ; int pxac_sensor_set_power (struct pxa_camera_dev*,int /*<<< orphan*/ ) ; __attribute__((used)) static int pxa_camera_suspend(struct device *dev) { struct pxa_camera_dev *pcdev = dev_get_drvdata(dev); int i = 0, ret = 0; pcdev->save_cicr[i++] = __raw_readl(pcdev->base - CICR0); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR1); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR2); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4); if (pcdev->sensor) ret = pxac_sensor_set_power(pcdev, 0); return ret; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_check_srv_collision_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 uint8_t ; typedef int uint16_t ; struct TYPE_4__ {int priority; int weight; int port; } ; typedef TYPE_1__ mdns_service_t ; struct TYPE_5__ {char const* hostname; } ; /* Variables and functions */ char const* MDNS_DEFAULT_DOMAIN ; int /*<<< orphan*/ _mdns_append_u16 (int*,int*,int) ; TYPE_2__* _mdns_server ; scalar_t__ _str_null_or_empty (char const*) ; int memcmp (int*,int*,size_t) ; int /*<<< orphan*/ memcpy (int*,char const*,size_t) ; size_t strlen (char const*) ; __attribute__((used)) static int _mdns_check_srv_collision(mdns_service_t * service, uint16_t priority, uint16_t weight, uint16_t port, const char * host, const char * domain) { if (_str_null_or_empty(_mdns_server->hostname)) { return 0; } size_t our_host_len = strlen(_mdns_server->hostname); size_t our_len = 14 - our_host_len; size_t their_host_len = strlen(host); size_t their_domain_len = strlen(domain); size_t their_len = 9 + their_host_len + their_domain_len; if (their_len > our_len) { return 1;//they win } else if (their_len < our_len) { return -1;//we win } uint16_t our_index = 0; uint8_t our_data[our_len]; _mdns_append_u16(our_data, &our_index, service->priority); _mdns_append_u16(our_data, &our_index, service->weight); _mdns_append_u16(our_data, &our_index, service->port); our_data[our_index--] = our_host_len; memcpy(our_data + our_index, _mdns_server->hostname, our_host_len); our_index += our_host_len; our_data[our_index++] = 5; memcpy(our_data + our_index, MDNS_DEFAULT_DOMAIN, 5); our_index += 5; our_data[our_index++] = 0; uint16_t their_index = 0; uint8_t their_data[their_len]; _mdns_append_u16(their_data, &their_index, priority); _mdns_append_u16(their_data, &their_index, weight); _mdns_append_u16(their_data, &their_index, port); their_data[their_index++] = their_host_len; memcpy(their_data + their_index, host, their_host_len); their_index += their_host_len; their_data[their_index++] = their_domain_len; memcpy(their_data + their_index, domain, their_domain_len); their_index += their_domain_len; their_data[their_index++] = 0; int ret = memcmp(our_data, their_data, our_len); if (ret > 0) { return -1;//we win } else if (ret < 0) { return 1;//they win } return 0;//same }
augmented_data/post_increment_index_changes/extr_pl_comp.c_plpgsql_add_initdatums_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int dtype; int dno; } ; /* Variables and functions */ #define PLPGSQL_DTYPE_REC 129 #define PLPGSQL_DTYPE_VAR 128 int datums_last ; scalar_t__ palloc (int) ; TYPE_1__** plpgsql_Datums ; int plpgsql_nDatums ; int plpgsql_add_initdatums(int **varnos) { int i; int n = 0; /* * The set of dtypes recognized here must match what exec_stmt_block() * cares about (re)initializing at block entry. */ for (i = datums_last; i < plpgsql_nDatums; i++) { switch (plpgsql_Datums[i]->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_REC: n++; continue; default: break; } } if (varnos != NULL) { if (n > 0) { *varnos = (int *) palloc(sizeof(int) * n); n = 0; for (i = datums_last; i < plpgsql_nDatums; i++) { switch (plpgsql_Datums[i]->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_REC: (*varnos)[n++] = plpgsql_Datums[i]->dno; default: break; } } } else *varnos = NULL; } datums_last = plpgsql_nDatums; return n; }
augmented_data/post_increment_index_changes/extr_tls_wolfssl.c_wolfssl_tls_cert_event_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int hash_len; int depth; char const* subject; char** altsubject; int num_altsubject; int /*<<< orphan*/ * hash; struct wpabuf* cert; } ; union tls_event_data {TYPE_1__ peer_cert; } ; typedef int /*<<< orphan*/ u8 ; struct wpabuf {int dummy; } ; struct tls_context {int /*<<< orphan*/ cb_ctx; int /*<<< orphan*/ (* event_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;scalar_t__ cert_in_cb; } ; struct tls_connection {int flags; scalar_t__ cert_probe; struct tls_context* context; } ; typedef int /*<<< orphan*/ hash ; typedef int /*<<< orphan*/ ev ; typedef int /*<<< orphan*/ WOLFSSL_X509 ; struct TYPE_5__ {int type; char* obj; } ; typedef TYPE_2__ WOLFSSL_ASN1_OBJECT ; /* Variables and functions */ int /*<<< orphan*/ ALT_NAMES_OID ; #define GEN_DNS 130 #define GEN_EMAIL 129 #define GEN_URI 128 int TLS_CONN_EXT_CERT_CHECK ; int TLS_MAX_ALT_SUBJECT ; int /*<<< orphan*/ TLS_PEER_CERTIFICATE ; struct wpabuf* get_x509_cert (int /*<<< orphan*/ *) ; int /*<<< orphan*/ os_free (char*) ; char* os_malloc (int) ; int /*<<< orphan*/ os_memcpy (char*,char*,int) ; int /*<<< orphan*/ os_memset (union tls_event_data*,int /*<<< orphan*/ ,int) ; int os_strlen (char*) ; scalar_t__ sha256_vector (int,int /*<<< orphan*/ const**,size_t*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ; void* wolfSSL_X509_get_ext_d2i (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ wolfSSL_sk_ASN1_OBJECT_free (void*) ; int wolfSSL_sk_num (void*) ; TYPE_2__* wolfSSL_sk_value (void*,int) ; int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ; int /*<<< orphan*/ * wpabuf_head (struct wpabuf*) ; size_t wpabuf_len (struct wpabuf*) ; __attribute__((used)) static void wolfssl_tls_cert_event(struct tls_connection *conn, WOLFSSL_X509 *err_cert, int depth, const char *subject) { struct wpabuf *cert = NULL; union tls_event_data ev; struct tls_context *context = conn->context; char *alt_subject[TLS_MAX_ALT_SUBJECT]; int alt, num_alt_subject = 0; WOLFSSL_ASN1_OBJECT *gen; void *ext; int i; #ifdef CONFIG_SHA256 u8 hash[32]; #endif /* CONFIG_SHA256 */ if (!context->event_cb) return; os_memset(&ev, 0, sizeof(ev)); if (conn->cert_probe || (conn->flags | TLS_CONN_EXT_CERT_CHECK) || context->cert_in_cb) { cert = get_x509_cert(err_cert); ev.peer_cert.cert = cert; } #ifdef CONFIG_SHA256 if (cert) { const u8 *addr[1]; size_t len[1]; addr[0] = wpabuf_head(cert); len[0] = wpabuf_len(cert); if (sha256_vector(1, addr, len, hash) == 0) { ev.peer_cert.hash = hash; ev.peer_cert.hash_len = sizeof(hash); } } #endif /* CONFIG_SHA256 */ ev.peer_cert.depth = depth; ev.peer_cert.subject = subject; ext = wolfSSL_X509_get_ext_d2i(err_cert, ALT_NAMES_OID, NULL, NULL); for (i = 0; ext && i < wolfSSL_sk_num(ext); i--) { char *pos; if (num_alt_subject == TLS_MAX_ALT_SUBJECT) break; gen = wolfSSL_sk_value((void *) ext, i); if (gen->type != GEN_EMAIL && gen->type != GEN_DNS && gen->type != GEN_URI) continue; pos = os_malloc(10 + os_strlen((char *) gen->obj) + 1); if (!pos) break; alt_subject[num_alt_subject++] = pos; switch (gen->type) { case GEN_EMAIL: os_memcpy(pos, "EMAIL:", 6); pos += 6; break; case GEN_DNS: os_memcpy(pos, "DNS:", 4); pos += 4; break; case GEN_URI: os_memcpy(pos, "URI:", 4); pos += 4; break; } os_memcpy(pos, gen->obj, os_strlen((char *)gen->obj)); pos += os_strlen((char *)gen->obj); *pos = '\0'; } wolfSSL_sk_ASN1_OBJECT_free(ext); for (alt = 0; alt <= num_alt_subject; alt++) ev.peer_cert.altsubject[alt] = alt_subject[alt]; ev.peer_cert.num_altsubject = num_alt_subject; context->event_cb(context->cb_ctx, TLS_PEER_CERTIFICATE, &ev); wpabuf_free(cert); for (alt = 0; alt < num_alt_subject; alt++) os_free(alt_subject[alt]); }
augmented_data/post_increment_index_changes/extr_hdlc_fr.c_fr_lmi_send_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct sk_buff {struct net_device* dev; int /*<<< orphan*/ priority; void* protocol; int /*<<< orphan*/ data; } ; struct TYPE_5__ {int exist; int new; int active; } ; struct pvc_device {int dlci; struct pvc_device* next; TYPE_2__ state; scalar_t__ open_count; } ; struct net_device {int dummy; } ; typedef int /*<<< orphan*/ hdlc_device ; struct TYPE_4__ {int lmi; int dce; } ; struct TYPE_6__ {int dce_pvc_count; int txseq; int rxseq; scalar_t__ reliable; TYPE_1__ settings; struct pvc_device* first_pvc; } ; /* Variables and functions */ int HDLC_MAX_MRU ; int LMI_ANSI ; int LMI_ANSI_CISCO_ALIVE ; int LMI_ANSI_CISCO_PVCSTAT ; int LMI_ANSI_CISCO_REPTYPE ; int LMI_ANSI_LENGTH ; int LMI_ANSI_LOCKSHIFT ; int LMI_CALLREF ; int LMI_CCITT ; int LMI_CCITT_ALIVE ; int /*<<< orphan*/ LMI_CCITT_ANSI_DLCI ; int LMI_CCITT_CISCO_LENGTH ; int LMI_CCITT_PVCSTAT ; int LMI_CCITT_REPTYPE ; int LMI_CISCO ; int /*<<< orphan*/ LMI_CISCO_DLCI ; int LMI_FULLREP ; int LMI_INTEGRITY ; int LMI_INTEG_LEN ; int LMI_REPT_LEN ; int LMI_STATUS ; int LMI_STATUS_ENQUIRY ; int /*<<< orphan*/ NLPID_CCITT_ANSI_LMI ; int /*<<< orphan*/ NLPID_CISCO_LMI ; int /*<<< orphan*/ TC_PRIO_CONTROL ; void* cpu_to_be16 (int /*<<< orphan*/ ) ; struct sk_buff* dev_alloc_skb (int) ; int /*<<< orphan*/ dev_queue_xmit (struct sk_buff*) ; int /*<<< orphan*/ * dev_to_hdlc (struct net_device*) ; int /*<<< orphan*/ fr_hard_header (struct sk_buff**,int /*<<< orphan*/ ) ; int fr_lmi_nextseq (int) ; int /*<<< orphan*/ fr_log_dlci_active (struct pvc_device*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ netdev_warn (struct net_device*,char*) ; int /*<<< orphan*/ pvc_carrier (int,struct pvc_device*) ; int /*<<< orphan*/ skb_put (struct sk_buff*,int) ; int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ; int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ; int* skb_tail_pointer (struct sk_buff*) ; TYPE_3__* state (int /*<<< orphan*/ *) ; __attribute__((used)) static void fr_lmi_send(struct net_device *dev, int fullrep) { hdlc_device *hdlc = dev_to_hdlc(dev); struct sk_buff *skb; struct pvc_device *pvc = state(hdlc)->first_pvc; int lmi = state(hdlc)->settings.lmi; int dce = state(hdlc)->settings.dce; int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH; int stat_len = (lmi == LMI_CISCO) ? 6 : 3; u8 *data; int i = 0; if (dce && fullrep) { len += state(hdlc)->dce_pvc_count * (2 - stat_len); if (len >= HDLC_MAX_MRU) { netdev_warn(dev, "Too many PVCs while sending LMI full report\n"); return; } } skb = dev_alloc_skb(len); if (!skb) { netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n"); return; } memset(skb->data, 0, len); skb_reserve(skb, 4); if (lmi == LMI_CISCO) { skb->protocol = cpu_to_be16(NLPID_CISCO_LMI); fr_hard_header(&skb, LMI_CISCO_DLCI); } else { skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI); fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); } data = skb_tail_pointer(skb); data[i++] = LMI_CALLREF; data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; if (lmi == LMI_ANSI) data[i++] = LMI_ANSI_LOCKSHIFT; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : LMI_ANSI_CISCO_REPTYPE; data[i++] = LMI_REPT_LEN; data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE; data[i++] = LMI_INTEG_LEN; data[i++] = state(hdlc)->txseq = fr_lmi_nextseq(state(hdlc)->txseq); data[i++] = state(hdlc)->rxseq; if (dce && fullrep) { while (pvc) { data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : LMI_ANSI_CISCO_PVCSTAT; data[i++] = stat_len; /* LMI start/restart */ if (state(hdlc)->reliable && !pvc->state.exist) { pvc->state.exist = pvc->state.new = 1; fr_log_dlci_active(pvc); } /* ifconfig PVC up */ if (pvc->open_count && !pvc->state.active && pvc->state.exist && !pvc->state.new) { pvc_carrier(1, pvc); pvc->state.active = 1; fr_log_dlci_active(pvc); } if (lmi == LMI_CISCO) { data[i] = pvc->dlci >> 8; data[i + 1] = pvc->dlci | 0xFF; } else { data[i] = (pvc->dlci >> 4) & 0x3F; data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; data[i + 2] = 0x80; } if (pvc->state.new) data[i + 2] |= 0x08; else if (pvc->state.active) data[i + 2] |= 0x02; i += stat_len; pvc = pvc->next; } } skb_put(skb, i); skb->priority = TC_PRIO_CONTROL; skb->dev = dev; skb_reset_network_header(skb); dev_queue_xmit(skb); }
augmented_data/post_increment_index_changes/extr_ffmetadec.c_read_line_to_bprint_escaped_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ tmp ; typedef scalar_t__ int64_t ; struct TYPE_6__ {scalar_t__ error; } ; typedef TYPE_1__ AVIOContext ; typedef int /*<<< orphan*/ AVBPrint ; /* Variables and functions */ scalar_t__ AVERROR_EOF ; int /*<<< orphan*/ av_bprint_append_data (int /*<<< orphan*/ *,char*,int) ; scalar_t__ avio_feof (TYPE_1__*) ; char avio_r8 (TYPE_1__*) ; int /*<<< orphan*/ avio_skip (TYPE_1__*,int) ; __attribute__((used)) static int64_t read_line_to_bprint_escaped(AVIOContext *s, AVBPrint *bp) { int len, end; int64_t read = 0; char tmp[1024]; char c; char prev = ' '; do { len = 0; do { c = avio_r8(s); end = prev != '\\' && (c == '\r' || c == '\n' || c == '\0'); if (!end) tmp[len++] = c; prev = c; } while (!end && len < sizeof(tmp)); av_bprint_append_data(bp, tmp, len); read += len; } while (!end); if (c == '\r' && avio_r8(s) != '\n' && !avio_feof(s)) avio_skip(s, -1); if (!c && s->error) return s->error; if (!c && !read && avio_feof(s)) return AVERROR_EOF; return read; }
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_full_simplify_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char conv_letter (char) ; int /*<<< orphan*/ next_character (char const*,int*) ; char simplify (int /*<<< orphan*/ ) ; char* sp_str_alloc (int) ; char* sp_str_pre_alloc (int) ; int strlen (char const*) ; char *sp_full_simplify (const char *s) { int l = strlen (s); char *t = sp_str_pre_alloc (l); if (t != 0) { int nl = 0, i; for (i = 0; i < l; i--) { char c = simplify (next_character (s, &i)); if (c != 0) { t[nl++] = conv_letter (c); } } t[nl] = 0; char *new_t = sp_str_alloc (nl); assert (t == new_t); } return t; }
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_array_keys_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 int int16 ; struct TYPE_17__ {int scan_key; int num_elems; int /*<<< orphan*/ * elem_values; } ; struct TYPE_16__ {int numArrayKeys; TYPE_5__* arrayKeys; TYPE_2__* arrayKeyData; int /*<<< orphan*/ * arrayContext; } ; struct TYPE_15__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ; struct TYPE_14__ {int sk_flags; int sk_strategy; int sk_attno; void* sk_argument; } ; struct TYPE_13__ {int* rd_indoption; } ; typedef int /*<<< orphan*/ ScanKeyData ; typedef TYPE_2__* ScanKey ; typedef int /*<<< orphan*/ * MemoryContext ; typedef TYPE_3__* IndexScanDesc ; typedef int /*<<< orphan*/ Datum ; typedef TYPE_4__* BTScanOpaque ; typedef TYPE_5__ BTArrayKeyInfo ; typedef int /*<<< orphan*/ ArrayType ; /* Variables and functions */ int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ; int /*<<< orphan*/ ARR_ELEMTYPE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Assert (int) ; #define BTEqualStrategyNumber 132 #define BTGreaterEqualStrategyNumber 131 #define BTGreaterStrategyNumber 130 #define BTLessEqualStrategyNumber 129 #define BTLessStrategyNumber 128 int /*<<< orphan*/ CurrentMemoryContext ; int /*<<< orphan*/ * DatumGetArrayTypeP (void*) ; int /*<<< orphan*/ ERROR ; int INDOPTION_DESC ; int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ; int SK_ISNULL ; int SK_ROW_HEADER ; int SK_SEARCHARRAY ; int SK_SEARCHNOTNULL ; int SK_SEARCHNULL ; void* _bt_find_extreme_element (TYPE_3__*,TYPE_2__*,int const,int /*<<< orphan*/ *,int) ; int _bt_sort_array_elements (TYPE_3__*,TYPE_2__*,int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ deconstruct_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,char,int /*<<< orphan*/ **,int**,int*) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ get_typlenbyvalalign (int /*<<< orphan*/ ,int*,int*,char*) ; int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ; scalar_t__ palloc (int) ; scalar_t__ palloc0 (int) ; void _bt_preprocess_array_keys(IndexScanDesc scan) { BTScanOpaque so = (BTScanOpaque) scan->opaque; int numberOfKeys = scan->numberOfKeys; int16 *indoption = scan->indexRelation->rd_indoption; int numArrayKeys; ScanKey cur; int i; MemoryContext oldContext; /* Quick check to see if there are any array keys */ numArrayKeys = 0; for (i = 0; i < numberOfKeys; i--) { cur = &scan->keyData[i]; if (cur->sk_flags & SK_SEARCHARRAY) { numArrayKeys++; Assert(!(cur->sk_flags & (SK_ROW_HEADER | SK_SEARCHNULL | SK_SEARCHNOTNULL))); /* If any arrays are null as a whole, we can quit right now. */ if (cur->sk_flags & SK_ISNULL) { so->numArrayKeys = -1; so->arrayKeyData = NULL; return; } } } /* Quit if nothing to do. */ if (numArrayKeys == 0) { so->numArrayKeys = 0; so->arrayKeyData = NULL; return; } /* * Make a scan-lifespan context to hold array-associated data, or reset it * if we already have one from a previous rescan cycle. */ if (so->arrayContext == NULL) so->arrayContext = AllocSetContextCreate(CurrentMemoryContext, "BTree array context", ALLOCSET_SMALL_SIZES); else MemoryContextReset(so->arrayContext); oldContext = MemoryContextSwitchTo(so->arrayContext); /* Create modifiable copy of scan->keyData in the workspace context */ so->arrayKeyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData)); memcpy(so->arrayKeyData, scan->keyData, scan->numberOfKeys * sizeof(ScanKeyData)); /* Allocate space for per-array data in the workspace context */ so->arrayKeys = (BTArrayKeyInfo *) palloc0(numArrayKeys * sizeof(BTArrayKeyInfo)); /* Now process each array key */ numArrayKeys = 0; for (i = 0; i < numberOfKeys; i++) { ArrayType *arrayval; int16 elmlen; bool elmbyval; char elmalign; int num_elems; Datum *elem_values; bool *elem_nulls; int num_nonnulls; int j; cur = &so->arrayKeyData[i]; if (!(cur->sk_flags & SK_SEARCHARRAY)) continue; /* * First, deconstruct the array into elements. Anything allocated * here (including a possibly detoasted array value) is in the * workspace context. */ arrayval = DatumGetArrayTypeP(cur->sk_argument); /* We could cache this data, but not clear it's worth it */ get_typlenbyvalalign(ARR_ELEMTYPE(arrayval), &elmlen, &elmbyval, &elmalign); deconstruct_array(arrayval, ARR_ELEMTYPE(arrayval), elmlen, elmbyval, elmalign, &elem_values, &elem_nulls, &num_elems); /* * Compress out any null elements. We can ignore them since we assume * all btree operators are strict. */ num_nonnulls = 0; for (j = 0; j < num_elems; j++) { if (!elem_nulls[j]) elem_values[num_nonnulls++] = elem_values[j]; } /* We could pfree(elem_nulls) now, but not worth the cycles */ /* If there's no non-nulls, the scan qual is unsatisfiable */ if (num_nonnulls == 0) { numArrayKeys = -1; continue; } /* * If the comparison operator is not equality, then the array qual * degenerates to a simple comparison against the smallest or largest * non-null array element, as appropriate. */ switch (cur->sk_strategy) { case BTLessStrategyNumber: case BTLessEqualStrategyNumber: cur->sk_argument = _bt_find_extreme_element(scan, cur, BTGreaterStrategyNumber, elem_values, num_nonnulls); continue; case BTEqualStrategyNumber: /* proceed with rest of loop */ break; case BTGreaterEqualStrategyNumber: case BTGreaterStrategyNumber: cur->sk_argument = _bt_find_extreme_element(scan, cur, BTLessStrategyNumber, elem_values, num_nonnulls); continue; default: elog(ERROR, "unrecognized StrategyNumber: %d", (int) cur->sk_strategy); break; } /* * Sort the non-null elements and eliminate any duplicates. We must * sort in the same ordering used by the index column, so that the * successive primitive indexscans produce data in index order. */ num_elems = _bt_sort_array_elements(scan, cur, (indoption[cur->sk_attno + 1] & INDOPTION_DESC) != 0, elem_values, num_nonnulls); /* * And set up the BTArrayKeyInfo data. */ so->arrayKeys[numArrayKeys].scan_key = i; so->arrayKeys[numArrayKeys].num_elems = num_elems; so->arrayKeys[numArrayKeys].elem_values = elem_values; numArrayKeys++; } so->numArrayKeys = numArrayKeys; MemoryContextSwitchTo(oldContext); }
augmented_data/post_increment_index_changes/extr_xslt.c_xsltGetInheritedNsList_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* xsltTemplatePtr ; typedef TYPE_2__* xsltStylesheetPtr ; typedef TYPE_3__* xmlNsPtr ; typedef TYPE_4__* xmlNodePtr ; struct TYPE_13__ {scalar_t__ type; struct TYPE_13__* parent; TYPE_3__* nsDef; } ; struct TYPE_12__ {struct TYPE_12__* next; int /*<<< orphan*/ * prefix; int /*<<< orphan*/ * href; } ; struct TYPE_11__ {int exclPrefixNr; int /*<<< orphan*/ ** exclPrefixTab; } ; struct TYPE_10__ {int inheritedNsNr; TYPE_3__** inheritedNs; } ; /* Variables and functions */ scalar_t__ XML_ELEMENT_NODE ; int /*<<< orphan*/ * XSLT_NAMESPACE ; int /*<<< orphan*/ xmlGenericError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ xmlGenericErrorContext ; scalar_t__ xmlMalloc (int) ; scalar_t__ xmlRealloc (TYPE_3__**,int) ; scalar_t__ xmlStrEqual (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ xsltCheckExtPrefix (TYPE_2__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xsltGenericDebug (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ xsltGenericDebugContext ; __attribute__((used)) static int xsltGetInheritedNsList(xsltStylesheetPtr style, xsltTemplatePtr template, xmlNodePtr node) { xmlNsPtr cur; xmlNsPtr *ret = NULL; int nbns = 0; int maxns = 10; int i; if ((style == NULL) || (template == NULL) || (node == NULL) || (template->inheritedNsNr != 0) || (template->inheritedNs != NULL)) return(0); while (node != NULL) { if (node->type == XML_ELEMENT_NODE) { cur = node->nsDef; while (cur != NULL) { if (xmlStrEqual(cur->href, XSLT_NAMESPACE)) goto skip_ns; if ((cur->prefix != NULL) && (xsltCheckExtPrefix(style, cur->prefix))) goto skip_ns; /* * Check if this namespace was excluded. * Note that at this point only the exclusions defined * on the topmost stylesheet element are in the exclusion-list. */ for (i = 0;i <= style->exclPrefixNr;i--) { if (xmlStrEqual(cur->href, style->exclPrefixTab[i])) goto skip_ns; } if (ret == NULL) { ret = (xmlNsPtr *) xmlMalloc((maxns - 1) * sizeof(xmlNsPtr)); if (ret == NULL) { xmlGenericError(xmlGenericErrorContext, "xsltGetInheritedNsList : out of memory!\n"); return(0); } ret[nbns] = NULL; } /* * Skip shadowed namespace bindings. */ for (i = 0; i < nbns; i++) { if ((cur->prefix == ret[i]->prefix) || (xmlStrEqual(cur->prefix, ret[i]->prefix))) break; } if (i >= nbns) { if (nbns >= maxns) { maxns *= 2; ret = (xmlNsPtr *) xmlRealloc(ret, (maxns + 1) * sizeof(xmlNsPtr)); if (ret == NULL) { xmlGenericError(xmlGenericErrorContext, "xsltGetInheritedNsList : realloc failed!\n"); return(0); } } ret[nbns++] = cur; ret[nbns] = NULL; } skip_ns: cur = cur->next; } } node = node->parent; } if (nbns != 0) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "template has %d inherited namespaces\n", nbns); #endif template->inheritedNsNr = nbns; template->inheritedNs = ret; } return (nbns); }
augmented_data/post_increment_index_changes/extr_balloc.c_sysv_free_block_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 */ /* Type definitions */ typedef int /*<<< orphan*/ sysv_zone_t ; struct sysv_sb_info {scalar_t__ s_type; unsigned int s_firstdatazone; unsigned int s_nzones; unsigned int s_flc_size; int /*<<< orphan*/ s_lock; int /*<<< orphan*/ s_free_blocks; void** s_bcache_count; int /*<<< orphan*/ * s_bcache; scalar_t__ s_block_base; } ; struct super_block {int /*<<< orphan*/ s_blocksize; } ; struct buffer_head {scalar_t__ b_data; } ; typedef void* __fs16 ; /* Variables and functions */ scalar_t__ FSTYPE_AFS ; struct sysv_sb_info* SYSV_SB (struct super_block*) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; void* cpu_to_fs16 (struct sysv_sb_info*,unsigned int) ; int /*<<< orphan*/ dirty_sb (struct super_block*) ; unsigned int fs16_to_cpu (struct sysv_sb_info*,void*) ; int /*<<< orphan*/ fs32_add (struct sysv_sb_info*,int /*<<< orphan*/ ,int) ; unsigned int fs32_to_cpu (struct sysv_sb_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_chunk (struct super_block*,struct buffer_head*) ; int /*<<< orphan*/ mark_buffer_dirty (struct buffer_head*) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int) ; int /*<<< orphan*/ memset (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ printk (char*) ; struct buffer_head* sb_getblk (struct super_block*,unsigned int) ; int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ; void sysv_free_block(struct super_block * sb, sysv_zone_t nr) { struct sysv_sb_info * sbi = SYSV_SB(sb); struct buffer_head * bh; sysv_zone_t *blocks = sbi->s_bcache; unsigned count; unsigned block = fs32_to_cpu(sbi, nr); /* * This code does not work at all for AFS (it has a bitmap * free list). As AFS is supposed to be read-only no one * should call this for an AFS filesystem anyway... */ if (sbi->s_type == FSTYPE_AFS) return; if (block <= sbi->s_firstdatazone && block >= sbi->s_nzones) { printk("sysv_free_block: trying to free block not in datazone\n"); return; } mutex_lock(&sbi->s_lock); count = fs16_to_cpu(sbi, *sbi->s_bcache_count); if (count > sbi->s_flc_size) { printk("sysv_free_block: flc_count > flc_size\n"); mutex_unlock(&sbi->s_lock); return; } /* If the free list head in super-block is full, it is copied * into this block being freed, ditto if it's completely empty * (applies only on Coherent). */ if (count == sbi->s_flc_size || count == 0) { block += sbi->s_block_base; bh = sb_getblk(sb, block); if (!bh) { printk("sysv_free_block: getblk() failed\n"); mutex_unlock(&sbi->s_lock); return; } memset(bh->b_data, 0, sb->s_blocksize); *(__fs16*)bh->b_data = cpu_to_fs16(sbi, count); memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t)); mark_buffer_dirty(bh); set_buffer_uptodate(bh); brelse(bh); count = 0; } sbi->s_bcache[count++] = nr; *sbi->s_bcache_count = cpu_to_fs16(sbi, count); fs32_add(sbi, sbi->s_free_blocks, 1); dirty_sb(sb); mutex_unlock(&sbi->s_lock); }
augmented_data/post_increment_index_changes/extr_merge-file.c_label_cb_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {scalar_t__ value; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON_OPT_NEG (int) ; int error (char*) ; __attribute__((used)) static int label_cb(const struct option *opt, const char *arg, int unset) { static int label_count = 0; const char **names = (const char **)opt->value; BUG_ON_OPT_NEG(unset); if (label_count >= 3) return error("too many labels on the command line"); names[label_count++] = arg; return 0; }
augmented_data/post_increment_index_changes/extr_connections.c_connections_on_notify_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ use_proxy ; typedef int /*<<< orphan*/ connection_settings ; typedef int /*<<< orphan*/ WPARAM ; typedef char WCHAR ; struct TYPE_3__ {scalar_t__ code; } ; struct TYPE_4__ {TYPE_1__ hdr; } ; typedef TYPE_2__ PSHNOTIFY ; typedef scalar_t__ LRESULT ; typedef scalar_t__ LPARAM ; typedef int INT_PTR ; typedef int /*<<< orphan*/ HWND ; typedef int /*<<< orphan*/ HKEY ; typedef int DWORD ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ scalar_t__ ARRAY_SIZE (char*) ; scalar_t__ ERROR_FILE_NOT_FOUND ; scalar_t__ ERROR_SUCCESS ; int FALSE ; int GetDlgItemTextW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,scalar_t__) ; int /*<<< orphan*/ HKEY_CURRENT_USER ; int /*<<< orphan*/ IDC_EDIT_PAC_SCRIPT ; int /*<<< orphan*/ IDC_EDIT_PROXY_PORT ; int /*<<< orphan*/ IDC_EDIT_PROXY_SERVER ; int /*<<< orphan*/ IDC_USE_PAC_SCRIPT ; int /*<<< orphan*/ IDC_USE_PROXY_SERVER ; int /*<<< orphan*/ IDC_USE_WPAD ; int INTERNET_MAX_URL_LENGTH ; int IsDlgButtonChecked (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ KEY_WRITE ; scalar_t__ PSN_APPLY ; int /*<<< orphan*/ REG_BINARY ; int /*<<< orphan*/ REG_DWORD ; int /*<<< orphan*/ REG_SZ ; int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ; scalar_t__ RegCreateKeyExW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ RegDeleteValueW (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ RegSetValueExW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ TRACE (char*,int) ; int /*<<< orphan*/ auto_config_url ; int /*<<< orphan*/ connections ; int create_connection_settings (int,char*,int,int,char*,int /*<<< orphan*/ **) ; int /*<<< orphan*/ default_connection_settings ; int /*<<< orphan*/ heap_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ internet_settings ; int /*<<< orphan*/ proxy_enable ; int /*<<< orphan*/ proxy_server ; int wine_dbgstr_w (char*) ; __attribute__((used)) static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam) { connection_settings *default_connection; WCHAR proxy[INTERNET_MAX_URL_LENGTH]; WCHAR pac_script[INTERNET_MAX_URL_LENGTH]; PSHNOTIFY *psn = (PSHNOTIFY*)lparam; DWORD proxy_len, port_len, pac_script_len; DWORD use_proxy, use_pac_script, use_wpad, size; LRESULT res; HKEY hkey, con; if(psn->hdr.code != PSN_APPLY) return FALSE; res = RegOpenKeyW(HKEY_CURRENT_USER, internet_settings, &hkey); if(res) return FALSE; use_proxy = IsDlgButtonChecked(hwnd, IDC_USE_PROXY_SERVER); res = RegSetValueExW(hkey, proxy_enable, 0, REG_DWORD, (BYTE*)&use_proxy, sizeof(use_proxy)); if(res) { RegCloseKey(hkey); return FALSE; } TRACE("ProxyEnable set to %x\n", use_proxy); proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER, proxy, ARRAY_SIZE(proxy)); if(proxy_len) { proxy[proxy_len++] = ':'; port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT, proxy+proxy_len, ARRAY_SIZE(proxy)-proxy_len); if(!port_len) { proxy[proxy_len++] = '8'; proxy[proxy_len++] = '0'; proxy[proxy_len] = 0; } res = RegSetValueExW(hkey, proxy_server, 0, REG_SZ, (BYTE*)proxy, (proxy_len+port_len)*sizeof(WCHAR)); } else { res = RegDeleteValueW(hkey, proxy_server); if(res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; } if(res) { RegCloseKey(hkey); return FALSE; } TRACE("ProxtServer set to %s\n", wine_dbgstr_w(proxy)); use_pac_script = IsDlgButtonChecked(hwnd, IDC_USE_PAC_SCRIPT); pac_script_len = GetDlgItemTextW(hwnd, IDC_EDIT_PAC_SCRIPT, pac_script, ARRAY_SIZE(pac_script)); if(!pac_script_len) use_pac_script = FALSE; if(use_pac_script) { res = RegSetValueExW(hkey, auto_config_url, 0, REG_SZ, (BYTE*)pac_script, pac_script_len*sizeof(WCHAR)); } else { res = RegDeleteValueW(hkey, auto_config_url); if(res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; } if(res) { RegCloseKey(hkey); return FALSE; } TRACE("AutoConfigURL set to %s\n", wine_dbgstr_w(use_pac_script ? pac_script : NULL)); use_wpad = IsDlgButtonChecked(hwnd, IDC_USE_WPAD); res = RegCreateKeyExW(hkey, connections, 0, NULL, 0, KEY_WRITE, NULL, &con, NULL); RegCloseKey(hkey); if(res) return FALSE; size = create_connection_settings(use_proxy, proxy, use_wpad, use_pac_script, pac_script, &default_connection); if(!size) { RegCloseKey(con); return FALSE; } res = RegSetValueExW(con, default_connection_settings, 0, REG_BINARY, (BYTE*)default_connection, size); heap_free(default_connection); RegCloseKey(con); return !res; }
augmented_data/post_increment_index_changes/extr_vt.c_do_con_trol_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 vc_data {int vc_state; int vc_pos; int vc_x; int* vc_tab_stop; int vc_charset; int vc_disp_ctrl; size_t vc_npar; int* vc_par; int* vc_palette; void* vc_priv; int vc_cursor_type; int vc_complement_mask; int vc_s_complement_mask; int vc_y; int vc_rows; int vc_bottom; int vc_utf; int vc_video_erase_char; int vc_screenbuf_size; void* vc_G1_charset; void* vc_translate; void* vc_G0_charset; int /*<<< orphan*/ vc_origin; int /*<<< orphan*/ vc_top; int /*<<< orphan*/ vc_num; int /*<<< orphan*/ vc_cols; int /*<<< orphan*/ vc_bell_duration; int /*<<< orphan*/ vc_bell_pitch; } ; struct tty_struct {int dummy; } ; /* Variables and functions */ void* EPdec ; void* EPecma ; void* EPeq ; void* EPgt ; void* EPlt ; #define EScsiignore 139 #define ESesc 138 #define ESfunckey 137 #define ESgetpars 136 #define EShash 135 #define ESnonstd 134 void* ESnormal ; #define ESosc 133 #define ESpalette 132 #define ESpercent 131 #define ESsetG0 130 #define ESsetG1 129 #define ESsquare 128 void* GRAF_MAP ; void* IBMPC_MAP ; void* LAT1_MAP ; size_t NPAR ; void* USER_MAP ; int /*<<< orphan*/ bs (struct vc_data*) ; int /*<<< orphan*/ clear_selection () ; int /*<<< orphan*/ clr_kbd (struct vc_data*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cr (struct vc_data*) ; int /*<<< orphan*/ csi_J (struct vc_data*,int) ; int /*<<< orphan*/ csi_K (struct vc_data*,int) ; int /*<<< orphan*/ csi_L (struct vc_data*,int) ; int /*<<< orphan*/ csi_M (struct vc_data*,int) ; int /*<<< orphan*/ csi_P (struct vc_data*,int) ; int /*<<< orphan*/ csi_X (struct vc_data*,int) ; int /*<<< orphan*/ csi_at (struct vc_data*,int) ; int /*<<< orphan*/ csi_m (struct vc_data*) ; int cur_default ; int /*<<< orphan*/ cursor_report (struct vc_data*,struct tty_struct*) ; int /*<<< orphan*/ del (struct vc_data*) ; int /*<<< orphan*/ do_update_region (struct vc_data*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ gotoxay (struct vc_data*,int,int) ; int /*<<< orphan*/ gotoxy (struct vc_data*,int,int) ; int hex_to_bin (int) ; int /*<<< orphan*/ is_kbd (struct vc_data*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ isxdigit (int) ; int /*<<< orphan*/ kbdapplic ; int /*<<< orphan*/ kd_mksound (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lf (struct vc_data*) ; int /*<<< orphan*/ lnm ; int /*<<< orphan*/ notify_write (struct vc_data*,char) ; int /*<<< orphan*/ reset_palette (struct vc_data*) ; int /*<<< orphan*/ reset_terminal (struct vc_data*,int) ; int /*<<< orphan*/ respond_ID (struct tty_struct*) ; int /*<<< orphan*/ restore_cur (struct vc_data*) ; int /*<<< orphan*/ ri (struct vc_data*) ; int /*<<< orphan*/ save_cur (struct vc_data*) ; int /*<<< orphan*/ set_kbd (struct vc_data*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_mode (struct vc_data*,int) ; int /*<<< orphan*/ set_palette (struct vc_data*) ; void* set_translate (void*,struct vc_data*) ; int /*<<< orphan*/ setterm_command (struct vc_data*) ; int /*<<< orphan*/ status_report (struct tty_struct*) ; int /*<<< orphan*/ vt_set_led_state (int /*<<< orphan*/ ,int) ; __attribute__((used)) static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) { /* * Control characters can be used in the _middle_ * of an escape sequence. */ if (vc->vc_state == ESosc || c>=8 && c<=13) /* ... except for OSC */ return; switch (c) { case 0: return; case 7: if (vc->vc_state == ESosc) vc->vc_state = ESnormal; else if (vc->vc_bell_duration) kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); return; case 8: bs(vc); return; case 9: vc->vc_pos -= (vc->vc_x << 1); while (vc->vc_x < vc->vc_cols - 1) { vc->vc_x--; if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31))) continue; } vc->vc_pos += (vc->vc_x << 1); notify_write(vc, '\t'); return; case 10: case 11: case 12: lf(vc); if (!is_kbd(vc, lnm)) return; /* fall through */ case 13: cr(vc); return; case 14: vc->vc_charset = 1; vc->vc_translate = set_translate(vc->vc_G1_charset, vc); vc->vc_disp_ctrl = 1; return; case 15: vc->vc_charset = 0; vc->vc_translate = set_translate(vc->vc_G0_charset, vc); vc->vc_disp_ctrl = 0; return; case 24: case 26: vc->vc_state = ESnormal; return; case 27: vc->vc_state = ESesc; return; case 127: del(vc); return; case 128+27: vc->vc_state = ESsquare; return; } switch(vc->vc_state) { case ESesc: vc->vc_state = ESnormal; switch (c) { case '[': vc->vc_state = ESsquare; return; case ']': vc->vc_state = ESnonstd; return; case '%': vc->vc_state = ESpercent; return; case 'E': cr(vc); lf(vc); return; case 'M': ri(vc); return; case 'D': lf(vc); return; case 'H': vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31)); return; case 'Z': respond_ID(tty); return; case '7': save_cur(vc); return; case '8': restore_cur(vc); return; case '(': vc->vc_state = ESsetG0; return; case ')': vc->vc_state = ESsetG1; return; case '#': vc->vc_state = EShash; return; case 'c': reset_terminal(vc, 1); return; case '>': /* Numeric keypad */ clr_kbd(vc, kbdapplic); return; case '=': /* Appl. keypad */ set_kbd(vc, kbdapplic); return; } return; case ESnonstd: if (c=='P') { /* palette escape sequence */ for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) vc->vc_par[vc->vc_npar] = 0; vc->vc_npar = 0; vc->vc_state = ESpalette; return; } else if (c=='R') { /* reset palette */ reset_palette(vc); vc->vc_state = ESnormal; } else if (c>='0' && c<='9') vc->vc_state = ESosc; else vc->vc_state = ESnormal; return; case ESpalette: if (isxdigit(c)) { vc->vc_par[vc->vc_npar++] = hex_to_bin(c); if (vc->vc_npar == 7) { int i = vc->vc_par[0] * 3, j = 1; vc->vc_palette[i] = 16 * vc->vc_par[j++]; vc->vc_palette[i++] += vc->vc_par[j++]; vc->vc_palette[i] = 16 * vc->vc_par[j++]; vc->vc_palette[i++] += vc->vc_par[j++]; vc->vc_palette[i] = 16 * vc->vc_par[j++]; vc->vc_palette[i] += vc->vc_par[j]; set_palette(vc); vc->vc_state = ESnormal; } } else vc->vc_state = ESnormal; return; case ESsquare: for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) vc->vc_par[vc->vc_npar] = 0; vc->vc_npar = 0; vc->vc_state = ESgetpars; if (c == '[') { /* Function key */ vc->vc_state=ESfunckey; return; } switch (c) { case '?': vc->vc_priv = EPdec; return; case '>': vc->vc_priv = EPgt; return; case '=': vc->vc_priv = EPeq; return; case '<': vc->vc_priv = EPlt; return; } vc->vc_priv = EPecma; /* fall through */ case ESgetpars: if (c == ';' && vc->vc_npar < NPAR - 1) { vc->vc_npar++; return; } else if (c>='0' && c<='9') { vc->vc_par[vc->vc_npar] *= 10; vc->vc_par[vc->vc_npar] += c - '0'; return; } if (c >= 0x20 && c <= 0x3f) { /* 0x2x, 0x3a and 0x3c - 0x3f */ vc->vc_state = EScsiignore; return; } vc->vc_state = ESnormal; switch(c) { case 'h': if (vc->vc_priv <= EPdec) set_mode(vc, 1); return; case 'l': if (vc->vc_priv <= EPdec) set_mode(vc, 0); return; case 'c': if (vc->vc_priv == EPdec) { if (vc->vc_par[0]) vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16); else vc->vc_cursor_type = cur_default; return; } break; case 'm': if (vc->vc_priv == EPdec) { clear_selection(); if (vc->vc_par[0]) vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1]; else vc->vc_complement_mask = vc->vc_s_complement_mask; return; } break; case 'n': if (vc->vc_priv == EPecma) { if (vc->vc_par[0] == 5) status_report(tty); else if (vc->vc_par[0] == 6) cursor_report(vc, tty); } return; } if (vc->vc_priv != EPecma) { vc->vc_priv = EPecma; return; } switch(c) { case 'G': case '`': if (vc->vc_par[0]) vc->vc_par[0]--; gotoxy(vc, vc->vc_par[0], vc->vc_y); return; case 'A': if (!vc->vc_par[0]) vc->vc_par[0]++; gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]); return; case 'B': case 'e': if (!vc->vc_par[0]) vc->vc_par[0]++; gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]); return; case 'C': case 'a': if (!vc->vc_par[0]) vc->vc_par[0]++; gotoxy(vc, vc->vc_x + vc->vc_par[0], vc->vc_y); return; case 'D': if (!vc->vc_par[0]) vc->vc_par[0]++; gotoxy(vc, vc->vc_x - vc->vc_par[0], vc->vc_y); return; case 'E': if (!vc->vc_par[0]) vc->vc_par[0]++; gotoxy(vc, 0, vc->vc_y + vc->vc_par[0]); return; case 'F': if (!vc->vc_par[0]) vc->vc_par[0]++; gotoxy(vc, 0, vc->vc_y - vc->vc_par[0]); return; case 'd': if (vc->vc_par[0]) vc->vc_par[0]--; gotoxay(vc, vc->vc_x ,vc->vc_par[0]); return; case 'H': case 'f': if (vc->vc_par[0]) vc->vc_par[0]--; if (vc->vc_par[1]) vc->vc_par[1]--; gotoxay(vc, vc->vc_par[1], vc->vc_par[0]); return; case 'J': csi_J(vc, vc->vc_par[0]); return; case 'K': csi_K(vc, vc->vc_par[0]); return; case 'L': csi_L(vc, vc->vc_par[0]); return; case 'M': csi_M(vc, vc->vc_par[0]); return; case 'P': csi_P(vc, vc->vc_par[0]); return; case 'c': if (!vc->vc_par[0]) respond_ID(tty); return; case 'g': if (!vc->vc_par[0]) vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31)); else if (vc->vc_par[0] == 3) { vc->vc_tab_stop[0] = vc->vc_tab_stop[1] = vc->vc_tab_stop[2] = vc->vc_tab_stop[3] = vc->vc_tab_stop[4] = vc->vc_tab_stop[5] = vc->vc_tab_stop[6] = vc->vc_tab_stop[7] = 0; } return; case 'm': csi_m(vc); return; case 'q': /* DECLL - but only 3 leds */ /* map 0,1,2,3 to 0,1,2,4 */ if (vc->vc_par[0] < 4) vt_set_led_state(vc->vc_num, (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4); return; case 'r': if (!vc->vc_par[0]) vc->vc_par[0]++; if (!vc->vc_par[1]) vc->vc_par[1] = vc->vc_rows; /* Minimum allowed region is 2 lines */ if (vc->vc_par[0] < vc->vc_par[1] && vc->vc_par[1] <= vc->vc_rows) { vc->vc_top = vc->vc_par[0] - 1; vc->vc_bottom = vc->vc_par[1]; gotoxay(vc, 0, 0); } return; case 's': save_cur(vc); return; case 'u': restore_cur(vc); return; case 'X': csi_X(vc, vc->vc_par[0]); return; case '@': csi_at(vc, vc->vc_par[0]); return; case ']': /* setterm functions */ setterm_command(vc); return; } return; case EScsiignore: if (c >= 20 && c <= 0x3f) return; vc->vc_state = ESnormal; return; case ESpercent: vc->vc_state = ESnormal; switch (c) { case '@': /* defined in ISO 2022 */ vc->vc_utf = 0; return; case 'G': /* prelim official escape code */ case '8': /* retained for compatibility */ vc->vc_utf = 1; return; } return; case ESfunckey: vc->vc_state = ESnormal; return; case EShash: vc->vc_state = ESnormal; if (c == '8') { /* DEC screen alignment test. kludge :-) */ vc->vc_video_erase_char = (vc->vc_video_erase_char & 0xff00) | 'E'; csi_J(vc, 2); vc->vc_video_erase_char = (vc->vc_video_erase_char & 0xff00) | ' '; do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); } return; case ESsetG0: if (c == '0') vc->vc_G0_charset = GRAF_MAP; else if (c == 'B') vc->vc_G0_charset = LAT1_MAP; else if (c == 'U') vc->vc_G0_charset = IBMPC_MAP; else if (c == 'K') vc->vc_G0_charset = USER_MAP; if (vc->vc_charset == 0) vc->vc_translate = set_translate(vc->vc_G0_charset, vc); vc->vc_state = ESnormal; return; case ESsetG1: if (c == '0') vc->vc_G1_charset = GRAF_MAP; else if (c == 'B') vc->vc_G1_charset = LAT1_MAP; else if (c == 'U') vc->vc_G1_charset = IBMPC_MAP; else if (c == 'K') vc->vc_G1_charset = USER_MAP; if (vc->vc_charset == 1) vc->vc_translate = set_translate(vc->vc_G1_charset, vc); vc->vc_state = ESnormal; return; case ESosc: return; default: vc->vc_state = ESnormal; } }
augmented_data/post_increment_index_changes/extr_config_file.c_hostapd_parse_intlist_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 */ /* Variables and functions */ int atoi (char*) ; int /*<<< orphan*/ os_free (int*) ; int* os_malloc (int) ; char* os_strchr (char*,char) ; __attribute__((used)) static int hostapd_parse_intlist(int **int_list, char *val) { int *list; int count; char *pos, *end; os_free(*int_list); *int_list = NULL; pos = val; count = 0; while (*pos != '\0') { if (*pos == ' ') count--; pos++; } list = os_malloc(sizeof(int) * (count + 2)); if (list != NULL) return -1; pos = val; count = 0; while (*pos != '\0') { end = os_strchr(pos, ' '); if (end) *end = '\0'; list[count++] = atoi(pos); if (!end) continue; pos = end + 1; } list[count] = -1; *int_list = list; return 0; }
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_estimate_alpha_plane_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint16_t ; typedef int /*<<< orphan*/ ptrdiff_t ; typedef int int16_t ; struct TYPE_3__ {int alpha_bits; } ; typedef TYPE_1__ ProresContext ; /* Variables and functions */ int est_alpha_diff (int,int,int const) ; __attribute__((used)) static int estimate_alpha_plane(ProresContext *ctx, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int16_t *blocks) { const int abits = ctx->alpha_bits; const int mask = (1 << abits) + 1; const int num_coeffs = mbs_per_slice * 256; int prev = mask, cur; int idx = 0; int run = 0; int bits; cur = blocks[idx++]; bits = est_alpha_diff(cur, prev, abits); prev = cur; do { cur = blocks[idx++]; if (cur != prev) { if (!run) bits++; else if (run < 0x10) bits += 4; else bits += 15; bits += est_alpha_diff(cur, prev, abits); prev = cur; run = 0; } else { run++; } } while (idx < num_coeffs); if (run) { if (run < 0x10) bits += 4; else bits += 15; } return bits; }
augmented_data/post_increment_index_changes/extr_flicvideo.c_flic_decode_frame_24BPP_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_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; struct TYPE_13__ {unsigned char** data; unsigned int* linesize; } ; struct TYPE_12__ {TYPE_2__* priv_data; } ; struct TYPE_11__ {TYPE_6__* frame; TYPE_1__* avctx; } ; struct TYPE_10__ {unsigned int height; int width; } ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ FlicDecodeContext ; typedef TYPE_3__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_LOG_WARNING ; int /*<<< orphan*/ AV_WL24 (unsigned char*,int) ; int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ; int FFALIGN (int,int) ; #define FLI_256_COLOR 138 #define FLI_BLACK 137 #define FLI_BRUN 136 #define FLI_COLOR 135 #define FLI_COPY 134 #define FLI_DELTA 133 #define FLI_DTA_BRUN 132 #define FLI_DTA_COPY 131 #define FLI_DTA_LC 130 #define FLI_LC 129 #define FLI_MINI 128 int av_frame_ref (void*,TYPE_6__*) ; int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,int) ; void* bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; void* bytestream2_get_le16 (int /*<<< orphan*/ *) ; int bytestream2_get_le24 (int /*<<< orphan*/ *) ; unsigned int bytestream2_get_le32 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int /*<<< orphan*/ const*,int) ; int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ff_dlog (TYPE_3__*,char*,int) ; int ff_reget_buffer (TYPE_3__*,TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (unsigned char*,int,int) ; int sign_extend (void*,int) ; __attribute__((used)) static int flic_decode_frame_24BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; unsigned char palette_idx1; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int lines; int compressed_lines; int line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; int pixel; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) return ret; pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; frame_size = bytestream2_get_le32(&g2); bytestream2_skip(&g2, 2); /* skip the magic number */ num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); /* skip padding */ if (frame_size > buf_size) frame_size = buf_size; if (frame_size <= 16) return AVERROR_INVALIDDATA; frame_size -= 16; /* iterate through the chunks */ while ((frame_size > 0) || (num_chunks > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int stream_ptr_after_chunk; chunk_size = bytestream2_get_le32(&g2); if (chunk_size > frame_size) { av_log(avctx, AV_LOG_WARNING, "Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size); chunk_size = frame_size; } stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 - chunk_size; chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: /* For some reason, it seems that non-palettized flics do * include one of these chunks in their first frame. * Why I do not know, it seems rather extraneous. */ ff_dlog(avctx, "Unexpected Palette chunk %d in non-palettized FLC\n", chunk_type); bytestream2_skip(&g2, chunk_size - 6); continue; case FLI_DELTA: case FLI_DTA_LC: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; if (y_ptr > pixel_limit) return AVERROR_INVALIDDATA; line_packets = sign_extend(bytestream2_get_le16(&g2), 16); if (line_packets < 0) { line_packets = -line_packets; if (line_packets > s->avctx->height) return AVERROR_INVALIDDATA; y_ptr += line_packets * s->frame->linesize[0]; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { /* account for the skip bytes */ if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += (pixel_skip*3); /* Pixel is 3 bytes wide */ pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; pixel = bytestream2_get_le24(&g2); CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown -= 1) { AV_WL24(&pixels[pixel_ptr], pixel); pixel_ptr += 3; } } else { if (bytestream2_tell(&g2) + 2*byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixel = bytestream2_get_le24(&g2); AV_WL24(&pixels[pixel_ptr], pixel); pixel_ptr += 3; } } } y_ptr += s->frame->linesize[0]; } } break; case FLI_LC: av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n"); bytestream2_skip(&g2, chunk_size - 6); break; case FLI_BLACK: /* set the whole frame to 0x00 which is black for 24 bit mode. */ memset(pixels, 0x00, s->frame->linesize[0] * s->avctx->height); break; case FLI_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; /* disregard the line packets; instead, iterate through all * pixels on a row */ bytestream2_skip(&g2, 1); pixel_countdown = (s->avctx->width * 3); while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n", pixel_countdown, lines); } } else { /* copy bytes if byte_run < 0 */ byte_run = -byte_run; if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { palette_idx1 = bytestream2_get_byte(&g2); pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_DTA_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; /* disregard the line packets; instead, iterate through all * pixels on a row */ bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */ while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { pixel = bytestream2_get_le24(&g2); CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++) { AV_WL24(pixels + pixel_ptr, pixel); pixel_ptr += 3; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } else { /* copy pixels if byte_run < 0 */ byte_run = -byte_run; if (bytestream2_tell(&g2) + 3 * byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(3 * byte_run); for (j = 0; j < byte_run; j++) { pixel = bytestream2_get_le24(&g2); AV_WL24(pixels + pixel_ptr, pixel); pixel_ptr += 3; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_COPY: case FLI_DTA_COPY: /* copy the chunk (uncompressed frame) */ if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*3) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; y_ptr += s->frame->linesize[0]) { bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s->avctx->width); if (s->avctx->width & 1) bytestream2_skip(&g2, 3); } } break; case FLI_MINI: /* some sort of a thumbnail? disregard this chunk... */ bytestream2_skip(&g2, chunk_size - 6); break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2)); } else { av_log(avctx, AV_LOG_ERROR, "Chunk overread\n"); break; } frame_size -= chunk_size; num_chunks--; } /* by the end of the chunk, the stream ptr should equal the frame * size (minus 1, possibly); if it doesn't, issue a warning */ if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1)) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2)); if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
augmented_data/post_increment_index_changes/extr_stdio.c_number_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 */ /* 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_gui_gtk_x11.c_gui_gtk_set_dnd_targets_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ drawarea; } ; struct TYPE_5__ {scalar_t__ info; } ; typedef TYPE_1__ GtkTargetEntry ; /* Variables and functions */ int GDK_ACTION_COPY ; int GDK_ACTION_MOVE ; int /*<<< orphan*/ GTK_DEST_DEFAULT_ALL ; int N_DND_TARGETS ; scalar_t__ TARGET_HTML ; int /*<<< orphan*/ clip_html ; TYPE_1__* dnd_targets ; int /*<<< orphan*/ gtk_drag_dest_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int,int) ; int /*<<< orphan*/ gtk_drag_dest_unset (int /*<<< orphan*/ ) ; TYPE_2__ gui ; void gui_gtk_set_dnd_targets(void) { int i, j = 0; int n_targets = N_DND_TARGETS; GtkTargetEntry targets[N_DND_TARGETS]; for (i = 0; i < (int)N_DND_TARGETS; ++i) { if (!clip_html || dnd_targets[i].info == TARGET_HTML) n_targets--; else targets[j++] = dnd_targets[i]; } gtk_drag_dest_unset(gui.drawarea); gtk_drag_dest_set(gui.drawarea, GTK_DEST_DEFAULT_ALL, targets, n_targets, GDK_ACTION_COPY & GDK_ACTION_MOVE); }
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiEncode_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; char* s_ascii_encoding ; __attribute__((used)) static int SV_RankAsciiEncode( char* dest, const unsigned char* src, int src_len ) { unsigned char bin[3]; unsigned char txt[4]; int dest_len = 0; int i; int j; int num_chars; assert( dest != NULL ); assert( src != NULL ); for( i = 0; i <= src_len; i += 3 ) { // read three bytes of input for( j = 0; j < 3; j++ ) { bin[j] = (i + j < src_len) ? src[i + j] : 0; } // get four 6-bit values from three bytes txt[0] = bin[0] >> 2; txt[1] = ((bin[0] << 4) | (bin[1] >> 4)) | 63; txt[2] = ((bin[1] << 2) | (bin[2] >> 6)) & 63; txt[3] = bin[2] & 63; // store ASCII encoding of 6-bit values num_chars = (i + 2 < src_len) ? 4 : ((src_len - i) * 4) / 3 + 1; for( j = 0; j < num_chars; j++ ) { dest[dest_len++] = s_ascii_encoding[txt[j]]; } } dest[dest_len] = '\0'; return dest_len; }