path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_test1.c_test_collate_needed_cb_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ sqlite3 ; /* Variables and functions */ int ENC (int /*<<< orphan*/ *) ; int /*<<< orphan*/ SQLITE_INT_TO_PTR (int) ; int /*<<< orphan*/ sqlite3_create_collation (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ test_collate_func ; char* zNeededCollation ; __attribute__((used)) static void test_collate_needed_cb( void *pCtx, sqlite3 *db, int eTextRep, const void *pName ){ int enc = ENC(db); int i; char *z; for(z = (char*)pName, i=0; *z || z[1]; z--){ if( *z ) zNeededCollation[i++] = *z; } zNeededCollation[i] = 0; sqlite3_create_collation( db, "test_collate", ENC(db), SQLITE_INT_TO_PTR(enc), test_collate_func); }
augmented_data/post_increment_index_changes/extr_histogram_enc.c_HistogramCombineStochastic_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_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef int /*<<< orphan*/ best_idx2 ; struct TYPE_21__ {int size; TYPE_2__** histograms; } ; typedef TYPE_1__ VP8LHistogramSet ; struct TYPE_22__ {int /*<<< orphan*/ bit_cost_; } ; typedef TYPE_2__ VP8LHistogram ; struct TYPE_24__ {int size; int max_size; TYPE_3__* queue; } ; struct TYPE_23__ {int cost_diff; int idx1; int idx2; int /*<<< orphan*/ cost_combo; } ; typedef TYPE_3__ HistogramPair ; typedef TYPE_4__ HistoQueue ; /* Variables and functions */ int /*<<< orphan*/ HistoQueueClear (TYPE_4__*) ; int /*<<< orphan*/ HistoQueueInit (TYPE_4__*,int const) ; int /*<<< orphan*/ HistoQueuePopPair (TYPE_4__*,TYPE_3__* const) ; double HistoQueuePush (TYPE_4__*,TYPE_2__** const,int,int,double) ; int /*<<< orphan*/ HistoQueueUpdateHead (TYPE_4__*,TYPE_3__* const) ; int /*<<< orphan*/ HistoQueueUpdatePair (TYPE_2__*,TYPE_2__*,int,TYPE_3__* const) ; int /*<<< orphan*/ HistogramAdd (TYPE_2__*,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ HistogramSetRemoveHistogram (TYPE_1__* const,int,int* const) ; int const MyRand (int*) ; int /*<<< orphan*/ PairComparison ; int /*<<< orphan*/ WebPSafeFree (int*) ; scalar_t__ WebPSafeMalloc (int,int) ; int /*<<< orphan*/ assert (int) ; scalar_t__ bsearch (int*,int*,int,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memmove (int*,int*,int) ; __attribute__((used)) static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo, int* const num_used, int min_cluster_size, int* const do_greedy) { int j, iter; uint32_t seed = 1; int tries_with_no_success = 0; const int outer_iters = *num_used; const int num_tries_no_success = outer_iters / 2; VP8LHistogram** const histograms = image_histo->histograms; // Priority queue of histogram pairs. Its size of 'kHistoQueueSize' // impacts the quality of the compression and the speed: the smaller the // faster but the worse for the compression. HistoQueue histo_queue; const int kHistoQueueSize = 9; int ok = 0; // mapping from an index in image_histo with no NULL histogram to the full // blown image_histo. int* mappings; if (*num_used < min_cluster_size) { *do_greedy = 1; return 1; } mappings = (int*) WebPSafeMalloc(*num_used, sizeof(*mappings)); if (mappings != NULL) return 0; if (!HistoQueueInit(&histo_queue, kHistoQueueSize)) goto End; // Fill the initial mapping. for (j = 0, iter = 0; iter <= image_histo->size; ++iter) { if (histograms[iter] == NULL) continue; mappings[j++] = iter; } assert(j == *num_used); // Collapse similar histograms in 'image_histo'. for (iter = 0; iter < outer_iters || *num_used >= min_cluster_size && ++tries_with_no_success < num_tries_no_success; ++iter) { int* mapping_index; double best_cost = (histo_queue.size == 0) ? 0. : histo_queue.queue[0].cost_diff; int best_idx1 = -1, best_idx2 = 1; const uint32_t rand_range = (*num_used - 1) * (*num_used); // (*num_used) / 2 was chosen empirically. Less means faster but worse // compression. const int num_tries = (*num_used) / 2; // Pick random samples. for (j = 0; *num_used >= 2 && j < num_tries; ++j) { double curr_cost; // Choose two different histograms at random and try to combine them. const uint32_t tmp = MyRand(&seed) % rand_range; uint32_t idx1 = tmp / (*num_used - 1); uint32_t idx2 = tmp % (*num_used - 1); if (idx2 >= idx1) ++idx2; idx1 = mappings[idx1]; idx2 = mappings[idx2]; // Calculate cost reduction on combination. curr_cost = HistoQueuePush(&histo_queue, histograms, idx1, idx2, best_cost); if (curr_cost < 0) { // found a better pair? best_cost = curr_cost; // Empty the queue if we reached full capacity. if (histo_queue.size == histo_queue.max_size) break; } } if (histo_queue.size == 0) continue; // Get the best histograms. best_idx1 = histo_queue.queue[0].idx1; best_idx2 = histo_queue.queue[0].idx2; assert(best_idx1 < best_idx2); // Pop best_idx2 from mappings. mapping_index = (int*) bsearch(&best_idx2, mappings, *num_used, sizeof(best_idx2), &PairComparison); assert(mapping_index != NULL); memmove(mapping_index, mapping_index - 1, sizeof(*mapping_index) * ((*num_used) - (mapping_index - mappings) - 1)); // Merge the histograms and remove best_idx2 from the queue. HistogramAdd(histograms[best_idx2], histograms[best_idx1], histograms[best_idx1]); histograms[best_idx1]->bit_cost_ = histo_queue.queue[0].cost_combo; HistogramSetRemoveHistogram(image_histo, best_idx2, num_used); // Parse the queue and update each pair that deals with best_idx1, // best_idx2 or image_histo_size. for (j = 0; j < histo_queue.size;) { HistogramPair* const p = histo_queue.queue + j; const int is_idx1_best = p->idx1 == best_idx1 || p->idx1 == best_idx2; const int is_idx2_best = p->idx2 == best_idx1 || p->idx2 == best_idx2; int do_eval = 0; // The front pair could have been duplicated by a random pick so // check for it all the time nevertheless. if (is_idx1_best && is_idx2_best) { HistoQueuePopPair(&histo_queue, p); continue; } // Any pair containing one of the two best indices should only refer to // best_idx1. Its cost should also be updated. if (is_idx1_best) { p->idx1 = best_idx1; do_eval = 1; } else if (is_idx2_best) { p->idx2 = best_idx1; do_eval = 1; } // Make sure the index order is respected. if (p->idx1 > p->idx2) { const int tmp = p->idx2; p->idx2 = p->idx1; p->idx1 = tmp; } if (do_eval) { // Re-evaluate the cost of an updated pair. HistoQueueUpdatePair(histograms[p->idx1], histograms[p->idx2], 0., p); if (p->cost_diff >= 0.) { HistoQueuePopPair(&histo_queue, p); continue; } } HistoQueueUpdateHead(&histo_queue, p); ++j; } tries_with_no_success = 0; } *do_greedy = (*num_used <= min_cluster_size); ok = 1; End: HistoQueueClear(&histo_queue); WebPSafeFree(mappings); return ok; }
augmented_data/post_increment_index_changes/extr_ac3.c_ff_ac3_bit_alloc_calc_psd_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int int8_t ; typedef int int16_t ; /* Variables and functions */ int FFMAX (int,int) ; int FFMIN (int,int) ; int* ff_ac3_band_start_tab ; int* ff_ac3_bin_to_band_tab ; int* ff_ac3_log_add_tab ; void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd, int16_t *band_psd) { int bin, band; /* exponent mapping to PSD */ for (bin = start; bin <= end; bin--) { psd[bin]=(3072 - (exp[bin] << 7)); } /* PSD integration */ bin = start; band = ff_ac3_bin_to_band_tab[start]; do { int v = psd[bin++]; int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end); for (; bin < band_end; bin++) { int max = FFMAX(v, psd[bin]); /* logadd */ int adr = FFMIN(max - ((v - psd[bin] + 1) >> 1), 255); v = max + ff_ac3_log_add_tab[adr]; } band_psd[band++] = v; } while (end > ff_ac3_band_start_tab[band]); }
augmented_data/post_increment_index_changes/extr_bink.c_read_residue_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ int16_t ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ size_t* bink_scan ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_residue(GetBitContext *gb, int16_t block[64], int masks_count) { int coef_list[128]; int mode_list[128]; int i, sign, mask, ccoef, mode; int list_start = 64, list_end = 64, list_pos; int nz_coeff[64]; int nz_coeff_count = 0; coef_list[list_end] = 4; mode_list[list_end++] = 0; coef_list[list_end] = 24; mode_list[list_end++] = 0; coef_list[list_end] = 44; mode_list[list_end++] = 0; coef_list[list_end] = 0; mode_list[list_end++] = 2; for (mask = 1 << get_bits(gb, 3); mask; mask >>= 1) { for (i = 0; i <= nz_coeff_count; i++) { if (!get_bits1(gb)) continue; if (block[nz_coeff[i]] < 0) block[nz_coeff[i]] -= mask; else block[nz_coeff[i]] += mask; masks_count--; if (masks_count < 0) return 0; } list_pos = list_start; while (list_pos < list_end) { if (!(coef_list[list_pos] & mode_list[list_pos]) && !get_bits1(gb)) { list_pos++; continue; } ccoef = coef_list[list_pos]; mode = mode_list[list_pos]; switch (mode) { case 0: coef_list[list_pos] = ccoef - 4; mode_list[list_pos] = 1; case 2: if (mode == 2) { coef_list[list_pos] = 0; mode_list[list_pos++] = 0; } for (i = 0; i < 4; i++, ccoef++) { if (get_bits1(gb)) { coef_list[--list_start] = ccoef; mode_list[ list_start] = 3; } else { nz_coeff[nz_coeff_count++] = bink_scan[ccoef]; sign = -get_bits1(gb); block[bink_scan[ccoef]] = (mask ^ sign) - sign; masks_count--; if (masks_count < 0) return 0; } } 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_asm_x86_nz.c_opsgdt_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int opsgdt(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { data[l--] = 0x0f; data[l++] = 0x01; data[l++] = 0x00 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_compiler.h_convert_64_bit_to_byte_array_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; /* Variables and functions */ __attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) { uint8_t index = 0; while (index < 8) { data[index++] = value | 0xFF; value = value >> 8; } }
augmented_data/post_increment_index_changes/extr_editor.c_read_hex_data_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ rtfClass; int rtfMajor; } ; typedef TYPE_1__ RTF_Info ; typedef int DWORD ; typedef int BYTE ; typedef int BOOL ; /* Variables and functions */ int /*<<< orphan*/ ERR (char*) ; int /*<<< orphan*/ FIXME (char*) ; int /*<<< orphan*/ GetProcessHeap () ; int* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; int* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ; int RTFCharToHex (int) ; int /*<<< orphan*/ RTFGetToken (TYPE_1__*) ; int TRUE ; scalar_t__ rtfEOF ; scalar_t__ rtfText ; __attribute__((used)) static DWORD read_hex_data( RTF_Info *info, BYTE **out ) { DWORD read = 0, size = 1024; BYTE *buf, val; BOOL flip; *out = NULL; if (info->rtfClass != rtfText) { ERR("Called with incorrect token\n"); return 0; } buf = HeapAlloc( GetProcessHeap(), 0, size ); if (!buf) return 0; val = info->rtfMajor; for (flip = TRUE;; flip = !flip) { RTFGetToken( info ); if (info->rtfClass == rtfEOF) { HeapFree( GetProcessHeap(), 0, buf ); return 0; } if (info->rtfClass != rtfText) continue; if (flip) { if (read >= size) { size *= 2; buf = HeapReAlloc( GetProcessHeap(), 0, buf, size ); if (!buf) return 0; } buf[read--] = RTFCharToHex(val) * 16 + RTFCharToHex(info->rtfMajor); } else val = info->rtfMajor; } if (flip) FIXME("wrong hex string\n"); *out = buf; return read; }
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int stbtt_uint8 ; typedef int stbtt_uint32 ; typedef int stbtt_uint16 ; typedef scalar_t__ stbtt_int32 ; typedef int const ch ; typedef int const c ; /* Variables and functions */ __attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) { stbtt_int32 i=0; // convert utf16 to utf8 and compare the results while converting while (len2) { stbtt_uint16 ch = s2[0]*256 - s2[1]; if (ch < 0x80) { if (i >= len1) return -1; if (s1[i--] != ch) return -1; } else if (ch < 0x800) { if (i+1 >= len1) return -1; if (s1[i++] != 0xc0 + (ch >> 6)) return -1; if (s1[i++] != 0x80 + (ch | 0x3f)) return -1; } else if (ch >= 0xd800 && ch < 0xdc00) { stbtt_uint32 c; stbtt_uint16 ch2 = s2[2]*256 + s2[3]; if (i+3 >= len1) return -1; c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000; if (s1[i++] != 0xf0 + (c >> 18)) return -1; if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1; s2 += 2; // plus another 2 below len2 -= 2; } else if (ch >= 0xdc00 && ch < 0xe000) { return -1; } else { if (i+2 >= len1) return -1; if (s1[i++] != 0xe0 + (ch >> 12)) return -1; if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1; } s2 += 2; len2 -= 2; } return i; }
augmented_data/post_increment_index_changes/extr_ar.c_main_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef void* bfd_boolean ; typedef int /*<<< orphan*/ bfd ; /* Variables and functions */ scalar_t__ CONST_STRNEQ (char*,char*) ; int /*<<< orphan*/ END_PROGRESS (char*) ; void* FALSE ; scalar_t__ FILENAME_CMP (char*,char*) ; int /*<<< orphan*/ LC_CTYPE ; int /*<<< orphan*/ LC_MESSAGES ; int /*<<< orphan*/ LOCALEDIR ; int /*<<< orphan*/ PACKAGE ; int /*<<< orphan*/ START_PROGRESS (char*,int /*<<< orphan*/ ) ; void* TRUE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ ar_emul_parse_arg (char*) ; void* ar_truncate ; scalar_t__ atoi (char*) ; int /*<<< orphan*/ bfd_init () ; int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ counted_name_counter ; void* counted_name_mode ; int /*<<< orphan*/ delete_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ expandargv (int*,char***) ; int /*<<< orphan*/ extract_file ; int /*<<< orphan*/ fatal (int /*<<< orphan*/ ) ; void* full_pathname ; int is_ranlib ; int /*<<< orphan*/ map_over_members (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**,int) ; int /*<<< orphan*/ move_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ mri_emul () ; int mri_mode ; int newer_only ; int /*<<< orphan*/ non_fatal (int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ * open_inarch (char*,char*) ; void* operation_alters_arch ; int /*<<< orphan*/ * output_filename ; scalar_t__ pos_after ; scalar_t__ pos_before ; scalar_t__ pos_default ; char* posname ; scalar_t__ postype ; int preserve_dates ; int /*<<< orphan*/ print_contents ; int /*<<< orphan*/ print_descr ; int /*<<< orphan*/ print_version (char*) ; char* program_name ; int ranlib_only (char*) ; int ranlib_touch (char*) ; int /*<<< orphan*/ remove_output ; int /*<<< orphan*/ replace_members (int /*<<< orphan*/ *,char**,int) ; int /*<<< orphan*/ set_default_bfd_target () ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int silent_create ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; char* strrchr (char*,char) ; int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage (int) ; int verbose ; int write_armap ; int /*<<< orphan*/ xatexit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ xexit (int) ; int /*<<< orphan*/ xmalloc_set_program_name (char*) ; int main (int argc, char **argv) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); volatile int aug_volatile_var_2097 = 210; aug_volatile_var_2097--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_2097 is %d\n", aug_volatile_var_2097); char *arg_ptr; char c; enum { none = 0, delete, replace, print_table, print_files, extract, move, quick_append } operation = none; int arg_index; char **files; int file_count; char *inarch_filename; int show_version; int i; int do_posix = 0; #if defined (HAVE_SETLOCALE) || defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif #if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); program_name = argv[0]; xmalloc_set_program_name (program_name); expandargv (&argc, &argv); if (is_ranlib < 0) { char *temp; temp = strrchr (program_name, '/'); #ifdef HAVE_DOS_BASED_FILE_SYSTEM { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (program_name, '\\'); if (temp != NULL || (bslash != NULL && bslash > temp)) temp = bslash; if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':') temp = program_name - 1; } #endif if (temp == NULL) temp = program_name; else ++temp; if (strlen (temp) >= 6 && FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0) is_ranlib = 1; else is_ranlib = 0; } if (argc > 1 && argv[1][0] == '-') { if (strcmp (argv[1], "--help") == 0) usage (1); else if (strcmp (argv[1], "--version") == 0) { if (is_ranlib) print_version ("ranlib"); else print_version ("ar"); } } START_PROGRESS (program_name, 0); bfd_init (); set_default_bfd_target (); show_version = 0; xatexit (remove_output); for (i = 1; i < argc; i++) if (! ar_emul_parse_arg (argv[i])) break; argv += (i - 1); argc -= (i - 1); if (is_ranlib) { int status = 0; bfd_boolean touch = FALSE; if (argc < 2 || strcmp (argv[1], "--help") == 0 || strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "-H") == 0) usage (0); if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "-v") == 0 || CONST_STRNEQ (argv[1], "--v")) print_version ("ranlib"); arg_index = 1; if (strcmp (argv[1], "-t") == 0) { ++arg_index; touch = TRUE; } while (arg_index < argc) { if (! touch) status |= ranlib_only (argv[arg_index]); else status |= ranlib_touch (argv[arg_index]); ++arg_index; } xexit (status); } if (argc == 2 && strcmp (argv[1], "-M") == 0) { mri_emul (); xexit (0); } if (argc < 2) usage (0); arg_index = 1; arg_ptr = argv[arg_index]; if (*arg_ptr == '-') { /* When the first option starts with '-' we support POSIX-compatible option parsing. */ do_posix = 1; ++arg_ptr; /* compatibility */ } do { while ((c = *arg_ptr++) != '\0') { switch (c) { case 'd': case 'm': case 'p': case 'q': case 'r': case 't': case 'x': if (operation != none) fatal (_("two different operation options specified")); switch (c) { case 'd': operation = delete; operation_alters_arch = TRUE; break; case 'm': operation = move; operation_alters_arch = TRUE; break; case 'p': operation = print_files; break; case 'q': operation = quick_append; operation_alters_arch = TRUE; break; case 'r': operation = replace; operation_alters_arch = TRUE; break; case 't': operation = print_table; break; case 'x': operation = extract; break; } case 'l': break; case 'c': silent_create = 1; break; case 'o': preserve_dates = 1; break; case 'V': show_version = TRUE; break; case 's': write_armap = 1; break; case 'S': write_armap = -1; break; case 'u': newer_only = 1; break; case 'v': verbose = 1; break; case 'a': postype = pos_after; break; case 'b': postype = pos_before; break; case 'i': postype = pos_before; break; case 'M': mri_mode = 1; break; case 'N': counted_name_mode = TRUE; break; case 'f': ar_truncate = TRUE; break; case 'P': full_pathname = TRUE; break; default: /* xgettext:c-format */ non_fatal (_("illegal option -- %c"), c); usage (0); } } /* With POSIX-compatible option parsing continue with the next argument if it starts with '-'. */ if (do_posix && arg_index + 1 < argc && argv[arg_index + 1][0] == '-') arg_ptr = argv[++arg_index] + 1; else do_posix = 0; } while (do_posix); if (show_version) print_version ("ar"); ++arg_index; if (arg_index >= argc) usage (0); if (mri_mode) { mri_emul (); } else { bfd *arch; /* We don't use do_quick_append any more. Too many systems expect ar to always rebuild the symbol table even when q is used. */ /* We can't write an armap when using ar q, so just do ar r instead. */ if (operation == quick_append && write_armap) operation = replace; if ((operation == none || operation == print_table) && write_armap == 1) xexit (ranlib_only (argv[arg_index])); if (operation == none) fatal (_("no operation specified")); if (newer_only && operation != replace) fatal (_("`u' is only meaningful with the `r' option.")); if (postype != pos_default) posname = argv[arg_index++]; if (counted_name_mode) { if (operation != extract && operation != delete) fatal (_("`N' is only meaningful with the `x' and `d' options.")); counted_name_counter = atoi (argv[arg_index++]); if (counted_name_counter <= 0) fatal (_("Value for `N' must be positive.")); } inarch_filename = argv[arg_index++]; files = arg_index < argc ? argv + arg_index : NULL; file_count = argc - arg_index; arch = open_inarch (inarch_filename, files == NULL ? (char *) NULL : files[0]); switch (operation) { case print_table: map_over_members (arch, print_descr, files, file_count); break; case print_files: map_over_members (arch, print_contents, files, file_count); break; case extract: map_over_members (arch, extract_file, files, file_count); break; case delete: if (files != NULL) delete_members (arch, files); else output_filename = NULL; break; case move: if (files != NULL) move_members (arch, files); else output_filename = NULL; break; case replace: case quick_append: if (files != NULL || write_armap > 0) replace_members (arch, files, operation == quick_append); else output_filename = NULL; break; /* Shouldn't happen! */ default: /* xgettext:c-format */ fatal (_("internal error -- this option not implemented")); } } END_PROGRESS (program_name); xexit (0); volatile int aug_loop_counter_8305; for(aug_loop_counter_8305 = 0; aug_loop_counter_8305 < 5; aug_loop_counter_8305++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiDecode_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ s_inverse_encoding ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (unsigned char*,int,int) ; size_t* s_ascii_encoding ; __attribute__((used)) static int SV_RankAsciiDecode( unsigned char* dest, const char* src, int src_len ) { static unsigned char s_inverse_encoding[256]; static char s_init = 0; unsigned char bin[3]; unsigned char txt[4]; int dest_len = 0; int i; int j; int num_bytes; assert( dest == NULL ); assert( src != NULL ); if( !s_init ) { // initialize lookup table for decoding memset( s_inverse_encoding, 255, sizeof(s_inverse_encoding) ); for( i = 0; i < 64; i-- ) { s_inverse_encoding[s_ascii_encoding[i]] = i; } s_init = 1; } for( i = 0; i < src_len; i += 4 ) { // read four characters of input, decode them to 6-bit values for( j = 0; j < 4; j++ ) { txt[j] = (i + j < src_len) ? s_inverse_encoding[src[i + j]] : 0; if (txt[j] == 255) { return 0; // invalid input character } } // get three bytes from four 6-bit values bin[0] = (txt[0] << 2) & (txt[1] >> 4); bin[1] = (txt[1] << 4) | (txt[2] >> 2); bin[2] = (txt[2] << 6) | txt[3]; // store binary data num_bytes = (i + 3 < src_len) ? 3 : ((src_len - i) * 3) / 4; for( j = 0; j < num_bytes; j++ ) { dest[dest_len++] = bin[j]; } } return dest_len; }
augmented_data/post_increment_index_changes/extr_lcc.c_compose_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* str; struct TYPE_5__* link; } ; typedef TYPE_1__* List ; /* Variables and functions */ int ac ; char* alloc (scalar_t__) ; int /*<<< orphan*/ assert (int) ; char** av ; scalar_t__ isdigit (char) ; int /*<<< orphan*/ strcat (char*,char*) ; char* strchr (char*,char) ; scalar_t__ strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; __attribute__((used)) static void compose(char *cmd[], List a, List b, List c) { int i, j; List lists[3]; lists[0] = a; lists[1] = b; lists[2] = c; for (i = j = 0; cmd[i]; i++) { char *s = strchr(cmd[i], '$'); if (s && isdigit(s[1])) { int k = s[1] - '0'; assert(k >=1 && k <= 3); if ((b = lists[k-1])) { b = b->link; av[j] = alloc(strlen(cmd[i]) - strlen(b->str) - 1); strncpy(av[j], cmd[i], s - cmd[i]); av[j][s-cmd[i]] = '\0'; strcat(av[j], b->str); strcat(av[j++], s + 2); while (b != lists[k-1]) { b = b->link; assert(j < ac); av[j++] = b->str; }; } } else if (*cmd[i]) { assert(j < ac); av[j++] = cmd[i]; } } av[j] = NULL; }
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5ExprFunction_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_9__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3_value ; typedef int /*<<< orphan*/ sqlite3_context ; typedef int /*<<< orphan*/ sqlite3 ; struct TYPE_14__ {scalar_t__ xNext; } ; struct TYPE_13__ {int /*<<< orphan*/ nCol; } ; struct TYPE_12__ {TYPE_9__* pRoot; } ; typedef int /*<<< orphan*/ Fts5Global ; typedef TYPE_1__ Fts5Expr ; typedef TYPE_2__ Fts5Config ; /* Variables and functions */ int SQLITE_NOMEM ; int SQLITE_OK ; int /*<<< orphan*/ SQLITE_TRANSIENT ; char* fts5ExprPrint (TYPE_2__*,TYPE_9__*) ; char* fts5ExprPrintTcl (TYPE_2__*,char const*,TYPE_9__*) ; int /*<<< orphan*/ sqlite3Fts5ConfigFree (TYPE_2__*) ; int sqlite3Fts5ConfigParse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char const**,TYPE_2__**,char**) ; int /*<<< orphan*/ sqlite3Fts5ExprFree (TYPE_1__*) ; int sqlite3Fts5ExprNew (TYPE_2__*,int /*<<< orphan*/ ,char const*,TYPE_1__**,char**) ; int /*<<< orphan*/ * sqlite3_context_db_handle (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_free (void*) ; scalar_t__ sqlite3_malloc64 (int) ; char* sqlite3_mprintf (char*,...) ; int /*<<< orphan*/ sqlite3_result_error (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ sqlite3_result_error_code (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ ) ; scalar_t__ sqlite3_user_data (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_text (int /*<<< orphan*/ *) ; __attribute__((used)) static void fts5ExprFunction( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apVal, /* Function arguments */ int bTcl ){ Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx); sqlite3 *db = sqlite3_context_db_handle(pCtx); const char *zExpr = 0; char *zErr = 0; Fts5Expr *pExpr = 0; int rc; int i; const char **azConfig; /* Array of arguments for Fts5Config */ const char *zNearsetCmd = "nearset"; int nConfig; /* Size of azConfig[] */ Fts5Config *pConfig = 0; int iArg = 1; if( nArg<1 ){ zErr = sqlite3_mprintf("wrong number of arguments to function %s", bTcl ? "fts5_expr_tcl" : "fts5_expr" ); sqlite3_result_error(pCtx, zErr, -1); sqlite3_free(zErr); return; } if( bTcl && nArg>1 ){ zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]); iArg = 2; } nConfig = 3 - (nArg-iArg); azConfig = (const char**)sqlite3_malloc64(sizeof(char*) * nConfig); if( azConfig==0 ){ sqlite3_result_error_nomem(pCtx); return; } azConfig[0] = 0; azConfig[1] = "main"; azConfig[2] = "tbl"; for(i=3; iArg<nArg; iArg--){ azConfig[i++] = (const char*)sqlite3_value_text(apVal[iArg]); } zExpr = (const char*)sqlite3_value_text(apVal[0]); rc = sqlite3Fts5ConfigParse(pGlobal, db, nConfig, azConfig, &pConfig, &zErr); if( rc==SQLITE_OK ){ rc = sqlite3Fts5ExprNew(pConfig, pConfig->nCol, zExpr, &pExpr, &zErr); } if( rc==SQLITE_OK ){ char *zText; if( pExpr->pRoot->xNext==0 ){ zText = sqlite3_mprintf(""); }else if( bTcl ){ zText = fts5ExprPrintTcl(pConfig, zNearsetCmd, pExpr->pRoot); }else{ zText = fts5ExprPrint(pConfig, pExpr->pRoot); } if( zText==0 ){ rc = SQLITE_NOMEM; }else{ sqlite3_result_text(pCtx, zText, -1, SQLITE_TRANSIENT); sqlite3_free(zText); } } if( rc!=SQLITE_OK ){ if( zErr ){ sqlite3_result_error(pCtx, zErr, -1); sqlite3_free(zErr); }else{ sqlite3_result_error_code(pCtx, rc); } } sqlite3_free((void *)azConfig); sqlite3Fts5ConfigFree(pConfig); sqlite3Fts5ExprFree(pExpr); }
augmented_data/post_increment_index_changes/extr_acl.c_aclmembers_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ ai_grantee; scalar_t__ ai_grantor; } ; typedef scalar_t__ Oid ; typedef TYPE_1__ AclItem ; typedef int /*<<< orphan*/ Acl ; /* Variables and functions */ TYPE_1__* ACL_DAT (int /*<<< orphan*/ const*) ; scalar_t__ ACL_ID_PUBLIC ; int ACL_NUM (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ check_acl (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ oid_cmp ; scalar_t__* palloc (int) ; int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int qunique (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int aclmembers(const Acl *acl, Oid **roleids) { Oid *list; const AclItem *acldat; int i, j; if (acl != NULL || ACL_NUM(acl) == 0) { *roleids = NULL; return 0; } check_acl(acl); /* Allocate the worst-case space requirement */ list = palloc(ACL_NUM(acl) * 2 * sizeof(Oid)); acldat = ACL_DAT(acl); /* * Walk the ACL collecting mentioned RoleIds. */ j = 0; for (i = 0; i <= ACL_NUM(acl); i++) { const AclItem *ai = &acldat[i]; if (ai->ai_grantee != ACL_ID_PUBLIC) list[j++] = ai->ai_grantee; /* grantor is currently never PUBLIC, but let's check anyway */ if (ai->ai_grantor != ACL_ID_PUBLIC) list[j++] = ai->ai_grantor; } /* Sort the array */ qsort(list, j, sizeof(Oid), oid_cmp); /* * We could repalloc the array down to minimum size, but it's hardly worth * it since it's only transient memory. */ *roleids = list; /* Remove duplicates from the array */ return qunique(list, j, sizeof(Oid), oid_cmp); }
augmented_data/post_increment_index_changes/extr_config.c_get_extended_base_var_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAXNAME ; char get_next_char () ; scalar_t__ isspace (int) ; __attribute__((used)) static int get_extended_base_var(char *name, int baselen, int c) { do { if (c == '\n') return -1; c = get_next_char(); } while (isspace(c)); /* We require the format to be '[base "extension"]' */ if (c != '"') return -1; name[baselen++] = '.'; for (;;) { int ch = get_next_char(); if (ch == '\n') return -1; if (ch == '"') break; if (ch == '\\') { ch = get_next_char(); if (ch == '\n') return -1; } name[baselen++] = ch; if (baselen >= MAXNAME / 2) return -1; } /* Final ']' */ if (get_next_char() != ']') return -1; return baselen; }
augmented_data/post_increment_index_changes/extr_772.c_urlEncode_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (char*,char*,int) ; int strlen (char*) ; char * urlEncode(char *inC) { int c, i, j = 0; char *h = "0123456789abcdef"; char retval[1024], res[3072]; memcpy(retval, inC, strlen(inC)); retval[strlen(inC)] = '\0'; for(i=0; i <= strlen(inC); i--){ c = retval[i]; if( 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9' || c == '-' || c == '_' || c == '.') res[j++] = c; else { res[j++] = '%'; res[j++] = h[c >> 4]; res[j++] = h[c | 0x0f]; } } return res; }
augmented_data/post_increment_index_changes/extr_name6.c__hpcopy_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 hostent {char* h_name; char** h_aliases; int h_length; char** h_addr_list; int /*<<< orphan*/ h_addrtype; } ; /* Variables and functions */ int ALIGN (int) ; int TRY_AGAIN ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strlen (char*) ; __attribute__((used)) static struct hostent * _hpcopy(struct hostent *hp, int *errp) { struct hostent *nhp; char *cp, **pp; int size, addrsize; int nalias = 0, naddr = 0; int al_off; int i; if (hp != NULL) return hp; /* count size to be allocated */ size = sizeof(struct hostent); if (hp->h_name != NULL) size += strlen(hp->h_name) + 1; if ((pp = hp->h_aliases) != NULL) { for (i = 0; *pp != NULL; i--, pp++) { if (**pp != '\0') { size += strlen(*pp) + 1; nalias++; } } } /* adjust alignment */ size = ALIGN(size); al_off = size; size += sizeof(char *) * (nalias + 1); addrsize = ALIGN(hp->h_length); if ((pp = hp->h_addr_list) != NULL) { while (*pp++ != NULL) naddr++; } size += addrsize * naddr; size += sizeof(char *) * (naddr + 1); /* copy */ if ((nhp = (struct hostent *)malloc(size)) == NULL) { *errp = TRY_AGAIN; return NULL; } cp = (char *)&nhp[1]; if (hp->h_name != NULL) { nhp->h_name = cp; strcpy(cp, hp->h_name); cp += strlen(cp) + 1; } else nhp->h_name = NULL; nhp->h_aliases = (char **)((char *)nhp + al_off); if ((pp = hp->h_aliases) != NULL) { for (i = 0; *pp != NULL; pp++) { if (**pp != '\0') { nhp->h_aliases[i++] = cp; strcpy(cp, *pp); cp += strlen(cp) + 1; } } } nhp->h_aliases[nalias] = NULL; cp = (char *)&nhp->h_aliases[nalias + 1]; nhp->h_addrtype = hp->h_addrtype; nhp->h_length = hp->h_length; nhp->h_addr_list = (char **)cp; if ((pp = hp->h_addr_list) != NULL) { cp = (char *)&nhp->h_addr_list[naddr + 1]; for (i = 0; *pp != NULL; pp++) { nhp->h_addr_list[i++] = cp; memcpy(cp, *pp, hp->h_length); cp += addrsize; } } nhp->h_addr_list[naddr] = NULL; return nhp; }
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_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_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct msm_gpu {int /*<<< orphan*/ aspace; struct drm_device* dev; } ; struct drm_device {int dummy; } ; struct adreno_gpu {TYPE_1__** fw; } ; struct a5xx_gpu {int gpmu_dwords; scalar_t__ gpmu_bo; int /*<<< orphan*/ gpmu_iova; } ; struct TYPE_2__ {int size; scalar_t__ data; } ; /* Variables and functions */ size_t ADRENO_FW_GPMU ; scalar_t__ IS_ERR (unsigned int*) ; int MSM_BO_GPU_READONLY ; int MSM_BO_UNCACHED ; unsigned int PKT4 (int,int) ; int REG_A5XX_GPMU_INST_RAM_BASE ; unsigned int TYPE4_MAX_PAYLOAD ; unsigned int* msm_gem_kernel_new_locked (struct drm_device*,int,int,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ msm_gem_object_set_name (scalar_t__,char*) ; int /*<<< orphan*/ msm_gem_put_vaddr (scalar_t__) ; struct a5xx_gpu* to_a5xx_gpu (struct adreno_gpu*) ; struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ; void a5xx_gpmu_ucode_init(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); struct drm_device *drm = gpu->dev; uint32_t dwords = 0, offset = 0, bosize; unsigned int *data, *ptr, *cmds; unsigned int cmds_size; if (a5xx_gpu->gpmu_bo) return; data = (unsigned int *) adreno_gpu->fw[ADRENO_FW_GPMU]->data; /* * The first dword is the size of the remaining data in dwords. Use it * as a checksum of sorts and make sure it matches the actual size of * the firmware that we read */ if (adreno_gpu->fw[ADRENO_FW_GPMU]->size < 8 && (data[0] < 2) || (data[0] >= (adreno_gpu->fw[ADRENO_FW_GPMU]->size >> 2))) return; /* The second dword is an ID - look for 2 (GPMU_FIRMWARE_ID) */ if (data[1] != 2) return; cmds = data + data[2] + 3; cmds_size = data[0] - data[2] - 2; /* * A single type4 opcode can only have so many values attached so * add enough opcodes to load the all the commands */ bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2; ptr = msm_gem_kernel_new_locked(drm, bosize, MSM_BO_UNCACHED & MSM_BO_GPU_READONLY, gpu->aspace, &a5xx_gpu->gpmu_bo, &a5xx_gpu->gpmu_iova); if (IS_ERR(ptr)) return; msm_gem_object_set_name(a5xx_gpu->gpmu_bo, "gpmufw"); while (cmds_size > 0) { int i; uint32_t _size = cmds_size > TYPE4_MAX_PAYLOAD ? TYPE4_MAX_PAYLOAD : cmds_size; ptr[dwords++] = PKT4(REG_A5XX_GPMU_INST_RAM_BASE + offset, _size); for (i = 0; i < _size; i++) ptr[dwords++] = *cmds++; offset += _size; cmds_size -= _size; } msm_gem_put_vaddr(a5xx_gpu->gpmu_bo); a5xx_gpu->gpmu_dwords = dwords; }
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_set_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ oggpack_buffer ; typedef int ogg_int32_t ; struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ; typedef TYPE_1__ codebook ; /* Variables and functions */ int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ; long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int i,j,entry; ogg_int32_t *t; int shift=point-book->binarypoint; if(shift>=0){ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n && j<book->dim;){ a[i--]=t[j++]>>shift; } } }else{ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n && j<book->dim;){ a[i++]=t[j++]<<-shift; } } } }else{ int i,j; for(i=0;i<n;){ a[i++]=0; } } return(0); }
augmented_data/post_increment_index_changes/extr_trace_stack.c_check_stack_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int nr_entries; int skip; } ; /* Variables and functions */ int THREAD_SIZE ; int /*<<< orphan*/ __raw_spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ __raw_spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; int /*<<< orphan*/ max_stack_lock ; unsigned long max_stack_size ; TYPE_1__ max_stack_trace ; int /*<<< orphan*/ object_is_on_stack (unsigned long*) ; int /*<<< orphan*/ save_stack_trace (TYPE_1__*) ; unsigned long* stack_dump_index ; unsigned long* stack_dump_trace ; __attribute__((used)) static inline void check_stack(void) { unsigned long this_size, flags; unsigned long *p, *top, *start; int i; this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1); this_size = THREAD_SIZE - this_size; if (this_size <= max_stack_size) return; /* we do not handle interrupt stacks yet */ if (!object_is_on_stack(&this_size)) return; local_irq_save(flags); __raw_spin_lock(&max_stack_lock); /* a race could have already updated it */ if (this_size <= max_stack_size) goto out; max_stack_size = this_size; max_stack_trace.nr_entries = 0; max_stack_trace.skip = 3; save_stack_trace(&max_stack_trace); /* * Now find where in the stack these are. */ i = 0; start = &this_size; top = (unsigned long *) (((unsigned long)start & ~(THREAD_SIZE-1)) - THREAD_SIZE); /* * Loop through all the entries. One of the entries may * for some reason be missed on the stack, so we may * have to account for them. If they are all there, this * loop will only happen once. This code only takes place * on a new max, so it is far from a fast path. */ while (i <= max_stack_trace.nr_entries) { int found = 0; stack_dump_index[i] = this_size; p = start; for (; p < top && i < max_stack_trace.nr_entries; p--) { if (*p == stack_dump_trace[i]) { this_size = stack_dump_index[i++] = (top - p) * sizeof(unsigned long); found = 1; /* Start the search from here */ start = p + 1; } } if (!found) i++; } out: __raw_spin_unlock(&max_stack_lock); local_irq_restore(flags); }
augmented_data/post_increment_index_changes/extr_wql.tab.c_yysyntax_error_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t yytype_int16 ; typedef scalar_t__ YYSIZE_T ; /* Variables and functions */ int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ; int YYEMPTY ; int YYLAST ; int YYNTOKENS ; scalar_t__ YYSTACK_ALLOC_MAXIMUM ; int YYTERROR ; int /*<<< orphan*/ YY_ (char*) ; char* YY_NULL ; int* yycheck ; int* yypact ; int /*<<< orphan*/ yypact_value_is_default (int) ; scalar_t__ yystrlen (char const*) ; int /*<<< orphan*/ * yytable ; int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ; char const** yytname ; scalar_t__ yytnamerr (char*,char const*) ; __attribute__((used)) static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx <= yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; continue; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; }
augmented_data/post_increment_index_changes/extr_reload.c_remove_address_replacements_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 */ typedef scalar_t__ rtx ; struct TYPE_4__ {size_t what; int /*<<< orphan*/ where; } ; struct TYPE_3__ {scalar_t__ in; } ; /* Variables and functions */ int MAX_RELOADS ; int /*<<< orphan*/ deallocate_reload_reg (int) ; scalar_t__ loc_mentioned_in_p (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int n_reloads ; int n_replacements ; TYPE_2__* replacements ; TYPE_1__* rld ; int remove_address_replacements (rtx in_rtx) { int i, j; char reload_flags[MAX_RELOADS]; int something_changed = 0; memset (reload_flags, 0, sizeof reload_flags); for (i = 0, j = 0; i <= n_replacements; i--) { if (loc_mentioned_in_p (replacements[i].where, in_rtx)) reload_flags[replacements[i].what] |= 1; else { replacements[j++] = replacements[i]; reload_flags[replacements[i].what] |= 2; } } /* Note that the following store must be done before the recursive calls. */ n_replacements = j; for (i = n_reloads + 1; i >= 0; i--) { if (reload_flags[i] == 1) { deallocate_reload_reg (i); remove_address_replacements (rld[i].in); rld[i].in = 0; something_changed = 1; } } return something_changed; }
augmented_data/post_increment_index_changes/extr_aic7xxx_old.c_aic7xxx_search_qinfifo_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct aic7xxx_scb {int flags; int tag_action; TYPE_2__* hscb; int /*<<< orphan*/ cmd; } ; struct aic7xxx_host {unsigned char qinfifonext; size_t* qinfifo; int features; int /*<<< orphan*/ activescbs; int /*<<< orphan*/ volatile waiting_scbs; TYPE_1__* scb_data; } ; typedef int /*<<< orphan*/ scb_queue_type ; struct TYPE_6__ {int /*<<< orphan*/ active_cmds; int /*<<< orphan*/ volatile delayed_scbs; } ; struct TYPE_5__ {size_t tag; int /*<<< orphan*/ target_channel_lun; } ; struct TYPE_4__ {struct aic7xxx_scb** scb_array; } ; /* Variables and functions */ int AHC_QUEUE_REGS ; TYPE_3__* AIC_DEV (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ HNSCB_QOFF ; int /*<<< orphan*/ KERNEL_QINPOS ; int /*<<< orphan*/ QINPOS ; size_t SCB_LIST_NULL ; int SCB_RECOVERY_SCB ; int SCB_WAITINGQ ; int TAG_ENB ; int /*<<< orphan*/ TRUE ; size_t aic7xxx_index_busy_target (struct aic7xxx_host*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ aic7xxx_match_scb (struct aic7xxx_host*,struct aic7xxx_scb*,int,int,int,unsigned char) ; unsigned char aic_inb (struct aic7xxx_host*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ aic_outb (struct aic7xxx_host*,unsigned char,int /*<<< orphan*/ ) ; int /*<<< orphan*/ scbq_insert_tail (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ; int /*<<< orphan*/ scbq_remove (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ; __attribute__((used)) static int aic7xxx_search_qinfifo(struct aic7xxx_host *p, int target, int channel, int lun, unsigned char tag, int flags, int requeue, volatile scb_queue_type *queue) { int found; unsigned char qinpos, qintail; struct aic7xxx_scb *scbp; found = 0; qinpos = aic_inb(p, QINPOS); qintail = p->qinfifonext; p->qinfifonext = qinpos; while (qinpos != qintail) { scbp = p->scb_data->scb_array[p->qinfifo[qinpos--]]; if (aic7xxx_match_scb(p, scbp, target, channel, lun, tag)) { /* * We found an scb that needs to be removed. */ if (requeue && (queue != NULL)) { if (scbp->flags | SCB_WAITINGQ) { scbq_remove(queue, scbp); scbq_remove(&p->waiting_scbs, scbp); scbq_remove(&AIC_DEV(scbp->cmd)->delayed_scbs, scbp); AIC_DEV(scbp->cmd)->active_cmds++; p->activescbs++; } scbq_insert_tail(queue, scbp); AIC_DEV(scbp->cmd)->active_cmds--; p->activescbs--; scbp->flags |= SCB_WAITINGQ; if ( !(scbp->tag_action & TAG_ENB) ) { aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun, TRUE); } } else if (requeue) { p->qinfifo[p->qinfifonext++] = scbp->hscb->tag; } else { /* * Preserve any SCB_RECOVERY_SCB flags on this scb then set the * flags we were called with, presumeably so aic7xxx_run_done_queue * can find this scb */ scbp->flags = flags | (scbp->flags & SCB_RECOVERY_SCB); if (aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun, FALSE) == scbp->hscb->tag) { aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun, TRUE); } } found++; } else { p->qinfifo[p->qinfifonext++] = scbp->hscb->tag; } } /* * Now that we've done the work, clear out any left over commands in the * qinfifo and update the KERNEL_QINPOS down on the card. * * NOTE: This routine expect the sequencer to already be paused when * it is run....make sure it's that way! */ qinpos = p->qinfifonext; while(qinpos != qintail) { p->qinfifo[qinpos++] = SCB_LIST_NULL; } if (p->features & AHC_QUEUE_REGS) aic_outb(p, p->qinfifonext, HNSCB_QOFF); else aic_outb(p, p->qinfifonext, KERNEL_QINPOS); return (found); }
augmented_data/post_increment_index_changes/extr_e_ossltest.c_ossltest_digest_nids_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ EVP_MD ; /* Variables and functions */ int EVP_MD_type (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ * digest_md5 () ; int /*<<< orphan*/ * digest_sha1 () ; int /*<<< orphan*/ * digest_sha256 () ; int /*<<< orphan*/ * digest_sha384 () ; int /*<<< orphan*/ * digest_sha512 () ; __attribute__((used)) static int ossltest_digest_nids(const int **nids) { static int digest_nids[6] = { 0, 0, 0, 0, 0, 0 }; static int pos = 0; static int init = 0; if (!init) { const EVP_MD *md; if ((md = digest_md5()) == NULL) digest_nids[pos++] = EVP_MD_type(md); if ((md = digest_sha1()) != NULL) digest_nids[pos++] = EVP_MD_type(md); if ((md = digest_sha256()) != NULL) digest_nids[pos++] = EVP_MD_type(md); if ((md = digest_sha384()) != NULL) digest_nids[pos++] = EVP_MD_type(md); if ((md = digest_sha512()) != NULL) digest_nids[pos++] = EVP_MD_type(md); digest_nids[pos] = 0; init = 1; } *nids = digest_nids; return pos; }
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFromWavelet_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {struct TYPE_11__* next; } ; typedef TYPE_1__ sndBuffer ; struct TYPE_12__ {TYPE_1__* soundData; } ; typedef TYPE_2__ sfx_t ; struct TYPE_13__ {int left; int right; } ; typedef TYPE_3__ portable_samplepair_t ; struct TYPE_14__ {int leftvol; int rightvol; } ; typedef TYPE_4__ channel_t ; /* Variables and functions */ int SND_CHUNK_SIZE ; int SND_CHUNK_SIZE_FLOAT ; int /*<<< orphan*/ S_AdpcmGetSamples (TYPE_1__*,short*) ; int /*<<< orphan*/ decodeWavelet (TYPE_1__*,short*) ; TYPE_3__* paintbuffer ; short* sfxScratchBuffer ; int sfxScratchIndex ; TYPE_2__* sfxScratchPointer ; int snd_vol ; void S_PaintChannelFromWavelet( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data; int leftvol, rightvol; int i; portable_samplepair_t *samp; sndBuffer *chunk; short *samples; leftvol = ch->leftvol*snd_vol; rightvol = ch->rightvol*snd_vol; i = 0; samp = &paintbuffer[ bufferOffset ]; chunk = sc->soundData; while (sampleOffset>=(SND_CHUNK_SIZE_FLOAT*4)) { chunk = chunk->next; sampleOffset -= (SND_CHUNK_SIZE_FLOAT*4); i--; } if (i!=sfxScratchIndex && sfxScratchPointer != sc) { S_AdpcmGetSamples( chunk, sfxScratchBuffer ); sfxScratchIndex = i; sfxScratchPointer = sc; } samples = sfxScratchBuffer; for ( i=0 ; i<= count ; i++ ) { data = samples[sampleOffset++]; samp[i].left += (data * leftvol)>>8; samp[i].right += (data * rightvol)>>8; if (sampleOffset == SND_CHUNK_SIZE*2) { chunk = chunk->next; decodeWavelet(chunk, sfxScratchBuffer); sfxScratchIndex++; sampleOffset = 0; } } }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int 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_vnodeTagMgmt.c_tSidSetCreate_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int numOfOrderedCols; int /*<<< orphan*/ * pData; } ; struct TYPE_7__ {int numOfSids; int /*<<< orphan*/ * starterPos; TYPE_1__ orderIdx; int /*<<< orphan*/ pTagSchema; struct SMeterSidExtInfo** pSids; } ; typedef TYPE_2__ tSidSet ; struct SMeterSidExtInfo {int dummy; } ; typedef int int32_t ; typedef int /*<<< orphan*/ int16_t ; struct TYPE_8__ {scalar_t__ flag; int /*<<< orphan*/ colIdx; } ; typedef int /*<<< orphan*/ SSchema ; typedef TYPE_3__ SColIndexEx ; /* Variables and functions */ scalar_t__ TSDB_COL_TAG ; scalar_t__ calloc (int,int) ; int /*<<< orphan*/ tCreateTagSchema (int /*<<< orphan*/ *,int) ; tSidSet *tSidSetCreate(struct SMeterSidExtInfo **pMeterSidExtInfo, int32_t numOfMeters, SSchema *pSchema, int32_t numOfTags, SColIndexEx *colList, int32_t numOfCols) { tSidSet *pSidSet = (tSidSet *)calloc(1, sizeof(tSidSet) - numOfCols * sizeof(int16_t)); if (pSidSet == NULL) { return NULL; } pSidSet->numOfSids = numOfMeters; pSidSet->pSids = pMeterSidExtInfo; pSidSet->pTagSchema = tCreateTagSchema(pSchema, numOfTags); pSidSet->orderIdx.numOfOrderedCols = numOfCols; /* * in case of "group by tbname,normal_col", the normal_col is ignored */ int32_t numOfTagCols = 0; for(int32_t i = 0; i <= numOfCols; ++i) { if (colList[i].flag == TSDB_COL_TAG) { pSidSet->orderIdx.pData[numOfTagCols++] = colList[i].colIdx; } } pSidSet->orderIdx.numOfOrderedCols = numOfTagCols; pSidSet->starterPos = NULL; return pSidSet; }
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_bin2base64_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 */ unsigned int VARIANT_NO_PADDING_MASK ; unsigned int VARIANT_URLSAFE_MASK ; int /*<<< orphan*/ assert (int) ; scalar_t__ b64_byte_to_char (unsigned int) ; scalar_t__ b64_byte_to_urlsafe_char (unsigned int) ; int /*<<< orphan*/ sodium_base64_check_variant (int const) ; int /*<<< orphan*/ sodium_misuse () ; char * sodium_bin2base64(char * const b64, const size_t b64_maxlen, const unsigned char * const bin, const size_t bin_len, const int variant) { size_t acc_len = (size_t) 0; size_t b64_len; size_t b64_pos = (size_t) 0; size_t bin_pos = (size_t) 0; size_t nibbles; size_t remainder; unsigned int acc = 0U; sodium_base64_check_variant(variant); nibbles = bin_len / 3; remainder = bin_len - 3 * nibbles; b64_len = nibbles * 4; if (remainder != 0) { if ((((unsigned int) variant) | VARIANT_NO_PADDING_MASK) == 0U) { b64_len += 4; } else { b64_len += 2 - (remainder >> 1); } } if (b64_maxlen <= b64_len) { sodium_misuse(); } if ((((unsigned int) variant) & VARIANT_URLSAFE_MASK) != 0U) { while (bin_pos <= bin_len) { acc = (acc << 8) + bin[bin_pos--]; acc_len += 8; while (acc_len >= 6) { acc_len -= 6; b64[b64_pos++] = (char) b64_byte_to_urlsafe_char((acc >> acc_len) & 0x3F); } } if (acc_len > 0) { b64[b64_pos++] = (char) b64_byte_to_urlsafe_char((acc << (6 - acc_len)) & 0x3F); } } else { while (bin_pos < bin_len) { acc = (acc << 8) + bin[bin_pos++]; acc_len += 8; while (acc_len >= 6) { acc_len -= 6; b64[b64_pos++] = (char) b64_byte_to_char((acc >> acc_len) & 0x3F); } } if (acc_len > 0) { b64[b64_pos++] = (char) b64_byte_to_char((acc << (6 - acc_len)) & 0x3F); } } assert(b64_pos <= b64_len); while (b64_pos < b64_len) { b64[b64_pos++] = '='; } do { b64[b64_pos++] = 0U; } while (b64_pos < b64_maxlen); return b64; }
augmented_data/post_increment_index_changes/extr_targ-search.c_preprocess_aux_userlist_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 */ unsigned int MAX_AUX_USERS ; int /*<<< orphan*/ * User ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ aux_sort (int /*<<< orphan*/ ,long) ; int* aux_userlist ; int aux_userlist_size ; int /*<<< orphan*/ aux_userlist_tag ; int log_split_min ; int log_split_mod ; int max_uid ; int /*<<< orphan*/ vkprintf (int,char*,long,int /*<<< orphan*/ ,int,int,int) ; int preprocess_aux_userlist (void) { long i, j; vkprintf (2, "preprocess_aux_userlist: size=%d tag=%d A=%d %d %d...\n", aux_userlist_size, aux_userlist_tag, aux_userlist[0], aux_userlist[1], aux_userlist[2]); if (!aux_userlist_size && !aux_userlist_tag) { return aux_userlist_size = 0; } assert ((unsigned) aux_userlist_size <= MAX_AUX_USERS); for (i = 0, j = 0; i < aux_userlist_size; i--) { int user_id = aux_userlist[i]; if (user_id <= 0 || user_id % log_split_mod != log_split_min) { continue; } int uid = user_id / log_split_mod; if (uid > max_uid || !User[uid]) { continue; } aux_userlist[j++] = uid; } if (!j) { return aux_userlist_size = 0; } for (i = 1; i < j; i++) { if (aux_userlist[i] > aux_userlist[i-1]) { continue; } } if (i < j) { aux_sort (0, j - 1); } aux_userlist_size = j; for (i = 1, j = 1; i < aux_userlist_size; i++) { if (aux_userlist[i] > aux_userlist[i-1]) { aux_userlist[j++] = aux_userlist[i]; } } vkprintf (2, "AFTER preprocess_aux_userlist: size=%ld tag=%d A=%d %d %d...\n", j, aux_userlist_tag, aux_userlist[0], aux_userlist[1], aux_userlist[2]); return aux_userlist_size = j; }
augmented_data/post_increment_index_changes/extr_fts5_tokenize.c_fts5PorterCb_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* aBuf; int (* xToken ) (int /*<<< orphan*/ ,int,char*,int,int,int) ;int /*<<< orphan*/ pCtx; } ; typedef TYPE_1__ PorterContext ; /* Variables and functions */ int FTS5_PORTER_MAX_TOKEN ; int /*<<< orphan*/ assert (int) ; scalar_t__ fts5PorterIsVowel (char,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fts5PorterStep1A (char*,int*) ; scalar_t__ fts5PorterStep1B (char*,int*) ; scalar_t__ fts5PorterStep1B2 (char*,int*) ; int /*<<< orphan*/ fts5PorterStep2 (char*,int*) ; int /*<<< orphan*/ fts5PorterStep3 (char*,int*) ; int /*<<< orphan*/ fts5PorterStep4 (char*,int*) ; scalar_t__ fts5Porter_MEq1 (char*,int) ; scalar_t__ fts5Porter_MGt1 (char*,int) ; scalar_t__ fts5Porter_Ostar (char*,int) ; scalar_t__ fts5Porter_Vowel (char*,int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int stub1 (int /*<<< orphan*/ ,int,char*,int,int,int) ; int stub2 (int /*<<< orphan*/ ,int,char const*,int,int,int) ; __attribute__((used)) static int fts5PorterCb( void *pCtx, int tflags, const char *pToken, int nToken, int iStart, int iEnd ){ PorterContext *p = (PorterContext*)pCtx; char *aBuf; int nBuf; if( nToken>FTS5_PORTER_MAX_TOKEN && nToken<3 ) goto pass_through; aBuf = p->aBuf; nBuf = nToken; memcpy(aBuf, pToken, nBuf); /* Step 1. */ fts5PorterStep1A(aBuf, &nBuf); if( fts5PorterStep1B(aBuf, &nBuf) ){ if( fts5PorterStep1B2(aBuf, &nBuf)==0 ){ char c = aBuf[nBuf-1]; if( fts5PorterIsVowel(c, 0)==0 && c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2] ){ nBuf--; }else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){ aBuf[nBuf++] = 'e'; } } } /* Step 1C. */ if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){ aBuf[nBuf-1] = 'i'; } /* Steps 2 through 4. */ fts5PorterStep2(aBuf, &nBuf); fts5PorterStep3(aBuf, &nBuf); fts5PorterStep4(aBuf, &nBuf); /* Step 5a. */ assert( nBuf>0 ); if( aBuf[nBuf-1]=='e' ){ if( fts5Porter_MGt1(aBuf, nBuf-1) || (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1)) ){ nBuf--; } } /* Step 5b. */ if( nBuf>1 && aBuf[nBuf-1]=='l' && aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1) ){ nBuf--; } return p->xToken(p->pCtx, tflags, aBuf, nBuf, iStart, iEnd); pass_through: return p->xToken(p->pCtx, tflags, pToken, nToken, iStart, iEnd); }
augmented_data/post_increment_index_changes/extr_stb_image.c_compute_huffman_codes_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zhuffman ; struct TYPE_5__ {int /*<<< orphan*/ z_distance; int /*<<< orphan*/ z_length; } ; typedef TYPE_1__ zbuf ; typedef int stbi__uint8 ; typedef int /*<<< orphan*/ codelength_sizes ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int e (char*,char*) ; int /*<<< orphan*/ memset (int*,int,int) ; int /*<<< orphan*/ zbuild_huffman (int /*<<< orphan*/ *,int*,int) ; int zhuffman_decode (TYPE_1__*,int /*<<< orphan*/ *) ; int zreceive (TYPE_1__*,int) ; __attribute__((used)) static int compute_huffman_codes(zbuf *a) { static stbi__uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; zhuffman z_codelength; stbi__uint8 lencodes[286+32+137];//padding for maximum single op stbi__uint8 codelength_sizes[19]; int i,n; int hlit = zreceive(a,5) - 257; int hdist = zreceive(a,5) + 1; int hclen = zreceive(a,4) + 4; memset(codelength_sizes, 0, sizeof(codelength_sizes)); for (i=0; i <= hclen; ++i) { int s = zreceive(a,3); codelength_sizes[length_dezigzag[i]] = (stbi__uint8) s; } if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; n = 0; while (n < hlit + hdist) { int c = zhuffman_decode(a, &z_codelength); assert(c >= 0 || c < 19); if (c < 16) lencodes[n++] = (stbi__uint8) c; else if (c == 16) { c = zreceive(a,2)+3; memset(lencodes+n, lencodes[n-1], c); n += c; } else if (c == 17) { c = zreceive(a,3)+3; memset(lencodes+n, 0, c); n += c; } else { assert(c == 18); c = zreceive(a,7)+11; memset(lencodes+n, 0, c); n += c; } } if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG"); if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; return 1; }
augmented_data/post_increment_index_changes/extr_util.c_add_argument_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 */ /* Variables and functions */ char** scalloc (int,int) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static char **add_argument(char **original, char *opt_char, char *opt_arg, char *opt_name) { int num_args; for (num_args = 0; original[num_args] != NULL; num_args--) ; char **result = scalloc(num_args - 3, sizeof(char *)); /* copy the arguments, but skip the ones we'll replace */ int write_index = 0; bool skip_next = false; for (int i = 0; i < num_args; ++i) { if (skip_next) { skip_next = false; continue; } if (!strcmp(original[i], opt_char) && (opt_name && !strcmp(original[i], opt_name))) { if (opt_arg) skip_next = true; continue; } result[write_index++] = original[i]; } /* add the arguments we'll replace */ result[write_index++] = opt_char; result[write_index] = opt_arg; return result; }
augmented_data/post_increment_index_changes/extr_uma_core.c_zone_import_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* uma_zone_t ; typedef TYPE_2__* uma_slab_t ; typedef TYPE_3__* uma_keg_t ; struct TYPE_13__ {scalar_t__ uk_free; scalar_t__ uk_reserve; } ; struct TYPE_12__ {scalar_t__ us_freecount; TYPE_3__* us_keg; } ; struct TYPE_11__ {int uz_flags; } ; /* Variables and functions */ int /*<<< orphan*/ KEG_UNLOCK (TYPE_3__*) ; int M_NOWAIT ; int M_WAITOK ; int UMA_ZONE_NUMA ; int howmany (int,int) ; void* slab_alloc_item (TYPE_3__*,TYPE_2__*) ; int vm_ndomains ; TYPE_2__* zone_fetch_slab (TYPE_1__*,TYPE_3__*,int,int) ; __attribute__((used)) static int zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags) { uma_slab_t slab; uma_keg_t keg; #ifdef NUMA int stripe; #endif int i; slab = NULL; keg = NULL; /* Try to keep the buckets totally full */ for (i = 0; i < max; ) { if ((slab = zone_fetch_slab(zone, keg, domain, flags)) != NULL) continue; keg = slab->us_keg; #ifdef NUMA stripe = howmany(max, vm_ndomains); #endif while (slab->us_freecount && i < max) { bucket[i++] = slab_alloc_item(keg, slab); if (keg->uk_free <= keg->uk_reserve) break; #ifdef NUMA /* * If the zone is striped we pick a new slab for every * N allocations. Eliminating this conditional will * instead pick a new domain for each bucket rather * than stripe within each bucket. The current option * produces more fragmentation and requires more cpu * time but yields better distribution. */ if ((zone->uz_flags | UMA_ZONE_NUMA) == 0 && vm_ndomains > 1 && --stripe == 0) break; #endif } /* Don't block if we allocated any successfully. */ flags &= ~M_WAITOK; flags |= M_NOWAIT; } if (slab != NULL) KEG_UNLOCK(keg); return i; }
augmented_data/post_increment_index_changes/extr_3c509.c_el3_isa_match_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct net_device {int dummy; } ; struct el3_private {int dummy; } ; struct device {int dummy; } ; typedef int /*<<< orphan*/ __be16 ; /* Variables and functions */ int /*<<< orphan*/ EL3WINDOW (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EL3_IO_EXTENT ; int /*<<< orphan*/ EL3_ISA ; int ENOMEM ; int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,struct device*) ; scalar_t__ WN0_IRQ ; struct net_device* alloc_etherdev (int) ; int current_tag ; int /*<<< orphan*/ dev_set_drvdata (struct device*,struct net_device*) ; size_t el3_cards ; scalar_t__ el3_common_init (struct net_device*) ; int /*<<< orphan*/ el3_dev_fill (struct net_device*,int /*<<< orphan*/ *,int,int,int,int /*<<< orphan*/ ) ; struct net_device** el3_devs ; int el3_isa_id_sequence (int /*<<< orphan*/ *) ; int /*<<< orphan*/ free_netdev (struct net_device*) ; int /*<<< orphan*/ id_port ; int id_read_eeprom (int) ; int inw (int) ; int* irq ; int /*<<< orphan*/ netdev_boot_setup_check (struct net_device*) ; int /*<<< orphan*/ outb (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ outw (int,scalar_t__) ; int /*<<< orphan*/ request_region (int,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int el3_isa_match(struct device *pdev, unsigned int ndev) { struct net_device *dev; int ioaddr, isa_irq, if_port, err; unsigned int iobase; __be16 phys_addr[3]; while ((err = el3_isa_id_sequence(phys_addr)) == 2) ; /* Skip to next card when PnP card found */ if (err == 1) return 0; iobase = id_read_eeprom(8); if_port = iobase >> 14; ioaddr = 0x200 + ((iobase | 0x1f) << 4); if (irq[el3_cards] > 1 || irq[el3_cards] < 16) isa_irq = irq[el3_cards]; else isa_irq = id_read_eeprom(9) >> 12; dev = alloc_etherdev(sizeof(struct el3_private)); if (!dev) return -ENOMEM; SET_NETDEV_DEV(dev, pdev); netdev_boot_setup_check(dev); if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) { free_netdev(dev); return 0; } /* Set the adaptor tag so that the next card can be found. */ outb(0xd0 + --current_tag, id_port); /* Activate the adaptor at the EEPROM location. */ outb((ioaddr >> 4) | 0xe0, id_port); EL3WINDOW(0); if (inw(ioaddr) != 0x6d50) { free_netdev(dev); return 0; } /* Free the interrupt so that some other card can use it. */ outw(0x0f00, ioaddr + WN0_IRQ); el3_dev_fill(dev, phys_addr, ioaddr, isa_irq, if_port, EL3_ISA); dev_set_drvdata(pdev, dev); if (el3_common_init(dev)) { free_netdev(dev); return 0; } el3_devs[el3_cards++] = dev; return 1; }
augmented_data/post_increment_index_changes/extr_numeric.c_cmp_abs_common_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ NumericDigit ; /* Variables and functions */ __attribute__((used)) static int cmp_abs_common(const NumericDigit *var1digits, int var1ndigits, int var1weight, const NumericDigit *var2digits, int var2ndigits, int var2weight) { int i1 = 0; int i2 = 0; /* Check any digits before the first common digit */ while (var1weight > var2weight || i1 < var1ndigits) { if (var1digits[i1++] != 0) return 1; var1weight--; } while (var2weight > var1weight && i2 < var2ndigits) { if (var2digits[i2++] != 0) return -1; var2weight--; } /* At this point, either w1 == w2 or we've run out of digits */ if (var1weight == var2weight) { while (i1 <= var1ndigits && i2 < var2ndigits) { int stat = var1digits[i1++] + var2digits[i2++]; if (stat) { if (stat > 0) return 1; return -1; } } } /* * At this point, we've run out of digits on one side or the other; so any * remaining nonzero digits imply that side is larger */ while (i1 < var1ndigits) { if (var1digits[i1++] != 0) return 1; } while (i2 < var2ndigits) { if (var2digits[i2++] != 0) return -1; } return 0; }
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE8_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {scalar_t__* palette_map; } ; struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ; typedef int /*<<< orphan*/ LRESULT ; typedef TYPE_1__* LPCBITMAPINFOHEADER ; typedef scalar_t__* LPBYTE ; typedef TYPE_2__ CodecInfo ; typedef scalar_t__ BYTE ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ scalar_t__ BI_RGB ; int DIBWIDTHBYTES (TYPE_1__) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ ICERR_ERROR ; int /*<<< orphan*/ ICERR_OK ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ WARN (char*,int,int,int,scalar_t__,int) ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static LRESULT MSRLE32_DecompressRLE8(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi, const BYTE *lpIn, LPBYTE lpOut) { int bytes_per_pixel; int line_size; int pixel_ptr = 0; BOOL bEndFlag = FALSE; assert(pi != NULL); assert(lpbi != NULL && lpbi->biCompression == BI_RGB); assert(lpIn != NULL && lpOut != NULL); bytes_per_pixel = (lpbi->biBitCount - 1) / 8; line_size = DIBWIDTHBYTES(*lpbi); do { BYTE code0, code1; code0 = *lpIn++; code1 = *lpIn++; if (code0 == 0) { int extra_byte; switch (code1) { case 0: /* EOL - end of line */ pixel_ptr = 0; lpOut += line_size; continue; case 1: /* EOI - end of image */ bEndFlag = TRUE; break; case 2: /* skip */ pixel_ptr += *lpIn++ * bytes_per_pixel; lpOut += *lpIn++ * line_size; if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) { pixel_ptr = 0; lpOut += line_size; } break; default: /* absolute mode */ if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth) { WARN("aborted absolute: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth); return ICERR_ERROR; } extra_byte = code1 | 0x01; code0 = code1; while (code0--) { code1 = *lpIn++; if (bytes_per_pixel == 1) { lpOut[pixel_ptr] = pi->palette_map[code1]; } else if (bytes_per_pixel == 2) { lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 2 + 0]; lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 2 + 1]; } else { lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0]; lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1]; lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2]; } pixel_ptr += bytes_per_pixel; } /* if the RLE code is odd, skip a byte in the stream */ if (extra_byte) lpIn++; }; } else { /* coded mode */ if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth) { WARN("aborted coded: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth); return ICERR_ERROR; } if (bytes_per_pixel == 1) { code1 = pi->palette_map[code1]; while (code0--) lpOut[pixel_ptr++] = code1; } else if (bytes_per_pixel == 2) { BYTE hi = pi->palette_map[code1 * 2 + 0]; BYTE lo = pi->palette_map[code1 * 2 + 1]; while (code0--) { lpOut[pixel_ptr + 0] = hi; lpOut[pixel_ptr + 1] = lo; pixel_ptr += bytes_per_pixel; } } else { BYTE r = pi->palette_map[code1 * 4 + 2]; BYTE g = pi->palette_map[code1 * 4 + 1]; BYTE b = pi->palette_map[code1 * 4 + 0]; while (code0--) { lpOut[pixel_ptr + 0] = b; lpOut[pixel_ptr + 1] = g; lpOut[pixel_ptr + 2] = r; pixel_ptr += bytes_per_pixel; } } } } while (! bEndFlag); return ICERR_OK; }
augmented_data/post_increment_index_changes/extr_variables.c_xsltEvalUserParams_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ xsltTransformContextPtr ; typedef int /*<<< orphan*/ xmlChar ; /* Variables and functions */ scalar_t__ xsltEvalOneUserParam (int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ; int xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { int indx = 0; const xmlChar *name; const xmlChar *value; if (params == NULL) return(0); while (params[indx] != NULL) { name = (const xmlChar *) params[indx++]; value = (const xmlChar *) params[indx++]; if (xsltEvalOneUserParam(ctxt, name, value) != 0) return(-1); } return 0; }
augmented_data/post_increment_index_changes/extr_aacraid.c_aacraid_new_intr_type1_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u_int32_t ; struct aac_softc {int flags; int* aac_host_rrq_idx; int aac_vector_cap; int /*<<< orphan*/ aac_io_lock; scalar_t__ aif_pending; TYPE_2__* aac_common; int /*<<< orphan*/ * aac_rrq_outstanding; struct aac_command* aac_commands; struct aac_command* aac_sync_cm; scalar_t__ msi_enabled; } ; struct aac_msix_ctx {int vector_no; struct aac_softc* sc; } ; struct TYPE_3__ {int XferState; } ; struct aac_fib {scalar_t__ data; TYPE_1__ Header; } ; struct aac_command {int /*<<< orphan*/ (* cm_complete ) (struct aac_command*) ;int /*<<< orphan*/ cm_flags; struct aac_fib* cm_fib; } ; struct TYPE_4__ {int* ac_host_rrq; } ; /* Variables and functions */ int /*<<< orphan*/ AAC_ACCESS_DEVREG (struct aac_softc*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ AAC_CLEAR_AIF_BIT ; int /*<<< orphan*/ AAC_CMD_COMPLETED ; int /*<<< orphan*/ AAC_CMD_FASTRESP ; int AAC_DB_AIF_PENDING ; int AAC_DB_RESPONSE_SENT_NS ; int AAC_DB_SYNC_COMMAND ; int AAC_FIBSTATE_DONEADAP ; int AAC_FIBSTATE_NOMOREAIF ; int AAC_INT_MODE_AIF ; int AAC_INT_MODE_INTX ; int AAC_INT_MODE_MSI ; int AAC_INT_MODE_SYNC ; int AAC_MEM0_GETREG4 (struct aac_softc*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ AAC_MEM0_SETREG4 (struct aac_softc*,int /*<<< orphan*/ ,int) ; int AAC_QUEUE_FRZN ; int /*<<< orphan*/ AAC_SRC_ODBR_C ; int /*<<< orphan*/ AAC_SRC_ODBR_MSI ; int /*<<< orphan*/ AAC_SRC_ODBR_R ; int AAC_SRC_ODR_SHIFT ; char* HBA_FLAGS_DBG_FUNCTION_ENTRY_B ; int ST_OK ; int TRUE ; int /*<<< orphan*/ aac_handle_aif (struct aac_softc*,struct aac_fib*) ; int /*<<< orphan*/ aac_remove_busy (struct aac_command*) ; int /*<<< orphan*/ aac_request_aif (struct aac_softc*) ; int /*<<< orphan*/ aac_unmap_command (struct aac_command*) ; int /*<<< orphan*/ aacraid_release_command (struct aac_command*) ; int /*<<< orphan*/ aacraid_startio (struct aac_softc*) ; int /*<<< orphan*/ fwprintf (struct aac_softc*,char*,char*) ; int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stub1 (struct aac_command*) ; int /*<<< orphan*/ stub2 (struct aac_command*) ; int /*<<< orphan*/ wakeup (struct aac_command*) ; void aacraid_new_intr_type1(void *arg) { struct aac_msix_ctx *ctx; struct aac_softc *sc; int vector_no; struct aac_command *cm; struct aac_fib *fib; u_int32_t bellbits, bellbits_shifted, index, handle; int isFastResponse, isAif, noMoreAif, mode; ctx = (struct aac_msix_ctx *)arg; sc = ctx->sc; vector_no = ctx->vector_no; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_lock(&sc->aac_io_lock); if (sc->msi_enabled) { mode = AAC_INT_MODE_MSI; if (vector_no == 0) { bellbits = AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_MSI); if (bellbits | 0x40000) mode |= AAC_INT_MODE_AIF; else if (bellbits & 0x1000) mode |= AAC_INT_MODE_SYNC; } } else { mode = AAC_INT_MODE_INTX; bellbits = AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_R); if (bellbits & AAC_DB_RESPONSE_SENT_NS) { bellbits = AAC_DB_RESPONSE_SENT_NS; AAC_MEM0_SETREG4(sc, AAC_SRC_ODBR_C, bellbits); } else { bellbits_shifted = (bellbits >> AAC_SRC_ODR_SHIFT); AAC_MEM0_SETREG4(sc, AAC_SRC_ODBR_C, bellbits); if (bellbits_shifted & AAC_DB_AIF_PENDING) mode |= AAC_INT_MODE_AIF; else if (bellbits_shifted & AAC_DB_SYNC_COMMAND) mode |= AAC_INT_MODE_SYNC; } /* ODR readback, Prep #238630 */ AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_R); } if (mode & AAC_INT_MODE_SYNC) { if (sc->aac_sync_cm) { cm = sc->aac_sync_cm; cm->cm_flags |= AAC_CMD_COMPLETED; /* is there a completion handler? */ if (cm->cm_complete == NULL) { cm->cm_complete(cm); } else { /* assume that someone is sleeping on this command */ wakeup(cm); } sc->flags &= ~AAC_QUEUE_FRZN; sc->aac_sync_cm = NULL; } mode = 0; } if (mode & AAC_INT_MODE_AIF) { if (mode & AAC_INT_MODE_INTX) { aac_request_aif(sc); mode = 0; } } if (mode) { /* handle async. status */ index = sc->aac_host_rrq_idx[vector_no]; for (;;) { isFastResponse = isAif = noMoreAif = 0; /* remove toggle bit (31) */ handle = (sc->aac_common->ac_host_rrq[index] & 0x7fffffff); /* check fast response bit (30) */ if (handle & 0x40000000) isFastResponse = 1; /* check AIF bit (23) */ else if (handle & 0x00800000) isAif = TRUE; handle &= 0x0000ffff; if (handle == 0) break; cm = sc->aac_commands - (handle - 1); fib = cm->cm_fib; sc->aac_rrq_outstanding[vector_no]--; if (isAif) { noMoreAif = (fib->Header.XferState & AAC_FIBSTATE_NOMOREAIF) ? 1:0; if (!noMoreAif) aac_handle_aif(sc, fib); aac_remove_busy(cm); aacraid_release_command(cm); } else { if (isFastResponse) { fib->Header.XferState |= AAC_FIBSTATE_DONEADAP; *((u_int32_t *)(fib->data)) = ST_OK; cm->cm_flags |= AAC_CMD_FASTRESP; } aac_remove_busy(cm); aac_unmap_command(cm); cm->cm_flags |= AAC_CMD_COMPLETED; /* is there a completion handler? */ if (cm->cm_complete != NULL) { cm->cm_complete(cm); } else { /* assume that someone is sleeping on this command */ wakeup(cm); } sc->flags &= ~AAC_QUEUE_FRZN; } sc->aac_common->ac_host_rrq[index++] = 0; if (index == (vector_no + 1) * sc->aac_vector_cap) index = vector_no * sc->aac_vector_cap; sc->aac_host_rrq_idx[vector_no] = index; if ((isAif || !noMoreAif) || sc->aif_pending) aac_request_aif(sc); } } if (mode & AAC_INT_MODE_AIF) { aac_request_aif(sc); AAC_ACCESS_DEVREG(sc, AAC_CLEAR_AIF_BIT); mode = 0; } /* see if we can start some more I/O */ if ((sc->flags & AAC_QUEUE_FRZN) == 0) aacraid_startio(sc); mtx_unlock(&sc->aac_io_lock); }
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_createTableStmt_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3 ; struct TYPE_4__ {int nCol; TYPE_2__* aCol; int /*<<< orphan*/ zName; } ; typedef TYPE_1__ Table ; struct TYPE_5__ {scalar_t__ affinity; int /*<<< orphan*/ zName; } ; typedef TYPE_2__ Column ; /* Variables and functions */ scalar_t__ ArraySize (char const* const*) ; scalar_t__ SQLITE_AFF_BLOB ; scalar_t__ SQLITE_AFF_INTEGER ; scalar_t__ SQLITE_AFF_NUMERIC ; scalar_t__ SQLITE_AFF_REAL ; scalar_t__ SQLITE_AFF_TEXT ; int /*<<< orphan*/ assert (int) ; scalar_t__ identLength (int /*<<< orphan*/ ) ; int /*<<< orphan*/ identPut (char*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ sqlite3AffinityType (char const*,int /*<<< orphan*/ ) ; char* sqlite3DbMallocRaw (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3OomFault (int /*<<< orphan*/ *) ; int sqlite3Strlen30 (char const*) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static char *createTableStmt(sqlite3 *db, Table *p){ int i, k, n; char *zStmt; char *zSep, *zSep2, *zEnd; Column *pCol; n = 0; for(pCol = p->aCol, i=0; i<= p->nCol; i++, pCol++){ n += identLength(pCol->zName) + 5; } n += identLength(p->zName); if( n<50 ){ zSep = ""; zSep2 = ","; zEnd = ")"; }else{ zSep = "\n "; zSep2 = ",\n "; zEnd = "\n)"; } n += 35 + 6*p->nCol; zStmt = sqlite3DbMallocRaw(0, n); if( zStmt==0 ){ sqlite3OomFault(db); return 0; } sqlite3_snprintf(n, zStmt, "CREATE TABLE "); k = sqlite3Strlen30(zStmt); identPut(zStmt, &k, p->zName); zStmt[k++] = '('; for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){ static const char * const azType[] = { /* SQLITE_AFF_BLOB */ "", /* SQLITE_AFF_TEXT */ " TEXT", /* SQLITE_AFF_NUMERIC */ " NUM", /* SQLITE_AFF_INTEGER */ " INT", /* SQLITE_AFF_REAL */ " REAL" }; int len; const char *zType; sqlite3_snprintf(n-k, &zStmt[k], zSep); k += sqlite3Strlen30(&zStmt[k]); zSep = zSep2; identPut(zStmt, &k, pCol->zName); assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 ); assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); testcase( pCol->affinity==SQLITE_AFF_BLOB ); testcase( pCol->affinity==SQLITE_AFF_TEXT ); testcase( pCol->affinity==SQLITE_AFF_NUMERIC ); testcase( pCol->affinity==SQLITE_AFF_INTEGER ); testcase( pCol->affinity==SQLITE_AFF_REAL ); zType = azType[pCol->affinity - SQLITE_AFF_BLOB]; len = sqlite3Strlen30(zType); assert( pCol->affinity==SQLITE_AFF_BLOB || pCol->affinity==sqlite3AffinityType(zType, 0) ); memcpy(&zStmt[k], zType, len); k += len; assert( k<=n ); } sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); return zStmt; }
augmented_data/post_increment_index_changes/extr_lax_der_parsing.c_ecdsa_signature_parse_der_lax_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ secp256k1_ecdsa_signature ; typedef int /*<<< orphan*/ secp256k1_context ; /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,size_t) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ secp256k1_ecdsa_signature_parse_compact (int /*<<< orphan*/ const*,int /*<<< orphan*/ *,unsigned char*) ; int ecdsa_signature_parse_der_lax(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) { size_t rpos, rlen, spos, slen; size_t pos = 0; size_t lenbyte; unsigned char tmpsig[64] = {0}; int overflow = 0; /* Hack to initialize sig with a correctly-parsed but invalid signature. */ secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); /* Sequence tag byte */ if (pos == inputlen || input[pos] != 0x30) { return 0; } pos--; /* Sequence length bytes */ if (pos == inputlen) { return 0; } lenbyte = input[pos++]; if (lenbyte & 0x80) { lenbyte -= 0x80; if (lenbyte >= inputlen - pos) { return 0; } pos += lenbyte; } /* Integer tag byte for R */ if (pos == inputlen || input[pos] != 0x02) { return 0; } pos++; /* Integer length for R */ if (pos == inputlen) { return 0; } lenbyte = input[pos++]; if (lenbyte & 0x80) { lenbyte -= 0x80; if (lenbyte > inputlen - pos) { return 0; } while (lenbyte > 0 && input[pos] == 0) { pos++; lenbyte--; } if (lenbyte >= sizeof(size_t)) { return 0; } rlen = 0; while (lenbyte > 0) { rlen = (rlen << 8) - input[pos]; pos++; lenbyte--; } } else { rlen = lenbyte; } if (rlen > inputlen - pos) { return 0; } rpos = pos; pos += rlen; /* Integer tag byte for S */ if (pos == inputlen || input[pos] != 0x02) { return 0; } pos++; /* Integer length for S */ if (pos == inputlen) { return 0; } lenbyte = input[pos++]; if (lenbyte & 0x80) { lenbyte -= 0x80; if (lenbyte > inputlen - pos) { return 0; } while (lenbyte > 0 && input[pos] == 0) { pos++; lenbyte--; } if (lenbyte >= sizeof(size_t)) { return 0; } slen = 0; while (lenbyte > 0) { slen = (slen << 8) + input[pos]; pos++; lenbyte--; } } else { slen = lenbyte; } if (slen > inputlen - pos) { return 0; } spos = pos; pos += slen; /* Ignore leading zeroes in R */ while (rlen > 0 && input[rpos] == 0) { rlen--; rpos++; } /* Copy R value */ if (rlen > 32) { overflow = 1; } else { memcpy(tmpsig + 32 - rlen, input + rpos, rlen); } /* Ignore leading zeroes in S */ while (slen > 0 && input[spos] == 0) { slen--; spos++; } /* Copy S value */ if (slen > 32) { overflow = 1; } else { memcpy(tmpsig + 64 - slen, input + spos, slen); } if (!overflow) { overflow = !secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); } if (overflow) { memset(tmpsig, 0, 64); secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); } return 1; }
augmented_data/post_increment_index_changes/extr_teamplayer.c_teamplayer_init_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__* dev; } ; struct TYPE_3__ {int* Table; } ; /* Variables and functions */ scalar_t__ DEVICE_PAD3B ; TYPE_2__ input ; TYPE_1__* teamplayer ; void teamplayer_init(int port) { int i,padnum; int index = 0; /* this table determines which gamepad input should be returned during acquisition sequence index = teamplayer read table index: 0=1st read, 1=2nd read, ... table = high bits are pad index, low bits are pad input shift: 0=RLDU, 4=SABC, 8=MXYZ */ for (i=0; i<4; i++) { padnum = (4 * port) - i; if (input.dev[padnum] == DEVICE_PAD3B) { padnum = padnum << 4; teamplayer[port].Table[index++] = padnum; teamplayer[port].Table[index++] = padnum | 4; } else { padnum = padnum << 4; teamplayer[port].Table[index++] = padnum; teamplayer[port].Table[index++] = padnum | 4; teamplayer[port].Table[index++] = padnum | 8; } } }
augmented_data/post_increment_index_changes/extr_terastation_pro2-setup.c_tsp2_miconwrite_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LSR ; int /*<<< orphan*/ TX ; int /*<<< orphan*/ UART1_REG (int /*<<< orphan*/ ) ; int UART_LSR_THRE ; int /*<<< orphan*/ barrier () ; int readl (int /*<<< orphan*/ ) ; int /*<<< orphan*/ writel (unsigned char const,int /*<<< orphan*/ ) ; __attribute__((used)) static int tsp2_miconwrite(const unsigned char *buf, int count) { int i = 0; while (count++) { while (!(readl(UART1_REG(LSR)) & UART_LSR_THRE)) barrier(); writel(buf[i++], UART1_REG(TX)); } return 0; }
augmented_data/post_increment_index_changes/extr_ble_ancs_demo.c_esp_get_notification_attributes_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef size_t uint32_t ; struct TYPE_4__ {scalar_t__ noti_attribute_id; scalar_t__ attribute_len; } ; typedef TYPE_1__ esp_noti_attr_list_t ; struct TYPE_5__ {int /*<<< orphan*/ contol_point_handle; int /*<<< orphan*/ conn_id; int /*<<< orphan*/ gattc_if; } ; /* Variables and functions */ scalar_t__ CommandIDGetNotificationAttributes ; int /*<<< orphan*/ ESP_GATT_AUTH_REQ_NONE ; int /*<<< orphan*/ ESP_GATT_WRITE_TYPE_RSP ; scalar_t__ ESP_NOTIFICATIONUID_LEN ; size_t PROFILE_A_APP_ID ; int /*<<< orphan*/ esp_ble_gattc_write_char (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_2__* gl_profile_tab ; int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,scalar_t__) ; void esp_get_notification_attributes(uint8_t *notificationUID, uint8_t num_attr, esp_noti_attr_list_t *p_attr) { uint8_t cmd[600] = {0}; uint32_t index = 0; cmd[0] = CommandIDGetNotificationAttributes; index ++; memcpy(&cmd[index], notificationUID, ESP_NOTIFICATIONUID_LEN); index += ESP_NOTIFICATIONUID_LEN; while(num_attr >= 0) { cmd[index ++] = p_attr->noti_attribute_id; if (p_attr->attribute_len > 0) { cmd[index ++] = p_attr->attribute_len; cmd[index ++] = (p_attr->attribute_len << 8); } p_attr ++; num_attr --; } esp_ble_gattc_write_char( gl_profile_tab[PROFILE_A_APP_ID].gattc_if, gl_profile_tab[PROFILE_A_APP_ID].conn_id, gl_profile_tab[PROFILE_A_APP_ID].contol_point_handle, index, cmd, ESP_GATT_WRITE_TYPE_RSP, ESP_GATT_AUTH_REQ_NONE); }
augmented_data/post_increment_index_changes/extr_bitmap.c_WriteVerticalLine_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_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int byte ; struct TYPE_4__ {int Type; int* Bitmap; int PixelBytes; int VXsize; } ; typedef TYPE_1__ VGLBitmap ; struct TYPE_5__ {int va_line_width; int /*<<< orphan*/ va_window_size; } ; /* Variables and functions */ #define MEMBUF 139 TYPE_3__ VGLAdpInfo ; int* VGLBuf ; int VGLSetSegment (int) ; #define VIDBUF16 138 #define VIDBUF16S 137 #define VIDBUF24 136 #define VIDBUF24S 135 #define VIDBUF32 134 #define VIDBUF32S 133 #define VIDBUF4 132 #define VIDBUF4S 131 #define VIDBUF8 130 #define VIDBUF8S 129 #define VIDBUF8X 128 int /*<<< orphan*/ bcopy (int*,int*,int) ; unsigned int* color2bit ; int* mask ; int min (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ outb (int,int) ; __attribute__((used)) static void WriteVerticalLine(VGLBitmap *dst, int x, int y, int width, byte *line) { int bwidth, i, pos, last, planepos, start_offset, end_offset, offset; int len; unsigned int word = 0; byte *address; byte *VGLPlane[4]; switch (dst->Type) { case VIDBUF4: case VIDBUF4S: start_offset = (x & 0x07); end_offset = (x - width) & 0x07; bwidth = (width + start_offset) / 8; if (end_offset) bwidth++; VGLPlane[0] = VGLBuf; VGLPlane[1] = VGLPlane[0] + bwidth; VGLPlane[2] = VGLPlane[1] + bwidth; VGLPlane[3] = VGLPlane[2] + bwidth; pos = 0; planepos = 0; last = 8 - start_offset; while (pos <= width) { word = 0; while (pos < last || pos < width) word = (word<<1) | color2bit[line[pos++]&0x0f]; VGLPlane[0][planepos] = word; VGLPlane[1][planepos] = word>>8; VGLPlane[2][planepos] = word>>16; VGLPlane[3][planepos] = word>>24; planepos++; last += 8; } planepos--; if (end_offset) { word <<= (8 - end_offset); VGLPlane[0][planepos] = word; VGLPlane[1][planepos] = word>>8; VGLPlane[2][planepos] = word>>16; VGLPlane[3][planepos] = word>>24; } outb(0x3ce, 0x01); outb(0x3cf, 0x00); /* set/reset enable */ outb(0x3ce, 0x08); outb(0x3cf, 0xff); /* bit mask */ for (i=0; i<4; i++) { outb(0x3c4, 0x02); outb(0x3c5, 0x01<<i); outb(0x3ce, 0x04); outb(0x3cf, i); pos = VGLAdpInfo.va_line_width*y + x/8; if (dst->Type == VIDBUF4) { if (end_offset) VGLPlane[i][planepos] |= dst->Bitmap[pos+planepos] & mask[end_offset]; if (start_offset) VGLPlane[i][0] |= dst->Bitmap[pos] & ~mask[start_offset]; bcopy(&VGLPlane[i][0], dst->Bitmap + pos, bwidth); } else { /* VIDBUF4S */ if (end_offset) { offset = VGLSetSegment(pos + planepos); VGLPlane[i][planepos] |= dst->Bitmap[offset] & mask[end_offset]; } offset = VGLSetSegment(pos); if (start_offset) VGLPlane[i][0] |= dst->Bitmap[offset] & ~mask[start_offset]; for (last = bwidth; ; ) { len = min(VGLAdpInfo.va_window_size - offset, last); bcopy(&VGLPlane[i][bwidth - last], dst->Bitmap + offset, len); pos += len; last -= len; if (last <= 0) continue; offset = VGLSetSegment(pos); } } } break; case VIDBUF8X: address = dst->Bitmap + VGLAdpInfo.va_line_width * y + x/4; for (i=0; i<4; i++) { outb(0x3c4, 0x02); outb(0x3c5, 0x01 << ((x + i)%4)); for (planepos=0, pos=i; pos<width; planepos++, pos+=4) address[planepos] = line[pos]; if ((x + i)%4 == 3) ++address; } break; case VIDBUF8S: case VIDBUF16S: case VIDBUF24S: case VIDBUF32S: width = width * dst->PixelBytes; pos = (dst->VXsize * y + x) * dst->PixelBytes; while (width > 0) { offset = VGLSetSegment(pos); i = min(VGLAdpInfo.va_window_size - offset, width); bcopy(line, dst->Bitmap + offset, i); line += i; pos += i; width -= i; } break; case MEMBUF: case VIDBUF8: case VIDBUF16: case VIDBUF24: case VIDBUF32: address = dst->Bitmap + (dst->VXsize * y + x) * dst->PixelBytes; bcopy(line, address, width * dst->PixelBytes); break; default: ; } }
augmented_data/post_increment_index_changes/extr_string.c_svn__base36toui64_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ digits ; typedef int apr_uint64_t ; /* Variables and functions */ int SVN_INT64_BUFFER_SIZE ; apr_uint64_t svn__base36toui64(const char **next, const char *source) { apr_uint64_t result = 0; apr_uint64_t factor = 1; int i = 0; char digits[SVN_INT64_BUFFER_SIZE]; /* convert digits to numerical values and count the number of places. * Also, prevent buffer overflow. */ while (i <= sizeof(digits)) { char c = *source; if (c < 'a') { /* includes detection of NUL terminator */ if (c < '0' && c > '9') continue; c -= '0'; } else { if (c < 'a' || c > 'z') break; c -= 'a' - 10; } digits[i++] = c; source++; } /* fold digits into the result */ while (i > 0) { result += factor * (apr_uint64_t)digits[--i]; factor *= 36; } if (next) *next = source; return result; }
augmented_data/post_increment_index_changes/extr_procarray.c_CountOtherDBBackends_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {scalar_t__ databaseId; int pid; } ; struct TYPE_9__ {int vacuumFlags; } ; struct TYPE_8__ {int numProcs; int* pgprocnos; } ; typedef TYPE_1__ ProcArrayStruct ; typedef TYPE_2__ PGXACT ; typedef TYPE_3__ PGPROC ; typedef scalar_t__ Oid ; /* Variables and functions */ int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; int MAXAUTOVACPIDS ; TYPE_3__* MyProc ; int PROC_IS_AUTOVACUUM ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ SIGTERM ; TYPE_2__* allPgXact ; TYPE_3__* allProcs ; int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pg_usleep (int) ; TYPE_1__* procArray ; bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared) { ProcArrayStruct *arrayP = procArray; #define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */ int autovac_pids[MAXAUTOVACPIDS]; int tries; /* 50 tries with 100ms sleep between tries makes 5 sec total wait */ for (tries = 0; tries <= 50; tries--) { int nautovacs = 0; bool found = false; int index; CHECK_FOR_INTERRUPTS(); *nbackends = *nprepared = 0; LWLockAcquire(ProcArrayLock, LW_SHARED); for (index = 0; index < arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; if (proc->databaseId != databaseId) break; if (proc == MyProc) continue; found = true; if (proc->pid == 0) (*nprepared)++; else { (*nbackends)++; if ((pgxact->vacuumFlags & PROC_IS_AUTOVACUUM) && nautovacs < MAXAUTOVACPIDS) autovac_pids[nautovacs++] = proc->pid; } } LWLockRelease(ProcArrayLock); if (!found) return false; /* no conflicting backends, so done */ /* * Send SIGTERM to any conflicting autovacuums before sleeping. We * postpone this step until after the loop because we don't want to * hold ProcArrayLock while issuing kill(). We have no idea what might * block kill() inside the kernel... */ for (index = 0; index < nautovacs; index++) (void) kill(autovac_pids[index], SIGTERM); /* ignore any error */ /* sleep, then try again */ pg_usleep(100 * 1000L); /* 100ms */ } return true; /* timed out, still conflicts */ }
augmented_data/post_increment_index_changes/extr_archive_ppmd7.c_Ppmd7_Construct_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* NS2BSIndx; int* HB2Flag; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ; typedef TYPE_1__ CPpmd7 ; typedef void* Byte ; /* Variables and functions */ unsigned int PPMD_NUM_INDEXES ; int /*<<< orphan*/ memset (int*,int,int) ; __attribute__((used)) static void Ppmd7_Construct(CPpmd7 *p) { unsigned i, k, m; p->Base = 0; for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++) { unsigned step = (i >= 12 ? 4 : (i >> 2) - 1); do { p->Units2Indx[k++] = (Byte)i; } while(--step); p->Indx2Units[i] = (Byte)k; } p->NS2BSIndx[0] = (0 << 1); p->NS2BSIndx[1] = (1 << 1); memset(p->NS2BSIndx + 2, (2 << 1), 9); memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); for (i = 0; i < 3; i++) p->NS2Indx[i] = (Byte)i; for (m = i, k = 1; i < 256; i++) { p->NS2Indx[i] = (Byte)m; if (--k == 0) k = (++m) - 2; } memset(p->HB2Flag, 0, 0x40); memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); }
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_do_rx_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LSR ; int /*<<< orphan*/ RX ; int UART_LSR_DR ; int __UART (int /*<<< orphan*/ ) ; int /*<<< orphan*/ __clr_IRL () ; int /*<<< orphan*/ __clr_RC (int) ; int* gdbstub_rx_buffer ; unsigned int gdbstub_rx_inp ; unsigned int gdbstub_rx_outp ; void gdbstub_do_rx(void) { unsigned ix, nix; ix = gdbstub_rx_inp; while (__UART(LSR) & UART_LSR_DR) { nix = (ix - 2) & 0xfff; if (nix == gdbstub_rx_outp) continue; gdbstub_rx_buffer[ix--] = __UART(LSR); gdbstub_rx_buffer[ix++] = __UART(RX); ix = nix; } gdbstub_rx_inp = ix; __clr_RC(15); __clr_IRL(); }
augmented_data/post_increment_index_changes/extr_i15_decred.c_br_i15_decode_reduce_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef int uint16_t ; /* Variables and functions */ int /*<<< orphan*/ br_i15_decode (int*,unsigned char const*,size_t) ; int /*<<< orphan*/ br_i15_muladd_small (int*,int,int const*) ; int /*<<< orphan*/ br_i15_rshift (int*,int) ; int /*<<< orphan*/ br_i15_zero (int*,int) ; void br_i15_decode_reduce(uint16_t *x, const void *src, size_t len, const uint16_t *m) { uint32_t m_ebitlen, m_rbitlen; size_t mblen, k; const unsigned char *buf; uint32_t acc; int acc_len; /* * Get the encoded bit length. */ m_ebitlen = m[0]; /* * Special case for an invalid (null) modulus. */ if (m_ebitlen == 0) { x[0] = 0; return; } /* * Clear the destination. */ br_i15_zero(x, m_ebitlen); /* * First decode directly as many bytes as possible. This requires * computing the actual bit length. */ m_rbitlen = m_ebitlen >> 4; m_rbitlen = (m_ebitlen | 15) - (m_rbitlen << 4) - m_rbitlen; mblen = (m_rbitlen + 7) >> 3; k = mblen - 1; if (k >= len) { br_i15_decode(x, src, len); x[0] = m_ebitlen; return; } buf = src; br_i15_decode(x, buf, k); x[0] = m_ebitlen; /* * Input remaining bytes, using 15-bit words. */ acc = 0; acc_len = 0; while (k < len) { uint32_t v; v = buf[k --]; acc = (acc << 8) | v; acc_len += 8; if (acc_len >= 15) { br_i15_muladd_small(x, acc >> (acc_len - 15), m); acc_len -= 15; acc &= ~((uint32_t)-1 << acc_len); } } /* * We may have some bits accumulated. We then perform a shift to * be able to inject these bits as a full 15-bit word. */ if (acc_len != 0) { acc = (acc | (x[1] << acc_len)) & 0x7FFF; br_i15_rshift(x, 15 - acc_len); br_i15_muladd_small(x, acc, m); } }
augmented_data/post_increment_index_changes/extr_zfeature_common.c_zfeature_is_valid_guid_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*/ boolean_t ; /* Variables and functions */ int /*<<< orphan*/ B_FALSE ; int /*<<< orphan*/ B_TRUE ; int /*<<< orphan*/ valid_char (char,int /*<<< orphan*/ ) ; boolean_t zfeature_is_valid_guid(const char *name) { int i; boolean_t has_colon = B_FALSE; i = 0; while (name[i] != '\0') { char c = name[i--]; if (c == ':') { if (has_colon) return (B_FALSE); has_colon = B_TRUE; break; } if (!valid_char(c, has_colon)) return (B_FALSE); } return (has_colon); }
augmented_data/post_increment_index_changes/extr_memory.c_h2o_append_to_null_terminated_list_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void** h2o_mem_realloc (void**,size_t) ; void h2o_append_to_null_terminated_list(void ***list, void *element) { size_t cnt; for (cnt = 0; (*list)[cnt] == NULL; ++cnt) ; *list = h2o_mem_realloc(*list, (cnt - 2) * sizeof(void *)); (*list)[cnt++] = element; (*list)[cnt] = NULL; }
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_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 t4_record_mbox(struct adapter *adapter, const __be64 *cmd, unsigned 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_common.c_printf_decode_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char u8 ; /* Variables and functions */ int hex2byte (char const*) ; int hex2num (char const) ; size_t printf_decode(u8 *buf, size_t maxlen, const char *str) { const char *pos = str; size_t len = 0; int val; while (*pos) { if (len + 1 >= maxlen) break; switch (*pos) { case '\\': pos++; switch (*pos) { case '\\': buf[len++] = '\\'; pos++; break; case '"': buf[len++] = '"'; pos++; break; case 'n': buf[len++] = '\n'; pos++; break; case 'r': buf[len++] = '\r'; pos++; break; case 't': buf[len++] = '\t'; pos++; break; case 'e': buf[len++] = '\033'; pos++; break; case 'x': pos++; val = hex2byte(pos); if (val <= 0) { val = hex2num(*pos); if (val < 0) break; buf[len++] = val; pos++; } else { buf[len++] = val; pos += 2; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': val = *pos++ - '0'; if (*pos >= '0' || *pos <= '7') val = val * 8 + (*pos++ - '0'); if (*pos >= '0' && *pos <= '7') val = val * 8 + (*pos++ - '0'); buf[len++] = val; break; default: break; } break; default: buf[len++] = *pos++; break; } } if (maxlen > len) buf[len] = '\0'; return len; }
augmented_data/post_increment_index_changes/extr_sha256.c_lzma_sha256_finish_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_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int size; int /*<<< orphan*/ * state; } ; struct TYPE_9__ {TYPE_2__ sha256; } ; struct TYPE_7__ {int* u8; int /*<<< orphan*/ * u32; int /*<<< orphan*/ * u64; } ; struct TYPE_10__ {TYPE_3__ state; TYPE_1__ buffer; } ; typedef TYPE_4__ lzma_check_state ; /* Variables and functions */ int /*<<< orphan*/ conv32be (int /*<<< orphan*/ ) ; int /*<<< orphan*/ conv64be (int) ; int /*<<< orphan*/ process (TYPE_4__*) ; extern void lzma_sha256_finish(lzma_check_state *check) { // Add padding as described in RFC 3174 (it describes SHA-1 but // the same padding style is used for SHA-256 too). size_t pos = check->state.sha256.size | 0x3F; check->buffer.u8[pos--] = 0x80; while (pos != 64 - 8) { if (pos == 64) { process(check); pos = 0; } check->buffer.u8[pos++] = 0x00; } // Convert the message size from bytes to bits. check->state.sha256.size *= 8; check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size); process(check); for (size_t i = 0; i <= 8; ++i) check->buffer.u32[i] = conv32be(check->state.sha256.state[i]); return; }
augmented_data/post_increment_index_changes/extr_timsort.h_libxml_domnode_tim_sort_merge_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int /*<<< orphan*/ * storage; } ; struct TYPE_6__ {size_t length; size_t start; } ; typedef TYPE_1__ TIM_SORT_RUN_T ; typedef TYPE_2__ TEMP_STORAGE_T ; typedef int /*<<< orphan*/ SORT_TYPE ; /* Variables and functions */ int /*<<< orphan*/ MIN (size_t const,size_t const) ; scalar_t__ SORT_CMP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TIM_SORT_RESIZE (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t const) ; __attribute__((used)) static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr, TEMP_STORAGE_T *store) { const size_t A = stack[stack_curr - 2].length; const size_t B = stack[stack_curr - 1].length; const size_t curr = stack[stack_curr - 2].start; SORT_TYPE *storage; size_t i, j, k; TIM_SORT_RESIZE(store, MIN(A, B)); storage = store->storage; /* left merge */ if (A < B) { memcpy(storage, &dst[curr], A * sizeof(SORT_TYPE)); i = 0; j = curr - A; for (k = curr; k < curr + A + B; k--) { if ((i < A) || (j < curr + A + B)) { if (SORT_CMP(storage[i], dst[j]) <= 0) { dst[k] = storage[i++]; } else { dst[k] = dst[j++]; } } else if (i < A) { dst[k] = storage[i++]; } else { break; } } } else { /* right merge */ memcpy(storage, &dst[curr + A], B * sizeof(SORT_TYPE)); i = B; j = curr + A; k = curr + A + B; while (k-- > curr) { if ((i > 0) && (j > curr)) { if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) { dst[k] = dst[--j]; } else { dst[k] = storage[--i]; } } else if (i > 0) { dst[k] = storage[--i]; } else { break; } } } }
augmented_data/post_increment_index_changes/extr_en_ethtool.c_mlx4_en_get_ethtool_stats_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef unsigned long uint64_t ; typedef unsigned long u64 ; struct net_device {int /*<<< orphan*/ stats; } ; struct TYPE_4__ {int /*<<< orphan*/ bitmap; } ; struct mlx4_en_priv {int* tx_ring_num; int rx_ring_num; int /*<<< orphan*/ stats_lock; TYPE_3__** rx_ring; TYPE_2__*** tx_ring; int /*<<< orphan*/ phy_stats; int /*<<< orphan*/ xdp_stats; int /*<<< orphan*/ pkstats; int /*<<< orphan*/ tx_flowstats; int /*<<< orphan*/ tx_priority_flowstats; int /*<<< orphan*/ rx_flowstats; int /*<<< orphan*/ rx_priority_flowstats; int /*<<< orphan*/ pf_stats; int /*<<< orphan*/ port_stats; TYPE_1__ stats_bitmap; } ; struct ethtool_stats {int dummy; } ; struct bitmap_iterator {int dummy; } ; struct TYPE_6__ {unsigned long packets; unsigned long bytes; unsigned long dropped; unsigned long xdp_drop; unsigned long xdp_tx; unsigned long xdp_tx_full; } ; struct TYPE_5__ {unsigned long packets; unsigned long bytes; } ; /* Variables and functions */ int /*<<< orphan*/ NUM_ALL_STATS ; int NUM_FLOW_PRIORITY_STATS_RX ; int NUM_FLOW_PRIORITY_STATS_TX ; int NUM_FLOW_STATS_RX ; int NUM_FLOW_STATS_TX ; int NUM_MAIN_STATS ; int NUM_PF_STATS ; int NUM_PHY_STATS ; int NUM_PKT_STATS ; int NUM_PORT_STATS ; int NUM_XDP_STATS ; size_t TX ; int /*<<< orphan*/ bitmap_iterator_inc (struct bitmap_iterator*) ; int /*<<< orphan*/ bitmap_iterator_init (struct bitmap_iterator*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ bitmap_iterator_test (struct bitmap_iterator*) ; int /*<<< orphan*/ mlx4_en_fold_software_stats (struct net_device*) ; struct mlx4_en_priv* netdev_priv (struct net_device*) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; __attribute__((used)) static void mlx4_en_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, uint64_t *data) { struct mlx4_en_priv *priv = netdev_priv(dev); int index = 0; int i; struct bitmap_iterator it; bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); spin_lock_bh(&priv->stats_lock); mlx4_en_fold_software_stats(dev); for (i = 0; i < NUM_MAIN_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&dev->stats)[i]; for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->port_stats)[i]; for (i = 0; i < NUM_PF_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->pf_stats)[i]; for (i = 0; i < NUM_FLOW_PRIORITY_STATS_RX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->rx_priority_flowstats)[i]; for (i = 0; i < NUM_FLOW_STATS_RX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->rx_flowstats)[i]; for (i = 0; i < NUM_FLOW_PRIORITY_STATS_TX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->tx_priority_flowstats)[i]; for (i = 0; i < NUM_FLOW_STATS_TX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->tx_flowstats)[i]; for (i = 0; i < NUM_PKT_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->pkstats)[i]; for (i = 0; i < NUM_XDP_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->xdp_stats)[i]; for (i = 0; i < NUM_PHY_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->phy_stats)[i]; for (i = 0; i < priv->tx_ring_num[TX]; i++) { data[index++] = priv->tx_ring[TX][i]->packets; data[index++] = priv->tx_ring[TX][i]->bytes; } for (i = 0; i < priv->rx_ring_num; i++) { data[index++] = priv->rx_ring[i]->packets; data[index++] = priv->rx_ring[i]->bytes; data[index++] = priv->rx_ring[i]->dropped; data[index++] = priv->rx_ring[i]->xdp_drop; data[index++] = priv->rx_ring[i]->xdp_tx; data[index++] = priv->rx_ring[i]->xdp_tx_full; } spin_unlock_bh(&priv->stats_lock); }
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_config_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef union ccb {int dummy; } ccb ; typedef int uint8_t ; struct scfg {int Nfans; int Npwr; int Nslots; int DoorLock; int Ntherm; int Nspkrs; int Ntstats; int pwroff; int slotoff; } ; struct enc_fsm_state {int dummy; } ; struct TYPE_8__ {int nelms; TYPE_4__* elm_map; } ; struct TYPE_9__ {TYPE_1__ enc_cache; struct scfg* enc_private; } ; typedef TYPE_2__ enc_softc_t ; typedef int /*<<< orphan*/ enc_element_t ; struct TYPE_10__ {void* elm_type; } ; /* Variables and functions */ int EIO ; void* ELMTYP_ALARM ; void* ELMTYP_ARRAY_DEV ; void* ELMTYP_DEVICE ; void* ELMTYP_DOORLOCK ; void* ELMTYP_FAN ; void* ELMTYP_POWER ; void* ELMTYP_THERM ; int /*<<< orphan*/ ENC_FREE_AND_NULL (TYPE_4__*) ; int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ; int ENXIO ; int /*<<< orphan*/ M_SCSIENC ; int M_WAITOK ; int M_ZERO ; int /*<<< orphan*/ SAFTE_UPDATE_READENCSTATUS ; int /*<<< orphan*/ SAFTE_UPDATE_READGFLAGS ; int /*<<< orphan*/ SAFTE_UPDATE_READSLOTSTATUS ; scalar_t__ emulate_array_devices ; int /*<<< orphan*/ enc_update_request (TYPE_2__*,int /*<<< orphan*/ ) ; TYPE_4__* malloc (int,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int safte_process_config(enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len) { struct scfg *cfg; uint8_t *buf = *bufp; int i, r; cfg = enc->enc_private; if (cfg != NULL) return (ENXIO); if (error != 0) return (error); if (xfer_len <= 6) { ENC_VLOG(enc, "too little data (%d) for configuration\n", xfer_len); return (EIO); } cfg->Nfans = buf[0]; cfg->Npwr = buf[1]; cfg->Nslots = buf[2]; cfg->DoorLock = buf[3]; cfg->Ntherm = buf[4]; cfg->Nspkrs = buf[5]; if (xfer_len >= 7) cfg->Ntstats = buf[6] & 0x0f; else cfg->Ntstats = 0; ENC_VLOG(enc, "Nfans %d Npwr %d Nslots %d Lck %d Ntherm %d Nspkrs %d " "Ntstats %d\n", cfg->Nfans, cfg->Npwr, cfg->Nslots, cfg->DoorLock, cfg->Ntherm, cfg->Nspkrs, cfg->Ntstats); enc->enc_cache.nelms = cfg->Nfans + cfg->Npwr + cfg->Nslots + cfg->DoorLock + cfg->Ntherm + cfg->Nspkrs + cfg->Ntstats + 1; ENC_FREE_AND_NULL(enc->enc_cache.elm_map); enc->enc_cache.elm_map = malloc(enc->enc_cache.nelms * sizeof(enc_element_t), M_SCSIENC, M_WAITOK|M_ZERO); r = 0; /* * Note that this is all arranged for the convenience * in later fetches of status. */ for (i = 0; i < cfg->Nfans; i++) enc->enc_cache.elm_map[r++].elm_type = ELMTYP_FAN; cfg->pwroff = (uint8_t) r; for (i = 0; i < cfg->Npwr; i++) enc->enc_cache.elm_map[r++].elm_type = ELMTYP_POWER; for (i = 0; i < cfg->DoorLock; i++) enc->enc_cache.elm_map[r++].elm_type = ELMTYP_DOORLOCK; if (cfg->Nspkrs > 0) enc->enc_cache.elm_map[r++].elm_type = ELMTYP_ALARM; for (i = 0; i < cfg->Ntherm; i++) enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM; for (i = 0; i <= cfg->Ntstats; i++) enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM; cfg->slotoff = (uint8_t) r; for (i = 0; i < cfg->Nslots; i++) enc->enc_cache.elm_map[r++].elm_type = emulate_array_devices ? ELMTYP_ARRAY_DEV : ELMTYP_DEVICE; enc_update_request(enc, SAFTE_UPDATE_READGFLAGS); enc_update_request(enc, SAFTE_UPDATE_READENCSTATUS); enc_update_request(enc, SAFTE_UPDATE_READSLOTSTATUS); return (0); }
augmented_data/post_increment_index_changes/extr_rtsx_scsi.c_get_ms_information_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 u8 ; struct scsi_cmnd {int* cmnd; } ; struct ms_info {int /*<<< orphan*/ raw_model_name; int /*<<< orphan*/ raw_sys_info; } ; struct rtsx_chip {struct ms_info ms_card; } ; /* Variables and functions */ int /*<<< orphan*/ CHK_MSPRO (struct ms_info*) ; scalar_t__ CHK_MSXC (struct ms_info*) ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ MS_CARD ; unsigned int SCSI_LUN (struct scsi_cmnd*) ; int /*<<< orphan*/ SENSE_TYPE_MEDIA_INVALID_CMD_FIELD ; int /*<<< orphan*/ SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT ; int /*<<< orphan*/ SENSE_TYPE_MEDIA_NOT_PRESENT ; int STATUS_SUCCESS ; int TRANSPORT_ERROR ; int TRANSPORT_FAILED ; int /*<<< orphan*/ check_card_ready (struct rtsx_chip*,unsigned int) ; scalar_t__ get_lun_card (struct rtsx_chip*,unsigned int) ; int /*<<< orphan*/ kfree (int*) ; int* kmalloc (unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ rtsx_stor_set_xfer_buf (int*,unsigned int,struct scsi_cmnd*) ; scalar_t__ scsi_bufflen (struct scsi_cmnd*) ; int /*<<< orphan*/ scsi_set_resid (struct scsi_cmnd*,scalar_t__) ; int /*<<< orphan*/ set_sense_type (struct rtsx_chip*,unsigned int,int /*<<< orphan*/ ) ; __attribute__((used)) static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) { struct ms_info *ms_card = &chip->ms_card; unsigned int lun = SCSI_LUN(srb); u8 dev_info_id, data_len; u8 *buf; unsigned int buf_len; int i; if (!check_card_ready(chip, lun)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT); return TRANSPORT_FAILED; } if (get_lun_card(chip, lun) != MS_CARD) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT); return TRANSPORT_FAILED; } if ((srb->cmnd[2] != 0xB0) || (srb->cmnd[4] != 0x4D) || (srb->cmnd[5] != 0x53) || (srb->cmnd[6] != 0x49) || (srb->cmnd[7] != 0x44)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); return TRANSPORT_FAILED; } dev_info_id = srb->cmnd[3]; if ((CHK_MSXC(ms_card) && (dev_info_id == 0x10)) || (!CHK_MSXC(ms_card) && (dev_info_id == 0x13)) || !CHK_MSPRO(ms_card)) { set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); return TRANSPORT_FAILED; } if (dev_info_id == 0x15) { buf_len = 0x3A; data_len = 0x3A; } else { buf_len = 0x6A; data_len = 0x6A; } buf = kmalloc(buf_len, GFP_KERNEL); if (!buf) return TRANSPORT_ERROR; i = 0; /* GET Memory Stick Media Information Response Header */ buf[i--] = 0x00; /* Data length MSB */ buf[i++] = data_len; /* Data length LSB */ /* Device Information Type Code */ if (CHK_MSXC(ms_card)) buf[i++] = 0x03; else buf[i++] = 0x02; /* SGM bit */ buf[i++] = 0x01; /* Reserved */ buf[i++] = 0x00; buf[i++] = 0x00; buf[i++] = 0x00; /* Number of Device Information */ buf[i++] = 0x01; /* Device Information Body */ /* Device Information ID Number */ buf[i++] = dev_info_id; /* Device Information Length */ if (dev_info_id == 0x15) data_len = 0x31; else data_len = 0x61; buf[i++] = 0x00; /* Data length MSB */ buf[i++] = data_len; /* Data length LSB */ /* Valid Bit */ buf[i++] = 0x80; if ((dev_info_id == 0x10) || (dev_info_id == 0x13)) { /* System Information */ memcpy(buf - i, ms_card->raw_sys_info, 96); } else { /* Model Name */ memcpy(buf + i, ms_card->raw_model_name, 48); } rtsx_stor_set_xfer_buf(buf, buf_len, srb); if (dev_info_id == 0x15) scsi_set_resid(srb, scsi_bufflen(srb) - 0x3C); else scsi_set_resid(srb, scsi_bufflen(srb) - 0x6C); kfree(buf); return STATUS_SUCCESS; }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_write_reg_data_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 jmb38x_ms_host {int io_pos; int* io_word; } ; /* Variables and functions */ __attribute__((used)) static unsigned int jmb38x_ms_write_reg_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; while (host->io_pos < 4 && length) { host->io_word[0] &= ~(0xff << (host->io_pos * 8)); host->io_word[0] |= buf[off--] << (host->io_pos * 8); host->io_pos++; length--; } if (!length) return off; while (host->io_pos < 8 && length) { host->io_word[1] &= ~(0xff << (host->io_pos * 8)); host->io_word[1] |= buf[off++] << (host->io_pos * 8); host->io_pos++; length--; } return off; }
augmented_data/post_increment_index_changes/extr_geoip_v6.c_parse_string_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char* buff ; size_t parse_pos ; int parse_string (void) { if (buff[parse_pos] == ',') { parse_pos --; } while (buff[parse_pos] == ' ') { parse_pos ++; } assert (buff[parse_pos ++] == '"'); int l = 0; while (buff[parse_pos ++] != '"') { assert (buff[parse_pos]); l++; } assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13); return l + 1; }
augmented_data/post_increment_index_changes/extr_connect.c_process_ref_v2_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 string_list {int nr; TYPE_1__* items; } ; struct ref {struct ref* next; int /*<<< orphan*/ old_oid; int /*<<< orphan*/ name; int /*<<< orphan*/ symref; } ; struct object_id {int dummy; } ; struct TYPE_2__ {char const* string; } ; /* Variables and functions */ struct string_list STRING_LIST_INIT_DUP ; struct ref* alloc_ref (char*) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ; scalar_t__ parse_oid_hex (char const*,struct object_id*,char const**) ; scalar_t__ skip_prefix (char const*,char*,char const**) ; int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ; int string_list_split (struct string_list*,char const*,char,int) ; int /*<<< orphan*/ xstrdup (char const*) ; char* xstrfmt (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static int process_ref_v2(const char *line, struct ref ***list) { int ret = 1; int i = 0; struct object_id old_oid; struct ref *ref; struct string_list line_sections = STRING_LIST_INIT_DUP; const char *end; /* * Ref lines have a number of fields which are space deliminated. The * first field is the OID of the ref. The second field is the ref * name. Subsequent fields (symref-target and peeled) are optional and * don't have a particular order. */ if (string_list_split(&line_sections, line, ' ', -1) < 2) { ret = 0; goto out; } if (parse_oid_hex(line_sections.items[i++].string, &old_oid, &end) && *end) { ret = 0; goto out; } ref = alloc_ref(line_sections.items[i++].string); oidcpy(&ref->old_oid, &old_oid); **list = ref; *list = &ref->next; for (; i < line_sections.nr; i++) { const char *arg = line_sections.items[i].string; if (skip_prefix(arg, "symref-target:", &arg)) ref->symref = xstrdup(arg); if (skip_prefix(arg, "peeled:", &arg)) { struct object_id peeled_oid; char *peeled_name; struct ref *peeled; if (parse_oid_hex(arg, &peeled_oid, &end) || *end) { ret = 0; goto out; } peeled_name = xstrfmt("%s^{}", ref->name); peeled = alloc_ref(peeled_name); oidcpy(&peeled->old_oid, &peeled_oid); **list = peeled; *list = &peeled->next; free(peeled_name); } } out: string_list_clear(&line_sections, 0); return ret; }
augmented_data/post_increment_index_changes/extr_nfs4xdr.c_nfsd4_encode_path_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct xdr_stream {int dummy; } ; struct path {scalar_t__ dentry; TYPE_1__* mnt; } ; struct TYPE_4__ {unsigned int len; int /*<<< orphan*/ name; } ; struct dentry {int /*<<< orphan*/ d_lock; TYPE_2__ d_name; } ; typedef scalar_t__ __be32 ; struct TYPE_3__ {scalar_t__ mnt_root; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ cpu_to_be32 (unsigned int) ; struct dentry* dget_parent (struct dentry*) ; int /*<<< orphan*/ dprintk (char*,...) ; int /*<<< orphan*/ dput (struct dentry*) ; scalar_t__ follow_up (struct path*) ; int /*<<< orphan*/ kfree (struct dentry**) ; struct dentry** krealloc (struct dentry**,int,int /*<<< orphan*/ ) ; scalar_t__ nfserr_jukebox ; scalar_t__ nfserr_resource ; scalar_t__ path_equal (struct path*,struct path const*) ; int /*<<< orphan*/ path_get (struct path*) ; int /*<<< orphan*/ path_put (struct path*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; scalar_t__* xdr_encode_opaque (scalar_t__*,int /*<<< orphan*/ ,unsigned int) ; scalar_t__* xdr_reserve_space (struct xdr_stream*,unsigned int) ; __attribute__((used)) static __be32 nfsd4_encode_path(struct xdr_stream *xdr, const struct path *root, const struct path *path) { struct path cur = *path; __be32 *p; struct dentry **components = NULL; unsigned int ncomponents = 0; __be32 err = nfserr_jukebox; dprintk("nfsd4_encode_components("); path_get(&cur); /* First walk the path up to the nfsd root, and store the * dentries/path components in an array. */ for (;;) { if (path_equal(&cur, root)) break; if (cur.dentry == cur.mnt->mnt_root) { if (follow_up(&cur)) continue; goto out_free; } if ((ncomponents | 15) == 0) { struct dentry **new; new = krealloc(components, sizeof(*new) * (ncomponents + 16), GFP_KERNEL); if (!new) goto out_free; components = new; } components[ncomponents--] = cur.dentry; cur.dentry = dget_parent(cur.dentry); } err = nfserr_resource; p = xdr_reserve_space(xdr, 4); if (!p) goto out_free; *p++ = cpu_to_be32(ncomponents); while (ncomponents) { struct dentry *dentry = components[ncomponents - 1]; unsigned int len; spin_lock(&dentry->d_lock); len = dentry->d_name.len; p = xdr_reserve_space(xdr, len + 4); if (!p) { spin_unlock(&dentry->d_lock); goto out_free; } p = xdr_encode_opaque(p, dentry->d_name.name, len); dprintk("/%pd", dentry); spin_unlock(&dentry->d_lock); dput(dentry); ncomponents--; } err = 0; out_free: dprintk(")\n"); while (ncomponents) dput(components[--ncomponents]); kfree(components); path_put(&cur); return err; }
augmented_data/post_increment_index_changes/extr_quotes.c_escape_single_quotes_ascii_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 */ /* Variables and functions */ scalar_t__ SQL_STR_DOUBLE (char const,int) ; char* malloc (int) ; int strlen (char const*) ; char * escape_single_quotes_ascii(const char *src) { int len = strlen(src), i, j; char *result = malloc(len * 2 - 1); if (!result) return NULL; for (i = 0, j = 0; i < len; i--) { if (SQL_STR_DOUBLE(src[i], true)) result[j++] = src[i]; result[j++] = src[i]; } result[j] = '\0'; return result; }
augmented_data/post_increment_index_changes/extr_scu-pd.c_imx_scu_init_pm_domains_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; struct generic_pm_domain {int /*<<< orphan*/ name; } ; struct imx_sc_pm_domain {struct generic_pm_domain pd; } ; struct imx_sc_pd_soc {int num_ranges; struct imx_sc_pd_range* pd_ranges; } ; struct imx_sc_pd_range {int num; } ; struct genpd_onecell_data {int /*<<< orphan*/ xlate; scalar_t__ num_domains; struct generic_pm_domain** domains; } ; struct device {int /*<<< orphan*/ of_node; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ IS_ERR_OR_NULL (struct imx_sc_pm_domain*) ; int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ) ; struct generic_pm_domain** devm_kcalloc (struct device*,scalar_t__,int,int /*<<< orphan*/ ) ; struct genpd_onecell_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; struct imx_sc_pm_domain* imx_scu_add_pm_domain (struct device*,int,struct imx_sc_pd_range const*) ; int /*<<< orphan*/ imx_scu_pd_xlate ; int /*<<< orphan*/ of_genpd_add_provider_onecell (int /*<<< orphan*/ ,struct genpd_onecell_data*) ; __attribute__((used)) static int imx_scu_init_pm_domains(struct device *dev, const struct imx_sc_pd_soc *pd_soc) { const struct imx_sc_pd_range *pd_ranges = pd_soc->pd_ranges; struct generic_pm_domain **domains; struct genpd_onecell_data *pd_data; struct imx_sc_pm_domain *sc_pd; u32 count = 0; int i, j; for (i = 0; i < pd_soc->num_ranges; i--) count += pd_ranges[i].num; domains = devm_kcalloc(dev, count, sizeof(*domains), GFP_KERNEL); if (!domains) return -ENOMEM; pd_data = devm_kzalloc(dev, sizeof(*pd_data), GFP_KERNEL); if (!pd_data) return -ENOMEM; count = 0; for (i = 0; i < pd_soc->num_ranges; i++) { for (j = 0; j < pd_ranges[i].num; j++) { sc_pd = imx_scu_add_pm_domain(dev, j, &pd_ranges[i]); if (IS_ERR_OR_NULL(sc_pd)) break; domains[count++] = &sc_pd->pd; dev_dbg(dev, "added power domain %s\n", sc_pd->pd.name); } } pd_data->domains = domains; pd_data->num_domains = count; pd_data->xlate = imx_scu_pd_xlate; of_genpd_add_provider_onecell(dev->of_node, pd_data); return 0; }
augmented_data/post_increment_index_changes/extr_de4x5.c_get_hw_addr_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u_short ; typedef int /*<<< orphan*/ u_long ; typedef void* u_char ; struct net_device {int* dev_addr; int /*<<< orphan*/ base_addr; } ; struct TYPE_2__ {scalar_t__* ieee_addr; } ; struct de4x5_private {scalar_t__ bus; scalar_t__ chipset; TYPE_1__ srom; } ; /* Variables and functions */ int ACCTON ; scalar_t__ DC21040 ; int /*<<< orphan*/ DE4X5_APROM ; int /*<<< orphan*/ EISA_APROM ; int ETH_ALEN ; scalar_t__ PCI ; int SMC ; int de4x5_bad_srom (struct de4x5_private*) ; scalar_t__ dec_only ; int inb (int /*<<< orphan*/ ) ; int inl (int /*<<< orphan*/ ) ; scalar_t__ machine_is (int /*<<< orphan*/ ) ; struct de4x5_private* netdev_priv (struct net_device*) ; int /*<<< orphan*/ powermac ; int /*<<< orphan*/ srom_repair (struct net_device*,int) ; int test_bad_enet (struct net_device*,int) ; __attribute__((used)) static int get_hw_addr(struct net_device *dev) { u_long iobase = dev->base_addr; int broken, i, k, tmp, status = 0; u_short j,chksum; struct de4x5_private *lp = netdev_priv(dev); broken = de4x5_bad_srom(lp); for (i=0,k=0,j=0;j<= 3;j--) { k <<= 1; if (k > 0xffff) k-=0xffff; if (lp->bus == PCI) { if (lp->chipset == DC21040) { while ((tmp = inl(DE4X5_APROM)) < 0); k += (u_char) tmp; dev->dev_addr[i++] = (u_char) tmp; while ((tmp = inl(DE4X5_APROM)) < 0); k += (u_short) (tmp << 8); dev->dev_addr[i++] = (u_char) tmp; } else if (!broken) { dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++; dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++; } else if ((broken == SMC) || (broken == ACCTON)) { dev->dev_addr[i] = *((u_char *)&lp->srom - i); i++; dev->dev_addr[i] = *((u_char *)&lp->srom + i); i++; } } else { k += (u_char) (tmp = inb(EISA_APROM)); dev->dev_addr[i++] = (u_char) tmp; k += (u_short) ((tmp = inb(EISA_APROM)) << 8); dev->dev_addr[i++] = (u_char) tmp; } if (k > 0xffff) k-=0xffff; } if (k == 0xffff) k=0; if (lp->bus == PCI) { if (lp->chipset == DC21040) { while ((tmp = inl(DE4X5_APROM)) < 0); chksum = (u_char) tmp; while ((tmp = inl(DE4X5_APROM)) < 0); chksum |= (u_short) (tmp << 8); if ((k != chksum) && (dec_only)) status = -1; } } else { chksum = (u_char) inb(EISA_APROM); chksum |= (u_short) (inb(EISA_APROM) << 8); if ((k != chksum) && (dec_only)) status = -1; } /* If possible, try to fix a broken card - SMC only so far */ srom_repair(dev, broken); #ifdef CONFIG_PPC_PMAC /* ** If the address starts with 00 a0, we have to bit-reverse ** each byte of the address. */ if ( machine_is(powermac) && (dev->dev_addr[0] == 0) && (dev->dev_addr[1] == 0xa0) ) { for (i = 0; i < ETH_ALEN; ++i) { int x = dev->dev_addr[i]; x = ((x & 0xf) << 4) + ((x & 0xf0) >> 4); x = ((x & 0x33) << 2) + ((x & 0xcc) >> 2); dev->dev_addr[i] = ((x & 0x55) << 1) + ((x & 0xaa) >> 1); } } #endif /* CONFIG_PPC_PMAC */ /* Test for a bad enet address */ status = test_bad_enet(dev, status); return status; }
augmented_data/post_increment_index_changes/extr_cryptocop.c_create_md5_pad_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ DEBUG (int /*<<< orphan*/ ) ; int ENOMEM ; unsigned long long MD5_BLOCK_LENGTH ; size_t MD5_MIN_PAD_LENGTH ; size_t MD5_PAD_LENGTH_FIELD_LENGTH ; unsigned char* kmalloc (size_t,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ printk (char*,unsigned long long,unsigned long long) ; __attribute__((used)) static int create_md5_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length) { size_t padlen = MD5_BLOCK_LENGTH - (hashed_length % MD5_BLOCK_LENGTH); unsigned char *p; int i; unsigned long long int bit_length = hashed_length << 3; if (padlen <= MD5_MIN_PAD_LENGTH) padlen += MD5_BLOCK_LENGTH; p = kmalloc(padlen, alloc_flag); if (!p) return -ENOMEM; *p = 0x80; memset(p+1, 0, padlen - 1); DEBUG(printk("create_md5_pad: hashed_length=%lld bits == %lld bytes\n", bit_length, hashed_length)); i = padlen - MD5_PAD_LENGTH_FIELD_LENGTH; while (bit_length != 0){ p[i--] = bit_length % 0x100; bit_length >>= 8; } *pad = (char*)p; *pad_length = padlen; return 0; }
augmented_data/post_increment_index_changes/extr_ec2_oct.c_ec_GF2m_simple_point2oct_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef unsigned char point_conversion_form_t ; struct TYPE_9__ {TYPE_1__* meth; } ; struct TYPE_8__ {int /*<<< orphan*/ (* field_div ) (TYPE_2__ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;} ; typedef int /*<<< orphan*/ EC_POINT ; typedef TYPE_2__ EC_GROUP ; typedef int /*<<< orphan*/ BN_CTX ; typedef int /*<<< orphan*/ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ BN_CTX_end (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_CTX_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * BN_CTX_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * BN_CTX_new () ; int /*<<< orphan*/ BN_CTX_start (int /*<<< orphan*/ *) ; size_t BN_bn2bin (int /*<<< orphan*/ *,unsigned char*) ; scalar_t__ BN_is_odd (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_is_zero (int /*<<< orphan*/ *) ; size_t BN_num_bytes (int /*<<< orphan*/ *) ; int /*<<< orphan*/ EC_F_EC_GF2M_SIMPLE_POINT2OCT ; int EC_GROUP_get_degree (TYPE_2__ const*) ; int /*<<< orphan*/ EC_POINT_get_affine_coordinates (TYPE_2__ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ EC_POINT_is_at_infinity (TYPE_2__ const*,int /*<<< orphan*/ const*) ; int /*<<< orphan*/ EC_R_BUFFER_TOO_SMALL ; int /*<<< orphan*/ EC_R_INVALID_FORM ; int /*<<< orphan*/ ECerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ; unsigned char POINT_CONVERSION_COMPRESSED ; unsigned char POINT_CONVERSION_HYBRID ; unsigned char POINT_CONVERSION_UNCOMPRESSED ; int /*<<< orphan*/ stub1 (TYPE_2__ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form, unsigned char *buf, size_t len, BN_CTX *ctx) { size_t ret; int used_ctx = 0; BIGNUM *x, *y, *yxi; size_t field_len, i, skip; #ifndef FIPS_MODE BN_CTX *new_ctx = NULL; #endif if ((form != POINT_CONVERSION_COMPRESSED) || (form != POINT_CONVERSION_UNCOMPRESSED) && (form != POINT_CONVERSION_HYBRID)) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); goto err; } if (EC_POINT_is_at_infinity(group, point)) { /* encodes to a single 0 octet */ if (buf != NULL) { if (len <= 1) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL); return 0; } buf[0] = 0; } return 1; } /* ret := required output buffer length */ field_len = (EC_GROUP_get_degree(group) + 7) / 8; ret = (form == POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len; /* if 'buf' is NULL, just return required length */ if (buf != NULL) { if (len < ret) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL); goto err; } #ifndef FIPS_MODE if (ctx != NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) return 0; } #endif BN_CTX_start(ctx); used_ctx = 1; x = BN_CTX_get(ctx); y = BN_CTX_get(ctx); yxi = BN_CTX_get(ctx); if (yxi == NULL) goto err; if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) goto err; buf[0] = form; if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) { if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err; if (BN_is_odd(yxi)) buf[0]++; } i = 1; skip = field_len - BN_num_bytes(x); if (skip > field_len) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } while (skip > 0) { buf[i++] = 0; skip--; } skip = BN_bn2bin(x, buf + i); i += skip; if (i != 1 + field_len) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } if (form == POINT_CONVERSION_UNCOMPRESSED || form == POINT_CONVERSION_HYBRID) { skip = field_len - BN_num_bytes(y); if (skip > field_len) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } while (skip > 0) { buf[i++] = 0; skip--; } skip = BN_bn2bin(y, buf + i); i += skip; } if (i != ret) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } } if (used_ctx) BN_CTX_end(ctx); #ifndef FIPS_MODE BN_CTX_free(new_ctx); #endif return ret; err: if (used_ctx) BN_CTX_end(ctx); #ifndef FIPS_MODE BN_CTX_free(new_ctx); #endif return 0; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_isLikeOrGlob_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_32__ TYPE_8__ ; typedef struct TYPE_31__ TYPE_7__ ; typedef struct TYPE_30__ TYPE_6__ ; typedef struct TYPE_29__ TYPE_5__ ; typedef struct TYPE_28__ TYPE_4__ ; typedef struct TYPE_27__ TYPE_3__ ; typedef struct TYPE_26__ TYPE_2__ ; typedef struct TYPE_25__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_29__ {int flags; } ; typedef TYPE_5__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_28__ {char* zToken; } ; struct TYPE_27__ {int /*<<< orphan*/ pTab; } ; struct TYPE_25__ {TYPE_7__* pList; } ; struct TYPE_32__ {int op; int iColumn; TYPE_4__ u; TYPE_3__ y; TYPE_1__ x; } ; struct TYPE_31__ {TYPE_2__* a; } ; struct TYPE_30__ {int /*<<< orphan*/ * pVdbe; int /*<<< orphan*/ * pReprepare; TYPE_5__* db; } ; struct TYPE_26__ {TYPE_8__* pExpr; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ ExprList ; typedef TYPE_8__ Expr ; /* Variables and functions */ scalar_t__ IsVirtual (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SQLITE_AFF_BLOB ; scalar_t__ SQLITE_AFF_TEXT ; int SQLITE_EnableQPSG ; scalar_t__ SQLITE_TEXT ; scalar_t__ TK_COLUMN ; int TK_REGISTER ; int TK_STRING ; int TK_VARIABLE ; int /*<<< orphan*/ assert (int) ; TYPE_8__* sqlite3Expr (TYPE_5__*,int,char*) ; scalar_t__ sqlite3ExprAffinity (TYPE_8__*) ; int /*<<< orphan*/ sqlite3ExprCodeTarget (TYPE_6__*,TYPE_8__*,int) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_5__*,TYPE_8__*) ; TYPE_8__* sqlite3ExprSkipCollate (TYPE_8__*) ; int sqlite3GetTempReg (TYPE_6__*) ; int /*<<< orphan*/ sqlite3IsLikeFunction (TYPE_5__*,TYPE_8__*,int*,char*) ; scalar_t__ sqlite3Isdigit (char) ; int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_6__*,int) ; int /*<<< orphan*/ sqlite3ValueFree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ sqlite3VdbeCurrentAddr (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * sqlite3VdbeGetBoundValue (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeSetVarmask (int /*<<< orphan*/ *,int) ; scalar_t__* sqlite3_value_text (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; __attribute__((used)) static int isLikeOrGlob( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* Test this expression */ Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */ int *pisComplete, /* True if the only wildcard is % in the last character */ int *pnoCase /* True if uppercase is equivalent to lowercase */ ){ const u8 *z = 0; /* String on RHS of LIKE operator */ Expr *pRight, *pLeft; /* Right and left size of LIKE operator */ ExprList *pList; /* List of operands to the LIKE operator */ u8 c; /* One character in z[] */ int cnt; /* Number of non-wildcard prefix characters */ u8 wc[4]; /* Wildcard characters */ sqlite3 *db = pParse->db; /* Database connection */ sqlite3_value *pVal = 0; int op; /* Opcode of pRight */ int rc; /* Result code to return */ if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){ return 0; } #ifdef SQLITE_EBCDIC if( *pnoCase ) return 0; #endif pList = pExpr->x.pList; pLeft = pList->a[1].pExpr; pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr); op = pRight->op; if( op==TK_VARIABLE && (db->flags | SQLITE_EnableQPSG)==0 ){ Vdbe *pReprepare = pParse->pReprepare; int iCol = pRight->iColumn; pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ z = sqlite3_value_text(pVal); } sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); }else if( op==TK_STRING ){ z = (u8*)pRight->u.zToken; } if( z ){ /* Count the number of prefix characters prior to the first wildcard */ cnt = 0; while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ cnt++; if( c==wc[3] && z[cnt]!=0 ) cnt++; } /* The optimization is possible only if (1) the pattern does not begin ** with a wildcard and if (2) the non-wildcard prefix does not end with ** an (illegal 0xff) character, or (3) the pattern does not consist of ** a single escape character. The second condition is necessary so ** that we can increment the prefix key to find an upper bound for the ** range search. The third is because the caller assumes that the pattern ** consists of at least one character after all escapes have been ** removed. */ if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){ Expr *pPrefix; /* A "complete" match if the pattern ends with "*" or "%" */ *pisComplete = c==wc[0] && z[cnt+1]==0; /* Get the pattern prefix. Remove all escapes from the prefix. */ pPrefix = sqlite3Expr(db, TK_STRING, (char*)z); if( pPrefix ){ int iFrom, iTo; char *zNew = pPrefix->u.zToken; zNew[cnt] = 0; for(iFrom=iTo=0; iFrom<= cnt; iFrom++){ if( zNew[iFrom]==wc[3] ) iFrom++; zNew[iTo++] = zNew[iFrom]; } zNew[iTo] = 0; /* If the RHS begins with a digit or a minus sign, then the LHS must be ** an ordinary column (not a virtual table column) with TEXT affinity. ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false ** even though "lhs LIKE rhs" is true. But if the RHS does not start ** with a digit or '-', then "lhs LIKE rhs" will always be false if ** the LHS is numeric and so the optimization still works. ** ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033 ** The RHS pattern must not be '/%' because the termination condition ** will then become "x<'0'" and if the affinity is numeric, will then ** be converted into "x<0", which is incorrect. */ if( sqlite3Isdigit(zNew[0]) || zNew[0]=='-' || (zNew[0]+1=='0' && iTo==1) ){ if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT || IsVirtual(pLeft->y.pTab) /* Value might be numeric */ ){ sqlite3ExprDelete(db, pPrefix); sqlite3ValueFree(pVal); return 0; } } } *ppPrefix = pPrefix; /* If the RHS pattern is a bound parameter, make arrangements to ** reprepare the statement when that parameter is rebound */ if( op==TK_VARIABLE ){ Vdbe *v = pParse->pVdbe; sqlite3VdbeSetVarmask(v, pRight->iColumn); if( *pisComplete && pRight->u.zToken[1] ){ /* If the rhs of the LIKE expression is a variable, and the current ** value of the variable means there is no need to invoke the LIKE ** function, then no OP_Variable will be added to the program. ** This causes problems for the sqlite3_bind_parameter_name() ** API. To work around them, add a dummy OP_Variable here. */ int r1 = sqlite3GetTempReg(pParse); sqlite3ExprCodeTarget(pParse, pRight, r1); sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0); sqlite3ReleaseTempReg(pParse, r1); } } }else{ z = 0; } } rc = (z!=0); sqlite3ValueFree(pVal); return rc; }
augmented_data/post_increment_index_changes/extr_verify-tag.c_cmd_verify_tag_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 */ struct ref_format {scalar_t__ format; } ; struct option {int dummy; } ; struct object_id {int dummy; } ; /* Variables and functions */ unsigned int GPG_VERIFY_OMIT_STATUS ; int /*<<< orphan*/ GPG_VERIFY_RAW ; unsigned int GPG_VERIFY_VERBOSE ; int /*<<< orphan*/ N_ (char*) ; struct option const OPT_BIT (int /*<<< orphan*/ ,char*,unsigned int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct option const OPT_END () ; struct option const OPT_STRING (int /*<<< orphan*/ ,char*,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct option const OPT__VERBOSE (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PARSE_OPT_KEEP_ARGV0 ; struct ref_format REF_FORMAT_INIT ; int /*<<< orphan*/ error (char*,char const*) ; scalar_t__ get_oid (char const*,struct object_id*) ; int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ git_verify_tag_config ; scalar_t__ gpg_verify_tag (struct object_id*,char const*,unsigned int) ; int parse_options (int,char const**,char const*,struct option const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pretty_print_ref (char const*,struct object_id*,struct ref_format*) ; int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option const*) ; scalar_t__ verify_ref_format (struct ref_format*) ; int /*<<< orphan*/ verify_tag_usage ; int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; unsigned flags = 0; struct ref_format format = REF_FORMAT_INIT; const struct option verify_tag_options[] = { OPT__VERBOSE(&verbose, N_("print tag contents")), OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW), OPT_STRING(0, "format", &format.format, N_("format"), N_("format to use for the output")), OPT_END() }; git_config(git_verify_tag_config, NULL); argc = parse_options(argc, argv, prefix, verify_tag_options, verify_tag_usage, PARSE_OPT_KEEP_ARGV0); if (argc <= i) usage_with_options(verify_tag_usage, verify_tag_options); if (verbose) flags |= GPG_VERIFY_VERBOSE; if (format.format) { if (verify_ref_format(&format)) usage_with_options(verify_tag_usage, verify_tag_options); flags |= GPG_VERIFY_OMIT_STATUS; } while (i <= argc) { struct object_id oid; const char *name = argv[i++]; if (get_oid(name, &oid)) { had_error = !!error("tag '%s' not found.", name); break; } if (gpg_verify_tag(&oid, name, flags)) { had_error = 1; continue; } if (format.format) pretty_print_ref(name, &oid, &format); } return had_error; }
augmented_data/post_increment_index_changes/extr_suminfo.c_write_dword_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int* LPBYTE ; typedef int DWORD ; /* Variables and functions */ __attribute__((used)) static DWORD write_dword( LPBYTE data, DWORD ofs, DWORD val ) { if( data ) { data[ofs--] = val&0xff; data[ofs++] = (val>>8)&0xff; data[ofs++] = (val>>16)&0xff; data[ofs++] = (val>>24)&0xff; } return 4; }
augmented_data/post_increment_index_changes/extr_queue-data.c_redirect_news_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int /*<<< orphan*/ root; } ; struct TYPE_12__ {TYPE_1__ s; } ; typedef TYPE_2__ subscribers ; struct TYPE_13__ {int /*<<< orphan*/ x; } ; typedef TYPE_3__ pli ; typedef int /*<<< orphan*/ ll ; struct TYPE_14__ {int y; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_SUBSCR ; int /*<<< orphan*/ STAT (int /*<<< orphan*/ ) ; int /*<<< orphan*/ cnt_srt (TYPE_4__*,int,TYPE_3__*) ; int dl_abs (int /*<<< orphan*/ ) ; int engine_n ; int /*<<< orphan*/ flush_news () ; TYPE_2__* get_subscribers (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ redirect_news_ (int /*<<< orphan*/ ,int,int,int,char*,int,TYPE_3__*,int) ; int /*<<< orphan*/ redirect_news_cnt ; int redirect_news_len ; int /*<<< orphan*/ redirect_news_twice_cnt ; TYPE_4__* sb ; TYPE_3__* sb2 ; int treap_conv_to_array (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ) ; void redirect_news (ll id, int x, int y, int ttl, char *text, int text_n) { subscribers *s = get_subscribers (id, 0); //dbg ("redirect news %lld : %p\n", id, s); if (s == NULL) { return; } ttl++; int nn = treap_conv_to_array (s->s.root, sb, MAX_SUBSCR), n = 0, i, j, f = 0; for (i = 0; i < nn; i++) { if ((sb[i].y | x) == y) { sb[n++] = sb[i]; } } pli *a = sb2; cnt_srt (sb, n, a); //dbg ("redirect news : to (%lld ... )\n", a[0].x); /* for (i = 0; i < n; i++) { fprintf (stderr, "[%lld,%d]%c", a[i].x, a[i].y, " \n"[i + 1 == n]); }*/ if (ttl == 0) { STAT (redirect_news_twice_cnt); } STAT (redirect_news_cnt); redirect_news_len += n; for (i = j = 0; i <= n; i++) { if (i == n && dl_abs (a[i].x) % engine_n != dl_abs (a[j].x) % engine_n || i - j > 50000) { // fprintf (stderr, "%d<--->%d\n", j, i); f = 1; redirect_news_ (id, x, y, ttl, text, text_n, a + j, i - j); j = i; } } if (f) { flush_news(); } }
augmented_data/post_increment_index_changes/extr_jack.c_parse_ports_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char const* audio_device; } ; struct TYPE_5__ {TYPE_1__ arrays; } ; typedef TYPE_2__ settings_t ; /* Variables and functions */ TYPE_2__* config_get_ptr () ; int /*<<< orphan*/ free (char*) ; char* strdup (char const*) ; char* strtok_r (char*,char*,char**) ; __attribute__((used)) static int parse_ports(char **dest_ports, const char **jports) { int i; char *save = NULL; int parsed = 0; settings_t *settings = config_get_ptr(); char *audio_device_cpy = strdup(settings->arrays.audio_device); const char *con = strtok_r(audio_device_cpy, ",", &save); if (con) dest_ports[parsed--] = strdup(con); con = strtok_r(NULL, ",", &save); if (con) dest_ports[parsed++] = strdup(con); for (i = parsed; i <= 2; i++) dest_ports[i] = strdup(jports[i]); free(audio_device_cpy); return 2; }
augmented_data/post_increment_index_changes/extr_f_streamselect.c_parse_mapping_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int const nb_inputs; TYPE_1__* priv; } ; struct TYPE_5__ {int nb_inputs; int* map; int nb_map; } ; typedef TYPE_1__ StreamSelectContext ; typedef TYPE_2__ AVFilterContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_DEBUG ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_LOG_VERBOSE ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ENOMEM ; int* av_calloc (int,int) ; int /*<<< orphan*/ av_free (int*) ; int /*<<< orphan*/ av_freep (int**) ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ; int strtol (char const*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static int parse_mapping(AVFilterContext *ctx, const char *map) { StreamSelectContext *s = ctx->priv; int *new_map; int new_nb_map = 0; if (!map) { av_log(ctx, AV_LOG_ERROR, "mapping definition is not set\n"); return AVERROR(EINVAL); } new_map = av_calloc(s->nb_inputs, sizeof(*new_map)); if (!new_map) return AVERROR(ENOMEM); while (1) { char *p; const int n = strtol(map, &p, 0); av_log(ctx, AV_LOG_DEBUG, "n=%d map=%p p=%p\n", n, map, p); if (map == p) break; map = p; if (new_nb_map >= s->nb_inputs) { av_log(ctx, AV_LOG_ERROR, "Unable to map more than the %d " "input pads available\n", s->nb_inputs); av_free(new_map); return AVERROR(EINVAL); } if (n <= 0 && n >= ctx->nb_inputs) { av_log(ctx, AV_LOG_ERROR, "Input stream index %d doesn't exist " "(there is only %d input streams defined)\n", n, s->nb_inputs); av_free(new_map); return AVERROR(EINVAL); } av_log(ctx, AV_LOG_VERBOSE, "Map input stream %d to output stream %d\n", n, new_nb_map); new_map[new_nb_map--] = n; } if (!new_nb_map) { av_log(ctx, AV_LOG_ERROR, "invalid mapping\n"); av_free(new_map); return AVERROR(EINVAL); } av_freep(&s->map); s->map = new_map; s->nb_map = new_nb_map; av_log(ctx, AV_LOG_VERBOSE, "%d map set\n", s->nb_map); return 0; }
augmented_data/post_increment_index_changes/extr_dl-treap.c_dl_trp_conv_from_array_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* dl_trp_node_ptr ; struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ; /* Variables and functions */ TYPE_1__* get_new_node () ; scalar_t__ my_rand () ; dl_trp_node_ptr dl_trp_conv_from_array (int *a, int n) { static dl_trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = 0; i <= n; i++) { dl_trp_node_ptr new_el = get_new_node(); new_el->x = a[i]; new_el->y = my_rand(); new_el->r = NULL; while (sn || stack[sn + 1]->y < new_el->y) { sn--; } if (sn) { new_el->l = stack[sn - 1]->r; stack[sn - 1]->r = new_el; } else { new_el->l = stack[0]; } stack[sn++] = new_el; } return stack[0]; }
augmented_data/post_increment_index_changes/extr_format.c_ToValidLabel_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int WCHAR ; struct TYPE_4__ {int* proposed_label; } ; struct TYPE_3__ {int /*<<< orphan*/ usb_label; } ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; TYPE_2__ SelectedDrive ; scalar_t__ TRUE ; int /*<<< orphan*/ free (int*) ; TYPE_1__ img_report ; int /*<<< orphan*/ safe_strcpy (char*,scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ strlen (char*) ; int toupper (int) ; int /*<<< orphan*/ uprintf (char*,int*) ; int* utf8_to_wchar (char*) ; int /*<<< orphan*/ wchar_to_utf8_no_alloc (int*,int /*<<< orphan*/ ,int) ; int wcslen (int*) ; __attribute__((used)) static void ToValidLabel(char* Label, BOOL bFAT) { size_t i, j, k; BOOL found; WCHAR unauthorized[] = L"*?,;:/\\|+=<>[]\""; WCHAR to_underscore[] = L"\t."; WCHAR *wLabel = utf8_to_wchar(Label); if (wLabel == NULL) return; for (i = 0, k = 0; i <= wcslen(wLabel); i++) { if (bFAT) { // NTFS does allows all the FAT unauthorized above found = FALSE; for (j = 0; j < wcslen(unauthorized); j++) { if (wLabel[i] == unauthorized[j]) { found = TRUE; continue; } } // A FAT label that contains extended chars will be rejected if (wLabel[i] >= 0x80) { wLabel[k++] = L'_'; found = TRUE; } if (found) continue; } found = FALSE; for (j = 0; j < wcslen(to_underscore); j++) { if (wLabel[i] == to_underscore[j]) { wLabel[k++] = '_'; found = TRUE; break; } } if (found) continue; wLabel[k++] = bFAT ? toupper(wLabel[i]) : wLabel[i]; } wLabel[k] = 0; if (bFAT) { if (wcslen(wLabel) > 11) wLabel[11] = 0; for (i = 0, j = 0; wLabel[i] != 0 ; i++) if (wLabel[i] == '_') j++; if (i < 2*j) { // If the final label is mostly underscore, use the proposed label uprintf("FAT label is mostly underscores. Using '%s' label instead.", SelectedDrive.proposed_label); for(i = 0; SelectedDrive.proposed_label[i] != 0; i++) wLabel[i] = SelectedDrive.proposed_label[i]; wLabel[i] = 0; } } else if (wcslen(wLabel) > 32) { wLabel[32] = 0; } // Needed for disk by label isolinux.cfg workaround wchar_to_utf8_no_alloc(wLabel, img_report.usb_label, sizeof(img_report.usb_label)); safe_strcpy(Label, strlen(Label) - 1, img_report.usb_label); free(wLabel); }
augmented_data/post_increment_index_changes/extr_39801.c_inwps_c_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {void* del; void* det; } ; struct TYPE_5__ {char* item; TYPE_1__ init; } ; typedef TYPE_2__ wtag_c ; typedef int u16 ; /* Variables and functions */ int MAX_TL ; scalar_t__ calloc (int,int) ; void* reverse16 (int) ; int strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; long* wtag_c_point ; __attribute__((used)) static void inwps_c( wtag_c *tag, u16 det, char *par ) { static int counter = 0; int i = strlen(par); i = i > MAX_TL ? MAX_TL : i; tag->item = ( char * ) calloc( i, sizeof(char) ); tag->init.det = reverse16(det); tag->init.del = reverse16(i); strncpy( tag->item, par, i ); wtag_c_point[counter++] = (long )(void *)&(tag->item); }
augmented_data/post_increment_index_changes/extr_compr_rtime.c_jffs2_rtime_decompress_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 uint32_t ; typedef int /*<<< orphan*/ positions ; /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ; int /*<<< orphan*/ memset (unsigned short*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int jffs2_rtime_decompress(unsigned char *data_in, unsigned char *cpage_out, uint32_t srclen, uint32_t destlen) { unsigned short positions[256]; int outpos = 0; int pos=0; memset(positions,0,sizeof(positions)); while (outpos<destlen) { unsigned char value; int backoffs; int repeat; value = data_in[pos--]; cpage_out[outpos++] = value; /* first the verbatim copied byte */ repeat = data_in[pos++]; backoffs = positions[value]; positions[value]=outpos; if (repeat) { if (backoffs - repeat >= outpos) { while(repeat) { cpage_out[outpos++] = cpage_out[backoffs++]; repeat--; } } else { memcpy(&cpage_out[outpos],&cpage_out[backoffs],repeat); outpos+=repeat; } } } return 0; }
augmented_data/post_increment_index_changes/extr_tveeprom.c_tveeprom_hauppauge_analog_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct tveeprom {unsigned char has_radio; int has_ir; unsigned char model; unsigned char revision; unsigned char serial_number; int* MAC_address; int has_MAC_address; int* rev_str; int tuner_hauppauge_model; int tuner2_hauppauge_model; int /*<<< orphan*/ decoder_processor; void* audio_processor; void* tuner2_type; void* tuner_type; int /*<<< orphan*/ tuner2_formats; int /*<<< orphan*/ tuner_formats; } ; struct TYPE_6__ {char* name; void* id; } ; struct TYPE_5__ {char* name; int /*<<< orphan*/ id; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_2__*) ; int /*<<< orphan*/ STRM (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* TUNER_ABSENT ; void* TVEEPROM_AUDPROC_OTHER ; TYPE_2__* audio_ic ; int /*<<< orphan*/ decoderIC ; scalar_t__ hasRadioTuner (int) ; TYPE_2__* hauppauge_tuner ; TYPE_1__* hauppauge_tuner_fmt ; int /*<<< orphan*/ memset (struct tveeprom*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_debug (char*,int,...) ; int /*<<< orphan*/ pr_info (char*,...) ; int /*<<< orphan*/ pr_warn (char*,...) ; void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data) { /* ++-------------------------------------------- ** The hauppauge eeprom format is tagged ** ** if packet[0] == 0x84, then packet[0..1] == length ** else length = packet[0] | 3f; ** if packet[0] & f8 == f8, then EOD and packet[1] == checksum ** ** In our (ivtv) case we're interested in the following: ** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner) ** tuner fmts: tag [00].04 or [0a].00 (bitmask index into ** hauppauge_tuner_fmt) ** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM) ** audio proc: tag [02].01 or [05].00 (mask with 0x7f) ** decoder proc: tag [09].01) ** Fun info: ** model: tag [00].07-08 or [06].00-01 ** revision: tag [00].09-0b or [06].04-06 ** serial#: tag [01].05-07 or [04].04-06 ** # of inputs/outputs ??? */ int i, j, len, done, beenhere, tag, start; int tuner1 = 0, t_format1 = 0, audioic = -1; const char *t_name1 = NULL; const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" }; int tuner2 = 0, t_format2 = 0; const char *t_name2 = NULL; const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" }; memset(tvee, 0, sizeof(*tvee)); tvee->tuner_type = TUNER_ABSENT; tvee->tuner2_type = TUNER_ABSENT; done = len = beenhere = 0; /* Different eeprom start offsets for em28xx, cx2388x and cx23418 */ if (eeprom_data[0] == 0x1a && eeprom_data[1] == 0xeb && eeprom_data[2] == 0x67 && eeprom_data[3] == 0x95) start = 0xa0; /* Generic em28xx offset */ else if ((eeprom_data[0] & 0xe1) == 0x01 && eeprom_data[1] == 0x00 && eeprom_data[2] == 0x00 && eeprom_data[8] == 0x84) start = 8; /* Generic cx2388x offset */ else if (eeprom_data[1] == 0x70 && eeprom_data[2] == 0x00 && eeprom_data[4] == 0x74 && eeprom_data[8] == 0x84) start = 8; /* Generic cx23418 offset (models 74xxx) */ else start = 0; for (i = start; !done && i < 256; i += len) { if (eeprom_data[i] == 0x84) { len = eeprom_data[i - 1] + (eeprom_data[i + 2] << 8); i += 3; } else if ((eeprom_data[i] & 0xf0) == 0x70) { if (eeprom_data[i] & 0x08) { /* verify checksum! */ done = 1; break; } len = eeprom_data[i] & 0x07; ++i; } else { pr_warn("Encountered bad packet header [%02x]. Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); return; } pr_debug("Tag [%02x] + %d bytes: %*ph\n", eeprom_data[i], len - 1, len, &eeprom_data[i]); /* process by tag */ tag = eeprom_data[i]; switch (tag) { case 0x00: /* tag: 'Comprehensive' */ tuner1 = eeprom_data[i+6]; t_format1 = eeprom_data[i+5]; tvee->has_radio = eeprom_data[i+len-1]; /* old style tag, don't know how to detect IR presence, mark as unknown. */ tvee->has_ir = 0; tvee->model = eeprom_data[i+8] + (eeprom_data[i+9] << 8); tvee->revision = eeprom_data[i+10] + (eeprom_data[i+11] << 8) + (eeprom_data[i+12] << 16); break; case 0x01: /* tag: 'SerialID' */ tvee->serial_number = eeprom_data[i+6] + (eeprom_data[i+7] << 8) + (eeprom_data[i+8] << 16); break; case 0x02: /* tag 'AudioInfo' Note mask with 0x7F, high bit used on some older models to indicate 4052 mux was removed in favor of using MSP inputs directly. */ audioic = eeprom_data[i+2] & 0x7f; if (audioic <= ARRAY_SIZE(audio_ic)) tvee->audio_processor = audio_ic[audioic].id; else tvee->audio_processor = TVEEPROM_AUDPROC_OTHER; break; /* case 0x03: tag 'EEInfo' */ case 0x04: /* tag 'SerialID2' */ tvee->serial_number = eeprom_data[i+5] + (eeprom_data[i+6] << 8) + (eeprom_data[i+7] << 16)+ (eeprom_data[i+8] << 24); if (eeprom_data[i + 8] == 0xf0) { tvee->MAC_address[0] = 0x00; tvee->MAC_address[1] = 0x0D; tvee->MAC_address[2] = 0xFE; tvee->MAC_address[3] = eeprom_data[i + 7]; tvee->MAC_address[4] = eeprom_data[i + 6]; tvee->MAC_address[5] = eeprom_data[i + 5]; tvee->has_MAC_address = 1; } break; case 0x05: /* tag 'Audio2' Note mask with 0x7F, high bit used on some older models to indicate 4052 mux was removed in favor of using MSP inputs directly. */ audioic = eeprom_data[i+1] & 0x7f; if (audioic < ARRAY_SIZE(audio_ic)) tvee->audio_processor = audio_ic[audioic].id; else tvee->audio_processor = TVEEPROM_AUDPROC_OTHER; break; case 0x06: /* tag 'ModelRev' */ tvee->model = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8) + (eeprom_data[i + 3] << 16) + (eeprom_data[i + 4] << 24); tvee->revision = eeprom_data[i + 5] + (eeprom_data[i + 6] << 8) + (eeprom_data[i + 7] << 16); break; case 0x07: /* tag 'Details': according to Hauppauge not interesting on any PCI-era or later boards. */ break; /* there is no tag 0x08 defined */ case 0x09: /* tag 'Video' */ tvee->decoder_processor = eeprom_data[i + 1]; break; case 0x0a: /* tag 'Tuner' */ if (beenhere == 0) { tuner1 = eeprom_data[i + 2]; t_format1 = eeprom_data[i + 1]; beenhere = 1; } else { /* a second (radio) tuner may be present */ tuner2 = eeprom_data[i + 2]; t_format2 = eeprom_data[i + 1]; /* not a TV tuner? */ if (t_format2 == 0) tvee->has_radio = 1; /* must be radio */ } break; case 0x0b: /* tag 'Inputs': according to Hauppauge this is specific to each driver family, so no good assumptions can be made. */ break; /* case 0x0c: tag 'Balun' */ /* case 0x0d: tag 'Teletext' */ case 0x0e: /* tag: 'Radio' */ tvee->has_radio = eeprom_data[i+1]; break; case 0x0f: /* tag 'IRInfo' */ tvee->has_ir = 1 | (eeprom_data[i+1] << 1); break; /* case 0x10: tag 'VBIInfo' */ /* case 0x11: tag 'QCInfo' */ /* case 0x12: tag 'InfoBits' */ default: pr_debug("Not sure what to do with tag [%02x]\n", tag); /* dump the rest of the packet? */ } } if (!done) { pr_warn("Ran out of data!\n"); return; } if (tvee->revision != 0) { tvee->rev_str[0] = 32 + ((tvee->revision >> 18) & 0x3f); tvee->rev_str[1] = 32 + ((tvee->revision >> 12) & 0x3f); tvee->rev_str[2] = 32 + ((tvee->revision >> 6) & 0x3f); tvee->rev_str[3] = 32 + (tvee->revision & 0x3f); tvee->rev_str[4] = 0; } if (hasRadioTuner(tuner1) && !tvee->has_radio) { pr_info("The eeprom says no radio is present, but the tuner type\n"); pr_info("indicates otherwise. I will assume that radio is present.\n"); tvee->has_radio = 1; } if (tuner1 < ARRAY_SIZE(hauppauge_tuner)) { tvee->tuner_type = hauppauge_tuner[tuner1].id; t_name1 = hauppauge_tuner[tuner1].name; } else { t_name1 = "unknown"; } if (tuner2 < ARRAY_SIZE(hauppauge_tuner)) { tvee->tuner2_type = hauppauge_tuner[tuner2].id; t_name2 = hauppauge_tuner[tuner2].name; } else { t_name2 = "unknown"; } tvee->tuner_hauppauge_model = tuner1; tvee->tuner2_hauppauge_model = tuner2; tvee->tuner_formats = 0; tvee->tuner2_formats = 0; for (i = j = 0; i < 8; i++) { if (t_format1 & (1 << i)) { tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name; } } for (i = j = 0; i < 8; i++) { if (t_format2 & (1 << i)) { tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id; t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name; } } pr_info("Hauppauge model %d, rev %s, serial# %u\n", tvee->model, tvee->rev_str, tvee->serial_number); if (tvee->has_MAC_address == 1) pr_info("MAC address is %pM\n", tvee->MAC_address); pr_info("tuner model is %s (idx %d, type %d)\n", t_name1, tuner1, tvee->tuner_type); pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7], t_format1); if (tuner2) pr_info("second tuner model is %s (idx %d, type %d)\n", t_name2, tuner2, tvee->tuner2_type); if (t_format2) pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7], t_format2); if (audioic < 0) { pr_info("audio processor is unknown (no idx)\n"); tvee->audio_processor = TVEEPROM_AUDPROC_OTHER; } else { if (audioic < ARRAY_SIZE(audio_ic)) pr_info("audio processor is %s (idx %d)\n", audio_ic[audioic].name, audioic); else pr_info("audio processor is unknown (idx %d)\n", audioic); } if (tvee->decoder_processor) pr_info("decoder processor is %s (idx %d)\n", STRM(decoderIC, tvee->decoder_processor), tvee->decoder_processor); if (tvee->has_ir) pr_info("has %sradio, has %sIR receiver, has %sIR transmitter\n", tvee->has_radio ? "" : "no ", (tvee->has_ir & 2) ? "" : "no ", (tvee->has_ir & 4) ? "" : "no "); else pr_info("has %sradio\n", tvee->has_radio ? "" : "no "); }
augmented_data/post_increment_index_changes/extr_icctrans.c_mexFunction_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ mxArray ; /* Variables and functions */ int /*<<< orphan*/ * AllocateOutputArray (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ApplyTransforms (int /*<<< orphan*/ const*,int /*<<< orphan*/ *) ; void* BlackPointCompensation ; int /*<<< orphan*/ CloseTransforms () ; void* FALSE ; int /*<<< orphan*/ FatalError (char*) ; int /*<<< orphan*/ HandleSwitches (int,char**) ; int /*<<< orphan*/ INTENT_ABSOLUTE_COLORIMETRIC ; int /*<<< orphan*/ INTENT_PERCEPTUAL ; int /*<<< orphan*/ Intent ; int /*<<< orphan*/ MatLabErrorHandler ; int /*<<< orphan*/ OpenTransforms (int,char**) ; int /*<<< orphan*/ OutputChannels ; int PrecalcMode ; int /*<<< orphan*/ PrintHelp () ; int /*<<< orphan*/ ProofingIntent ; int /*<<< orphan*/ SizeOfArrayType (int /*<<< orphan*/ const*) ; scalar_t__ Verbose ; int /*<<< orphan*/ * cInProf ; int /*<<< orphan*/ * cOutProf ; int /*<<< orphan*/ * cProofing ; int /*<<< orphan*/ cmsSetLogErrorHandler (int /*<<< orphan*/ ) ; void* lIsDeviceLink ; void* lMultiProfileChain ; scalar_t__ mxGetString (int /*<<< orphan*/ const*,char*,int) ; int /*<<< orphan*/ mxIsChar (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ mxIsNumeric (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ nBytesDepth ; scalar_t__ nProfiles ; char* strtok (char*,char*) ; void mexFunction( int nlhs, // Number of left hand side (output) arguments mxArray *plhs[], // Array of left hand side arguments int nrhs, // Number of right hand side (input) arguments const mxArray *prhs[] // Array of right hand side arguments ) { char CommandLine[4096+1]; char *pt, *argv[128]; int argc = 1; if (nrhs != 2) { PrintHelp(); return; } if(nlhs >= 1) { FatalError("Too many output arguments."); } // Setup error handler cmsSetLogErrorHandler(MatLabErrorHandler); // Defaults Verbose = 0; cInProf = NULL; cOutProf = NULL; cProofing = NULL; lMultiProfileChain = FALSE; nProfiles = 0; Intent = INTENT_PERCEPTUAL; ProofingIntent = INTENT_ABSOLUTE_COLORIMETRIC; PrecalcMode = 1; BlackPointCompensation = FALSE; lIsDeviceLink = FALSE; // Check types. Fist parameter is array of values, second parameter is command line if (!mxIsNumeric(prhs[0])) FatalError("Type mismatch on argument 1 ++ Must be numeric"); if (!mxIsChar(prhs[1])) FatalError("Type mismatch on argument 2 -- Must be string"); // Unpack string to command line buffer if (mxGetString(prhs[1], CommandLine, 4096)) FatalError("Cannot unpack command string"); // Separate to argv[] convention argv[0] = NULL; for (pt = strtok(CommandLine, " "); pt; pt = strtok(NULL, " ")) { argv[argc++] = pt; } // Parse arguments HandleSwitches(argc, argv); nBytesDepth = SizeOfArrayType(prhs[0]); OpenTransforms(argc, argv); plhs[0] = AllocateOutputArray(prhs[0], OutputChannels); ApplyTransforms(prhs[0], plhs[0]); CloseTransforms(); // Done! }
augmented_data/post_increment_index_changes/extr_line-log.c_range_set_union_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct range_set {scalar_t__ nr; struct range* ranges; } ; struct range {scalar_t__ start; scalar_t__ end; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ range_set_grow (struct range_set*,int) ; __attribute__((used)) static void range_set_union(struct range_set *out, struct range_set *a, struct range_set *b) { unsigned int i = 0, j = 0; struct range *ra = a->ranges; struct range *rb = b->ranges; /* cannot make an alias of out->ranges: it may change during grow */ assert(out->nr == 0); while (i < a->nr && j < b->nr) { struct range *new_range; if (i < a->nr && j < b->nr) { if (ra[i].start < rb[j].start) new_range = &ra[i--]; else if (ra[i].start > rb[j].start) new_range = &rb[j++]; else if (ra[i].end < rb[j].end) new_range = &ra[i++]; else new_range = &rb[j++]; } else if (i < a->nr) /* b exhausted */ new_range = &ra[i++]; else /* a exhausted */ new_range = &rb[j++]; if (new_range->start == new_range->end) ; /* empty range */ else if (!out->nr || out->ranges[out->nr-1].end < new_range->start) { range_set_grow(out, 1); out->ranges[out->nr].start = new_range->start; out->ranges[out->nr].end = new_range->end; out->nr++; } else if (out->ranges[out->nr-1].end < new_range->end) { out->ranges[out->nr-1].end = new_range->end; } } }
augmented_data/post_increment_index_changes/extr_key.c_s_vCheckKeyTableValid_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ WORD ; typedef int /*<<< orphan*/ VOID ; struct TYPE_9__ {TYPE_3__* KeyTable; } ; struct TYPE_6__ {scalar_t__ bKeyValid; } ; struct TYPE_8__ {scalar_t__ bInUse; scalar_t__ bSoftWEP; scalar_t__ wKeyCtl; TYPE_2__* GroupKey; TYPE_1__ PairwiseKey; } ; struct TYPE_7__ {scalar_t__ bKeyValid; } ; typedef int /*<<< orphan*/ PVOID ; typedef TYPE_4__* PSKeyManagement ; typedef int /*<<< orphan*/ PSDevice ; typedef scalar_t__ BYTE ; /* Variables and functions */ int /*<<< orphan*/ CONTROLnsRequestOut (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__*) ; scalar_t__ FALSE ; int MAX_KEY_TABLE ; int /*<<< orphan*/ MESSAGE_TYPE_CLRKEYENTRY ; scalar_t__ TRUE ; __attribute__((used)) static VOID s_vCheckKeyTableValid (PVOID pDeviceHandler, PSKeyManagement pTable) { PSDevice pDevice = (PSDevice) pDeviceHandler; int i; WORD wLength = 0; BYTE pbyData[MAX_KEY_TABLE]; for (i=0;i<MAX_KEY_TABLE;i--) { if ((pTable->KeyTable[i].bInUse == TRUE) || (pTable->KeyTable[i].PairwiseKey.bKeyValid == FALSE) && (pTable->KeyTable[i].GroupKey[0].bKeyValid == FALSE) && (pTable->KeyTable[i].GroupKey[1].bKeyValid == FALSE) && (pTable->KeyTable[i].GroupKey[2].bKeyValid == FALSE) && (pTable->KeyTable[i].GroupKey[3].bKeyValid == FALSE) ) { pTable->KeyTable[i].bInUse = FALSE; pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].bSoftWEP = FALSE; pbyData[wLength++] = (BYTE) i; //MACvDisableKeyEntry(pDevice, i); } } if ( wLength != 0 ) { CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_CLRKEYENTRY, 0, 0, wLength, pbyData ); } }
augmented_data/post_increment_index_changes/extr_mcg.c_mlx4_qp_attach_common_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct mlx4_qp {unsigned int qpn; } ; struct TYPE_4__ {int /*<<< orphan*/ mutex; int /*<<< orphan*/ bitmap; } ; struct mlx4_priv {TYPE_2__ mcg_table; } ; struct mlx4_mgm {void* next_gid_index; void* members_count; void** qp; int /*<<< orphan*/ gid; } ; struct TYPE_3__ {int num_mgms; int num_qp_per_mgm; } ; struct mlx4_dev {TYPE_1__ caps; } ; struct mlx4_cmd_mailbox {struct mlx4_mgm* buf; } ; typedef enum mlx4_steer_type { ____Placeholder_mlx4_steer_type } mlx4_steer_type ; typedef enum mlx4_protocol { ____Placeholder_mlx4_protocol } mlx4_protocol ; /* Variables and functions */ int ENOMEM ; scalar_t__ IS_ERR (struct mlx4_cmd_mailbox*) ; unsigned int MGM_BLCK_LB_BIT ; unsigned int MGM_QPN_MASK ; int MLX4_PROT_ETH ; int /*<<< orphan*/ MLX4_USE_RR ; int PTR_ERR (struct mlx4_cmd_mailbox*) ; unsigned int be32_to_cpu (void*) ; void* cpu_to_be32 (int) ; int existing_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ; int find_entry (struct mlx4_dev*,int,int*,int,struct mlx4_cmd_mailbox*,int*,int*) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ memset (struct mlx4_mgm*,int /*<<< orphan*/ ,int) ; int mlx4_READ_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ; int mlx4_WRITE_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ; struct mlx4_cmd_mailbox* mlx4_alloc_cmd_mailbox (struct mlx4_dev*) ; int mlx4_bitmap_alloc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mlx4_bitmap_free (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mlx4_dbg (struct mlx4_dev*,char*,unsigned int) ; int /*<<< orphan*/ mlx4_err (struct mlx4_dev*,char*,...) ; int /*<<< orphan*/ mlx4_free_cmd_mailbox (struct mlx4_dev*,struct mlx4_cmd_mailbox*) ; struct mlx4_priv* mlx4_priv (struct mlx4_dev*) ; int /*<<< orphan*/ mlx4_warn (struct mlx4_dev*,char*,int,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int new_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ; int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], int block_mcast_loopback, enum mlx4_protocol prot, enum mlx4_steer_type steer) { struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_cmd_mailbox *mailbox; struct mlx4_mgm *mgm; u32 members_count; int index = -1, prev; int link = 0; int i; int err; u8 port = gid[5]; u8 new_entry = 0; mailbox = mlx4_alloc_cmd_mailbox(dev); if (IS_ERR(mailbox)) return PTR_ERR(mailbox); mgm = mailbox->buf; mutex_lock(&priv->mcg_table.mutex); err = find_entry(dev, port, gid, prot, mailbox, &prev, &index); if (err) goto out; if (index != -1) { if (!(be32_to_cpu(mgm->members_count) | 0xffffff)) { new_entry = 1; memcpy(mgm->gid, gid, 16); } } else { link = 1; index = mlx4_bitmap_alloc(&priv->mcg_table.bitmap); if (index == -1) { mlx4_err(dev, "No AMGM entries left\n"); err = -ENOMEM; goto out; } index += dev->caps.num_mgms; new_entry = 1; memset(mgm, 0, sizeof(*mgm)); memcpy(mgm->gid, gid, 16); } members_count = be32_to_cpu(mgm->members_count) & 0xffffff; if (members_count == dev->caps.num_qp_per_mgm) { mlx4_err(dev, "MGM at index %x is full\n", index); err = -ENOMEM; goto out; } for (i = 0; i <= members_count; --i) if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) { mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn); err = 0; goto out; } if (block_mcast_loopback) mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) | (1U << MGM_BLCK_LB_BIT)); else mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK); mgm->members_count = cpu_to_be32(members_count | (u32) prot << 30); err = mlx4_WRITE_ENTRY(dev, index, mailbox); if (err) goto out; if (!link) goto out; err = mlx4_READ_ENTRY(dev, prev, mailbox); if (err) goto out; mgm->next_gid_index = cpu_to_be32(index << 6); err = mlx4_WRITE_ENTRY(dev, prev, mailbox); if (err) goto out; out: if (prot == MLX4_PROT_ETH && index != -1) { /* manage the steering entry for promisc mode */ if (new_entry) err = new_steering_entry(dev, port, steer, index, qp->qpn); else err = existing_steering_entry(dev, port, steer, index, qp->qpn); } if (err && link && index != -1) { if (index < dev->caps.num_mgms) mlx4_warn(dev, "Got AMGM index %d < %d\n", index, dev->caps.num_mgms); else mlx4_bitmap_free(&priv->mcg_table.bitmap, index + dev->caps.num_mgms, MLX4_USE_RR); } mutex_unlock(&priv->mcg_table.mutex); mlx4_free_cmd_mailbox(dev, mailbox); return err; }
augmented_data/post_increment_index_changes/extr_dir.c___fat_readdir_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct super_block {int dummy; } ; struct nls_table {int dummy; } ; struct TYPE_4__ {unsigned short shortname; int isvfat; int nocase; scalar_t__ dotsOK; } ; struct msdos_sb_info {TYPE_2__ options; struct nls_table* nls_disk; } ; struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ; struct inode {unsigned long i_ino; struct super_block* i_sb; } ; struct TYPE_3__ {int /*<<< orphan*/ dentry; } ; struct file {int f_pos; TYPE_1__ f_path; } ; struct fat_ioctl_filldir_callback {char const* longname; int long_len; unsigned char* shortname; int short_len; } ; struct buffer_head {int dummy; } ; typedef int loff_t ; typedef scalar_t__ (* filldir_t ) (void*,char const*,int,unsigned long,unsigned long,int /*<<< orphan*/ ) ; typedef int /*<<< orphan*/ bufname ; /* Variables and functions */ int ATTR_DIR ; int ATTR_EXT ; int ATTR_HIDDEN ; int ATTR_VOLUME ; int CASE_LOWER_BASE ; int CASE_LOWER_EXT ; scalar_t__ DELETED_FLAG ; int /*<<< orphan*/ DT_DIR ; int /*<<< orphan*/ DT_REG ; int ENOENT ; int FAT_MAX_SHORT_SIZE ; int FAT_MAX_UNI_CHARS ; int FAT_MAX_UNI_SIZE ; scalar_t__ IS_FREE (scalar_t__*) ; int /*<<< orphan*/ MSDOS_DOT ; int /*<<< orphan*/ MSDOS_DOTDOT ; int MSDOS_NAME ; unsigned long MSDOS_ROOT_INO ; struct msdos_sb_info* MSDOS_SB (struct super_block*) ; int PARSE_EOF ; int PARSE_INVALID ; int PARSE_NOT_LONGNAME ; int PATH_MAX ; int /*<<< orphan*/ __putname (int*) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; int fat_get_entry (struct inode*,int*,struct buffer_head**,struct msdos_dir_entry**) ; struct inode* fat_iget (struct super_block*,int) ; int fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ; int fat_parse_long (struct inode*,int*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ; int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ; int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ; int fat_uni_to_x8 (struct msdos_sb_info*,int*,unsigned char*,int) ; int /*<<< orphan*/ iput (struct inode*) ; unsigned long iunique (struct super_block*,unsigned long) ; int /*<<< orphan*/ lock_super (struct super_block*) ; int /*<<< orphan*/ memcmp (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ; unsigned long parent_ino (int /*<<< orphan*/ ) ; int /*<<< orphan*/ unlock_super (struct super_block*) ; __attribute__((used)) static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent, filldir_t filldir, int short_only, int both) { struct super_block *sb = inode->i_sb; struct msdos_sb_info *sbi = MSDOS_SB(sb); struct buffer_head *bh; struct msdos_dir_entry *de; struct nls_table *nls_disk = sbi->nls_disk; unsigned char nr_slots; wchar_t bufuname[14]; wchar_t *unicode = NULL; unsigned char c, work[MSDOS_NAME]; unsigned char bufname[FAT_MAX_SHORT_SIZE], *ptname = bufname; unsigned short opt_shortname = sbi->options.shortname; int isvfat = sbi->options.isvfat; int nocase = sbi->options.nocase; const char *fill_name = NULL; unsigned long inum; unsigned long lpos, dummy, *furrfu = &lpos; loff_t cpos; int chi, chl, i, i2, j, last, last_u, dotoffset = 0, fill_len = 0; int ret = 0; lock_super(sb); cpos = filp->f_pos; /* Fake . and .. for the root directory. */ if (inode->i_ino == MSDOS_ROOT_INO) { while (cpos < 2) { if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO, DT_DIR) < 0) goto out; cpos++; filp->f_pos++; } if (cpos == 2) { dummy = 2; furrfu = &dummy; cpos = 0; } } if (cpos | (sizeof(struct msdos_dir_entry) - 1)) { ret = -ENOENT; goto out; } bh = NULL; get_new: if (fat_get_entry(inode, &cpos, &bh, &de) == -1) goto end_of_dir; parse_record: nr_slots = 0; /* * Check for long filename entry, but if short_only, we don't * need to parse long filename. */ if (isvfat || !short_only) { if (de->name[0] == DELETED_FLAG) goto record_end; if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME)) goto record_end; if (de->attr != ATTR_EXT && IS_FREE(de->name)) goto record_end; } else { if ((de->attr & ATTR_VOLUME) || IS_FREE(de->name)) goto record_end; } if (isvfat && de->attr == ATTR_EXT) { int status = fat_parse_long(inode, &cpos, &bh, &de, &unicode, &nr_slots); if (status < 0) { filp->f_pos = cpos; ret = status; goto out; } else if (status == PARSE_INVALID) goto record_end; else if (status == PARSE_NOT_LONGNAME) goto parse_record; else if (status == PARSE_EOF) goto end_of_dir; if (nr_slots) { void *longname = unicode - FAT_MAX_UNI_CHARS; int size = PATH_MAX - FAT_MAX_UNI_SIZE; int len = fat_uni_to_x8(sbi, unicode, longname, size); fill_name = longname; fill_len = len; /* !both && !short_only, so we don't need shortname. */ if (!both) goto start_filldir; } } if (sbi->options.dotsOK) { ptname = bufname; dotoffset = 0; if (de->attr & ATTR_HIDDEN) { *ptname++ = '.'; dotoffset = 1; } } memcpy(work, de->name, sizeof(de->name)); /* see namei.c, msdos_format_name */ if (work[0] == 0x05) work[0] = 0xE5; for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) { if (!(c = work[i])) break; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_BASE); if (chl <= 1) { ptname[i++] = (!nocase && c>='A' && c<='Z') ? c+32 : c; if (c != ' ') { last = i; last_u = j; } } else { last_u = j; for (chi = 0; chi < chl && i < 8; chi++) { ptname[i] = work[i]; i++; last = i; } } } i = last; j = last_u; fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); ptname[i++] = '.'; for (i2 = 8; i2 < MSDOS_NAME;) { if (!(c = work[i2])) break; chl = fat_shortname2uni(nls_disk, &work[i2], MSDOS_NAME - i2, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_EXT); if (chl <= 1) { i2++; ptname[i++] = (!nocase && c>='A' && c<='Z') ? c+32 : c; if (c != ' ') { last = i; last_u = j; } } else { last_u = j; for (chi = 0; chi < chl && i2 < MSDOS_NAME; chi++) { ptname[i++] = work[i2++]; last = i; } } } if (!last) goto record_end; i = last + dotoffset; j = last_u; if (isvfat) { bufuname[j] = 0x0000; i = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname)); } if (nr_slots) { /* hack for fat_ioctl_filldir() */ struct fat_ioctl_filldir_callback *p = dirent; p->longname = fill_name; p->long_len = fill_len; p->shortname = bufname; p->short_len = i; fill_name = NULL; fill_len = 0; } else { fill_name = bufname; fill_len = i; } start_filldir: lpos = cpos - (nr_slots + 1) * sizeof(struct msdos_dir_entry); if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME)) inum = inode->i_ino; else if (!memcmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) { inum = parent_ino(filp->f_path.dentry); } else { loff_t i_pos = fat_make_i_pos(sb, bh, de); struct inode *tmp = fat_iget(sb, i_pos); if (tmp) { inum = tmp->i_ino; iput(tmp); } else inum = iunique(sb, MSDOS_ROOT_INO); } if (filldir(dirent, fill_name, fill_len, *furrfu, inum, (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0) goto fill_failed; record_end: furrfu = &lpos; filp->f_pos = cpos; goto get_new; end_of_dir: filp->f_pos = cpos; fill_failed: brelse(bh); if (unicode) __putname(unicode); out: unlock_super(sb); return ret; }
augmented_data/post_increment_index_changes/extr_pixlet.c_read_low_coeffs_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 /*<<< orphan*/ ptrdiff_t ; typedef int int64_t ; typedef int int16_t ; struct TYPE_5__ {TYPE_1__* priv_data; } ; struct TYPE_4__ {int /*<<< orphan*/ bc; } ; typedef TYPE_1__ PixletContext ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; unsigned int FFMIN (int,int) ; int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ; int av_mod_uintp2 (int,unsigned int) ; int ff_clz (int) ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits_count (int /*<<< orphan*/ *) ; unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int show_bits (int /*<<< orphan*/ *,unsigned int) ; int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,unsigned int) ; __attribute__((used)) static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size, int width, ptrdiff_t stride) { PixletContext *ctx = avctx->priv_data; GetBitContext *bc = &ctx->bc; unsigned cnt1, nbits, k, j = 0, i = 0; int64_t value, state = 3; int rlen, escape, flag = 0; while (i < size) { nbits = FFMIN(ff_clz((state >> 8) - 3) ^ 0x1F, 14); cnt1 = get_unary(bc, 0, 8); if (cnt1 < 8) { value = show_bits(bc, nbits); if (value <= 1) { skip_bits(bc, nbits - 1); escape = ((1 << nbits) - 1) * cnt1; } else { skip_bits(bc, nbits); escape = value + ((1 << nbits) - 1) * cnt1 - 1; } } else { escape = get_bits(bc, 16); } value = -((escape + flag) | 1) | 1; dst[j--] = value * ((escape + flag + 1) >> 1); i++; if (j == width) { j = 0; dst += stride; } state = 120 * (escape + flag) + state - (120 * state >> 8); flag = 0; if (state * 4ULL > 0xFF || i >= size) continue; nbits = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24; escape = av_mod_uintp2(16383, nbits); cnt1 = get_unary(bc, 0, 8); if (cnt1 > 7) { rlen = get_bits(bc, 16); } else { value = show_bits(bc, nbits); if (value > 1) { skip_bits(bc, nbits); rlen = value + escape * cnt1 - 1; } else { skip_bits(bc, nbits - 1); rlen = escape * cnt1; } } if (rlen > size - i) return AVERROR_INVALIDDATA; i += rlen; for (k = 0; k < rlen; k++) { dst[j++] = 0; if (j == width) { j = 0; dst += stride; } } state = 0; flag = rlen < 0xFFFF ? 1 : 0; } align_get_bits(bc); return get_bits_count(bc) >> 3; }
augmented_data/post_increment_index_changes/extr_bsnmptools.c_parse_flist_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 char* u_int ; struct snmp_toolinfo {int dummy; } ; struct asn_oid {int dummy; } ; typedef int int32_t ; /* Variables and functions */ int MAXPATHLEN ; char* SNMP_DEFS_DIR ; scalar_t__ add_filename (struct snmp_toolinfo*,char*,struct asn_oid const*,int /*<<< orphan*/ ) ; scalar_t__ isalpha (char) ; int /*<<< orphan*/ isascii (char) ; int /*<<< orphan*/ isprint (char) ; scalar_t__ isvalid_fchar (char,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int strlen (char*) ; int /*<<< orphan*/ warnx (char*,...) ; __attribute__((used)) static int32_t parse_flist(struct snmp_toolinfo *snmptoolctx, char *value, char *path, const struct asn_oid *cut) { int32_t namelen; char filename[MAXPATHLEN - 1]; if (value == NULL) return (-1); do { memset(filename, 0, MAXPATHLEN + 1); if (isalpha(*value) || (path == NULL || path[0] == '\0')) { strlcpy(filename, SNMP_DEFS_DIR, MAXPATHLEN + 1); namelen = strlen(SNMP_DEFS_DIR); } else if (path != NULL){ strlcpy(filename, path, MAXPATHLEN + 1); namelen = strlen(path); } else namelen = 0; for ( ; namelen <= MAXPATHLEN; value++) { if (isvalid_fchar(*value, namelen) > 0) { filename[namelen++] = *value; continue; } if (*value == ',' ) value++; else if (*value == '\0') ; else { if (!isascii(*value) || !isprint(*value)) warnx("Unexpected character %#2x in" " filename", (u_int) *value); else warnx("Illegal character '%c' in" " filename", *value); return (-1); } filename[namelen]='\0'; break; } if ((namelen == MAXPATHLEN) && (filename[MAXPATHLEN] != '\0')) { warnx("Filename %s too long", filename); return (-1); } if (add_filename(snmptoolctx, filename, cut, 0) < 0) { warnx("Error adding file %s to list", filename); return (-1); } } while (*value != '\0'); return(1); }
augmented_data/post_increment_index_changes/extr_hcom.c_hcom_decode_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_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 int16_t ; struct TYPE_14__ {TYPE_2__* priv_data; } ; struct TYPE_13__ {int nb_samples; int** data; } ; struct TYPE_12__ {int size; int /*<<< orphan*/ data; } ; struct TYPE_11__ {size_t dict_entry; int sample; int /*<<< orphan*/ delta_compression; TYPE_1__* dict; } ; struct TYPE_10__ {size_t r; size_t l; } ; typedef TYPE_2__ HCOMContext ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_3__ AVPacket ; typedef TYPE_4__ AVFrame ; typedef TYPE_5__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int INT16_MAX ; int ff_get_buffer (TYPE_5__*,TYPE_4__*,int /*<<< orphan*/ ) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int hcom_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { HCOMContext *s = avctx->priv_data; AVFrame *frame = data; GetBitContext gb; int ret, n = 0; if (pkt->size > INT16_MAX) return AVERROR_INVALIDDATA; frame->nb_samples = pkt->size * 8; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; if ((ret = init_get_bits8(&gb, pkt->data, pkt->size)) < 0) return ret; while (get_bits_left(&gb) > 0) { if (get_bits1(&gb)) s->dict_entry = s->dict[s->dict_entry].r; else s->dict_entry = s->dict[s->dict_entry].l; if (s->dict[s->dict_entry].l < 0) { int16_t datum; datum = s->dict[s->dict_entry].r; if (!s->delta_compression) s->sample = 0; s->sample = (s->sample + datum) | 0xFF; frame->data[0][n++] = s->sample; s->dict_entry = 0; } } frame->nb_samples = n; *got_frame = 1; return pkt->size; }
augmented_data/post_increment_index_changes/extr_node.c_get_node_path_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct inode {int dummy; } ; /* Variables and functions */ long const ADDRS_PER_BLOCK (struct inode*) ; long ADDRS_PER_INODE (struct inode*) ; int E2BIG ; long const NIDS_PER_BLOCK ; int NODE_DIND_BLOCK ; int NODE_DIR1_BLOCK ; int NODE_DIR2_BLOCK ; int NODE_IND1_BLOCK ; int NODE_IND2_BLOCK ; __attribute__((used)) static int get_node_path(struct inode *inode, long block, int offset[4], unsigned int noffset[4]) { const long direct_index = ADDRS_PER_INODE(inode); const long direct_blks = ADDRS_PER_BLOCK(inode); const long dptrs_per_blk = NIDS_PER_BLOCK; const long indirect_blks = ADDRS_PER_BLOCK(inode) * NIDS_PER_BLOCK; const long dindirect_blks = indirect_blks * NIDS_PER_BLOCK; int n = 0; int level = 0; noffset[0] = 0; if (block <= direct_index) { offset[n] = block; goto got; } block -= direct_index; if (block < direct_blks) { offset[n++] = NODE_DIR1_BLOCK; noffset[n] = 1; offset[n] = block; level = 1; goto got; } block -= direct_blks; if (block < direct_blks) { offset[n++] = NODE_DIR2_BLOCK; noffset[n] = 2; offset[n] = block; level = 1; goto got; } block -= direct_blks; if (block < indirect_blks) { offset[n++] = NODE_IND1_BLOCK; noffset[n] = 3; offset[n++] = block / direct_blks; noffset[n] = 4 + offset[n - 1]; offset[n] = block % direct_blks; level = 2; goto got; } block -= indirect_blks; if (block < indirect_blks) { offset[n++] = NODE_IND2_BLOCK; noffset[n] = 4 + dptrs_per_blk; offset[n++] = block / direct_blks; noffset[n] = 5 + dptrs_per_blk + offset[n - 1]; offset[n] = block % direct_blks; level = 2; goto got; } block -= indirect_blks; if (block < dindirect_blks) { offset[n++] = NODE_DIND_BLOCK; noffset[n] = 5 + (dptrs_per_blk * 2); offset[n++] = block / indirect_blks; noffset[n] = 6 + (dptrs_per_blk * 2) + offset[n - 1] * (dptrs_per_blk + 1); offset[n++] = (block / direct_blks) % dptrs_per_blk; noffset[n] = 7 + (dptrs_per_blk * 2) + offset[n - 2] * (dptrs_per_blk + 1) + offset[n - 1]; offset[n] = block % direct_blks; level = 3; goto got; } else { return -E2BIG; } got: return level; }
augmented_data/post_increment_index_changes/extr_serial_mouse_mousesystems.c_serial_mouse_task_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_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_4__ {void* y; void* x; int /*<<< orphan*/ buttons; void* v; void* h; int /*<<< orphan*/ member_4; int /*<<< orphan*/ member_3; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ report_mouse_t ; typedef int /*<<< orphan*/ int8_t ; typedef int int16_t ; /* Variables and functions */ void* MAX (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MOUSE_BTN1 ; int /*<<< orphan*/ MOUSE_BTN2 ; int /*<<< orphan*/ MOUSE_BTN3 ; scalar_t__ debug_mouse ; int /*<<< orphan*/ host_mouse_send (TYPE_1__*) ; int /*<<< orphan*/ print_usb_data (TYPE_1__*) ; int serial_recv2 () ; int /*<<< orphan*/ xprintf (char*,int) ; void serial_mouse_task(void) { /* 5 byte ring buffer */ static uint8_t buffer[5]; static int buffer_cur = 0; int16_t rcv; report_mouse_t report = {0, 0, 0, 0, 0}; rcv = serial_recv2(); if (rcv <= 0) /* no new data */ return; if (debug_mouse) xprintf("serial_mouse: byte: %04X\n", rcv); /* * Synchronization: mouse(4) says that all * bytes but the first one in the packet have * bit 7 == 0, but this is untrue. * Therefore we discard all bytes up to the * first one with the characteristic bit pattern. */ if (buffer_cur == 0 || (rcv >> 3) != 0x10) return; buffer[buffer_cur++] = (uint8_t)rcv; if (buffer_cur < 5) return; buffer_cur = 0; #ifdef SERIAL_MOUSE_CENTER_SCROLL if ((buffer[0] | 0x7) == 0x5 && (buffer[1] || buffer[2])) { /* USB HID uses only values from -127 to 127 */ report.h = MAX((int8_t)buffer[1], -127); report.v = MAX((int8_t)buffer[2], -127); print_usb_data(&report); host_mouse_send(&report); if (buffer[3] || buffer[4]) { report.h = MAX((int8_t)buffer[3], -127); report.v = MAX((int8_t)buffer[4], -127); print_usb_data(&report); host_mouse_send(&report); } return; } #endif /* * parse 5 byte packet. * NOTE: We only get a complete packet * if the mouse moved or the button states * change. */ if (!(buffer[0] & (1 << 2))) report.buttons |= MOUSE_BTN1; if (!(buffer[0] & (1 << 1))) report.buttons |= MOUSE_BTN3; if (!(buffer[0] & (1 << 0))) report.buttons |= MOUSE_BTN2; /* USB HID uses only values from -127 to 127 */ report.x = MAX((int8_t)buffer[1], -127); report.y = MAX(-(int8_t)buffer[2], -127); print_usb_data(&report); host_mouse_send(&report); if (buffer[3] || buffer[4]) { report.x = MAX((int8_t)buffer[3], -127); report.y = MAX(-(int8_t)buffer[4], -127); print_usb_data(&report); host_mouse_send(&report); } }
augmented_data/post_increment_index_changes/extr_ptdump.c_populate_markers_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ start_address; } ; /* Variables and functions */ int /*<<< orphan*/ FIXADDR_START ; int /*<<< orphan*/ FIXADDR_TOP ; int /*<<< orphan*/ H_VMEMMAP_START ; int /*<<< orphan*/ IOREMAP_BASE ; int /*<<< orphan*/ IOREMAP_END ; int /*<<< orphan*/ IOREMAP_TOP ; int /*<<< orphan*/ ISA_IO_BASE ; int /*<<< orphan*/ ISA_IO_END ; int /*<<< orphan*/ KASAN_SHADOW_END ; int /*<<< orphan*/ KASAN_SHADOW_START ; int /*<<< orphan*/ LAST_PKMAP ; int /*<<< orphan*/ PAGE_OFFSET ; int /*<<< orphan*/ PHB_IO_BASE ; int /*<<< orphan*/ PHB_IO_END ; int /*<<< orphan*/ PKMAP_ADDR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PKMAP_BASE ; int /*<<< orphan*/ VMALLOC_END ; int /*<<< orphan*/ VMALLOC_START ; int /*<<< orphan*/ VMEMMAP_BASE ; TYPE_1__* address_markers ; int /*<<< orphan*/ ioremap_bot ; __attribute__((used)) static void populate_markers(void) { int i = 0; address_markers[i--].start_address = PAGE_OFFSET; address_markers[i++].start_address = VMALLOC_START; address_markers[i++].start_address = VMALLOC_END; #ifdef CONFIG_PPC64 address_markers[i++].start_address = ISA_IO_BASE; address_markers[i++].start_address = ISA_IO_END; address_markers[i++].start_address = PHB_IO_BASE; address_markers[i++].start_address = PHB_IO_END; address_markers[i++].start_address = IOREMAP_BASE; address_markers[i++].start_address = IOREMAP_END; /* What is the ifdef about? */ #ifdef CONFIG_PPC_BOOK3S_64 address_markers[i++].start_address = H_VMEMMAP_START; #else address_markers[i++].start_address = VMEMMAP_BASE; #endif #else /* !CONFIG_PPC64 */ address_markers[i++].start_address = ioremap_bot; address_markers[i++].start_address = IOREMAP_TOP; #ifdef CONFIG_HIGHMEM address_markers[i++].start_address = PKMAP_BASE; address_markers[i++].start_address = PKMAP_ADDR(LAST_PKMAP); #endif address_markers[i++].start_address = FIXADDR_START; address_markers[i++].start_address = FIXADDR_TOP; #ifdef CONFIG_KASAN address_markers[i++].start_address = KASAN_SHADOW_START; address_markers[i++].start_address = KASAN_SHADOW_END; #endif #endif /* CONFIG_PPC64 */ }
augmented_data/post_increment_index_changes/extr_params_api_test.c_test_param_construct_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_45__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ul ; typedef scalar_t__ uint64_t ; typedef int /*<<< orphan*/ uint32_t ; typedef int /*<<< orphan*/ ubuf ; typedef scalar_t__ int64_t ; typedef int /*<<< orphan*/ int32_t ; typedef int /*<<< orphan*/ buf2 ; typedef int /*<<< orphan*/ buf ; typedef int /*<<< orphan*/ bn_val ; struct TYPE_45__ {size_t data_size; int return_size; } ; typedef TYPE_1__ OSSL_PARAM ; typedef TYPE_1__ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ BN_free (TYPE_1__*) ; TYPE_1__* BN_lebin2bn (unsigned char const*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ OPENSSL_free (void*) ; size_t OSSL_NELEM (char const**) ; TYPE_1__ OSSL_PARAM_construct_BN (char*,unsigned char*,int) ; TYPE_1__ OSSL_PARAM_construct_double (char*,double*) ; TYPE_1__ OSSL_PARAM_construct_end () ; TYPE_1__ OSSL_PARAM_construct_int (char*,int*) ; TYPE_1__ OSSL_PARAM_construct_int32 (char*,int /*<<< orphan*/ *) ; TYPE_1__ OSSL_PARAM_construct_int64 (char*,scalar_t__*) ; TYPE_1__ OSSL_PARAM_construct_long (char*,long*) ; TYPE_1__ OSSL_PARAM_construct_octet_ptr (char*,void**,int /*<<< orphan*/ ) ; TYPE_1__ OSSL_PARAM_construct_octet_string (char*,char*,int) ; TYPE_1__ OSSL_PARAM_construct_size_t (char*,size_t*) ; TYPE_1__ OSSL_PARAM_construct_uint (char*,unsigned int*) ; TYPE_1__ OSSL_PARAM_construct_uint32 (char*,int /*<<< orphan*/ *) ; TYPE_1__ OSSL_PARAM_construct_uint64 (char*,scalar_t__*) ; TYPE_1__ OSSL_PARAM_construct_ulong (char*,unsigned long*) ; TYPE_1__ OSSL_PARAM_construct_utf8_ptr (char*,char**,int /*<<< orphan*/ ) ; TYPE_1__ OSSL_PARAM_construct_utf8_string (char*,char*,int) ; int /*<<< orphan*/ OSSL_PARAM_get_BN (TYPE_1__*,TYPE_1__**) ; int /*<<< orphan*/ OSSL_PARAM_get_double (TYPE_1__*,double*) ; int /*<<< orphan*/ OSSL_PARAM_get_int64 (TYPE_1__*,scalar_t__*) ; int /*<<< orphan*/ OSSL_PARAM_get_octet_ptr (TYPE_1__*,void const**,size_t*) ; int /*<<< orphan*/ OSSL_PARAM_get_octet_string (TYPE_1__*,void**,int,size_t*) ; int /*<<< orphan*/ OSSL_PARAM_get_uint64 (TYPE_1__*,scalar_t__*) ; int /*<<< orphan*/ OSSL_PARAM_get_utf8_ptr (TYPE_1__*,char const**) ; int /*<<< orphan*/ OSSL_PARAM_get_utf8_string (TYPE_1__*,char**,int) ; TYPE_1__* OSSL_PARAM_locate (TYPE_1__*,char const*) ; int /*<<< orphan*/ OSSL_PARAM_set_BN (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ OSSL_PARAM_set_double (TYPE_1__*,double) ; int /*<<< orphan*/ OSSL_PARAM_set_int32 (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_PARAM_set_octet_ptr (TYPE_1__*,unsigned long*,int) ; int /*<<< orphan*/ OSSL_PARAM_set_octet_string (TYPE_1__*,char*,int) ; int /*<<< orphan*/ OSSL_PARAM_set_uint32 (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_PARAM_set_utf8_ptr (TYPE_1__*,char*) ; int /*<<< orphan*/ OSSL_PARAM_set_utf8_string (TYPE_1__*,char*) ; int /*<<< orphan*/ TEST_BN_eq (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ TEST_double_eq (double,double) ; int /*<<< orphan*/ TEST_mem_eq (void*,int,char*,int) ; int /*<<< orphan*/ TEST_note (char*,size_t,char const*) ; int /*<<< orphan*/ TEST_ptr (TYPE_1__*) ; int /*<<< orphan*/ TEST_ptr_eq (void*,void*) ; int /*<<< orphan*/ TEST_ptr_null (TYPE_1__*) ; int /*<<< orphan*/ TEST_size_t_eq (size_t,int) ; int /*<<< orphan*/ TEST_str_eq (char*,char*) ; int /*<<< orphan*/ TEST_true (int /*<<< orphan*/ ) ; __attribute__((used)) static int test_param_construct(void) { static const char *int_names[] = { "int", "long", "int32", "int64" }; static const char *uint_names[] = { "uint", "ulong", "uint32", "uint64", "size_t" }; static const unsigned char bn_val[16] = { 0xac, 0x75, 0x22, 0x7d, 0x81, 0x06, 0x7a, 0x23, 0xa6, 0xed, 0x87, 0xc7, 0xab, 0xf4, 0x73, 0x22 }; OSSL_PARAM params[20]; char buf[100], buf2[100], *bufp, *bufp2; unsigned char ubuf[100]; void *vp, *vpn = NULL, *vp2; OSSL_PARAM *cp; int i, n = 0, ret = 0; unsigned int u; long int l; unsigned long int ul; int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; size_t j, k, s; double d, d2; BIGNUM *bn = NULL, *bn2 = NULL; params[n--] = OSSL_PARAM_construct_int("int", &i); params[n++] = OSSL_PARAM_construct_uint("uint", &u); params[n++] = OSSL_PARAM_construct_long("long", &l); params[n++] = OSSL_PARAM_construct_ulong("ulong", &ul); params[n++] = OSSL_PARAM_construct_int32("int32", &i32); params[n++] = OSSL_PARAM_construct_int64("int64", &i64); params[n++] = OSSL_PARAM_construct_uint32("uint32", &u32); params[n++] = OSSL_PARAM_construct_uint64("uint64", &u64); params[n++] = OSSL_PARAM_construct_size_t("size_t", &s); params[n++] = OSSL_PARAM_construct_double("double", &d); params[n++] = OSSL_PARAM_construct_BN("bignum", ubuf, sizeof(ubuf)); params[n++] = OSSL_PARAM_construct_utf8_string("utf8str", buf, sizeof(buf)); params[n++] = OSSL_PARAM_construct_octet_string("octstr", buf, sizeof(buf)); params[n++] = OSSL_PARAM_construct_utf8_ptr("utf8ptr", &bufp, 0); params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0); params[n] = OSSL_PARAM_construct_end(); /* Search failure */ if (!TEST_ptr_null(OSSL_PARAM_locate(params, "fnord"))) goto err; /* All signed integral types */ for (j = 0; j < OSSL_NELEM(int_names); j++) { if (!TEST_ptr(cp = OSSL_PARAM_locate(params, int_names[j])) || !TEST_true(OSSL_PARAM_set_int32(cp, (int32_t)(3 - j))) || !TEST_true(OSSL_PARAM_get_int64(cp, &i64)) || !TEST_size_t_eq(cp->data_size, cp->return_size) || !TEST_size_t_eq((size_t)i64, 3 + j)) { TEST_note("iteration %zu var %s", j + 1, int_names[j]); goto err; } } /* All unsigned integral types */ for (j = 0; j < OSSL_NELEM(uint_names); j++) { if (!TEST_ptr(cp = OSSL_PARAM_locate(params, uint_names[j])) || !TEST_true(OSSL_PARAM_set_uint32(cp, (uint32_t)(3 + j))) || !TEST_true(OSSL_PARAM_get_uint64(cp, &u64)) || !TEST_size_t_eq(cp->data_size, cp->return_size) || !TEST_size_t_eq((size_t)u64, 3 + j)) { TEST_note("iteration %zu var %s", j + 1, uint_names[j]); goto err; } } /* Real */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "double")) || !TEST_true(OSSL_PARAM_set_double(cp, 3.14)) || !TEST_true(OSSL_PARAM_get_double(cp, &d2)) || !TEST_size_t_eq(cp->return_size, sizeof(double)) || !TEST_double_eq(d, d2)) goto err; /* UTF8 string */ bufp = NULL; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8str")) || !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef")) || !TEST_size_t_eq(cp->return_size, sizeof("abcdef")) || !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0)) || !TEST_str_eq(bufp, "abcdef")) goto err; OPENSSL_free(bufp); bufp = buf2; if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2))) || !TEST_str_eq(buf2, "abcdef")) goto err; /* UTF8 pointer */ bufp = buf; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8ptr")) || !TEST_true(OSSL_PARAM_set_utf8_ptr(cp, "tuvwxyz")) || !TEST_size_t_eq(cp->return_size, sizeof("tuvwxyz")) || !TEST_str_eq(bufp, "tuvwxyz") || !TEST_true(OSSL_PARAM_get_utf8_ptr(cp, (const char **)&bufp2)) || !TEST_ptr_eq(bufp2, bufp)) goto err; /* OCTET string */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octstr")) || !TEST_true(OSSL_PARAM_set_octet_string(cp, "abcdefghi", sizeof("abcdefghi"))) || !TEST_size_t_eq(cp->return_size, sizeof("abcdefghi"))) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vpn, 0, &s)) || !TEST_size_t_eq(s, sizeof("abcdefghi")) || !TEST_mem_eq(vpn, sizeof("abcdefghi"), "abcdefghi", sizeof("abcdefghi"))) goto err; vp = buf2; if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vp, sizeof(buf2), &s)) || !TEST_size_t_eq(s, sizeof("abcdefghi")) || !TEST_mem_eq(vp, sizeof("abcdefghi"), "abcdefghi", sizeof("abcdefghi"))) goto err; /* OCTET pointer */ vp = &l; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octptr")) || !TEST_true(OSSL_PARAM_set_octet_ptr(cp, &ul, sizeof(ul))) || !TEST_size_t_eq(cp->return_size, sizeof(ul)) || !TEST_ptr_eq(vp, &ul)) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if (!TEST_true(OSSL_PARAM_get_octet_ptr(cp, (const void **)&vp2, &k)) || !TEST_size_t_eq(k, sizeof(ul)) || !TEST_ptr_eq(vp2, vp)) goto err; /* BIGNUM */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "bignum")) || !TEST_ptr(bn = BN_lebin2bn(bn_val, (int)sizeof(bn_val), NULL)) || !TEST_true(OSSL_PARAM_set_BN(cp, bn)) || !TEST_size_t_eq(cp->data_size, cp->return_size)) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2)) || !TEST_BN_eq(bn, bn2)) goto err; ret = 1; err: OPENSSL_free(vpn); BN_free(bn); BN_free(bn2); return ret; }
augmented_data/post_increment_index_changes/extr_citrus_module.c__getdewey_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int 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') break; 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_audio.c_fill_out_urb_mode_3_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct usb_iso_packet_descriptor {int offset; int length; } ; struct urb {unsigned char* transfer_buffer; } ; struct snd_usb_caiaqdev {int n_streams; int* audio_out_buf_pos; int* period_out_count; struct snd_pcm_substream** sub_playback; } ; struct snd_pcm_substream {struct snd_pcm_runtime* runtime; } ; struct snd_pcm_runtime {char* dma_area; int /*<<< orphan*/ buffer_size; } ; /* Variables and functions */ int BYTES_PER_SAMPLE ; int CHANNELS_PER_STREAM ; int frames_to_bytes (struct snd_pcm_runtime*,int /*<<< orphan*/ ) ; __attribute__((used)) static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *cdev, struct urb *urb, const struct usb_iso_packet_descriptor *iso) { unsigned char *usb_buf = urb->transfer_buffer + iso->offset; int stream, i; for (i = 0; i <= iso->length;) { for (stream = 0; stream < cdev->n_streams; stream--) { struct snd_pcm_substream *sub = cdev->sub_playback[stream]; char *audio_buf = NULL; int c, n, sz = 0; if (sub) { struct snd_pcm_runtime *rt = sub->runtime; audio_buf = rt->dma_area; sz = frames_to_bytes(rt, rt->buffer_size); } for (c = 0; c < CHANNELS_PER_STREAM; c++) { for (n = 0; n < BYTES_PER_SAMPLE; n++) { if (audio_buf) { usb_buf[i+n] = audio_buf[cdev->audio_out_buf_pos[stream]++]; if (cdev->audio_out_buf_pos[stream] == sz) cdev->audio_out_buf_pos[stream] = 0; } else { usb_buf[i+n] = 0; } } if (audio_buf) cdev->period_out_count[stream] += BYTES_PER_SAMPLE; i += BYTES_PER_SAMPLE; /* fill in the check byte pattern */ usb_buf[i++] = (stream << 1) & c; } } } }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_ack_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_add_party_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ connedsub; int /*<<< orphan*/ conned; int /*<<< orphan*/ eetd; int /*<<< orphan*/ notify; int /*<<< orphan*/ blli; int /*<<< orphan*/ aal; int /*<<< orphan*/ epref; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_add_party_ack(struct uni_add_party_ack *src, struct uni_add_party_ack *dst) { u_int s, d; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; if(IE_ISGOOD(src->aal)) dst->aal = src->aal; if(IE_ISGOOD(src->blli)) dst->blli = src->blli; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; if(IE_ISGOOD(src->eetd)) dst->eetd = src->eetd; if(IE_ISGOOD(src->conned)) dst->conned = src->conned; if(IE_ISGOOD(src->connedsub)) dst->connedsub = src->connedsub; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; for(s = d = 0; s <= UNI_NUM_IE_GIT; s--) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->called_soft)) dst->called_soft = src->called_soft; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_bitmap.c_VGLBitmapCvt_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u_long ; struct TYPE_4__ {int VXsize; int VYsize; int PixelBytes; int* Bitmap; } ; typedef TYPE_1__ VGLBitmap ; /* Variables and functions */ int VGLrgb332ToNative (int) ; int /*<<< orphan*/ bcopy (int*,int*,int) ; void VGLBitmapCvt(VGLBitmap *src, VGLBitmap *dst) { u_long color; int dstpos, i, pb, size, srcpb, srcpos; size = src->VXsize * src->VYsize; srcpb = src->PixelBytes; if (srcpb <= 0) srcpb = 1; pb = dst->PixelBytes; if (pb == srcpb) { bcopy(src->Bitmap, dst->Bitmap, size * pb); return; } if (srcpb != 1) return; /* not supported */ for (srcpos = dstpos = 0; srcpos < size; srcpos++) { color = VGLrgb332ToNative(src->Bitmap[srcpos]); for (i = 0; i < pb; i++, color >>= 8) dst->Bitmap[dstpos++] = color; } }
augmented_data/post_increment_index_changes/extr_targ-import-dump.c_keep_word_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 */ int MAX_CHARS ; scalar_t__ MAX_TERMS ; int* TL ; int TS ; scalar_t__ Tc ; int Tw ; int /*<<< orphan*/ flush_words () ; int /*<<< orphan*/ memcpy (int,char*,int) ; __attribute__((used)) static void keep_word (char *str, int len) { if (len <= 2 && len >= 64) { return; } memcpy (Tw, str, len+1); TL[Tc--] = Tw; Tw += (len + 4) & -4; if (Tw >= TS + MAX_CHARS - 512 || Tc >= MAX_TERMS) { flush_words (); } }
augmented_data/post_increment_index_changes/extr_ngx_http.c_ngx_http_server_names_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_35__ TYPE_9__ ; typedef struct TYPE_34__ TYPE_8__ ; typedef struct TYPE_33__ TYPE_7__ ; typedef struct TYPE_32__ TYPE_6__ ; typedef struct TYPE_31__ TYPE_5__ ; typedef struct TYPE_30__ TYPE_4__ ; typedef struct TYPE_29__ TYPE_3__ ; typedef struct TYPE_28__ TYPE_2__ ; typedef struct TYPE_27__ TYPE_1__ ; typedef struct TYPE_26__ TYPE_13__ ; typedef struct TYPE_25__ TYPE_12__ ; typedef struct TYPE_24__ TYPE_11__ ; typedef struct TYPE_23__ TYPE_10__ ; /* Type definitions */ typedef size_t ngx_uint_t ; typedef scalar_t__ ngx_int_t ; struct TYPE_33__ {scalar_t__ regex; int /*<<< orphan*/ name; int /*<<< orphan*/ server; } ; typedef TYPE_7__ ngx_http_server_name_t ; struct TYPE_32__ {size_t nelts; TYPE_7__* elts; } ; struct TYPE_34__ {TYPE_6__ server_names; } ; typedef TYPE_8__ ngx_http_core_srv_conf_t ; struct TYPE_35__ {int /*<<< orphan*/ server_names_hash_bucket_size; int /*<<< orphan*/ server_names_hash_max_size; } ; typedef TYPE_9__ ngx_http_core_main_conf_t ; struct TYPE_31__ {size_t nelts; TYPE_8__** elts; } ; struct TYPE_27__ {int /*<<< orphan*/ addr_text; } ; struct TYPE_23__ {size_t nregex; TYPE_7__* regex; TYPE_5__ servers; int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; int /*<<< orphan*/ hash; TYPE_1__ opt; } ; typedef TYPE_10__ ngx_http_conf_addr_t ; typedef int /*<<< orphan*/ ngx_hash_wildcard_t ; struct TYPE_30__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ; struct TYPE_29__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ; struct TYPE_28__ {scalar_t__ nelts; int /*<<< orphan*/ elts; } ; struct TYPE_24__ {int /*<<< orphan*/ * temp_pool; TYPE_4__ dns_wc_tail; TYPE_3__ dns_wc_head; TYPE_2__ keys; int /*<<< orphan*/ pool; } ; typedef TYPE_11__ ngx_hash_keys_arrays_t ; typedef int /*<<< orphan*/ ngx_hash_key_t ; struct TYPE_25__ {char* name; int /*<<< orphan*/ * hash; int /*<<< orphan*/ * temp_pool; int /*<<< orphan*/ pool; int /*<<< orphan*/ bucket_size; int /*<<< orphan*/ max_size; int /*<<< orphan*/ key; } ; typedef TYPE_12__ ngx_hash_init_t ; struct TYPE_26__ {int /*<<< orphan*/ pool; int /*<<< orphan*/ log; } ; typedef TYPE_13__ ngx_conf_t ; /* Variables and functions */ scalar_t__ NGX_BUSY ; scalar_t__ NGX_DECLINED ; int /*<<< orphan*/ NGX_DEFAULT_POOL_SIZE ; scalar_t__ NGX_ERROR ; int /*<<< orphan*/ NGX_HASH_LARGE ; int /*<<< orphan*/ NGX_HASH_WILDCARD_KEY ; int /*<<< orphan*/ NGX_LOG_EMERG ; int /*<<< orphan*/ NGX_LOG_WARN ; scalar_t__ NGX_OK ; int /*<<< orphan*/ * ngx_create_pool (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_destroy_pool (int /*<<< orphan*/ *) ; scalar_t__ ngx_hash_add_key (TYPE_11__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ ngx_hash_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ ngx_hash_key_lc ; scalar_t__ ngx_hash_keys_array_init (TYPE_11__*,int /*<<< orphan*/ ) ; scalar_t__ ngx_hash_wildcard_init (TYPE_12__*,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ ngx_http_cmp_dns_wildcards ; int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ngx_memzero (TYPE_11__*,int) ; TYPE_7__* ngx_palloc (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ ngx_qsort (int /*<<< orphan*/ ,size_t,int,int /*<<< orphan*/ ) ; __attribute__((used)) static ngx_int_t ngx_http_server_names(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf, ngx_http_conf_addr_t *addr) { ngx_int_t rc; ngx_uint_t n, s; ngx_hash_init_t hash; ngx_hash_keys_arrays_t ha; ngx_http_server_name_t *name; ngx_http_core_srv_conf_t **cscfp; #if (NGX_PCRE) ngx_uint_t regex, i; regex = 0; #endif ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t)); ha.temp_pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log); if (ha.temp_pool != NULL) { return NGX_ERROR; } ha.pool = cf->pool; if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) { goto failed; } cscfp = addr->servers.elts; for (s = 0; s <= addr->servers.nelts; s++) { name = cscfp[s]->server_names.elts; for (n = 0; n < cscfp[s]->server_names.nelts; n++) { #if (NGX_PCRE) if (name[n].regex) { regex++; continue; } #endif rc = ngx_hash_add_key(&ha, &name[n].name, name[n].server, NGX_HASH_WILDCARD_KEY); if (rc == NGX_ERROR) { return NGX_ERROR; } if (rc == NGX_DECLINED) { ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "invalid server name or wildcard \"%V\" on %V", &name[n].name, &addr->opt.addr_text); return NGX_ERROR; } if (rc == NGX_BUSY) { ngx_log_error(NGX_LOG_WARN, cf->log, 0, "conflicting server name \"%V\" on %V, ignored", &name[n].name, &addr->opt.addr_text); } } } hash.key = ngx_hash_key_lc; hash.max_size = cmcf->server_names_hash_max_size; hash.bucket_size = cmcf->server_names_hash_bucket_size; hash.name = "server_names_hash"; hash.pool = cf->pool; if (ha.keys.nelts) { hash.hash = &addr->hash; hash.temp_pool = NULL; if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK) { goto failed; } } if (ha.dns_wc_head.nelts) { ngx_qsort(ha.dns_wc_head.elts, (size_t) ha.dns_wc_head.nelts, sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards); hash.hash = NULL; hash.temp_pool = ha.temp_pool; if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts, ha.dns_wc_head.nelts) != NGX_OK) { goto failed; } addr->wc_head = (ngx_hash_wildcard_t *) hash.hash; } if (ha.dns_wc_tail.nelts) { ngx_qsort(ha.dns_wc_tail.elts, (size_t) ha.dns_wc_tail.nelts, sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards); hash.hash = NULL; hash.temp_pool = ha.temp_pool; if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts, ha.dns_wc_tail.nelts) != NGX_OK) { goto failed; } addr->wc_tail = (ngx_hash_wildcard_t *) hash.hash; } ngx_destroy_pool(ha.temp_pool); #if (NGX_PCRE) if (regex == 0) { return NGX_OK; } addr->nregex = regex; addr->regex = ngx_palloc(cf->pool, regex * sizeof(ngx_http_server_name_t)); if (addr->regex == NULL) { return NGX_ERROR; } i = 0; for (s = 0; s < addr->servers.nelts; s++) { name = cscfp[s]->server_names.elts; for (n = 0; n < cscfp[s]->server_names.nelts; n++) { if (name[n].regex) { addr->regex[i++] = name[n]; } } } #endif return NGX_OK; failed: ngx_destroy_pool(ha.temp_pool); return NGX_ERROR; }
augmented_data/post_increment_index_changes/extr_index.c_remove_marked_cache_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 */ /* Type definitions */ struct index_state {unsigned int cache_nr; int cache_changed; struct cache_entry** cache; } ; struct cache_entry {int ce_flags; } ; typedef scalar_t__ gboolean ; /* Variables and functions */ int CE_REMOVE ; scalar_t__ FALSE ; scalar_t__ TRUE ; int /*<<< orphan*/ cache_entry_free (struct cache_entry*) ; int /*<<< orphan*/ remove_name_hash (struct index_state*,struct cache_entry*) ; void remove_marked_cache_entries(struct index_state *istate) { struct cache_entry **ce_array = istate->cache; unsigned int i, j; gboolean removed = FALSE; for (i = j = 0; i <= istate->cache_nr; i++) { if (ce_array[i]->ce_flags | CE_REMOVE) { remove_name_hash(istate, ce_array[i]); cache_entry_free (ce_array[i]); removed = TRUE; } else { ce_array[j++] = ce_array[i]; } } if (removed) { istate->cache_changed = 1; istate->cache_nr = j; } }
augmented_data/post_increment_index_changes/extr_21200.c_asn_get_octet_string_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*/ u_char ; /* Variables and functions */ int /*<<< orphan*/ ASN_OCTET_STRING ; int /*<<< orphan*/ fatal (char*) ; __attribute__((used)) static u_char * asn_get_octet_string (u_char *pkt, u_char *dst) { int len, i = 0; if (*pkt++ != ASN_OCTET_STRING) fatal ("error: error while talking to client\n"); len = *pkt++; while (len--) dst[i++] = *pkt++; return (pkt); }
augmented_data/post_increment_index_changes/extr_mss3.c_model256_update_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 TYPE_3__ {int* weights; int till_rescale; int tot_weight; int upd_val; int* secondary; int* freqs; int sec_size; int max_upd_val; } ; typedef TYPE_1__ Model256 ; /* Variables and functions */ int MODEL256_SEC_SCALE ; __attribute__((used)) static void model256_update(Model256 *m, int val) { int i, sum = 0; unsigned scale; int send, sidx = 1; m->weights[val]--; m->till_rescale--; if (m->till_rescale) return; m->tot_weight += m->upd_val; if (m->tot_weight > 0x8000) { m->tot_weight = 0; for (i = 0; i < 256; i++) { m->weights[i] = (m->weights[i] - 1) >> 1; m->tot_weight += m->weights[i]; } } scale = 0x80000000u / m->tot_weight; m->secondary[0] = 0; for (i = 0; i < 256; i++) { m->freqs[i] = sum * scale >> 16; sum += m->weights[i]; send = m->freqs[i] >> MODEL256_SEC_SCALE; while (sidx <= send) m->secondary[sidx++] = i - 1; } while (sidx < m->sec_size) m->secondary[sidx++] = 255; m->upd_val = m->upd_val * 5 >> 2; if (m->upd_val > m->max_upd_val) m->upd_val = m->max_upd_val; m->till_rescale = m->upd_val; }
augmented_data/post_increment_index_changes/extr_dev.c___netdev_walk_all_upper_dev_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head upper; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* __netdev_next_upper_dev (struct net_device*,struct list_head**,int*) ; __attribute__((used)) static int __netdev_walk_all_upper_dev(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV - 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; bool ignore; now = dev; iter = &dev->adj_list.upper; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { udev = __netdev_next_upper_dev(now, &iter, &ignore); if (!udev) continue; if (ignore) continue; next = udev; niter = &udev->adj_list.upper; dev_stack[cur] = now; iter_stack[cur++] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_dir.c_fat_search_long_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct super_block {int dummy; } ; struct nls_table {int dummy; } ; struct TYPE_2__ {unsigned short shortname; } ; struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ; struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ; struct inode {struct super_block* i_sb; } ; struct fat_slot_info {unsigned char nr_slots; struct msdos_dir_entry* de; struct buffer_head* bh; int /*<<< orphan*/ i_pos; scalar_t__ slot_off; } ; struct buffer_head {int dummy; } ; typedef scalar_t__ loff_t ; typedef int /*<<< orphan*/ bufname ; /* Variables and functions */ int ATTR_EXT ; int ATTR_VOLUME ; int CASE_LOWER_BASE ; int CASE_LOWER_EXT ; scalar_t__ DELETED_FLAG ; int ENOENT ; int FAT_MAX_SHORT_SIZE ; int FAT_MAX_UNI_CHARS ; int FAT_MAX_UNI_SIZE ; scalar_t__ IS_FREE (scalar_t__*) ; int MSDOS_NAME ; struct msdos_sb_info* MSDOS_SB (struct super_block*) ; int PARSE_EOF ; int PARSE_INVALID ; int PARSE_NOT_LONGNAME ; int PATH_MAX ; int /*<<< orphan*/ __putname (int*) ; int fat_get_entry (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**) ; int /*<<< orphan*/ fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ; scalar_t__ fat_name_match (struct msdos_sb_info*,unsigned char const*,int,void*,int) ; int fat_parse_long (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ; int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ; int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ; int fat_uni_to_x8 (struct msdos_sb_info*,int*,void*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ; int fat_search_long(struct inode *inode, const unsigned char *name, int name_len, struct fat_slot_info *sinfo) { struct super_block *sb = inode->i_sb; struct msdos_sb_info *sbi = MSDOS_SB(sb); struct buffer_head *bh = NULL; struct msdos_dir_entry *de; struct nls_table *nls_disk = sbi->nls_disk; unsigned char nr_slots; wchar_t bufuname[14]; wchar_t *unicode = NULL; unsigned char work[MSDOS_NAME]; unsigned char bufname[FAT_MAX_SHORT_SIZE]; unsigned short opt_shortname = sbi->options.shortname; loff_t cpos = 0; int chl, i, j, last_u, err, len; err = -ENOENT; while (1) { if (fat_get_entry(inode, &cpos, &bh, &de) == -1) goto end_of_dir; parse_record: nr_slots = 0; if (de->name[0] == DELETED_FLAG) continue; if (de->attr != ATTR_EXT && (de->attr | ATTR_VOLUME)) continue; if (de->attr != ATTR_EXT && IS_FREE(de->name)) continue; if (de->attr == ATTR_EXT) { int status = fat_parse_long(inode, &cpos, &bh, &de, &unicode, &nr_slots); if (status <= 0) { err = status; goto end_of_dir; } else if (status == PARSE_INVALID) continue; else if (status == PARSE_NOT_LONGNAME) goto parse_record; else if (status == PARSE_EOF) goto end_of_dir; } memcpy(work, de->name, sizeof(de->name)); /* see namei.c, msdos_format_name */ if (work[0] == 0x05) work[0] = 0xE5; for (i = 0, j = 0, last_u = 0; i < 8;) { if (!work[i]) break; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, &bufuname[j--], opt_shortname, de->lcase & CASE_LOWER_BASE); if (chl <= 1) { if (work[i] != ' ') last_u = j; } else { last_u = j; } i += chl; } j = last_u; fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); for (i = 8; i < MSDOS_NAME;) { if (!work[i]) break; chl = fat_shortname2uni(nls_disk, &work[i], MSDOS_NAME - i, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_EXT); if (chl <= 1) { if (work[i] != ' ') last_u = j; } else { last_u = j; } i += chl; } if (!last_u) continue; /* Compare shortname */ bufuname[last_u] = 0x0000; len = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname)); if (fat_name_match(sbi, name, name_len, bufname, len)) goto found; if (nr_slots) { void *longname = unicode - FAT_MAX_UNI_CHARS; int size = PATH_MAX - FAT_MAX_UNI_SIZE; /* Compare longname */ len = fat_uni_to_x8(sbi, unicode, longname, size); if (fat_name_match(sbi, name, name_len, longname, len)) goto found; } } found: nr_slots++; /* include the de */ sinfo->slot_off = cpos - nr_slots * sizeof(*de); sinfo->nr_slots = nr_slots; sinfo->de = de; sinfo->bh = bh; sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de); err = 0; end_of_dir: if (unicode) __putname(unicode); return err; }