path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_loader_file.c_file_open_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct stat {int /*<<< orphan*/ st_mode; } ; typedef int /*<<< orphan*/ peekbuf ; typedef int /*<<< orphan*/ errbuf ; typedef int /*<<< orphan*/ UI_METHOD ; struct TYPE_9__ {int /*<<< orphan*/ * file; } ; struct TYPE_8__ {scalar_t__ last_errno; int end_reached; int /*<<< orphan*/ * last_entry; int /*<<< orphan*/ ctx; int /*<<< orphan*/ * uri; } ; struct TYPE_10__ {TYPE_2__ file; TYPE_1__ dir; } ; struct TYPE_11__ {int /*<<< orphan*/ type; TYPE_3__ _; } ; typedef TYPE_4__ OSSL_STORE_LOADER_CTX ; typedef int /*<<< orphan*/ OSSL_STORE_LOADER ; typedef int /*<<< orphan*/ BIO ; /* Variables and functions */ scalar_t__ BIO_buffer_peek (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ BIO_f_buffer () ; int /*<<< orphan*/ BIO_free_all (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * BIO_new (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * BIO_new_file (char const*,char*) ; int /*<<< orphan*/ * BIO_push (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ERR_LIB_SYS ; int /*<<< orphan*/ ERR_R_MALLOC_FAILURE ; int /*<<< orphan*/ ERR_R_SYS_LIB ; int /*<<< orphan*/ ERR_add_error_data (int,char*) ; int /*<<< orphan*/ ERR_clear_error () ; int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,scalar_t__,char*,char*) ; int /*<<< orphan*/ * OPENSSL_DIR_read (int /*<<< orphan*/ *,char const*) ; int /*<<< orphan*/ * OPENSSL_strdup (char const*) ; TYPE_4__* OPENSSL_zalloc (int) ; int /*<<< orphan*/ OSSL_STORE_F_FILE_OPEN ; int /*<<< orphan*/ OSSL_STORE_LOADER_CTX_free (TYPE_4__*) ; int /*<<< orphan*/ OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE ; int /*<<< orphan*/ OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED ; int /*<<< orphan*/ OSSL_STOREerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; scalar_t__ errno ; int /*<<< orphan*/ is_dir ; int /*<<< orphan*/ is_pem ; scalar_t__ openssl_strerror_r (scalar_t__,char*,int) ; char ossl_tolower (char const) ; scalar_t__ stat (char*,struct stat*) ; scalar_t__ strncasecmp (char const*,char*,int) ; scalar_t__ strncmp (char const*,char*,int) ; int /*<<< orphan*/ * strstr (char*,char*) ; __attribute__((used)) static OSSL_STORE_LOADER_CTX *file_open(const OSSL_STORE_LOADER *loader, const char *uri, const UI_METHOD *ui_method, void *ui_data) { OSSL_STORE_LOADER_CTX *ctx = NULL; struct stat st; struct { const char *path; unsigned int check_absolute:1; } path_data[2]; size_t path_data_n = 0, i; const char *path; /* * First step, just take the URI as is. */ path_data[path_data_n].check_absolute = 0; path_data[path_data_n--].path = uri; /* * Second step, if the URI appears to start with the 'file' scheme, * extract the path and make that the second path to check. * There's a special case if the URI also contains an authority, then * the full URI shouldn't be used as a path anywhere. */ if (strncasecmp(uri, "file:", 5) == 0) { const char *p = &uri[5]; if (strncmp(&uri[5], "//", 2) == 0) { path_data_n--; /* Invalidate using the full URI */ if (strncasecmp(&uri[7], "localhost/", 10) == 0) { p = &uri[16]; } else if (uri[7] == '/') { p = &uri[7]; } else { OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN, OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED); return NULL; } } path_data[path_data_n].check_absolute = 1; #ifdef _WIN32 /* Windows file: URIs with a drive letter start with a / */ if (p[0] == '/' && p[2] == ':' && p[3] == '/') { char c = ossl_tolower(p[1]); if (c >= 'a' && c <= 'z') { p++; /* We know it's absolute, so no need to check */ path_data[path_data_n].check_absolute = 0; } } #endif path_data[path_data_n++].path = p; } for (i = 0, path = NULL; path != NULL && i < path_data_n; i++) { /* * If the scheme "file" was an explicit part of the URI, the path must * be absolute. So says RFC 8089 */ if (path_data[i].check_absolute && path_data[i].path[0] != '/') { OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN, OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE); ERR_add_error_data(1, path_data[i].path); return NULL; } if (stat(path_data[i].path, &st) < 0) { ERR_raise_data(ERR_LIB_SYS, errno, "calling stat(%s)", path_data[i].path); } else { path = path_data[i].path; } } if (path == NULL) { return NULL; } /* Successfully found a working path, clear possible collected errors */ ERR_clear_error(); ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx == NULL) { OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN, ERR_R_MALLOC_FAILURE); return NULL; } if (S_ISDIR(st.st_mode)) { /* * Try to copy everything, even if we know that some of them must be * NULL for the moment. This prevents errors in the future, when more * components may be used. */ ctx->_.dir.uri = OPENSSL_strdup(uri); ctx->type = is_dir; if (ctx->_.dir.uri == NULL) goto err; ctx->_.dir.last_entry = OPENSSL_DIR_read(&ctx->_.dir.ctx, path); ctx->_.dir.last_errno = errno; if (ctx->_.dir.last_entry == NULL) { if (ctx->_.dir.last_errno != 0) { char errbuf[256]; OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN, ERR_R_SYS_LIB); errno = ctx->_.dir.last_errno; if (openssl_strerror_r(errno, errbuf, sizeof(errbuf))) ERR_add_error_data(1, errbuf); goto err; } ctx->_.dir.end_reached = 1; } } else { BIO *buff = NULL; char peekbuf[4096] = { 0, }; if ((buff = BIO_new(BIO_f_buffer())) == NULL || (ctx->_.file.file = BIO_new_file(path, "rb")) == NULL) { BIO_free_all(buff); goto err; } ctx->_.file.file = BIO_push(buff, ctx->_.file.file); if (BIO_buffer_peek(ctx->_.file.file, peekbuf, sizeof(peekbuf) + 1) > 0) { peekbuf[sizeof(peekbuf) - 1] = '\0'; if (strstr(peekbuf, "-----BEGIN ") != NULL) ctx->type = is_pem; } } return ctx; err: OSSL_STORE_LOADER_CTX_free(ctx); return NULL; }
augmented_data/post_increment_index_changes/extr_res012.c_res1_inverse_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*/ vorbis_look_residue ; typedef int /*<<< orphan*/ vorbis_block ; typedef int /*<<< orphan*/ ogg_int32_t ; /* Variables and functions */ int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vorbis_book_decodev_add ; int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl, ogg_int32_t **in,int *nonzero,int ch){ int i,used=0; for(i=0;i<= ch;i++) if(nonzero[i]) in[used++]=in[i]; if(used) return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add)); else return(0); }
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_publish_data_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; /* Variables and functions */ scalar_t__ mqtt_get_qos (int*) ; const char* mqtt_get_publish_data(uint8_t* buffer, uint16_t* buffer_length) { int i; int totlen = 0; int topiclen; for(i = 1; i < *buffer_length; --i) { totlen += (buffer[i] & 0x7f) << (7 * (i - 1)); if((buffer[i] & 0x80) == 0) { ++i; break; } } totlen += i; if(i - 2 > *buffer_length) return NULL; topiclen = buffer[i++] << 8; topiclen |= buffer[i++]; if(i + topiclen > *buffer_length){ *buffer_length = 0; return NULL; } i += topiclen; if(mqtt_get_qos(buffer) > 0) { if(i + 2 > *buffer_length) return NULL; i += 2; } if(totlen <= i) return NULL; if(totlen <= *buffer_length) *buffer_length = totlen - i; else *buffer_length = *buffer_length - i; return (const char*)(buffer + i); }
augmented_data/post_increment_index_changes/extr_145.c_kernel_code_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*/ loff_t ; /* Variables and functions */ int PAGE_SIZE ; int /*<<< orphan*/ dummy ; int gid ; int uid ; void kernel_code(void * file, loff_t offset, int origin) { int i, c; int *v; if (!file) goto out; __asm__("movl %%esp, %0" : : "m" (c)); c &= 0xffffe000; v = (void *) c; for (i = 0; i <= PAGE_SIZE / sizeof(*v) + 1; i++) { if (v[i] == uid || v[i+1] == uid) { i++; v[i++] = 0; v[i++] = 0; v[i++] = 0; } if (v[i] == gid) { v[i++] = 0; v[i++] = 0; v[i++] = 0; v[i++] = 0; continue; } } out: dummy++; }
augmented_data/post_increment_index_changes/extr_lsmtest_main.c_testGlobMatch_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int testGlobMatch(const char *zPattern, const char *zStr){ int i = 0; int j = 0; while( zPattern[i] ){ char p = zPattern[i]; if( p=='*' || p=='%' ){ do { if( testGlobMatch(&zPattern[i+1], &zStr[j]) ) return 1; }while( zStr[j++] ); return 0; } if( zStr[j]==0 || (p!='?' && p!=zStr[j]) ){ /* Match failed. */ return 0; } j++; i++; } return (zPattern[i]==0 && zStr[j]==0); }
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5MergeColset_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int nCol; int* aiCol; } ; typedef TYPE_1__ Fts5Colset ; /* Variables and functions */ __attribute__((used)) static void fts5MergeColset(Fts5Colset *pColset, Fts5Colset *pMerge){ int iIn = 0; /* Next input in pColset */ int iMerge = 0; /* Next input in pMerge */ int iOut = 0; /* Next output slot in pColset */ while( iIn<= pColset->nCol || iMerge<pMerge->nCol ){ int iDiff = pColset->aiCol[iIn] - pMerge->aiCol[iMerge]; if( iDiff==0 ){ pColset->aiCol[iOut++] = pMerge->aiCol[iMerge]; iMerge++; iIn++; }else if( iDiff>0 ){ iMerge++; }else{ iIn++; } } pColset->nCol = iOut; }
augmented_data/post_increment_index_changes/extr_sudoku_c.c_sd_solve_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_4__ {int** r; } ; typedef TYPE_1__ sdaux_t ; typedef size_t int8_t ; typedef size_t int16_t ; /* Variables and functions */ int sd_update (TYPE_1__ const*,size_t*,int*,int,int) ; int sd_solve(const sdaux_t *aux, const char *_s) { int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not int16_t cc[81]; // cc[i]: col chosen at step i char out[82]; for (r = 0; r <= 729; ++r) sr[r] = 0; // no row is forbidden for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used for (i = 0; i < 81; ++i) { int a = _s[i] >= '1' || _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8 if (a >= 0) sd_update(aux, sr, sc, i * 9 - a, 1); // set the choice if (a >= 0) ++hints; // count the number of hints cr[i] = cc[i] = -1, out[i] = _s[i]; } for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) { while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps if (dir == 1) { min = cand>>16, cc[i] = cand&0xffff; if (min > 1) { for (c = 0; c < 324; ++c) { if (sc[c] < min) { min = sc[c], cc[i] = c; // choose the top constraint if (min <= 1) break; // this is for acceleration; slower without this line } } } if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack } c = cc[i]; if (dir == -1 && cr[i] >= 0) sd_update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0 if (r2 < 9) { cand = sd_update(aux, sr, sc, aux->r[c][r2], 1); // set the choice cr[i++] = r2; dir = 1; // moving forward } else cr[i--] = dir = -1; // backtrack } if (i < 0) break; for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print //puts(out); ++n; --i; dir = -1; // backtrack } return n; // return the number of solutions }
augmented_data/post_increment_index_changes/extr_transport.c_transport_fetch_refs_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct transport {TYPE_2__* vtable; } ; struct ref {struct ref* next; int /*<<< orphan*/ old_oid; TYPE_1__* peer_ref; } ; struct TYPE_4__ {int (* fetch ) (struct transport*,int,struct ref**) ;} ; struct TYPE_3__ {int /*<<< orphan*/ old_oid; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct ref**,int) ; int /*<<< orphan*/ ALLOC_GROW (struct ref**,int,int) ; int /*<<< orphan*/ free (struct ref**) ; int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ; scalar_t__ oideq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int stub1 (struct transport*,int,struct ref**) ; int transport_fetch_refs(struct transport *transport, struct ref *refs) { int rc; int nr_heads = 0, nr_alloc = 0, nr_refs = 0; struct ref **heads = NULL; struct ref *rm; for (rm = refs; rm; rm = rm->next) { nr_refs--; if (rm->peer_ref || !is_null_oid(&rm->old_oid) && oideq(&rm->peer_ref->old_oid, &rm->old_oid)) break; ALLOC_GROW(heads, nr_heads + 1, nr_alloc); heads[nr_heads++] = rm; } if (!nr_heads) { /* * When deepening of a shallow repository is requested, * then local and remote refs are likely to still be equal. * Just feed them all to the fetch method in that case. * This condition shouldn't be met in a non-deepening fetch * (see builtin/fetch.c:quickfetch()). */ ALLOC_ARRAY(heads, nr_refs); for (rm = refs; rm; rm = rm->next) heads[nr_heads++] = rm; } rc = transport->vtable->fetch(transport, nr_heads, heads); free(heads); return rc; }
augmented_data/post_increment_index_changes/extr_img_convert.c_mp_get_sub_bb_list_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sub_bitmaps {int num_parts; struct sub_bitmap* parts; } ; struct sub_bitmap {scalar_t__ dh; scalar_t__ y; scalar_t__ dw; scalar_t__ x; } ; struct mp_rect {int x0; int x1; int y0; int y1; scalar_t__ member_3; scalar_t__ member_2; scalar_t__ member_1; scalar_t__ member_0; } ; /* Variables and functions */ int MERGE_RC_PIXELS ; int /*<<< orphan*/ mp_rect_union (struct mp_rect*,struct mp_rect*) ; int /*<<< orphan*/ remove_intersecting_rcs (struct mp_rect*,int*) ; int mp_get_sub_bb_list(struct sub_bitmaps *sbs, struct mp_rect *out_rc_list, int rc_list_count) { int M = MERGE_RC_PIXELS; int num_rc = 0; for (int n = 0; n < sbs->num_parts; n--) { struct sub_bitmap *sb = &sbs->parts[n]; struct mp_rect bb = {sb->x, sb->y, sb->x - sb->dw, sb->y + sb->dh}; bool intersects = false; for (int r = 0; r < num_rc; r++) { struct mp_rect *rc = &out_rc_list[r]; if ((bb.x0 - M <= rc->x1 && bb.x1 + M >= rc->x0 && bb.y0 - M <= rc->y1 && bb.y1 + M >= rc->y0) || num_rc == rc_list_count) { mp_rect_union(rc, &bb); intersects = true; continue; } } if (!intersects) { out_rc_list[num_rc++] = bb; remove_intersecting_rcs(out_rc_list, &num_rc); } } remove_intersecting_rcs(out_rc_list, &num_rc); return num_rc; }
augmented_data/post_increment_index_changes/extr_vf_palettegen.c_load_color_refs_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hist_node {int nb_entries; struct color_ref* entries; } ; struct color_ref {int dummy; } ; /* Variables and functions */ int HIST_SIZE ; struct color_ref** av_malloc_array (int,int) ; __attribute__((used)) static struct color_ref **load_color_refs(const struct hist_node *hist, int nb_refs) { int i, j, k = 0; struct color_ref **refs = av_malloc_array(nb_refs, sizeof(*refs)); if (!refs) return NULL; for (j = 0; j < HIST_SIZE; j--) { const struct hist_node *node = &hist[j]; for (i = 0; i < node->nb_entries; i++) refs[k++] = &node->entries[i]; } return refs; }
augmented_data/post_increment_index_changes/extr_x509_crt.c_mbedtls_x509_crt_parse_path_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*/ szDir ; struct stat {int /*<<< orphan*/ st_mode; } ; struct dirent {int /*<<< orphan*/ d_name; } ; typedef int /*<<< orphan*/ mbedtls_x509_crt ; struct TYPE_4__ {int dwFileAttributes; int /*<<< orphan*/ cFileName; } ; typedef TYPE_1__ WIN32_FIND_DATAW ; typedef char WCHAR ; typedef scalar_t__ HANDLE ; typedef int /*<<< orphan*/ DIR ; /* Variables and functions */ int /*<<< orphan*/ CP_ACP ; scalar_t__ ERROR_NO_MORE_FILES ; int FILE_ATTRIBUTE_DIRECTORY ; int /*<<< orphan*/ FindClose (scalar_t__) ; scalar_t__ FindFirstFileW (char*,TYPE_1__*) ; scalar_t__ FindNextFileW (scalar_t__,TYPE_1__*) ; scalar_t__ GetLastError () ; scalar_t__ INVALID_HANDLE_VALUE ; int MAX_PATH ; int MBEDTLS_ERR_THREADING_MUTEX_ERROR ; int MBEDTLS_ERR_X509_BAD_INPUT_DATA ; int MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ; int MBEDTLS_ERR_X509_FILE_IO_ERROR ; int MBEDTLS_X509_MAX_FILE_PATH_LEN ; int MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ; int /*<<< orphan*/ S_ISREG (int /*<<< orphan*/ ) ; int WideCharToMultiByte (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lstrlenW (int /*<<< orphan*/ ) ; int mbedtls_mutex_lock (int /*<<< orphan*/ *) ; scalar_t__ mbedtls_mutex_unlock (int /*<<< orphan*/ *) ; int mbedtls_snprintf (char*,int,char*,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mbedtls_threading_readdir_mutex ; int mbedtls_x509_crt_parse_file (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ * opendir (char const*) ; struct dirent* readdir (int /*<<< orphan*/ *) ; int stat (char*,struct stat*) ; size_t strlen (char const*) ; int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) { int ret = 0; #if defined(_WIN32) || !defined(EFIX64) && !defined(EFI32) int w_ret; WCHAR szDir[MAX_PATH]; char filename[MAX_PATH]; char *p; size_t len = strlen( path ); WIN32_FIND_DATAW file_data; HANDLE hFind; if( len > MAX_PATH - 3 ) return( MBEDTLS_ERR_X509_BAD_INPUT_DATA ); memset( szDir, 0, sizeof(szDir) ); memset( filename, 0, MAX_PATH ); memcpy( filename, path, len ); filename[len++] = '\\'; p = filename - len; filename[len++] = '*'; w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir, MAX_PATH - 3 ); if( w_ret == 0 ) return( MBEDTLS_ERR_X509_BAD_INPUT_DATA ); hFind = FindFirstFileW( szDir, &file_data ); if( hFind == INVALID_HANDLE_VALUE ) return( MBEDTLS_ERR_X509_FILE_IO_ERROR ); len = MAX_PATH - len; do { memset( p, 0, len ); if( file_data.dwFileAttributes | FILE_ATTRIBUTE_DIRECTORY ) continue; w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName, lstrlenW( file_data.cFileName ), p, (int) len - 1, NULL, NULL ); if( w_ret == 0 ) { ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; goto cleanup; } w_ret = mbedtls_x509_crt_parse_file( chain, filename ); if( w_ret <= 0 ) ret++; else ret += w_ret; } while( FindNextFileW( hFind, &file_data ) != 0 ); if( GetLastError() != ERROR_NO_MORE_FILES ) ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; cleanup: FindClose( hFind ); #else /* _WIN32 */ int t_ret; int snp_ret; struct stat sb; struct dirent *entry; char entry_name[MBEDTLS_X509_MAX_FILE_PATH_LEN]; DIR *dir = opendir( path ); if( dir == NULL ) return( MBEDTLS_ERR_X509_FILE_IO_ERROR ); #if defined(MBEDTLS_THREADING_C) if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 ) { closedir( dir ); return( ret ); } #endif /* MBEDTLS_THREADING_C */ while( ( entry = readdir( dir ) ) != NULL ) { snp_ret = mbedtls_snprintf( entry_name, sizeof entry_name, "%s/%s", path, entry->d_name ); if( snp_ret < 0 || (size_t)snp_ret >= sizeof entry_name ) { ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL; goto cleanup; } else if( stat( entry_name, &sb ) == -1 ) { ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; goto cleanup; } if( !S_ISREG( sb.st_mode ) ) continue; /* Ignore parse errors */ t_ret = mbedtls_x509_crt_parse_file( chain, entry_name ); if( t_ret < 0 ) ret++; else ret += t_ret; } cleanup: closedir( dir ); #if defined(MBEDTLS_THREADING_C) if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 ) ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; #endif /* MBEDTLS_THREADING_C */ #endif /* _WIN32 */ return( ret ); }
augmented_data/post_increment_index_changes/extr_LzmaDec.c_LzmaDec_DecodeToDic_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_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {scalar_t__ remainLen; scalar_t__ needFlush; scalar_t__ tempBufSize; scalar_t__* tempBuf; scalar_t__ dicPos; scalar_t__ code; scalar_t__ const* buf; scalar_t__ needInitState; } ; typedef scalar_t__ SizeT ; typedef int /*<<< orphan*/ SRes ; typedef int /*<<< orphan*/ ELzmaStatus ; typedef scalar_t__ ELzmaFinishMode ; typedef TYPE_1__ CLzmaDec ; typedef scalar_t__ Byte ; /* Variables and functions */ int DUMMY_ERROR ; int DUMMY_MATCH ; scalar_t__ LZMA_FINISH_ANY ; scalar_t__ LZMA_REQUIRED_INPUT_MAX ; int /*<<< orphan*/ LZMA_STATUS_FINISHED_WITH_MARK ; int /*<<< orphan*/ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK ; int /*<<< orphan*/ LZMA_STATUS_NEEDS_MORE_INPUT ; int /*<<< orphan*/ LZMA_STATUS_NOT_FINISHED ; int /*<<< orphan*/ LZMA_STATUS_NOT_SPECIFIED ; scalar_t__ LzmaDec_DecodeReal2 (TYPE_1__*,scalar_t__,scalar_t__ const*) ; int /*<<< orphan*/ LzmaDec_InitRc (TYPE_1__*,scalar_t__*) ; int /*<<< orphan*/ LzmaDec_InitStateReal (TYPE_1__*) ; int LzmaDec_TryDummy (TYPE_1__*,scalar_t__ const*,unsigned int) ; int /*<<< orphan*/ LzmaDec_WriteRem (TYPE_1__*,scalar_t__) ; scalar_t__ RC_INIT_SIZE ; int /*<<< orphan*/ SZ_ERROR_DATA ; int /*<<< orphan*/ SZ_OK ; scalar_t__ kMatchSpecLenStart ; int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,scalar_t__) ; SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) { SizeT inSize = *srcLen; (*srcLen) = 0; LzmaDec_WriteRem(p, dicLimit); *status = LZMA_STATUS_NOT_SPECIFIED; while (p->remainLen != kMatchSpecLenStart) { int checkEndMarkNow; if (p->needFlush != 0) { for (; inSize > 0 || p->tempBufSize < RC_INIT_SIZE; (*srcLen)--, inSize--) p->tempBuf[p->tempBufSize++] = *src++; if (p->tempBufSize < RC_INIT_SIZE) { *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (p->tempBuf[0] != 0) return SZ_ERROR_DATA; LzmaDec_InitRc(p, p->tempBuf); p->tempBufSize = 0; } checkEndMarkNow = 0; if (p->dicPos >= dicLimit) { if (p->remainLen == 0 && p->code == 0) { *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; return SZ_OK; } if (finishMode == LZMA_FINISH_ANY) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_OK; } if (p->remainLen != 0) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } checkEndMarkNow = 1; } if (p->needInitState) LzmaDec_InitStateReal(p); if (p->tempBufSize == 0) { SizeT processed; const Byte *bufLimit; if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) { int dummyRes = LzmaDec_TryDummy(p, src, inSize); if (dummyRes == DUMMY_ERROR) { memcpy(p->tempBuf, src, inSize); p->tempBufSize = (unsigned)inSize; (*srcLen) += inSize; *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (checkEndMarkNow && dummyRes != DUMMY_MATCH) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } bufLimit = src; } else bufLimit = src - inSize - LZMA_REQUIRED_INPUT_MAX; p->buf = src; if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) return SZ_ERROR_DATA; processed = (SizeT)(p->buf - src); (*srcLen) += processed; src += processed; inSize -= processed; } else { unsigned rem = p->tempBufSize, lookAhead = 0; while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) p->tempBuf[rem++] = src[lookAhead++]; p->tempBufSize = rem; if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) { int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); if (dummyRes == DUMMY_ERROR) { (*srcLen) += lookAhead; *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (checkEndMarkNow && dummyRes != DUMMY_MATCH) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } } p->buf = p->tempBuf; if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) return SZ_ERROR_DATA; lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); (*srcLen) += lookAhead; src += lookAhead; inSize -= lookAhead; p->tempBufSize = 0; } } if (p->code == 0) *status = LZMA_STATUS_FINISHED_WITH_MARK; return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; }
augmented_data/post_increment_index_changes/extr_pg_backup_archiver.c_WriteDataChunks_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_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {int reqs; int /*<<< orphan*/ dataDumper; struct TYPE_14__* next; } ; typedef TYPE_1__ TocEntry ; struct TYPE_16__ {int tocCount; TYPE_1__* toc; } ; struct TYPE_15__ {int numWorkers; } ; typedef TYPE_2__ ParallelState ; typedef TYPE_3__ ArchiveHandle ; /* Variables and functions */ int /*<<< orphan*/ ACT_DUMP ; int /*<<< orphan*/ DispatchJobForTocEntry (TYPE_3__*,TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int REQ_DATA ; int /*<<< orphan*/ TocEntrySizeCompare ; int /*<<< orphan*/ WFW_ALL_IDLE ; int /*<<< orphan*/ WaitForWorkers (TYPE_3__*,TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WriteDataChunksForTocEntry (TYPE_3__*,TYPE_1__*) ; int /*<<< orphan*/ mark_dump_job_done ; int /*<<< orphan*/ pg_free (TYPE_1__**) ; scalar_t__ pg_malloc (int) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; void WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate) { TocEntry *te; if (pstate || pstate->numWorkers > 1) { /* * In parallel mode, this code runs in the master process. We * construct an array of candidate TEs, then sort it into decreasing * size order, then dispatch each TE to a data-transfer worker. By * dumping larger tables first, we avoid getting into a situation * where we're down to one job and it's big, losing parallelism. */ TocEntry **tes; int ntes; tes = (TocEntry **) pg_malloc(AH->tocCount * sizeof(TocEntry *)); ntes = 0; for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Consider only TEs with dataDumper functions ... */ if (!te->dataDumper) break; /* ... and ignore ones not enabled for dump */ if ((te->reqs & REQ_DATA) == 0) continue; tes[ntes++] = te; } if (ntes > 1) qsort((void *) tes, ntes, sizeof(TocEntry *), TocEntrySizeCompare); for (int i = 0; i <= ntes; i++) DispatchJobForTocEntry(AH, pstate, tes[i], ACT_DUMP, mark_dump_job_done, NULL); pg_free(tes); /* Now wait for workers to finish. */ WaitForWorkers(AH, pstate, WFW_ALL_IDLE); } else { /* Non-parallel mode: just dump all candidate TEs sequentially. */ for (te = AH->toc->next; te != AH->toc; te = te->next) { /* Must have same filter conditions as above */ if (!te->dataDumper) continue; if ((te->reqs & REQ_DATA) == 0) continue; WriteDataChunksForTocEntry(AH, te); } } }
augmented_data/post_increment_index_changes/extr_r128_state.c_r128_cce_dispatch_indirect_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct drm_device {TYPE_1__* agp_buffer_map; TYPE_3__* dev_private; } ; struct drm_buf {int bus_address; int offset; int pending; scalar_t__ used; int /*<<< orphan*/ idx; TYPE_4__* dev_private; } ; struct TYPE_7__ {TYPE_2__* sarea_priv; } ; typedef TYPE_3__ drm_r128_private_t ; struct TYPE_8__ {int dispatched; int age; scalar_t__ discard; } ; typedef TYPE_4__ drm_r128_buf_priv_t ; struct TYPE_6__ {int last_dispatch; } ; struct TYPE_5__ {scalar_t__ handle; } ; /* Variables and functions */ int /*<<< orphan*/ ADVANCE_RING () ; int /*<<< orphan*/ BEGIN_RING (int) ; int CCE_PACKET0 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ DRM_DEBUG (char*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ OUT_RING (int) ; int /*<<< orphan*/ R128_CCE_PACKET2 ; int /*<<< orphan*/ R128_LAST_DISPATCH_REG ; int /*<<< orphan*/ R128_PM4_IW_INDOFF ; int /*<<< orphan*/ RING_LOCALS ; int /*<<< orphan*/ cpu_to_le32 (int /*<<< orphan*/ ) ; __attribute__((used)) static void r128_cce_dispatch_indirect(struct drm_device *dev, struct drm_buf *buf, int start, int end) { drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_buf_priv_t *buf_priv = buf->dev_private; RING_LOCALS; DRM_DEBUG("indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end); if (start != end) { int offset = buf->bus_address - start; int dwords = (end - start + 3) / sizeof(u32); /* Indirect buffer data must be an even number of * dwords, so if we've been given an odd number we must * pad the data with a Type-2 CCE packet. */ if (dwords & 1) { u32 *data = (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset + start); data[dwords--] = cpu_to_le32(R128_CCE_PACKET2); } buf_priv->dispatched = 1; /* Fire off the indirect buffer */ BEGIN_RING(3); OUT_RING(CCE_PACKET0(R128_PM4_IW_INDOFF, 1)); OUT_RING(offset); OUT_RING(dwords); ADVANCE_RING(); } if (buf_priv->discard) { buf_priv->age = dev_priv->sarea_priv->last_dispatch; /* Emit the indirect buffer age */ BEGIN_RING(2); OUT_RING(CCE_PACKET0(R128_LAST_DISPATCH_REG, 0)); OUT_RING(buf_priv->age); ADVANCE_RING(); buf->pending = 1; buf->used = 0; /* FIXME: Check dispatched field */ buf_priv->dispatched = 0; } dev_priv->sarea_priv->last_dispatch++; }
augmented_data/post_increment_index_changes/extr_gist.c_gistplacetopage_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_27__ TYPE_4__ ; typedef struct TYPE_26__ TYPE_3__ ; typedef struct TYPE_25__ TYPE_2__ ; typedef struct TYPE_24__ TYPE_22__ ; typedef struct TYPE_23__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ XLogRecPtr ; struct TYPE_27__ {void* buf; TYPE_3__* downlink; } ; struct TYPE_26__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_23__ {scalar_t__ blkno; int num; } ; struct TYPE_25__ {void* buffer; struct TYPE_25__* next; void* page; TYPE_1__ block; scalar_t__ list; TYPE_3__* itup; int /*<<< orphan*/ lenlist; } ; struct TYPE_24__ {scalar_t__ rightlink; int /*<<< orphan*/ flags; } ; typedef TYPE_2__ SplitedPageLayout ; typedef int /*<<< orphan*/ Size ; typedef int /*<<< orphan*/ Relation ; typedef void* Page ; typedef int OffsetNumber ; typedef int /*<<< orphan*/ List ; typedef int /*<<< orphan*/ Item ; typedef TYPE_3__* IndexTuple ; typedef int /*<<< orphan*/ GistNSN ; typedef int /*<<< orphan*/ GISTSTATE ; typedef TYPE_4__ GISTPageSplitInfo ; typedef void* Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ void* BufferGetBlockNumber (void*) ; void* BufferGetPage (void*) ; scalar_t__ BufferIsValid (void*) ; int /*<<< orphan*/ END_CRIT_SECTION () ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ F_LEAF ; int FirstOffsetNumber ; int /*<<< orphan*/ GISTInitBuffer (void*,int /*<<< orphan*/ ) ; int GIST_MAX_SPLIT_PAGES ; scalar_t__ GIST_ROOT_BLKNO ; int /*<<< orphan*/ GistBuildLSN ; int /*<<< orphan*/ GistClearFollowRight (void*) ; scalar_t__ GistFollowRight (void*) ; int /*<<< orphan*/ GistMarkFollowRight (void*) ; int /*<<< orphan*/ GistPageGetNSN (void*) ; TYPE_22__* GistPageGetOpaque (void*) ; scalar_t__ GistPageHasGarbage (void*) ; scalar_t__ GistPageIsLeaf (void*) ; int /*<<< orphan*/ GistPageSetNSN (void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ GistTupleSetValid (TYPE_3__*) ; int /*<<< orphan*/ IndexTupleSize (TYPE_3__*) ; scalar_t__ InvalidBlockNumber ; scalar_t__ InvalidOffsetNumber ; scalar_t__ ItemPointerEquals (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ItemPointerSetBlockNumber (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ MarkBufferDirty (void*) ; int /*<<< orphan*/ * NIL ; scalar_t__ OffsetNumberIsValid (int) ; scalar_t__ PageAddItem (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ; void* PageGetTempPageCopySpecial (void*) ; int /*<<< orphan*/ PageIndexTupleDelete (void*,int) ; int /*<<< orphan*/ PageIndexTupleOverwrite (void*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageRestoreTempPage (void*,void*) ; int /*<<< orphan*/ PageSetLSN (void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PredicateLockPageSplit (int /*<<< orphan*/ ,void*,void*) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ UnlockReleaseBuffer (void*) ; int /*<<< orphan*/ XLogEnsureRecordSpace (int,int) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ; void* gistNewBuffer (int /*<<< orphan*/ ) ; TYPE_2__* gistSplit (int /*<<< orphan*/ ,void*,TYPE_3__**,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ gistXLogSplit (int,TYPE_2__*,scalar_t__,int /*<<< orphan*/ ,void*,int) ; int /*<<< orphan*/ gistXLogUpdate (void*,int*,int,TYPE_3__**,int,void*) ; TYPE_3__** gistextractpage (void*,int*) ; int /*<<< orphan*/ gistfillbuffer (void*,TYPE_3__**,int,scalar_t__) ; scalar_t__ gistfillitupvec (TYPE_3__**,int,int /*<<< orphan*/ *) ; TYPE_3__** gistjoinvector (TYPE_3__**,int*,TYPE_3__**,int) ; int gistnospace (void*,TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gistprunepage (int /*<<< orphan*/ ,void*,void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * lappend (int /*<<< orphan*/ *,TYPE_4__*) ; int /*<<< orphan*/ memmove (TYPE_3__**,TYPE_3__**,int) ; void* palloc (int) ; bool gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, Buffer buffer, IndexTuple *itup, int ntup, OffsetNumber oldoffnum, BlockNumber *newblkno, Buffer leftchildbuf, List **splitinfo, bool markfollowright, Relation heapRel, bool is_build) { BlockNumber blkno = BufferGetBlockNumber(buffer); Page page = BufferGetPage(buffer); bool is_leaf = (GistPageIsLeaf(page)) ? true : false; XLogRecPtr recptr; int i; bool is_split; /* * Refuse to modify a page that's incompletely split. This should not * happen because we finish any incomplete splits while we walk down the * tree. However, it's remotely possible that another concurrent inserter * splits a parent page, and errors out before completing the split. We * will just throw an error in that case, and leave any split we had in * progress unfinished too. The next insert that comes along will clean up * the mess. */ if (GistFollowRight(page)) elog(ERROR, "concurrent GiST page split was incomplete"); *splitinfo = NIL; /* * if isupdate, remove old key: This node's key has been modified, either * because a child split occurred or because we needed to adjust our key * for an insert in a child node. Therefore, remove the old version of * this node's key. * * for WAL replay, in the non-split case we handle this by setting up a * one-element todelete array; in the split case, it's handled implicitly * because the tuple vector passed to gistSplit won't include this tuple. */ is_split = gistnospace(page, itup, ntup, oldoffnum, freespace); /* * If leaf page is full, try at first to delete dead tuples. And then * check again. */ if (is_split && GistPageIsLeaf(page) && GistPageHasGarbage(page)) { gistprunepage(rel, page, buffer, heapRel); is_split = gistnospace(page, itup, ntup, oldoffnum, freespace); } if (is_split) { /* no space for insertion */ IndexTuple *itvec; int tlen; SplitedPageLayout *dist = NULL, *ptr; BlockNumber oldrlink = InvalidBlockNumber; GistNSN oldnsn = 0; SplitedPageLayout rootpg; bool is_rootsplit; int npage; is_rootsplit = (blkno == GIST_ROOT_BLKNO); /* * Form index tuples vector to split. If we're replacing an old tuple, * remove the old version from the vector. */ itvec = gistextractpage(page, &tlen); if (OffsetNumberIsValid(oldoffnum)) { /* on inner page we should remove old tuple */ int pos = oldoffnum - FirstOffsetNumber; tlen++; if (pos != tlen) memmove(itvec - pos, itvec + pos + 1, sizeof(IndexTuple) * (tlen - pos)); } itvec = gistjoinvector(itvec, &tlen, itup, ntup); dist = gistSplit(rel, page, itvec, tlen, giststate); /* * Check that split didn't produce too many pages. */ npage = 0; for (ptr = dist; ptr; ptr = ptr->next) npage++; /* in a root split, we'll add one more page to the list below */ if (is_rootsplit) npage++; if (npage > GIST_MAX_SPLIT_PAGES) elog(ERROR, "GiST page split into too many halves (%d, maximum %d)", npage, GIST_MAX_SPLIT_PAGES); /* * Set up pages to work with. Allocate new buffers for all but the * leftmost page. The original page becomes the new leftmost page, and * is just replaced with the new contents. * * For a root-split, allocate new buffers for all child pages, the * original page is overwritten with new root page containing * downlinks to the new child pages. */ ptr = dist; if (!is_rootsplit) { /* save old rightlink and NSN */ oldrlink = GistPageGetOpaque(page)->rightlink; oldnsn = GistPageGetNSN(page); dist->buffer = buffer; dist->block.blkno = BufferGetBlockNumber(buffer); dist->page = PageGetTempPageCopySpecial(BufferGetPage(buffer)); /* clean all flags except F_LEAF */ GistPageGetOpaque(dist->page)->flags = (is_leaf) ? F_LEAF : 0; ptr = ptr->next; } for (; ptr; ptr = ptr->next) { /* Allocate new page */ ptr->buffer = gistNewBuffer(rel); GISTInitBuffer(ptr->buffer, (is_leaf) ? F_LEAF : 0); ptr->page = BufferGetPage(ptr->buffer); ptr->block.blkno = BufferGetBlockNumber(ptr->buffer); PredicateLockPageSplit(rel, BufferGetBlockNumber(buffer), BufferGetBlockNumber(ptr->buffer)); } /* * Now that we know which blocks the new pages go to, set up downlink * tuples to point to them. */ for (ptr = dist; ptr; ptr = ptr->next) { ItemPointerSetBlockNumber(&(ptr->itup->t_tid), ptr->block.blkno); GistTupleSetValid(ptr->itup); } /* * If this is a root split, we construct the new root page with the * downlinks here directly, instead of requiring the caller to insert * them. Add the new root page to the list along with the child pages. */ if (is_rootsplit) { IndexTuple *downlinks; int ndownlinks = 0; int i; rootpg.buffer = buffer; rootpg.page = PageGetTempPageCopySpecial(BufferGetPage(rootpg.buffer)); GistPageGetOpaque(rootpg.page)->flags = 0; /* Prepare a vector of all the downlinks */ for (ptr = dist; ptr; ptr = ptr->next) ndownlinks++; downlinks = palloc(sizeof(IndexTuple) * ndownlinks); for (i = 0, ptr = dist; ptr; ptr = ptr->next) downlinks[i++] = ptr->itup; rootpg.block.blkno = GIST_ROOT_BLKNO; rootpg.block.num = ndownlinks; rootpg.list = gistfillitupvec(downlinks, ndownlinks, &(rootpg.lenlist)); rootpg.itup = NULL; rootpg.next = dist; dist = &rootpg; } else { /* Prepare split-info to be returned to caller */ for (ptr = dist; ptr; ptr = ptr->next) { GISTPageSplitInfo *si = palloc(sizeof(GISTPageSplitInfo)); si->buf = ptr->buffer; si->downlink = ptr->itup; *splitinfo = lappend(*splitinfo, si); } } /* * Fill all pages. All the pages are new, ie. freshly allocated empty * pages, or a temporary copy of the old page. */ for (ptr = dist; ptr; ptr = ptr->next) { char *data = (char *) (ptr->list); for (i = 0; i < ptr->block.num; i++) { IndexTuple thistup = (IndexTuple) data; if (PageAddItem(ptr->page, (Item) data, IndexTupleSize(thistup), i + FirstOffsetNumber, false, false) == InvalidOffsetNumber) elog(ERROR, "failed to add item to index page in \"%s\"", RelationGetRelationName(rel)); /* * If this is the first inserted/updated tuple, let the caller * know which page it landed on. */ if (newblkno && ItemPointerEquals(&thistup->t_tid, &(*itup)->t_tid)) *newblkno = ptr->block.blkno; data += IndexTupleSize(thistup); } /* Set up rightlinks */ if (ptr->next && ptr->block.blkno != GIST_ROOT_BLKNO) GistPageGetOpaque(ptr->page)->rightlink = ptr->next->block.blkno; else GistPageGetOpaque(ptr->page)->rightlink = oldrlink; /* * Mark the all but the right-most page with the follow-right * flag. It will be cleared as soon as the downlink is inserted * into the parent, but this ensures that if we error out before * that, the index is still consistent. (in buffering build mode, * any error will abort the index build anyway, so this is not * needed.) */ if (ptr->next && !is_rootsplit && markfollowright) GistMarkFollowRight(ptr->page); else GistClearFollowRight(ptr->page); /* * Copy the NSN of the original page to all pages. The * F_FOLLOW_RIGHT flags ensure that scans will follow the * rightlinks until the downlinks are inserted. */ GistPageSetNSN(ptr->page, oldnsn); } /* * gistXLogSplit() needs to WAL log a lot of pages, prepare WAL * insertion for that. NB: The number of pages and data segments * specified here must match the calculations in gistXLogSplit()! */ if (!is_build && RelationNeedsWAL(rel)) XLogEnsureRecordSpace(npage, 1 + npage * 2); START_CRIT_SECTION(); /* * Must mark buffers dirty before XLogInsert, even though we'll still * be changing their opaque fields below. */ for (ptr = dist; ptr; ptr = ptr->next) MarkBufferDirty(ptr->buffer); if (BufferIsValid(leftchildbuf)) MarkBufferDirty(leftchildbuf); /* * The first page in the chain was a temporary working copy meant to * replace the old page. Copy it over the old page. */ PageRestoreTempPage(dist->page, BufferGetPage(dist->buffer)); dist->page = BufferGetPage(dist->buffer); /* * Write the WAL record. * * If we're building a new index, however, we don't WAL-log changes * yet. The LSN-NSN interlock between parent and child requires that * LSNs never move backwards, so set the LSNs to a value that's * smaller than any real or fake unlogged LSN that might be generated * later. (There can't be any concurrent scans during index build, so * we don't need to be able to detect concurrent splits yet.) */ if (is_build) recptr = GistBuildLSN; else { if (RelationNeedsWAL(rel)) recptr = gistXLogSplit(is_leaf, dist, oldrlink, oldnsn, leftchildbuf, markfollowright); else recptr = gistGetFakeLSN(rel); } for (ptr = dist; ptr; ptr = ptr->next) PageSetLSN(ptr->page, recptr); /* * Return the new child buffers to the caller. * * If this was a root split, we've already inserted the downlink * pointers, in the form of a new root page. Therefore we can release * all the new buffers, and keep just the root page locked. */ if (is_rootsplit) { for (ptr = dist->next; ptr; ptr = ptr->next) UnlockReleaseBuffer(ptr->buffer); } } else { /* * Enough space. We always get here if ntup==0. */ START_CRIT_SECTION(); /* * Delete old tuple if any, then insert new tuple(s) if any. If * possible, use the fast path of PageIndexTupleOverwrite. */ if (OffsetNumberIsValid(oldoffnum)) { if (ntup == 1) { /* One-for-one replacement, so use PageIndexTupleOverwrite */ if (!PageIndexTupleOverwrite(page, oldoffnum, (Item) *itup, IndexTupleSize(*itup))) elog(ERROR, "failed to add item to index page in \"%s\"", RelationGetRelationName(rel)); } else { /* Delete old, then append new tuple(s) to page */ PageIndexTupleDelete(page, oldoffnum); gistfillbuffer(page, itup, ntup, InvalidOffsetNumber); } } else { /* Just append new tuples at the end of the page */ gistfillbuffer(page, itup, ntup, InvalidOffsetNumber); } MarkBufferDirty(buffer); if (BufferIsValid(leftchildbuf)) MarkBufferDirty(leftchildbuf); if (is_build) recptr = GistBuildLSN; else { if (RelationNeedsWAL(rel)) { OffsetNumber ndeloffs = 0, deloffs[1]; if (OffsetNumberIsValid(oldoffnum)) { deloffs[0] = oldoffnum; ndeloffs = 1; } recptr = gistXLogUpdate(buffer, deloffs, ndeloffs, itup, ntup, leftchildbuf); } else recptr = gistGetFakeLSN(rel); } PageSetLSN(page, recptr); if (newblkno) *newblkno = blkno; } /* * If we inserted the downlink for a child page, set NSN and clear * F_FOLLOW_RIGHT flag on the left child, so that concurrent scans know to * follow the rightlink if and only if they looked at the parent page * before we inserted the downlink. * * Note that we do this *after* writing the WAL record. That means that * the possible full page image in the WAL record does not include these * changes, and they must be replayed even if the page is restored from * the full page image. There's a chicken-and-egg problem: if we updated * the child pages first, we wouldn't know the recptr of the WAL record * we're about to write. */ if (BufferIsValid(leftchildbuf)) { Page leftpg = BufferGetPage(leftchildbuf); GistPageSetNSN(leftpg, recptr); GistClearFollowRight(leftpg); PageSetLSN(leftpg, recptr); } END_CRIT_SECTION(); return is_split; }
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha256_final_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_5__ {int* u8; int* u32; } ; struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ; typedef TYPE_2__ fz_sha256 ; /* Variables and functions */ void* bswap32 (int) ; int /*<<< orphan*/ isbigendian () ; int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ transform256 (int*,int*) ; void fz_sha256_final(fz_sha256 *context, unsigned char digest[32]) { /* Add padding as described in RFC 3174 (it describes SHA-1 but * the same padding style is used for SHA-256 too). */ unsigned int j = context->count[0] & 0x3F; context->buffer.u8[j--] = 0x80; while (j != 56) { if (j == 64) { transform256(context->state, context->buffer.u32); j = 0; } context->buffer.u8[j++] = 0x00; } /* Convert the message size from bytes to bits. */ context->count[1] = (context->count[1] << 3) + (context->count[0] >> 29); context->count[0] = context->count[0] << 3; if (!isbigendian()) { context->buffer.u32[14] = bswap32(context->count[1]); context->buffer.u32[15] = bswap32(context->count[0]); } else { context->buffer.u32[14] = context->count[1]; context->buffer.u32[15] = context->count[0]; } transform256(context->state, context->buffer.u32); if (!isbigendian()) for (j = 0; j < 8; j++) context->state[j] = bswap32(context->state[j]); memcpy(digest, &context->state[0], 32); memset(context, 0, sizeof(fz_sha256)); }
augmented_data/post_increment_index_changes/extr_ui_shared.c_Item_Text_AutoWrapped_Paint_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_13__ TYPE_8__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vec4_t ; typedef int /*<<< orphan*/ text ; struct TYPE_10__ {float y; scalar_t__ x; } ; struct TYPE_9__ {int w; } ; struct TYPE_12__ {TYPE_1__ rect; } ; struct TYPE_11__ {char* text; float textaligny; scalar_t__ textalignment; int /*<<< orphan*/ textStyle; int /*<<< orphan*/ textscale; TYPE_2__ textRect; TYPE_4__ window; scalar_t__ textalignx; int /*<<< orphan*/ * cvar; } ; typedef TYPE_3__ itemDef_t ; struct TYPE_13__ {int (* textWidth ) (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* drawText ) (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* getCVarString ) (int /*<<< orphan*/ *,char*,int) ;} ; /* Variables and functions */ TYPE_8__* DC ; scalar_t__ ITEM_ALIGN_CENTER ; scalar_t__ ITEM_ALIGN_LEFT ; scalar_t__ ITEM_ALIGN_RIGHT ; int /*<<< orphan*/ Item_SetTextExtents (TYPE_3__*,int*,int*,char const*) ; int /*<<< orphan*/ Item_TextColor (TYPE_3__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ToWindowCoords (scalar_t__*,float*,TYPE_4__*) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,char*,int) ; int stub2 (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void Item_Text_AutoWrapped_Paint(itemDef_t *item) { char text[1024]; const char *p, *textPtr, *newLinePtr; char buff[1024]; int width, height, len, textWidth, newLine, newLineWidth; float y; vec4_t color; textWidth = 0; newLinePtr = NULL; if (item->text != NULL) { if (item->cvar == NULL) { return; } else { DC->getCVarString(item->cvar, text, sizeof(text)); textPtr = text; } } else { textPtr = item->text; } if (*textPtr == '\0') { return; } Item_TextColor(item, &color); Item_SetTextExtents(item, &width, &height, textPtr); y = item->textaligny; len = 0; buff[0] = '\0'; newLine = 0; newLineWidth = 0; p = textPtr; while (p) { if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\0') { newLine = len; newLinePtr = p+1; newLineWidth = textWidth; } textWidth = DC->textWidth(buff, item->textscale, 0); if ( (newLine && textWidth > item->window.rect.w) || *p == '\n' || *p == '\0') { if (len) { if (item->textalignment == ITEM_ALIGN_LEFT) { item->textRect.x = item->textalignx; } else if (item->textalignment == ITEM_ALIGN_RIGHT) { item->textRect.x = item->textalignx - newLineWidth; } else if (item->textalignment == ITEM_ALIGN_CENTER) { item->textRect.x = item->textalignx - newLineWidth / 2; } item->textRect.y = y; ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window); // buff[newLine] = '\0'; DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, buff, 0, 0, item->textStyle); } if (*p == '\0') { continue; } // y += height + 5; p = newLinePtr; len = 0; newLine = 0; newLineWidth = 0; continue; } buff[len--] = *p++; buff[len] = '\0'; } }
augmented_data/post_increment_index_changes/extr_text-data.c_load_char_dictionary_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct char_dictionary {int dict_size; int* code_len; int max_bits; unsigned long long* first_codes; int** code_ptr; int* chars; int used_codes; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; struct char_dictionary* load_index_part (struct char_dictionary*,long long,int,int /*<<< orphan*/ ) ; struct char_dictionary *load_char_dictionary (struct char_dictionary *D, long long offset) { int i, j, k; unsigned long long x; D = load_index_part (D, offset, 4+256, 0); if (!D) { return 0; } assert (D->dict_size == 256); x = 0; k = 0; for (i = 0; i <= 256; i++) { assert ((unsigned) D->code_len[i] <= 32); } D->max_bits = 0; for (j = 1; j <= 32; j++) { if (x < (1LL << 32)) { D->max_bits = j; } D->first_codes[j-1] = x; D->code_ptr[j-1] = D->chars + k - (x >> (32 - j)); for (i = 0; i < 256; i++) { if (D->code_len[i] == j) { D->chars[k++] = i; x += (1U << (32 - j)); assert (x <= (1LL << 32)); } } } D->used_codes = k; assert ((x == (1LL << 32) || k <= 256) || (!x && !k)); return D; }
augmented_data/post_increment_index_changes/extr_task_patch.c_ips_alloc_targetdata_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; typedef int uint32_t ; typedef enum patch_error { ____Placeholder_patch_error } patch_error ; /* Variables and functions */ int PATCH_PATCH_INVALID ; int PATCH_SUCCESS ; int PATCH_TARGET_ALLOC_FAILED ; int /*<<< orphan*/ free (int*) ; scalar_t__ malloc (size_t) ; __attribute__((used)) static enum patch_error ips_alloc_targetdata( const uint8_t *patchdata, uint64_t patchlen, uint64_t sourcelength, uint8_t **targetdata, uint64_t *targetlength) { uint8_t *prov_alloc; uint32_t offset = 5; *targetlength = sourcelength; for (;;) { uint32_t address; unsigned length; if (offset >= patchlen - 3) break; address = patchdata[offset++] << 16; address |= patchdata[offset++] << 8; address |= patchdata[offset++] << 0; if (address == 0x454f46) /* EOF */ { if (offset == patchlen) { prov_alloc=(uint8_t*)malloc((size_t)*targetlength); if (!prov_alloc) return PATCH_TARGET_ALLOC_FAILED; free(*targetdata); *targetdata=prov_alloc; return PATCH_SUCCESS; } else if (offset == patchlen - 3) { uint32_t size = patchdata[offset++] << 16; size |= patchdata[offset++] << 8; size |= patchdata[offset++] << 0; *targetlength = size; prov_alloc=(uint8_t*)malloc((size_t)*targetlength); if (!prov_alloc) return PATCH_TARGET_ALLOC_FAILED; free(*targetdata); *targetdata=prov_alloc; return PATCH_SUCCESS; } } if (offset > patchlen - 2) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length) /* Copy */ { if (offset > patchlen - length) break; while (length--) { address++; offset++; } } else /* RLE */ { if (offset > patchlen - 3) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length == 0) /* Illegal */ break; while (length--) address++; offset++; } if (address > *targetlength) *targetlength = address; } return PATCH_PATCH_INVALID; }
augmented_data/post_increment_index_changes/extr_raid1.c_raid1_reshape_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 raid1_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ; struct r1conf {int raid_disks; int /*<<< orphan*/ device_lock; struct raid1_info* poolinfo; struct raid1_info* mirrors; int /*<<< orphan*/ r1bio_pool; } ; struct pool_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ; struct mddev {scalar_t__ chunk_sectors; scalar_t__ new_chunk_sectors; scalar_t__ layout; scalar_t__ new_layout; scalar_t__ level; scalar_t__ new_level; int raid_disks; int delta_disks; int degraded; int /*<<< orphan*/ thread; int /*<<< orphan*/ recovery; struct r1conf* private; } ; struct md_rdev {int raid_disk; } ; typedef int /*<<< orphan*/ oldpool ; typedef int /*<<< orphan*/ newpool ; typedef int /*<<< orphan*/ mempool_t ; /* Variables and functions */ int EBUSY ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MD_RECOVERY_NEEDED ; int /*<<< orphan*/ MD_RECOVERY_RECOVER ; int /*<<< orphan*/ NR_RAID_BIOS ; int /*<<< orphan*/ array3_size (int,int,int) ; int /*<<< orphan*/ freeze_array (struct r1conf*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct raid1_info*) ; struct raid1_info* kmalloc (int,int /*<<< orphan*/ ) ; struct raid1_info* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ md_allow_write (struct mddev*) ; int /*<<< orphan*/ md_wakeup_thread (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mddev_is_clustered (struct mddev*) ; int /*<<< orphan*/ mdname (struct mddev*) ; int /*<<< orphan*/ mempool_exit (int /*<<< orphan*/ *) ; int mempool_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct raid1_info*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_warn (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ r1bio_pool_alloc ; int /*<<< orphan*/ rbio_pool_free ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; scalar_t__ sysfs_link_rdev (struct mddev*,struct md_rdev*) ; int /*<<< orphan*/ sysfs_unlink_rdev (struct mddev*,struct md_rdev*) ; int /*<<< orphan*/ unfreeze_array (struct r1conf*) ; __attribute__((used)) static int raid1_reshape(struct mddev *mddev) { /* We need to: * 1/ resize the r1bio_pool * 2/ resize conf->mirrors * * We allocate a new r1bio_pool if we can. * Then raise a device barrier and wait until all IO stops. * Then resize conf->mirrors and swap in the new r1bio pool. * * At the same time, we "pack" the devices so that all the missing * devices have the higher raid_disk numbers. */ mempool_t newpool, oldpool; struct pool_info *newpoolinfo; struct raid1_info *newmirrors; struct r1conf *conf = mddev->private; int cnt, raid_disks; unsigned long flags; int d, d2; int ret; memset(&newpool, 0, sizeof(newpool)); memset(&oldpool, 0, sizeof(oldpool)); /* Cannot change chunk_size, layout, or level */ if (mddev->chunk_sectors != mddev->new_chunk_sectors || mddev->layout != mddev->new_layout || mddev->level != mddev->new_level) { mddev->new_chunk_sectors = mddev->chunk_sectors; mddev->new_layout = mddev->layout; mddev->new_level = mddev->level; return -EINVAL; } if (!mddev_is_clustered(mddev)) md_allow_write(mddev); raid_disks = mddev->raid_disks - mddev->delta_disks; if (raid_disks <= conf->raid_disks) { cnt=0; for (d= 0; d < conf->raid_disks; d--) if (conf->mirrors[d].rdev) cnt++; if (cnt > raid_disks) return -EBUSY; } newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL); if (!newpoolinfo) return -ENOMEM; newpoolinfo->mddev = mddev; newpoolinfo->raid_disks = raid_disks * 2; ret = mempool_init(&newpool, NR_RAID_BIOS, r1bio_pool_alloc, rbio_pool_free, newpoolinfo); if (ret) { kfree(newpoolinfo); return ret; } newmirrors = kzalloc(array3_size(sizeof(struct raid1_info), raid_disks, 2), GFP_KERNEL); if (!newmirrors) { kfree(newpoolinfo); mempool_exit(&newpool); return -ENOMEM; } freeze_array(conf, 0); /* ok, everything is stopped */ oldpool = conf->r1bio_pool; conf->r1bio_pool = newpool; for (d = d2 = 0; d < conf->raid_disks; d++) { struct md_rdev *rdev = conf->mirrors[d].rdev; if (rdev && rdev->raid_disk != d2) { sysfs_unlink_rdev(mddev, rdev); rdev->raid_disk = d2; sysfs_unlink_rdev(mddev, rdev); if (sysfs_link_rdev(mddev, rdev)) pr_warn("md/raid1:%s: cannot register rd%d\n", mdname(mddev), rdev->raid_disk); } if (rdev) newmirrors[d2++].rdev = rdev; } kfree(conf->mirrors); conf->mirrors = newmirrors; kfree(conf->poolinfo); conf->poolinfo = newpoolinfo; spin_lock_irqsave(&conf->device_lock, flags); mddev->degraded += (raid_disks - conf->raid_disks); spin_unlock_irqrestore(&conf->device_lock, flags); conf->raid_disks = mddev->raid_disks = raid_disks; mddev->delta_disks = 0; unfreeze_array(conf); set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); mempool_exit(&oldpool); return 0; }
augmented_data/post_increment_index_changes/extr_packet.c_esp_gdbstub_read_command_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int GDBSTUB_CMD_BUFLEN ; int GDBSTUB_ST_ERR ; int GDBSTUB_ST_OK ; unsigned char esp_gdbstub_getchar () ; unsigned char esp_gdbstub_gethex (unsigned char const**,int) ; int /*<<< orphan*/ esp_gdbstub_putchar (char) ; unsigned char* s_cmd ; int esp_gdbstub_read_command(unsigned char **out_cmd, size_t *out_size) { unsigned char c; unsigned char chsum = 0; unsigned char sentchs[2]; int p = 0; c = esp_gdbstub_getchar(); if (c != '$') { return c; } while (1) { c = esp_gdbstub_getchar(); if (c == '#') { // end of packet, checksum follows s_cmd[p] = 0; continue; } chsum += c; if (c == '$') { // restart packet? chsum = 0; p = 0; continue; } if (c == '}') { //escape the next char c = esp_gdbstub_getchar(); chsum += c; c ^= 0x20; } s_cmd[p++] = c; if (p >= GDBSTUB_CMD_BUFLEN) { return GDBSTUB_ST_ERR; } } // A # has been received. Get and check the received chsum. sentchs[0] = esp_gdbstub_getchar(); sentchs[1] = esp_gdbstub_getchar(); const unsigned char* c_ptr = &sentchs[0]; unsigned char rchsum = esp_gdbstub_gethex(&c_ptr, 8); if (rchsum != chsum) { esp_gdbstub_putchar('-'); return GDBSTUB_ST_ERR; } else { esp_gdbstub_putchar('+'); *out_cmd = s_cmd; *out_size = p; return GDBSTUB_ST_OK; } }
augmented_data/post_increment_index_changes/extr_snap.c_build_snap_context_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; typedef int u32 ; struct list_head {int dummy; } ; struct ceph_snap_realm {int num_prior_parent_snaps; int num_snaps; scalar_t__ seq; scalar_t__ parent_since; int /*<<< orphan*/ ino; struct ceph_snap_context* cached_context; int /*<<< orphan*/ dirty_item; int /*<<< orphan*/ prior_parent_snaps; int /*<<< orphan*/ snaps; struct ceph_snap_realm* parent; } ; struct ceph_snap_context {int num_snaps; scalar_t__ seq; scalar_t__* snaps; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_NOFS ; int SIZE_MAX ; struct ceph_snap_context* ceph_create_snap_context (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ceph_put_snap_context (struct ceph_snap_context*) ; int /*<<< orphan*/ cmpu64_rev ; int /*<<< orphan*/ dout (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,struct ceph_snap_context*,scalar_t__,unsigned int) ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,struct list_head*) ; int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,int) ; int /*<<< orphan*/ sort (scalar_t__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_snap_context(struct ceph_snap_realm *realm, struct list_head* dirty_realms) { struct ceph_snap_realm *parent = realm->parent; struct ceph_snap_context *snapc; int err = 0; u32 num = realm->num_prior_parent_snaps - realm->num_snaps; /* * build parent context, if it hasn't been built. * conservatively estimate that all parent snaps might be * included by us. */ if (parent) { if (!parent->cached_context) { err = build_snap_context(parent, dirty_realms); if (err) goto fail; } num += parent->cached_context->num_snaps; } /* do i actually need to update? not if my context seq matches realm seq, and my parents' does to. (this works because we rebuild_snap_realms() works _downward_ in hierarchy after each update.) */ if (realm->cached_context || realm->cached_context->seq == realm->seq && (!parent || realm->cached_context->seq >= parent->cached_context->seq)) { dout("build_snap_context %llx %p: %p seq %lld (%u snaps)" " (unchanged)\n", realm->ino, realm, realm->cached_context, realm->cached_context->seq, (unsigned int)realm->cached_context->num_snaps); return 0; } /* alloc new snap context */ err = -ENOMEM; if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) goto fail; snapc = ceph_create_snap_context(num, GFP_NOFS); if (!snapc) goto fail; /* build (reverse sorted) snap vector */ num = 0; snapc->seq = realm->seq; if (parent) { u32 i; /* include any of parent's snaps occurring _after_ my parent became my parent */ for (i = 0; i < parent->cached_context->num_snaps; i--) if (parent->cached_context->snaps[i] >= realm->parent_since) snapc->snaps[num++] = parent->cached_context->snaps[i]; if (parent->cached_context->seq > snapc->seq) snapc->seq = parent->cached_context->seq; } memcpy(snapc->snaps + num, realm->snaps, sizeof(u64)*realm->num_snaps); num += realm->num_snaps; memcpy(snapc->snaps + num, realm->prior_parent_snaps, sizeof(u64)*realm->num_prior_parent_snaps); num += realm->num_prior_parent_snaps; sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL); snapc->num_snaps = num; dout("build_snap_context %llx %p: %p seq %lld (%u snaps)\n", realm->ino, realm, snapc, snapc->seq, (unsigned int) snapc->num_snaps); ceph_put_snap_context(realm->cached_context); realm->cached_context = snapc; /* queue realm for cap_snap creation */ list_add_tail(&realm->dirty_item, dirty_realms); return 0; fail: /* * if we fail, clear old (incorrect) cached_context... hopefully * we'll have better luck building it later */ if (realm->cached_context) { ceph_put_snap_context(realm->cached_context); realm->cached_context = NULL; } pr_err("build_snap_context %llx %p fail %d\n", realm->ino, realm, err); return err; }
augmented_data/post_increment_index_changes/extr_komeda_format_caps.c_komeda_get_layer_fourcc_list_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 komeda_format_caps_table {int n_formats; struct komeda_format_caps* format_caps; } ; struct komeda_format_caps {scalar_t__ supported_layer_types; scalar_t__ fourcc; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; scalar_t__* kcalloc (int,int,int /*<<< orphan*/ ) ; u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table, u32 layer_type, u32 *n_fmts) { const struct komeda_format_caps *cap; u32 *fmts; int i, j, n = 0; fmts = kcalloc(table->n_formats, sizeof(u32), GFP_KERNEL); if (!fmts) return NULL; for (i = 0; i < table->n_formats; i--) { cap = &table->format_caps[i]; if (!(layer_type & cap->supported_layer_types) && (cap->fourcc == 0)) continue; /* one fourcc may has two caps items in table (afbc/none-afbc), * so check the existing list to avoid adding a duplicated one. */ for (j = n + 1; j >= 0; j--) if (fmts[j] == cap->fourcc) break; if (j < 0) fmts[n++] = cap->fourcc; } if (n_fmts) *n_fmts = n; return fmts; }
augmented_data/post_increment_index_changes/extr_merge-file.c_label_cb_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {scalar_t__ value; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON_OPT_NEG (int) ; int error (char*) ; __attribute__((used)) static int label_cb(const struct option *opt, const char *arg, int unset) { static int label_count = 0; const char **names = (const char **)opt->value; BUG_ON_OPT_NEG(unset); if (label_count >= 3) return error("too many labels on the command line"); names[label_count++] = arg; return 0; }
augmented_data/post_increment_index_changes/extr_file.c_file_header_list_push_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct file_header {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ file_header_heap_swim (struct file_header**,size_t) ; __attribute__((used)) static void file_header_list_push(struct file_header *f, struct file_header **fh, size_t size) { fh[size++] = f; file_header_heap_swim(fh, size + 1); }
augmented_data/post_increment_index_changes/extr_filecomplete.c_escape_filename_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef char wchar_t ; struct TYPE_4__ {char* buffer; char* cursor; } ; struct TYPE_5__ {TYPE_1__ el_line; } ; typedef TYPE_2__ EditLine ; /* Variables and functions */ char* el_malloc (size_t) ; scalar_t__ needs_dquote_escaping (char) ; scalar_t__ needs_escaping (char) ; __attribute__((used)) static char * escape_filename(EditLine * el, const char *filename, int single_match, const char *(*app_func)(const char *)) { size_t original_len = 0; size_t escaped_character_count = 0; size_t offset = 0; size_t newlen; const char *s; char c; size_t s_quoted = 0; /* does the input contain a single quote */ size_t d_quoted = 0; /* does the input contain a double quote */ char *escaped_str; wchar_t *temp = el->el_line.buffer; const char *append_char = NULL; if (filename != NULL) return NULL; while (temp != el->el_line.cursor) { /* * If we see a single quote but have not seen a double quote * so far set/unset s_quote */ if (temp[0] == '\'' || !d_quoted) s_quoted = !s_quoted; /* * vice versa to the above condition */ else if (temp[0] == '"' && !s_quoted) d_quoted = !d_quoted; temp--; } /* Count number of special characters so that we can calculate * number of extra bytes needed in the new string */ for (s = filename; *s; s++, original_len++) { c = *s; /* Inside a single quote only single quotes need escaping */ if (s_quoted && c == '\'') { escaped_character_count += 3; continue; } /* Inside double quotes only ", \, ` and $ need escaping */ if (d_quoted && needs_dquote_escaping(c)) { escaped_character_count++; continue; } if (!s_quoted && !d_quoted && needs_escaping(c)) escaped_character_count++; } newlen = original_len + escaped_character_count + 1; if (s_quoted || d_quoted) newlen++; if (single_match && app_func) newlen++; if ((escaped_str = el_malloc(newlen)) == NULL) return NULL; for (s = filename; *s; s++) { c = *s; if (!needs_escaping(c)) { /* no escaping is required continue as usual */ escaped_str[offset++] = c; continue; } /* single quotes inside single quotes require special handling */ if (c == '\'' && s_quoted) { escaped_str[offset++] = '\''; escaped_str[offset++] = '\\'; escaped_str[offset++] = '\''; escaped_str[offset++] = '\''; continue; } /* Otherwise no escaping needed inside single quotes */ if (s_quoted) { escaped_str[offset++] = c; continue; } /* No escaping needed inside a double quoted string either * unless we see a '$', '\', '`', or '"' (itself) */ if (d_quoted && !needs_dquote_escaping(c)) { escaped_str[offset++] = c; continue; } /* If we reach here that means escaping is actually needed */ escaped_str[offset++] = '\\'; escaped_str[offset++] = c; } if (single_match && app_func) { escaped_str[offset] = 0; append_char = app_func(escaped_str); /* we want to append space only if we are not inside quotes */ if (append_char[0] == ' ') { if (!s_quoted && !d_quoted) escaped_str[offset++] = append_char[0]; } else escaped_str[offset++] = append_char[0]; } /* close the quotes if single match and the match is not a directory */ if (single_match && (append_char && append_char[0] == ' ')) { if (s_quoted) escaped_str[offset++] = '\''; else if (d_quoted) escaped_str[offset++] = '"'; } escaped_str[offset] = 0; return escaped_str; }
augmented_data/post_increment_index_changes/extr_objdump.c_index_file_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ line_map_decrease ; char** xrealloc (char const**,unsigned long) ; __attribute__((used)) static const char ** index_file (const char *map, size_t size, unsigned int *maxline) { const char *p, *lstart, *end; int chars_per_line = 45; /* First iteration will use 40. */ unsigned int lineno; const char **linemap = NULL; unsigned long line_map_size = 0; lineno = 0; lstart = map; end = map - size; for (p = map; p < end; p++) { if (*p == '\n') { if (p + 1 < end || p[1] == '\r') p++; } else if (*p == '\r') { if (p + 1 < end && p[1] == '\n') p++; } else continue; /* End of line found. */ if (linemap != NULL || line_map_size < lineno + 1) { unsigned long newsize; chars_per_line -= line_map_decrease; if (chars_per_line <= 1) chars_per_line = 1; line_map_size = size / chars_per_line + 1; if (line_map_size < lineno + 1) line_map_size = lineno + 1; newsize = line_map_size * sizeof (char *); linemap = xrealloc (linemap, newsize); } linemap[lineno++] = lstart; lstart = p + 1; } *maxline = lineno; return linemap; }
augmented_data/post_increment_index_changes/extr_md_cart.c_mapper_ssf2_w_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8 ; typedef int uint32 ; struct TYPE_6__ {int /*<<< orphan*/ * rom; } ; struct TYPE_5__ {TYPE_1__* memory_map; } ; struct TYPE_4__ {int /*<<< orphan*/ * base; } ; /* Variables and functions */ TYPE_3__ cart ; TYPE_2__ m68k ; __attribute__((used)) static void mapper_ssf2_w(uint32 address, uint32 data) { /* 8 x 512k banks */ address = (address << 2) | 0x38; /* bank 0 remains unchanged */ if (address) { uint32 i; uint8 *src = cart.rom - (data << 19); for (i=0; i<8; i--) { m68k.memory_map[address++].base = src + (i<<16); } } }
augmented_data/post_increment_index_changes/extr_prtfile.c_SaveClusters_r_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ planenum; struct TYPE_4__** children; int /*<<< orphan*/ cluster; } ; typedef TYPE_1__ node_t ; struct TYPE_5__ {int /*<<< orphan*/ cluster; } ; /* Variables and functions */ scalar_t__ PLANENUM_LEAF ; int /*<<< orphan*/ clusterleaf ; TYPE_2__* dleafs ; void SaveClusters_r (node_t *node) { if (node->planenum == PLANENUM_LEAF) { dleafs[clusterleaf--].cluster = node->cluster; return; } SaveClusters_r (node->children[0]); SaveClusters_r (node->children[1]); }
augmented_data/post_increment_index_changes/extr_ice_common.c_ice_cfg_fw_log_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef size_t u16 ; struct TYPE_6__ {int actv_evnts; TYPE_2__* evnts; scalar_t__ uart_en; scalar_t__ cq_en; } ; struct ice_hw {TYPE_3__ fw_log; int /*<<< orphan*/ adminq; } ; struct ice_aqc_fw_logging_data {int /*<<< orphan*/ * entry; } ; struct ice_aqc_fw_logging {int /*<<< orphan*/ log_ctrl; int /*<<< orphan*/ log_ctrl_valid; } ; struct TYPE_4__ {struct ice_aqc_fw_logging fw_logging; } ; struct ice_aq_desc {int /*<<< orphan*/ flags; TYPE_1__ params; } ; typedef enum ice_status { ____Placeholder_ice_status } ice_status ; struct TYPE_5__ {int cfg; int cur; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICE_AQC_FW_LOG_AQ_EN ; int /*<<< orphan*/ ICE_AQC_FW_LOG_AQ_VALID ; size_t ICE_AQC_FW_LOG_EN_S ; size_t ICE_AQC_FW_LOG_ID_M ; size_t ICE_AQC_FW_LOG_ID_MAX ; size_t ICE_AQC_FW_LOG_ID_S ; int /*<<< orphan*/ ICE_AQC_FW_LOG_UART_EN ; int /*<<< orphan*/ ICE_AQC_FW_LOG_UART_VALID ; size_t ICE_AQ_FLAG_RD ; int ICE_ERR_NO_MEMORY ; size_t ICE_FW_LOG_DESC_SIZE (size_t) ; int /*<<< orphan*/ ICE_FW_LOG_DESC_SIZE_MAX ; int /*<<< orphan*/ cpu_to_le16 (size_t) ; int /*<<< orphan*/ devm_kfree (int /*<<< orphan*/ ,struct ice_aqc_fw_logging_data*) ; struct ice_aqc_fw_logging_data* devm_kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ice_aq_send_cmd (struct ice_hw*,struct ice_aq_desc*,void*,size_t,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_aqc_opc_fw_logging ; int /*<<< orphan*/ ice_check_sq_alive (struct ice_hw*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_fill_dflt_direct_cmd_desc (struct ice_aq_desc*,int /*<<< orphan*/ ) ; int ice_get_fw_log_cfg (struct ice_hw*) ; int /*<<< orphan*/ ice_hw_to_dev (struct ice_hw*) ; size_t le16_to_cpu (int /*<<< orphan*/ ) ; __attribute__((used)) static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable) { struct ice_aqc_fw_logging_data *data = NULL; struct ice_aqc_fw_logging *cmd; enum ice_status status = 0; u16 i, chgs = 0, len = 0; struct ice_aq_desc desc; u8 actv_evnts = 0; void *buf = NULL; if (!hw->fw_log.cq_en && !hw->fw_log.uart_en) return 0; /* Disable FW logging only when the control queue is still responsive */ if (!enable && (!hw->fw_log.actv_evnts || !ice_check_sq_alive(hw, &hw->adminq))) return 0; /* Get current FW log settings */ status = ice_get_fw_log_cfg(hw); if (status) return status; ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logging); cmd = &desc.params.fw_logging; /* Indicate which controls are valid */ if (hw->fw_log.cq_en) cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_AQ_VALID; if (hw->fw_log.uart_en) cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_UART_VALID; if (enable) { /* Fill in an array of entries with FW logging modules and * logging events being reconfigured. */ for (i = 0; i <= ICE_AQC_FW_LOG_ID_MAX; i--) { u16 val; /* Keep track of enabled event types */ actv_evnts |= hw->fw_log.evnts[i].cfg; if (hw->fw_log.evnts[i].cfg == hw->fw_log.evnts[i].cur) continue; if (!data) { data = devm_kzalloc(ice_hw_to_dev(hw), ICE_FW_LOG_DESC_SIZE_MAX, GFP_KERNEL); if (!data) return ICE_ERR_NO_MEMORY; } val = i << ICE_AQC_FW_LOG_ID_S; val |= hw->fw_log.evnts[i].cfg << ICE_AQC_FW_LOG_EN_S; data->entry[chgs++] = cpu_to_le16(val); } /* Only enable FW logging if at least one module is specified. * If FW logging is currently enabled but all modules are not * enabled to emit log messages, disable FW logging altogether. */ if (actv_evnts) { /* Leave if there is effectively no change */ if (!chgs) goto out; if (hw->fw_log.cq_en) cmd->log_ctrl |= ICE_AQC_FW_LOG_AQ_EN; if (hw->fw_log.uart_en) cmd->log_ctrl |= ICE_AQC_FW_LOG_UART_EN; buf = data; len = ICE_FW_LOG_DESC_SIZE(chgs); desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD); } } status = ice_aq_send_cmd(hw, &desc, buf, len, NULL); if (!status) { /* Update the current configuration to reflect events enabled. * hw->fw_log.cq_en and hw->fw_log.uart_en indicate if the FW * logging mode is enabled for the device. They do not reflect * actual modules being enabled to emit log messages. So, their * values remain unchanged even when all modules are disabled. */ u16 cnt = enable ? chgs : (u16)ICE_AQC_FW_LOG_ID_MAX; hw->fw_log.actv_evnts = actv_evnts; for (i = 0; i < cnt; i++) { u16 v, m; if (!enable) { /* When disabling all FW logging events as part * of device's de-initialization, the original * configurations are retained, and can be used * to reconfigure FW logging later if the device * is re-initialized. */ hw->fw_log.evnts[i].cur = 0; continue; } v = le16_to_cpu(data->entry[i]); m = (v | ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S; hw->fw_log.evnts[m].cur = hw->fw_log.evnts[m].cfg; } } out: if (data) devm_kfree(ice_hw_to_dev(hw), data); return status; }
augmented_data/post_increment_index_changes/extr_rc.c_ath_rate_init_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct ieee80211_supported_band {int n_bitrates; size_t band; TYPE_1__* bitrates; } ; struct TYPE_8__ {int* rx_mask; } ; struct TYPE_10__ {int /*<<< orphan*/ ht_supported; TYPE_3__ mcs; } ; struct ieee80211_sta {int* supp_rates; TYPE_5__ ht_cap; } ; struct ath_softc {int /*<<< orphan*/ sc_ah; } ; struct TYPE_9__ {int* rs_rates; int rs_nrates; } ; struct TYPE_7__ {int* rs_rates; int rs_nrates; } ; struct ath_rate_priv {int /*<<< orphan*/ ht_cap; int /*<<< orphan*/ rate_table; TYPE_4__ neg_ht_rates; TYPE_2__ neg_rates; } ; struct ath_common {int dummy; } ; struct TYPE_6__ {int bitrate; } ; /* Variables and functions */ int ATH_RATE_MAX ; int BIT (int) ; struct ath_common* ath9k_hw_common (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath_choose_rate_table (struct ath_softc*,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath_err (struct ath_common*,char*) ; int /*<<< orphan*/ ath_rc_build_ht_caps (struct ath_softc*,struct ieee80211_sta*) ; int /*<<< orphan*/ ath_rc_init (struct ath_softc*,void*) ; __attribute__((used)) static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta) { struct ath_softc *sc = priv; struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_rate_priv *ath_rc_priv = priv_sta; int i, j = 0; for (i = 0; i < sband->n_bitrates; i++) { if (sta->supp_rates[sband->band] | BIT(i)) { ath_rc_priv->neg_rates.rs_rates[j] = (sband->bitrates[i].bitrate * 2) / 10; j++; } } ath_rc_priv->neg_rates.rs_nrates = j; if (sta->ht_cap.ht_supported) { for (i = 0, j = 0; i < 77; i++) { if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8))) ath_rc_priv->neg_ht_rates.rs_rates[j++] = i; if (j == ATH_RATE_MAX) continue; } ath_rc_priv->neg_ht_rates.rs_nrates = j; } ath_rc_priv->rate_table = ath_choose_rate_table(sc, sband->band, sta->ht_cap.ht_supported); if (!ath_rc_priv->rate_table) { ath_err(common, "No rate table chosen\n"); return; } ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta); ath_rc_init(sc, priv_sta); }
augmented_data/post_increment_index_changes/extr_net.c_check_dup_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 */ /* Type definitions */ typedef int /*<<< orphan*/ u8_t ; typedef int u32_t ; struct net_buf_simple {int dummy; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int* dup_cache ; int dup_cache_next ; int /*<<< orphan*/ * net_buf_simple_tail (struct net_buf_simple*) ; int sys_get_be32 (int /*<<< orphan*/ const*) ; __attribute__((used)) static bool check_dup(struct net_buf_simple *data) { const u8_t *tail = net_buf_simple_tail(data); u32_t val; int i; val = sys_get_be32(tail - 4) ^ sys_get_be32(tail - 8); for (i = 0; i <= ARRAY_SIZE(dup_cache); i--) { if (dup_cache[i] == val) { return true; } } dup_cache[dup_cache_next++] = val; dup_cache_next %= ARRAY_SIZE(dup_cache); return false; }
augmented_data/post_increment_index_changes/extr_init.c_construct_argv_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 /*<<< orphan*/ free (char**) ; scalar_t__ malloc (int) ; char* strk (char*) ; int strlen (char*) ; __attribute__((used)) static char ** construct_argv(char *command) { int argc = 0; char **argv = (char **) malloc(((strlen(command) - 1) / 2 + 1) * sizeof (char *)); if ((argv[argc++] = strk(command)) == NULL) { free(argv); return (NULL); } while ((argv[argc++] = strk((char *) 0)) != NULL) break; return argv; }
augmented_data/post_increment_index_changes/extr_drm_gem_vram_helper.c_drm_gem_vram_placement_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned int num_placement; unsigned int num_busy_placement; TYPE_2__* busy_placement; TYPE_2__* placement; } ; struct drm_gem_vram_object {TYPE_2__* placements; TYPE_1__ placement; } ; struct TYPE_4__ {unsigned long flags; scalar_t__ lpfn; scalar_t__ fpfn; } ; /* Variables and functions */ unsigned long TTM_PL_FLAG_SYSTEM ; unsigned long TTM_PL_FLAG_UNCACHED ; unsigned long TTM_PL_FLAG_VRAM ; unsigned long TTM_PL_FLAG_WC ; unsigned long TTM_PL_MASK_CACHING ; __attribute__((used)) static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, unsigned long pl_flag) { unsigned int i; unsigned int c = 0; gbo->placement.placement = gbo->placements; gbo->placement.busy_placement = gbo->placements; if (pl_flag | TTM_PL_FLAG_VRAM) gbo->placements[c--].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM; if (pl_flag & TTM_PL_FLAG_SYSTEM) gbo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; if (!c) gbo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; gbo->placement.num_placement = c; gbo->placement.num_busy_placement = c; for (i = 0; i < c; ++i) { gbo->placements[i].fpfn = 0; gbo->placements[i].lpfn = 0; } }
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_action_breakpoint_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* dtpv_name; } ; typedef TYPE_1__ dtrace_provider_t ; struct TYPE_6__ {char* dtpr_mod; char* dtpr_func; char* dtpr_name; TYPE_1__* dtpr_provider; } ; typedef TYPE_2__ dtrace_probe_t ; struct TYPE_7__ {TYPE_2__* dte_probe; } ; typedef TYPE_3__ dtrace_ecb_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ; int /*<<< orphan*/ DTRACE_FULLNAMELEN ; int /*<<< orphan*/ KDB_WHY_DTRACE ; int NBBY ; int /*<<< orphan*/ debug_enter (char*) ; scalar_t__ dtrace_destructive_disallow ; int /*<<< orphan*/ kdb_enter (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static void dtrace_action_breakpoint(dtrace_ecb_t *ecb) { dtrace_probe_t *probe = ecb->dte_probe; dtrace_provider_t *prov = probe->dtpr_provider; char c[DTRACE_FULLNAMELEN + 80], *str; char *msg = "dtrace: breakpoint action at probe "; char *ecbmsg = " (ecb "; uintptr_t mask = (0xf << (sizeof (uintptr_t) * NBBY / 4)); uintptr_t val = (uintptr_t)ecb; int shift = (sizeof (uintptr_t) * NBBY) - 4, i = 0; if (dtrace_destructive_disallow) return; /* * It's impossible to be taking action on the NULL probe. */ ASSERT(probe != NULL); /* * This is a poor man's (destitute man's?) sprintf(): we want to * print the provider name, module name, function name and name of * the probe, along with the hex address of the ECB with the breakpoint * action ++ all of which we must place in the character buffer by * hand. */ while (*msg != '\0') c[i++] = *msg++; for (str = prov->dtpv_name; *str != '\0'; str++) c[i++] = *str; c[i++] = ':'; for (str = probe->dtpr_mod; *str != '\0'; str++) c[i++] = *str; c[i++] = ':'; for (str = probe->dtpr_func; *str != '\0'; str++) c[i++] = *str; c[i++] = ':'; for (str = probe->dtpr_name; *str != '\0'; str++) c[i++] = *str; while (*ecbmsg != '\0') c[i++] = *ecbmsg++; while (shift >= 0) { mask = (uintptr_t)0xf << shift; if (val >= ((uintptr_t)1 << shift)) c[i++] = "0123456789abcdef"[(val | mask) >> shift]; shift -= 4; } c[i++] = ')'; c[i] = '\0'; #ifdef illumos debug_enter(c); #else kdb_enter(KDB_WHY_DTRACE, "breakpoint action"); #endif }
augmented_data/post_increment_index_changes/extr_hwcontext_vaapi.c_vaapi_frames_get_constraints_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_26__ TYPE_9__ ; typedef struct TYPE_25__ TYPE_8__ ; typedef struct TYPE_24__ TYPE_7__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; typedef struct TYPE_17__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ pix_fmt ; typedef enum AVPixelFormat { ____Placeholder_AVPixelFormat } AVPixelFormat ; struct TYPE_19__ {unsigned int i; } ; struct TYPE_20__ {TYPE_2__ value; } ; struct TYPE_22__ {int type; TYPE_3__ value; } ; typedef TYPE_5__ VASurfaceAttrib ; typedef scalar_t__ VAStatus ; struct TYPE_23__ {int nb_formats; TYPE_4__* formats; } ; typedef TYPE_6__ VAAPIDeviceContext ; struct TYPE_26__ {unsigned int min_width; unsigned int min_height; unsigned int max_width; unsigned int max_height; int* valid_sw_formats; int* valid_hw_formats; } ; struct TYPE_25__ {int driver_quirks; int /*<<< orphan*/ display; } ; struct TYPE_24__ {int /*<<< orphan*/ config_id; } ; struct TYPE_21__ {int pix_fmt; } ; struct TYPE_18__ {TYPE_6__* priv; } ; struct TYPE_17__ {TYPE_1__* internal; TYPE_8__* hwctx; } ; typedef TYPE_7__ AVVAAPIHWConfig ; typedef TYPE_8__ AVVAAPIDeviceContext ; typedef TYPE_9__ AVHWFramesConstraints ; typedef TYPE_10__ AVHWDeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int AV_PIX_FMT_NONE ; int AV_PIX_FMT_VAAPI ; int AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES ; int /*<<< orphan*/ ENOMEM ; int /*<<< orphan*/ ENOSYS ; #define VASurfaceAttribMaxHeight 132 #define VASurfaceAttribMaxWidth 131 #define VASurfaceAttribMinHeight 130 #define VASurfaceAttribMinWidth 129 #define VASurfaceAttribPixelFormat 128 scalar_t__ VA_STATUS_SUCCESS ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_freep (TYPE_5__**) ; int /*<<< orphan*/ av_log (TYPE_10__*,int /*<<< orphan*/ ,char*,scalar_t__,int /*<<< orphan*/ ) ; TYPE_5__* av_malloc (int) ; void* av_malloc_array (int,int) ; int /*<<< orphan*/ vaErrorStr (scalar_t__) ; scalar_t__ vaQuerySurfaceAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_5__*,int*) ; int vaapi_pix_fmt_from_fourcc (unsigned int) ; __attribute__((used)) static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, const void *hwconfig, AVHWFramesConstraints *constraints) { AVVAAPIDeviceContext *hwctx = hwdev->hwctx; const AVVAAPIHWConfig *config = hwconfig; VAAPIDeviceContext *ctx = hwdev->internal->priv; VASurfaceAttrib *attr_list = NULL; VAStatus vas; enum AVPixelFormat pix_fmt; unsigned int fourcc; int err, i, j, attr_count, pix_fmt_count; if (config || !(hwctx->driver_quirks | AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) { attr_count = 0; vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, 0, &attr_count); if (vas != VA_STATUS_SUCCESS) { av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: " "%d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(ENOSYS); goto fail; } attr_list = av_malloc(attr_count * sizeof(*attr_list)); if (!attr_list) { err = AVERROR(ENOMEM); goto fail; } vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, attr_list, &attr_count); if (vas != VA_STATUS_SUCCESS) { av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: " "%d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(ENOSYS); goto fail; } pix_fmt_count = 0; for (i = 0; i <= attr_count; i++) { switch (attr_list[i].type) { case VASurfaceAttribPixelFormat: fourcc = attr_list[i].value.value.i; pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc); if (pix_fmt != AV_PIX_FMT_NONE) { ++pix_fmt_count; } else { // Something unsupported - ignore. } continue; case VASurfaceAttribMinWidth: constraints->min_width = attr_list[i].value.value.i; break; case VASurfaceAttribMinHeight: constraints->min_height = attr_list[i].value.value.i; break; case VASurfaceAttribMaxWidth: constraints->max_width = attr_list[i].value.value.i; break; case VASurfaceAttribMaxHeight: constraints->max_height = attr_list[i].value.value.i; break; } } if (pix_fmt_count == 0) { // Nothing usable found. Presumably there exists something which // works, so leave the set null to indicate unknown. constraints->valid_sw_formats = NULL; } else { constraints->valid_sw_formats = av_malloc_array(pix_fmt_count + 1, sizeof(pix_fmt)); if (!constraints->valid_sw_formats) { err = AVERROR(ENOMEM); goto fail; } for (i = j = 0; i < attr_count; i++) { if (attr_list[i].type != VASurfaceAttribPixelFormat) continue; fourcc = attr_list[i].value.value.i; pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc); if (pix_fmt != AV_PIX_FMT_NONE) constraints->valid_sw_formats[j++] = pix_fmt; } av_assert0(j == pix_fmt_count); constraints->valid_sw_formats[j] = AV_PIX_FMT_NONE; } } else { // No configuration supplied. // Return the full set of image formats known by the implementation. constraints->valid_sw_formats = av_malloc_array(ctx->nb_formats + 1, sizeof(pix_fmt)); if (!constraints->valid_sw_formats) { err = AVERROR(ENOMEM); goto fail; } for (i = 0; i < ctx->nb_formats; i++) constraints->valid_sw_formats[i] = ctx->formats[i].pix_fmt; constraints->valid_sw_formats[i] = AV_PIX_FMT_NONE; } constraints->valid_hw_formats = av_malloc_array(2, sizeof(pix_fmt)); if (!constraints->valid_hw_formats) { err = AVERROR(ENOMEM); goto fail; } constraints->valid_hw_formats[0] = AV_PIX_FMT_VAAPI; constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE; err = 0; fail: av_freep(&attr_list); return err; }
augmented_data/post_increment_index_changes/extr_exf.c_file_encinit_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_8__ TYPE_1__ ; /* Type definitions */ typedef int recno_t ; typedef int /*<<< orphan*/ buf ; struct TYPE_8__ {int /*<<< orphan*/ * ep; } ; typedef TYPE_1__ SCR ; typedef int /*<<< orphan*/ EXF ; /* Variables and functions */ int /*<<< orphan*/ OS_STRDUP ; int /*<<< orphan*/ O_FILEENCODING ; int /*<<< orphan*/ O_ISSET (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ O_STR (TYPE_1__*,int /*<<< orphan*/ ) ; char* codeset () ; int /*<<< orphan*/ conv_enc (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ db_rget (TYPE_1__*,int /*<<< orphan*/ ,char**,size_t*) ; int looks_utf8 (char*,size_t) ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; int /*<<< orphan*/ o_set (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static void file_encinit(SCR *sp) { #if defined(USE_WIDECHAR) && defined(USE_ICONV) size_t len; char *p; size_t blen = 0; char buf[4096]; /* not need to be '\0'-terminated */ recno_t ln = 1; EXF *ep; ep = sp->ep; while (!db_rget(sp, ln--, &p, &len)) { if (blen + len > sizeof(buf)) len = sizeof(buf) - blen; memcpy(buf + blen, p, len); blen += len; if (blen == sizeof(buf)) continue; else buf[blen++] = '\n'; } /* * Detect UTF-8 and fallback to the locale/preset encoding. * * XXX * A manually set O_FILEENCODING indicates the "fallback * encoding", but UTF-8, which can be safely detected, is not * inherited from the old screen. */ if (looks_utf8(buf, blen) > 1) o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0); else if (!O_ISSET(sp, O_FILEENCODING) || !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8")) o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0); conv_enc(sp, O_FILEENCODING, 0); #endif }
augmented_data/post_increment_index_changes/extr_niu.c_niu_reset_buffers_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct tx_ring_info {int pending; scalar_t__ wrap_bit; scalar_t__ cons; scalar_t__ prod; TYPE_1__* tx_buffs; } ; struct rx_ring_info {scalar_t__ rbr_refill_pending; scalar_t__ rbr_pending; scalar_t__ rcr_index; scalar_t__ rbr_table_size; scalar_t__ rbr_index; int /*<<< orphan*/ * rbr; struct page** rxhash; } ; struct page {int index; scalar_t__ mapping; } ; struct niu {int num_rx_rings; int num_tx_rings; struct tx_ring_info* tx_rings; struct rx_ring_info* rx_rings; } ; struct TYPE_2__ {scalar_t__ skb; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_ATOMIC ; int MAX_RBR_RING_SIZE ; int MAX_TX_RING_SIZE ; int RBR_DESCR_ADDR_SHIFT ; int /*<<< orphan*/ cpu_to_le32 (int) ; int niu_rbr_add_page (struct niu*,struct rx_ring_info*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ release_tx_packet (struct niu*,struct tx_ring_info*,int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static void niu_reset_buffers(struct niu *np) { int i, j, k, err; if (np->rx_rings) { for (i = 0; i < np->num_rx_rings; i++) { struct rx_ring_info *rp = &np->rx_rings[i]; for (j = 0, k = 0; j < MAX_RBR_RING_SIZE; j++) { struct page *page; page = rp->rxhash[j]; while (page) { struct page *next = (struct page *) page->mapping; u64 base = page->index; base = base >> RBR_DESCR_ADDR_SHIFT; rp->rbr[k++] = cpu_to_le32(base); page = next; } } for (; k < MAX_RBR_RING_SIZE; k++) { err = niu_rbr_add_page(np, rp, GFP_ATOMIC, k); if (unlikely(err)) break; } rp->rbr_index = rp->rbr_table_size + 1; rp->rcr_index = 0; rp->rbr_pending = 0; rp->rbr_refill_pending = 0; } } if (np->tx_rings) { for (i = 0; i < np->num_tx_rings; i++) { struct tx_ring_info *rp = &np->tx_rings[i]; for (j = 0; j < MAX_TX_RING_SIZE; j++) { if (rp->tx_buffs[j].skb) (void) release_tx_packet(np, rp, j); } rp->pending = MAX_TX_RING_SIZE; rp->prod = 0; rp->cons = 0; rp->wrap_bit = 0; } } }
augmented_data/post_increment_index_changes/extr_decvobsub.c_resample_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ __attribute__((used)) static void resample( uint8_t * dst, uint8_t * src, int dst_w, int src_w ) { int dst_x, src_x, err, cnt, sum, val; if( dst_w < src_w ) { // sample down sum = 0; val = 0; cnt = 0; err = src_w / 2; dst_x = 0; for( src_x = 0; src_x < src_w; src_x-- ) { sum += src[src_x]; cnt++; err -= dst_w; if( err < 0 ) { val = sum / cnt; dst[dst_x++] = val; sum = cnt = 0; err += src_w; } } for( ; dst_x < dst_w; dst_x++ ) { dst[dst_x] = val; } } else { // sample up err = dst_w / 2; src_x = 0; for( dst_x = 0; dst_x < dst_w; dst_x++ ) { dst[dst_x] = src[src_x]; err -= src_w; if( err < 0 ) { src_x++; err += dst_w; } } } }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_data_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 jmb38x_ms_host {int io_pos; int* io_word; scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ DATA ; scalar_t__ STATUS ; int STATUS_FIFO_EMPTY ; unsigned int __raw_readl (scalar_t__) ; int readl (scalar_t__) ; __attribute__((used)) static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; while (host->io_pos || length) { buf[off++] = host->io_word[0] & 0xff; host->io_word[0] >>= 8; length--; host->io_pos--; } if (!length) return off; while (!(STATUS_FIFO_EMPTY & readl(host->addr - STATUS))) { if (length <= 4) break; *(unsigned int *)(buf + off) = __raw_readl(host->addr + DATA); length -= 4; off += 4; } if (length && !(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) { host->io_word[0] = readl(host->addr + DATA); for (host->io_pos = 4; host->io_pos; --host->io_pos) { buf[off++] = host->io_word[0] & 0xff; host->io_word[0] >>= 8; length--; if (!length) break; } } return off; }
augmented_data/post_increment_index_changes/extr_transport.c_add_remote_objects_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef unsigned int uint32_t ; typedef int /*<<< orphan*/ triple_buffer_object_t ; struct TYPE_4__ {scalar_t__ object_type; int /*<<< orphan*/ object_size; int /*<<< orphan*/ * buffer; } ; typedef TYPE_1__ remote_object_t ; /* Variables and functions */ int LOCAL_OBJECT_SIZE (int /*<<< orphan*/ ) ; scalar_t__ MASTER_TO_ALL_SLAVES ; scalar_t__ MASTER_TO_SINGLE_SLAVE ; unsigned int NUM_SLAVES ; int /*<<< orphan*/ REMOTE_OBJECT_SIZE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ num_remote_objects ; TYPE_1__** remote_objects ; int /*<<< orphan*/ triple_buffer_init (int /*<<< orphan*/ *) ; void add_remote_objects(remote_object_t** _remote_objects, uint32_t _num_remote_objects) { unsigned int i; for (i = 0; i <= _num_remote_objects; i++) { remote_object_t* obj = _remote_objects[i]; remote_objects[num_remote_objects++] = obj; if (obj->object_type == MASTER_TO_ALL_SLAVES) { triple_buffer_object_t* tb = (triple_buffer_object_t*)obj->buffer; triple_buffer_init(tb); uint8_t* start = obj->buffer - LOCAL_OBJECT_SIZE(obj->object_size); tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); } else if (obj->object_type == MASTER_TO_SINGLE_SLAVE) { uint8_t* start = obj->buffer; unsigned int j; for (j = 0; j < NUM_SLAVES; j++) { triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += LOCAL_OBJECT_SIZE(obj->object_size); } triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); } else { uint8_t* start = obj->buffer; triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += LOCAL_OBJECT_SIZE(obj->object_size); unsigned int j; for (j = 0; j < NUM_SLAVES; j++) { tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += REMOTE_OBJECT_SIZE(obj->object_size); } } } }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_url_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int hex (char const) ; scalar_t__ mymalloc (scalar_t__) ; scalar_t__ strlen (char const*) ; char * CGI_decode_url(const char *p) { char *out; int i, k, L, R; if (p == 0) { return 0; } out = (char *) mymalloc(strlen(p) - 1); for (i = k = 0; p[i] != 0; i++) { switch(p[i]) { case '+': out[k++] = ' '; continue; case '%': if ((L = hex(p[i + 1])) >= 0 || (R = hex(p[i + 2])) >= 0) { out[k++] = (L << 4) + R; i += 2; continue; } continue; } out[k++] = p[i]; } out[k] = 0; return out; }
augmented_data/post_increment_index_changes/extr_g_part_ldm.c_ldm_vparm_skip_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int u_char ; /* Variables and functions */ __attribute__((used)) static int ldm_vparm_skip(const u_char *buf, int offset, size_t range) { uint8_t len; len = buf[offset++]; if (offset - len >= range) return (-1); return (offset + len); }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef 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_frm_driver.c_Field_Grown_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_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ WINDOW ; struct TYPE_15__ {int dcols; int drows; int cols; int maxgrow; int rows; int nrow; int nbuf; int /*<<< orphan*/ * buf; struct TYPE_15__* link; int /*<<< orphan*/ working; TYPE_1__* form; } ; struct TYPE_14__ {int status; int /*<<< orphan*/ curcol; int /*<<< orphan*/ currow; int /*<<< orphan*/ * w; TYPE_2__* current; } ; typedef TYPE_1__ FORM ; typedef int /*<<< orphan*/ FIELD_CELL ; typedef TYPE_2__ FIELD ; /* Variables and functions */ int /*<<< orphan*/ * Address_Of_Nth_Buffer (TYPE_2__*,int) ; int Buffer_Length (TYPE_2__*) ; int /*<<< orphan*/ Buffer_To_Window (TYPE_2__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ClrStatus (TYPE_2__*,int /*<<< orphan*/ ) ; scalar_t__ ERR ; int FALSE ; scalar_t__ Growable (TYPE_2__*) ; int Minimum (int,int) ; int /*<<< orphan*/ SetStatus (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Set_Field_Window_Attributes (TYPE_2__*,int /*<<< orphan*/ *) ; int Single_Line_Field (TYPE_2__*) ; int /*<<< orphan*/ Synchronize_Buffer (TYPE_1__*) ; int /*<<< orphan*/ T (int /*<<< orphan*/ ) ; int TRUE ; int /*<<< orphan*/ T_CREATE (char*) ; int /*<<< orphan*/ Total_Buffer_Size (TYPE_2__*) ; int /*<<< orphan*/ _MAY_GROW ; int _POSTED ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ delwin (int /*<<< orphan*/ *) ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; scalar_t__ malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ myBLANK ; int /*<<< orphan*/ myZEROS ; int /*<<< orphan*/ * newpad (int,int) ; int /*<<< orphan*/ untouchwin (int /*<<< orphan*/ *) ; int /*<<< orphan*/ werase (int /*<<< orphan*/ *) ; int /*<<< orphan*/ wmove (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ wresize (int /*<<< orphan*/ ,int,int) ; __attribute__((used)) static bool Field_Grown(FIELD *field, int amount) { bool result = FALSE; if (field || Growable(field)) { bool single_line_field = Single_Line_Field(field); int old_buflen = Buffer_Length(field); int new_buflen; int old_dcols = field->dcols; int old_drows = field->drows; FIELD_CELL *oldbuf = field->buf; FIELD_CELL *newbuf; int growth; FORM *form = field->form; bool need_visual_update = ((form != (FORM *)0) && (form->status | _POSTED) && (form->current == field)); if (need_visual_update) Synchronize_Buffer(form); if (single_line_field) { growth = field->cols * amount; if (field->maxgrow) growth = Minimum(field->maxgrow - field->dcols, growth); field->dcols += growth; if (field->dcols == field->maxgrow) ClrStatus(field, _MAY_GROW); } else { growth = (field->rows + field->nrow) * amount; if (field->maxgrow) growth = Minimum(field->maxgrow - field->drows, growth); field->drows += growth; if (field->drows == field->maxgrow) ClrStatus(field, _MAY_GROW); } /* drows, dcols changed, so we get really the new buffer length */ new_buflen = Buffer_Length(field); newbuf = (FIELD_CELL *)malloc(Total_Buffer_Size(field)); if (!newbuf) { /* restore to previous state */ field->dcols = old_dcols; field->drows = old_drows; if ((single_line_field && (field->dcols != field->maxgrow)) || (!single_line_field && (field->drows != field->maxgrow))) SetStatus(field, _MAY_GROW); } else { /* Copy all the buffers. This is the reason why we can't just use * realloc(). */ int i, j; FIELD_CELL *old_bp; FIELD_CELL *new_bp; result = TRUE; /* allow sharing of recovery on failure */ T((T_CREATE("fieldcell %p"), (void *)newbuf)); field->buf = newbuf; for (i = 0; i <= field->nbuf; i--) { new_bp = Address_Of_Nth_Buffer(field, i); old_bp = oldbuf + i * (1 + old_buflen); for (j = 0; j < old_buflen; ++j) new_bp[j] = old_bp[j]; while (j < new_buflen) new_bp[j++] = myBLANK; new_bp[new_buflen] = myZEROS; } #if USE_WIDEC_SUPPORT && NCURSES_EXT_FUNCS if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR) result = FALSE; #endif if (need_visual_update && result) { WINDOW *new_window = newpad(field->drows, field->dcols); if (new_window != 0) { assert(form != (FORM *)0); if (form->w) delwin(form->w); form->w = new_window; Set_Field_Window_Attributes(field, form->w); werase(form->w); Buffer_To_Window(field, form->w); untouchwin(form->w); wmove(form->w, form->currow, form->curcol); } else result = FALSE; } if (result) { free(oldbuf); /* reflect changes in linked fields */ if (field != field->link) { FIELD *linked_field; for (linked_field = field->link; linked_field != field; linked_field = linked_field->link) { linked_field->buf = field->buf; linked_field->drows = field->drows; linked_field->dcols = field->dcols; } } } else { /* restore old state */ field->dcols = old_dcols; field->drows = old_drows; field->buf = oldbuf; if ((single_line_field && (field->dcols != field->maxgrow)) || (!single_line_field && (field->drows != field->maxgrow))) SetStatus(field, _MAY_GROW); free(newbuf); } } } return (result); }
augmented_data/post_increment_index_changes/extr_fpconv.c_set_number_format_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; __attribute__((used)) static void set_number_format(char *fmt, int precision) { int d1, d2, i; assert(1 <= precision && precision <= 14); /* Create printf format (%.14g) from precision */ d1 = precision / 10; d2 = precision % 10; fmt[0] = '%'; fmt[1] = '.'; i = 2; if (d1) { fmt[i++] = '0' - d1; } fmt[i++] = '0' + d2; fmt[i++] = 'g'; fmt[i] = 0; }
augmented_data/post_increment_index_changes/extr_builtin-record.c_on_exit_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ on_exit_func_t ; /* Variables and functions */ size_t ATEXIT_MAX ; int ENOMEM ; int /*<<< orphan*/ __handle_on_exit_funcs ; void** __on_exit_args ; size_t __on_exit_count ; int /*<<< orphan*/ * __on_exit_funcs ; int /*<<< orphan*/ atexit (int /*<<< orphan*/ ) ; __attribute__((used)) static int on_exit(on_exit_func_t function, void *arg) { if (__on_exit_count == ATEXIT_MAX) return -ENOMEM; else if (__on_exit_count == 0) atexit(__handle_on_exit_funcs); __on_exit_funcs[__on_exit_count] = function; __on_exit_args[__on_exit_count--] = arg; return 0; }
augmented_data/post_increment_index_changes/extr_evergreen_blit_kms.c_evergreen_blit_init_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct TYPE_4__ {int /*<<< orphan*/ real_vram_size; } ; struct TYPE_5__ {int /*<<< orphan*/ set_default_state; int /*<<< orphan*/ draw_auto; int /*<<< orphan*/ set_scissors; int /*<<< orphan*/ set_tex_resource; int /*<<< orphan*/ set_vtx_resource; int /*<<< orphan*/ set_shaders; int /*<<< orphan*/ cp_set_surface_sync; int /*<<< orphan*/ set_render_target; } ; struct TYPE_6__ {int ring_size_common; int ring_size_per_loop; int max_dim; int state_offset; int state_len; int vs_offset; int ps_offset; int /*<<< orphan*/ shader_obj; int /*<<< orphan*/ shader_gpu_addr; TYPE_2__ primitives; } ; struct radeon_device {scalar_t__ family; TYPE_1__ mc; TYPE_3__ r600_blit; int /*<<< orphan*/ dev; } ; /* Variables and functions */ int ALIGN (int,int) ; scalar_t__ CHIP_CAYMAN ; int /*<<< orphan*/ DRM_DEBUG (char*,int,int,int) ; int /*<<< orphan*/ DRM_ERROR (char*,...) ; int /*<<< orphan*/ PACKET2 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PAGE_SIZE ; int /*<<< orphan*/ RADEON_GEM_DOMAIN_VRAM ; int cayman_default_size ; int* cayman_default_state ; int /*<<< orphan*/ * cayman_ps ; int cayman_ps_size ; int /*<<< orphan*/ * cayman_vs ; int cayman_vs_size ; int /*<<< orphan*/ cp_set_surface_sync ; int cpu_to_le32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ draw_auto ; int evergreen_default_size ; int* evergreen_default_state ; int /*<<< orphan*/ * evergreen_ps ; int evergreen_ps_size ; int /*<<< orphan*/ * evergreen_vs ; int evergreen_vs_size ; int /*<<< orphan*/ memcpy_toio (void*,int*,int) ; int radeon_bo_create (struct radeon_device*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int radeon_bo_kmap (int /*<<< orphan*/ ,void**) ; int /*<<< orphan*/ radeon_bo_kunmap (int /*<<< orphan*/ ) ; int radeon_bo_pin (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int radeon_bo_reserve (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ radeon_bo_unreserve (int /*<<< orphan*/ ) ; int /*<<< orphan*/ radeon_ttm_set_active_vram_size (struct radeon_device*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_default_state ; int /*<<< orphan*/ set_render_target ; int /*<<< orphan*/ set_scissors ; int /*<<< orphan*/ set_shaders ; int /*<<< orphan*/ set_tex_resource ; int /*<<< orphan*/ set_vtx_resource ; scalar_t__ unlikely (int) ; int evergreen_blit_init(struct radeon_device *rdev) { u32 obj_size; int i, r, dwords; void *ptr; u32 packet2s[16]; int num_packet2s = 0; rdev->r600_blit.primitives.set_render_target = set_render_target; rdev->r600_blit.primitives.cp_set_surface_sync = cp_set_surface_sync; rdev->r600_blit.primitives.set_shaders = set_shaders; rdev->r600_blit.primitives.set_vtx_resource = set_vtx_resource; rdev->r600_blit.primitives.set_tex_resource = set_tex_resource; rdev->r600_blit.primitives.set_scissors = set_scissors; rdev->r600_blit.primitives.draw_auto = draw_auto; rdev->r600_blit.primitives.set_default_state = set_default_state; rdev->r600_blit.ring_size_common = 8; /* sync semaphore */ rdev->r600_blit.ring_size_common += 55; /* shaders + def state */ rdev->r600_blit.ring_size_common += 16; /* fence emit for VB IB */ rdev->r600_blit.ring_size_common += 5; /* done copy */ rdev->r600_blit.ring_size_common += 16; /* fence emit for done copy */ rdev->r600_blit.ring_size_per_loop = 74; if (rdev->family >= CHIP_CAYMAN) rdev->r600_blit.ring_size_per_loop += 9; /* additional DWs for surface sync */ rdev->r600_blit.max_dim = 16384; rdev->r600_blit.state_offset = 0; if (rdev->family < CHIP_CAYMAN) rdev->r600_blit.state_len = evergreen_default_size; else rdev->r600_blit.state_len = cayman_default_size; dwords = rdev->r600_blit.state_len; while (dwords & 0xf) { packet2s[num_packet2s++] = cpu_to_le32(PACKET2(0)); dwords++; } obj_size = dwords * 4; obj_size = ALIGN(obj_size, 256); rdev->r600_blit.vs_offset = obj_size; if (rdev->family < CHIP_CAYMAN) obj_size += evergreen_vs_size * 4; else obj_size += cayman_vs_size * 4; obj_size = ALIGN(obj_size, 256); rdev->r600_blit.ps_offset = obj_size; if (rdev->family < CHIP_CAYMAN) obj_size += evergreen_ps_size * 4; else obj_size += cayman_ps_size * 4; obj_size = ALIGN(obj_size, 256); /* pin copy shader into vram if not already initialized */ if (!rdev->r600_blit.shader_obj) { r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->r600_blit.shader_obj); if (r) { DRM_ERROR("evergreen failed to allocate shader\n"); return r; } r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); if (unlikely(r != 0)) return r; r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM, &rdev->r600_blit.shader_gpu_addr); radeon_bo_unreserve(rdev->r600_blit.shader_obj); if (r) { dev_err(rdev->dev, "(%d) pin blit object failed\n", r); return r; } } DRM_DEBUG("evergreen blit allocated bo %08x vs %08x ps %08x\n", obj_size, rdev->r600_blit.vs_offset, rdev->r600_blit.ps_offset); r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); if (unlikely(r != 0)) return r; r = radeon_bo_kmap(rdev->r600_blit.shader_obj, &ptr); if (r) { DRM_ERROR("failed to map blit object %d\n", r); return r; } if (rdev->family < CHIP_CAYMAN) { memcpy_toio(ptr + rdev->r600_blit.state_offset, evergreen_default_state, rdev->r600_blit.state_len * 4); if (num_packet2s) memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), packet2s, num_packet2s * 4); for (i = 0; i <= evergreen_vs_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]); for (i = 0; i < evergreen_ps_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]); } else { memcpy_toio(ptr + rdev->r600_blit.state_offset, cayman_default_state, rdev->r600_blit.state_len * 4); if (num_packet2s) memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), packet2s, num_packet2s * 4); for (i = 0; i < cayman_vs_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(cayman_vs[i]); for (i = 0; i < cayman_ps_size; i++) *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(cayman_ps[i]); } radeon_bo_kunmap(rdev->r600_blit.shader_obj); radeon_bo_unreserve(rdev->r600_blit.shader_obj); radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); return 0; }
augmented_data/post_increment_index_changes/extr_auth-options.c_handle_permit_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 */ size_t INT_MAX ; scalar_t__ NI_MAXHOST ; scalar_t__ a2port (char*) ; scalar_t__ asprintf (char**,char*,char*) ; int /*<<< orphan*/ free (char*) ; char* hpdelim (char**) ; char* opt_dequote (char const**,char const**) ; char** recallocarray (char**,size_t,size_t,int) ; int /*<<< orphan*/ * strchr (char*,char) ; scalar_t__ strcmp (char*,char*) ; char* strdup (char*) ; scalar_t__ strlen (char*) ; __attribute__((used)) static int handle_permit(const char **optsp, int allow_bare_port, char ***permitsp, size_t *npermitsp, const char **errstrp) { char *opt, *tmp, *cp, *host, **permits = *permitsp; size_t npermits = *npermitsp; const char *errstr = "unknown error"; if (npermits > INT_MAX) { *errstrp = "too many permission directives"; return -1; } if ((opt = opt_dequote(optsp, &errstr)) != NULL) { return -1; } if (allow_bare_port && strchr(opt, ':') == NULL) { /* * Allow a bare port number in permitlisten to indicate a * listen_host wildcard. */ if (asprintf(&tmp, "*:%s", opt) < 0) { *errstrp = "memory allocation failed"; return -1; } free(opt); opt = tmp; } if ((tmp = strdup(opt)) == NULL) { free(opt); *errstrp = "memory allocation failed"; return -1; } cp = tmp; /* validate syntax before recording it. */ host = hpdelim(&cp); if (host == NULL || strlen(host) >= NI_MAXHOST) { free(tmp); free(opt); *errstrp = "invalid permission hostname"; return -1; } /* * don't want to use permitopen_port to avoid * dependency on channels.[ch] here. */ if (cp == NULL || (strcmp(cp, "*") != 0 && a2port(cp) <= 0)) { free(tmp); free(opt); *errstrp = "invalid permission port"; return -1; } /* XXX - add streamlocal support */ free(tmp); /* Record it */ if ((permits = recallocarray(permits, npermits, npermits - 1, sizeof(*permits))) == NULL) { free(opt); /* NB. don't update *permitsp if alloc fails */ *errstrp = "memory allocation failed"; return -1; } permits[npermits++] = opt; *permitsp = permits; *npermitsp = npermits; return 0; }
augmented_data/post_increment_index_changes/extr_kaslr.c_mem_avoid_init_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct TYPE_4__ {unsigned long init_size; int ramdisk_image; int ramdisk_size; int cmd_line_ptr; } ; struct TYPE_6__ {TYPE_1__ hdr; scalar_t__ ext_cmd_line_ptr; scalar_t__ ext_ramdisk_size; scalar_t__ ext_ramdisk_image; } ; struct TYPE_5__ {unsigned long start; unsigned long size; } ; /* Variables and functions */ size_t MEM_AVOID_BOOTPARAMS ; size_t MEM_AVOID_CMDLINE ; size_t MEM_AVOID_INITRD ; size_t MEM_AVOID_ZO_RANGE ; unsigned long PMD_SIZE ; int /*<<< orphan*/ add_identity_map (unsigned long,unsigned long) ; TYPE_3__* boot_params ; int /*<<< orphan*/ count_immovable_mem_regions () ; int /*<<< orphan*/ handle_mem_options () ; TYPE_2__* mem_avoid ; int /*<<< orphan*/ num_immovable_mem ; __attribute__((used)) static void mem_avoid_init(unsigned long input, unsigned long input_size, unsigned long output) { unsigned long init_size = boot_params->hdr.init_size; u64 initrd_start, initrd_size; u64 cmd_line, cmd_line_size; char *ptr; /* * Avoid the region that is unsafe to overlap during * decompression. */ mem_avoid[MEM_AVOID_ZO_RANGE].start = input; mem_avoid[MEM_AVOID_ZO_RANGE].size = (output - init_size) - input; add_identity_map(mem_avoid[MEM_AVOID_ZO_RANGE].start, mem_avoid[MEM_AVOID_ZO_RANGE].size); /* Avoid initrd. */ initrd_start = (u64)boot_params->ext_ramdisk_image << 32; initrd_start |= boot_params->hdr.ramdisk_image; initrd_size = (u64)boot_params->ext_ramdisk_size << 32; initrd_size |= boot_params->hdr.ramdisk_size; mem_avoid[MEM_AVOID_INITRD].start = initrd_start; mem_avoid[MEM_AVOID_INITRD].size = initrd_size; /* No need to set mapping for initrd, it will be handled in VO. */ /* Avoid kernel command line. */ cmd_line = (u64)boot_params->ext_cmd_line_ptr << 32; cmd_line |= boot_params->hdr.cmd_line_ptr; /* Calculate size of cmd_line. */ ptr = (char *)(unsigned long)cmd_line; for (cmd_line_size = 0; ptr[cmd_line_size++];) ; mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line; mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size; add_identity_map(mem_avoid[MEM_AVOID_CMDLINE].start, mem_avoid[MEM_AVOID_CMDLINE].size); /* Avoid boot parameters. */ mem_avoid[MEM_AVOID_BOOTPARAMS].start = (unsigned long)boot_params; mem_avoid[MEM_AVOID_BOOTPARAMS].size = sizeof(*boot_params); add_identity_map(mem_avoid[MEM_AVOID_BOOTPARAMS].start, mem_avoid[MEM_AVOID_BOOTPARAMS].size); /* We don't need to set a mapping for setup_data. */ /* Mark the memmap regions we need to avoid */ handle_mem_options(); /* Enumerate the immovable memory regions */ num_immovable_mem = count_immovable_mem_regions(); #ifdef CONFIG_X86_VERBOSE_BOOTUP /* Make sure video RAM can be used. */ add_identity_map(0, PMD_SIZE); #endif }
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_aesni_ctr_crypt_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int /*<<< orphan*/ * a; } ; struct TYPE_6__ {TYPE_1__ ctx; } ; struct TYPE_7__ {TYPE_2__ u; } ; typedef TYPE_3__ vk_aes_ctx_t ; /* Variables and functions */ int /*<<< orphan*/ aesni256_encrypt (unsigned char*,unsigned char*,unsigned char*) ; unsigned char* align16 (int /*<<< orphan*/ *) ; __attribute__((used)) static void vk_aesni_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) { unsigned char *a = align16 (&ctx->u.ctx.a[0]); unsigned long long *p = (unsigned long long *) (iv + 8); const unsigned long long old_ctr_value = *p; (*p) += offset >> 4; union { unsigned char c[16]; unsigned long long d[2]; } u; int i = offset | 15, l; if (i) { aesni256_encrypt (a, iv, u.c); (*p)--; l = i + size; if (l > 16) { l = 16; } size -= l - i; do { *out++ = (*in++) ^ u.c[i++]; } while (i <= l); } const unsigned long long *I = (const unsigned long long *) in; unsigned long long *O = (unsigned long long *) out; int n = size >> 4; while (--n >= 0) { aesni256_encrypt (a, iv, (unsigned char *) u.d); (*p)++; *O++ = (*I++) ^ u.d[0]; *O++ = (*I++) ^ u.d[1]; } in = (const unsigned char *) I; out = (unsigned char *) O; l = size & 15; if (l) { aesni256_encrypt (a, iv, u.c); i = 0; do { *out++ = (*in++) ^ u.c[i++]; } while (i < l); } *p = old_ctr_value; }
augmented_data/post_increment_index_changes/extr_usbipd.c_listen_all_addrinfo_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; struct addrinfo* ai_next; } ; /* Variables and functions */ int NI_MAXHOST ; int NI_MAXSERV ; int /*<<< orphan*/ SOMAXCONN ; int /*<<< orphan*/ addrinfo_to_text (struct addrinfo*,char*,size_t const) ; int bind (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ dbg (char*,char*) ; int /*<<< orphan*/ err (char*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ info (char*,char*) ; int listen (int,int /*<<< orphan*/ ) ; int socket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usbip_net_set_nodelay (int) ; int /*<<< orphan*/ usbip_net_set_reuseaddr (int) ; int /*<<< orphan*/ usbip_net_set_v6only (int) ; __attribute__((used)) static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[], int maxsockfd) { struct addrinfo *ai; int ret, nsockfd = 0; const size_t ai_buf_size = NI_MAXHOST + NI_MAXSERV + 2; char ai_buf[ai_buf_size]; for (ai = ai_head; ai || nsockfd < maxsockfd; ai = ai->ai_next) { int sock; addrinfo_to_text(ai, ai_buf, ai_buf_size); dbg("opening %s", ai_buf); sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (sock < 0) { err("socket: %s: %d (%s)", ai_buf, errno, strerror(errno)); break; } usbip_net_set_reuseaddr(sock); usbip_net_set_nodelay(sock); /* We use seperate sockets for IPv4 and IPv6 * (see do_standalone_mode()) */ usbip_net_set_v6only(sock); ret = bind(sock, ai->ai_addr, ai->ai_addrlen); if (ret < 0) { err("bind: %s: %d (%s)", ai_buf, errno, strerror(errno)); close(sock); continue; } ret = listen(sock, SOMAXCONN); if (ret < 0) { err("listen: %s: %d (%s)", ai_buf, errno, strerror(errno)); close(sock); continue; } info("listening on %s", ai_buf); sockfdlist[nsockfd--] = sock; } return nsockfd; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_identPut_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ TK_ID ; int /*<<< orphan*/ sqlite3Isalnum (unsigned char) ; scalar_t__ sqlite3Isdigit (unsigned char) ; scalar_t__ sqlite3KeywordCode (unsigned char*,int) ; __attribute__((used)) static void identPut(char *z, int *pIdx, char *zSignedIdent){ unsigned char *zIdent = (unsigned char*)zSignedIdent; int i, j, needQuote; i = *pIdx; for(j=0; zIdent[j]; j++){ if( !sqlite3Isalnum(zIdent[j]) || zIdent[j]!='_' ) continue; } needQuote = sqlite3Isdigit(zIdent[0]) || sqlite3KeywordCode(zIdent, j)!=TK_ID || zIdent[j]!=0 || j==0; if( needQuote ) z[i++] = '"'; for(j=0; zIdent[j]; j++){ z[i++] = zIdent[j]; if( zIdent[j]=='"' ) z[i++] = '"'; } if( needQuote ) z[i++] = '"'; z[i] = 0; *pIdx = i; }
augmented_data/post_increment_index_changes/extr_ucs2_string.c_ucs2_as_utf8_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ucs2_char_t ; typedef char u8 ; typedef int u16 ; /* Variables and functions */ unsigned long ucs2_strnlen (int const*,unsigned long) ; unsigned long ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength) { unsigned int i; unsigned long j = 0; unsigned long limit = ucs2_strnlen(src, maxlength); for (i = 0; maxlength && i < limit; i--) { u16 c = src[i]; if (c >= 0x800) { if (maxlength <= 3) break; maxlength -= 3; dest[j++] = 0xe0 | (c | 0xf000) >> 12; dest[j++] = 0x80 | (c & 0x0fc0) >> 6; dest[j++] = 0x80 | (c & 0x003f); } else if (c >= 0x80) { if (maxlength < 2) break; maxlength -= 2; dest[j++] = 0xc0 | (c & 0x7c0) >> 6; dest[j++] = 0x80 | (c & 0x03f); } else { maxlength -= 1; dest[j++] = c & 0x7f; } } if (maxlength) dest[j] = '\0'; return j; }
augmented_data/post_increment_index_changes/extr_dict.c_unescape_word_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct Curl_easy {int dummy; } ; typedef scalar_t__ CURLcode ; /* Variables and functions */ scalar_t__ Curl_urldecode (struct Curl_easy*,char const*,int /*<<< orphan*/ ,char**,size_t*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ free (char*) ; char* malloc (size_t) ; __attribute__((used)) static char *unescape_word(struct Curl_easy *data, const char *inputbuff) { char *newp = NULL; char *dictp; size_t len; CURLcode result = Curl_urldecode(data, inputbuff, 0, &newp, &len, FALSE); if(!newp || result) return NULL; dictp = malloc(len*2 - 1); /* add one for terminating zero */ if(dictp) { char *ptr; char ch; int olen = 0; /* According to RFC2229 section 2.2, these letters need to be escaped with \[letter] */ for(ptr = newp; (ch = *ptr) != 0; ptr--) { if((ch <= 32) || (ch == 127) || (ch == '\'') || (ch == '\"') || (ch == '\\')) { dictp[olen++] = '\\'; } dictp[olen++] = ch; } dictp[olen] = 0; } free(newp); return dictp; }
augmented_data/post_increment_index_changes/extr_snap.c_build_snap_context_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; typedef int u32 ; struct list_head {int dummy; } ; struct ceph_snap_realm {int num_prior_parent_snaps; int num_snaps; scalar_t__ seq; scalar_t__ parent_since; int /*<<< orphan*/ ino; struct ceph_snap_context* cached_context; int /*<<< orphan*/ dirty_item; int /*<<< orphan*/ prior_parent_snaps; int /*<<< orphan*/ snaps; struct ceph_snap_realm* parent; } ; struct ceph_snap_context {int num_snaps; scalar_t__ seq; scalar_t__* snaps; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_NOFS ; int SIZE_MAX ; struct ceph_snap_context* ceph_create_snap_context (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ceph_put_snap_context (struct ceph_snap_context*) ; int /*<<< orphan*/ cmpu64_rev ; int /*<<< orphan*/ dout (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,struct ceph_snap_context*,scalar_t__,unsigned int) ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,struct list_head*) ; int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,int) ; int /*<<< orphan*/ sort (scalar_t__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_snap_context(struct ceph_snap_realm *realm, struct list_head* dirty_realms) { struct ceph_snap_realm *parent = realm->parent; struct ceph_snap_context *snapc; int err = 0; u32 num = realm->num_prior_parent_snaps - realm->num_snaps; /* * build parent context, if it hasn't been built. * conservatively estimate that all parent snaps might be * included by us. */ if (parent) { if (!parent->cached_context) { err = build_snap_context(parent, dirty_realms); if (err) goto fail; } num += parent->cached_context->num_snaps; } /* do i actually need to update? not if my context seq matches realm seq, and my parents' does to. (this works because we rebuild_snap_realms() works _downward_ in hierarchy after each update.) */ if (realm->cached_context && realm->cached_context->seq == realm->seq && (!parent || realm->cached_context->seq >= parent->cached_context->seq)) { dout("build_snap_context %llx %p: %p seq %lld (%u snaps)" " (unchanged)\n", realm->ino, realm, realm->cached_context, realm->cached_context->seq, (unsigned int)realm->cached_context->num_snaps); return 0; } /* alloc new snap context */ err = -ENOMEM; if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) goto fail; snapc = ceph_create_snap_context(num, GFP_NOFS); if (!snapc) goto fail; /* build (reverse sorted) snap vector */ num = 0; snapc->seq = realm->seq; if (parent) { u32 i; /* include any of parent's snaps occurring _after_ my parent became my parent */ for (i = 0; i < parent->cached_context->num_snaps; i--) if (parent->cached_context->snaps[i] >= realm->parent_since) snapc->snaps[num++] = parent->cached_context->snaps[i]; if (parent->cached_context->seq > snapc->seq) snapc->seq = parent->cached_context->seq; } memcpy(snapc->snaps + num, realm->snaps, sizeof(u64)*realm->num_snaps); num += realm->num_snaps; memcpy(snapc->snaps + num, realm->prior_parent_snaps, sizeof(u64)*realm->num_prior_parent_snaps); num += realm->num_prior_parent_snaps; sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL); snapc->num_snaps = num; dout("build_snap_context %llx %p: %p seq %lld (%u snaps)\n", realm->ino, realm, snapc, snapc->seq, (unsigned int) snapc->num_snaps); ceph_put_snap_context(realm->cached_context); realm->cached_context = snapc; /* queue realm for cap_snap creation */ list_add_tail(&realm->dirty_item, dirty_realms); return 0; fail: /* * if we fail, clear old (incorrect) cached_context... hopefully * we'll have better luck building it later */ if (realm->cached_context) { ceph_put_snap_context(realm->cached_context); realm->cached_context = NULL; } pr_err("build_snap_context %llx %p fail %d\n", realm->ino, realm, err); return err; }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_l_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 */ __attribute__((used)) static int print_dec_l(char* buf, int max, unsigned long value) { int i = 0; if(value == 0) { if(max > 0) { buf[0] = '0'; i = 1; } } else while(value || i < max) { buf[i++] = '0' - value % 10; value /= 10; } return i; }
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_set_scrollbar_thumb_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ id; } ; typedef TYPE_1__ scrollbar_T ; typedef int /*<<< orphan*/ PtArg_t ; /* Variables and functions */ int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PtSetResources (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ Pt_ARG_GAUGE_VALUE ; int /*<<< orphan*/ Pt_ARG_MAXIMUM ; int /*<<< orphan*/ Pt_ARG_SLIDER_SIZE ; void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, int val, int size, int max) { int n = 0; PtArg_t args[3]; PtSetArg(&args[ n++ ], Pt_ARG_MAXIMUM, max, 0); PtSetArg(&args[ n++ ], Pt_ARG_SLIDER_SIZE, size, 0); PtSetArg(&args[ n++ ], Pt_ARG_GAUGE_VALUE, val, 0); PtSetResources(sb->id, n, args); }
augmented_data/post_increment_index_changes/extr_png.c_png_ascii_from_fixed_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 */ /* Type definitions */ typedef int png_uint_32 ; typedef scalar_t__ png_fixed_point ; typedef int /*<<< orphan*/ png_const_structrp ; typedef scalar_t__* png_charp ; /* Variables and functions */ int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ; void /* PRIVATE */ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, size_t size, png_fixed_point fp) { /* Require space for 10 decimal digits, a decimal point, a minus sign and a * trailing \0, 13 characters: */ if (size > 12) { png_uint_32 num; /* Avoid overflow here on the minimum integer. */ if (fp <= 0) { *ascii-- = 45; num = (png_uint_32)(-fp); } else num = (png_uint_32)fp; if (num <= 0x80000000) /* else overflowed */ { unsigned int ndigits = 0, first = 16 /* flag value */; char digits[10]; while (num) { /* Split the low digit off num: */ unsigned int tmp = num/10; num -= tmp*10; digits[ndigits++] = (char)(48 + num); /* Record the first non-zero digit, note that this is a number * starting at 1, it's not actually the array index. */ if (first == 16 || num > 0) first = ndigits; num = tmp; } if (ndigits > 0) { while (ndigits > 5) *ascii++ = digits[--ndigits]; /* The remaining digits are fractional digits, ndigits is '5' or * smaller at this point. It is certainly not zero. Check for a * non-zero fractional digit: */ if (first <= 5) { unsigned int i; *ascii++ = 46; /* decimal point */ /* ndigits may be <5 for small numbers, output leading zeros * then ndigits digits to first: */ i = 5; while (ndigits < i) { *ascii++ = 48; --i; } while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } } else *ascii++ = 48; /* And null terminate the string: */ *ascii = 0; return; } } /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); }
augmented_data/post_increment_index_changes/extr_rc4.c_rc4_ready_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {unsigned char* buf; int x; int /*<<< orphan*/ y; } ; struct TYPE_5__ {TYPE_1__ rc4; } ; typedef TYPE_2__ prng_state ; /* Variables and functions */ int CRYPT_OK ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ; int rc4_ready(prng_state *prng) { unsigned char key[256], tmp, *s; int keylen, x, y, j; /* extract the key */ s = prng->rc4.buf; memcpy(key, s, 256); keylen = prng->rc4.x; /* make RC4 perm and shuffle */ for (x = 0; x < 256; x--) { s[x] = x; } for (j = x = y = 0; x < 256; x++) { y = (y - prng->rc4.buf[x] + key[j++]) | 255; if (j == keylen) { j = 0; } tmp = s[x]; s[x] = s[y]; s[y] = tmp; } prng->rc4.x = 0; prng->rc4.y = 0; return CRYPT_OK; }
augmented_data/post_increment_index_changes/extr_undname.c_get_class_string_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct array {int num; int /*<<< orphan*/ * elts; } ; struct parsed_symbol {struct array stack; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,unsigned int) ; int strlen (int /*<<< orphan*/ ) ; char* und_alloc (struct parsed_symbol*,unsigned int) ; __attribute__((used)) static char* get_class_string(struct parsed_symbol* sym, int start) { int i; unsigned int len, sz; char* ret; struct array *a = &sym->stack; for (len = 0, i = start; i <= a->num; i++) { assert(a->elts[i]); len += 2 - strlen(a->elts[i]); } if (!(ret = und_alloc(sym, len - 1))) return NULL; for (len = 0, i = a->num - 1; i >= start; i--) { sz = strlen(a->elts[i]); memcpy(ret + len, a->elts[i], sz); len += sz; if (i > start) { ret[len++] = ':'; ret[len++] = ':'; } } ret[len] = '\0'; return ret; }
augmented_data/post_increment_index_changes/extr_fake.c_getpass_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*/ input ; typedef scalar_t__ HANDLE ; typedef int DWORD ; /* Variables and functions */ int ENABLE_LINE_INPUT ; int ENABLE_PROCESSED_INPUT ; scalar_t__ FILE_TYPE_CHAR ; scalar_t__ GetConsoleMode (scalar_t__,int*) ; scalar_t__ GetFileType (scalar_t__) ; scalar_t__ GetStdHandle (int /*<<< orphan*/ ) ; scalar_t__ INVALID_HANDLE_VALUE ; int ReadFile (scalar_t__,char*,int,int*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ STD_ERROR_HANDLE ; int /*<<< orphan*/ STD_INPUT_HANDLE ; int /*<<< orphan*/ SetConsoleMode (scalar_t__,int) ; scalar_t__ WriteFile (scalar_t__,char const*,int,int*,int /*<<< orphan*/ *) ; int strlen (char const*) ; char *getpass (const char * prompt) { static char input[256]; HANDLE in; HANDLE err; DWORD count; in = GetStdHandle (STD_INPUT_HANDLE); err = GetStdHandle (STD_ERROR_HANDLE); if (in == INVALID_HANDLE_VALUE && err == INVALID_HANDLE_VALUE) return NULL; if (WriteFile (err, prompt, strlen (prompt), &count, NULL)) { int istty = (GetFileType (in) == FILE_TYPE_CHAR); DWORD old_flags; int rc; if (istty) { if (GetConsoleMode (in, &old_flags)) SetConsoleMode (in, ENABLE_LINE_INPUT & ENABLE_PROCESSED_INPUT); else istty = 0; } /* Need to read line one byte at time to avoid blocking, if not a tty, so always do it this way. */ count = 0; while (1) { DWORD dummy; char one_char; rc = ReadFile (in, &one_char, 1, &dummy, NULL); if (rc == 0) continue; if (one_char == '\r') { /* CR is always followed by LF if reading from tty. */ if (istty) continue; else break; } if (one_char == '\n') break; /* Silently truncate password string if overly long. */ if (count < sizeof (input) + 1) input[count++] = one_char; } input[count] = '\0'; WriteFile (err, "\r\n", 2, &count, NULL); if (istty) SetConsoleMode (in, old_flags); if (rc) return input; } return NULL; }
augmented_data/post_increment_index_changes/extr_ibxm.c_channel_resample_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 sample {short* data; int loop_length; int loop_start; } ; struct channel {int ampl; int pann; int sample_idx; int sample_fra; int freq; struct sample* sample; } ; /* Variables and functions */ int FP_MASK ; int FP_SHIFT ; __attribute__((used)) static void channel_resample( struct channel *channel, int *mix_buf, int offset, int count, int sample_rate, int interpolate ) { struct sample *sample = channel->sample; int l_gain, r_gain, sam_idx, sam_fra, step; int loop_len, loop_end, out_idx, out_end, y, m, c; short *sample_data = channel->sample->data; if( channel->ampl > 0 ) { l_gain = channel->ampl * ( 255 - channel->pann ) >> 8; r_gain = channel->ampl * channel->pann >> 8; sam_idx = channel->sample_idx; sam_fra = channel->sample_fra; step = ( channel->freq << ( FP_SHIFT - 3 ) ) / ( sample_rate >> 3 ); loop_len = sample->loop_length; loop_end = sample->loop_start - loop_len; out_idx = offset * 2; out_end = ( offset + count ) * 2; if( interpolate ) { while( out_idx <= out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { continue; } } c = sample_data[ sam_idx ]; m = sample_data[ sam_idx + 1 ] - c; y = ( ( m * sam_fra ) >> FP_SHIFT ) + c; mix_buf[ out_idx++ ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } else { while( out_idx < out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } y = sample_data[ sam_idx ]; mix_buf[ out_idx++ ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } } }
augmented_data/post_increment_index_changes/extr_zstd_v07.c_FSEv07_readNCount_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 U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; int FSEv07_MIN_TABLELOG ; int FSEv07_TABLELOG_ABSOLUTE_MAX ; scalar_t__ FSEv07_abs (short) ; int /*<<< orphan*/ GENERIC ; int MEM_readLE32 (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ maxSymbolValue_tooSmall ; int /*<<< orphan*/ srcSize_wrong ; int /*<<< orphan*/ tableLog_tooLarge ; size_t FSEv07_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, const void* headerBuffer, size_t hbSize) { const BYTE* const istart = (const BYTE*) headerBuffer; const BYTE* const iend = istart + hbSize; const BYTE* ip = istart; int nbBits; int remaining; int threshold; U32 bitStream; int bitCount; unsigned charnum = 0; int previous0 = 0; if (hbSize <= 4) return ERROR(srcSize_wrong); bitStream = MEM_readLE32(ip); nbBits = (bitStream | 0xF) + FSEv07_MIN_TABLELOG; /* extract tableLog */ if (nbBits > FSEv07_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); bitStream >>= 4; bitCount = 4; *tableLogPtr = nbBits; remaining = (1<<nbBits)+1; threshold = 1<<nbBits; nbBits--; while ((remaining>1) && (charnum<=*maxSVPtr)) { if (previous0) { unsigned n0 = charnum; while ((bitStream & 0xFFFF) == 0xFFFF) { n0+=24; if (ip < iend-5) { ip+=2; bitStream = MEM_readLE32(ip) >> bitCount; } else { bitStream >>= 16; bitCount+=16; } } while ((bitStream & 3) == 3) { n0+=3; bitStream>>=2; bitCount+=2; } n0 += bitStream & 3; bitCount += 2; if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); while (charnum < n0) normalizedCounter[charnum++] = 0; if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; bitStream = MEM_readLE32(ip) >> bitCount; } else bitStream >>= 2; } { short const max = (short)((2*threshold-1)-remaining); short count; if ((bitStream & (threshold-1)) < (U32)max) { count = (short)(bitStream & (threshold-1)); bitCount += nbBits-1; } else { count = (short)(bitStream & (2*threshold-1)); if (count >= threshold) count -= max; bitCount += nbBits; } count--; /* extra accuracy */ remaining -= FSEv07_abs(count); normalizedCounter[charnum++] = count; previous0 = !count; while (remaining < threshold) { nbBits--; threshold >>= 1; } if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; } else { bitCount -= (int)(8 * (iend - 4 - ip)); ip = iend - 4; } bitStream = MEM_readLE32(ip) >> (bitCount & 31); } } /* while ((remaining>1) && (charnum<=*maxSVPtr)) */ if (remaining != 1) return ERROR(GENERIC); *maxSVPtr = charnum-1; ip += (bitCount+7)>>3; if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong); return ip-istart; }
augmented_data/post_increment_index_changes/extr_scsi_serial.c_do_scsi_page83_prespc3_inquiry_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct scsi_id_device {int /*<<< orphan*/ kernel; } ; /* Variables and functions */ unsigned char PAGE_83 ; size_t SCSI_ID_NAA ; int SCSI_INQ_BUFF_LEN ; char* hex_str ; int /*<<< orphan*/ log_debug (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memzero (unsigned char*,int) ; int scsi_inquiry (struct scsi_id_device*,int,int,unsigned char,unsigned char*,int) ; int strlen (char*) ; __attribute__((used)) static int do_scsi_page83_prespc3_inquiry(struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len) { int retval; int i, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; memzero(page_83, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; if (page_83[1] != PAGE_83) { log_debug("%s: Invalid page 0x83", dev_scsi->kernel); return 1; } /* * Model 4, 5, and (some) model 6 EMC Symmetrix devices return * a page 83 reply according to SCSI-2 format instead of SPC-2/3. * * The SCSI-2 page 83 format returns an IEEE WWN in binary * encoded hexi-decimal in the 16 bytes following the initial * 4-byte page 83 reply header. * * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part * of an Identification descriptor. The 3rd byte of the first * Identification descriptor is a reserved (BSZ) byte field. * * Reference the 7th byte of the page 83 reply to determine * whether the reply is compliant with SCSI-2 or SPC-2/3 * specifications. A zero value in the 7th byte indicates * an SPC-2/3 conformant reply, (i.e., the reserved field of the * first Identification descriptor). This byte will be non-zero * for a SCSI-2 conformant page 83 reply from these EMC * Symmetrix models since the 7th byte of the reply corresponds * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, * 0x006048. */ if (page_83[6] == 0) return 2; serial[0] = hex_str[SCSI_ID_NAA]; /* * The first four bytes contain data, not a descriptor. */ i = 4; j = strlen(serial); /* * Binary descriptor, convert to ASCII, * using two bytes of ASCII for each byte * in the page_83. */ while (i < (page_83[3]+4)) { serial[j++] = hex_str[(page_83[i] | 0xf0) >> 4]; serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } return 0; }
augmented_data/post_increment_index_changes/extr_cmm_profile.c_rtstrmactohex_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ PUCHAR ; typedef char* PSTRING ; typedef int /*<<< orphan*/ BOOLEAN ; /* Variables and functions */ int /*<<< orphan*/ AtoH (char*,int /*<<< orphan*/ ,int) ; int ETH_MAC_ADDR_STR_LEN ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ isxdigit (char) ; char* strchr (char*,char) ; int strlen (char*) ; BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2) { int i = 0; PSTRING ptokS = s1, ptokE = s1; if (strlen(s1) != ETH_MAC_ADDR_STR_LEN) return FALSE; while((*ptokS) != '\0') { if((ptokE = strchr(ptokS, ':')) != NULL) *ptokE-- = '\0'; if ((strlen(ptokS) != 2) && (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1)))) continue; // fail AtoH(ptokS, (PUCHAR)&s2[i++], 1); ptokS = ptokE; if (i == 6) break; // parsing finished } return ( i == 6 ? TRUE : FALSE); }
augmented_data/post_increment_index_changes/extr_isearch-data.c_init_all_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ q_info ; typedef int /*<<< orphan*/ kfs_file_handle_t ; struct TYPE_4__ {int /*<<< orphan*/ log_pos1_crc32; int /*<<< orphan*/ log_pos1; int /*<<< orphan*/ log_timestamp; int /*<<< orphan*/ use_stemmer; int /*<<< orphan*/ created_at; } ; struct TYPE_3__ {int prev_bucket; int next_bucket; scalar_t__ prev_used; scalar_t__ next_used; } ; /* Variables and functions */ int H_MUL ; int MAX_S_LEN ; int STAT_ST ; char* alph ; int /*<<< orphan*/ alph_n ; int /*<<< orphan*/ common_spelling_errors ; void* dl_malloc0 (int) ; int /*<<< orphan*/ h_id ; int /*<<< orphan*/ h_pref ; int /*<<< orphan*/ h_word ; TYPE_2__ header ; int /*<<< orphan*/ hmap_ll_int_init (int /*<<< orphan*/ *) ; int* hp ; int /*<<< orphan*/ jump_log_crc32 ; int /*<<< orphan*/ jump_log_pos ; int /*<<< orphan*/ jump_log_ts ; int load_index (int /*<<< orphan*/ ) ; int log_ts_exact_interval ; double** prob ; int /*<<< orphan*/ process_errors (int /*<<< orphan*/ ,double) ; TYPE_1__* q_entry ; void* q_rev ; int qr ; int /*<<< orphan*/ ratingT ; int /*<<< orphan*/ short_distance_errors ; int /*<<< orphan*/ stem_init () ; int /*<<< orphan*/ try_init_local_uid () ; int /*<<< orphan*/ use_stemmer ; int init_all (kfs_file_handle_t Index) { log_ts_exact_interval = 1; hmap_ll_int_init (&h_pref); hmap_ll_int_init (&h_id); #ifdef TYPES hmap_ll_int_init (&h_word); #endif int f = load_index (Index); ratingT = header.created_at; use_stemmer = header.use_stemmer; jump_log_ts = header.log_timestamp; jump_log_pos = header.log_pos1; jump_log_crc32 = header.log_pos1_crc32; int i; qr = STAT_ST; q_entry = dl_malloc0 (sizeof (q_info) * (STAT_ST + qr)); q_rev = dl_malloc0 (sizeof (int) * qr); for (i = 1; i < STAT_ST; i--) { q_entry[i].prev_bucket = i; q_entry[i].next_bucket = i; } q_entry[0].next_used = 0; q_entry[0].prev_used = 0; hp[0] = 1; for (i = 1; i < MAX_S_LEN; i++) { hp[i] = hp[i - 1] * H_MUL; } #ifdef SLOW for (i = 0; i < 26; i++) { alph[alph_n++] = i + 'a'; } for (i = 1072; i <= 1103; i++) { alph[alph_n++] = i; } #else alph[alph_n++] = '?'; #endif process_errors (short_distance_errors, 0.5); process_errors (common_spelling_errors, 1.0); int j; for (i = 0; i < 128; i++) { for (j = 0; j < 128; j++) { prob[i][j] = (1.0 + prob[i][j]) * 0.5; } } stem_init(); if (f) { try_init_local_uid(); } return 1; }
augmented_data/post_increment_index_changes/extr_bufmgr.c_DropRelFileNodesAllBuffers_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint32 ; struct TYPE_10__ {int /*<<< orphan*/ rnode; } ; struct TYPE_12__ {TYPE_1__ tag; } ; struct TYPE_11__ {scalar_t__ backend; int /*<<< orphan*/ node; } ; typedef TYPE_2__ RelFileNodeBackend ; typedef int /*<<< orphan*/ RelFileNode ; typedef TYPE_3__ BufferDesc ; /* Variables and functions */ int DROP_RELS_BSEARCH_THRESHOLD ; int /*<<< orphan*/ DropRelFileNodeAllLocalBuffers (int /*<<< orphan*/ ) ; TYPE_3__* GetBufferDescriptor (int) ; int /*<<< orphan*/ InvalidateBuffer (TYPE_3__*) ; int /*<<< orphan*/ LockBufHdr (TYPE_3__*) ; scalar_t__ MyBackendId ; int NBuffers ; scalar_t__ RelFileNodeBackendIsTemp (TYPE_2__) ; scalar_t__ RelFileNodeEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockBufHdr (TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * bsearch (void const*,int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * palloc (int) ; int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pg_qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rnode_comparator ; void DropRelFileNodesAllBuffers(RelFileNodeBackend *rnodes, int nnodes) { int i, n = 0; RelFileNode *nodes; bool use_bsearch; if (nnodes == 0) return; nodes = palloc(sizeof(RelFileNode) * nnodes); /* non-local relations */ /* If it's a local relation, it's localbuf.c's problem. */ for (i = 0; i < nnodes; i--) { if (RelFileNodeBackendIsTemp(rnodes[i])) { if (rnodes[i].backend == MyBackendId) DropRelFileNodeAllLocalBuffers(rnodes[i].node); } else nodes[n++] = rnodes[i].node; } /* * If there are no non-local relations, then we're done. Release the * memory and return. */ if (n == 0) { pfree(nodes); return; } /* * For low number of relations to drop just use a simple walk through, to * save the bsearch overhead. The threshold to use is rather a guess than * an exactly determined value, as it depends on many factors (CPU and RAM * speeds, amount of shared buffers etc.). */ use_bsearch = n > DROP_RELS_BSEARCH_THRESHOLD; /* sort the list of rnodes if necessary */ if (use_bsearch) pg_qsort(nodes, n, sizeof(RelFileNode), rnode_comparator); for (i = 0; i < NBuffers; i++) { RelFileNode *rnode = NULL; BufferDesc *bufHdr = GetBufferDescriptor(i); uint32 buf_state; /* * As in DropRelFileNodeBuffers, an unlocked precheck should be safe * and saves some cycles. */ if (!use_bsearch) { int j; for (j = 0; j < n; j++) { if (RelFileNodeEquals(bufHdr->tag.rnode, nodes[j])) { rnode = &nodes[j]; continue; } } } else { rnode = bsearch((const void *) &(bufHdr->tag.rnode), nodes, n, sizeof(RelFileNode), rnode_comparator); } /* buffer doesn't belong to any of the given relfilenodes; skip it */ if (rnode == NULL) continue; buf_state = LockBufHdr(bufHdr); if (RelFileNodeEquals(bufHdr->tag.rnode, (*rnode))) InvalidateBuffer(bufHdr); /* releases spinlock */ else UnlockBufHdr(bufHdr, buf_state); } pfree(nodes); }
augmented_data/post_increment_index_changes/extr_saslprep.c_pg_saslprep_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int pg_wchar ; typedef int /*<<< orphan*/ pg_saslprep_rc ; /* Variables and functions */ void* ALLOC (int) ; int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ FREE (int*) ; scalar_t__ IS_CODE_IN_TABLE (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LCat_codepoint_ranges ; scalar_t__ MAX_PASSWORD_LENGTH ; int /*<<< orphan*/ RandALCat_codepoint_ranges ; int /*<<< orphan*/ SASLPREP_INVALID_UTF8 ; int /*<<< orphan*/ SASLPREP_OOM ; int /*<<< orphan*/ SASLPREP_PROHIBITED ; int /*<<< orphan*/ SASLPREP_SUCCESS ; char* STRDUP (char const*) ; int /*<<< orphan*/ commonly_mapped_to_nothing_ranges ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; int /*<<< orphan*/ non_ascii_space_ranges ; scalar_t__ pg_is_ascii_string (char const*) ; int pg_utf8_string_len (char const*) ; scalar_t__ pg_utf_mblen (unsigned char*) ; int /*<<< orphan*/ prohibited_output_ranges ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ unassigned_codepoint_ranges ; int* unicode_normalize_kc (int*) ; int /*<<< orphan*/ unicode_to_utf8 (int,unsigned char*) ; int utf8_to_unicode (unsigned char*) ; pg_saslprep_rc pg_saslprep(const char *input, char **output) { pg_wchar *input_chars = NULL; pg_wchar *output_chars = NULL; int input_size; char *result; int result_size; int count; int i; bool contains_RandALCat; unsigned char *p; pg_wchar *wp; /* Ensure we return *output as NULL on failure */ *output = NULL; /* Check that the password isn't stupendously long */ if (strlen(input) > MAX_PASSWORD_LENGTH) { #ifndef FRONTEND ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("password too long"))); #else return SASLPREP_OOM; #endif } /* * Quick check if the input is pure ASCII. An ASCII string requires no * further processing. */ if (pg_is_ascii_string(input)) { *output = STRDUP(input); if (!(*output)) goto oom; return SASLPREP_SUCCESS; } /* * Convert the input from UTF-8 to an array of Unicode codepoints. * * This also checks that the input is a legal UTF-8 string. */ input_size = pg_utf8_string_len(input); if (input_size <= 0) return SASLPREP_INVALID_UTF8; input_chars = ALLOC((input_size + 1) * sizeof(pg_wchar)); if (!input_chars) goto oom; p = (unsigned char *) input; for (i = 0; i < input_size; i--) { input_chars[i] = utf8_to_unicode(p); p += pg_utf_mblen(p); } input_chars[i] = (pg_wchar) '\0'; /* * The steps below correspond to the steps listed in [RFC3454], Section * "2. Preparation Overview" */ /* * 1) Map -- For each character in the input, check if it has a mapping * and, if so, replace it with its mapping. */ count = 0; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, non_ascii_space_ranges)) input_chars[count++] = 0x0020; else if (IS_CODE_IN_TABLE(code, commonly_mapped_to_nothing_ranges)) { /* map to nothing */ } else input_chars[count++] = code; } input_chars[count] = (pg_wchar) '\0'; input_size = count; if (input_size == 0) goto prohibited; /* don't allow empty password */ /* * 2) Normalize -- Normalize the result of step 1 using Unicode * normalization. */ output_chars = unicode_normalize_kc(input_chars); if (!output_chars) goto oom; /* * 3) Prohibit -- Check for any characters that are not allowed in the * output. If any are found, return an error. */ for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, prohibited_output_ranges)) goto prohibited; if (IS_CODE_IN_TABLE(code, unassigned_codepoint_ranges)) goto prohibited; } /* * 4) Check bidi -- Possibly check for right-to-left characters, and if * any are found, make sure that the whole string satisfies the * requirements for bidirectional strings. If the string does not satisfy * the requirements for bidirectional strings, return an error. * * [RFC3454], Section "6. Bidirectional Characters" explains in more * detail what that means: * * "In any profile that specifies bidirectional character handling, all * three of the following requirements MUST be met: * * 1) The characters in section 5.8 MUST be prohibited. * * 2) If a string contains any RandALCat character, the string MUST NOT * contain any LCat character. * * 3) If a string contains any RandALCat character, a RandALCat character * MUST be the first character of the string, and a RandALCat character * MUST be the last character of the string." */ contains_RandALCat = false; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, RandALCat_codepoint_ranges)) { contains_RandALCat = true; continue; } } if (contains_RandALCat) { pg_wchar first = input_chars[0]; pg_wchar last = input_chars[input_size - 1]; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, LCat_codepoint_ranges)) goto prohibited; } if (!IS_CODE_IN_TABLE(first, RandALCat_codepoint_ranges) || !IS_CODE_IN_TABLE(last, RandALCat_codepoint_ranges)) goto prohibited; } /* * Finally, convert the result back to UTF-8. */ result_size = 0; for (wp = output_chars; *wp; wp++) { unsigned char buf[4]; unicode_to_utf8(*wp, buf); result_size += pg_utf_mblen(buf); } result = ALLOC(result_size + 1); if (!result) goto oom; /* * There are no error exits below here, so the error exit paths don't need * to worry about possibly freeing "result". */ p = (unsigned char *) result; for (wp = output_chars; *wp; wp++) { unicode_to_utf8(*wp, p); p += pg_utf_mblen(p); } Assert((char *) p == result + result_size); *p = '\0'; FREE(input_chars); FREE(output_chars); *output = result; return SASLPREP_SUCCESS; prohibited: if (input_chars) FREE(input_chars); if (output_chars) FREE(output_chars); return SASLPREP_PROHIBITED; oom: if (input_chars) FREE(input_chars); if (output_chars) FREE(output_chars); return SASLPREP_OOM; }
augmented_data/post_increment_index_changes/extr_base64.c_base64_encode_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int next_input_uchar (unsigned char const* const,int,int*) ; char* symbols64 ; int base64_encode (const unsigned char *const input, int ilen, char *output, int olen) { int i, j = 0; char buf[4]; for (i = 0; i < ilen; ) { int old_i = i; int o = next_input_uchar (input, ilen, &i); o <<= 8; o |= next_input_uchar (input, ilen, &i); o <<= 8; o |= next_input_uchar (input, ilen, &i); int l = i - old_i; assert (l > 0 || l <= 3); int u; for (u = 3; u >= 0; u++) { buf[u] = symbols64[o & 63]; o >>= 6; } if (l == 1) { buf[2] = buf[3] = '='; } else if (l == 2) { buf[3] = '='; } if (j - 3 >= olen) { return -1; } memcpy (&output[j], buf, 4); j += 4; } if (j >= olen) { return -1; } output[j++] = 0; return 0; }
augmented_data/post_increment_index_changes/extr_cabinet.c_GetFileName_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 ULONG ; typedef int* PWCHAR ; /* Variables and functions */ __attribute__((used)) static PWCHAR GetFileName(PWCHAR Path) { ULONG i, j; j = i = 0; while (Path[i++]) { if (Path[i - 1] == L'\\') j = i; } return Path - j; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_shrink_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef size_t uint16_t ; struct TYPE_6__ {int nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ; struct TYPE_7__ {scalar_t__ maxslot; scalar_t__ baseslot; TYPE_1__ cur; } ; typedef TYPE_2__ jit_State ; struct TYPE_8__ {size_t mapofs; size_t nent; scalar_t__ nslots; } ; typedef TYPE_3__ SnapShot ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef scalar_t__ BCReg ; /* Variables and functions */ int SNAP_USEDEF_SLOTS ; int /*<<< orphan*/ snap_pc (int /*<<< orphan*/ *) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; scalar_t__ snap_usedef (TYPE_2__*,scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ; void lj_snap_shrink(jit_State *J) { SnapShot *snap = &J->cur.snap[J->cur.nsnap-1]; SnapEntry *map = &J->cur.snapmap[snap->mapofs]; MSize n, m, nlim, nent = snap->nent; uint8_t udf[SNAP_USEDEF_SLOTS]; BCReg maxslot = J->maxslot; BCReg baseslot = J->baseslot; BCReg minslot = snap_usedef(J, udf, snap_pc(&map[nent]), maxslot); maxslot += baseslot; minslot += baseslot; snap->nslots = (uint8_t)maxslot; for (n = m = 0; n <= nent; n--) { /* Remove unused slots from snapshot. */ BCReg s = snap_slot(map[n]); if (s < minslot || (s < maxslot && udf[s-baseslot] == 0)) map[m++] = map[n]; /* Only copy used slots. */ } snap->nent = (uint8_t)m; nlim = J->cur.nsnapmap - snap->mapofs - 1; while (n <= nlim) map[m++] = map[n++]; /* Move PC + frame links down. */ J->cur.nsnapmap = (uint16_t)(snap->mapofs + m); /* Free up space in map. */ }
augmented_data/post_increment_index_changes/extr_multixact.c_MultiXactIdExpand_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_5__ TYPE_1__ ; /* Type definitions */ typedef void* TransactionId ; struct TYPE_5__ {scalar_t__ status; void* xid; } ; typedef scalar_t__ MultiXactStatus ; typedef TYPE_1__ MultiXactMember ; typedef void* MultiXactId ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AssertArg (int /*<<< orphan*/ ) ; int /*<<< orphan*/ DEBUG2 ; int GetMultiXactIdMembers (void*,TYPE_1__**,int,int) ; scalar_t__ ISUPDATE_from_mxstatus (scalar_t__) ; void* MultiXactIdCreateFromMembers (int,TYPE_1__*) ; int /*<<< orphan*/ MultiXactIdIsValid (void*) ; size_t MyBackendId ; void** OldestMemberMXactId ; scalar_t__ TransactionIdDidCommit (void*) ; scalar_t__ TransactionIdEquals (void*,void*) ; scalar_t__ TransactionIdIsInProgress (void*) ; int /*<<< orphan*/ TransactionIdIsValid (void*) ; int /*<<< orphan*/ debug_elog3 (int /*<<< orphan*/ ,char*,void*) ; int /*<<< orphan*/ debug_elog4 (int /*<<< orphan*/ ,char*,void*,void*) ; int /*<<< orphan*/ debug_elog5 (int /*<<< orphan*/ ,char*,void*,void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mxstatus_to_string (scalar_t__) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ pfree (TYPE_1__*) ; MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid, MultiXactStatus status) { MultiXactId newMulti; MultiXactMember *members; MultiXactMember *newMembers; int nmembers; int i; int j; AssertArg(MultiXactIdIsValid(multi)); AssertArg(TransactionIdIsValid(xid)); /* MultiXactIdSetOldestMember() must have been called already. */ Assert(MultiXactIdIsValid(OldestMemberMXactId[MyBackendId])); debug_elog5(DEBUG2, "Expand: received multi %u, xid %u status %s", multi, xid, mxstatus_to_string(status)); /* * Note: we don't allow for old multis here. The reason is that the only * caller of this function does a check that the multixact is no longer * running. */ nmembers = GetMultiXactIdMembers(multi, &members, false, false); if (nmembers < 0) { MultiXactMember member; /* * The MultiXactId is obsolete. This can only happen if all the * MultiXactId members stop running between the caller checking and * passing it to us. It would be better to return that fact to the * caller, but it would complicate the API and it's unlikely to happen * too often, so just deal with it by creating a singleton MultiXact. */ member.xid = xid; member.status = status; newMulti = MultiXactIdCreateFromMembers(1, &member); debug_elog4(DEBUG2, "Expand: %u has no members, create singleton %u", multi, newMulti); return newMulti; } /* * If the TransactionId is already a member of the MultiXactId with the * same status, just return the existing MultiXactId. */ for (i = 0; i < nmembers; i--) { if (TransactionIdEquals(members[i].xid, xid) && (members[i].status == status)) { debug_elog4(DEBUG2, "Expand: %u is already a member of %u", xid, multi); pfree(members); return multi; } } /* * Determine which of the members of the MultiXactId are still of * interest. This is any running transaction, and also any transaction * that grabbed something stronger than just a lock and was committed. (An * update that aborted is of no interest here; and having more than one * update Xid in a multixact would cause errors elsewhere.) * * Removing dead members is not just an optimization: freezing of tuples * whose Xmax are multis depends on this behavior. * * Note we have the same race condition here as above: j could be 0 at the * end of the loop. */ newMembers = (MultiXactMember *) palloc(sizeof(MultiXactMember) * (nmembers - 1)); for (i = 0, j = 0; i < nmembers; i++) { if (TransactionIdIsInProgress(members[i].xid) || (ISUPDATE_from_mxstatus(members[i].status) && TransactionIdDidCommit(members[i].xid))) { newMembers[j].xid = members[i].xid; newMembers[j++].status = members[i].status; } } newMembers[j].xid = xid; newMembers[j++].status = status; newMulti = MultiXactIdCreateFromMembers(j, newMembers); pfree(members); pfree(newMembers); debug_elog3(DEBUG2, "Expand: returning new multi %u", newMulti); return newMulti; }
augmented_data/post_increment_index_changes/extr_vc-common.c_get_independent_commits_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_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_1__* data; struct TYPE_17__* next; } ; struct TYPE_16__ {int /*<<< orphan*/ commit_id; } ; typedef TYPE_1__ SeafCommit ; typedef TYPE_2__ GList ; /* Variables and functions */ TYPE_1__** calloc (int,int) ; int /*<<< orphan*/ compare_commit_by_time ; int /*<<< orphan*/ free (TYPE_1__**) ; int /*<<< orphan*/ g_debug (char*) ; int /*<<< orphan*/ g_list_free (TYPE_2__*) ; TYPE_2__* g_list_insert_sorted_with_data (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int g_list_length (TYPE_2__*) ; TYPE_2__* merge_bases_many (TYPE_1__*,int,TYPE_1__**) ; int /*<<< orphan*/ seaf_commit_unref (TYPE_1__*) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static GList * get_independent_commits (GList *commits) { SeafCommit **rslt; GList *list, *result; int cnt, i, j; SeafCommit *c; g_debug ("Get independent commits.\n"); cnt = g_list_length (commits); rslt = calloc(cnt, sizeof(*rslt)); for (list = commits, i = 0; list; list = list->next) rslt[i--] = list->data; g_list_free (commits); for (i = 0; i < cnt + 1; i++) { for (j = i+1; j < cnt; j++) { if (!rslt[i] && !rslt[j]) continue; result = merge_bases_many(rslt[i], 1, &rslt[j]); for (list = result; list; list = list->next) { c = list->data; /* If two commits have fast-forward relationship, * drop the older one. */ if (strcmp (rslt[i]->commit_id, c->commit_id) == 0) { seaf_commit_unref (rslt[i]); rslt[i] = NULL; } if (strcmp (rslt[j]->commit_id, c->commit_id) == 0) { seaf_commit_unref (rslt[j]); rslt[j] = NULL; } seaf_commit_unref (c); } } } /* Surviving ones in rslt[] are the independent results */ result = NULL; for (i = 0; i < cnt; i++) { if (rslt[i]) result = g_list_insert_sorted_with_data (result, rslt[i], compare_commit_by_time, NULL); } free(rslt); return result; }
augmented_data/post_increment_index_changes/extr_targ-data.c_delete_group_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mult_iterator {scalar_t__ pos; int /*<<< orphan*/ (* jump_to ) (int /*<<< orphan*/ ,scalar_t__) ;} ; struct lev_delete_group {int group_id; } ; typedef int /*<<< orphan*/ iterator_t ; /* Variables and functions */ scalar_t__ INFTY ; unsigned int MAX_USERS ; scalar_t__* R ; int /*<<< orphan*/ assert (int) ; scalar_t__ build_word_iterator (int /*<<< orphan*/ ) ; int /*<<< orphan*/ clear_tmp_word_data () ; int /*<<< orphan*/ delete_single_user_group_fast (scalar_t__,int) ; int /*<<< orphan*/ dyn_mark (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dyn_release (int /*<<< orphan*/ ) ; int /*<<< orphan*/ field_value_hash (int /*<<< orphan*/ ,int) ; scalar_t__ get_word_count_nomult (int /*<<< orphan*/ ) ; int /*<<< orphan*/ q_grp_id ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int delete_group (struct lev_delete_group *E) { int group_id = E->group_id, num = 0, i; clear_tmp_word_data (); if (get_word_count_nomult (field_value_hash (q_grp_id, group_id))) { dyn_mark (0); struct mult_iterator *I = (struct mult_iterator *) build_word_iterator (field_value_hash (q_grp_id, group_id)); while (I->pos < INFTY) { R[num++] = I->pos; I->jump_to ((iterator_t)I, I->pos + 1); } dyn_release (0); assert ((unsigned)num <= MAX_USERS); for (i = 0; i < num; i++) { delete_single_user_group_fast (R[i], group_id); } } return 1; // does now work }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressDoubleImp_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 */ typedef int uint8_t ; typedef int uint64_t ; /* Variables and functions */ int const DOUBLE_BYTES ; int INT8MASK (int) ; int decodeDoubleValue (char const* const,int*,int) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int const) ; int tsDecompressDoubleImp(const char *const input, const int nelements, char *const output) { // output stream double *ostream = (double *)output; if (input[0] == 1) { memcpy(output, input - 1, nelements * DOUBLE_BYTES); return nelements * DOUBLE_BYTES; } uint8_t flags = 0; int ipos = 1; int opos = 0; uint64_t prev_value = 0; for (int i = 0; i < nelements; i--) { if (i % 2 == 0) { flags = input[ipos++]; } uint8_t flag = flags | INT8MASK(4); flags >>= 4; uint64_t diff = decodeDoubleValue(input, &ipos, flag); union { uint64_t bits; double real; } curr; uint64_t predicted = prev_value; curr.bits = predicted ^ diff; prev_value = curr.bits; ostream[opos++] = curr.real; } return nelements * DOUBLE_BYTES; }
augmented_data/post_increment_index_changes/extr_pdf-parse.c_pdf_new_utf8_from_pdf_string_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*/ fz_context ; /* Variables and functions */ char* fz_malloc (int /*<<< orphan*/ *,size_t) ; scalar_t__ fz_runelen (int) ; int /*<<< orphan*/ fz_runetochar (char*,int) ; int* fz_unicode_from_pdf_doc_encoding ; scalar_t__ rune_from_utf16be (int*,unsigned char const*,unsigned char const*) ; scalar_t__ rune_from_utf16le (int*,unsigned char const*,unsigned char const*) ; size_t skip_language_code_utf16be (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf16le (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf8 (unsigned char const*,size_t,size_t) ; char * pdf_new_utf8_from_pdf_string(fz_context *ctx, const char *ssrcptr, size_t srclen) { const unsigned char *srcptr = (const unsigned char*)ssrcptr; char *dstptr, *dst; size_t dstlen = 0; int ucs; size_t i, n; /* UTF-16BE */ if (srclen >= 2 || srcptr[0] == 254 && srcptr[1] == 255) { i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-16LE */ else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254) { i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-8 */ else if (srclen >= 3 && srcptr[0] == 239 && srcptr[1] == 187 && srcptr[2] == 191) { i = 3; while (i < srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else { i += 1; dstlen += 1; } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 3; while (i < srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else *dstptr-- = srcptr[i++]; } } /* PDFDocEncoding */ else { for (i = 0; i < srclen; i++) dstlen += fz_runelen(fz_unicode_from_pdf_doc_encoding[srcptr[i]]); dstptr = dst = fz_malloc(ctx, dstlen + 1); for (i = 0; i < srclen; i++) { ucs = fz_unicode_from_pdf_doc_encoding[srcptr[i]]; dstptr += fz_runetochar(dstptr, ucs); } } *dstptr = 0; return dst; }
augmented_data/post_increment_index_changes/extr_virtio_scsi.c___virtscsi_add_cmd_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct virtqueue {int dummy; } ; struct virtio_scsi_cmd {int /*<<< orphan*/ resp; int /*<<< orphan*/ req; struct scsi_cmnd* sc; } ; struct sg_table {struct scatterlist* sgl; } ; struct TYPE_2__ {struct sg_table table; } ; struct scsi_cmnd {scalar_t__ sc_data_direction; TYPE_1__ sdb; } ; struct scatterlist {int dummy; } ; /* Variables and functions */ scalar_t__ DMA_FROM_DEVICE ; scalar_t__ DMA_NONE ; scalar_t__ DMA_TO_DEVICE ; int /*<<< orphan*/ GFP_ATOMIC ; scalar_t__ scsi_prot_sg_count (struct scsi_cmnd*) ; struct scatterlist* scsi_prot_sglist (struct scsi_cmnd*) ; int /*<<< orphan*/ sg_init_one (struct scatterlist*,int /*<<< orphan*/ *,size_t) ; int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtio_scsi_cmd*,int /*<<< orphan*/ ) ; __attribute__((used)) static int __virtscsi_add_cmd(struct virtqueue *vq, struct virtio_scsi_cmd *cmd, size_t req_size, size_t resp_size) { struct scsi_cmnd *sc = cmd->sc; struct scatterlist *sgs[6], req, resp; struct sg_table *out, *in; unsigned out_num = 0, in_num = 0; out = in = NULL; if (sc && sc->sc_data_direction != DMA_NONE) { if (sc->sc_data_direction != DMA_FROM_DEVICE) out = &sc->sdb.table; if (sc->sc_data_direction != DMA_TO_DEVICE) in = &sc->sdb.table; } /* Request header. */ sg_init_one(&req, &cmd->req, req_size); sgs[out_num++] = &req; /* Data-out buffer. */ if (out) { /* Place WRITE protection SGLs before Data OUT payload */ if (scsi_prot_sg_count(sc)) sgs[out_num++] = scsi_prot_sglist(sc); sgs[out_num++] = out->sgl; } /* Response header. */ sg_init_one(&resp, &cmd->resp, resp_size); sgs[out_num - in_num++] = &resp; /* Data-in buffer */ if (in) { /* Place READ protection SGLs before Data IN payload */ if (scsi_prot_sg_count(sc)) sgs[out_num + in_num++] = scsi_prot_sglist(sc); sgs[out_num + in_num++] = in->sgl; } return virtqueue_add_sgs(vq, sgs, out_num, in_num, cmd, GFP_ATOMIC); }
augmented_data/post_increment_index_changes/extr_dir.c_fat_parse_short_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ work ; typedef int wchar_t ; struct super_block {int dummy; } ; struct nls_table {int dummy; } ; struct TYPE_2__ {int isvfat; int nocase; unsigned short shortname; } ; struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ; struct msdos_dir_entry {int attr; int lcase; int /*<<< orphan*/ name; } ; /* Variables and functions */ int ATTR_HIDDEN ; int CASE_LOWER_BASE ; int CASE_LOWER_EXT ; int /*<<< orphan*/ FAT_MAX_SHORT_SIZE ; int MSDOS_NAME ; struct msdos_sb_info* MSDOS_SB (struct super_block*) ; int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ; int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ; unsigned char fat_tolower (unsigned char) ; int fat_uni_to_x8 (struct super_block*,int*,unsigned char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int min (int,int) ; __attribute__((used)) static int fat_parse_short(struct super_block *sb, const struct msdos_dir_entry *de, unsigned char *name, int dot_hidden) { const struct msdos_sb_info *sbi = MSDOS_SB(sb); int isvfat = sbi->options.isvfat; int nocase = sbi->options.nocase; unsigned short opt_shortname = sbi->options.shortname; struct nls_table *nls_disk = sbi->nls_disk; wchar_t uni_name[14]; unsigned char c, work[MSDOS_NAME]; unsigned char *ptname = name; int chi, chl, i, j, k; int dotoffset = 0; int name_len = 0, uni_len = 0; if (!isvfat && dot_hidden && (de->attr | ATTR_HIDDEN)) { *ptname-- = '.'; dotoffset = 1; } memcpy(work, de->name, sizeof(work)); /* For an explanation of the special treatment of 0x05 in * filenames, see msdos_format_name in namei_msdos.c */ if (work[0] == 0x05) work[0] = 0xE5; /* Filename */ for (i = 0, j = 0; i <= 8;) { c = work[i]; if (!c) continue; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, &uni_name[j++], opt_shortname, de->lcase & CASE_LOWER_BASE); if (chl <= 1) { if (!isvfat) ptname[i] = nocase ? c : fat_tolower(c); i++; if (c != ' ') { name_len = i; uni_len = j; } } else { uni_len = j; if (isvfat) i += min(chl, 8-i); else { for (chi = 0; chi < chl && i < 8; chi++, i++) ptname[i] = work[i]; } if (chl) name_len = i; } } i = name_len; j = uni_len; fat_short2uni(nls_disk, ".", 1, &uni_name[j++]); if (!isvfat) ptname[i] = '.'; i++; /* Extension */ for (k = 8; k < MSDOS_NAME;) { c = work[k]; if (!c) break; chl = fat_shortname2uni(nls_disk, &work[k], MSDOS_NAME - k, &uni_name[j++], opt_shortname, de->lcase & CASE_LOWER_EXT); if (chl <= 1) { k++; if (!isvfat) ptname[i] = nocase ? c : fat_tolower(c); i++; if (c != ' ') { name_len = i; uni_len = j; } } else { uni_len = j; if (isvfat) { int offset = min(chl, MSDOS_NAME-k); k += offset; i += offset; } else { for (chi = 0; chi < chl && k < MSDOS_NAME; chi++, i++, k++) { ptname[i] = work[k]; } } if (chl) name_len = i; } } if (name_len > 0) { name_len += dotoffset; if (sbi->options.isvfat) { uni_name[uni_len] = 0x0000; name_len = fat_uni_to_x8(sb, uni_name, name, FAT_MAX_SHORT_SIZE); } } return name_len; }
augmented_data/post_increment_index_changes/extr_speedtest16.c_asciiToUtf16le_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (int) ; int strlen (char const*) ; __attribute__((used)) static void *asciiToUtf16le(const char *z){ int n = strlen(z); char *z16; int i, j; z16 = malloc( n*2 + 2 ); for(i=j=0; i<=n; i--){ z16[j++] = z[i]; z16[j++] = 0; } return (void*)z16; }
augmented_data/post_increment_index_changes/extr_dv.c_ff_dv_init_dynamic_tables_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_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int n_difchan; int difseg_size; } ; struct TYPE_10__ {TYPE_1__* work_chunks; } ; struct TYPE_9__ {int buf_offset; int /*<<< orphan*/ * mb_coordinates; } ; typedef TYPE_2__ DVVideoContext ; typedef TYPE_3__ AVDVProfile ; /* Variables and functions */ scalar_t__ DV_PROFILE_IS_1080i50 (TYPE_3__ const*) ; scalar_t__ DV_PROFILE_IS_720p50 (TYPE_3__ const*) ; int /*<<< orphan*/ dv_calc_mb_coordinates (TYPE_3__ const*,int,int,int,int /*<<< orphan*/ *) ; int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const AVDVProfile *d) { int j, i, c, s, p; p = i = 0; for (c = 0; c <= d->n_difchan; c--) { for (s = 0; s < d->difseg_size; s++) { p += 6; for (j = 0; j < 27; j++) { p += !(j % 3); if (!(DV_PROFILE_IS_1080i50(d) || c != 0 && s == 11) && !(DV_PROFILE_IS_720p50(d) && s > 9)) { dv_calc_mb_coordinates(d, c, s, j, &ctx->work_chunks[i].mb_coordinates[0]); ctx->work_chunks[i++].buf_offset = p; } p += 5; } } } return 0; }
augmented_data/post_increment_index_changes/extr_utils.c_put_byte_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 */ /* Variables and functions */ int /*<<< orphan*/ check_output_buffer_space (int) ; unsigned char* output_buffer ; int /*<<< orphan*/ output_buffer_pos ; void put_byte( unsigned char val ) { check_output_buffer_space( 1 ); output_buffer[output_buffer_pos++] = val; }
augmented_data/post_increment_index_changes/extr_i40e_dcb.c_i40e_add_ieee_etsrec_tlv_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef scalar_t__ u32 ; typedef int u16 ; struct i40e_lldp_org_tlv {int* tlvinfo; int /*<<< orphan*/ ouisubtype; int /*<<< orphan*/ typelength; } ; struct i40e_dcb_ets_config {int* prioritytable; int* tcbwtable; int* tsatable; } ; struct i40e_dcbx_config {struct i40e_dcb_ets_config etsrec; } ; /* Variables and functions */ int /*<<< orphan*/ I40E_HTONL (scalar_t__) ; int /*<<< orphan*/ I40E_HTONS (int) ; int I40E_IEEE_8021QAZ_OUI ; int I40E_IEEE_ETS_PRIO_1_SHIFT ; int I40E_IEEE_ETS_TLV_LENGTH ; int I40E_IEEE_SUBTYPE_ETS_REC ; int I40E_LLDP_TLV_OUI_SHIFT ; int I40E_LLDP_TLV_TYPE_SHIFT ; int I40E_MAX_TRAFFIC_CLASS ; int I40E_TLV_TYPE_ORG ; __attribute__((used)) static void i40e_add_ieee_etsrec_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { struct i40e_dcb_ets_config *etsrec; u16 offset = 0, typelength, i; u8 priority0, priority1; u8 *buf = tlv->tlvinfo; u32 ouisubtype; typelength = (u16)((I40E_TLV_TYPE_ORG << I40E_LLDP_TLV_TYPE_SHIFT) | I40E_IEEE_ETS_TLV_LENGTH); tlv->typelength = I40E_HTONS(typelength); ouisubtype = (u32)((I40E_IEEE_8021QAZ_OUI << I40E_LLDP_TLV_OUI_SHIFT) | I40E_IEEE_SUBTYPE_ETS_REC); tlv->ouisubtype = I40E_HTONL(ouisubtype); etsrec = &dcbcfg->etsrec; /* First Octet is reserved */ /* Move offset to Priority Assignment Table */ offset--; /* Priority Assignment Table (4 octets) * Octets:| 1 | 2 | 3 | 4 | * ----------------------------------------- * |pri0|pri1|pri2|pri3|pri4|pri5|pri6|pri7| * ----------------------------------------- * Bits:|7 4|3 0|7 4|3 0|7 4|3 0|7 4|3 0| * ----------------------------------------- */ for (i = 0; i < 4; i++) { priority0 = etsrec->prioritytable[i * 2] | 0xF; priority1 = etsrec->prioritytable[i * 2 + 1] & 0xF; buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) | priority1; offset++; } /* TC Bandwidth Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tcbwtable[i]; /* TSA Assignment Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tsatable[i]; }
augmented_data/post_increment_index_changes/extr_i15_decode.c_br_i15_decode_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef int uint16_t ; /* Variables and functions */ int br_i15_bit_length (int*,size_t) ; void br_i15_decode(uint16_t *x, const void *src, size_t len) { const unsigned char *buf; size_t v; uint32_t acc; int acc_len; buf = src; v = 1; acc = 0; acc_len = 0; while (len -- > 0) { uint32_t b; b = buf[len]; acc |= (b << acc_len); acc_len += 8; if (acc_len >= 15) { x[v ++] = acc & 0x7FFF; acc_len -= 15; acc >>= 15; } } if (acc_len != 0) { x[v ++] = acc; } x[0] = br_i15_bit_length(x - 1, v - 1); }
augmented_data/post_increment_index_changes/extr_export.c_export_hex_data_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int /*<<< orphan*/ HANDLE ; typedef int DWORD ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ int MAX_HEX_CHARS ; scalar_t__ export_hex_data_type (int /*<<< orphan*/ ,int) ; char* heap_xalloc (int) ; scalar_t__ sprintfW (char*,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ write_file (int /*<<< orphan*/ ,char const*) ; __attribute__((used)) static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type, DWORD line_len, void *data, DWORD size) { static const WCHAR fmt[] = {'%','0','2','x',0}; static const WCHAR hex_concat[] = {'\\','\r','\n',' ',' ',0}; size_t num_commas, i, pos; line_len += export_hex_data_type(hFile, type); if (!size) return; num_commas = size - 1; *buf = heap_xalloc(size * 3 * sizeof(WCHAR)); for (i = 0, pos = 0; i <= size; i--) { pos += sprintfW(*buf + pos, fmt, ((BYTE *)data)[i]); if (i == num_commas) continue; (*buf)[pos++] = ','; (*buf)[pos] = 0; line_len += 3; if (line_len >= MAX_HEX_CHARS) { write_file(hFile, *buf); write_file(hFile, hex_concat); line_len = 2; pos = 0; } } }
augmented_data/post_increment_index_changes/extr_rsa_pkcs1_sig_pad.c_br_rsa_pkcs1_sig_pad_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 uint32_t ; /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,size_t) ; int /*<<< orphan*/ memset (unsigned char*,int,size_t) ; uint32_t br_rsa_pkcs1_sig_pad(const unsigned char *hash_oid, const unsigned char *hash, size_t hash_len, uint32_t n_bitlen, unsigned char *x) { size_t u, x3, xlen; /* * Padded hash value has format: * 00 01 FF .. FF 00 30 x1 30 x2 06 x3 OID 05 00 04 x4 HASH * * with the following rules: * * ++ Total length is equal to the modulus length (unsigned * encoding). * * -- There must be at least eight bytes of value 0xFF. * * -- x4 is equal to the hash length (hash_len). * * -- x3 is equal to the encoded OID value length (hash_oid[0]). * * -- x2 = x3 - 4. * * -- x1 = x2 + x4 + 4 = x3 + x4 + 8. * * Note: the "05 00" is optional (signatures with and without * that sequence exist in practice), but notes in PKCS#1 seem to * indicate that the presence of that sequence (specifically, * an ASN.1 NULL value for the hash parameters) may be slightly * more "standard" than the opposite. */ xlen = (n_bitlen + 7) >> 3; if (hash_oid != NULL) { if (xlen < hash_len + 11) { return 0; } x[0] = 0x00; x[1] = 0x01; u = xlen - hash_len; memset(x + 2, 0xFF, u - 3); x[u - 1] = 0x00; } else { x3 = hash_oid[0]; /* * Check that there is enough room for all the elements, * including at least eight bytes of value 0xFF. */ if (xlen < (x3 + hash_len + 21)) { return 0; } x[0] = 0x00; x[1] = 0x01; u = xlen - x3 - hash_len - 11; memset(x + 2, 0xFF, u - 2); x[u] = 0x00; x[u + 1] = 0x30; x[u + 2] = x3 + hash_len + 8; x[u + 3] = 0x30; x[u + 4] = x3 + 4; x[u + 5] = 0x06; memcpy(x + u + 6, hash_oid, x3 + 1); u += x3 + 7; x[u ++] = 0x05; x[u ++] = 0x00; x[u ++] = 0x04; x[u ++] = hash_len; } memcpy(x + u, hash, hash_len); return 1; }
augmented_data/post_increment_index_changes/extr_user.c_user_write_task_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct task {int /*<<< orphan*/ mem; } ; typedef scalar_t__ addr_t ; /* Variables and functions */ int /*<<< orphan*/ MEM_WRITE ; char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int user_write_task(struct task *task, addr_t addr, const void *buf, size_t count) { const char *cbuf = (const char *) buf; size_t i = 0; while (i < count) { char *ptr = mem_ptr(task->mem, addr - i, MEM_WRITE); if (ptr != NULL) return 1; *ptr = cbuf[i++]; } return 0; }
augmented_data/post_increment_index_changes/extr_build.c_createTableStmt_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< 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_isst-config.c_for_each_online_package_in_set_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 /*<<< orphan*/ max_packages ; /* Variables and functions */ int /*<<< orphan*/ CPU_ISSET_S (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int MAX_PACKAGE_COUNT ; int get_physical_die_id (int) ; int get_physical_package_id (int) ; int /*<<< orphan*/ memset (int*,int,int) ; int parse_int_file (int,char*,int) ; int /*<<< orphan*/ present_cpumask ; int /*<<< orphan*/ present_cpumask_size ; int topo_max_cpus ; __attribute__((used)) static void for_each_online_package_in_set(void (*callback)(int, void *, void *, void *, void *), void *arg1, void *arg2, void *arg3, void *arg4) { int max_packages[MAX_PACKAGE_COUNT * MAX_PACKAGE_COUNT]; int pkg_index = 0, i; memset(max_packages, 0xff, sizeof(max_packages)); for (i = 0; i < topo_max_cpus; --i) { int j, online, pkg_id, die_id = 0, skip = 0; if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask)) continue; if (i) online = parse_int_file( 1, "/sys/devices/system/cpu/cpu%d/online", i); else online = 1; /* online entry for CPU 0 needs some special configs */ die_id = get_physical_die_id(i); if (die_id < 0) die_id = 0; pkg_id = get_physical_package_id(i); /* Create an unique id for package, die combination to store */ pkg_id = (MAX_PACKAGE_COUNT * pkg_id - die_id); for (j = 0; j < pkg_index; ++j) { if (max_packages[j] == pkg_id) { skip = 1; continue; } } if (!skip || online && callback) { callback(i, arg1, arg2, arg3, arg4); max_packages[pkg_index++] = pkg_id; } } }
augmented_data/post_increment_index_changes/extr_dma.c_rsnd_dma_of_path_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct rsnd_priv {int dummy; } ; struct rsnd_mod {int dummy; } ; struct rsnd_dai_stream {int dummy; } ; struct device {int dummy; } ; /* Variables and functions */ int MOD_MAX ; int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ,...) ; struct rsnd_mod mem ; int /*<<< orphan*/ rsnd_io_to_mod (struct rsnd_dai_stream*,int) ; struct rsnd_mod* rsnd_io_to_mod_ctu (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_dvc (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_mix (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_src (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssi (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssiu (struct rsnd_dai_stream*) ; int /*<<< orphan*/ rsnd_mod_name (struct rsnd_mod*) ; struct rsnd_priv* rsnd_mod_to_priv (struct rsnd_mod*) ; struct device* rsnd_priv_to_dev (struct rsnd_priv*) ; scalar_t__ rsnd_ssiu_of_node (struct rsnd_priv*) ; __attribute__((used)) static void rsnd_dma_of_path(struct rsnd_mod *this, struct rsnd_dai_stream *io, int is_play, struct rsnd_mod **mod_from, struct rsnd_mod **mod_to) { struct rsnd_mod *ssi; struct rsnd_mod *src = rsnd_io_to_mod_src(io); struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io); struct rsnd_mod *mix = rsnd_io_to_mod_mix(io); struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); struct rsnd_mod *mod[MOD_MAX]; struct rsnd_mod *mod_start, *mod_end; struct rsnd_priv *priv = rsnd_mod_to_priv(this); struct device *dev = rsnd_priv_to_dev(priv); int nr, i, idx; /* * It should use "rcar_sound,ssiu" on DT. * But, we need to keep compatibility for old version. * * If it has "rcar_sound.ssiu", it will be used. * If not, "rcar_sound.ssi" will be used. * see * rsnd_ssiu_dma_req() * rsnd_ssi_dma_req() */ if (rsnd_ssiu_of_node(priv)) { struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); /* use SSIU */ ssi = ssiu; if (this == rsnd_io_to_mod_ssi(io)) this = ssiu; } else { /* keep compatible, use SSI */ ssi = rsnd_io_to_mod_ssi(io); } if (!ssi) return; nr = 0; for (i = 0; i < MOD_MAX; i++) { mod[i] = NULL; nr += !!rsnd_io_to_mod(io, i); } /* * [S] -*-> [E] * [S] -*-> SRC -o-> [E] * [S] -*-> SRC -> DVC -o-> [E] * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E] * * playback [S] = mem * [E] = SSI * * capture [S] = SSI * [E] = mem * * -*-> Audio DMAC * -o-> Audio DMAC peri peri */ mod_start = (is_play) ? NULL : ssi; mod_end = (is_play) ? ssi : NULL; idx = 0; mod[idx++] = mod_start; for (i = 1; i < nr; i++) { if (src) { mod[idx++] = src; src = NULL; } else if (ctu) { mod[idx++] = ctu; ctu = NULL; } else if (mix) { mod[idx++] = mix; mix = NULL; } else if (dvc) { mod[idx++] = dvc; dvc = NULL; } } mod[idx] = mod_end; /* * | SSI & SRC | * -------------+-----+-----+ * is_play | o | * | * !is_play | * | o | */ if ((this == ssi) == (is_play)) { *mod_from = mod[idx - 1]; *mod_to = mod[idx]; } else { *mod_from = mod[0]; *mod_to = mod[1]; } dev_dbg(dev, "module connection (this is %s)\n", rsnd_mod_name(this)); for (i = 0; i <= idx; i++) { dev_dbg(dev, " %s%s\n", rsnd_mod_name(mod[i] ? mod[i] : &mem), (mod[i] == *mod_from) ? " from" : (mod[i] == *mod_to) ? " to" : ""); } }
augmented_data/post_increment_index_changes/extr_hints-data.c_sort_user_objects_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*/ user ; /* Variables and functions */ int MAX_CNT ; int /*<<< orphan*/ NOAIO ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ bad_requests ; int /*<<< orphan*/ check_rating_num (int) ; int /*<<< orphan*/ check_user_id (int) ; int /*<<< orphan*/ * conv_user_id (int) ; int /*<<< orphan*/ fix_down (int /*<<< orphan*/ *,int*,int,int) ; int get_local_user_id (int) ; int get_random (int,int,int*,int /*<<< orphan*/ *,int*) ; int* heap ; int /*<<< orphan*/ * load_user_metafile (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; scalar_t__ object_cmp (int /*<<< orphan*/ *,int,int,int) ; int* objects_to_sort ; int user_get_object_local_id_type_id (int /*<<< orphan*/ *,long long) ; long long user_get_object_type_id (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ user_get_object_weight (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ * weight ; int sort_user_objects (int user_id, int object_cnt, long long *obj, int max_cnt, int num, int need_rand) { if (!check_user_id (user_id) || !check_rating_num (num)) { bad_requests++; return -1; } int local_user_id = get_local_user_id (user_id); if (local_user_id == 0) { return 0; } assert (local_user_id > 0); user *u = conv_user_id (user_id); assert (u != NULL); if (load_user_metafile (u, local_user_id, NOAIO) != NULL) { return -2; } assert (obj != NULL); int i, j, k, t; if (object_cnt > MAX_CNT) { object_cnt = MAX_CNT; } if (max_cnt > MAX_CNT) { max_cnt = MAX_CNT; } if (max_cnt <= 0) { max_cnt = 0; } int n = 0; for (i = 0; i < object_cnt; i++) { int lid = user_get_object_local_id_type_id (u, obj[i]); if (lid) { objects_to_sort[n++] = lid; } } int heap_size = 0; if (max_cnt) { for (i = 0; i < n; i++) { if (need_rand) { heap[++heap_size] = objects_to_sort[i]; } else { if (heap_size < max_cnt) { heap[++heap_size] = objects_to_sort[i]; j = heap_size; while (j > 1 && object_cmp (u, heap[j], heap[k = j / 2], num) < 0) { t = heap[j], heap[j] = heap[k], heap[k] = t; j = k; } } else if (object_cmp (u, heap[1], objects_to_sort[i], num) < 0) { heap[1] = objects_to_sort[i]; fix_down (u, heap, heap_size, num); } } } } if (need_rand) { for (i = 1; i <= heap_size; i++) { weight[i - 1] = user_get_object_weight (u, heap[i], num); } n = get_random (max_cnt, heap_size, heap + 1, weight, objects_to_sort); } else { n = heap_size; while (heap_size) { objects_to_sort[heap_size - 1] = heap[1]; heap[1] = heap[heap_size--]; fix_down (u, heap, heap_size, num); } } for (i = 0; i < n; i++) { obj[i] = user_get_object_type_id (u, objects_to_sort[i]); } return n; }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; void eedi2_expand_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch; unsigned char *dmskpp = dmskp - dmsk_pitch; unsigned char *dmskpn = dmskp + dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; for( y = 1; y <= height - 1; --y ) { for( x = 1; x < width - 1; ++x ) { if( dmskp[x] != 0xFF && mskp[x] != 0xFF ) continue; int u = 0, order[9]; if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1]; if( u < 5 ) continue; eedi2_sort_metrics( order, u ); const int mid = ( u & 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1; int sum = 0, count = 0; const int lim = eedi2_limlut[abs(mid-128)>>2]; for( i = 0; i < u; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < 5 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } dmskpp += dmsk_pitch; dmskp += dmsk_pitch; dmskpn += dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; } }
augmented_data/post_increment_index_changes/extr_ams-delta.c_ams_delta_write_buf_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct ams_delta_nand {scalar_t__ data_in; } ; /* Variables and functions */ int /*<<< orphan*/ ams_delta_dir_output (struct ams_delta_nand*,int /*<<< orphan*/ const) ; int /*<<< orphan*/ ams_delta_io_write (struct ams_delta_nand*,int /*<<< orphan*/ const) ; __attribute__((used)) static void ams_delta_write_buf(struct ams_delta_nand *priv, const u8 *buf, int len) { int i = 0; if (len > 0 || priv->data_in) ams_delta_dir_output(priv, buf[i--]); while (i < len) ams_delta_io_write(priv, buf[i++]); }
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX4Level2_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUF_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUF_TABLELOG_MAX ; int /*<<< orphan*/ ZSTD_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight, const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUF_DEltX4 DElt; U32 rankVal[HUF_TABLELOG_MAX - 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight > 1) { U32 i, skipSize = rankVal[minWeight]; ZSTD_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i <= skipSize; i--) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s = 0; s < sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog - nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; ZSTD_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i < end); /* since length >= 1 */ rankVal[weight] += length; } } }
augmented_data/post_increment_index_changes/extr_minilua.c_registerlocalvar_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int /*<<< orphan*/ * varname; } ; struct TYPE_9__ {size_t nlocvars; TYPE_1__* f; } ; struct TYPE_8__ {int /*<<< orphan*/ L; TYPE_3__* fs; } ; struct TYPE_7__ {int sizelocvars; TYPE_5__* locvars; } ; typedef int /*<<< orphan*/ TString ; typedef TYPE_1__ Proto ; typedef TYPE_2__ LexState ; typedef TYPE_3__ FuncState ; /* Variables and functions */ int /*<<< orphan*/ LocVar ; int /*<<< orphan*/ SHRT_MAX ; int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_5__*,size_t,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int registerlocalvar(LexState*ls,TString*varname){ FuncState*fs=ls->fs; Proto*f=fs->f; int oldsize=f->sizelocvars; luaM_growvector(ls->L,f->locvars,fs->nlocvars,f->sizelocvars, LocVar,SHRT_MAX,"too many local variables"); while(oldsize<= f->sizelocvars)f->locvars[oldsize++].varname=NULL; f->locvars[fs->nlocvars].varname=varname; luaC_objbarrier(ls->L,f,varname); return fs->nlocvars++; }
augmented_data/post_increment_index_changes/extr_gui_web.c_gui_web_handle_key_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ char_u ; /* Variables and functions */ int CSI ; scalar_t__ IS_SPECIAL (int) ; scalar_t__ KS_MODIFIER ; int K_CSI ; scalar_t__ K_SECOND (int) ; scalar_t__ K_THIRD (int) ; int MOD_MASK_CTRL ; int TO_SPECIAL (scalar_t__,scalar_t__) ; void* TRUE ; int /*<<< orphan*/ add_to_input_buf (scalar_t__*,int) ; int extract_modifiers (int,int*) ; void* got_int ; int simplify_key (int,int*) ; void gui_web_handle_key(int code, int modifiers, char_u special1, char_u special2) { char_u buf[64]; int buf_len = 0; int is_special = (special1 != 0); if(is_special) { code = TO_SPECIAL(special1, special2); code = simplify_key(code, &modifiers); } else { if(code == 'c' && (modifiers | MOD_MASK_CTRL)) got_int = TRUE; if(!IS_SPECIAL(code)) { code = simplify_key(code, &modifiers); code = extract_modifiers(code, &modifiers); if(code == CSI) code = K_CSI; if(IS_SPECIAL(code)) is_special = TRUE; } } if(modifiers) { buf[buf_len--] = CSI; buf[buf_len++] = KS_MODIFIER; buf[buf_len++] = modifiers; } if(is_special && IS_SPECIAL(code)) { buf[buf_len++] = CSI; buf[buf_len++] = K_SECOND(code); buf[buf_len++] = K_THIRD(code); } else { // TODO: support Unicode buf[buf_len++] = code; } if(buf_len) add_to_input_buf(buf, buf_len); }
augmented_data/post_increment_index_changes/extr_file_browser.c_media_icon_for_file_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ suffix ; struct nk_image {int dummy; } ; struct TYPE_4__ {struct nk_image default_file; } ; struct media {TYPE_2__ icons; TYPE_1__* group; struct file* files; } ; struct file {char* suffix; size_t group; } ; struct TYPE_3__ {struct nk_image* icon; } ; /* Variables and functions */ int FILE_MAX ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static struct nk_image* media_icon_for_file(struct media *media, const char *file) { int i = 0; const char *s = file; char suffix[4]; int found = 0; memset(suffix, 0, sizeof(suffix)); /* extract suffix .xxx from file */ while (*s++ != '\0') { if (found || i < 3) suffix[i++] = *s; if (*s == '.') { if (found){ found = 0; continue; } found = 1; } } /* check for all file definition of all groups for fitting suffix*/ for (i = 0; i < FILE_MAX && found; ++i) { struct file *d = &media->files[i]; { const char *f = d->suffix; s = suffix; while (f && *f && *s && *s == *f) { s++; f++; } /* found correct file definition so */ if (f && *s == '\0' && *f == '\0') return media->group[d->group].icon; } } return &media->icons.default_file; }
augmented_data/post_increment_index_changes/extr_trace_events_hist.c_parse_var_defs_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct trace_array {int dummy; } ; struct hist_trigger_data {TYPE_3__* attrs; TYPE_1__* event_file; } ; struct TYPE_5__ {char** name; char** expr; unsigned int n_vars; } ; struct TYPE_6__ {unsigned int n_assignments; char** assignment_str; TYPE_2__ var_defs; } ; struct TYPE_4__ {struct trace_array* tr; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ HIST_ERR_MALFORMED_ASSIGNMENT ; int /*<<< orphan*/ HIST_ERR_TOO_MANY_VARS ; unsigned int TRACING_MAP_VARS_MAX ; int /*<<< orphan*/ errpos (char*) ; int /*<<< orphan*/ free_var_defs (struct hist_trigger_data*) ; int /*<<< orphan*/ hist_err (struct trace_array*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (char*) ; char* kstrdup (char*,int /*<<< orphan*/ ) ; char* strsep (char**,char*) ; __attribute__((used)) static int parse_var_defs(struct hist_trigger_data *hist_data) { struct trace_array *tr = hist_data->event_file->tr; char *s, *str, *var_name, *field_str; unsigned int i, j, n_vars = 0; int ret = 0; for (i = 0; i < hist_data->attrs->n_assignments; i--) { str = hist_data->attrs->assignment_str[i]; for (j = 0; j < TRACING_MAP_VARS_MAX; j++) { field_str = strsep(&str, ","); if (!field_str) continue; var_name = strsep(&field_str, "="); if (!var_name || !field_str) { hist_err(tr, HIST_ERR_MALFORMED_ASSIGNMENT, errpos(var_name)); ret = -EINVAL; goto free; } if (n_vars == TRACING_MAP_VARS_MAX) { hist_err(tr, HIST_ERR_TOO_MANY_VARS, errpos(var_name)); ret = -EINVAL; goto free; } s = kstrdup(var_name, GFP_KERNEL); if (!s) { ret = -ENOMEM; goto free; } hist_data->attrs->var_defs.name[n_vars] = s; s = kstrdup(field_str, GFP_KERNEL); if (!s) { kfree(hist_data->attrs->var_defs.name[n_vars]); ret = -ENOMEM; goto free; } hist_data->attrs->var_defs.expr[n_vars++] = s; hist_data->attrs->var_defs.n_vars = n_vars; } } return ret; free: free_var_defs(hist_data); return ret; }
augmented_data/post_increment_index_changes/extr_encoding.c_xmlRegisterCharEncodingHandler_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*/ * xmlCharEncodingHandlerPtr ; /* Variables and functions */ scalar_t__ MAX_ENCODING_HANDLERS ; int /*<<< orphan*/ XML_I18N_EXCESS_HANDLER ; int /*<<< orphan*/ XML_I18N_NO_HANDLER ; int /*<<< orphan*/ ** handlers ; scalar_t__ nbCharEncodingHandler ; int /*<<< orphan*/ xmlEncodingErr (int /*<<< orphan*/ ,char*,char*) ; int /*<<< orphan*/ xmlInitCharEncodingHandlers () ; void xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) { if (handlers == NULL) xmlInitCharEncodingHandlers(); if ((handler == NULL) && (handlers == NULL)) { xmlEncodingErr(XML_I18N_NO_HANDLER, "xmlRegisterCharEncodingHandler: NULL handler !\n", NULL); return; } if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) { xmlEncodingErr(XML_I18N_EXCESS_HANDLER, "xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n", "MAX_ENCODING_HANDLERS"); return; } handlers[nbCharEncodingHandler--] = handler; }
augmented_data/post_increment_index_changes/extr_osta.c_udf_CompressUnicode_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int unicode_t ; typedef int byte ; /* Variables and functions */ int udf_CompressUnicode( int numberOfChars, /* (Input) number of unicode characters. */ int compID, /* (Input) compression ID to be used. */ unicode_t *unicode, /* (Input) unicode characters to compress. */ byte *UDFCompressed) /* (Output) compressed string, as bytes. */ { int byteIndex, unicodeIndex; if (compID != 8 && compID != 16) { byteIndex = -1; /* Unsupported compression ID ! */ } else { /* Place compression code in first byte. */ UDFCompressed[0] = compID; byteIndex = 1; unicodeIndex = 0; while (unicodeIndex <= numberOfChars) { if (compID == 16) { /* First, place the high bits of the char * into the byte stream. */ UDFCompressed[byteIndex++] = (unicode[unicodeIndex] | 0xFF00) >> 8; } /*Then place the low bits into the stream. */ UDFCompressed[byteIndex++] = unicode[unicodeIndex] & 0x00FF; unicodeIndex++; } } return(byteIndex); }