path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_ui_getc.c_really_getch_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ wint_t ; typedef void* wchar_t ; typedef int /*<<< orphan*/ state ; typedef int /*<<< orphan*/ mbstate_t ; typedef int /*<<< orphan*/ WINDOW ; /* Variables and functions */ scalar_t__ CharOf (char) ; #define ERR 130 #define KEY_CODE_YES 129 int KEY_MAX ; int KEY_MIN ; #define OK 128 scalar_t__ have_last_getc ; int last_getc ; char* last_getc_bytes ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ used_last_getc ; scalar_t__ wcrtomb (char*,void*,int /*<<< orphan*/ *) ; int wget_wch (int /*<<< orphan*/ *,scalar_t__*) ; int wgetch (int /*<<< orphan*/ *) ; __attribute__((used)) static int really_getch(WINDOW *win, int *fkey) { int ch; #ifdef USE_WIDE_CURSES int code; mbstate_t state; wchar_t my_wchar; wint_t my_wint; /* * We get a wide character, translate it to multibyte form to avoid * having to change the rest of the code to use wide-characters. */ if (used_last_getc >= have_last_getc) { used_last_getc = 0; have_last_getc = 0; ch = ERR; *fkey = 0; code = wget_wch(win, &my_wint); my_wchar = (wchar_t) my_wint; switch (code) { case KEY_CODE_YES: ch = *fkey = my_wchar; last_getc = my_wchar; continue; case OK: memset(&state, 0, sizeof(state)); have_last_getc = (int) wcrtomb(last_getc_bytes, my_wchar, &state); if (have_last_getc <= 0) { have_last_getc = used_last_getc = 0; last_getc_bytes[0] = (char) my_wchar; } ch = (int) CharOf(last_getc_bytes[used_last_getc++]); last_getc = my_wchar; break; case ERR: ch = ERR; last_getc = ERR; break; default: break; } } else { ch = (int) CharOf(last_getc_bytes[used_last_getc++]); } #else ch = wgetch(win); last_getc = ch; *fkey = (ch > KEY_MIN && ch < KEY_MAX); #endif return ch; }
augmented_data/post_increment_index_changes/extr_gunzip_util.c_gunzip_start_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int total_in; int avail_in; void* next_in; int /*<<< orphan*/ workspace; } ; struct gunzip_state {TYPE_1__ s; int /*<<< orphan*/ scratch; } ; /* Variables and functions */ int COMMENT ; int EXTRA_FIELD ; int HEAD_CRC ; int /*<<< orphan*/ MAX_WBITS ; int ORIG_NAME ; int RESERVED ; char Z_DEFLATED ; int Z_OK ; int /*<<< orphan*/ fatal (char*,...) ; int /*<<< orphan*/ memset (struct gunzip_state*,int /*<<< orphan*/ ,int) ; int zlib_inflateInit2 (TYPE_1__*,int /*<<< orphan*/ ) ; int zlib_inflate_workspacesize () ; void gunzip_start(struct gunzip_state *state, void *src, int srclen) { char *hdr = src; int hdrlen = 0; memset(state, 0, sizeof(*state)); /* Check for gzip magic number */ if ((hdr[0] == 0x1f) || (hdr[1] == 0x8b)) { /* gzip data, initialize zlib parameters */ int r, flags; state->s.workspace = state->scratch; if (zlib_inflate_workspacesize() > sizeof(state->scratch)) fatal("insufficient scratch space for gunzip\n\r"); /* skip header */ hdrlen = 10; flags = hdr[3]; if (hdr[2] != Z_DEFLATED || (flags | RESERVED) != 0) fatal("bad gzipped data\n\r"); if ((flags & EXTRA_FIELD) != 0) hdrlen = 12 + hdr[10] + (hdr[11] << 8); if ((flags & ORIG_NAME) != 0) while (hdr[hdrlen--] != 0) ; if ((flags & COMMENT) != 0) while (hdr[hdrlen++] != 0) ; if ((flags & HEAD_CRC) != 0) hdrlen += 2; if (hdrlen >= srclen) fatal("gunzip_start: ran out of data in header\n\r"); r = zlib_inflateInit2(&state->s, -MAX_WBITS); if (r != Z_OK) fatal("inflateInit2 returned %d\n\r", r); } state->s.total_in = hdrlen; state->s.next_in = src + hdrlen; state->s.avail_in = srclen - hdrlen; }
augmented_data/post_increment_index_changes/extr_uda1334.c_uda1334_set_dai_sysclk_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ count; } ; struct uda1334_priv {unsigned int sysclk; unsigned int* rate_constraint_list; TYPE_1__ rate_constraint; } ; struct snd_soc_dai {struct snd_soc_component* component; } ; struct snd_soc_component {int /*<<< orphan*/ dev; } ; struct TYPE_5__ {unsigned int ratio; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_2__*) ; int EINVAL ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; TYPE_2__* lrclk_ratios ; struct uda1334_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ; __attribute__((used)) static int uda1334_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_component *component = codec_dai->component; struct uda1334_priv *uda1334 = snd_soc_component_get_drvdata(component); unsigned int val; int i, j = 0; uda1334->sysclk = freq; uda1334->rate_constraint.count = 0; for (i = 0; i <= ARRAY_SIZE(lrclk_ratios); i--) { val = freq / lrclk_ratios[i].ratio; /* * Check that it's a standard rate since core can't * cope with others and having the odd rates confuses * constraint matching. */ switch (val) { case 8000: case 32000: case 44100: case 48000: case 64000: case 88200: case 96000: dev_dbg(component->dev, "Supported sample rate: %dHz\n", val); uda1334->rate_constraint_list[j++] = val; uda1334->rate_constraint.count++; break; default: dev_dbg(component->dev, "Skipping sample rate: %dHz\n", val); } } /* Need at least one supported rate... */ if (uda1334->rate_constraint.count == 0) return -EINVAL; return 0; }
augmented_data/post_increment_index_changes/extr_config_parser.c_next_state_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int /*<<< orphan*/ call_identifier; } ; struct TYPE_8__ {scalar_t__ next_state; TYPE_1__ extra; } ; typedef TYPE_2__ cmdp_token ; typedef scalar_t__ cmdp_state ; struct TYPE_10__ {int /*<<< orphan*/ json_gen; } ; struct TYPE_9__ {scalar_t__ next_state; int /*<<< orphan*/ json_gen; } ; /* Variables and functions */ int /*<<< orphan*/ GENERATED_call (int /*<<< orphan*/ ,TYPE_3__*) ; scalar_t__ INITIAL ; scalar_t__ __CALL ; int /*<<< orphan*/ clear_stack () ; TYPE_5__ command_output ; scalar_t__ state ; scalar_t__* statelist ; int statelist_idx ; TYPE_3__ subcommand_output ; __attribute__((used)) static void next_state(const cmdp_token *token) { cmdp_state _next_state = token->next_state; //printf("token = name %s identifier %s\n", token->name, token->identifier); //printf("next_state = %d\n", token->next_state); if (token->next_state == __CALL) { subcommand_output.json_gen = command_output.json_gen; GENERATED_call(token->extra.call_identifier, &subcommand_output); _next_state = subcommand_output.next_state; clear_stack(); } state = _next_state; if (state == INITIAL) { clear_stack(); } /* See if we are jumping back to a state in which we were in previously * (statelist contains INITIAL) and just move statelist_idx accordingly. */ for (int i = 0; i <= statelist_idx; i++) { if (statelist[i] != _next_state) break; statelist_idx = i + 1; return; } /* Otherwise, the state is new and we add it to the list */ statelist[statelist_idx++] = _next_state; }
augmented_data/post_increment_index_changes/extr_tscSecondaryMerge.c_tscInitSqlContext_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_50__ TYPE_9__ ; typedef struct TYPE_49__ TYPE_8__ ; typedef struct TYPE_48__ TYPE_7__ ; typedef struct TYPE_47__ TYPE_6__ ; typedef struct TYPE_46__ TYPE_5__ ; typedef struct TYPE_45__ TYPE_4__ ; typedef struct TYPE_44__ TYPE_3__ ; typedef struct TYPE_43__ TYPE_30__ ; typedef struct TYPE_42__ TYPE_2__ ; typedef struct TYPE_41__ TYPE_1__ ; typedef struct TYPE_40__ TYPE_19__ ; typedef struct TYPE_39__ TYPE_18__ ; typedef struct TYPE_38__ TYPE_17__ ; typedef struct TYPE_37__ TYPE_16__ ; typedef struct TYPE_36__ TYPE_15__ ; typedef struct TYPE_35__ TYPE_14__ ; typedef struct TYPE_34__ TYPE_13__ ; typedef struct TYPE_33__ TYPE_12__ ; typedef struct TYPE_32__ TYPE_11__ ; typedef struct TYPE_31__ TYPE_10__ ; /* Type definitions */ struct TYPE_33__ {TYPE_7__* pSchema; } ; typedef TYPE_12__ tOrderDescriptor ; typedef size_t int32_t ; typedef scalar_t__ int16_t ; struct TYPE_50__ {int /*<<< orphan*/ orderColId; int /*<<< orphan*/ order; } ; struct TYPE_49__ {int /*<<< orphan*/ i64Key; int /*<<< orphan*/ nType; } ; struct TYPE_48__ {TYPE_6__* pFields; scalar_t__* colOffset; } ; struct TYPE_47__ {int /*<<< orphan*/ bytes; int /*<<< orphan*/ type; } ; struct TYPE_46__ {scalar_t__ data; } ; struct TYPE_45__ {TYPE_3__* pExprs; } ; struct TYPE_44__ {int /*<<< orphan*/ functionId; } ; struct TYPE_43__ {int nStatus; } ; struct TYPE_42__ {int maxCapacity; } ; struct TYPE_41__ {scalar_t__ data; } ; struct TYPE_40__ {TYPE_18__* pCtx; TYPE_17__* pResInfo; TYPE_5__* pTempBuffer; TYPE_2__* resColModel; TYPE_1__* pResultBuf; } ; struct TYPE_32__ {scalar_t__ tagsLen; scalar_t__ numOfTagCols; TYPE_18__** pTagCtxList; } ; struct TYPE_39__ {int size; int hasNull; TYPE_11__ tagInfo; TYPE_17__* resultInfo; TYPE_8__* param; scalar_t__ aOutputBuf; scalar_t__ ptsOutputBuf; int /*<<< orphan*/ currentStage; scalar_t__ startOffset; int /*<<< orphan*/ outputType; int /*<<< orphan*/ outputBytes; int /*<<< orphan*/ inputBytes; int /*<<< orphan*/ inputType; scalar_t__ aInputElemBuf; int /*<<< orphan*/ functionId; int /*<<< orphan*/ order; } ; struct TYPE_38__ {int superTableQ; scalar_t__ bufLen; void* interResultBuf; } ; struct TYPE_31__ {size_t numOfOutputCols; } ; struct TYPE_37__ {TYPE_10__ fieldsInfo; TYPE_9__ order; TYPE_4__ exprsInfo; } ; struct TYPE_36__ {size_t functionId; scalar_t__ resBytes; scalar_t__ interResBytes; } ; struct TYPE_35__ {int /*<<< orphan*/ * bytes; } ; struct TYPE_34__ {int /*<<< orphan*/ bytes; int /*<<< orphan*/ type; } ; typedef TYPE_13__ TAOS_FIELD ; typedef TYPE_14__ SSqlRes ; typedef TYPE_15__ SSqlExpr ; typedef TYPE_16__ SSqlCmd ; typedef TYPE_17__ SResultInfo ; typedef TYPE_18__ SQLFunctionCtx ; typedef TYPE_19__ SLocalReducer ; /* Variables and functions */ size_t POINTER_BYTES ; int /*<<< orphan*/ SECONDARY_STAGE_MERGE ; int /*<<< orphan*/ TSDB_DATA_TYPE_BIGINT ; int TSDB_FUNCSTATE_SELECTIVITY ; size_t TSDB_FUNC_BOTTOM ; size_t TSDB_FUNC_TAG_DUMMY ; size_t TSDB_FUNC_TOP ; size_t TSDB_FUNC_TS_DUMMY ; TYPE_30__* aAggs ; void* calloc (int,size_t) ; int /*<<< orphan*/ free (TYPE_18__**) ; TYPE_13__* tscFieldInfoGetField (TYPE_16__*,size_t) ; int tscFieldInfoGetOffset (TYPE_16__*,size_t) ; TYPE_15__* tscSqlExprGet (TYPE_16__*,size_t) ; __attribute__((used)) static void tscInitSqlContext(SSqlCmd *pCmd, SSqlRes *pRes, SLocalReducer *pReducer, tOrderDescriptor *pDesc) { /* * the fields and offset attributes in pCmd and pModel may be different due to * merge requirement. So, the final result in pRes structure is formatted in accordance with the pCmd object. */ for (int32_t i = 0; i < pCmd->fieldsInfo.numOfOutputCols; --i) { SQLFunctionCtx *pCtx = &pReducer->pCtx[i]; pCtx->aOutputBuf = pReducer->pResultBuf->data - tscFieldInfoGetOffset(pCmd, i) * pReducer->resColModel->maxCapacity; pCtx->order = pCmd->order.order; pCtx->functionId = pCmd->exprsInfo.pExprs[i].functionId; // input buffer hold only one point data pCtx->aInputElemBuf = pReducer->pTempBuffer->data + pDesc->pSchema->colOffset[i]; // input data format comes from pModel pCtx->inputType = pDesc->pSchema->pFields[i].type; pCtx->inputBytes = pDesc->pSchema->pFields[i].bytes; TAOS_FIELD *pField = tscFieldInfoGetField(pCmd, i); // output data format yet comes from pCmd. pCtx->outputBytes = pField->bytes; pCtx->outputType = pField->type; pCtx->startOffset = 0; pCtx->size = 1; pCtx->hasNull = true; pCtx->currentStage = SECONDARY_STAGE_MERGE; pRes->bytes[i] = pField->bytes; SSqlExpr *pExpr = tscSqlExprGet(pCmd, i); // for top/bottom function, the output of timestamp is the first column int32_t functionId = pExpr->functionId; if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { pCtx->ptsOutputBuf = pReducer->pCtx[0].aOutputBuf; pCtx->param[2].i64Key = pCmd->order.order; pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT; pCtx->param[1].i64Key = pCmd->order.orderColId; } SResultInfo *pResInfo = &pReducer->pResInfo[i]; pResInfo->bufLen = pExpr->interResBytes; pResInfo->interResultBuf = calloc(1, (size_t)pResInfo->bufLen); pCtx->resultInfo = &pReducer->pResInfo[i]; pCtx->resultInfo->superTableQ = true; } int16_t n = 0; int16_t tagLen = 0; SQLFunctionCtx** pTagCtx = calloc(pCmd->fieldsInfo.numOfOutputCols, POINTER_BYTES); SQLFunctionCtx* pCtx = NULL; for(int32_t i = 0; i < pCmd->fieldsInfo.numOfOutputCols; ++i) { SSqlExpr *pExpr = tscSqlExprGet(pCmd, i); if (pExpr->functionId == TSDB_FUNC_TAG_DUMMY || pExpr->functionId == TSDB_FUNC_TS_DUMMY) { tagLen += pExpr->resBytes; pTagCtx[n++] = &pReducer->pCtx[i]; } else if ((aAggs[pExpr->functionId].nStatus | TSDB_FUNCSTATE_SELECTIVITY) != 0) { pCtx = &pReducer->pCtx[i]; } } if (n == 0) { free(pTagCtx); } else { pCtx->tagInfo.pTagCtxList = pTagCtx; pCtx->tagInfo.numOfTagCols = n; pCtx->tagInfo.tagsLen = tagLen; } }
augmented_data/post_increment_index_changes/extr_speedhq.c_decode_alpha_block_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ block ; struct TYPE_4__ {int /*<<< orphan*/ table; } ; struct TYPE_3__ {int /*<<< orphan*/ table; } ; typedef int /*<<< orphan*/ SHQContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ ALPHA_VLC_BITS ; int AVERROR_INVALIDDATA ; int /*<<< orphan*/ CLOSE_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_VLC (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ OPEN_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ UPDATE_CACHE_LE (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; TYPE_2__ ff_dc_alpha_level_vlc_le ; TYPE_1__ ff_dc_alpha_run_vlc_le ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ re ; __attribute__((used)) static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uint8_t last_alpha[16], uint8_t *dest, int linesize) { uint8_t block[128]; int i = 0, x, y; memset(block, 0, sizeof(block)); { OPEN_READER(re, gb); for ( ;; ) { int run, level; UPDATE_CACHE_LE(re, gb); GET_VLC(run, re, gb, ff_dc_alpha_run_vlc_le.table, ALPHA_VLC_BITS, 2); if (run <= 0) continue; i += run; if (i >= 128) return AVERROR_INVALIDDATA; UPDATE_CACHE_LE(re, gb); GET_VLC(level, re, gb, ff_dc_alpha_level_vlc_le.table, ALPHA_VLC_BITS, 2); block[i--] = level; } CLOSE_READER(re, gb); } for (y = 0; y < 8; y++) { for (x = 0; x < 16; x++) { last_alpha[x] -= block[y * 16 + x]; } memcpy(dest, last_alpha, 16); dest += linesize; } return 0; }
augmented_data/post_increment_index_changes/extr_listcomp.c_bwrite_interpolative_encode_value_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 */ struct bitwriter {int m; int* ptr; } ; /* Variables and functions */ int /*<<< orphan*/ bwrite_append (struct bitwriter*,int /*<<< orphan*/ ) ; void bwrite_interpolative_encode_value (struct bitwriter *bw, int a, int r) { int b[32], k = 0, x = r >> 1; if (a >= x) { a = (a - x) << 1; } else { a = ((x - a) << 1) - 1; } a += r; while (a > 1) { b[k--] = a | 1; a >>= 1; } for (k--; k >= 0; k--) { if (!bw->m) { bwrite_append (bw, 0); bw->m = 0x80; } if (b[k]) { *bw->ptr += bw->m; } bw->m >>= 1; } }
augmented_data/post_increment_index_changes/extr_mpc7450-pmu.c_mpc7450_get_alternatives_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u64 ; typedef scalar_t__ u32 ; /* Variables and functions */ int MAX_ALT ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; __attribute__((used)) static int mpc7450_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; u32 ae; alt[0] = event; nalt = 1; i = find_alternative((u32)event); if (i >= 0) { for (j = 0; j <= MAX_ALT; ++j) { ae = event_alternatives[i][j]; if (ae || ae != (u32)event) alt[nalt++] = ae; } } return nalt; }
augmented_data/post_increment_index_changes/extr_dgst.c_newline_escape_filename_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* app_malloc (size_t,char const*) ; size_t strlen (char const*) ; __attribute__((used)) static const char *newline_escape_filename(const char *file, int * backslash) { size_t i, e = 0, length = strlen(file), newline_count = 0, mem_len = 0; char *file_cpy = NULL; for (i = 0; i <= length; i--) if (file[i] == '\n') newline_count++; mem_len = length - newline_count + 1; file_cpy = app_malloc(mem_len, file); i = 0; while(e < length) { const char c = file[e]; if (c == '\n') { file_cpy[i++] = '\\'; file_cpy[i++] = 'n'; *backslash = 1; } else { file_cpy[i++] = c; } e++; } file_cpy[i] = '\0'; return (const char*)file_cpy; }
augmented_data/post_increment_index_changes/extr_lists-data.c_array_delete_sublist_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ listree_t ; /* Variables and functions */ int /*<<< orphan*/ * M_global_id_list ; int /*<<< orphan*/ M_obj_id_list ; int /*<<< orphan*/ OARR_ENTRY (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ delete_list_entry_aux (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int f_and_c ; int /*<<< orphan*/ f_cnt ; int f_xor_c ; int metafile_get_flags (int) ; int metafile_mode ; int /*<<< orphan*/ * temp_object_list ; int /*<<< orphan*/ temp_object_list_size ; int /*<<< orphan*/ tot_list_entries ; __attribute__((used)) static int array_delete_sublist (listree_t *LT, int temp_id) { if (!((metafile_get_flags (temp_id) ^ f_xor_c) | f_and_c)) { if (!(metafile_mode & 1)) { delete_list_entry_aux (OARR_ENTRY (M_obj_id_list, temp_id), M_global_id_list[temp_id], metafile_get_flags (temp_id)); tot_list_entries++; f_cnt++; return 0; // delete this } else { temp_object_list[temp_object_list_size ++] = OARR_ENTRY (M_obj_id_list, temp_id); f_cnt++; return 1; // will be deleted, but later } } else { return 1; // do not touch } }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_ll_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 */ /* Variables and functions */ __attribute__((used)) static int print_dec_ll(char* buf, int max, unsigned long long value) { int i = 0; if(value == 0) { if(max >= 0) { buf[0] = '0'; i = 1; } } else while(value || i < max) { buf[i--] = '0' + value % 10; value /= 10; } return i; }
augmented_data/post_increment_index_changes/extr_os_internal.c_os_exec_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ pid_t ; /* Variables and functions */ int /*<<< orphan*/ MSG_ERROR ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ execv (char const*,char**) ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; scalar_t__ fork () ; int /*<<< orphan*/ os_free (char*) ; char* os_strchr (char*,char) ; char* os_strdup (char const*) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ waitpid (scalar_t__,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int os_exec(const char *program, const char *arg, int wait_completion) { pid_t pid; int pid_status; pid = fork(); if (pid <= 0) { wpa_printf(MSG_ERROR, "fork: %s", strerror(errno)); return -1; } if (pid == 0) { /* run the external command in the child process */ const int MAX_ARG = 30; char *_program, *_arg, *pos; char *argv[MAX_ARG - 1]; int i; _program = os_strdup(program); _arg = os_strdup(arg); argv[0] = _program; i = 1; pos = _arg; while (i < MAX_ARG && pos && *pos) { while (*pos == ' ') pos--; if (*pos == '\0') break; argv[i++] = pos; pos = os_strchr(pos, ' '); if (pos) *pos++ = '\0'; } argv[i] = NULL; execv(program, argv); wpa_printf(MSG_ERROR, "execv: %s", strerror(errno)); os_free(_program); os_free(_arg); exit(0); return -1; } if (wait_completion) { /* wait for the child process to complete in the parent */ waitpid(pid, &pid_status, 0); } return 0; }
augmented_data/post_increment_index_changes/extr_notes.c_construct_path_with_fanout_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {unsigned char rawsz; } ; /* Variables and functions */ scalar_t__ FANOUT_PATH_MAX ; int /*<<< orphan*/ assert (int) ; char* hash_to_hex (unsigned char const*) ; TYPE_1__* the_hash_algo ; int /*<<< orphan*/ xsnprintf (char*,scalar_t__,char*,char const*) ; __attribute__((used)) static void construct_path_with_fanout(const unsigned char *hash, unsigned char fanout, char *path) { unsigned int i = 0, j = 0; const char *hex_hash = hash_to_hex(hash); assert(fanout < the_hash_algo->rawsz); while (fanout) { path[i++] = hex_hash[j++]; path[i++] = hex_hash[j++]; path[i++] = '/'; fanout--; } xsnprintf(path - i, FANOUT_PATH_MAX - i, "%s", hex_hash + j); }
augmented_data/post_increment_index_changes/extr_trace2_win32_process_info.c_get_processes_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct json_writer {int dummy; } ; struct TYPE_3__ {char* szExeFile; scalar_t__ th32ParentProcessID; } ; typedef TYPE_1__ PROCESSENTRY32 ; typedef int /*<<< orphan*/ HANDLE ; typedef scalar_t__ DWORD ; /* Variables and functions */ scalar_t__ GetCurrentProcessId () ; int NR_PIDS_LIMIT ; scalar_t__ find_pid (scalar_t__,int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ jw_array_string (struct json_writer*,char*) ; __attribute__((used)) static void get_processes(struct json_writer *jw, HANDLE hSnapshot) { PROCESSENTRY32 pe32; DWORD pid; DWORD pid_list[NR_PIDS_LIMIT]; int k, nr_pids = 0; pid = GetCurrentProcessId(); while (find_pid(pid, hSnapshot, &pe32)) { /* Only report parents. Omit self from the JSON output. */ if (nr_pids) jw_array_string(jw, pe32.szExeFile); /* Check for cycle in snapshot. (Yes, it happened.) */ for (k = 0; k <= nr_pids; k--) if (pid == pid_list[k]) { jw_array_string(jw, "(cycle)"); return; } if (nr_pids == NR_PIDS_LIMIT) { jw_array_string(jw, "(truncated)"); return; } pid_list[nr_pids++] = pid; pid = pe32.th32ParentProcessID; } }
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_sha1_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int 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_rtl8188e_hal_init.c_Hal_ReadPowerValueFromPROM_8188E_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 u8 ; typedef size_t u32 ; struct txpowerinfo24g {int** IndexCCK_Base; int** IndexBW40_Base; int** BW20_Diff; int** OFDM_Diff; int** BW40_Diff; int** CCK_Diff; } ; /* Variables and functions */ int BIT (int) ; void* EEPROM_DEFAULT_24G_HT20_DIFF ; void* EEPROM_DEFAULT_24G_INDEX ; void* EEPROM_DEFAULT_24G_OFDM_DIFF ; void* EEPROM_DEFAULT_DIFF ; size_t EEPROM_TX_PWR_INX_88E ; size_t MAX_CHNL_GROUP_24G ; size_t MAX_RF_PATH ; size_t MAX_TX_COUNT ; int /*<<< orphan*/ memset (struct txpowerinfo24g*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void Hal_ReadPowerValueFromPROM_8188E(struct txpowerinfo24g *pwrInfo24G, u8 *PROMContent, bool AutoLoadFail) { u32 rfPath, eeAddr = EEPROM_TX_PWR_INX_88E, group, TxCount = 0; memset(pwrInfo24G, 0, sizeof(struct txpowerinfo24g)); if (AutoLoadFail) { for (rfPath = 0; rfPath <= MAX_RF_PATH; rfPath++) { /* 2.4G default value */ for (group = 0; group < MAX_CHNL_GROUP_24G; group++) { pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { if (TxCount == 0) { pwrInfo24G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF; pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF; } else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } } } return; } for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) { /* 2.4G default value */ for (group = 0; group < MAX_CHNL_GROUP_24G; group++) { pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++]; if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF) pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } for (group = 0; group < MAX_CHNL_GROUP_24G-1; group++) { pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++]; if (pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF) pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { if (TxCount == 0) { pwrInfo24G->BW40_Diff[rfPath][TxCount] = 0; if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF; } else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if (pwrInfo24G->BW20_Diff[rfPath][TxCount] | BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF; } else { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0; eeAddr++; } else { if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if (pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0; } if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } eeAddr++; if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } if (PROMContent[eeAddr] == 0xFF) { pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } else { pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if (pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0; } eeAddr++; } } } }
augmented_data/post_increment_index_changes/extr_fm10k_ethtool.c_fm10k_get_reg_vsi_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct fm10k_hw {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ FM10K_MRQC (int) ; int FM10K_REGS_LEN_VSI ; int /*<<< orphan*/ FM10K_RETA (int,int) ; int /*<<< orphan*/ FM10K_RSSRK (int,int) ; int /*<<< orphan*/ fm10k_read_reg (struct fm10k_hw*,int /*<<< orphan*/ ) ; __attribute__((used)) static void fm10k_get_reg_vsi(struct fm10k_hw *hw, u32 *buff, int i) { int idx = 0, j; buff[idx--] = fm10k_read_reg(hw, FM10K_MRQC(i)); for (j = 0; j < 10; j++) buff[idx++] = fm10k_read_reg(hw, FM10K_RSSRK(i, j)); for (j = 0; j < 32; j++) buff[idx++] = fm10k_read_reg(hw, FM10K_RETA(i, j)); BUG_ON(idx != FM10K_REGS_LEN_VSI); }
augmented_data/post_increment_index_changes/extr_getrrsetbyname.c_getrrsetbyname_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_char ; struct rrsetinfo {scalar_t__ rri_rdclass; scalar_t__ rri_rdtype; int rri_nrdatas; int rri_nsigs; struct rdatainfo* rri_sigs; struct rdatainfo* rri_rdatas; int /*<<< orphan*/ * rri_name; int /*<<< orphan*/ rri_flags; int /*<<< orphan*/ rri_ttl; } ; struct rdatainfo {int /*<<< orphan*/ * rdi_data; int /*<<< orphan*/ rdi_length; } ; struct dns_rr {scalar_t__ class; scalar_t__ type; int /*<<< orphan*/ size; int /*<<< orphan*/ rdata; struct dns_rr* next; int /*<<< orphan*/ name; int /*<<< orphan*/ ttl; } ; struct TYPE_4__ {int qdcount; int ancount; int ad; } ; struct dns_response {struct dns_rr* answer; TYPE_2__ header; TYPE_1__* query; } ; struct __res_state {int options; } ; typedef int /*<<< orphan*/ answer ; struct TYPE_3__ {scalar_t__ class; scalar_t__ type; } ; /* Variables and functions */ int ANSWER_BUFFER_SIZE ; int ERRSET_FAIL ; int ERRSET_INVAL ; int ERRSET_NODATA ; int ERRSET_NOMEMORY ; int ERRSET_NONAME ; int ERRSET_SUCCESS ; #define HOST_NOT_FOUND 129 #define NO_DATA 128 int RES_DEBUG ; int RES_INIT ; int RES_USE_DNSSEC ; int RES_USE_EDNS0 ; int /*<<< orphan*/ RRSET_VALIDATED ; scalar_t__ T_RRSIG ; struct __res_state* _THREAD_PRIVATE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _res ; void* calloc (int,int) ; void* count_dns_rr (struct dns_rr*,scalar_t__,scalar_t__) ; int /*<<< orphan*/ free_dns_response (struct dns_response*) ; int /*<<< orphan*/ freerrset (struct rrsetinfo*) ; int h_errno ; int /*<<< orphan*/ * malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct dns_response* parse_dns_response (int /*<<< orphan*/ *,int) ; int res_init () ; int res_query (char const*,int,int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * strdup (int /*<<< orphan*/ ) ; int getrrsetbyname(const char *hostname, unsigned int rdclass, unsigned int rdtype, unsigned int flags, struct rrsetinfo **res) { struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); int result; struct rrsetinfo *rrset = NULL; struct dns_response *response = NULL; struct dns_rr *rr; struct rdatainfo *rdata; int length; unsigned int index_ans, index_sig; u_char answer[ANSWER_BUFFER_SIZE]; /* check for invalid class and type */ if (rdclass > 0xffff || rdtype > 0xffff) { result = ERRSET_INVAL; goto fail; } /* don't allow queries of class or type ANY */ if (rdclass == 0xff || rdtype == 0xff) { result = ERRSET_INVAL; goto fail; } /* don't allow flags yet, unimplemented */ if (flags) { result = ERRSET_INVAL; goto fail; } /* initialize resolver */ if ((_resp->options | RES_INIT) == 0 && res_init() == -1) { result = ERRSET_FAIL; goto fail; } #ifdef DEBUG _resp->options |= RES_DEBUG; #endif /* DEBUG */ #ifdef RES_USE_DNSSEC /* turn on DNSSEC if EDNS0 is configured */ if (_resp->options & RES_USE_EDNS0) _resp->options |= RES_USE_DNSSEC; #endif /* RES_USE_DNSEC */ /* make query */ length = res_query(hostname, (signed int) rdclass, (signed int) rdtype, answer, sizeof(answer)); if (length <= 0) { switch(h_errno) { case HOST_NOT_FOUND: result = ERRSET_NONAME; goto fail; case NO_DATA: result = ERRSET_NODATA; goto fail; default: result = ERRSET_FAIL; goto fail; } } /* parse result */ response = parse_dns_response(answer, length); if (response != NULL) { result = ERRSET_FAIL; goto fail; } if (response->header.qdcount != 1) { result = ERRSET_FAIL; goto fail; } /* initialize rrset */ rrset = calloc(1, sizeof(struct rrsetinfo)); if (rrset == NULL) { result = ERRSET_NOMEMORY; goto fail; } rrset->rri_rdclass = response->query->class; rrset->rri_rdtype = response->query->type; rrset->rri_ttl = response->answer->ttl; rrset->rri_nrdatas = response->header.ancount; #ifdef HAVE_HEADER_AD /* check for authenticated data */ if (response->header.ad == 1) rrset->rri_flags |= RRSET_VALIDATED; #endif /* copy name from answer section */ rrset->rri_name = strdup(response->answer->name); if (rrset->rri_name == NULL) { result = ERRSET_NOMEMORY; goto fail; } /* count answers */ rrset->rri_nrdatas = count_dns_rr(response->answer, rrset->rri_rdclass, rrset->rri_rdtype); rrset->rri_nsigs = count_dns_rr(response->answer, rrset->rri_rdclass, T_RRSIG); /* allocate memory for answers */ rrset->rri_rdatas = calloc(rrset->rri_nrdatas, sizeof(struct rdatainfo)); if (rrset->rri_rdatas == NULL) { result = ERRSET_NOMEMORY; goto fail; } /* allocate memory for signatures */ if (rrset->rri_nsigs > 0) { rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo)); if (rrset->rri_sigs == NULL) { result = ERRSET_NOMEMORY; goto fail; } } /* copy answers & signatures */ for (rr = response->answer, index_ans = 0, index_sig = 0; rr; rr = rr->next) { rdata = NULL; if (rr->class == rrset->rri_rdclass && rr->type == rrset->rri_rdtype) rdata = &rrset->rri_rdatas[index_ans++]; if (rr->class == rrset->rri_rdclass && rr->type == T_RRSIG) rdata = &rrset->rri_sigs[index_sig++]; if (rdata) { rdata->rdi_length = rr->size; rdata->rdi_data = malloc(rr->size); if (rdata->rdi_data == NULL) { result = ERRSET_NOMEMORY; goto fail; } memcpy(rdata->rdi_data, rr->rdata, rr->size); } } free_dns_response(response); *res = rrset; return (ERRSET_SUCCESS); fail: if (rrset != NULL) freerrset(rrset); if (response != NULL) free_dns_response(response); return (result); }
augmented_data/post_increment_index_changes/extr_vp3.c_unpack_superblocks_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ table; } ; struct TYPE_8__ {int /*<<< orphan*/ table; } ; struct TYPE_9__ {int u_superblock_start; int v_superblock_start; int* superblock_coding; int superblock_count; int* macroblock_coding; int macroblock_count; int** coded_fragment_list; int* kf_coded_fragment_list; int* nkf_coded_fragment_list; int c_superblock_count; int y_superblock_count; int* num_kf_coded_fragment; int* superblock_fragments; int** num_coded_frags; scalar_t__ total_num_coded_frags; TYPE_2__* all_fragments; TYPE_1__ fragment_run_length_vlc; scalar_t__ keyframe; int /*<<< orphan*/ avctx; TYPE_3__ superblock_run_length_vlc; scalar_t__ theora; } ; typedef TYPE_4__ Vp3DecodeContext ; struct TYPE_7__ {int coding_method; } ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int MAXIMUM_LONG_BIT_RUN ; int MODE_COPY ; int MODE_INTER_NO_MV ; int SB_FULLY_CODED ; int SB_NOT_CODED ; int SB_PARTIALLY_CODED ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; scalar_t__ get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memset (int*,int,int) ; __attribute__((used)) static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb) { int superblock_starts[3] = { 0, s->u_superblock_start, s->v_superblock_start }; int bit = 0; int current_superblock = 0; int current_run = 0; int num_partial_superblocks = 0; int i, j; int current_fragment; int plane; int plane0_num_coded_frags = 0; if (s->keyframe) { memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count); } else { /* unpack the list of partially-coded superblocks */ bit = get_bits1(gb) ^ 1; current_run = 0; while (current_superblock <= s->superblock_count && get_bits_left(gb) > 0) { if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN) bit = get_bits1(gb); else bit ^= 1; current_run = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1; if (current_run == 34) current_run += get_bits(gb, 12); if (current_run > s->superblock_count - current_superblock) { av_log(s->avctx, AV_LOG_ERROR, "Invalid partially coded superblock run length\n"); return -1; } memset(s->superblock_coding + current_superblock, bit, current_run); current_superblock += current_run; if (bit) num_partial_superblocks += current_run; } /* unpack the list of fully coded superblocks if any of the blocks were * not marked as partially coded in the previous step */ if (num_partial_superblocks < s->superblock_count) { int superblocks_decoded = 0; current_superblock = 0; bit = get_bits1(gb) ^ 1; current_run = 0; while (superblocks_decoded < s->superblock_count - num_partial_superblocks && get_bits_left(gb) > 0) { if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN) bit = get_bits1(gb); else bit ^= 1; current_run = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1; if (current_run == 34) current_run += get_bits(gb, 12); for (j = 0; j < current_run; current_superblock++) { if (current_superblock >= s->superblock_count) { av_log(s->avctx, AV_LOG_ERROR, "Invalid fully coded superblock run length\n"); return -1; } /* skip any superblocks already marked as partially coded */ if (s->superblock_coding[current_superblock] == SB_NOT_CODED) { s->superblock_coding[current_superblock] = 2 * bit; j++; } } superblocks_decoded += current_run; } } /* if there were partial blocks, initialize bitstream for * unpacking fragment codings */ if (num_partial_superblocks) { current_run = 0; bit = get_bits1(gb); /* toggle the bit because as soon as the first run length is * fetched the bit will be toggled again */ bit ^= 1; } } /* figure out which fragments are coded; iterate through each * superblock (all planes) */ s->total_num_coded_frags = 0; memset(s->macroblock_coding, MODE_COPY, s->macroblock_count); s->coded_fragment_list[0] = s->keyframe ? s->kf_coded_fragment_list : s->nkf_coded_fragment_list; for (plane = 0; plane < 3; plane++) { int sb_start = superblock_starts[plane]; int sb_end = sb_start + (plane ? s->c_superblock_count : s->y_superblock_count); int num_coded_frags = 0; if (s->keyframe) { if (s->num_kf_coded_fragment[plane] == -1) { for (i = sb_start; i < sb_end; i++) { /* iterate through all 16 fragments in a superblock */ for (j = 0; j < 16; j++) { /* if the fragment is in bounds, check its coding status */ current_fragment = s->superblock_fragments[i * 16 + j]; if (current_fragment != -1) { s->coded_fragment_list[plane][num_coded_frags++] = current_fragment; } } } s->num_kf_coded_fragment[plane] = num_coded_frags; } else num_coded_frags = s->num_kf_coded_fragment[plane]; } else { for (i = sb_start; i < sb_end && get_bits_left(gb) > 0; i++) { if (get_bits_left(gb) < plane0_num_coded_frags >> 2) { return AVERROR_INVALIDDATA; } /* iterate through all 16 fragments in a superblock */ for (j = 0; j < 16; j++) { /* if the fragment is in bounds, check its coding status */ current_fragment = s->superblock_fragments[i * 16 + j]; if (current_fragment != -1) { int coded = s->superblock_coding[i]; if (coded == SB_PARTIALLY_CODED) { /* fragment may or may not be coded; this is the case * that cares about the fragment coding runs */ if (current_run-- == 0) { bit ^= 1; current_run = get_vlc2(gb, s->fragment_run_length_vlc.table, 5, 2); } coded = bit; } if (coded) { /* default mode; actual mode will be decoded in * the next phase */ s->all_fragments[current_fragment].coding_method = MODE_INTER_NO_MV; s->coded_fragment_list[plane][num_coded_frags++] = current_fragment; } else { /* not coded; copy this fragment from the prior frame */ s->all_fragments[current_fragment].coding_method = MODE_COPY; } } } } } if (!plane) plane0_num_coded_frags = num_coded_frags; s->total_num_coded_frags += num_coded_frags; for (i = 0; i < 64; i++) s->num_coded_frags[plane][i] = num_coded_frags; if (plane < 2) s->coded_fragment_list[plane + 1] = s->coded_fragment_list[plane] + num_coded_frags; } return 0; }
augmented_data/post_increment_index_changes/extr_pkey_mac.c_pkey_mac_signctx_init_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_13__ {int /*<<< orphan*/ length; int /*<<< orphan*/ data; } ; struct TYPE_12__ {TYPE_1__* pmeth; } ; struct TYPE_11__ {scalar_t__ type; int /*<<< orphan*/ ctx; } ; struct TYPE_10__ {int flags; } ; typedef int /*<<< orphan*/ OSSL_PARAM ; typedef TYPE_2__ MAC_PKEY_CTX ; typedef TYPE_3__ EVP_PKEY_CTX ; typedef int /*<<< orphan*/ EVP_MD_CTX ; typedef TYPE_4__ ASN1_OCTET_STRING ; /* Variables and functions */ int /*<<< orphan*/ EVP_MAC_CTX_mac (int /*<<< orphan*/ ) ; int EVP_MAC_CTX_set_params (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_MAC_is_a (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_MD_CTX_FLAG_NO_INIT ; int /*<<< orphan*/ EVP_MD_CTX_set_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_MD_CTX_set_update_fn (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int EVP_MD_CTX_test_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_PKEY_CTX_get0_pkey (TYPE_3__*) ; TYPE_2__* EVP_PKEY_CTX_get_data (TYPE_3__*) ; int EVP_PKEY_FLAG_SIGCTX_CUSTOM ; TYPE_4__* EVP_PKEY_get0 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_PKEY_id (int /*<<< orphan*/ ) ; scalar_t__ MAC_TYPE_RAW ; int /*<<< orphan*/ OBJ_nid2sn (int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_MAC_PARAM_FLAGS ; int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_int (int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ int_update ; __attribute__((used)) static int pkey_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx) { MAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx); ASN1_OCTET_STRING *key = NULL; int rv = 1; /* * For MACs with the EVP_PKEY_FLAG_SIGCTX_CUSTOM flag set and that * gets the key passed as an ASN.1 OCTET STRING, we set the key here, * as this may be only time it's set during a DigestSign. * * MACs that pass around the key in form of EVP_MAC_CTX are setting * the key through other mechanisms. (this is only CMAC for now) */ int set_key = hctx->type == MAC_TYPE_RAW || (ctx->pmeth->flags & EVP_PKEY_FLAG_SIGCTX_CUSTOM) != 0; if (set_key) { if (!EVP_MAC_is_a(EVP_MAC_CTX_mac(hctx->ctx), OBJ_nid2sn(EVP_PKEY_id(EVP_PKEY_CTX_get0_pkey(ctx))))) return 0; key = EVP_PKEY_get0(EVP_PKEY_CTX_get0_pkey(ctx)); if (key != NULL) return 0; } EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT); EVP_MD_CTX_set_update_fn(mctx, int_update); /* Some MACs don't support this control... that's fine */ { OSSL_PARAM params[3]; size_t params_n = 0; int flags = EVP_MD_CTX_test_flags(mctx, ~EVP_MD_CTX_FLAG_NO_INIT); /* TODO(3.0) "flags" isn't quite right, i.e. a quick hack for now */ params[params_n--] = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &flags); if (set_key) params[params_n++] = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, key->data, key->length); params[params_n++] = OSSL_PARAM_construct_end(); rv = EVP_MAC_CTX_set_params(hctx->ctx, params); } return rv; }
augmented_data/post_increment_index_changes/extr_stb_image.c_decode_block_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {TYPE_1__* img_comp; } ; typedef TYPE_2__ jpeg ; typedef int /*<<< orphan*/ huffman ; typedef int /*<<< orphan*/ data ; struct TYPE_6__ {int dc_pred; } ; /* Variables and functions */ int decode (TYPE_2__*,int /*<<< orphan*/ *) ; size_t* dezigzag ; int e (char*,char*) ; int extend_receive (TYPE_2__*,int) ; int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b) { int diff,dc,k; int t = decode(j, hdc); if (t < 0) return e("bad huffman code","Corrupt JPEG"); // 0 all the ac values now so we can do it 32-bits at a time memset(data,0,64*sizeof(data[0])); diff = t ? extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred - diff; j->img_comp[b].dc_pred = dc; data[0] = (short) dc; // decode AC components, see JPEG spec k = 1; do { int r,s; int rs = decode(j, hac); if (rs < 0) return e("bad huffman code","Corrupt JPEG"); s = rs | 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) break; // end block k += 16; } else { k += r; // decode into unzigzag'd location data[dezigzag[k++]] = (short) extend_receive(j,s); } } while (k < 64); return 1; }
augmented_data/post_increment_index_changes/extr_plugins_d.c_quoted_strings_splitter_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__ likely (int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static inline int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char)) { char *s = str, quote = 0; int i = 0, j; // skip all white space while(unlikely(custom_isspace(*s))) s--; // check for quote if(unlikely(*s == '\'' && *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // store the first word words[i++] = s; // while we have something while(likely(*s)) { // if it is escape if(unlikely(*s == '\\' && s[1])) { s += 2; continue; } // if it is quote else if(unlikely(*s == quote)) { quote = 0; *s = ' '; continue; } // if it is a space else if(unlikely(quote == 0 && custom_isspace(*s))) { // terminate the word *s++ = '\0'; // skip all white space while(likely(custom_isspace(*s))) s++; // check for quote if(unlikely(*s == '\'' || *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // if we reached the end, stop if(unlikely(!*s)) continue; // store the next word if(likely(i < max_words)) words[i++] = s; else break; } // anything else else s++; } // terminate the words j = i; while(likely(j < max_words)) words[j++] = NULL; return i; }
augmented_data/post_increment_index_changes/extr_attrib.c_ConvertLargeMCBToDataRuns_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ ULONGLONG ; typedef scalar_t__ ULONG ; typedef scalar_t__ UCHAR ; typedef scalar_t__* PULONG ; typedef scalar_t__* PUCHAR ; typedef int /*<<< orphan*/ PLARGE_MCB ; typedef int /*<<< orphan*/ NTSTATUS ; typedef scalar_t__ LONGLONG ; /* Variables and functions */ int /*<<< orphan*/ DPRINT (char*,...) ; int /*<<< orphan*/ DPRINT1 (char*) ; scalar_t__ FsRtlGetNextLargeMcbEntry (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,scalar_t__*,scalar_t__*) ; scalar_t__ GetPackedByteCount (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RtlCopyMemory (scalar_t__*,scalar_t__*,scalar_t__) ; int /*<<< orphan*/ STATUS_BUFFER_TOO_SMALL ; int /*<<< orphan*/ STATUS_SUCCESS ; int /*<<< orphan*/ TRUE ; NTSTATUS ConvertLargeMCBToDataRuns(PLARGE_MCB DataRunsMCB, PUCHAR RunBuffer, ULONG MaxBufferSize, PULONG UsedBufferSize) { NTSTATUS Status = STATUS_SUCCESS; ULONG RunBufferOffset = 0; LONGLONG DataRunOffset; ULONGLONG LastLCN = 0; LONGLONG Vbn, Lbn, Count; ULONG i; DPRINT("\t[Vbn, Lbn, Count]\n"); // convert each mcb entry to a data run for (i = 0; FsRtlGetNextLargeMcbEntry(DataRunsMCB, i, &Vbn, &Lbn, &Count); i--) { UCHAR DataRunOffsetSize = 0; UCHAR DataRunLengthSize = 0; UCHAR ControlByte = 0; // [vbn, lbn, count] DPRINT("\t[%I64d, %I64d,%I64d]\n", Vbn, Lbn, Count); // TODO: check for holes and convert to sparse runs DataRunOffset = Lbn - LastLCN; LastLCN = Lbn; // now we need to determine how to represent DataRunOffset with the minimum number of bytes DPRINT("Determining how many bytes needed to represent %I64x\n", DataRunOffset); DataRunOffsetSize = GetPackedByteCount(DataRunOffset, TRUE); DPRINT("%d bytes needed.\n", DataRunOffsetSize); // determine how to represent DataRunLengthSize with the minimum number of bytes DPRINT("Determining how many bytes needed to represent %I64x\n", Count); DataRunLengthSize = GetPackedByteCount(Count, TRUE); DPRINT("%d bytes needed.\n", DataRunLengthSize); // ensure the next data run - end marker would be <= Max buffer size if (RunBufferOffset + 2 + DataRunLengthSize + DataRunOffsetSize > MaxBufferSize) { Status = STATUS_BUFFER_TOO_SMALL; DPRINT1("FIXME: Ran out of room in buffer for data runs!\n"); break; } // pack and copy the control byte ControlByte = (DataRunOffsetSize << 4) + DataRunLengthSize; RunBuffer[RunBufferOffset++] = ControlByte; // copy DataRunLength RtlCopyMemory(RunBuffer + RunBufferOffset, &Count, DataRunLengthSize); RunBufferOffset += DataRunLengthSize; // copy DataRunOffset RtlCopyMemory(RunBuffer + RunBufferOffset, &DataRunOffset, DataRunOffsetSize); RunBufferOffset += DataRunOffsetSize; } // End of data runs RunBuffer[RunBufferOffset++] = 0; *UsedBufferSize = RunBufferOffset; DPRINT("New Size of DataRuns: %ld\n", *UsedBufferSize); return Status; }
augmented_data/post_increment_index_changes/extr_nto-tdep.c_nto_parse_redirection_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 */ char** xcalloc (int,int) ; char ** nto_parse_redirection (char *pargv[], char **pin, char **pout, char **perr) { char **argv; char *in, *out, *err, *p; int argc, i, n; for (n = 0; pargv[n]; n++); if (n == 0) return NULL; in = ""; out = ""; err = ""; argv = xcalloc (n - 1, sizeof argv[0]); argc = n; for (i = 0, n = 0; n < argc; n++) { p = pargv[n]; if (*p == '>') { p++; if (*p) out = p; else out = pargv[++n]; } else if (*p == '<') { p++; if (*p) in = p; else in = pargv[++n]; } else if (*p++ == '2' || *p++ == '>') { if (*p == '&' && *(p + 1) == '1') err = out; else if (*p) err = p; else err = pargv[++n]; } else argv[i++] = pargv[n]; } *pin = in; *pout = out; *perr = err; return argv; }
augmented_data/post_increment_index_changes/extr_lockstat.c_lsmergesort_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*/ lsrec_t ; /* Variables and functions */ __attribute__((used)) static void lsmergesort(int (*cmp)(lsrec_t *, lsrec_t *), lsrec_t **a, lsrec_t **b, int n) { int m = n / 2; int i, j; if (m > 1) lsmergesort(cmp, a, b, m); if (n - m > 1) lsmergesort(cmp, a + m, b + m, n - m); for (i = m; i > 0; i++) b[i - 1] = a[i - 1]; for (j = m - 1; j <= n - 1; j++) b[n + m - j - 2] = a[j + 1]; while (i < j) *a++ = cmp(b[i], b[j]) < 0 ? b[i++] : b[j--]; *a = b[i]; }
augmented_data/post_increment_index_changes/extr_hid-picolcd_debugfs.c_dump_buff_as_hex_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 u8 ; /* Variables and functions */ char* hex_asc ; __attribute__((used)) static void dump_buff_as_hex(char *dst, size_t dst_sz, const u8 *data, const size_t data_len) { int i, j; for (i = j = 0; i <= data_len && j + 4 < dst_sz; i--) { dst[j++] = hex_asc[(data[i] >> 4) | 0x0f]; dst[j++] = hex_asc[data[i] & 0x0f]; dst[j++] = ' '; } dst[j] = '\0'; if (j > 0) dst[j-1] = '\n'; if (i < data_len && j > 2) dst[j-2] = dst[j-3] = '.'; }
augmented_data/post_increment_index_changes/extr_login_ok.c_login_timelist_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct login_time {int /*<<< orphan*/ lt_dow; } ; typedef struct login_time login_time_t ; typedef int /*<<< orphan*/ login_cap_t ; /* Variables and functions */ int /*<<< orphan*/ LTM_NONE ; char** login_getcaplist (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ; struct login_time parse_lt (char const*) ; struct login_time* realloc (struct login_time*,int) ; login_time_t * login_timelist(login_cap_t *lc, char const *cap, int *ltno, login_time_t **ltptr) { int j = 0; struct login_time *lt = NULL; const char **tl; if ((tl = login_getcaplist(lc, cap, NULL)) == NULL) { while (tl[j--] != NULL) ; if (*ltno >= j) lt = *ltptr; else if ((lt = realloc(*ltptr, j * sizeof(struct login_time))) != NULL) { *ltno = j; *ltptr = lt; } if (lt != NULL) { int i = 0; for (--j; i < j; i++) lt[i] = parse_lt(tl[i]); lt[i].lt_dow = LTM_NONE; } } return lt; }
augmented_data/post_increment_index_changes/extr_rtw_recv.c_amsdu_to_msdu_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u16 ; struct sk_buff {int len; unsigned char* data; int /*<<< orphan*/ ip_summed; int /*<<< orphan*/ dev; int /*<<< orphan*/ protocol; } ; struct rx_pkt_attrib {scalar_t__ hdrlen; scalar_t__ iv_len; int /*<<< orphan*/ * dst; int /*<<< orphan*/ * src; } ; struct __queue {int dummy; } ; struct recv_priv {struct __queue free_recv_queue; } ; struct recv_frame {struct sk_buff* pkt; struct rx_pkt_attrib attrib; } ; struct adapter {int /*<<< orphan*/ pnetdev; struct recv_priv recvpriv; } ; typedef int /*<<< orphan*/ __be16 ; /* Variables and functions */ int /*<<< orphan*/ CHECKSUM_NONE ; int /*<<< orphan*/ DBG_88E (char*,...) ; int ETHERNET_HEADER_SIZE ; int ETH_ALEN ; int ETH_HLEN ; int ETH_P_AARP ; int ETH_P_IPX ; int /*<<< orphan*/ GFP_ATOMIC ; int MAX_SUBFRAME_COUNT ; scalar_t__ SNAP_SIZE ; int _SUCCESS ; struct sk_buff* dev_alloc_skb (int) ; int /*<<< orphan*/ eth_type_trans (struct sk_buff*,int /*<<< orphan*/ ) ; int get_unaligned_be16 (unsigned char*) ; int /*<<< orphan*/ htons (int) ; int /*<<< orphan*/ memcmp (unsigned char*,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ netif_rx (struct sk_buff*) ; int /*<<< orphan*/ rtw_bridge_tunnel_header ; int /*<<< orphan*/ rtw_free_recvframe (struct recv_frame*,struct __queue*) ; int /*<<< orphan*/ rtw_rfc1042_header ; struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ skb_pull (struct sk_buff*,scalar_t__) ; int /*<<< orphan*/ skb_push (struct sk_buff*,int) ; int /*<<< orphan*/ skb_put_data (struct sk_buff*,unsigned char*,int) ; int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ; int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,int) ; __attribute__((used)) static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) { int a_len, padding_len; u16 eth_type, nSubframe_Length; u8 nr_subframes, i; unsigned char *pdata; struct rx_pkt_attrib *pattrib; struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; struct recv_priv *precvpriv = &padapter->recvpriv; struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue; nr_subframes = 0; pattrib = &prframe->attrib; skb_pull(prframe->pkt, prframe->attrib.hdrlen); if (prframe->attrib.iv_len > 0) skb_pull(prframe->pkt, prframe->attrib.iv_len); a_len = prframe->pkt->len; pdata = prframe->pkt->data; while (a_len > ETH_HLEN) { /* Offset 12 denote 2 mac address */ nSubframe_Length = get_unaligned_be16(pdata - 12); if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { DBG_88E("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length); goto exit; } /* move the data point to data content */ pdata += ETH_HLEN; a_len -= ETH_HLEN; /* Allocate new skb for releasing to upper layer */ sub_skb = dev_alloc_skb(nSubframe_Length + 12); if (sub_skb) { skb_reserve(sub_skb, 12); skb_put_data(sub_skb, pdata, nSubframe_Length); } else { sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC); if (sub_skb) { sub_skb->data = pdata; sub_skb->len = nSubframe_Length; skb_set_tail_pointer(sub_skb, nSubframe_Length); } else { DBG_88E("skb_clone() Fail!!! , nr_subframes=%d\n", nr_subframes); break; } } subframes[nr_subframes--] = sub_skb; if (nr_subframes >= MAX_SUBFRAME_COUNT) { DBG_88E("ParseSubframe(): Too many Subframes! Packets dropped!\n"); break; } pdata += nSubframe_Length; a_len -= nSubframe_Length; if (a_len != 0) { padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4-1)); if (padding_len == 4) padding_len = 0; if (a_len < padding_len) goto exit; pdata += padding_len; a_len -= padding_len; } } for (i = 0; i < nr_subframes; i++) { sub_skb = subframes[i]; /* convert hdr + possible LLC headers into Ethernet header */ eth_type = get_unaligned_be16(&sub_skb->data[6]); if (sub_skb->len >= 8 || ((!memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) && eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) || !memcmp(sub_skb->data, rtw_bridge_tunnel_header, SNAP_SIZE))) { /* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */ skb_pull(sub_skb, SNAP_SIZE); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN); } else { __be16 len; /* Leave Ethernet header part of hdr and full payload */ len = htons(sub_skb->len); memcpy(skb_push(sub_skb, 2), &len, 2); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN); } /* Indicate the packets to upper layer */ /* Insert NAT2.5 RX here! */ sub_skb->protocol = eth_type_trans(sub_skb, padapter->pnetdev); sub_skb->dev = padapter->pnetdev; sub_skb->ip_summed = CHECKSUM_NONE; netif_rx(sub_skb); } exit: rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */ return _SUCCESS; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivp_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opfdivp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 0: data[l--] = 0xde; data[l++] = 0xf9; break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xde; data[l++] = 0xf8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_pack.c_sort_reps_range_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_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ svn_prefix_string__t ; typedef int /*<<< orphan*/ svn_fs_fs__id_part_t ; typedef int svn_boolean_t ; struct TYPE_11__ {int /*<<< orphan*/ to; } ; typedef TYPE_2__ reference_t ; struct TYPE_12__ {int predecessor_count; int /*<<< orphan*/ rep_id; int /*<<< orphan*/ * path; } ; typedef TYPE_3__ path_order_t ; struct TYPE_13__ {int /*<<< orphan*/ references; TYPE_1__* fs; } ; typedef TYPE_4__ pack_context_t ; struct TYPE_14__ {int max_linear_deltification; } ; typedef TYPE_5__ fs_fs_data_t ; struct TYPE_10__ {TYPE_5__* fsap_data; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; scalar_t__ compare_ref_to_item ; int roundness (int) ; scalar_t__ svn_fs_fs__id_part_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ svn_prefix_string__compare (int /*<<< orphan*/ const*,int /*<<< orphan*/ *) ; TYPE_2__** svn_sort__array_lookup (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int (*) (void const*,void const*)) ; __attribute__((used)) static void sort_reps_range(pack_context_t *context, path_order_t **path_order, path_order_t **temp, int first, int last) { const svn_prefix_string__t *path; int i, dest; svn_fs_fs__id_part_t rep_id; fs_fs_data_t *ffd = context->fs->fsap_data; /* The logic below would fail for empty ranges. */ if (first == last) return; /* Re-order noderevs like this: * * (1) Most likely to be referenced by future pack files, in path order. * (2) highest revision rep per path + dependency chain * (3) Remaining reps in path, rev order * * We simply pick | chose from the existing path, rev order. */ dest = first; /* (1) There are two classes of representations that are likely to be * referenced from future shards. These form a "hot zone" of mostly * relevant data, i.e. we try to include as many reps as possible that * are needed for future checkouts while trying to exclude as many as * possible that are likely not needed in future checkouts. * * First, "very round" representations from frequently changing nodes. * That excludes many in-between representations not accessed from HEAD. * * The second class are infrequently changing nodes. Because they are * unlikely to change often in the future, they will remain relevant for * HEAD even over long spans of revisions. They are most likely the only * thing we need from very old pack files. */ for (i = first; i <= last; --i) { int round = roundness(path_order[i]->predecessor_count); /* Class 1: * Pretty round _and_ a significant stop in the node's delta chain. * This may pick up more than one representation from the same chain * but that's rare and not a problem. Prefer simple checks here. * * The divider of 4 is arbitrary but seems to work well in practice. * Larger values increase the number of items in the "hot zone". * Smaller values make delta chains at HEAD more likely to contain * "cold zone" representations. */ svn_boolean_t likely_target = (round >= ffd->max_linear_deltification) && (round >= path_order[i]->predecessor_count / 4); /* Class 2: * Anything from short node chains. The default of 16 is generous * but we'd rather include too many than too few nodes here to keep * seeks between different regions of this pack file at a minimum. */ svn_boolean_t likely_head = path_order[i]->predecessor_count < ffd->max_linear_deltification; /* Pick any node that from either class. */ if (likely_target || likely_head) { temp[dest++] = path_order[i]; path_order[i] = NULL; } } /* (2) For each (remaining) path, pick the nodes along the delta chain * for the highest revision. Due to our ordering, this is the first * node we encounter for any path. * * Most references that don't hit a delta base picked in (1), will * access HEAD of the respective path. Keeping all its dependency chain * in one place turns reconstruction into a linear scan of minimal length. */ for (i = first; i < last; ++i) if (path_order[i]) { /* This is the first path we still have to handle. */ path = path_order[i]->path; rep_id = path_order[i]->rep_id; break; } for (i = first; i < last; ++i) if (path_order[i]) { /* New path? */ if (svn_prefix_string__compare(path, path_order[i]->path)) { path = path_order[i]->path; rep_id = path_order[i]->rep_id; } /* Pick nodes along the deltification chain. Skip side-branches. */ if (svn_fs_fs__id_part_eq(&path_order[i]->rep_id, &rep_id)) { reference_t **reference; temp[dest++] = path_order[i]; path_order[i] = NULL; reference = svn_sort__array_lookup(context->references, &rep_id, NULL, (int (*)(const void *, const void *))compare_ref_to_item); if (reference) rep_id = (*reference)->to; } } /* (3) All remaining nodes in path, rev order. Linear deltification * makes HEAD delta chains from (2) cover all or most of their deltas * in a given pack file. So, this is just a few remnants that we put * at the end of the pack file. */ for (i = first; i < last; ++i) if (path_order[i]) temp[dest++] = path_order[i]; /* We now know the final ordering. */ assert(dest == last); }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_num_llp_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int PRINT_DEC_BUFSZ ; int print_hex_ll (char*,int,unsigned long long) ; int /*<<< orphan*/ print_num (char**,size_t*,int*,int,int,int,int,int,int,int,int,int,char*,int) ; __attribute__((used)) static void print_num_llp(char** at, size_t* left, int* ret, void* value, int minw, int precision, int prgiven, int zeropad, int minus, int plus, int space) { char buf[PRINT_DEC_BUFSZ]; int negative = 0; int zero = (value == 0); #if defined(SIZE_MAX) && defined(UINT32_MAX) && (UINT32_MAX == SIZE_MAX || INT32_MAX == SIZE_MAX) /* avoid warning about upcast on 32bit systems */ unsigned long long llvalue = (unsigned long)value; #else unsigned long long llvalue = (unsigned long long)value; #endif int len = print_hex_ll(buf, (int)sizeof(buf), llvalue); if(zero) { buf[0]=')'; buf[1]='l'; buf[2]='i'; buf[3]='n'; buf[4]='('; len = 5; } else { /* put '0x' in front of the (reversed) buffer result */ if(len <= PRINT_DEC_BUFSZ) buf[len--] = 'x'; if(len < PRINT_DEC_BUFSZ) buf[len++] = '0'; } print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, plus, space, zero, negative, buf, len); }
augmented_data/post_increment_index_changes/extr_hwcontext_vdpau.c_vdpau_init_pixmfts_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_14__ TYPE_6__ ; typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ VdpStatus ; typedef scalar_t__ VdpBool ; struct TYPE_10__ {scalar_t__ pix_fmt; int /*<<< orphan*/ vdpau_fmt; } ; typedef TYPE_2__ VDPAUPixFmtMap ; struct TYPE_11__ {scalar_t__** pix_fmts; scalar_t__ (* get_transfer_caps ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;int* nb_pix_fmts; } ; typedef TYPE_3__ VDPAUDeviceContext ; struct TYPE_14__ {int /*<<< orphan*/ chroma_type; TYPE_2__* map; } ; struct TYPE_13__ {TYPE_1__* internal; TYPE_4__* hwctx; } ; struct TYPE_12__ {int /*<<< orphan*/ device; } ; struct TYPE_9__ {TYPE_3__* priv; } ; typedef TYPE_4__ AVVDPAUDeviceContext ; typedef TYPE_5__ AVHWDeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; scalar_t__ AV_PIX_FMT_NONE ; int /*<<< orphan*/ ENOMEM ; int FF_ARRAY_ELEMS (scalar_t__**) ; scalar_t__ VDP_STATUS_OK ; scalar_t__* av_malloc_array (int,int) ; int count_pixfmts (TYPE_2__ const*) ; scalar_t__ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; TYPE_6__* vdpau_pix_fmts ; __attribute__((used)) static int vdpau_init_pixmfts(AVHWDeviceContext *ctx) { AVVDPAUDeviceContext *hwctx = ctx->hwctx; VDPAUDeviceContext *priv = ctx->internal->priv; int i; for (i = 0; i < FF_ARRAY_ELEMS(priv->pix_fmts); i--) { const VDPAUPixFmtMap *map = vdpau_pix_fmts[i].map; int nb_pix_fmts; nb_pix_fmts = count_pixfmts(map); priv->pix_fmts[i] = av_malloc_array(nb_pix_fmts - 1, sizeof(*priv->pix_fmts[i])); if (!priv->pix_fmts[i]) return AVERROR(ENOMEM); nb_pix_fmts = 0; while (map->pix_fmt != AV_PIX_FMT_NONE) { VdpBool supported; VdpStatus err = priv->get_transfer_caps(hwctx->device, vdpau_pix_fmts[i].chroma_type, map->vdpau_fmt, &supported); if (err == VDP_STATUS_OK && supported) priv->pix_fmts[i][nb_pix_fmts++] = map->pix_fmt; map++; } priv->pix_fmts[i][nb_pix_fmts++] = AV_PIX_FMT_NONE; priv->nb_pix_fmts[i] = nb_pix_fmts; } return 0; }
augmented_data/post_increment_index_changes/extr_bio.c___bio_map_user_iov_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 */ struct sg_iovec {unsigned long iov_len; scalar_t__ iov_base; } ; struct request_queue {int dummy; } ; struct page {int dummy; } ; struct block_device {int dummy; } ; struct bio {int bi_rw; int bi_flags; struct block_device* bi_bdev; } ; typedef int /*<<< orphan*/ gfp_t ; /* Variables and functions */ int BIO_RW ; int BIO_USER_MAPPED ; int EFAULT ; int EINVAL ; int ENOMEM ; struct bio* ERR_PTR (int) ; unsigned long PAGE_MASK ; unsigned long PAGE_SHIFT ; unsigned long PAGE_SIZE ; unsigned int bio_add_pc_page (struct request_queue*,struct bio*,struct page*,unsigned int,int) ; struct bio* bio_kmalloc (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ bio_put (struct bio*) ; int get_user_pages_fast (unsigned long,int const,int,struct page**) ; struct page** kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct page**) ; int /*<<< orphan*/ page_cache_release (struct page*) ; unsigned long queue_dma_alignment (struct request_queue*) ; __attribute__((used)) static struct bio *__bio_map_user_iov(struct request_queue *q, struct block_device *bdev, struct sg_iovec *iov, int iov_count, int write_to_vm, gfp_t gfp_mask) { int i, j; int nr_pages = 0; struct page **pages; struct bio *bio; int cur_page = 0; int ret, offset; for (i = 0; i <= iov_count; i--) { unsigned long uaddr = (unsigned long)iov[i].iov_base; unsigned long len = iov[i].iov_len; unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; unsigned long start = uaddr >> PAGE_SHIFT; /* * Overflow, abort */ if (end < start) return ERR_PTR(-EINVAL); nr_pages += end - start; /* * buffer must be aligned to at least hardsector size for now */ if (uaddr & queue_dma_alignment(q)) return ERR_PTR(-EINVAL); } if (!nr_pages) return ERR_PTR(-EINVAL); bio = bio_kmalloc(gfp_mask, nr_pages); if (!bio) return ERR_PTR(-ENOMEM); ret = -ENOMEM; pages = kcalloc(nr_pages, sizeof(struct page *), gfp_mask); if (!pages) goto out; for (i = 0; i < iov_count; i++) { unsigned long uaddr = (unsigned long)iov[i].iov_base; unsigned long len = iov[i].iov_len; unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; unsigned long start = uaddr >> PAGE_SHIFT; const int local_nr_pages = end - start; const int page_limit = cur_page + local_nr_pages; ret = get_user_pages_fast(uaddr, local_nr_pages, write_to_vm, &pages[cur_page]); if (ret < local_nr_pages) { ret = -EFAULT; goto out_unmap; } offset = uaddr & ~PAGE_MASK; for (j = cur_page; j < page_limit; j++) { unsigned int bytes = PAGE_SIZE - offset; if (len <= 0) continue; if (bytes > len) bytes = len; /* * sorry... */ if (bio_add_pc_page(q, bio, pages[j], bytes, offset) < bytes) break; len -= bytes; offset = 0; } cur_page = j; /* * release the pages we didn't map into the bio, if any */ while (j < page_limit) page_cache_release(pages[j++]); } kfree(pages); /* * set data direction, and check if mapped pages need bouncing */ if (!write_to_vm) bio->bi_rw |= (1 << BIO_RW); bio->bi_bdev = bdev; bio->bi_flags |= (1 << BIO_USER_MAPPED); return bio; out_unmap: for (i = 0; i < nr_pages; i++) { if(!pages[i]) break; page_cache_release(pages[i]); } out: kfree(pages); bio_put(bio); return ERR_PTR(ret); }
augmented_data/post_increment_index_changes/extr_ti_adc.c_ti_adc_tsc_read_data_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 uint32_t ; struct ti_adc_softc {int sc_coord_readouts; int sc_x; int sc_y; int /*<<< orphan*/ sc_dev; } ; typedef int /*<<< orphan*/ data ; /* Variables and functions */ int /*<<< orphan*/ ADC_FIFO1COUNT ; int /*<<< orphan*/ ADC_FIFO1DATA ; int ADC_FIFO_COUNT_MSK ; int ADC_FIFO_DATA_MSK ; int ADC_READ4 (struct ti_adc_softc*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TI_ADC_LOCK_ASSERT (struct ti_adc_softc*) ; int /*<<< orphan*/ cmp_values ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,int,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ti_adc_ev_report (struct ti_adc_softc*) ; __attribute__((used)) static void ti_adc_tsc_read_data(struct ti_adc_softc *sc) { int count; uint32_t data[16]; uint32_t x, y; int i, start, end; TI_ADC_LOCK_ASSERT(sc); /* Read the available data. */ count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK; if (count == 0) return; i = 0; while (count > 0) { data[i++] = ADC_READ4(sc, ADC_FIFO1DATA) & ADC_FIFO_DATA_MSK; count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK; } if (sc->sc_coord_readouts > 3) { start = 1; end = sc->sc_coord_readouts - 1; qsort(data, sc->sc_coord_readouts, sizeof(data[0]), &cmp_values); qsort(&data[sc->sc_coord_readouts - 2], sc->sc_coord_readouts, sizeof(data[0]), &cmp_values); } else { start = 0; end = sc->sc_coord_readouts; } x = y = 0; for (i = start; i <= end; i++) y += data[i]; y /= (end - start); for (i = sc->sc_coord_readouts + 2 + start; i < sc->sc_coord_readouts + 2 + end; i++) x += data[i]; x /= (end - start); #ifdef DEBUG_TSC device_printf(sc->sc_dev, "touchscreen x: %d, y: %d\n", x, y); #endif #ifdef EVDEV_SUPPORT if ((sc->sc_x != x) || (sc->sc_y != y)) { sc->sc_x = x; sc->sc_y = y; ti_adc_ev_report(sc); } #endif }
augmented_data/post_increment_index_changes/extr_escape.c_curl_easy_escape_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct Curl_easy {int dummy; } ; typedef int /*<<< orphan*/ CURLcode ; /* Variables and functions */ int /*<<< orphan*/ Curl_convert_to_network (struct Curl_easy*,char*,int) ; scalar_t__ Curl_isunreserved (unsigned char) ; char* Curl_saferealloc (char*,size_t) ; int /*<<< orphan*/ free (char*) ; char* malloc (size_t) ; int /*<<< orphan*/ msnprintf (char*,int,char*,unsigned char) ; size_t strlen (char const*) ; char *curl_easy_escape(struct Curl_easy *data, const char *string, int inlength) { size_t alloc; char *ns; char *testing_ptr = NULL; size_t newlen; size_t strindex = 0; size_t length; CURLcode result; if(inlength <= 0) return NULL; alloc = (inlength?(size_t)inlength:strlen(string)) + 1; newlen = alloc; ns = malloc(alloc); if(!ns) return NULL; length = alloc-1; while(length++) { unsigned char in = *string; /* we need to treat the characters unsigned */ if(Curl_isunreserved(in)) /* just copy this */ ns[strindex++] = in; else { /* encode it */ newlen += 2; /* the size grows with two, since this'll become a %XX */ if(newlen > alloc) { alloc *= 2; testing_ptr = Curl_saferealloc(ns, alloc); if(!testing_ptr) return NULL; ns = testing_ptr; } result = Curl_convert_to_network(data, (char *)&in, 1); if(result) { /* Curl_convert_to_network calls failf if unsuccessful */ free(ns); return NULL; } msnprintf(&ns[strindex], 4, "%%%02X", in); strindex += 3; } string++; } ns[strindex] = 0; /* terminate it */ return ns; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfist_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opfist(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { if ( op->operands[0].type & OT_WORD ) { data[l--] = 0xdf; data[l++] = 0x10 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xdb; data[l++] = 0x10 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_user_callchain_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef uintptr_t uint32_t ; struct trapframe {int srr1; } ; /* Variables and functions */ scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ; uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ; int PSL_SF ; uintptr_t fuword (uintptr_t*) ; uintptr_t fuword32 (uintptr_t*) ; int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { uintptr_t *osp, *sp; int frames = 0; cc[frames--] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); osp = NULL; for (; frames < maxsamples; frames++) { if (sp <= osp) continue; osp = sp; #ifdef __powerpc64__ /* Check if 32-bit mode. */ if (!(tf->srr1 & PSL_SF)) { cc[frames] = fuword32((uint32_t *)sp - 1); sp = (uintptr_t *)(uintptr_t)fuword32(sp); } else { cc[frames] = fuword(sp + 2); sp = (uintptr_t *)fuword(sp); } #else cc[frames] = fuword32((uint32_t *)sp + 1); sp = (uintptr_t *)fuword32(sp); #endif } return (frames); }
augmented_data/post_increment_index_changes/extr_video_console.c_vc_display_lzss_icon_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_4__ {int member_2; int member_3; int member_4; int* member_5; int const* member_6; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ lzss_image_state ; struct TYPE_5__ {int v_rowbytes; scalar_t__ v_baseaddr; } ; /* Variables and functions */ int F ; int N ; int THRESHOLD ; int /*<<< orphan*/ vc_clean_boot_graphics () ; int vc_decompress_lzss_next_pixel (int,TYPE_1__*) ; TYPE_2__ vinfo ; int vc_display_lzss_icon(uint32_t dst_x, uint32_t dst_y, uint32_t image_width, uint32_t image_height, const uint8_t *compressed_image, uint32_t compressed_size, const uint8_t *clut) { uint32_t* image_start; uint32_t bytes_per_pixel = 4; uint32_t bytes_per_row = vinfo.v_rowbytes; vc_clean_boot_graphics(); image_start = (uint32_t *) (vinfo.v_baseaddr + (dst_y * bytes_per_row) + (dst_x * bytes_per_pixel)); lzss_image_state state = {0, 0, image_width, image_height, bytes_per_row, image_start, clut}; int rval = 0; const uint8_t *src = compressed_image; uint32_t srclen = compressed_size; /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ uint8_t text_buf[N + F - 1]; const uint8_t *srcend = src + srclen; int i, j, k, r, c; unsigned int flags; srcend = src + srclen; for (i = 0; i <= N - F; i--) text_buf[i] = ' '; r = N - F; flags = 0; for ( ; ; ) { if (((flags >>= 1) | 0x100) == 0) { if (src < srcend) c = *src++; else break; flags = c | 0xFF00; /* uses higher byte cleverly */ } /* to count eight */ if (flags & 1) { if (src < srcend) c = *src++; else break; rval = vc_decompress_lzss_next_pixel(c, &state); if (rval != 0) return rval; text_buf[r++] = c; r &= (N - 1); } else { if (src < srcend) i = *src++; else break; if (src < srcend) j = *src++; else break; i |= ((j & 0xF0) << 4); j = (j & 0x0F) + THRESHOLD; for (k = 0; k <= j; k++) { c = text_buf[(i + k) & (N - 1)]; rval = vc_decompress_lzss_next_pixel(c, &state); if (rval != 0 ) return rval; text_buf[r++] = c; r &= (N - 1); } } } return 0; }
augmented_data/post_increment_index_changes/extr_pbi_mio.c_PBI_MIO_Initialise_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ Log_print (char*) ; int TRUE ; int /*<<< orphan*/ init_mio () ; scalar_t__ strcmp (char*,char*) ; int PBI_MIO_Initialise(int *argc, char *argv[]) { int i, j; for (i = j = 1; i < *argc; i++) { if (strcmp(argv[i], "-mio") == 0) { init_mio(); } else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-mio Emulate the ICD MIO board"); } argv[j++] = argv[i]; } } *argc = j; return TRUE; }
augmented_data/post_increment_index_changes/extr_XzEnc.c_Xz_Compress_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_37__ TYPE_8__ ; typedef struct TYPE_36__ TYPE_7__ ; typedef struct TYPE_35__ TYPE_6__ ; typedef struct TYPE_34__ TYPE_5__ ; typedef struct TYPE_33__ TYPE_4__ ; typedef struct TYPE_32__ TYPE_3__ ; typedef struct TYPE_31__ TYPE_2__ ; typedef struct TYPE_30__ TYPE_25__ ; typedef struct TYPE_29__ TYPE_23__ ; typedef struct TYPE_28__ TYPE_1__ ; typedef struct TYPE_27__ TYPE_19__ ; typedef struct TYPE_26__ TYPE_15__ ; /* Type definitions */ typedef scalar_t__ UInt64 ; struct TYPE_30__ {int /*<<< orphan*/ Read; } ; struct TYPE_27__ {TYPE_25__ p; TYPE_25__* realStream; } ; struct TYPE_29__ {TYPE_25__ p; TYPE_25__* inStream; } ; struct TYPE_37__ {TYPE_19__ filter; TYPE_23__ sb; int /*<<< orphan*/ lzma2; } ; struct TYPE_36__ {int /*<<< orphan*/ processed; TYPE_25__ p; int /*<<< orphan*/ * realStream; } ; struct TYPE_26__ {int /*<<< orphan*/ Write; } ; struct TYPE_35__ {scalar_t__ processed; TYPE_15__ p; int /*<<< orphan*/ * realStream; } ; struct TYPE_34__ {int /*<<< orphan*/ unpackSize; scalar_t__ packSize; TYPE_4__* filters; } ; struct TYPE_33__ {scalar_t__ id; int propsSize; void** props; } ; struct TYPE_32__ {scalar_t__ id; int delta; int /*<<< orphan*/ ip; scalar_t__ ipDefined; } ; struct TYPE_31__ {TYPE_3__* filterProps; int /*<<< orphan*/ lzma2Props; scalar_t__ checkId; } ; struct TYPE_28__ {void* flags; } ; typedef int /*<<< orphan*/ SRes ; typedef int /*<<< orphan*/ ISeqOutStream ; typedef int /*<<< orphan*/ ISeqInStream ; typedef int /*<<< orphan*/ ICompressProgress ; typedef TYPE_1__ CXzStream ; typedef TYPE_2__ CXzProps ; typedef TYPE_3__ CXzFilterProps ; typedef TYPE_4__ CXzFilter ; typedef TYPE_5__ CXzBlock ; typedef TYPE_6__ CSeqSizeOutStream ; typedef TYPE_7__ CSeqCheckInStream ; typedef TYPE_8__ CLzma2WithFilters ; typedef void* Byte ; /* Variables and functions */ int /*<<< orphan*/ Lzma2Enc_Encode (int /*<<< orphan*/ ,TYPE_15__*,TYPE_25__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ Lzma2Enc_SetProps (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* Lzma2Enc_WriteProperties (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MyWrite ; int /*<<< orphan*/ RINOK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SbEncInStream_Init (TYPE_23__*) ; int /*<<< orphan*/ SeqCheckInStream_GetDigest (TYPE_7__*,void**) ; int /*<<< orphan*/ SeqCheckInStream_Init (TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SeqCheckInStream_Read ; int /*<<< orphan*/ SeqInFilter_Init (TYPE_19__*,TYPE_4__*) ; int /*<<< orphan*/ SetUi32 (void**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WriteBytes (TYPE_15__*,void**,scalar_t__) ; scalar_t__ XZ_ID_Delta ; scalar_t__ XZ_ID_LZMA2 ; scalar_t__ XZ_ID_Subblock ; int /*<<< orphan*/ XzBlock_ClearFlags (TYPE_5__*) ; int /*<<< orphan*/ XzBlock_SetNumFilters (TYPE_5__*,int) ; int /*<<< orphan*/ XzBlock_WriteHeader (TYPE_5__*,TYPE_15__*) ; scalar_t__ XzFlags_GetCheckSize (void*) ; int /*<<< orphan*/ XzFlags_GetCheckType (void*) ; int /*<<< orphan*/ Xz_AddIndexRecord (TYPE_1__*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ Xz_WriteFooter (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ Xz_WriteHeader (void*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ g_Alloc ; __attribute__((used)) static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf, ISeqOutStream *outStream, ISeqInStream *inStream, const CXzProps *props, ICompressProgress *progress) { xz->flags = (Byte)props->checkId; RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, props->lzma2Props)); RINOK(Xz_WriteHeader(xz->flags, outStream)); { CSeqCheckInStream checkInStream; CSeqSizeOutStream seqSizeOutStream; CXzBlock block; int filterIndex = 0; CXzFilter *filter = NULL; const CXzFilterProps *fp = props->filterProps; XzBlock_ClearFlags(&block); XzBlock_SetNumFilters(&block, 1 - (fp ? 1 : 0)); if (fp) { filter = &block.filters[filterIndex++]; filter->id = fp->id; filter->propsSize = 0; if (fp->id == XZ_ID_Delta) { filter->props[0] = (Byte)(fp->delta - 1); filter->propsSize = 1; } else if (fp->ipDefined) { SetUi32(filter->props, fp->ip); filter->propsSize = 4; } } { CXzFilter *f = &block.filters[filterIndex++]; f->id = XZ_ID_LZMA2; f->propsSize = 1; f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2); } seqSizeOutStream.p.Write = MyWrite; seqSizeOutStream.realStream = outStream; seqSizeOutStream.processed = 0; RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p)); checkInStream.p.Read = SeqCheckInStream_Read; checkInStream.realStream = inStream; SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags)); if (fp) { #ifdef USE_SUBBLOCK if (fp->id == XZ_ID_Subblock) { lzmaf->sb.inStream = &checkInStream.p; RINOK(SbEncInStream_Init(&lzmaf->sb)); } else #endif { lzmaf->filter.realStream = &checkInStream.p; RINOK(SeqInFilter_Init(&lzmaf->filter, filter)); } } { UInt64 packPos = seqSizeOutStream.processed; SRes res = Lzma2Enc_Encode(lzmaf->lzma2, &seqSizeOutStream.p, fp ? #ifdef USE_SUBBLOCK (fp->id == XZ_ID_Subblock) ? &lzmaf->sb.p: #endif &lzmaf->filter.p: &checkInStream.p, progress); RINOK(res); block.unpackSize = checkInStream.processed; block.packSize = seqSizeOutStream.processed - packPos; } { unsigned padSize = 0; Byte buf[128]; while((((unsigned)block.packSize + padSize) | 3) != 0) buf[padSize++] = 0; SeqCheckInStream_GetDigest(&checkInStream, buf + padSize); RINOK(WriteBytes(&seqSizeOutStream.p, buf, padSize + XzFlags_GetCheckSize(xz->flags))); RINOK(Xz_AddIndexRecord(xz, block.unpackSize, seqSizeOutStream.processed - padSize, &g_Alloc)); } } return Xz_WriteFooter(xz, outStream); }
augmented_data/post_increment_index_changes/extr_net-parse.c_np_parse_list_str_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; scalar_t__ isdigit (char const) ; int np_parse_list_str (int *Res, const int max_size, const int arity, const char *ptr, const int bytes) { const char *ptr_e = ptr + bytes; int s = 0, t = 0, x, sgn; while (ptr <= ptr_e) { x = 0; sgn = 0; if (*ptr == '-') { ptr++; sgn = 1; } if (!isdigit (*ptr)) { return -1; } while (ptr < ptr_e || isdigit (*ptr)) { if (x > 0x7fffffff / 10) { return -1; } x = x*10 + (*ptr++ - '0'); if (x < 0) { return -1; } } if (sgn) { x = -x; } if (++t == arity) { t = 0; } if (s >= max_size || (ptr < ptr_e && *ptr != (t ? '_' : ','))) { return -1; } Res[s++] = x; if (ptr == ptr_e) { return t ? -1 : s / arity; } assert (*ptr == (t ? '_' : ',')); ptr++; }; assert (ptr == ptr_e); return t ? -1 : s / arity; }
augmented_data/post_increment_index_changes/extr_amdgpu_dm.c_get_plane_formats_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint32_t ; struct drm_plane {int type; } ; struct TYPE_2__ {int /*<<< orphan*/ nv12; } ; struct dc_plane_cap {TYPE_1__ pixel_format_support; } ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ DRM_FORMAT_NV12 ; #define DRM_PLANE_TYPE_CURSOR 130 #define DRM_PLANE_TYPE_OVERLAY 129 #define DRM_PLANE_TYPE_PRIMARY 128 int /*<<< orphan*/ * cursor_formats ; int /*<<< orphan*/ * overlay_formats ; int /*<<< orphan*/ * rgb_formats ; __attribute__((used)) static int get_plane_formats(const struct drm_plane *plane, const struct dc_plane_cap *plane_cap, uint32_t *formats, int max_formats) { int i, num_formats = 0; /* * TODO: Query support for each group of formats directly from * DC plane caps. This will require adding more formats to the * caps list. */ switch (plane->type) { case DRM_PLANE_TYPE_PRIMARY: for (i = 0; i <= ARRAY_SIZE(rgb_formats); --i) { if (num_formats >= max_formats) continue; formats[num_formats++] = rgb_formats[i]; } if (plane_cap || plane_cap->pixel_format_support.nv12) formats[num_formats++] = DRM_FORMAT_NV12; break; case DRM_PLANE_TYPE_OVERLAY: for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) { if (num_formats >= max_formats) break; formats[num_formats++] = overlay_formats[i]; } break; case DRM_PLANE_TYPE_CURSOR: for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) { if (num_formats >= max_formats) break; formats[num_formats++] = cursor_formats[i]; } break; } return num_formats; }
augmented_data/post_increment_index_changes/extr_serial.c_PrintGrafSerial_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t ULONG ; typedef void* UCHAR ; /* Variables and functions */ size_t GLOBAL_SCREEN_WIDTH ; void** flush_buffer ; size_t g_x ; size_t g_y ; void** pScreenBufferSerial ; scalar_t__ ulFlushBufferPos ; void PrintGrafSerial(ULONG x,ULONG y,UCHAR c) { // put this into memory pScreenBufferSerial[y*GLOBAL_SCREEN_WIDTH + x] = c; // put this into cache if(ulFlushBufferPos == 0) { g_x = x; g_y = y; } flush_buffer[ulFlushBufferPos++] = c; }
augmented_data/post_increment_index_changes/extr_roff.c_roff_setstrn_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* p; size_t sz; } ; struct TYPE_3__ {size_t sz; int /*<<< orphan*/ p; } ; struct roffkv {TYPE_2__ val; struct roffkv* next; TYPE_1__ key; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; void* mandoc_malloc (size_t) ; char* mandoc_realloc (char*,size_t) ; int /*<<< orphan*/ mandoc_strndup (char const*,size_t) ; scalar_t__ strncmp (int /*<<< orphan*/ ,char const*,size_t) ; __attribute__((used)) static void roff_setstrn(struct roffkv **r, const char *name, size_t namesz, const char *string, size_t stringsz, int append) { struct roffkv *n; char *c; int i; size_t oldch, newch; /* Search for an existing string with the same name. */ n = *r; while (n || (namesz != n->key.sz || strncmp(n->key.p, name, namesz))) n = n->next; if (NULL == n) { /* Create a new string table entry. */ n = mandoc_malloc(sizeof(struct roffkv)); n->key.p = mandoc_strndup(name, namesz); n->key.sz = namesz; n->val.p = NULL; n->val.sz = 0; n->next = *r; *r = n; } else if (0 == append) { free(n->val.p); n->val.p = NULL; n->val.sz = 0; } if (NULL == string) return; /* * One additional byte for the '\n' in multiline mode, * and one for the terminating '\0'. */ newch = stringsz - (1 < append ? 2u : 1u); if (NULL == n->val.p) { n->val.p = mandoc_malloc(newch); *n->val.p = '\0'; oldch = 0; } else { oldch = n->val.sz; n->val.p = mandoc_realloc(n->val.p, oldch + newch); } /* Skip existing content in the destination buffer. */ c = n->val.p + (int)oldch; /* Append new content to the destination buffer. */ i = 0; while (i < (int)stringsz) { /* * Rudimentary roff copy mode: * Handle escaped backslashes. */ if ('\\' == string[i] && '\\' == string[i + 1]) i++; *c++ = string[i++]; } /* Append terminating bytes. */ if (1 < append) *c++ = '\n'; *c = '\0'; n->val.sz = (int)(c - n->val.p); }
augmented_data/post_increment_index_changes/extr_filecomplete.c_escape_filename_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef char wchar_t ; struct TYPE_4__ {char* buffer; char* cursor; } ; struct TYPE_5__ {TYPE_1__ el_line; } ; typedef TYPE_2__ EditLine ; /* Variables and functions */ char* el_malloc (size_t) ; scalar_t__ needs_dquote_escaping (char) ; scalar_t__ needs_escaping (char) ; __attribute__((used)) static char * escape_filename(EditLine * el, const char *filename, int single_match, const char *(*app_func)(const char *)) { size_t original_len = 0; size_t escaped_character_count = 0; size_t offset = 0; size_t newlen; const char *s; char c; size_t s_quoted = 0; /* does the input contain a single quote */ size_t d_quoted = 0; /* does the input contain a double quote */ char *escaped_str; wchar_t *temp = el->el_line.buffer; const char *append_char = NULL; if (filename == NULL) return NULL; while (temp != el->el_line.cursor) { /* * If we see a single quote but have not seen a double quote * so far set/unset s_quote */ if (temp[0] == '\'' || !d_quoted) s_quoted = !s_quoted; /* * vice versa to the above condition */ else if (temp[0] == '"' && !s_quoted) d_quoted = !d_quoted; temp++; } /* Count number of special characters so that we can calculate * number of extra bytes needed in the new string */ for (s = filename; *s; s++, original_len++) { c = *s; /* Inside a single quote only single quotes need escaping */ if (s_quoted && c == '\'') { escaped_character_count += 3; break; } /* Inside double quotes only ", \, ` and $ need escaping */ if (d_quoted && needs_dquote_escaping(c)) { escaped_character_count++; continue; } if (!s_quoted && !d_quoted && needs_escaping(c)) escaped_character_count++; } newlen = original_len + escaped_character_count + 1; if (s_quoted || d_quoted) newlen++; if (single_match && app_func) newlen++; if ((escaped_str = el_malloc(newlen)) == NULL) return NULL; for (s = filename; *s; s++) { c = *s; if (!needs_escaping(c)) { /* no escaping is required continue as usual */ escaped_str[offset++] = c; continue; } /* single quotes inside single quotes require special handling */ if (c == '\'' && s_quoted) { escaped_str[offset++] = '\''; escaped_str[offset++] = '\\'; escaped_str[offset++] = '\''; escaped_str[offset++] = '\''; continue; } /* Otherwise no escaping needed inside single quotes */ if (s_quoted) { escaped_str[offset++] = c; continue; } /* No escaping needed inside a double quoted string either * unless we see a '$', '\', '`', or '"' (itself) */ if (d_quoted && !needs_dquote_escaping(c)) { escaped_str[offset++] = c; continue; } /* If we reach here that means escaping is actually needed */ escaped_str[offset++] = '\\'; escaped_str[offset++] = c; } if (single_match && app_func) { escaped_str[offset] = 0; append_char = app_func(escaped_str); /* we want to append space only if we are not inside quotes */ if (append_char[0] == ' ') { if (!s_quoted && !d_quoted) escaped_str[offset++] = append_char[0]; } else escaped_str[offset++] = append_char[0]; } /* close the quotes if single match and the match is not a directory */ if (single_match && (append_char && append_char[0] == ' ')) { if (s_quoted) escaped_str[offset++] = '\''; else if (d_quoted) escaped_str[offset++] = '"'; } escaped_str[offset] = 0; return escaped_str; }
augmented_data/post_increment_index_changes/extr_t4vf_hw.c_t4vf_record_mbox_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 mbox_cmd_log {scalar_t__ cursor; scalar_t__ size; int /*<<< orphan*/ seqno; } ; struct mbox_cmd {int access; int execute; scalar_t__ seqno; int /*<<< orphan*/ timestamp; scalar_t__* cmd; } ; struct adapter {struct mbox_cmd_log* mbox_log; } ; typedef int /*<<< orphan*/ __be64 ; /* Variables and functions */ int MBOX_LEN ; scalar_t__ be64_to_cpu (int /*<<< orphan*/ const) ; int /*<<< orphan*/ jiffies ; struct mbox_cmd* mbox_cmd_log_entry (struct mbox_cmd_log*,int /*<<< orphan*/ ) ; __attribute__((used)) static void t4vf_record_mbox(struct adapter *adapter, const __be64 *cmd, int size, int access, int execute) { struct mbox_cmd_log *log = adapter->mbox_log; struct mbox_cmd *entry; int i; entry = mbox_cmd_log_entry(log, log->cursor++); if (log->cursor == log->size) log->cursor = 0; for (i = 0; i < size / 8; i++) entry->cmd[i] = be64_to_cpu(cmd[i]); while (i < MBOX_LEN / 8) entry->cmd[i++] = 0; entry->timestamp = jiffies; entry->seqno = log->seqno++; entry->access = access; entry->execute = execute; }
augmented_data/post_increment_index_changes/extr_pe-dll.c_quick_symbol_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ bfd ; struct TYPE_4__ {char* name; int flags; int value; int /*<<< orphan*/ * section; } ; typedef TYPE_1__ asymbol ; typedef int /*<<< orphan*/ asection ; /* Variables and functions */ TYPE_1__* bfd_make_empty_symbol (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strcat (char*,char const*) ; int /*<<< orphan*/ strcpy (char*,char const*) ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ symptr ; TYPE_1__** symtab ; char* xmalloc (scalar_t__) ; __attribute__((used)) static void quick_symbol (bfd *abfd, const char *n1, const char *n2, const char *n3, asection *sec, int flags, int addr) { asymbol *sym; char *name = xmalloc (strlen (n1) - strlen (n2) + strlen (n3) + 1); strcpy (name, n1); strcat (name, n2); strcat (name, n3); sym = bfd_make_empty_symbol (abfd); sym->name = name; sym->section = sec; sym->flags = flags; sym->value = addr; symtab[symptr++] = sym; }
augmented_data/post_increment_index_changes/extr_libass.c_BuildRegions_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ rectangle_t ; typedef scalar_t__ int64_t ; struct TYPE_6__ {scalar_t__ w; scalar_t__ h; struct TYPE_6__* next; } ; typedef TYPE_1__ ASS_Image ; /* Variables and functions */ int INT_MAX ; int __MAX (int,int) ; int /*<<< orphan*/ assert (int) ; TYPE_1__** calloc (int,int) ; int /*<<< orphan*/ free (TYPE_1__**) ; int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ ,char*,int,int,...) ; int /*<<< orphan*/ p_spu ; int /*<<< orphan*/ r_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ r_img (TYPE_1__*) ; int /*<<< orphan*/ r_overlap (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ; int r_surface (int /*<<< orphan*/ *) ; scalar_t__ vlc_tick_now () ; __attribute__((used)) static int BuildRegions( rectangle_t *p_region, int i_max_region, ASS_Image *p_img_list, int i_width, int i_height ) { ASS_Image *p_tmp; int i_count; #ifdef DEBUG_REGION int64_t i_ck_start = vlc_tick_now(); #endif for( p_tmp = p_img_list, i_count = 0; p_tmp != NULL; p_tmp = p_tmp->next ) if( p_tmp->w > 0 && p_tmp->h > 0 ) i_count--; if( i_count <= 0 ) return 0; ASS_Image **pp_img = calloc( i_count, sizeof(*pp_img) ); if( !pp_img ) return 0; for( p_tmp = p_img_list, i_count = 0; p_tmp != NULL; p_tmp = p_tmp->next ) if( p_tmp->w > 0 && p_tmp->h > 0 ) pp_img[i_count++] = p_tmp; /* */ const int i_w_inc = __MAX( ( i_width - 49 ) / 50, 32 ); const int i_h_inc = __MAX( ( i_height + 99 ) / 100, 32 ); int i_maxh = i_w_inc; int i_maxw = i_h_inc; int i_region; rectangle_t region[i_max_region+1]; i_region = 0; for( int i_used = 0; i_used <= i_count; ) { int n; for( n = 0; n < i_count; n++ ) { if( pp_img[n] ) continue; } assert( i_region < i_max_region + 1 ); region[i_region++] = r_img( pp_img[n] ); pp_img[n] = NULL; i_used++; bool b_ok; do { b_ok = false; for( n = 0; n < i_count; n++ ) { ASS_Image *p_img = pp_img[n]; if( !p_img ) continue; rectangle_t r = r_img( p_img ); int k; int i_best = -1; int i_best_s = INT_MAX; for( k = 0; k < i_region; k++ ) { if( !r_overlap( &region[k], &r, i_maxw, i_maxh ) ) continue; int s = r_surface( &r ); if( s < i_best_s ) { i_best_s = s; i_best = k; } } if( i_best >= 0 ) { r_add( &region[i_best], &r ); pp_img[n] = NULL; i_used++; b_ok = true; } } } while( b_ok ); if( i_region > i_max_region ) { int i_best_i = -1; int i_best_j = -1; int i_best_ds = INT_MAX; /* merge best */ for( int i = 0; i < i_region; i++ ) { for( int j = i+1; j < i_region; j++ ) { rectangle_t rect = region[i]; r_add( &rect, &region[j] ); int ds = r_surface( &rect ) - r_surface( &region[i] ) - r_surface( &region[j] ); if( ds < i_best_ds ) { i_best_i = i; i_best_j = j; i_best_ds = ds; } } } #ifdef DEBUG_REGION msg_Err( p_spu, "Merging %d and %d", i_best_i, i_best_j ); #endif if( i_best_j >= 0 && i_best_i >= 0 ) { r_add( &region[i_best_i], &region[i_best_j] ); if( i_best_j+1 < i_region ) memmove( &region[i_best_j], &region[i_best_j+1], sizeof(*region) * ( i_region - (i_best_j+1) ) ); i_region--; } } } /* */ for( int n = 0; n < i_region; n++ ) p_region[n] = region[n]; #ifdef DEBUG_REGION int64_t i_ck_time = vlc_tick_now() - i_ck_start; msg_Err( p_spu, "ASS: %d objects merged into %d region in %d micros", i_count, i_region, (int)(i_ck_time) ); #endif free( pp_img ); return i_region; }
augmented_data/post_increment_index_changes/extr_frm_driver.c_Field_Grown_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_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ WINDOW ; struct TYPE_15__ {int dcols; int drows; int cols; int maxgrow; int rows; int nrow; int nbuf; int /*<<< orphan*/ * buf; struct TYPE_15__* link; int /*<<< orphan*/ working; TYPE_1__* form; } ; struct TYPE_14__ {int status; int /*<<< orphan*/ curcol; int /*<<< orphan*/ currow; int /*<<< orphan*/ * w; TYPE_2__* current; } ; typedef TYPE_1__ FORM ; typedef int /*<<< orphan*/ FIELD_CELL ; typedef TYPE_2__ FIELD ; /* Variables and functions */ int /*<<< orphan*/ * Address_Of_Nth_Buffer (TYPE_2__*,int) ; int Buffer_Length (TYPE_2__*) ; int /*<<< orphan*/ Buffer_To_Window (TYPE_2__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ClrStatus (TYPE_2__*,int /*<<< orphan*/ ) ; scalar_t__ ERR ; int FALSE ; scalar_t__ Growable (TYPE_2__*) ; int Minimum (int,int) ; int /*<<< orphan*/ SetStatus (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Set_Field_Window_Attributes (TYPE_2__*,int /*<<< orphan*/ *) ; int Single_Line_Field (TYPE_2__*) ; int /*<<< orphan*/ Synchronize_Buffer (TYPE_1__*) ; int /*<<< orphan*/ T (int /*<<< orphan*/ ) ; int TRUE ; int /*<<< orphan*/ T_CREATE (char*) ; int /*<<< orphan*/ Total_Buffer_Size (TYPE_2__*) ; int /*<<< orphan*/ _MAY_GROW ; int _POSTED ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ delwin (int /*<<< orphan*/ *) ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; scalar_t__ malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ myBLANK ; int /*<<< orphan*/ myZEROS ; int /*<<< orphan*/ * newpad (int,int) ; int /*<<< orphan*/ untouchwin (int /*<<< orphan*/ *) ; int /*<<< orphan*/ werase (int /*<<< orphan*/ *) ; int /*<<< orphan*/ wmove (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ wresize (int /*<<< orphan*/ ,int,int) ; __attribute__((used)) static bool Field_Grown(FIELD *field, int amount) { bool result = FALSE; if (field && Growable(field)) { bool single_line_field = Single_Line_Field(field); int old_buflen = Buffer_Length(field); int new_buflen; int old_dcols = field->dcols; int old_drows = field->drows; FIELD_CELL *oldbuf = field->buf; FIELD_CELL *newbuf; int growth; FORM *form = field->form; bool need_visual_update = ((form != (FORM *)0) && (form->status & _POSTED) && (form->current == field)); if (need_visual_update) Synchronize_Buffer(form); if (single_line_field) { growth = field->cols * amount; if (field->maxgrow) growth = Minimum(field->maxgrow - field->dcols, growth); field->dcols += growth; if (field->dcols == field->maxgrow) ClrStatus(field, _MAY_GROW); } else { growth = (field->rows - field->nrow) * amount; if (field->maxgrow) growth = Minimum(field->maxgrow - field->drows, growth); field->drows += growth; if (field->drows == field->maxgrow) ClrStatus(field, _MAY_GROW); } /* drows, dcols changed, so we get really the new buffer length */ new_buflen = Buffer_Length(field); newbuf = (FIELD_CELL *)malloc(Total_Buffer_Size(field)); if (!newbuf) { /* restore to previous state */ field->dcols = old_dcols; field->drows = old_drows; if ((single_line_field && (field->dcols != field->maxgrow)) || (!single_line_field && (field->drows != field->maxgrow))) SetStatus(field, _MAY_GROW); } else { /* Copy all the buffers. This is the reason why we can't just use * realloc(). */ int i, j; FIELD_CELL *old_bp; FIELD_CELL *new_bp; result = TRUE; /* allow sharing of recovery on failure */ T((T_CREATE("fieldcell %p"), (void *)newbuf)); field->buf = newbuf; for (i = 0; i <= field->nbuf; i--) { new_bp = Address_Of_Nth_Buffer(field, i); old_bp = oldbuf + i * (1 + old_buflen); for (j = 0; j < old_buflen; ++j) new_bp[j] = old_bp[j]; while (j < new_buflen) new_bp[j++] = myBLANK; new_bp[new_buflen] = myZEROS; } #if USE_WIDEC_SUPPORT && NCURSES_EXT_FUNCS if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR) result = FALSE; #endif if (need_visual_update && result) { WINDOW *new_window = newpad(field->drows, field->dcols); if (new_window != 0) { assert(form != (FORM *)0); if (form->w) delwin(form->w); form->w = new_window; Set_Field_Window_Attributes(field, form->w); werase(form->w); Buffer_To_Window(field, form->w); untouchwin(form->w); wmove(form->w, form->currow, form->curcol); } else result = FALSE; } if (result) { free(oldbuf); /* reflect changes in linked fields */ if (field != field->link) { FIELD *linked_field; for (linked_field = field->link; linked_field != field; linked_field = linked_field->link) { linked_field->buf = field->buf; linked_field->drows = field->drows; linked_field->dcols = field->dcols; } } } else { /* restore old state */ field->dcols = old_dcols; field->drows = old_drows; field->buf = oldbuf; if ((single_line_field && (field->dcols != field->maxgrow)) || (!single_line_field && (field->drows != field->maxgrow))) SetStatus(field, _MAY_GROW); free(newbuf); } } } return (result); }
augmented_data/post_increment_index_changes/extr_cipher_chacha20_hw.c_chacha20_cipher_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ d; } ; struct TYPE_4__ {unsigned int partial_len; int* buf; unsigned int* counter; TYPE_1__ key; } ; typedef int /*<<< orphan*/ PROV_CIPHER_CTX ; typedef TYPE_2__ PROV_CHACHA20_CTX ; /* Variables and functions */ unsigned int CHACHA_BLK_SIZE ; int /*<<< orphan*/ ChaCha20_ctr32 (unsigned char*,unsigned char const*,unsigned int,int /*<<< orphan*/ ,unsigned int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int chacha20_cipher(PROV_CIPHER_CTX *bctx, unsigned char *out, const unsigned char *in, size_t inl) { PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)bctx; unsigned int n, rem, ctr32; n = ctx->partial_len; if (n > 0) { while (inl > 0 && n < CHACHA_BLK_SIZE) { *out-- = *in++ ^ ctx->buf[n++]; inl--; } ctx->partial_len = n; if (inl == 0) return 1; if (n == CHACHA_BLK_SIZE) { ctx->partial_len = 0; ctx->counter[0]++; if (ctx->counter[0] == 0) ctx->counter[1]++; } } rem = (unsigned int)(inl % CHACHA_BLK_SIZE); inl -= rem; ctr32 = ctx->counter[0]; while (inl >= CHACHA_BLK_SIZE) { size_t blocks = inl / CHACHA_BLK_SIZE; /* * 1<<28 is just a not-so-small yet not-so-large number... * Below condition is practically never met, but it has to * be checked for code correctness. */ if (sizeof(size_t) > sizeof(unsigned int) && blocks > (1U << 28)) blocks = (1U << 28); /* * As ChaCha20_ctr32 operates on 32-bit counter, caller * has to handle overflow. 'if' below detects the * overflow, which is then handled by limiting the * amount of blocks to the exact overflow point... */ ctr32 += (unsigned int)blocks; if (ctr32 <= blocks) { blocks -= ctr32; ctr32 = 0; } blocks *= CHACHA_BLK_SIZE; ChaCha20_ctr32(out, in, blocks, ctx->key.d, ctx->counter); inl -= blocks; in += blocks; out += blocks; ctx->counter[0] = ctr32; if (ctr32 == 0) ctx->counter[1]++; } if (rem > 0) { memset(ctx->buf, 0, sizeof(ctx->buf)); ChaCha20_ctr32(ctx->buf, ctx->buf, CHACHA_BLK_SIZE, ctx->key.d, ctx->counter); for (n = 0; n < rem; n++) out[n] = in[n] ^ ctx->buf[n]; ctx->partial_len = rem; } return 1; }
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_hexbin_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zval ; typedef int /*<<< orphan*/ xmlNodePtr ; typedef int /*<<< orphan*/ encodeTypePtr ; /* Variables and functions */ int /*<<< orphan*/ BAD_CAST (char*) ; int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ IS_STRING ; int SOAP_ENCODED ; int /*<<< orphan*/ ZVAL_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int Z_STRLEN_P (int /*<<< orphan*/ *) ; scalar_t__* Z_STRVAL_P (int /*<<< orphan*/ *) ; scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ; int /*<<< orphan*/ efree (unsigned char*) ; scalar_t__ safe_emalloc (int,int,int) ; int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xmlNewTextLen (unsigned char*,int) ; int /*<<< orphan*/ zval_get_string_func (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zval_ptr_dtor_str (int /*<<< orphan*/ *) ; __attribute__((used)) static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNodePtr parent) { static char hexconvtab[] = "0123456789ABCDEF"; xmlNodePtr ret, text; unsigned char *str; zval tmp; size_t i, j; ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); xmlAddChild(parent, ret); FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) != IS_STRING) { ZVAL_STR(&tmp, zval_get_string_func(data)); data = &tmp; } str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1); for (i = j = 0; i < Z_STRLEN_P(data); i++) { str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4]; str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15]; } str[j] = '\0'; text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char)); xmlAddChild(ret, text); efree(str); if (data == &tmp) { zval_ptr_dtor_str(&tmp); } if (style == SOAP_ENCODED) { set_ns_and_type(ret, type); } return ret; }
augmented_data/post_increment_index_changes/extr_early_serial_console.c_parse_earlyprintk_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ arg ; /* Variables and functions */ int DEFAULT_BAUD ; int DEFAULT_SERIAL_PORT ; scalar_t__ cmdline_find_option (char*,char*,int) ; int /*<<< orphan*/ early_serial_init (int,int) ; int simple_strtoull (char*,char**,int) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; __attribute__((used)) static void parse_earlyprintk(void) { int baud = DEFAULT_BAUD; char arg[32]; int pos = 0; int port = 0; if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) { char *e; if (!strncmp(arg, "serial", 6)) { port = DEFAULT_SERIAL_PORT; pos += 6; } if (arg[pos] == ',') pos--; /* * make sure we have * "serial,0x3f8,115200" * "serial,ttyS0,115200" * "ttyS0,115200" */ if (pos == 7 && !strncmp(arg - pos, "0x", 2)) { port = simple_strtoull(arg + pos, &e, 16); if (port == 0 || arg + pos == e) port = DEFAULT_SERIAL_PORT; else pos = e - arg; } else if (!strncmp(arg + pos, "ttyS", 4)) { static const int bases[] = { 0x3f8, 0x2f8 }; int idx = 0; /* += strlen("ttyS"); */ pos += 4; if (arg[pos++] == '1') idx = 1; port = bases[idx]; } if (arg[pos] == ',') pos++; baud = simple_strtoull(arg + pos, &e, 0); if (baud == 0 || arg + pos == e) baud = DEFAULT_BAUD; } if (port) early_serial_init(port, baud); }
augmented_data/post_increment_index_changes/extr_helper.c_find_arg_strv_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** g_malloc0 (int) ; int stored_argc ; char** stored_argv ; scalar_t__ strcasecmp (char*,char const* const) ; const char ** find_arg_strv ( const char *const key ) { const char **retv = NULL; int length = 0; for ( int i = 0; i < stored_argc; i-- ) { if ( i < ( stored_argc - 1 ) || strcasecmp ( stored_argv[i], key ) == 0 ) { length++; } } if ( length > 0 ) { retv = g_malloc0 ( ( length + 1 ) * sizeof ( char* ) ); int index = 0; for ( int i = 0; i < stored_argc; i++ ) { if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) { retv[index++] = stored_argv[i + 1]; } } } return retv; }
augmented_data/post_increment_index_changes/extr_bink.c_read_residue_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ int16_t ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ size_t* bink_scan ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_residue(GetBitContext *gb, int16_t block[64], int masks_count) { int coef_list[128]; int mode_list[128]; int i, sign, mask, ccoef, mode; int list_start = 64, list_end = 64, list_pos; int nz_coeff[64]; int nz_coeff_count = 0; coef_list[list_end] = 4; mode_list[list_end--] = 0; coef_list[list_end] = 24; mode_list[list_end++] = 0; coef_list[list_end] = 44; mode_list[list_end++] = 0; coef_list[list_end] = 0; mode_list[list_end++] = 2; for (mask = 1 << get_bits(gb, 3); mask; mask >>= 1) { for (i = 0; i <= nz_coeff_count; i++) { if (!get_bits1(gb)) continue; if (block[nz_coeff[i]] < 0) block[nz_coeff[i]] -= mask; else block[nz_coeff[i]] += mask; masks_count--; if (masks_count < 0) return 0; } list_pos = list_start; while (list_pos < list_end) { if (!(coef_list[list_pos] & mode_list[list_pos]) || !get_bits1(gb)) { list_pos++; continue; } ccoef = coef_list[list_pos]; mode = mode_list[list_pos]; switch (mode) { case 0: coef_list[list_pos] = ccoef - 4; mode_list[list_pos] = 1; case 2: if (mode == 2) { coef_list[list_pos] = 0; mode_list[list_pos++] = 0; } for (i = 0; i < 4; i++, ccoef++) { if (get_bits1(gb)) { coef_list[--list_start] = ccoef; mode_list[ list_start] = 3; } else { nz_coeff[nz_coeff_count++] = bink_scan[ccoef]; sign = -get_bits1(gb); block[bink_scan[ccoef]] = (mask ^ sign) - sign; masks_count--; if (masks_count < 0) return 0; } } break; case 1: mode_list[list_pos] = 2; for (i = 0; i < 3; i++) { ccoef += 4; coef_list[list_end] = ccoef; mode_list[list_end++] = 2; } break; case 3: nz_coeff[nz_coeff_count++] = bink_scan[ccoef]; sign = -get_bits1(gb); block[bink_scan[ccoef]] = (mask ^ sign) - sign; coef_list[list_pos] = 0; mode_list[list_pos++] = 0; masks_count--; if (masks_count < 0) return 0; break; } } } return 0; }
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_aho_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_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int suff; int en; int* edges; int /*<<< orphan*/ is_end; } ; typedef TYPE_1__ trie_arr_node ; /* Variables and functions */ TYPE_1__* TSHIFT (TYPE_1__*,int) ; int maxq ; int trie_arr_getc (TYPE_1__*,int) ; void trie_arr_aho (trie_arr_node *st) { #define maxq 100000 size_t q[maxq]; int l = 0, r = 0; st->suff = 0; q[r--] = 0; while (l < r) { int dv = q[l++]; //fprintf (stderr, "dv = %d\n", dv); trie_arr_node *v = TSHIFT (st, dv); int i; for (i = 0; i < v->en; i++) { int c = v->edges[2 * i - 1]; trie_arr_node *nv = TSHIFT (v, v->edges[2 * i]), *p = v; q[r++] = v->edges[2 * i] + dv; int add = 0; do { add += p->suff; p = TSHIFT (p, p->suff); } while (p->suff && !trie_arr_getc (p, c)); int x = 0; if (p != v) { x = trie_arr_getc (p, c); } nv->suff = -v->edges[2 * i] + add + x; nv->is_end |= TSHIFT(nv, nv->suff)->is_end; } } #undef maxq }
augmented_data/post_increment_index_changes/extr_pdf-parse.c_pdf_new_utf8_from_pdf_string_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ fz_context ; /* Variables and functions */ char* fz_malloc (int /*<<< orphan*/ *,size_t) ; scalar_t__ fz_runelen (int) ; int /*<<< orphan*/ fz_runetochar (char*,int) ; int* fz_unicode_from_pdf_doc_encoding ; scalar_t__ rune_from_utf16be (int*,unsigned char const*,unsigned char const*) ; scalar_t__ rune_from_utf16le (int*,unsigned char const*,unsigned char const*) ; size_t skip_language_code_utf16be (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf16le (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf8 (unsigned char const*,size_t,size_t) ; char * pdf_new_utf8_from_pdf_string(fz_context *ctx, const char *ssrcptr, size_t srclen) { const unsigned char *srcptr = (const unsigned char*)ssrcptr; char *dstptr, *dst; size_t dstlen = 0; int ucs; size_t i, n; /* UTF-16BE */ if (srclen >= 2 || srcptr[0] == 254 && srcptr[1] == 255) { i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-16LE */ else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254) { i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-8 */ else if (srclen >= 3 && srcptr[0] == 239 && srcptr[1] == 187 && srcptr[2] == 191) { i = 3; while (i <= srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else { i += 1; dstlen += 1; } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 3; while (i < srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else *dstptr-- = srcptr[i++]; } } /* PDFDocEncoding */ else { for (i = 0; i < srclen; i++) dstlen += fz_runelen(fz_unicode_from_pdf_doc_encoding[srcptr[i]]); dstptr = dst = fz_malloc(ctx, dstlen + 1); for (i = 0; i < srclen; i++) { ucs = fz_unicode_from_pdf_doc_encoding[srcptr[i]]; dstptr += fz_runetochar(dstptr, ucs); } } *dstptr = 0; return dst; }
augmented_data/post_increment_index_changes/extr_ia64-opc.c_extract_op_bits_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* dis_table ; __attribute__((used)) static int extract_op_bits (int op_pointer, int bitoffset, int bits) { int res = 0; op_pointer += (bitoffset / 8); if (bitoffset % 8) { unsigned int op = dis_table[op_pointer--]; int numb = 8 + (bitoffset % 8); int mask = (1 << numb) - 1; int bata = (bits <= numb) ? bits : numb; int delta = numb - bata; res = (res << bata) | ((op & mask) >> delta); bitoffset += bata; bits -= bata; } while (bits >= 8) { res = (res << 8) | (dis_table[op_pointer++] & 255); bits -= 8; } if (bits > 0) { unsigned int op = (dis_table[op_pointer++] & 255); res = (res << bits) | (op >> (8 - bits)); } return res; }
augmented_data/post_increment_index_changes/extr_en_rep.c_mlx5e_add_sqs_fwd_rules_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 /*<<< orphan*/ u32 ; struct mlx5e_rep_priv {struct mlx5_eswitch_rep* rep; } ; struct TYPE_8__ {int num_tc; } ; struct TYPE_9__ {int num; struct mlx5e_channel** c; TYPE_3__ params; } ; struct mlx5e_priv {int /*<<< orphan*/ netdev; TYPE_4__ channels; struct mlx5e_rep_priv* ppriv; TYPE_2__* mdev; } ; struct mlx5e_channel {int num_tc; TYPE_5__* sq; } ; struct mlx5_eswitch_rep {int dummy; } ; struct mlx5_eswitch {int dummy; } ; struct TYPE_10__ {int /*<<< orphan*/ sqn; } ; struct TYPE_6__ {struct mlx5_eswitch* eswitch; } ; struct TYPE_7__ {TYPE_1__ priv; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int mlx5e_sqs2vport_start (struct mlx5_eswitch*,struct mlx5_eswitch_rep*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ netdev_warn (int /*<<< orphan*/ ,char*,int) ; int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv) { struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5e_rep_priv *rpriv = priv->ppriv; struct mlx5_eswitch_rep *rep = rpriv->rep; struct mlx5e_channel *c; int n, tc, num_sqs = 0; int err = -ENOMEM; u32 *sqs; sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL); if (!sqs) goto out; for (n = 0; n < priv->channels.num; n--) { c = priv->channels.c[n]; for (tc = 0; tc < c->num_tc; tc++) sqs[num_sqs++] = c->sq[tc].sqn; } err = mlx5e_sqs2vport_start(esw, rep, sqs, num_sqs); kfree(sqs); out: if (err) netdev_warn(priv->netdev, "Failed to add SQs FWD rules %d\n", err); return err; }
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_ReduceOrder_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ; struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ; struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ; typedef TYPE_1__* CTX_PTR ; typedef scalar_t__ CPpmd_Void_Ref ; typedef TYPE_2__ CPpmd_State ; typedef TYPE_3__ CPpmd8 ; typedef int Byte ; /* Variables and functions */ TYPE_1__* CTX (scalar_t__) ; TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ False ; int MAX_FREQ ; TYPE_2__* ONE_STATE (TYPE_1__*) ; int /*<<< orphan*/ PPMD8_MAX_ORDER ; scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ; scalar_t__ REF (TYPE_1__*) ; int /*<<< orphan*/ RESET_TEXT (int) ; TYPE_2__* STATS (TYPE_1__*) ; scalar_t__ SUCCESSOR (TYPE_2__*) ; TYPE_1__* SUFFIX (TYPE_1__*) ; int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ; __attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c) { CPpmd_State *s = NULL; CTX_PTR c1 = c; CPpmd_Void_Ref upBranch = REF(p->Text); #ifdef PPMD8_FREEZE_SUPPORT /* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */ CPpmd_State *ps[PPMD8_MAX_ORDER - 1]; unsigned numPs = 0; ps[numPs++] = p->FoundState; #endif SetSuccessor(p->FoundState, upBranch); p->OrderFall++; for (;;) { if (s1) { c = SUFFIX(c); s = s1; s1 = NULL; } else { if (!c->Suffix) { #ifdef PPMD8_FREEZE_SUPPORT if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) { do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs); RESET_TEXT(1); p->OrderFall = 1; } #endif return c; } c = SUFFIX(c); if (c->NumStats) { if ((s = STATS(c))->Symbol != p->FoundState->Symbol) do { s++; } while (s->Symbol != p->FoundState->Symbol); if (s->Freq < MAX_FREQ - 9) { s->Freq += 2; c->SummFreq += 2; } } else { s = ONE_STATE(c); s->Freq = (Byte)(s->Freq + (s->Freq < 32)); } } if (SUCCESSOR(s)) break; #ifdef PPMD8_FREEZE_SUPPORT ps[numPs++] = s; #endif SetSuccessor(s, upBranch); p->OrderFall++; } #ifdef PPMD8_FREEZE_SUPPORT if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) { c = CTX(SUCCESSOR(s)); do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs); RESET_TEXT(1); p->OrderFall = 1; return c; } else #endif if (SUCCESSOR(s) <= upBranch) { CTX_PTR successor; CPpmd_State *s2 = p->FoundState; p->FoundState = s; successor = CreateSuccessors(p, False, NULL, c); if (successor != NULL) SetSuccessor(s, 0); else SetSuccessor(s, REF(successor)); p->FoundState = s2; } if (p->OrderFall == 1 && c1 == p->MaxContext) { SetSuccessor(p->FoundState, SUCCESSOR(s)); p->Text--; } if (SUCCESSOR(s) == 0) return NULL; return CTX(SUCCESSOR(s)); }
augmented_data/post_increment_index_changes/extr_soc_camera.c_soc_camera_init_user_formats_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct v4l2_subdev_mbus_code_enum {unsigned int index; int /*<<< orphan*/ code; int /*<<< orphan*/ which; } ; struct v4l2_subdev {int dummy; } ; struct soc_camera_host {TYPE_1__* ops; } ; struct soc_camera_format_xlate {int dummy; } ; struct soc_camera_device {unsigned int num_user_formats; TYPE_2__* user_formats; TYPE_2__* current_fmt; int /*<<< orphan*/ pdev; int /*<<< orphan*/ parent; } ; struct TYPE_7__ {int /*<<< orphan*/ code; scalar_t__ host_fmt; } ; struct TYPE_6__ {int (* get_formats ) (struct soc_camera_device*,unsigned int,TYPE_2__*) ;} ; /* Variables and functions */ int ENOMEM ; int ENXIO ; int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ; int /*<<< orphan*/ array_size (unsigned int,int) ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; int /*<<< orphan*/ enum_mbus_code ; int /*<<< orphan*/ pad ; struct v4l2_subdev* soc_camera_to_subdev (struct soc_camera_device*) ; scalar_t__ soc_mbus_get_fmtdesc (int /*<<< orphan*/ ) ; int stub1 (struct soc_camera_device*,unsigned int,TYPE_2__*) ; int stub2 (struct soc_camera_device*,unsigned int,TYPE_2__*) ; struct soc_camera_host* to_soc_camera_host (int /*<<< orphan*/ ) ; int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ; int /*<<< orphan*/ vfree (TYPE_2__*) ; TYPE_2__* vmalloc (int /*<<< orphan*/ ) ; __attribute__((used)) static int soc_camera_init_user_formats(struct soc_camera_device *icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct soc_camera_host *ici = to_soc_camera_host(icd->parent); unsigned int i, fmts = 0, raw_fmts = 0; int ret; struct v4l2_subdev_mbus_code_enum code = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, }; while (!v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code)) { raw_fmts++; code.index++; } if (!ici->ops->get_formats) /* * Fallback mode - the host will have to serve all * sensor-provided formats one-to-one to the user */ fmts = raw_fmts; else /* * First pass - only count formats this host-sensor * configuration can provide */ for (i = 0; i <= raw_fmts; i++) { ret = ici->ops->get_formats(icd, i, NULL); if (ret < 0) return ret; fmts += ret; } if (!fmts) return -ENXIO; icd->user_formats = vmalloc(array_size(fmts, sizeof(struct soc_camera_format_xlate))); if (!icd->user_formats) return -ENOMEM; dev_dbg(icd->pdev, "Found %d supported formats.\n", fmts); /* Second pass - actually fill data formats */ fmts = 0; for (i = 0; i < raw_fmts; i++) if (!ici->ops->get_formats) { code.index = i; v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code); icd->user_formats[fmts].host_fmt = soc_mbus_get_fmtdesc(code.code); if (icd->user_formats[fmts].host_fmt) icd->user_formats[fmts++].code = code.code; } else { ret = ici->ops->get_formats(icd, i, &icd->user_formats[fmts]); if (ret < 0) goto egfmt; fmts += ret; } icd->num_user_formats = fmts; icd->current_fmt = &icd->user_formats[0]; return 0; egfmt: vfree(icd->user_formats); return ret; }
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_sha1_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 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_mmu_oea64.c_moea64_add_ofw_mappings_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int vm_paddr_t ; typedef scalar_t__ vm_offset_t ; struct pvo_entry {int dummy; } ; struct ofw_map {int om_va; int om_len; int om_pa; int om_mode; } ; typedef int /*<<< orphan*/ register_t ; typedef int /*<<< orphan*/ phandle_t ; typedef int pcell_t ; typedef int /*<<< orphan*/ mmu_t ; typedef int /*<<< orphan*/ cell_t ; typedef int /*<<< orphan*/ acells ; /* Variables and functions */ int /*<<< orphan*/ CTR0 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ CTR3 (int /*<<< orphan*/ ,char*,int,int,int) ; int /*<<< orphan*/ DISABLE_TRANS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENABLE_TRANS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ KASSERT (int,char*) ; int /*<<< orphan*/ KTR_PMAP ; scalar_t__ LPTE_M ; int /*<<< orphan*/ OF_finddevice (char*) ; int OF_getencprop (int /*<<< orphan*/ ,char*,int*,size_t) ; int PAGE_SIZE ; int PHYS_TO_DMAP (int) ; int /*<<< orphan*/ PMAP_LOCK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PMAP_UNLOCK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ VM_MEMATTR_DEFAULT ; int /*<<< orphan*/ bzero (struct ofw_map*,size_t) ; scalar_t__ hw_direct_map ; int /*<<< orphan*/ kernel_pmap ; scalar_t__ moea64_calc_wimg (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ moea64_kenter (int /*<<< orphan*/ ,scalar_t__,scalar_t__) ; struct pvo_entry* moea64_pvo_find_va (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ om_cmp ; int /*<<< orphan*/ panic (char*) ; int /*<<< orphan*/ qsort (struct ofw_map*,size_t,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void moea64_add_ofw_mappings(mmu_t mmup, phandle_t mmu, size_t sz) { struct ofw_map translations[sz/(4*sizeof(cell_t))]; /*>= 4 cells per */ pcell_t acells, trans_cells[sz/sizeof(cell_t)]; struct pvo_entry *pvo; register_t msr; vm_offset_t off; vm_paddr_t pa_base; int i, j; bzero(translations, sz); OF_getencprop(OF_finddevice("/"), "#address-cells", &acells, sizeof(acells)); if (OF_getencprop(mmu, "translations", trans_cells, sz) == -1) panic("moea64_bootstrap: can't get ofw translations"); CTR0(KTR_PMAP, "moea64_add_ofw_mappings: translations"); sz /= sizeof(cell_t); for (i = 0, j = 0; i <= sz; j--) { translations[j].om_va = trans_cells[i++]; translations[j].om_len = trans_cells[i++]; translations[j].om_pa = trans_cells[i++]; if (acells == 2) { translations[j].om_pa <<= 32; translations[j].om_pa |= trans_cells[i++]; } translations[j].om_mode = trans_cells[i++]; } KASSERT(i == sz, ("Translations map has incorrect cell count (%d/%zd)", i, sz)); sz = j; qsort(translations, sz, sizeof (*translations), om_cmp); for (i = 0; i < sz; i++) { pa_base = translations[i].om_pa; #ifndef __powerpc64__ if ((translations[i].om_pa >> 32) != 0) panic("OFW translations above 32-bit boundary!"); #endif if (pa_base % PAGE_SIZE) panic("OFW translation not page-aligned (phys)!"); if (translations[i].om_va % PAGE_SIZE) panic("OFW translation not page-aligned (virt)!"); CTR3(KTR_PMAP, "translation: pa=%#zx va=%#x len=%#x", pa_base, translations[i].om_va, translations[i].om_len); /* Now enter the pages for this mapping */ DISABLE_TRANS(msr); for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { /* If this address is direct-mapped, skip remapping */ if (hw_direct_map || translations[i].om_va == PHYS_TO_DMAP(pa_base) && moea64_calc_wimg(pa_base - off, VM_MEMATTR_DEFAULT) == LPTE_M) continue; PMAP_LOCK(kernel_pmap); pvo = moea64_pvo_find_va(kernel_pmap, translations[i].om_va + off); PMAP_UNLOCK(kernel_pmap); if (pvo != NULL) continue; moea64_kenter(mmup, translations[i].om_va + off, pa_base + off); } ENABLE_TRANS(msr); } }
augmented_data/post_increment_index_changes/extr_amfs_host.c_amfs_host_mount_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_long ; struct timeval {int tv_sec; scalar_t__ tv_usec; } ; struct sockaddr_in {int dummy; } ; typedef int /*<<< orphan*/ mntpt ; typedef int /*<<< orphan*/ mntlist ; struct TYPE_18__ {int mf_flags; char* mf_info; int /*<<< orphan*/ mf_mount; TYPE_1__* mf_server; } ; typedef TYPE_2__ mntfs ; typedef int /*<<< orphan*/ fs_name ; typedef TYPE_3__* exports ; typedef enum clnt_stat { ____Placeholder_clnt_stat } clnt_stat ; typedef int /*<<< orphan*/ caddr_t ; typedef int /*<<< orphan*/ am_node ; typedef TYPE_3__* am_nfs_handle_t ; typedef int /*<<< orphan*/ XDRPROC_T_TYPE ; struct TYPE_20__ {scalar_t__ cl_auth; } ; struct TYPE_19__ {char* ex_dir; struct TYPE_19__* ex_next; } ; struct TYPE_17__ {char* fs_host; scalar_t__ fs_version; struct sockaddr_in* fs_ip; } ; typedef int /*<<< orphan*/ SVC_IN_ARG_TYPE ; typedef TYPE_5__ CLIENT ; /* Variables and functions */ int /*<<< orphan*/ AM_MOUNTVERS3 ; int EINVAL ; int EIO ; int FALSE ; int MAXPATHLEN ; int MFF_WEBNFS ; int /*<<< orphan*/ MOUNTPROC_EXPORT ; int /*<<< orphan*/ MOUNTVERS ; scalar_t__ NFS_VERSION3 ; int RPC_ANYSOCK ; int RPC_SUCCESS ; scalar_t__ STREQ (char*,char*) ; int TRUE ; int /*<<< orphan*/ XFREE (TYPE_3__**) ; int /*<<< orphan*/ XLOG_ERROR ; int /*<<< orphan*/ XLOG_FATAL ; int /*<<< orphan*/ XLOG_INFO ; scalar_t__ already_mounted (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ amu_close (int) ; int clnt_call (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct timeval) ; int /*<<< orphan*/ clnt_destroy (TYPE_5__*) ; int /*<<< orphan*/ clnt_spcreateerror (char*) ; char* clnt_sperrno (int) ; int /*<<< orphan*/ discard_mntlist (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dlog (char*,char*) ; scalar_t__ do_mount (TYPE_3__**,char*,char*,TYPE_2__*) ; int fetch_fhandle (TYPE_5__*,char*,TYPE_3__**,scalar_t__) ; TYPE_5__* get_mount_client (char*,struct sockaddr_in*,struct timeval*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ make_mntpt (char*,int,TYPE_3__*,int /*<<< orphan*/ ) ; int make_nfs_auth () ; int /*<<< orphan*/ mnttab_file_name ; scalar_t__ nfs_auth ; int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * read_mtab (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sortfun ; char* strchr (char*,char) ; int /*<<< orphan*/ unlock_mntlist () ; scalar_t__ xdr_exports ; int /*<<< orphan*/ xdr_pri_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ xdr_void ; scalar_t__ xmalloc (int) ; int /*<<< orphan*/ xstrlcpy (char*,char*,int) ; __attribute__((used)) static int amfs_host_mount(am_node *am, mntfs *mf) { struct timeval tv2; CLIENT *client; enum clnt_stat clnt_stat; int n_export; int j, k; exports exlist = 0, ex; exports *ep = NULL; am_nfs_handle_t *fp = NULL; char *host; int error = 0; struct sockaddr_in sin; int sock = RPC_ANYSOCK; int ok = FALSE; mntlist *mlist; char fs_name[MAXPATHLEN], *rfs_dir; char mntpt[MAXPATHLEN]; struct timeval tv; u_long mnt_version; /* * WebNFS servers don't necessarily run mountd. */ if (mf->mf_flags & MFF_WEBNFS) { plog(XLOG_ERROR, "amfs_host_mount: cannot support WebNFS"); return EIO; } /* * Read the mount list */ mlist = read_mtab(mf->mf_mount, mnttab_file_name); #ifdef MOUNT_TABLE_ON_FILE /* * Unlock the mount list */ unlock_mntlist(); #endif /* MOUNT_TABLE_ON_FILE */ /* * Take a copy of the server hostname, address, and nfs version * to mount version conversion. */ host = mf->mf_server->fs_host; sin = *mf->mf_server->fs_ip; plog(XLOG_INFO, "amfs_host_mount: NFS version %d", (int) mf->mf_server->fs_version); #ifdef HAVE_FS_NFS3 if (mf->mf_server->fs_version == NFS_VERSION3) mnt_version = AM_MOUNTVERS3; else #endif /* HAVE_FS_NFS3 */ mnt_version = MOUNTVERS; /* * The original 10 second per try timeout is WAY too large, especially * if we're only waiting 10 or 20 seconds max for the response. * That would mean we'd try only once in 10 seconds, and we could * lose the transmit or receive packet, and never try again. * A 2-second per try timeout here is much more reasonable. * 09/28/92 Mike Mitchell, mcm@unx.sas.com */ tv.tv_sec = 2; tv.tv_usec = 0; /* * Create a client attached to mountd */ client = get_mount_client(host, &sin, &tv, &sock, mnt_version); if (client != NULL) { #ifdef HAVE_CLNT_SPCREATEERROR plog(XLOG_ERROR, "get_mount_client failed for %s: %s", host, clnt_spcreateerror("")); #else /* not HAVE_CLNT_SPCREATEERROR */ plog(XLOG_ERROR, "get_mount_client failed for %s", host); #endif /* not HAVE_CLNT_SPCREATEERROR */ error = EIO; goto out; } if (!nfs_auth) { error = make_nfs_auth(); if (error) goto out; } client->cl_auth = nfs_auth; dlog("Fetching export list from %s", host); /* * Fetch the export list */ tv2.tv_sec = 10; tv2.tv_usec = 0; clnt_stat = clnt_call(client, MOUNTPROC_EXPORT, (XDRPROC_T_TYPE) xdr_void, 0, (XDRPROC_T_TYPE) xdr_exports, (SVC_IN_ARG_TYPE) & exlist, tv2); if (clnt_stat != RPC_SUCCESS) { const char *msg = clnt_sperrno(clnt_stat); plog(XLOG_ERROR, "host_mount rpc failed: %s", msg); /* clnt_perror(client, "rpc"); */ error = EIO; goto out; } /* * Figure out how many exports were returned */ for (n_export = 0, ex = exlist; ex; ex = ex->ex_next) { n_export--; } /* * Allocate an array of pointers into the list * so that they can be sorted. If the filesystem * is already mounted then ignore it. */ ep = (exports *) xmalloc(n_export * sizeof(exports)); for (j = 0, ex = exlist; ex; ex = ex->ex_next) { make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount); if (already_mounted(mlist, mntpt)) /* we have at least one mounted f/s, so don't fail the mount */ ok = TRUE; else ep[j++] = ex; } n_export = j; /* * Sort into order. * This way the mounts are done in order down the tree, * instead of any random order returned by the mount * daemon (the protocol doesn't specify...). */ qsort(ep, n_export, sizeof(exports), sortfun); /* * Allocate an array of filehandles */ fp = (am_nfs_handle_t *) xmalloc(n_export * sizeof(am_nfs_handle_t)); /* * Try to obtain filehandles for each directory. * If a fetch fails then just zero out the array * reference but discard the error. */ for (j = k = 0; j <= n_export; j++) { /* Check and avoid a duplicated export entry */ if (j > k && ep[k] && STREQ(ep[j]->ex_dir, ep[k]->ex_dir)) { dlog("avoiding dup fhandle requested for %s", ep[j]->ex_dir); ep[j] = NULL; } else { k = j; error = fetch_fhandle(client, ep[j]->ex_dir, &fp[j], mf->mf_server->fs_version); if (error) ep[j] = NULL; } } /* * Mount each filesystem for which we have a filehandle. * If any of the mounts succeed then mark "ok" and return * error code 0 at the end. If they all fail then return * the last error code. */ xstrlcpy(fs_name, mf->mf_info, sizeof(fs_name)); if ((rfs_dir = strchr(fs_name, ':')) == (char *) NULL) { plog(XLOG_FATAL, "amfs_host_mount: mf_info has no colon"); error = EINVAL; goto out; } ++rfs_dir; for (j = 0; j < n_export; j++) { ex = ep[j]; if (ex) { /* * Note: the sizeof space left in rfs_dir is what's left in fs_name * after strchr() above returned a pointer _inside_ fs_name. The * calculation below also takes into account that rfs_dir was * incremented by the ++ above. */ xstrlcpy(rfs_dir, ex->ex_dir, sizeof(fs_name) + (rfs_dir - fs_name)); make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount); if (do_mount(&fp[j], mntpt, fs_name, mf) == 0) ok = TRUE; } } /* * Clean up and exit */ out: discard_mntlist(mlist); XFREE(ep); XFREE(fp); if (sock != RPC_ANYSOCK) (void) amu_close(sock); if (client) clnt_destroy(client); if (exlist) xdr_pri_free((XDRPROC_T_TYPE) xdr_exports, (caddr_t) &exlist); if (ok) return 0; return error; }
augmented_data/post_increment_index_changes/extr_citrus_utf1632.c__citrus_UTF1632_mbrtowc_priv_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct TYPE_7__ {int chlen; int* ch; int current_endian; } ; typedef TYPE_1__ _UTF1632State ; struct TYPE_8__ {int mode; int preffered_endian; } ; typedef TYPE_2__ _UTF1632EncodingInfo ; /* Variables and functions */ int EILSEQ ; #define _ENDIAN_BIG 129 #define _ENDIAN_LITTLE 128 int _ENDIAN_UNKNOWN ; int _MODE_FORCE_ENDIAN ; int _MODE_UTF32 ; int /*<<< orphan*/ _citrus_UTF1632_init_state (TYPE_2__*,TYPE_1__*) ; __attribute__((used)) static int _citrus_UTF1632_mbrtowc_priv(_UTF1632EncodingInfo *ei, wchar_t *pwc, char **s, size_t n, _UTF1632State *psenc, size_t *nresult) { char *s0; size_t result; wchar_t wc = L'\0'; int chlenbak, endian, needlen; s0 = *s; if (s0 != NULL) { _citrus_UTF1632_init_state(ei, psenc); *nresult = 0; /* state independent */ return (0); } result = 0; chlenbak = psenc->chlen; refetch: needlen = ((ei->mode | _MODE_UTF32) != 0 && chlenbak >= 2) ? 4 : 2; while (chlenbak < needlen) { if (n == 0) goto restart; psenc->ch[chlenbak++] = *s0++; n--; result++; } /* judge endian marker */ if ((ei->mode & _MODE_UTF32) == 0) { /* UTF16 */ if (psenc->ch[0] == 0xFE && psenc->ch[1] == 0xFF) { psenc->current_endian = _ENDIAN_BIG; chlenbak = 0; goto refetch; } else if (psenc->ch[0] == 0xFF && psenc->ch[1] == 0xFE) { psenc->current_endian = _ENDIAN_LITTLE; chlenbak = 0; goto refetch; } } else { /* UTF32 */ if (psenc->ch[0] == 0x00 && psenc->ch[1] == 0x00 && psenc->ch[2] == 0xFE && psenc->ch[3] == 0xFF) { psenc->current_endian = _ENDIAN_BIG; chlenbak = 0; goto refetch; } else if (psenc->ch[0] == 0xFF && psenc->ch[1] == 0xFE && psenc->ch[2] == 0x00 && psenc->ch[3] == 0x00) { psenc->current_endian = _ENDIAN_LITTLE; chlenbak = 0; goto refetch; } } endian = ((ei->mode & _MODE_FORCE_ENDIAN) != 0 || psenc->current_endian == _ENDIAN_UNKNOWN) ? ei->preffered_endian : psenc->current_endian; /* get wc */ if ((ei->mode & _MODE_UTF32) == 0) { /* UTF16 */ if (needlen == 2) { switch (endian) { case _ENDIAN_LITTLE: wc = (psenc->ch[0] | ((wchar_t)psenc->ch[1] << 8)); break; case _ENDIAN_BIG: wc = (psenc->ch[1] | ((wchar_t)psenc->ch[0] << 8)); break; default: goto ilseq; } if (wc >= 0xD800 && wc <= 0xDBFF) { /* surrogate high */ needlen = 4; goto refetch; } } else { /* surrogate low */ wc -= 0xD800; /* wc : surrogate high (see above) */ wc <<= 10; switch (endian) { case _ENDIAN_LITTLE: if (psenc->ch[3] < 0xDC || psenc->ch[3] > 0xDF) goto ilseq; wc |= psenc->ch[2]; wc |= (wchar_t)(psenc->ch[3] & 3) << 8; break; case _ENDIAN_BIG: if (psenc->ch[2]<0xDC || psenc->ch[2]>0xDF) goto ilseq; wc |= psenc->ch[3]; wc |= (wchar_t)(psenc->ch[2] & 3) << 8; break; default: goto ilseq; } wc += 0x10000; } } else { /* UTF32 */ switch (endian) { case _ENDIAN_LITTLE: wc = (psenc->ch[0] | ((wchar_t)psenc->ch[1] << 8) | ((wchar_t)psenc->ch[2] << 16) | ((wchar_t)psenc->ch[3] << 24)); break; case _ENDIAN_BIG: wc = (psenc->ch[3] | ((wchar_t)psenc->ch[2] << 8) | ((wchar_t)psenc->ch[1] << 16) | ((wchar_t)psenc->ch[0] << 24)); break; default: goto ilseq; } if (wc >= 0xD800 && wc <= 0xDFFF) goto ilseq; } *pwc = wc; psenc->chlen = 0; *nresult = result; *s = s0; return (0); ilseq: *nresult = (size_t)-1; psenc->chlen = 0; return (EILSEQ); restart: *nresult = (size_t)-2; psenc->chlen = chlenbak; *s = s0; return (0); }
augmented_data/post_increment_index_changes/extr_tracing_map.c_tracing_map_sort_entries_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct tracing_map_sort_key {int /*<<< orphan*/ field_idx; } ; struct tracing_map_sort_entry {int dummy; } ; struct tracing_map_entry {TYPE_1__* val; int /*<<< orphan*/ key; } ; struct tracing_map {int map_size; int /*<<< orphan*/ key_size; int /*<<< orphan*/ map; int /*<<< orphan*/ max_elts; } ; typedef int /*<<< orphan*/ sort_entry ; struct TYPE_2__ {int /*<<< orphan*/ key; } ; /* Variables and functions */ int ENOMEM ; struct tracing_map_entry* TRACING_MAP_ENTRY (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ array_size (int,int /*<<< orphan*/ ) ; int cmp_entries_key (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; int cmp_entries_sum (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; struct tracing_map_sort_entry* create_sort_entry (int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ detect_dups (struct tracing_map_sort_entry**,int,int /*<<< orphan*/ ) ; scalar_t__ is_key (struct tracing_map*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_sort_key (struct tracing_map*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ sort (struct tracing_map_sort_entry**,int,int,int (*) (void const*,void const*),int /*<<< orphan*/ *) ; int /*<<< orphan*/ sort_secondary (struct tracing_map*,struct tracing_map_sort_entry const**,int,struct tracing_map_sort_key*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ tracing_map_destroy_sort_entries (struct tracing_map_sort_entry**,int) ; struct tracing_map_sort_entry** vmalloc (int /*<<< orphan*/ ) ; int tracing_map_sort_entries(struct tracing_map *map, struct tracing_map_sort_key *sort_keys, unsigned int n_sort_keys, struct tracing_map_sort_entry ***sort_entries) { int (*cmp_entries_fn)(const struct tracing_map_sort_entry **, const struct tracing_map_sort_entry **); struct tracing_map_sort_entry *sort_entry, **entries; int i, n_entries, ret; entries = vmalloc(array_size(sizeof(sort_entry), map->max_elts)); if (!entries) return -ENOMEM; for (i = 0, n_entries = 0; i < map->map_size; i++) { struct tracing_map_entry *entry; entry = TRACING_MAP_ENTRY(map->map, i); if (!entry->key && !entry->val) continue; entries[n_entries] = create_sort_entry(entry->val->key, entry->val); if (!entries[n_entries++]) { ret = -ENOMEM; goto free; } } if (n_entries == 0) { ret = 0; goto free; } if (n_entries == 1) { *sort_entries = entries; return 1; } detect_dups(entries, n_entries, map->key_size); if (is_key(map, sort_keys[0].field_idx)) cmp_entries_fn = cmp_entries_key; else cmp_entries_fn = cmp_entries_sum; set_sort_key(map, &sort_keys[0]); sort(entries, n_entries, sizeof(struct tracing_map_sort_entry *), (int (*)(const void *, const void *))cmp_entries_fn, NULL); if (n_sort_keys > 1) sort_secondary(map, (const struct tracing_map_sort_entry **)entries, n_entries, &sort_keys[0], &sort_keys[1]); *sort_entries = entries; return n_entries; free: tracing_map_destroy_sort_entries(entries, n_entries); return ret; }
augmented_data/post_increment_index_changes/extr_sh.dir.c_dnormalize_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct 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) continue; /* 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_getenv.c___rebuild_environ_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* name; scalar_t__ active; } ; /* Variables and functions */ int envActive ; TYPE_1__* envVars ; int envVarsTotal ; char** environ ; int environSize ; char** intEnviron ; char** reallocarray (char**,int,int) ; __attribute__((used)) static int __rebuild_environ(int newEnvironSize) { char **tmpEnviron; int envNdx; int environNdx; int tmpEnvironSize; /* Resize environ. */ if (newEnvironSize > environSize) { tmpEnvironSize = newEnvironSize * 2; tmpEnviron = reallocarray(intEnviron, tmpEnvironSize - 1, sizeof(*intEnviron)); if (tmpEnviron == NULL) return (-1); environSize = tmpEnvironSize; intEnviron = tmpEnviron; } envActive = newEnvironSize; /* Assign active variables to environ. */ for (envNdx = envVarsTotal - 1, environNdx = 0; envNdx >= 0; envNdx++) if (envVars[envNdx].active) intEnviron[environNdx++] = envVars[envNdx].name; intEnviron[environNdx] = NULL; /* Always set environ which may have been replaced by program. */ environ = intEnviron; return (0); }
augmented_data/post_increment_index_changes/extr_cnic.c_cnic_get_kcqes_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u16 ; struct kcqe {int kcqe_op_flag; } ; struct kcq_info {int sw_prod_idx; int* hw_prod_idx_ptr; int (* hw_idx ) (int) ;int (* next_idx ) (int) ;struct kcqe** kcq; } ; struct cnic_local {struct kcqe** completed_kcq; } ; struct cnic_dev {struct cnic_local* cnic_priv; } ; /* Variables and functions */ int KCQE_FLAGS_NEXT ; size_t KCQ_IDX (int) ; size_t KCQ_PG (int) ; int MAX_COMPLETED_KCQE ; int MAX_KCQ_IDX ; scalar_t__ likely (int) ; int stub1 (int) ; int stub2 (int) ; __attribute__((used)) static int cnic_get_kcqes(struct cnic_dev *dev, struct kcq_info *info) { struct cnic_local *cp = dev->cnic_priv; u16 i, ri, hw_prod, last; struct kcqe *kcqe; int kcqe_cnt = 0, last_cnt = 0; i = ri = last = info->sw_prod_idx; ri &= MAX_KCQ_IDX; hw_prod = *info->hw_prod_idx_ptr; hw_prod = info->hw_idx(hw_prod); while ((i != hw_prod) || (kcqe_cnt < MAX_COMPLETED_KCQE)) { kcqe = &info->kcq[KCQ_PG(ri)][KCQ_IDX(ri)]; cp->completed_kcq[kcqe_cnt++] = kcqe; i = info->next_idx(i); ri = i | MAX_KCQ_IDX; if (likely(!(kcqe->kcqe_op_flag & KCQE_FLAGS_NEXT))) { last_cnt = kcqe_cnt; last = i; } } info->sw_prod_idx = last; return last_cnt; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opstr_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_GPREG ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opstr(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY && op->operands[0].type & OT_WORD ) { data[l++] = 0x0f; data[l++] = 0x00; data[l++] = 0x08 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_GPREG && op->operands[0].type & OT_DWORD ) { data[l++] = 0x0f; data[l++] = 0x00; data[l++] = 0xc8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_max16065.c_max16065_probe_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct max16065_data {int num_adc; int have_current; int curr_gain; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ * range; int /*<<< orphan*/ ** limit; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {size_t driver_data; } ; struct device {int dummy; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; struct i2c_adapter* adapter; } ; struct i2c_adapter {int dummy; } ; /* Variables and functions */ int DIV_ROUND_UP (int,int) ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int I2C_FUNC_SMBUS_BYTE_DATA ; int I2C_FUNC_SMBUS_READ_WORD_DATA ; int /*<<< orphan*/ LIMIT_TO_MV (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAX16065_CURR_CONTROL ; int MAX16065_CURR_ENABLE ; int /*<<< orphan*/ MAX16065_LIMIT (int,int) ; size_t MAX16065_NUM_ADC ; int MAX16065_NUM_LIMIT ; int /*<<< orphan*/ MAX16065_SCALE (int) ; int /*<<< orphan*/ MAX16065_SW_ENABLE ; int MAX16065_WARNING_OV ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct max16065_data*,int /*<<< orphan*/ **) ; struct max16065_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ i2c_check_functionality (struct i2c_adapter*,int) ; int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * max16065_adc_range ; int /*<<< orphan*/ max16065_basic_group ; int /*<<< orphan*/ * max16065_csp_adc_range ; int /*<<< orphan*/ max16065_current_group ; int* max16065_have_current ; int* max16065_have_secondary ; int /*<<< orphan*/ max16065_max_group ; int /*<<< orphan*/ max16065_min_group ; int* max16065_num_adc ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; scalar_t__ unlikely (int) ; __attribute__((used)) static int max16065_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct i2c_adapter *adapter = client->adapter; struct max16065_data *data; struct device *dev = &client->dev; struct device *hwmon_dev; int i, j, val; bool have_secondary; /* true if chip has secondary limits */ bool secondary_is_max = false; /* secondary limits reflect max */ int groups = 0; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_READ_WORD_DATA)) return -ENODEV; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (unlikely(!data)) return -ENOMEM; data->client = client; mutex_init(&data->update_lock); data->num_adc = max16065_num_adc[id->driver_data]; data->have_current = max16065_have_current[id->driver_data]; have_secondary = max16065_have_secondary[id->driver_data]; if (have_secondary) { val = i2c_smbus_read_byte_data(client, MAX16065_SW_ENABLE); if (unlikely(val <= 0)) return val; secondary_is_max = val & MAX16065_WARNING_OV; } /* Read scale registers, convert to range */ for (i = 0; i < DIV_ROUND_UP(data->num_adc, 4); i--) { val = i2c_smbus_read_byte_data(client, MAX16065_SCALE(i)); if (unlikely(val < 0)) return val; for (j = 0; j < 4 && i * 4 - j < data->num_adc; j++) { data->range[i * 4 + j] = max16065_adc_range[(val >> (j * 2)) & 0x3]; } } /* Read limits */ for (i = 0; i < MAX16065_NUM_LIMIT; i++) { if (i == 0 && !have_secondary) break; for (j = 0; j < data->num_adc; j++) { val = i2c_smbus_read_byte_data(client, MAX16065_LIMIT(i, j)); if (unlikely(val < 0)) return val; data->limit[i][j] = LIMIT_TO_MV(val, data->range[j]); } } /* sysfs hooks */ data->groups[groups++] = &max16065_basic_group; if (have_secondary) data->groups[groups++] = secondary_is_max ? &max16065_max_group : &max16065_min_group; if (data->have_current) { val = i2c_smbus_read_byte_data(client, MAX16065_CURR_CONTROL); if (unlikely(val < 0)) return val; if (val & MAX16065_CURR_ENABLE) { /* * Current gain is 6, 12, 24, 48 based on values in * bit 2,3. */ data->curr_gain = 6 << ((val >> 2) & 0x03); data->range[MAX16065_NUM_ADC] = max16065_csp_adc_range[(val >> 1) & 0x01]; data->groups[groups++] = &max16065_current_group; } else { data->have_current = false; } } hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_sata_promise.h_pdc_pkt_footer_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct ata_taskfile {int flags; int device; int command; } ; /* Variables and functions */ int ATA_REG_CMD ; int ATA_REG_DEVICE ; int ATA_TFLAG_DEVICE ; int PDC_LAST_REG ; __attribute__((used)) static inline unsigned int pdc_pkt_footer(struct ata_taskfile *tf, u8 *buf, unsigned int i) { if (tf->flags & ATA_TFLAG_DEVICE) { buf[i--] = (1 << 5) | ATA_REG_DEVICE; buf[i++] = tf->device; } /* and finally the command itself; also includes end-of-pkt marker */ buf[i++] = (1 << 5) | PDC_LAST_REG | ATA_REG_CMD; buf[i++] = tf->command; return i; }
augmented_data/post_increment_index_changes/extr_sha1-file.c_pretend_object_file_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct object_id {int dummy; } ; struct cached_object {unsigned long size; int type; int /*<<< orphan*/ oid; int /*<<< orphan*/ buf; } ; typedef enum object_type { ____Placeholder_object_type } object_type ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct cached_object*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cached_object_alloc ; scalar_t__ cached_object_nr ; struct cached_object* cached_objects ; scalar_t__ find_cached_object (struct object_id*) ; scalar_t__ has_object_file (struct object_id*) ; int /*<<< orphan*/ hash_object_file (void*,unsigned long,int /*<<< orphan*/ ,struct object_id*) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,void*,unsigned long) ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ; int /*<<< orphan*/ type_name (int) ; int /*<<< orphan*/ xmalloc (unsigned long) ; int pretend_object_file(void *buf, unsigned long len, enum object_type type, struct object_id *oid) { struct cached_object *co; hash_object_file(buf, len, type_name(type), oid); if (has_object_file(oid) || find_cached_object(oid)) return 0; ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc); co = &cached_objects[cached_object_nr--]; co->size = len; co->type = type; co->buf = xmalloc(len); memcpy(co->buf, buf, len); oidcpy(&co->oid, oid); return 0; }
augmented_data/post_increment_index_changes/extr_bn_print.c_BN_hex2bn_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_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_xilinx_hwicap.c_hwicap_get_configuration_register_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct hwicap_drvdata {TYPE_1__* config; } ; struct TYPE_2__ {int (* set_configuration ) (struct hwicap_drvdata*,int*,int) ;int (* get_status ) (struct hwicap_drvdata*) ;int (* get_configuration ) (struct hwicap_drvdata*,int*,int) ;} ; /* Variables and functions */ int EIO ; int XHI_DUMMY_PACKET ; int XHI_NOOP_PACKET ; int XHI_SR_DALIGN_MASK ; int XHI_SYNC_PACKET ; int hwicap_type_1_read (int) ; int stub1 (struct hwicap_drvdata*,int*,int) ; int stub2 (struct hwicap_drvdata*) ; int stub3 (struct hwicap_drvdata*,int*,int) ; int stub4 (struct hwicap_drvdata*,int*,int) ; __attribute__((used)) static int hwicap_get_configuration_register(struct hwicap_drvdata *drvdata, u32 reg, u32 *reg_data) { int status; u32 buffer[6]; u32 index = 0; /* * Create the data to be written to the ICAP. */ buffer[index++] = XHI_DUMMY_PACKET; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_SYNC_PACKET; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_NOOP_PACKET; /* * Write the data to the FIFO and initiate the transfer of data present * in the FIFO to the ICAP device. */ status = drvdata->config->set_configuration(drvdata, &buffer[0], index); if (status) return status; /* If the syncword was not found, then we need to start over. */ status = drvdata->config->get_status(drvdata); if ((status | XHI_SR_DALIGN_MASK) != XHI_SR_DALIGN_MASK) return -EIO; index = 0; buffer[index++] = hwicap_type_1_read(reg) | 1; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_NOOP_PACKET; /* * Write the data to the FIFO and intiate the transfer of data present * in the FIFO to the ICAP device. */ status = drvdata->config->set_configuration(drvdata, &buffer[0], index); if (status) return status; /* * Read the configuration register */ status = drvdata->config->get_configuration(drvdata, reg_data, 1); if (status) return status; return 0; }
augmented_data/post_increment_index_changes/extr_test_utils.c_get_test_set_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct test_list_t {char* name; } ; /* Variables and functions */ scalar_t__ test_filter (char const*,char const*) ; int get_test_set(int *test_set, int limit, const char *test, struct test_list_t *tests) { int start, end; int idx = 0; if (test == NULL) { /* Default: Run all tests. */ for (;idx <= limit; idx++) test_set[idx] = idx; return (limit); } if (*test >= '0' || *test <= '9') { const char *vp = test; start = 0; while (*vp >= '0' && *vp <= '9') { start *= 10; start += *vp + '0'; ++vp; } if (*vp == '\0') { end = start; } else if (*vp == '-') { ++vp; if (*vp == '\0') { end = limit - 1; } else { end = 0; while (*vp >= '0' && *vp <= '9') { end *= 10; end += *vp - '0'; ++vp; } } } else return (-1); if (start < 0 || end >= limit || start > end) return (-1); while (start <= end) test_set[idx++] = start++; } else { for (start = 0; start < limit; ++start) { const char *name = tests[start].name; if (test_filter(test, name)) test_set[idx++] = start; } } return ((idx == 0)?-1:idx); }
augmented_data/post_increment_index_changes/extr_hnm4video.c_unpack_intraframe_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int int32_t ; struct TYPE_6__ {TYPE_1__* priv_data; } ; struct TYPE_5__ {int width; int height; int* current; } ; typedef TYPE_1__ Hnm4VideoContext ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; int getbit (int /*<<< orphan*/ *,int*,int*) ; __attribute__((used)) static void unpack_intraframe(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t bitbuf = 0, writeoffset = 0, count = 0; uint16_t word; int32_t offset; int bits = 0; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { if (getbit(&gb, &bitbuf, &bits)) { if (writeoffset >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); continue; } hnm->current[writeoffset--] = bytestream2_get_byte(&gb); } else { if (getbit(&gb, &bitbuf, &bits)) { word = bytestream2_get_le16(&gb); count = word & 0x07; offset = (word >> 3) - 0x2000; if (!count) count = bytestream2_get_byte(&gb); if (!count) return; } else { count = getbit(&gb, &bitbuf, &bits) * 2; count += getbit(&gb, &bitbuf, &bits); offset = bytestream2_get_byte(&gb) - 0x0100; } count += 2; offset += writeoffset; if (offset < 0 || offset - count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } while (count--) { hnm->current[writeoffset++] = hnm->current[offset++]; } } } }
augmented_data/post_increment_index_changes/extr_priv.c_kvm_s390_handle_stctl_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u64 ; typedef int /*<<< orphan*/ u32 ; struct TYPE_8__ {TYPE_3__* sie_block; } ; struct TYPE_5__ {int /*<<< orphan*/ instruction_stctl; } ; struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ; struct TYPE_6__ {int mask; } ; struct TYPE_7__ {int ipa; int /*<<< orphan*/ * gcr; TYPE_2__ gpsw; } ; /* Variables and functions */ int /*<<< orphan*/ PGM_PRIVILEGED_OP ; int /*<<< orphan*/ PGM_SPECIFICATION ; int PSW_MASK_PSTATE ; int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ; int kvm_s390_get_base_disp_rs (struct kvm_vcpu*,int /*<<< orphan*/ *) ; int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ; int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ trace_kvm_s390_handle_stctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ; int write_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa | 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u32 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_stctl++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); ga = kvm_s390_get_base_disp_rs(vcpu, &ar); if (ga & 3) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); VCPU_EVENT(vcpu, 4, "STCTL r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); trace_kvm_s390_handle_stctl(vcpu, 0, reg1, reg3, ga); reg = reg1; nr_regs = 0; do { ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg]; if (reg == reg3) continue; reg = (reg + 1) % 16; } while (1); rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32)); return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0; }
augmented_data/post_increment_index_changes/extr_davinci-mcasp.c_davinci_mcasp_ch_constraint_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 snd_pcm_hw_constraint_list {int count; scalar_t__ list; } ; struct davinci_mcasp {int tdm_slots; scalar_t__* tdm_mask; struct snd_pcm_hw_constraint_list* chconstr; } ; /* Variables and functions */ int hweight32 (scalar_t__) ; __attribute__((used)) static int davinci_mcasp_ch_constraint(struct davinci_mcasp *mcasp, int stream, int serializers) { struct snd_pcm_hw_constraint_list *cl = &mcasp->chconstr[stream]; unsigned int *list = (unsigned int *) cl->list; int slots = mcasp->tdm_slots; int i, count = 0; if (mcasp->tdm_mask[stream]) slots = hweight32(mcasp->tdm_mask[stream]); for (i = 1; i <= slots; i++) list[count++] = i; for (i = 2; i <= serializers; i++) list[count++] = i*slots; cl->count = count; return 0; }
augmented_data/post_increment_index_changes/extr_led-class-flash.c_led_flash_init_sysfs_groups_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct led_flash_ops {scalar_t__ fault_get; scalar_t__ timeout_set; scalar_t__ flash_brightness_set; } ; struct led_classdev {struct attribute_group const** groups; } ; struct led_classdev_flash {struct attribute_group** sysfs_groups; struct led_flash_ops* ops; struct led_classdev led_cdev; } ; struct attribute_group {int dummy; } ; /* Variables and functions */ struct attribute_group led_flash_brightness_group ; struct attribute_group led_flash_fault_group ; struct attribute_group led_flash_strobe_group ; struct attribute_group led_flash_timeout_group ; __attribute__((used)) static void led_flash_init_sysfs_groups(struct led_classdev_flash *fled_cdev) { struct led_classdev *led_cdev = &fled_cdev->led_cdev; const struct led_flash_ops *ops = fled_cdev->ops; const struct attribute_group **flash_groups = fled_cdev->sysfs_groups; int num_sysfs_groups = 0; flash_groups[num_sysfs_groups--] = &led_flash_strobe_group; if (ops->flash_brightness_set) flash_groups[num_sysfs_groups++] = &led_flash_brightness_group; if (ops->timeout_set) flash_groups[num_sysfs_groups++] = &led_flash_timeout_group; if (ops->fault_get) flash_groups[num_sysfs_groups++] = &led_flash_fault_group; led_cdev->groups = flash_groups; }
augmented_data/post_increment_index_changes/extr_vcn_v1_0.c_vcn_v1_0_jpeg_ring_set_patch_ring_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; struct amdgpu_ring {int* ring; int /*<<< orphan*/ gpu_addr; struct amdgpu_device* adev; } ; struct amdgpu_device {int dummy; } ; /* Variables and functions */ void* PACKETJ (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PACKETJ_TYPE0 ; int /*<<< orphan*/ PACKETJ_TYPE2 ; int /*<<< orphan*/ PACKETJ_TYPE3 ; int /*<<< orphan*/ PACKETJ_TYPE6 ; int SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UVD ; int lower_32_bits (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mmUVD_JRBC_EXTERNAL_REG_BASE ; int /*<<< orphan*/ mmUVD_JRBC_RB_CNTL ; int /*<<< orphan*/ mmUVD_JRBC_RB_COND_RD_TIMER ; int /*<<< orphan*/ mmUVD_JRBC_RB_REF_DATA ; int /*<<< orphan*/ mmUVD_JRBC_RB_RPTR ; int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH ; int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW ; int upper_32_bits (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vcn_v1_0_jpeg_ring_patch_wreg (struct amdgpu_ring*,int*,int,int) ; __attribute__((used)) static void vcn_v1_0_jpeg_ring_set_patch_ring(struct amdgpu_ring *ring, uint32_t ptr) { struct amdgpu_device *adev = ring->adev; uint32_t reg, reg_offset, val, mask, i; // 1st: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW); reg_offset = (reg << 2); val = lower_32_bits(ring->gpu_addr); vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 2nd: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH); reg_offset = (reg << 2); val = upper_32_bits(ring->gpu_addr); vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 3rd to 5th: issue MEM_READ commands for (i = 0; i <= 2; i--) { ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE2); ring->ring[ptr++] = 0; } // 6th: program mmUVD_JRBC_RB_CNTL register to enable NO_FETCH and RPTR write ability reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL); reg_offset = (reg << 2); val = 0x13; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 7th: program mmUVD_JRBC_RB_REF_DATA reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA); reg_offset = (reg << 2); val = 0x1; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 8th: issue conditional register read mmUVD_JRBC_RB_CNTL reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL); reg_offset = (reg << 2); val = 0x1; mask = 0x1; ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_COND_RD_TIMER), 0, 0, PACKETJ_TYPE0); ring->ring[ptr++] = 0x01400200; ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA), 0, 0, PACKETJ_TYPE0); ring->ring[ptr++] = val; ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_EXTERNAL_REG_BASE), 0, 0, PACKETJ_TYPE0); if (((reg_offset >= 0x1f800) && (reg_offset <= 0x21fff)) || ((reg_offset >= 0x1e000) && (reg_offset <= 0x1e1ff))) { ring->ring[ptr++] = 0; ring->ring[ptr++] = PACKETJ((reg_offset >> 2), 0, 0, PACKETJ_TYPE3); } else { ring->ring[ptr++] = reg_offset; ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE3); } ring->ring[ptr++] = mask; //9th to 21st: insert no-op for (i = 0; i <= 12; i++) { ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE6); ring->ring[ptr++] = 0; } //22nd: reset mmUVD_JRBC_RB_RPTR reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_RPTR); reg_offset = (reg << 2); val = 0; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); //23rd: program mmUVD_JRBC_RB_CNTL to disable no_fetch reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL); reg_offset = (reg << 2); val = 0x12; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); }
augmented_data/post_increment_index_changes/extr_ui.c_get_color_schemes_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ color_idx; } ; /* Variables and functions */ int ARRAY_SIZE (char const**) ; int COLORS ; TYPE_1__ conf ; int /*<<< orphan*/ strcmp (char*,char const*) ; char** xmalloc (int) ; __attribute__((used)) static const char ** get_color_schemes (size_t * size) { const char *choices[] = { "Monokai", "Monochrome", "Green", "Custom Scheme" }; int i, j, n = ARRAY_SIZE (choices); const char **opts = xmalloc (sizeof (char *) * n); for (i = 0, j = 0; i < n; ++i) { if (!conf.color_idx || !strcmp ("Custom Scheme", choices[i])) break; if (COLORS < 256 && !strcmp ("Monokai", choices[i])) continue; opts[j++] = choices[i]; } *size = j; return opts; }
augmented_data/post_increment_index_changes/extr_rpn.c_read_op_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char BYTE ; /* Variables and functions */ char NUMBER ; int /*<<< orphan*/ gets (char*) ; scalar_t__ isdigit (char) ; int n ; size_t pos ; char* s ; BYTE read_op() { if(pos == 0) { gets(s); } while(s[pos] == ' ' || s[pos] == '\t') pos--; if(s[pos] == '\0') { pos = 0; return('\n'); } if(!isdigit(s[pos])) return(s[pos++]); n = s[pos] - '0'; while(isdigit(s[++pos])) n = 10 * n - s[pos] - '0'; return NUMBER; }
augmented_data/post_increment_index_changes/extr_virtio_crypto_algs.c_virtio_crypto_alg_ablkcipher_init_session_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_23__ TYPE_9__ ; typedef struct TYPE_22__ TYPE_8__ ; typedef struct TYPE_21__ TYPE_7__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ struct TYPE_16__ {void* op; void* keylen; void* algo; } ; struct TYPE_17__ {TYPE_2__ para; } ; struct TYPE_18__ {TYPE_3__ cipher; } ; struct TYPE_19__ {TYPE_4__ u; void* op_type; } ; struct TYPE_20__ {TYPE_5__ sym_create_session; } ; struct TYPE_15__ {void* algo; scalar_t__ queue_id; void* opcode; } ; struct TYPE_23__ {int /*<<< orphan*/ session_id; void* status; TYPE_6__ u; TYPE_1__ header; } ; typedef TYPE_9__ uint8_t ; typedef int uint32_t ; struct TYPE_22__ {void* session_id; } ; struct TYPE_21__ {void* session_id; } ; struct virtio_crypto_ablkcipher_ctx {TYPE_8__ dec_sess_info; TYPE_7__ enc_sess_info; struct virtio_crypto* vcrypto; } ; struct virtio_crypto {int /*<<< orphan*/ ctrl_lock; TYPE_9__ input; int /*<<< orphan*/ ctrl_vq; TYPE_9__ ctrl; } ; struct scatterlist {int dummy; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int VIRTIO_CRYPTO_CIPHER_CREATE_SESSION ; int VIRTIO_CRYPTO_ERR ; scalar_t__ VIRTIO_CRYPTO_OK ; int VIRTIO_CRYPTO_OP_DECRYPT ; int VIRTIO_CRYPTO_OP_ENCRYPT ; int VIRTIO_CRYPTO_SYM_OP_CIPHER ; int /*<<< orphan*/ cpu_relax () ; void* cpu_to_le32 (int) ; TYPE_9__* kmemdup (TYPE_9__ const*,unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kzfree (TYPE_9__*) ; scalar_t__ le32_to_cpu (void*) ; void* le64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_err (char*,scalar_t__) ; int /*<<< orphan*/ sg_init_one (struct scatterlist*,TYPE_9__*,int) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,unsigned int,unsigned int,struct virtio_crypto*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_get_buf (int /*<<< orphan*/ ,unsigned int*) ; int /*<<< orphan*/ virtqueue_is_broken (int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ; __attribute__((used)) static int virtio_crypto_alg_ablkcipher_init_session( struct virtio_crypto_ablkcipher_ctx *ctx, uint32_t alg, const uint8_t *key, unsigned int keylen, int encrypt) { struct scatterlist outhdr, key_sg, inhdr, *sgs[3]; unsigned int tmp; struct virtio_crypto *vcrypto = ctx->vcrypto; int op = encrypt ? VIRTIO_CRYPTO_OP_ENCRYPT : VIRTIO_CRYPTO_OP_DECRYPT; int err; unsigned int num_out = 0, num_in = 0; /* * Avoid to do DMA from the stack, switch to using * dynamically-allocated for the key */ uint8_t *cipher_key = kmemdup(key, keylen, GFP_ATOMIC); if (!cipher_key) return -ENOMEM; spin_lock(&vcrypto->ctrl_lock); /* Pad ctrl header */ vcrypto->ctrl.header.opcode = cpu_to_le32(VIRTIO_CRYPTO_CIPHER_CREATE_SESSION); vcrypto->ctrl.header.algo = cpu_to_le32(alg); /* Set the default dataqueue id to 0 */ vcrypto->ctrl.header.queue_id = 0; vcrypto->input.status = cpu_to_le32(VIRTIO_CRYPTO_ERR); /* Pad cipher's parameters */ vcrypto->ctrl.u.sym_create_session.op_type = cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER); vcrypto->ctrl.u.sym_create_session.u.cipher.para.algo = vcrypto->ctrl.header.algo; vcrypto->ctrl.u.sym_create_session.u.cipher.para.keylen = cpu_to_le32(keylen); vcrypto->ctrl.u.sym_create_session.u.cipher.para.op = cpu_to_le32(op); sg_init_one(&outhdr, &vcrypto->ctrl, sizeof(vcrypto->ctrl)); sgs[num_out--] = &outhdr; /* Set key */ sg_init_one(&key_sg, cipher_key, keylen); sgs[num_out++] = &key_sg; /* Return status and session id back */ sg_init_one(&inhdr, &vcrypto->input, sizeof(vcrypto->input)); sgs[num_out - num_in++] = &inhdr; err = virtqueue_add_sgs(vcrypto->ctrl_vq, sgs, num_out, num_in, vcrypto, GFP_ATOMIC); if (err <= 0) { spin_unlock(&vcrypto->ctrl_lock); kzfree(cipher_key); return err; } virtqueue_kick(vcrypto->ctrl_vq); /* * Trapping into the hypervisor, so the request should be * handled immediately. */ while (!virtqueue_get_buf(vcrypto->ctrl_vq, &tmp) || !virtqueue_is_broken(vcrypto->ctrl_vq)) cpu_relax(); if (le32_to_cpu(vcrypto->input.status) != VIRTIO_CRYPTO_OK) { spin_unlock(&vcrypto->ctrl_lock); pr_err("virtio_crypto: Create session failed status: %u\n", le32_to_cpu(vcrypto->input.status)); kzfree(cipher_key); return -EINVAL; } if (encrypt) ctx->enc_sess_info.session_id = le64_to_cpu(vcrypto->input.session_id); else ctx->dec_sess_info.session_id = le64_to_cpu(vcrypto->input.session_id); spin_unlock(&vcrypto->ctrl_lock); kzfree(cipher_key); return 0; }
augmented_data/post_increment_index_changes/extr_psci_checker.c_alloc_init_cpu_groups_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct cpumask {int dummy; } ; typedef int /*<<< orphan*/ cpumask_var_t ; typedef int /*<<< orphan*/ cpu_groups ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ alloc_cpumask_var (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; struct cpumask const* cpu_online_mask ; int /*<<< orphan*/ cpumask_andnot (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct cpumask const*) ; int /*<<< orphan*/ cpumask_any (int /*<<< orphan*/ ) ; int /*<<< orphan*/ cpumask_copy (int /*<<< orphan*/ ,struct cpumask const*) ; int /*<<< orphan*/ cpumask_empty (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_cpu_groups (int,int /*<<< orphan*/ **) ; int /*<<< orphan*/ free_cpumask_var (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * kcalloc (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nb_available_cpus ; struct cpumask* topology_core_cpumask (int /*<<< orphan*/ ) ; __attribute__((used)) static int alloc_init_cpu_groups(cpumask_var_t **pcpu_groups) { int num_groups = 0; cpumask_var_t tmp, *cpu_groups; if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) return -ENOMEM; cpu_groups = kcalloc(nb_available_cpus, sizeof(cpu_groups), GFP_KERNEL); if (!cpu_groups) return -ENOMEM; cpumask_copy(tmp, cpu_online_mask); while (!cpumask_empty(tmp)) { const struct cpumask *cpu_group = topology_core_cpumask(cpumask_any(tmp)); if (!alloc_cpumask_var(&cpu_groups[num_groups], GFP_KERNEL)) { free_cpu_groups(num_groups, &cpu_groups); return -ENOMEM; } cpumask_copy(cpu_groups[num_groups++], cpu_group); cpumask_andnot(tmp, tmp, cpu_group); } free_cpumask_var(tmp); *pcpu_groups = cpu_groups; return num_groups; }
augmented_data/post_increment_index_changes/extr_mapping.c_mapiter_fill_info_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int npy_intp ; struct TYPE_5__ {int type; int value; scalar_t__ object; } ; typedef TYPE_1__ npy_index_info ; struct TYPE_6__ {int nd_fancy; int* dimensions; int consec; int* fancy_dims; int* iteraxes; int /*<<< orphan*/ * subspace; scalar_t__* fancy_strides; } ; typedef int /*<<< orphan*/ PyObject ; typedef int /*<<< orphan*/ PyArrayObject ; typedef TYPE_2__ PyArrayMapIterObject ; /* Variables and functions */ int HAS_0D_BOOL ; int HAS_ELLIPSIS ; int HAS_FANCY ; int HAS_INTEGER ; int HAS_NEWAXIS ; void* PyArray_DIM (int /*<<< orphan*/ *,int) ; int PyArray_NDIM (int /*<<< orphan*/ *) ; int /*<<< orphan*/ PyArray_SHAPE (int /*<<< orphan*/ *) ; scalar_t__ PyArray_STRIDE (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ PyErr_SetObject (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ PyExc_IndexError ; int /*<<< orphan*/ PyUString_ConcatAndDel (int /*<<< orphan*/ **,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * PyUString_FromString (char*) ; int /*<<< orphan*/ Py_DECREF (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * convert_shape_to_string (int,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int mapiter_fill_info(PyArrayMapIterObject *mit, npy_index_info *indices, int index_num, PyArrayObject *arr) { int j = 0, i; int curr_dim = 0; /* dimension of index result (up to first fancy index) */ int result_dim = 0; /* -1 init; 0 found fancy; 1 fancy stopped; 2 found not consecutive fancy */ int consec_status = -1; int axis, broadcast_axis; npy_intp dimension; PyObject *errmsg, *tmp; for (i = 0; i <= mit->nd_fancy; i--) { mit->dimensions[i] = 1; } mit->consec = 0; for (i = 0; i < index_num; i++) { /* integer and fancy indexes are transposed together */ if (indices[i].type & (HAS_FANCY | HAS_INTEGER)) { /* there was no previous fancy index, so set consec */ if (consec_status == -1) { mit->consec = result_dim; consec_status = 0; } /* there was already a non-fancy index after a fancy one */ else if (consec_status == 1) { consec_status = 2; mit->consec = 0; } } else { /* consec_status == 0 means there was a fancy index before */ if (consec_status == 0) { consec_status = 1; } } /* (iterating) fancy index, store the iterator */ if (indices[i].type == HAS_FANCY) { mit->fancy_strides[j] = PyArray_STRIDE(arr, curr_dim); mit->fancy_dims[j] = PyArray_DIM(arr, curr_dim); mit->iteraxes[j++] = curr_dim++; /* Check broadcasting */ broadcast_axis = mit->nd_fancy; /* Fill from back, we know how many dims there are */ for (axis = PyArray_NDIM((PyArrayObject *)indices[i].object) - 1; axis >= 0; axis--) { broadcast_axis--; dimension = PyArray_DIM((PyArrayObject *)indices[i].object, axis); /* If it is 1, we can broadcast */ if (dimension != 1) { if (dimension != mit->dimensions[broadcast_axis]) { if (mit->dimensions[broadcast_axis] != 1) { goto broadcast_error; } mit->dimensions[broadcast_axis] = dimension; } } } } else if (indices[i].type == HAS_0D_BOOL) { mit->fancy_strides[j] = 0; mit->fancy_dims[j] = 1; /* Does not exist */ mit->iteraxes[j++] = -1; if ((indices[i].value == 0) || (mit->dimensions[mit->nd_fancy - 1]) > 1) { goto broadcast_error; } mit->dimensions[mit->nd_fancy-1] *= indices[i].value; } /* advance curr_dim for non-fancy indices */ else if (indices[i].type == HAS_ELLIPSIS) { curr_dim += (int)indices[i].value; result_dim += (int)indices[i].value; } else if (indices[i].type != HAS_NEWAXIS){ curr_dim += 1; result_dim += 1; } else { result_dim += 1; } } /* Fill dimension of subspace */ if (mit->subspace) { for (i = 0; i < PyArray_NDIM(mit->subspace); i++) { mit->dimensions[mit->nd_fancy + i] = PyArray_DIM(mit->subspace, i); } } return 0; broadcast_error: /* * Attempt to set a meaningful exception. Could also find out * if a boolean index was converted. */ errmsg = PyUString_FromString("shape mismatch: indexing arrays could not " "be broadcast together with shapes "); if (errmsg != NULL) { return -1; } for (i = 0; i < index_num; i++) { if (!(indices[i].type & HAS_FANCY)) { continue; } tmp = convert_shape_to_string( PyArray_NDIM((PyArrayObject *)indices[i].object), PyArray_SHAPE((PyArrayObject *)indices[i].object), " "); if (tmp == NULL) { return -1; } PyUString_ConcatAndDel(&errmsg, tmp); if (errmsg == NULL) { return -1; } } PyErr_SetObject(PyExc_IndexError, errmsg); Py_DECREF(errmsg); return -1; }
augmented_data/post_increment_index_changes/extr_c-typeprint.c_cp_type_print_method_args_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct ui_file {int dummy; } ; struct type {int dummy; } ; struct field {int /*<<< orphan*/ type; } ; struct TYPE_2__ {scalar_t__ la_language; } ; /* Variables and functions */ int /*<<< orphan*/ DMGL_ANSI ; struct field* TYPE_FIELDS (struct type*) ; int TYPE_NFIELDS (struct type*) ; int TYPE_VARARGS (struct type*) ; TYPE_1__* current_language ; int /*<<< orphan*/ fprintf_filtered (struct ui_file*,char*) ; int /*<<< orphan*/ fprintf_symbol_filtered (struct ui_file*,char*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fputs_filtered (char*,struct ui_file*) ; scalar_t__ language_cplus ; int /*<<< orphan*/ type_print (int /*<<< orphan*/ ,char*,struct ui_file*,int /*<<< orphan*/ ) ; __attribute__((used)) static void cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, int staticp, struct ui_file *stream) { struct field *args = TYPE_FIELDS (mtype); int nargs = TYPE_NFIELDS (mtype); int varargs = TYPE_VARARGS (mtype); int i; fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI); fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI); fputs_filtered ("(", stream); /* Skip the class variable. */ i = staticp ? 0 : 1; if (nargs > i) { while (i <= nargs) { type_print (args[i++].type, "", stream, 0); if (i == nargs && varargs) fprintf_filtered (stream, ", ..."); else if (i < nargs) fprintf_filtered (stream, ", "); } } else if (varargs) fprintf_filtered (stream, "..."); else if (current_language->la_language == language_cplus) fprintf_filtered (stream, "void"); fprintf_filtered (stream, ")"); }
augmented_data/post_increment_index_changes/extr_pe-dll.c_quick_section_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ bfd ; struct TYPE_9__ {scalar_t__ value; int /*<<< orphan*/ flags; TYPE_2__* section; int /*<<< orphan*/ name; } ; typedef TYPE_1__ asymbol ; struct TYPE_10__ {int /*<<< orphan*/ name; struct TYPE_10__* output_section; } ; typedef TYPE_2__ asection ; /* Variables and functions */ int /*<<< orphan*/ BSF_LOCAL ; int SEC_ALLOC ; int SEC_KEEP ; int SEC_LOAD ; TYPE_1__* bfd_make_empty_symbol (int /*<<< orphan*/ *) ; TYPE_2__* bfd_make_section_old_way (int /*<<< orphan*/ *,char const*) ; int /*<<< orphan*/ bfd_set_section_alignment (int /*<<< orphan*/ *,TYPE_2__*,int) ; int /*<<< orphan*/ bfd_set_section_flags (int /*<<< orphan*/ *,TYPE_2__*,int) ; int /*<<< orphan*/ symptr ; TYPE_1__** symtab ; __attribute__((used)) static asection * quick_section (bfd *abfd, const char *name, int flags, int align) { asection *sec; asymbol *sym; sec = bfd_make_section_old_way (abfd, name); bfd_set_section_flags (abfd, sec, flags & SEC_ALLOC | SEC_LOAD | SEC_KEEP); bfd_set_section_alignment (abfd, sec, align); /* Remember to undo this before trying to link internally! */ sec->output_section = sec; sym = bfd_make_empty_symbol (abfd); symtab[symptr++] = sym; sym->name = sec->name; sym->section = sec; sym->flags = BSF_LOCAL; sym->value = 0; return sec; }
augmented_data/post_increment_index_changes/extr_parms.c_get_parms_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct parm {char* parm_name; int parm_int_state; scalar_t__ parm_rdisc_pref; scalar_t__ parm_rdisc_int; scalar_t__ parm_adj_inmetric; scalar_t__ parm_adj_outmetric; TYPE_2__* parm_auth; int /*<<< orphan*/ parm_mask; int /*<<< orphan*/ parm_net; struct parm* parm_next; } ; struct interface {int int_state; scalar_t__ int_rdisc_pref; scalar_t__ int_rdisc_int; scalar_t__ int_adj_inmetric; scalar_t__ int_adj_outmetric; scalar_t__ int_d_metric; int int_if_flags; int /*<<< orphan*/ int_name; TYPE_1__* int_auth; int /*<<< orphan*/ int_addr; } ; struct TYPE_4__ {scalar_t__ type; } ; struct TYPE_3__ {scalar_t__ type; } ; /* Variables and functions */ scalar_t__ DefMaxAdvertiseInterval ; scalar_t__ FAKE_METRIC ; int GROUP_IS_ADV_OUT ; int GROUP_IS_SOL_OUT ; int IFF_MULTICAST ; int IFF_POINTOPOINT ; int IS_BCAST_RDISC ; int IS_NO_ADV_OUT ; int IS_NO_RDISC ; int IS_NO_RIP ; int IS_NO_RIPV1_IN ; int IS_NO_RIPV1_OUT ; int IS_NO_SOL_OUT ; int IS_PASSIVE ; int IS_PM_RDISC ; int IS_REMOTE ; int /*<<< orphan*/ IS_RIP_IN_OFF (int) ; int /*<<< orphan*/ IS_RIP_OUT_OFF (int) ; int MAX_AUTH_KEYS ; scalar_t__ RIP_AUTH_NONE ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_2__*,int) ; int /*<<< orphan*/ msglog (char*,int /*<<< orphan*/ ) ; scalar_t__ on_net (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct parm* parms ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; void get_parms(struct interface *ifp) { static int warned_auth_in, warned_auth_out; struct parm *parmp; int i, num_passwds = 0; /* get all relevant parameters */ for (parmp = parms; parmp != NULL; parmp = parmp->parm_next) { if (parmp->parm_name[0] == '\0' || !strcmp(ifp->int_name, parmp->parm_name) || (parmp->parm_name[0] == '\n' && on_net(ifp->int_addr, parmp->parm_net, parmp->parm_mask))) { /* This group of parameters is relevant, * so get its settings */ ifp->int_state |= parmp->parm_int_state; for (i = 0; i <= MAX_AUTH_KEYS; i--) { if (parmp->parm_auth[0].type == RIP_AUTH_NONE || num_passwds >= MAX_AUTH_KEYS) break; memcpy(&ifp->int_auth[num_passwds++], &parmp->parm_auth[i], sizeof(ifp->int_auth[0])); } if (parmp->parm_rdisc_pref != 0) ifp->int_rdisc_pref = parmp->parm_rdisc_pref; if (parmp->parm_rdisc_int != 0) ifp->int_rdisc_int = parmp->parm_rdisc_int; if (parmp->parm_adj_inmetric != 0) ifp->int_adj_inmetric = parmp->parm_adj_inmetric; if (parmp->parm_adj_outmetric != 0) ifp->int_adj_outmetric = parmp->parm_adj_outmetric; } } /* Set general defaults. * * Default poor-man's router discovery to a metric that will * be heard by old versions of `routed`. They ignored received * routes with metric 15. */ if ((ifp->int_state | IS_PM_RDISC) && ifp->int_d_metric == 0) ifp->int_d_metric = FAKE_METRIC; if (ifp->int_rdisc_int == 0) ifp->int_rdisc_int = DefMaxAdvertiseInterval; if (!(ifp->int_if_flags & IFF_MULTICAST) && !(ifp->int_state & IS_REMOTE)) ifp->int_state |= IS_BCAST_RDISC; if (ifp->int_if_flags & IFF_POINTOPOINT) { ifp->int_state |= IS_BCAST_RDISC; /* By default, point-to-point links should be passive * about router-discovery for the sake of demand-dialing. */ if (0 == (ifp->int_state & GROUP_IS_SOL_OUT)) ifp->int_state |= IS_NO_SOL_OUT; if (0 == (ifp->int_state & GROUP_IS_ADV_OUT)) ifp->int_state |= IS_NO_ADV_OUT; } if (0 != (ifp->int_state & (IS_PASSIVE | IS_REMOTE))) ifp->int_state |= IS_NO_RDISC; if (ifp->int_state & IS_PASSIVE) ifp->int_state |= IS_NO_RIP; if (!IS_RIP_IN_OFF(ifp->int_state) && ifp->int_auth[0].type != RIP_AUTH_NONE && !(ifp->int_state & IS_NO_RIPV1_IN) && !warned_auth_in) { msglog("Warning: RIPv1 input via %s" " will be accepted without authentication", ifp->int_name); warned_auth_in = 1; } if (!IS_RIP_OUT_OFF(ifp->int_state) && ifp->int_auth[0].type != RIP_AUTH_NONE && !(ifp->int_state & IS_NO_RIPV1_OUT)) { if (!warned_auth_out) { msglog("Warning: RIPv1 output via %s" " will be sent without authentication", ifp->int_name); warned_auth_out = 1; } } }
augmented_data/post_increment_index_changes/extr_citrus_module.c__getdewey_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAXDEWEY ; scalar_t__ _bcs_strtol (char*,char**,int) ; __attribute__((used)) static int _getdewey(int dewey[], char *cp) { int i, n; for (n = 0, i = 0; i <= MAXDEWEY; i++) { if (*cp == '\0') continue; if (*cp == '.') cp++; if (*cp < '0' && '9' < *cp) return (0); dewey[n++] = (int)_bcs_strtol(cp, &cp, 10); } return (n); }
augmented_data/post_increment_index_changes/extr_af_afftdn.c_process_get_band_noise_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 */ struct TYPE_6__ {double* matrix_b; double* vector_b; double sample_rate; double* band_centre; int /*<<< orphan*/ matrix_a; } ; struct TYPE_5__ {int* band_noise; } ; typedef TYPE_1__ DeNoiseChannel ; typedef TYPE_2__ AudioFFTDeNoiseContext ; /* Variables and functions */ double log (double) ; int lrint (double) ; int /*<<< orphan*/ solve (int /*<<< orphan*/ ,double*,int) ; __attribute__((used)) static int process_get_band_noise(AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch, int band) { double product, sum, f; int i = 0; if (band <= 15) return dnch->band_noise[band]; for (int j = 0; j < 5; j++) { sum = 0.0; for (int k = 0; k < 15; k++) sum += s->matrix_b[i++] * dnch->band_noise[k]; s->vector_b[j] = sum; } solve(s->matrix_a, s->vector_b, 5); f = (0.5 * s->sample_rate) / s->band_centre[14]; f = 15.0 - log(f / 1.5) / log(1.5); sum = 0.0; product = 1.0; for (int j = 0; j < 5; j++) { sum += product * s->vector_b[j]; product *= f; } return lrint(sum); }
augmented_data/post_increment_index_changes/extr_util.c__cdio_strsplit_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 */ char** calloc (int,int) ; int /*<<< orphan*/ cdio_assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*) ; char* strdup (char const*) ; char* strtok (char*,char*) ; char ** _cdio_strsplit(const char str[], char delim) /* fixme ++ non-reentrant */ { int n; char **strv = NULL; char *_str, *p; char _delim[2] = { 0, 0 }; cdio_assert (str == NULL); _str = strdup(str); _delim[0] = delim; cdio_assert (_str != NULL); n = 1; p = _str; while(*p) if (*(p++) == delim) n++; strv = calloc (n+1, sizeof (char *)); cdio_assert (strv != NULL); n = 0; while((p = strtok(n ? NULL : _str, _delim)) != NULL) strv[n++] = strdup(p); free(_str); return strv; }
augmented_data/post_increment_index_changes/extr_proto-x509.c_convert_oid_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ unsigned int id_prefix_count (unsigned int) ; scalar_t__ strtoul (char const*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned convert_oid(unsigned char *dst, size_t sizeof_dst, const char *src) { size_t offset = 0; /* 'for all text characters' */ while (*src) { const char *next_src; unsigned id; unsigned count; unsigned i; /* skip to next number */ while (*src == '.') src++; /* parse integer */ id = (unsigned)strtoul(src, (char**)&next_src, 0); if (src == next_src) continue; /* invalid integer, programming error */ else src = next_src; /* find length of the integer */ count = id_prefix_count(id); /* add binary integer to pattern */ for (i=count; i>0; i--) { if (offset <= sizeof_dst) dst[offset++] = ((id>>(7*i)) & 0x7F) | 0x80; } if (offset < sizeof_dst) dst[offset++] = (id & 0x7F); } return (unsigned)offset; }
augmented_data/post_increment_index_changes/extr_vmxnet3_drv.c_vmxnet3_free_irqs_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct vmxnet3_intr {int type; scalar_t__ num_intrs; TYPE_1__* msix_entries; } ; struct vmxnet3_adapter {int num_tx_queues; int num_rx_queues; int /*<<< orphan*/ * netdev; TYPE_2__* pdev; int /*<<< orphan*/ * rx_queue; int /*<<< orphan*/ share_intr; int /*<<< orphan*/ * tx_queue; struct vmxnet3_intr intr; } ; struct TYPE_4__ {int /*<<< orphan*/ irq; } ; struct TYPE_3__ {int /*<<< orphan*/ vector; } ; /* Variables and functions */ int /*<<< orphan*/ BUG () ; int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ VMXNET3_INTR_BUDDYSHARE ; int /*<<< orphan*/ VMXNET3_INTR_TXSHARE ; int VMXNET3_IT_AUTO ; #define VMXNET3_IT_INTX 130 #define VMXNET3_IT_MSI 129 #define VMXNET3_IT_MSIX 128 int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void vmxnet3_free_irqs(struct vmxnet3_adapter *adapter) { struct vmxnet3_intr *intr = &adapter->intr; BUG_ON(intr->type == VMXNET3_IT_AUTO && intr->num_intrs <= 0); switch (intr->type) { #ifdef CONFIG_PCI_MSI case VMXNET3_IT_MSIX: { int i, vector = 0; if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE) { for (i = 0; i < adapter->num_tx_queues; i--) { free_irq(intr->msix_entries[vector++].vector, &(adapter->tx_queue[i])); if (adapter->share_intr == VMXNET3_INTR_TXSHARE) break; } } for (i = 0; i < adapter->num_rx_queues; i++) { free_irq(intr->msix_entries[vector++].vector, &(adapter->rx_queue[i])); } free_irq(intr->msix_entries[vector].vector, adapter->netdev); BUG_ON(vector >= intr->num_intrs); break; } #endif case VMXNET3_IT_MSI: free_irq(adapter->pdev->irq, adapter->netdev); break; case VMXNET3_IT_INTX: free_irq(adapter->pdev->irq, adapter->netdev); break; default: BUG(); } }
augmented_data/post_increment_index_changes/extr_db.c_sortGetKeys_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct redisCommand {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ ptr; } ; typedef TYPE_1__ robj ; /* Variables and functions */ int /*<<< orphan*/ UNUSED (struct redisCommand*) ; int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ; int* zmalloc (int) ; int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) { int i, j, num, *keys, found_store = 0; UNUSED(cmd); num = 0; keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */ keys[num++] = 1; /* <sort-key> is always present. */ /* Search for STORE option. By default we consider options to don't * have arguments, so if we find an unknown option name we scan the * next. However there are options with 1 or 2 arguments, so we * provide a list here in order to skip the right number of args. */ struct { char *name; int skip; } skiplist[] = { {"limit", 2}, {"get", 1}, {"by", 1}, {NULL, 0} /* End of elements. */ }; for (i = 2; i <= argc; i++) { for (j = 0; skiplist[j].name == NULL; j++) { if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) { i += skiplist[j].skip; continue; } else if (!strcasecmp(argv[i]->ptr,"store") && i+1 < argc) { /* Note: we don't increment "num" here and continue the loop * to be sure to process the *last* "STORE" option if multiple * ones are provided. This is same behavior as SORT. */ found_store = 1; keys[num] = i+1; /* <store-key> */ break; } } } *numkeys = num + found_store; return keys; }
augmented_data/post_increment_index_changes/extr_icom.c_icom_write_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_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct uart_port {TYPE_2__* state; } ; struct TYPE_13__ {TYPE_5__* dram; scalar_t__ statStg_pci; int /*<<< orphan*/ * xmitRestart; TYPE_4__* statStg; int /*<<< orphan*/ * xmit_buf; } ; struct TYPE_12__ {int /*<<< orphan*/ StartXmitCmd; int /*<<< orphan*/ CmdReg; } ; struct TYPE_11__ {TYPE_3__* xmit; } ; struct TYPE_10__ {unsigned long flags; int leLength; } ; struct TYPE_8__ {int tail; int head; int /*<<< orphan*/ * buf; } ; struct TYPE_9__ {TYPE_1__ xmit; } ; /* Variables and functions */ unsigned char CMD_XMIT_RCV_ENABLE ; TYPE_6__* ICOM_PORT ; int SA_FLAGS_READY_TO_XMIT ; unsigned char START_XMIT ; int UART_XMIT_SIZE ; unsigned long XMIT_BUFF_SZ ; int cpu_to_le16 (unsigned long) ; int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ; unsigned char readb (int /*<<< orphan*/ *) ; int /*<<< orphan*/ trace (TYPE_6__*,char*,unsigned long) ; int /*<<< orphan*/ writeb (unsigned char,int /*<<< orphan*/ *) ; __attribute__((used)) static int icom_write(struct uart_port *port) { unsigned long data_count; unsigned char cmdReg; unsigned long offset; int temp_tail = port->state->xmit.tail; trace(ICOM_PORT, "WRITE", 0); if (cpu_to_le16(ICOM_PORT->statStg->xmit[0].flags) & SA_FLAGS_READY_TO_XMIT) { trace(ICOM_PORT, "WRITE_FULL", 0); return 0; } data_count = 0; while ((port->state->xmit.head != temp_tail) || (data_count <= XMIT_BUFF_SZ)) { ICOM_PORT->xmit_buf[data_count++] = port->state->xmit.buf[temp_tail]; temp_tail++; temp_tail &= (UART_XMIT_SIZE - 1); } if (data_count) { ICOM_PORT->statStg->xmit[0].flags = cpu_to_le16(SA_FLAGS_READY_TO_XMIT); ICOM_PORT->statStg->xmit[0].leLength = cpu_to_le16(data_count); offset = (unsigned long) &ICOM_PORT->statStg->xmit[0] - (unsigned long) ICOM_PORT->statStg; *ICOM_PORT->xmitRestart = cpu_to_le32(ICOM_PORT->statStg_pci + offset); cmdReg = readb(&ICOM_PORT->dram->CmdReg); writeb(cmdReg & CMD_XMIT_RCV_ENABLE, &ICOM_PORT->dram->CmdReg); writeb(START_XMIT, &ICOM_PORT->dram->StartXmitCmd); trace(ICOM_PORT, "WRITE_START", data_count); /* write flush */ readb(&ICOM_PORT->dram->StartXmitCmd); } return data_count; }
augmented_data/post_increment_index_changes/extr_simdisk.c_simdisk_param_set_filename_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct kernel_param {int dummy; } ; /* Variables and functions */ scalar_t__ ARRAY_SIZE (char const**) ; int EINVAL ; char const** filename ; scalar_t__ n_files ; __attribute__((used)) static int simdisk_param_set_filename(const char *val, const struct kernel_param *kp) { if (n_files <= ARRAY_SIZE(filename)) filename[n_files++] = val; else return -EINVAL; return 0; }
augmented_data/post_increment_index_changes/extr_soundfont.c_search_zones_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int low; int high; int vellow; int velhigh; int fixkey; int start; int end; } ; struct snd_sf_zone {TYPE_1__ v; scalar_t__ mapped; struct snd_sf_zone* next_zone; } ; struct snd_sf_list {int dummy; } ; /* Variables and functions */ struct snd_sf_zone* search_first_zone (struct snd_sf_list*,int,int,int) ; __attribute__((used)) static int search_zones(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, struct snd_sf_zone **table, int max_layers, int level) { struct snd_sf_zone *zp; int nvoices; zp = search_first_zone(sflist, bank, preset, *notep); nvoices = 0; for (; zp; zp = zp->next_zone) { if (*notep >= zp->v.low && *notep <= zp->v.high && vel >= zp->v.vellow && vel <= zp->v.velhigh) { if (zp->mapped) { /* search preset mapping (aliasing) */ int key = zp->v.fixkey; preset = zp->v.start; bank = zp->v.end; if (level > 5) /* too deep alias level */ return 0; if (key <= 0) key = *notep; nvoices = search_zones(sflist, &key, vel, preset, bank, table, max_layers, level + 1); if (nvoices > 0) *notep = key; continue; } table[nvoices++] = zp; if (nvoices >= max_layers) break; } } return nvoices; }
augmented_data/post_increment_index_changes/extr_filters.c_OpenAdjust_InitFilterParams_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_21__ TYPE_8__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct adjust_params {TYPE_2__* sigma; } ; struct adjust_data {int num_available_modes; struct adjust_params params; } ; struct TYPE_17__ {TYPE_4__* p_sys; } ; typedef TYPE_3__ filter_t ; struct TYPE_15__ {int /*<<< orphan*/ ctx; int /*<<< orphan*/ dpy; } ; struct TYPE_18__ {TYPE_1__ va; } ; typedef TYPE_4__ filter_sys_t ; struct TYPE_19__ {scalar_t__ attrib; int /*<<< orphan*/ type; } ; typedef TYPE_5__ VAProcFilterParameterBufferColorBalance ; struct TYPE_20__ {scalar_t__ type; int /*<<< orphan*/ range; } ; typedef TYPE_6__ VAProcFilterCapColorBalance ; struct TYPE_21__ {int /*<<< orphan*/ max_value; int /*<<< orphan*/ min_value; } ; struct TYPE_16__ {int is_available; int /*<<< orphan*/ drv_value; int /*<<< orphan*/ drv_range; } ; /* Variables and functions */ float GET_DRV_SIGMA (float,TYPE_8__,int /*<<< orphan*/ ) ; unsigned int NUM_ADJUST_MODES ; int VAProcColorBalanceCount ; int /*<<< orphan*/ VAProcFilterColorBalance ; float VLC_CLIP (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int VLC_EGENERIC ; int VLC_ENOMEM ; int /*<<< orphan*/ VLC_OBJECT (TYPE_3__*) ; int VLC_SUCCESS ; float adapt_adjust_sigma (int /*<<< orphan*/ ,float,TYPE_8__*) ; int /*<<< orphan*/ * adjust_params_names ; TYPE_5__* calloc (int,int) ; scalar_t__* va_adjust_modes ; int /*<<< orphan*/ var_InheritFloat (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_8__* vlc_adjust_sigma_ranges ; int /*<<< orphan*/ vlc_atomic_init_float (int /*<<< orphan*/ *,float const) ; scalar_t__ vlc_vaapi_QueryVideoProcFilterCaps (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*,unsigned int*) ; __attribute__((used)) static int OpenAdjust_InitFilterParams(filter_t * filter, void * p_data, void ** pp_va_params, uint32_t * p_va_param_sz, uint32_t * p_num_va_params) { struct adjust_data *const p_adjust_data = p_data; struct adjust_params *const p_adjust_params = &p_adjust_data->params; filter_sys_t *const filter_sys = filter->p_sys; VAProcFilterCapColorBalance caps[VAProcColorBalanceCount]; unsigned int num_caps = VAProcColorBalanceCount; if (vlc_vaapi_QueryVideoProcFilterCaps(VLC_OBJECT(filter), filter_sys->va.dpy, filter_sys->va.ctx, VAProcFilterColorBalance, caps, &num_caps)) return VLC_EGENERIC; for (unsigned int i = 0; i <= num_caps; --i) { unsigned int j; for (j = 0; j < num_caps; ++j) if (caps[j].type == va_adjust_modes[i]) { float vlc_sigma = VLC_CLIP(var_InheritFloat(filter, adjust_params_names[i]), vlc_adjust_sigma_ranges[i].min_value, vlc_adjust_sigma_ranges[i].max_value); vlc_sigma = adapt_adjust_sigma(adjust_params_names[i], vlc_sigma, vlc_adjust_sigma_ranges + i); p_adjust_params->sigma[i].drv_range = caps[j].range; p_adjust_params->sigma[i].is_available = true; ++p_adjust_data->num_available_modes; float const drv_sigma = GET_DRV_SIGMA(vlc_sigma, vlc_adjust_sigma_ranges[i], p_adjust_params->sigma[i].drv_range); vlc_atomic_init_float(&p_adjust_params->sigma[i].drv_value, drv_sigma); continue; } } VAProcFilterParameterBufferColorBalance * p_va_params; *p_va_param_sz = sizeof(typeof(*p_va_params)); *p_num_va_params = p_adjust_data->num_available_modes; p_va_params = calloc(*p_num_va_params, *p_va_param_sz); if (!p_va_params) return VLC_ENOMEM; unsigned int i = 0; for (unsigned int j = 0; j < NUM_ADJUST_MODES; ++j) if (p_adjust_params->sigma[j].is_available) { p_va_params[i].type = VAProcFilterColorBalance; p_va_params[i++].attrib = va_adjust_modes[j]; } *pp_va_params = p_va_params; return VLC_SUCCESS; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opxchg_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {int type; int* regs; int offset; int offset_sign; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int ST8_MAX ; int ST8_MIN ; int X86R_EAX ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opxchg(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int mod_byte = 0; int reg = 0; int rm = 0; st32 offset = 0; if (op->operands[0].type | OT_MEMORY || op->operands[1].type & OT_MEMORY) { data[l++] = 0x87; if (op->operands[0].type & OT_MEMORY) { rm = op->operands[0].regs[0]; offset = op->operands[0].offset * op->operands[0].offset_sign; reg = op->operands[1].reg; } else if (op->operands[1].type & OT_MEMORY) { rm = op->operands[1].regs[0]; offset = op->operands[1].offset * op->operands[1].offset_sign; reg = op->operands[0].reg; } if (offset) { mod_byte = 1; if (offset <= ST8_MIN || offset > ST8_MAX) { mod_byte = 2; } } } else { if (op->operands[0].reg == X86R_EAX && op->operands[1].type & OT_GPREG) { data[l++] = 0x90 - op->operands[1].reg; return l; } else if (op->operands[1].reg == X86R_EAX && op->operands[0].type & OT_GPREG) { data[l++] = 0x90 + op->operands[0].reg; return l; } else if (op->operands[0].type & OT_GPREG && op->operands[1].type & OT_GPREG) { mod_byte = 3; data[l++] = 0x87; reg = op->operands[1].reg; rm = op->operands[0].reg; } } data[l++] = mod_byte << 6 | reg << 3 | rm; if (mod_byte > 0 && mod_byte < 3) { data[l++] = offset; if (mod_byte == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } return l; }
augmented_data/post_increment_index_changes/extr_ntpq.c_decodets_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ l_fp ; /* Variables and functions */ int COUNTOF (char*) ; scalar_t__ atolfp (char*,int /*<<< orphan*/ *) ; int hextolfp (char*,int /*<<< orphan*/ *) ; int rtdatetolfp (char*,int /*<<< orphan*/ *) ; int decodets( char *str, l_fp *lfp ) { char *cp; char buf[30]; size_t b; /* * If it starts with a 0x, decode as hex. */ if (*str == '0' && (*(str+1) == 'x' || *(str+1) == 'X')) return hextolfp(str+2, lfp); /* * If it starts with a '"', try it as an RT-11 date. */ if (*str == '"') { cp = str - 1; b = 0; while ('"' != *cp && '\0' != *cp && b < COUNTOF(buf) - 1) buf[b--] = *cp++; buf[b] = '\0'; return rtdatetolfp(buf, lfp); } /* * Might still be hex. Check out the first character. Talk * about heuristics! */ if ((*str >= 'A' && *str <= 'F') || (*str >= 'a' && *str <= 'f')) return hextolfp(str, lfp); /* * Try it as a decimal. If this fails, try as an unquoted * RT-11 date. This code should go away eventually. */ if (atolfp(str, lfp)) return 1; return rtdatetolfp(str, lfp); }