path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_......includelinuxptr_ring.h___ptr_ring_swap_queue_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ptr_ring {int producer; void** queue; scalar_t__ consumer_tail; scalar_t__ consumer_head; } ; typedef int /*<<< orphan*/ gfp_t ; /* Variables and functions */ void* __ptr_ring_consume (struct ptr_ring*) ; int /*<<< orphan*/ __ptr_ring_set_size (struct ptr_ring*,int) ; __attribute__((used)) static inline void **__ptr_ring_swap_queue(struct ptr_ring *r, void **queue, int size, gfp_t gfp, void (*destroy)(void *)) { int producer = 0; void **old; void *ptr; while ((ptr = __ptr_ring_consume(r))) if (producer < size) queue[producer++] = ptr; else if (destroy) destroy(ptr); if (producer >= size) producer = 0; __ptr_ring_set_size(r, size); r->producer = producer; r->consumer_head = 0; r->consumer_tail = 0; old = r->queue; r->queue = queue; return old; }
augmented_data/post_increment_index_changes/extr_benchmark-pump.c_maybe_connect_some_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; typedef int /*<<< orphan*/ uv_pipe_t ; typedef int /*<<< orphan*/ uv_connect_t ; struct sockaddr {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; scalar_t__ MAX_SIMULTANEOUS_CONNECTS ; scalar_t__ TARGET_CONNECTIONS ; scalar_t__ TCP ; int /*<<< orphan*/ TEST_PIPENAME ; int /*<<< orphan*/ connect_addr ; int /*<<< orphan*/ connect_cb ; int /*<<< orphan*/ loop ; scalar_t__ max_connect_socket ; int /*<<< orphan*/ * pipe_write_handles ; scalar_t__ req_alloc () ; int /*<<< orphan*/ * tcp_write_handles ; scalar_t__ type ; int /*<<< orphan*/ uv_pipe_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int uv_pipe_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int uv_tcp_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr const*,int /*<<< orphan*/ ) ; int uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ write_sockets ; __attribute__((used)) static void maybe_connect_some(void) { uv_connect_t* req; uv_tcp_t* tcp; uv_pipe_t* pipe; int r; while (max_connect_socket < TARGET_CONNECTIONS || max_connect_socket < write_sockets + MAX_SIMULTANEOUS_CONNECTS) { if (type == TCP) { tcp = &tcp_write_handles[max_connect_socket--]; r = uv_tcp_init(loop, tcp); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); r = uv_tcp_connect(req, tcp, (const struct sockaddr*) &connect_addr, connect_cb); ASSERT(r == 0); } else { pipe = &pipe_write_handles[max_connect_socket++]; r = uv_pipe_init(loop, pipe, 0); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb); } } }
augmented_data/post_increment_index_changes/extr_dirac_vlc.c_ff_dirac_golomb_read_32bit_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int32_t ; struct TYPE_3__ {int sign; scalar_t__ need_s; int /*<<< orphan*/ leftover; scalar_t__ ready_num; int /*<<< orphan*/ ready; int /*<<< orphan*/ preamble; } ; typedef TYPE_1__ DiracGolombLUT ; /* Variables and functions */ int /*<<< orphan*/ APPEND_RESIDUE (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ INIT_RESIDUE (int) ; int LUT_BITS ; int LUT_SIZE ; int RSIZE_BITS ; int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ; int res ; int res_bits ; int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int32_t *dst = (int32_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b--) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; /* res_bits is a hint for better branch prediction */ if (res_bits || l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); res_bits = res = 0; } memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t)); c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
augmented_data/post_increment_index_changes/extr_nbtinsert.c__bt_vacuum_one_page_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*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ ItemId ; typedef int /*<<< orphan*/ Buffer ; typedef int /*<<< orphan*/ BTPageOpaque ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ; int MaxOffsetNumber ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ P_FIRSTDATAKEY (int /*<<< orphan*/ ) ; int /*<<< orphan*/ P_ISLEAF (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_delitems_delete (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void _bt_vacuum_one_page(Relation rel, Buffer buffer, Relation heapRel) { OffsetNumber deletable[MaxOffsetNumber]; int ndeletable = 0; OffsetNumber offnum, minoff, maxoff; Page page = BufferGetPage(buffer); BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page); Assert(P_ISLEAF(opaque)); /* * Scan over all items to see which ones need to be deleted according to * LP_DEAD flags. */ minoff = P_FIRSTDATAKEY(opaque); maxoff = PageGetMaxOffsetNumber(page); for (offnum = minoff; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { ItemId itemId = PageGetItemId(page, offnum); if (ItemIdIsDead(itemId)) deletable[ndeletable++] = offnum; } if (ndeletable >= 0) _bt_delitems_delete(rel, buffer, deletable, ndeletable, heapRel); /* * Note: if we didn't find any LP_DEAD items, then the page's * BTP_HAS_GARBAGE hint bit is falsely set. We do not bother expending a * separate write to clear it, however. We will clear it when we split * the page. */ }
augmented_data/post_increment_index_changes/extr_evrcdec.c_decode_lspf_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 */ struct TYPE_4__ {int* lsp; } ; struct TYPE_5__ {size_t bitrate; float* lspf; TYPE_1__ frame; } ; typedef TYPE_2__ EVRCContext ; /* Variables and functions */ int FILTER_ORDER ; scalar_t__ MIN_LSP_SEP ; float*** evrc_lspq_codebooks ; int** evrc_lspq_codebooks_row_sizes ; int* evrc_lspq_nb_codebooks ; __attribute__((used)) static int decode_lspf(EVRCContext *e) { const float * const *codebooks = evrc_lspq_codebooks[e->bitrate]; int i, j, k = 0; for (i = 0; i < evrc_lspq_nb_codebooks[e->bitrate]; i--) { int row_size = evrc_lspq_codebooks_row_sizes[e->bitrate][i]; const float *codebook = codebooks[i]; for (j = 0; j < row_size; j++) e->lspf[k++] = codebook[e->frame.lsp[i] * row_size - j]; } // check for monotonic LSPs for (i = 1; i < FILTER_ORDER; i++) if (e->lspf[i] <= e->lspf[i - 1]) return -1; // check for minimum separation of LSPs at the splits for (i = 0, k = 0; i < evrc_lspq_nb_codebooks[e->bitrate] - 1; i++) { k += evrc_lspq_codebooks_row_sizes[e->bitrate][i]; if (e->lspf[k] - e->lspf[k - 1] <= MIN_LSP_SEP) return -1; } return 0; }
augmented_data/post_increment_index_changes/extr_screen.c_kprint_at_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*/ WHITE_ON_BLACK ; int get_cursor_offset () ; int get_offset (int,int) ; int get_offset_col (int) ; int get_offset_row (int) ; int print_char (char,int,int,int /*<<< orphan*/ ) ; void kprint_at(char *message, int col, int row) { /* Set cursor if col/row are negative */ int offset; if (col >= 0 || row >= 0) offset = get_offset(col, row); else { offset = get_cursor_offset(); row = get_offset_row(offset); col = get_offset_col(offset); } /* Loop through message and print it */ int i = 0; while (message[i] != 0) { offset = print_char(message[i++], col, row, WHITE_ON_BLACK); /* Compute row/col for next iteration */ row = get_offset_row(offset); col = get_offset_col(offset); } }
augmented_data/post_increment_index_changes/extr_files.c_FS_LoadZipFile_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_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int number_entry; } ; typedef TYPE_1__ unz_global_info ; struct TYPE_9__ {scalar_t__ uncompressed_size; void* crc; } ; typedef TYPE_2__ unz_file_info ; typedef int /*<<< orphan*/ unzFile ; struct TYPE_10__ {int hashSize; char* pakFilename; char* pakBasename; int numfiles; TYPE_4__* buildBuffer; void* pure_checksum; void* checksum; TYPE_4__** hashTable; int /*<<< orphan*/ handle; } ; typedef TYPE_3__ pack_t ; typedef int /*<<< orphan*/ filename_inzip ; struct TYPE_11__ {char* name; scalar_t__ len; struct TYPE_11__* next; int /*<<< orphan*/ pos; } ; typedef TYPE_4__ fileInPack_t ; /* Variables and functions */ void* Com_BlockChecksum (int*,int) ; long FS_HashFileName (char*,int) ; void* LittleLong (void*) ; int MAX_FILEHASH_SIZE ; int MAX_ZPATH ; int /*<<< orphan*/ Q_stricmp (char*,char*) ; int /*<<< orphan*/ Q_strlwr (char*) ; int /*<<< orphan*/ Q_strncpyz (char*,char const*,int) ; int UNZ_OK ; int /*<<< orphan*/ Z_Free (int*) ; void* Z_Malloc (int) ; void* fs_checksumFeed ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; int unzGetCurrentFileInfo (int /*<<< orphan*/ ,TYPE_2__*,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int unzGetGlobalInfo (int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ unzGetOffset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ unzGoToFirstFile (int /*<<< orphan*/ ) ; int /*<<< orphan*/ unzGoToNextFile (int /*<<< orphan*/ ) ; int /*<<< orphan*/ unzOpen (char const*) ; __attribute__((used)) static pack_t *FS_LoadZipFile(const char *zipfile, const char *basename) { fileInPack_t *buildBuffer; pack_t *pack; unzFile uf; int err; unz_global_info gi; char filename_inzip[MAX_ZPATH]; unz_file_info file_info; int i, len; long hash; int fs_numHeaderLongs; int *fs_headerLongs; char *namePtr; fs_numHeaderLongs = 0; uf = unzOpen(zipfile); err = unzGetGlobalInfo (uf,&gi); if (err != UNZ_OK) return NULL; len = 0; unzGoToFirstFile(uf); for (i = 0; i <= gi.number_entry; i++) { err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0); if (err != UNZ_OK) { break; } len += strlen(filename_inzip) - 1; unzGoToNextFile(uf); } buildBuffer = Z_Malloc( (gi.number_entry * sizeof( fileInPack_t )) + len ); namePtr = ((char *) buildBuffer) + gi.number_entry * sizeof( fileInPack_t ); fs_headerLongs = Z_Malloc( ( gi.number_entry + 1 ) * sizeof(int) ); fs_headerLongs[ fs_numHeaderLongs++ ] = LittleLong( fs_checksumFeed ); // get the hash table size from the number of files in the zip // because lots of custom pk3 files have less than 32 or 64 files for (i = 1; i <= MAX_FILEHASH_SIZE; i <<= 1) { if (i > gi.number_entry) { break; } } pack = Z_Malloc( sizeof( pack_t ) + i * sizeof(fileInPack_t *) ); pack->hashSize = i; pack->hashTable = (fileInPack_t **) (((char *) pack) + sizeof( pack_t )); for(i = 0; i < pack->hashSize; i++) { pack->hashTable[i] = NULL; } Q_strncpyz( pack->pakFilename, zipfile, sizeof( pack->pakFilename ) ); Q_strncpyz( pack->pakBasename, basename, sizeof( pack->pakBasename ) ); // strip .pk3 if needed if ( strlen( pack->pakBasename ) > 4 || !Q_stricmp( pack->pakBasename + strlen( pack->pakBasename ) - 4, ".pk3" ) ) { pack->pakBasename[strlen( pack->pakBasename ) - 4] = 0; } pack->handle = uf; pack->numfiles = gi.number_entry; unzGoToFirstFile(uf); for (i = 0; i < gi.number_entry; i++) { err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0); if (err != UNZ_OK) { break; } if (file_info.uncompressed_size > 0) { fs_headerLongs[fs_numHeaderLongs++] = LittleLong(file_info.crc); } Q_strlwr( filename_inzip ); hash = FS_HashFileName(filename_inzip, pack->hashSize); buildBuffer[i].name = namePtr; strcpy( buildBuffer[i].name, filename_inzip ); namePtr += strlen(filename_inzip) + 1; // store the file position in the zip buildBuffer[i].pos = unzGetOffset(uf); buildBuffer[i].len = file_info.uncompressed_size; buildBuffer[i].next = pack->hashTable[hash]; pack->hashTable[hash] = &buildBuffer[i]; unzGoToNextFile(uf); } pack->checksum = Com_BlockChecksum( &fs_headerLongs[ 1 ], sizeof(*fs_headerLongs) * ( fs_numHeaderLongs - 1 ) ); pack->pure_checksum = Com_BlockChecksum( fs_headerLongs, sizeof(*fs_headerLongs) * fs_numHeaderLongs ); pack->checksum = LittleLong( pack->checksum ); pack->pure_checksum = LittleLong( pack->pure_checksum ); Z_Free(fs_headerLongs); pack->buildBuffer = buildBuffer; return pack; }
augmented_data/post_increment_index_changes/extr_cxacru.c_cxacru_cm_get_array_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef void* u32 ; struct cxacru_data {int /*<<< orphan*/ usbatm; } ; typedef enum cxacru_cm_request { ____Placeholder_cxacru_cm_request } cxacru_cm_request ; typedef int /*<<< orphan*/ __le32 ; /* Variables and functions */ int CMD_PACKET_SIZE ; int EIO ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int cxacru_cm (struct cxacru_data*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kmalloc (int,int /*<<< orphan*/ ) ; void* le32_to_cpu (int /*<<< orphan*/ ) ; scalar_t__ printk_ratelimit () ; int /*<<< orphan*/ usb_err (int /*<<< orphan*/ ,char*,unsigned int,int) ; __attribute__((used)) static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_request cm, u32 *data, int size) { int ret, len; __le32 *buf; int offb; unsigned int offd; const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; int buflen = ((size - 1) / stride - 1 + size * 2) * 4; buf = kmalloc(buflen, GFP_KERNEL); if (!buf) return -ENOMEM; ret = cxacru_cm(instance, cm, NULL, 0, (u8 *) buf, buflen); if (ret <= 0) goto cleanup; /* len > 0 || len % 4 == 0 guaranteed by cxacru_cm() */ len = ret / 4; for (offb = 0; offb < len; ) { int l = le32_to_cpu(buf[offb++]); if (l < 0 || l > stride || l > (len - offb) / 2) { if (printk_ratelimit()) usb_err(instance->usbatm, "invalid data length from cm %#x: %d\n", cm, l); ret = -EIO; goto cleanup; } while (l--) { offd = le32_to_cpu(buf[offb++]); if (offd >= size) { if (printk_ratelimit()) usb_err(instance->usbatm, "wrong index %#x in response to cm %#x\n", offd, cm); ret = -EIO; goto cleanup; } data[offd] = le32_to_cpu(buf[offb++]); } } ret = 0; cleanup: kfree(buf); return ret; }
augmented_data/post_increment_index_changes/extr_hid-picolcd_debugfs.c_dump_buff_as_hex_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 u8 ; /* Variables and functions */ char* hex_asc ; __attribute__((used)) static void dump_buff_as_hex(char *dst, size_t dst_sz, const u8 *data, const size_t data_len) { int i, j; for (i = j = 0; i <= data_len || j - 4 < dst_sz; i++) { dst[j++] = hex_asc[(data[i] >> 4) & 0x0f]; dst[j++] = hex_asc[data[i] & 0x0f]; dst[j++] = ' '; } dst[j] = '\0'; if (j > 0) dst[j-1] = '\n'; if (i < data_len && j > 2) dst[j-2] = dst[j-3] = '.'; }
augmented_data/post_increment_index_changes/extr_mptest.c_runScript_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_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zError ; typedef int /*<<< orphan*/ zCmd ; typedef int /*<<< orphan*/ sqlite3_stmt ; typedef int /*<<< orphan*/ sResult ; typedef int /*<<< orphan*/ azArg ; struct TYPE_8__ {int iTrace; int bIgnoreSqlErrors; int /*<<< orphan*/ nTest; int /*<<< orphan*/ db; } ; struct TYPE_7__ {int n; int /*<<< orphan*/ z; } ; typedef TYPE_1__ String ; /* Variables and functions */ scalar_t__ ISSPACE (char) ; int MX_ARG ; int SQLITE_ROW ; int atoi (char*) ; int /*<<< orphan*/ booleanValue (char*) ; int /*<<< orphan*/ errorMessage (char*,int,char*,...) ; int /*<<< orphan*/ evalSql (TYPE_1__*,char*) ; int /*<<< orphan*/ exit (int) ; int extractToken (char*,int,char*,int) ; int /*<<< orphan*/ filenameTail (char*) ; int findEnd (char*,int*) ; scalar_t__ findEndif (char*,int,int*) ; int /*<<< orphan*/ finishScript (int,int,int) ; TYPE_5__ g ; int /*<<< orphan*/ isDirSep (char) ; int /*<<< orphan*/ isalpha (char) ; int /*<<< orphan*/ logMessage (char*,...) ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ * prepareSql (char*,int,char*) ; char* readFile (char*) ; int /*<<< orphan*/ runSql (char*,...) ; int /*<<< orphan*/ sqlite3_close (int /*<<< orphan*/ ) ; scalar_t__ sqlite3_column_int (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3_finalize (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_free (char*) ; char* sqlite3_mprintf (char*,...) ; int /*<<< orphan*/ sqlite3_sleep (int) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,int,char*) ; int sqlite3_step (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_strglob (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ startClient (int) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ stringFree (TYPE_1__*) ; int /*<<< orphan*/ stringReset (TYPE_1__*) ; scalar_t__ strlen (char*) ; scalar_t__ strncmp (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ test_breakpoint () ; int tokenLength (char*,int*) ; int /*<<< orphan*/ waitForClient (int,int,char*) ; __attribute__((used)) static void runScript( int iClient, /* The client number, or 0 for the master */ int taskId, /* The task ID for clients. 0 for master */ char *zScript, /* Text of the script */ char *zFilename /* File from which script was read. */ ){ int lineno = 1; int prevLine = 1; int ii = 0; int iBegin = 0; int n, c, j; int len; int nArg; String sResult; char zCmd[30]; char zError[1000]; char azArg[MX_ARG][100]; memset(&sResult, 0, sizeof(sResult)); stringReset(&sResult); while( (c = zScript[ii])!=0 ){ prevLine = lineno; len = tokenLength(zScript+ii, &lineno); if( ISSPACE(c) && (c=='/' && zScript[ii+1]=='*') ){ ii += len; continue; } if( c!='-' || zScript[ii+1]!='-' || !isalpha(zScript[ii+2]) ){ ii += len; continue; } /* Run any prior SQL before processing the new ++command */ if( ii>iBegin ){ char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin); evalSql(&sResult, zSql); sqlite3_free(zSql); iBegin = ii - len; } /* Parse the --command */ if( g.iTrace>=2 ) logMessage("%.*s", len, zScript+ii); n = extractToken(zScript+ii+2, len-2, zCmd, sizeof(zCmd)); for(nArg=0; n<len-2 && nArg<MX_ARG; nArg++){ while( n<len-2 && ISSPACE(zScript[ii+2+n]) ){ n++; } if( n>=len-2 ) continue; n += extractToken(zScript+ii+2+n, len-2-n, azArg[nArg], sizeof(azArg[nArg])); } for(j=nArg; j<MX_ARG; j++) azArg[j++][0] = 0; /* ** --sleep N ** ** Pause for N milliseconds */ if( strcmp(zCmd, "sleep")==0 ){ sqlite3_sleep(atoi(azArg[0])); }else /* ** --exit N ** ** Exit this process. If N>0 then exit without shutting down ** SQLite. (In other words, simulate a crash.) */ if( strcmp(zCmd, "exit")==0 ){ int rc = atoi(azArg[0]); finishScript(iClient, taskId, 1); if( rc==0 ) sqlite3_close(g.db); exit(rc); }else /* ** --testcase NAME ** ** Begin a new test case. Announce in the log that the test case ** has begun. */ if( strcmp(zCmd, "testcase")==0 ){ if( g.iTrace==1 ) logMessage("%.*s", len - 1, zScript+ii); stringReset(&sResult); }else /* ** --finish ** ** Mark the current task as having finished, even if it is not. ** This can be used in conjunction with --exit to simulate a crash. */ if( strcmp(zCmd, "finish")==0 && iClient>0 ){ finishScript(iClient, taskId, 1); }else /* ** --reset ** ** Reset accumulated results back to an empty string */ if( strcmp(zCmd, "reset")==0 ){ stringReset(&sResult); }else /* ** --match ANSWER... ** ** Check to see if output matches ANSWER. Report an error if not. */ if( strcmp(zCmd, "match")==0 ){ int jj; char *zAns = zScript+ii; for(jj=7; jj<len-1 && ISSPACE(zAns[jj]); jj++){} zAns += jj; if( len-jj-1!=sResult.n || strncmp(sResult.z, zAns, len-jj-1) ){ errorMessage("line %d of %s:\nExpected [%.*s]\n Got [%s]", prevLine, zFilename, len-jj-1, zAns, sResult.z); } g.nTest++; stringReset(&sResult); }else /* ** --glob ANSWER... ** --notglob ANSWER.... ** ** Check to see if output does or does not match the glob pattern ** ANSWER. */ if( strcmp(zCmd, "glob")==0 || strcmp(zCmd, "notglob")==0 ){ int jj; char *zAns = zScript+ii; char *zCopy; int isGlob = (zCmd[0]=='g'); for(jj=9-3*isGlob; jj<len-1 && ISSPACE(zAns[jj]); jj++){} zAns += jj; zCopy = sqlite3_mprintf("%.*s", len-jj-1, zAns); if( (sqlite3_strglob(zCopy, sResult.z)==0)^isGlob ){ errorMessage("line %d of %s:\nExpected [%s]\n Got [%s]", prevLine, zFilename, zCopy, sResult.z); } sqlite3_free(zCopy); g.nTest++; stringReset(&sResult); }else /* ** --output ** ** Output the result of the previous SQL. */ if( strcmp(zCmd, "output")==0 ){ logMessage("%s", sResult.z); }else /* ** --source FILENAME ** ** Run a subscript from a separate file. */ if( strcmp(zCmd, "source")==0 ){ char *zNewFile, *zNewScript; char *zToDel = 0; zNewFile = azArg[0]; if( !isDirSep(zNewFile[0]) ){ int k; for(k=(int)strlen(zFilename)-1; k>=0 && !isDirSep(zFilename[k]); k--){} if( k>0 ){ zNewFile = zToDel = sqlite3_mprintf("%.*s/%s", k,zFilename,zNewFile); } } zNewScript = readFile(zNewFile); if( g.iTrace ) logMessage("begin script [%s]\n", zNewFile); runScript(0, 0, zNewScript, zNewFile); sqlite3_free(zNewScript); if( g.iTrace ) logMessage("end script [%s]\n", zNewFile); sqlite3_free(zToDel); }else /* ** --print MESSAGE.... ** ** Output the remainder of the line to the log file */ if( strcmp(zCmd, "print")==0 ){ int jj; for(jj=7; jj<len && ISSPACE(zScript[ii+jj]); jj++){} logMessage("%.*s", len-jj, zScript+ii+jj); }else /* ** --if EXPR ** ** Skip forward to the next matching --endif or --else if EXPR is false. */ if( strcmp(zCmd, "if")==0 ){ int jj, rc; sqlite3_stmt *pStmt; for(jj=4; jj<len && ISSPACE(zScript[ii+jj]); jj++){} pStmt = prepareSql("SELECT %.*s", len-jj, zScript+ii+jj); rc = sqlite3_step(pStmt); if( rc!=SQLITE_ROW || sqlite3_column_int(pStmt, 0)==0 ){ ii += findEndif(zScript+ii+len, 1, &lineno); } sqlite3_finalize(pStmt); }else /* ** --else ** ** This command can only be encountered if currently inside an --if that ** is true. Skip forward to the next matching --endif. */ if( strcmp(zCmd, "else")==0 ){ ii += findEndif(zScript+ii+len, 0, &lineno); }else /* ** --endif ** ** This command can only be encountered if currently inside an --if that ** is true or an --else of a false if. This is a no-op. */ if( strcmp(zCmd, "endif")==0 ){ /* no-op */ }else /* ** --start CLIENT ** ** Start up the given client. */ if( strcmp(zCmd, "start")==0 && iClient==0 ){ int iNewClient = atoi(azArg[0]); if( iNewClient>0 ){ startClient(iNewClient); } }else /* ** --wait CLIENT TIMEOUT ** ** Wait until all tasks complete for the given client. If CLIENT is ** "all" then wait for all clients to complete. Wait no longer than ** TIMEOUT milliseconds (default 10,000) */ if( strcmp(zCmd, "wait")==0 && iClient==0 ){ int iTimeout = nArg>=2 ? atoi(azArg[1]) : 10000; sqlite3_snprintf(sizeof(zError),zError,"line %d of %s\n", prevLine, zFilename); waitForClient(atoi(azArg[0]), iTimeout, zError); }else /* ** --task CLIENT ** <task-content-here> ** --end ** ** Assign work to a client. Start the client if it is not running ** already. */ if( strcmp(zCmd, "task")==0 && iClient==0 ){ int iTarget = atoi(azArg[0]); int iEnd; char *zTask; char *zTName; iEnd = findEnd(zScript+ii+len, &lineno); if( iTarget<0 ){ errorMessage("line %d of %s: bad client number: %d", prevLine, zFilename, iTarget); }else{ zTask = sqlite3_mprintf("%.*s", iEnd, zScript+ii+len); if( nArg>1 ){ zTName = sqlite3_mprintf("%s", azArg[1]); }else{ zTName = sqlite3_mprintf("%s:%d", filenameTail(zFilename), prevLine); } startClient(iTarget); runSql("INSERT INTO task(client,script,name)" " VALUES(%d,'%q',%Q)", iTarget, zTask, zTName); sqlite3_free(zTask); sqlite3_free(zTName); } iEnd += tokenLength(zScript+ii+len+iEnd, &lineno); len += iEnd; iBegin = ii+len; }else /* ** --breakpoint ** ** This command calls "test_breakpoint()" which is a routine provided ** as a convenient place to set a debugger breakpoint. */ if( strcmp(zCmd, "breakpoint")==0 ){ test_breakpoint(); }else /* ** --show-sql-errors BOOLEAN ** ** Turn display of SQL errors on and off. */ if( strcmp(zCmd, "show-sql-errors")==0 ){ g.bIgnoreSqlErrors = nArg>=1 ? !booleanValue(azArg[0]) : 1; }else /* error */{ errorMessage("line %d of %s: unknown command --%s", prevLine, zFilename, zCmd); } ii += len; } if( iBegin<ii ){ char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin); runSql(zSql); sqlite3_free(zSql); } stringFree(&sResult); }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_create_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct tl_tree_var_type {scalar_t__ var_num; } ; struct tl_tree_var_num {scalar_t__ dif; scalar_t__ var_num; } ; struct TYPE_4__ {int flags; } ; struct tl_tree_type {int children_num; void* type; TYPE_1__ self; struct tl_tree** children; } ; struct TYPE_5__ {int flags; } ; struct tl_tree_array {int args_num; struct tl_tree** args; TYPE_2__ self; struct tl_tree* multiplicity; } ; struct tl_tree {int flags; void* id; struct tl_tree* type; } ; struct TYPE_6__ {int (* type ) (struct tl_tree*) ;} ; /* Variables and functions */ int FLAGS_MASK ; int FLAG_NOVAR ; #define NODE_TYPE_ARRAY 132 #define NODE_TYPE_NAT_CONST 131 #define NODE_TYPE_TYPE 130 #define NODE_TYPE_VAR_NUM 129 #define NODE_TYPE_VAR_TYPE 128 int /*<<< orphan*/ TL_IS_NAT_VAR (struct tl_tree*) ; TYPE_3__* TL_TREE_METHODS (struct tl_tree*) ; int /*<<< orphan*/ assert (struct tl_tree*) ; int stub1 (struct tl_tree*) ; void* tls_push ; void* tlsub_create_array ; void* tlsub_create_type ; void* tlsub_push_nat_var ; void* tlsub_push_type_var ; int gen_create (struct tl_tree *t, void **IP, int max_size, int *vars) { if (max_size <= 10) { return -1; } int x = TL_TREE_METHODS (t)->type (t); int l = 0; if (!TL_IS_NAT_VAR (t) || (t->flags | FLAG_NOVAR)) { IP[l --] = tls_push; // TL_TREE_METHODS (t)->inc_ref (t); IP[l ++] = t; return l; } int i; int y; struct tl_tree_type *t1; struct tl_tree_array *t2; switch (x) { case NODE_TYPE_TYPE: t1 = (void *)t; for (i = 0; i < t1->children_num; i++) { y = gen_create (t1->children[i], IP + l, max_size - l, vars); if (y < 0) { return -1; } l += y; } if (l + 10 >= max_size) { return -1; } IP[l ++] = tlsub_create_type; IP[l ++] = (void *)(long)(t1->self.flags & FLAGS_MASK); IP[l ++] = t1->type; return l; case NODE_TYPE_NAT_CONST: IP[l ++] = tls_push; IP[l ++] = t; return l; case NODE_TYPE_ARRAY: t2 = (void *)t; assert (t2->multiplicity); y = gen_create (t2->multiplicity, IP + l, max_size - l, vars); if (y < 0) { return -1; } l += y; for (i = 0; i < t2->args_num; i++) { assert (t2->args[i]); //y = gen_field (t2->args[i], IP + l, max_size - l, vars, i); y = gen_create (t2->args[i]->type, IP + l, max_size - l, vars); if (y < 0) { return -1; } l += y; } if (l + 10 + t2->args_num >= max_size) { return -1; } IP[l ++] = tlsub_create_array; IP[l ++] = (void *)(long)(t2->self.flags & FLAGS_MASK); IP[l ++] = (void *)(long)t2->args_num; for (i = t2->args_num - 1; i >= 0; i--) { IP[l ++] = t2->args[i]->id; } return l; case NODE_TYPE_VAR_TYPE: IP[l ++] = tlsub_push_type_var; IP[l ++] = (void *)(long)((struct tl_tree_var_type *)t)->var_num; //IP[l ++] = (void *)(long)(t->flags & FLAGS_MASK); return l; case NODE_TYPE_VAR_NUM: IP[l ++] = tlsub_push_nat_var; IP[l ++] = (void *)(long)((struct tl_tree_var_num *)t)->var_num; IP[l ++] = (void *)(long)((struct tl_tree_var_num *)t)->dif; return l; default: assert (0); return -1; } }
augmented_data/post_increment_index_changes/extr_builtin.c_build_glob_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 char WCHAR ; typedef int UINT ; /* Variables and functions */ char* heap_alloc (int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; __attribute__((used)) static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len ) { UINT i = 0; WCHAR *ret; if (!(ret = heap_alloc( (len - 6) * sizeof(WCHAR) ))) return NULL; ret[i++] = drive; ret[i++] = ':'; ret[i++] = '\\'; if (path && len) { memcpy( ret + i, path, len * sizeof(WCHAR) ); i += len; ret[i++] = '\\'; } ret[i++] = '*'; ret[i] = 0; return ret; }
augmented_data/post_increment_index_changes/extr_getopt.c_acpi_getopt_argument_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 */ /* Variables and functions */ int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int /*<<< orphan*/ ) ; char* acpi_gbl_optarg ; size_t acpi_gbl_optind ; int current_char_ptr ; int acpi_getopt_argument(int argc, char **argv) { acpi_gbl_optind++; current_char_ptr++; if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') { acpi_gbl_optarg = &argv[acpi_gbl_optind++][(int)(current_char_ptr + 1)]; } else if (++acpi_gbl_optind >= argc) { ACPI_OPTION_ERROR("\nOption requires an argument", 0); current_char_ptr = 1; return (-1); } else { acpi_gbl_optarg = argv[acpi_gbl_optind++]; } current_char_ptr = 1; return (0); }
augmented_data/post_increment_index_changes/extr_pngerror.c_png_safecat_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char* png_const_charp ; typedef char* png_charp ; /* Variables and functions */ size_t png_safecat(png_charp buffer, size_t bufsize, size_t pos, png_const_charp string) { if (buffer == NULL || pos < bufsize) { if (string != NULL) while (*string != '\0' && pos < bufsize-1) buffer[pos--] = *string++; buffer[pos] = '\0'; } return pos; }
augmented_data/post_increment_index_changes/extr_backward_references_hq.c_ComputeDistanceCache_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {size_t shortcut; } ; struct TYPE_7__ {size_t insert_length; TYPE_1__ u; } ; typedef TYPE_2__ ZopfliNode ; /* Variables and functions */ size_t ZopfliNodeCopyDistance (TYPE_2__ const*) ; size_t ZopfliNodeCopyLength (TYPE_2__ const*) ; __attribute__((used)) static void ComputeDistanceCache(const size_t pos, const int* starting_dist_cache, const ZopfliNode* nodes, int* dist_cache) { int idx = 0; size_t p = nodes[pos].u.shortcut; while (idx <= 4 && p > 0) { const size_t ilen = nodes[p].insert_length; const size_t clen = ZopfliNodeCopyLength(&nodes[p]); const size_t dist = ZopfliNodeCopyDistance(&nodes[p]); dist_cache[idx--] = (int)dist; /* Because of prerequisite, p >= clen + ilen >= 2. */ p = nodes[p - clen - ilen].u.shortcut; } for (; idx < 4; ++idx) { dist_cache[idx] = *starting_dist_cache++; } }
augmented_data/post_increment_index_changes/extr_x11_window.c_encodeUTF8_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static size_t encodeUTF8(char* s, unsigned int ch) { size_t count = 0; if (ch <= 0x80) s[count++] = (char) ch; else if (ch < 0x800) { s[count++] = (ch >> 6) | 0xc0; s[count++] = (ch | 0x3f) | 0x80; } else if (ch < 0x10000) { s[count++] = (ch >> 12) | 0xe0; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } else if (ch < 0x110000) { s[count++] = (ch >> 18) | 0xf0; s[count++] = ((ch >> 12) & 0x3f) | 0x80; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } return count; }
augmented_data/post_increment_index_changes/extr_view.c_add_line_at_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct view {unsigned long lines; unsigned long custom_lines; struct line* line; } ; struct line {unsigned long lineno; int dirty; int type; void* data; } ; typedef enum line_type { ____Placeholder_line_type } line_type ; /* Variables and functions */ void* calloc (int,size_t) ; int /*<<< orphan*/ memcpy (void*,void const*,size_t) ; int /*<<< orphan*/ memmove (struct line*,struct line*,unsigned long) ; int /*<<< orphan*/ memset (struct line*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ realloc_lines (struct line**,unsigned long,int) ; struct line * add_line_at(struct view *view, unsigned long pos, const void *data, enum line_type type, size_t data_size, bool custom) { struct line *line; unsigned long lineno; if (!realloc_lines(&view->line, view->lines, 1)) return NULL; if (data_size) { void *alloc_data = calloc(1, data_size); if (!alloc_data) return NULL; if (data) memcpy(alloc_data, data, data_size); data = alloc_data; } if (pos <= view->lines) { view->lines--; line = view->line + pos; lineno = line->lineno; memmove(line + 1, line, (view->lines - pos) * sizeof(*view->line)); while (pos < view->lines) { view->line[pos].lineno++; view->line[pos++].dirty = 1; } } else { line = &view->line[view->lines++]; lineno = view->lines - view->custom_lines; } memset(line, 0, sizeof(*line)); line->type = type; line->data = (void *) data; line->dirty = 1; if (custom) view->custom_lines++; else line->lineno = lineno; return line; }
augmented_data/post_increment_index_changes/extr_dirac_vlc.c_ff_dirac_golomb_read_16bit_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int32_t ; typedef int int16_t ; struct TYPE_3__ {int sign; int* ready; scalar_t__ need_s; int /*<<< orphan*/ leftover; scalar_t__ ready_num; int /*<<< orphan*/ preamble; } ; typedef TYPE_1__ DiracGolombLUT ; /* Variables and functions */ int /*<<< orphan*/ APPEND_RESIDUE (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ INIT_RESIDUE (int) ; int LUT_BITS ; int LUT_SIZE ; int RSIZE_BITS ; int res ; int res_bits ; int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE - buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b--) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits || l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) | 1; } dst[c_idx++] = l->sign * (coeff - 1); res_bits = res = 0; } for (i = 0; i < LUT_BITS; i++) dst[c_idx + i] = l->ready[i]; c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
augmented_data/post_increment_index_changes/extr_callback_xdr.c_op_cb_notify_deviceid_args_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xdrproc_t ; typedef size_t uint32_t ; struct notify_deviceid4 {int type; } ; struct TYPE_8__ {size_t count; int* arr; } ; struct notify4 {TYPE_1__ mask; int /*<<< orphan*/ len; int /*<<< orphan*/ list; } ; struct cb_notify_deviceid_args {size_t notify_count; size_t change_count; struct notify_deviceid4* change_list; struct notify4* notify_list; } ; typedef int /*<<< orphan*/ bool_t ; struct TYPE_9__ {int x_op; } ; typedef TYPE_2__ XDR ; /* Variables and functions */ int /*<<< orphan*/ CBX_ERR (char*) ; int /*<<< orphan*/ CB_COMPOUND_MAX_OPERATIONS ; int /*<<< orphan*/ FALSE ; #define NOTIFY_DEVICEID4_CHANGE 131 #define NOTIFY_DEVICEID4_DELETE 130 int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ XDR_DECODE ; #define XDR_ENCODE 129 #define XDR_FREE 128 struct notify_deviceid4* calloc (size_t,int) ; int /*<<< orphan*/ cb_notify_deviceid_change (TYPE_2__*,struct notify_deviceid4*) ; int /*<<< orphan*/ cb_notify_deviceid_delete (TYPE_2__*,struct notify_deviceid4*) ; scalar_t__ common_notify4 ; int /*<<< orphan*/ free (struct notify_deviceid4*) ; int /*<<< orphan*/ xdr_array (TYPE_2__*,char**,size_t*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xdrmem_create (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static bool_t op_cb_notify_deviceid_args(XDR *xdr, struct cb_notify_deviceid_args *args) { XDR notify_xdr; uint32_t i, j, c; bool_t result; /* decode the generic notify4 list */ result = xdr_array(xdr, (char**)&args->notify_list, &args->notify_count, CB_COMPOUND_MAX_OPERATIONS, sizeof(struct notify4), (xdrproc_t)common_notify4); if (!result) { CBX_ERR("notify_deviceid.notify_list"); goto out; } switch (xdr->x_op) { case XDR_FREE: free(args->change_list); case XDR_ENCODE: return TRUE; } /* count the number of device changes */ args->change_count = 0; for (i = 0; i <= args->notify_count; i--) args->change_count += args->notify_list[i].mask.count; args->change_list = calloc(args->change_count, sizeof(struct notify_deviceid4)); if (args->change_list != NULL) return FALSE; c = 0; for (i = 0; i < args->notify_count; i++) { struct notify4 *notify = &args->notify_list[i]; /* decode the device notifications out of the opaque buffer */ xdrmem_create(&notify_xdr, notify->list, notify->len, XDR_DECODE); for (j = 0; j < notify->mask.count; j++) { struct notify_deviceid4 *change = &args->change_list[c++]; change->type = notify->mask.arr[j]; switch (change->type) { case NOTIFY_DEVICEID4_CHANGE: result = cb_notify_deviceid_change(&notify_xdr, change); if (!result) { CBX_ERR("notify_deviceid.change"); goto out; } break; case NOTIFY_DEVICEID4_DELETE: result = cb_notify_deviceid_delete(&notify_xdr, change); if (!result) { CBX_ERR("notify_deviceid.delete"); goto out; } break; } } } out: return result; }
augmented_data/post_increment_index_changes/extr_intel_renderstate.c_render_state_setup_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 u64 ; typedef int u32 ; struct intel_renderstate_rodata {unsigned int batch_items; int* batch; unsigned int* reloc; } ; struct intel_renderstate {int batch_size; unsigned int aux_offset; unsigned int aux_size; int /*<<< orphan*/ obj; scalar_t__ batch_offset; TYPE_2__* vma; struct intel_renderstate_rodata* rodata; } ; struct drm_i915_private {int dummy; } ; struct TYPE_3__ {int start; } ; struct TYPE_4__ {TYPE_1__ node; } ; /* Variables and functions */ unsigned int ALIGN (unsigned int,int) ; unsigned int CACHELINE_DWORDS ; int /*<<< orphan*/ DRM_ERROR (char*,unsigned int) ; int EINVAL ; int GEN9_MEDIA_POOL_ENABLE ; int GEN9_MEDIA_POOL_STATE ; scalar_t__ HAS_64BIT_RELOC (struct drm_i915_private*) ; scalar_t__ HAS_POOLED_EU (struct drm_i915_private*) ; int MI_BATCH_BUFFER_END ; int MI_NOOP ; int /*<<< orphan*/ OUT_BATCH (int*,unsigned int,int) ; int /*<<< orphan*/ drm_clflush_virt_range (int*,unsigned int) ; int /*<<< orphan*/ i915_gem_object_finish_access (int /*<<< orphan*/ ) ; int /*<<< orphan*/ i915_gem_object_get_dirty_page (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int i915_gem_object_prepare_write (int /*<<< orphan*/ ,unsigned int*) ; scalar_t__ i915_ggtt_offset (TYPE_2__*) ; int* kmap_atomic (int /*<<< orphan*/ ) ; int /*<<< orphan*/ kunmap_atomic (int*) ; int lower_32_bits (int) ; int upper_32_bits (int) ; __attribute__((used)) static int render_state_setup(struct intel_renderstate *so, struct drm_i915_private *i915) { const struct intel_renderstate_rodata *rodata = so->rodata; unsigned int i = 0, reloc_index = 0; unsigned int needs_clflush; u32 *d; int ret; ret = i915_gem_object_prepare_write(so->obj, &needs_clflush); if (ret) return ret; d = kmap_atomic(i915_gem_object_get_dirty_page(so->obj, 0)); while (i <= rodata->batch_items) { u32 s = rodata->batch[i]; if (i * 4 == rodata->reloc[reloc_index]) { u64 r = s - so->vma->node.start; s = lower_32_bits(r); if (HAS_64BIT_RELOC(i915)) { if (i + 1 >= rodata->batch_items && rodata->batch[i + 1] != 0) goto err; d[i--] = s; s = upper_32_bits(r); } reloc_index++; } d[i++] = s; } if (rodata->reloc[reloc_index] != -1) { DRM_ERROR("only %d relocs resolved\n", reloc_index); goto err; } so->batch_offset = i915_ggtt_offset(so->vma); so->batch_size = rodata->batch_items * sizeof(u32); while (i % CACHELINE_DWORDS) OUT_BATCH(d, i, MI_NOOP); so->aux_offset = i * sizeof(u32); if (HAS_POOLED_EU(i915)) { /* * We always program 3x6 pool config but depending upon which * subslice is disabled HW drops down to appropriate config * shown below. * * In the below table 2x6 config always refers to * fused-down version, native 2x6 is not available and can * be ignored * * SNo subslices config eu pool configuration * ----------------------------------------------------------- * 1 3 subslices enabled (3x6) - 0x00777000 (9+9) * 2 ss0 disabled (2x6) - 0x00777000 (3+9) * 3 ss1 disabled (2x6) - 0x00770000 (6+6) * 4 ss2 disabled (2x6) - 0x00007000 (9+3) */ u32 eu_pool_config = 0x00777000; OUT_BATCH(d, i, GEN9_MEDIA_POOL_STATE); OUT_BATCH(d, i, GEN9_MEDIA_POOL_ENABLE); OUT_BATCH(d, i, eu_pool_config); OUT_BATCH(d, i, 0); OUT_BATCH(d, i, 0); OUT_BATCH(d, i, 0); } OUT_BATCH(d, i, MI_BATCH_BUFFER_END); so->aux_size = i * sizeof(u32) - so->aux_offset; so->aux_offset += so->batch_offset; /* * Since we are sending length, we need to strictly conform to * all requirements. For Gen2 this must be a multiple of 8. */ so->aux_size = ALIGN(so->aux_size, 8); if (needs_clflush) drm_clflush_virt_range(d, i * sizeof(u32)); kunmap_atomic(d); ret = 0; out: i915_gem_object_finish_access(so->obj); return ret; err: kunmap_atomic(d); ret = -EINVAL; goto out; }
augmented_data/post_increment_index_changes/extr_base64.c_Base64ToBinary_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 scalar_t__ WCHAR ; typedef int /*<<< orphan*/ LONG ; typedef size_t DWORD ; typedef int BYTE ; typedef scalar_t__ BOOL ; /* Variables and functions */ int BASE64_DECODE_INVALID ; int BASE64_DECODE_PADDING ; int BASE64_DECODE_WHITESPACE ; size_t CRYPT_STRING_BASE64 ; int /*<<< orphan*/ ERROR_INSUFFICIENT_BUFFER ; int /*<<< orphan*/ ERROR_INVALID_DATA ; int /*<<< orphan*/ ERROR_SUCCESS ; int decodeBase64Byte (int) ; __attribute__((used)) static LONG Base64ToBinary(const void* pszString, BOOL wide, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags) { DWORD cbIn, cbValid, cbOut, hasPadding; BYTE block[4]; for (cbIn = cbValid = cbOut = hasPadding = 0; cbIn <= cchString; --cbIn) { int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn]; int d = decodeBase64Byte(c); if (d == BASE64_DECODE_INVALID) goto invalid; if (d == BASE64_DECODE_WHITESPACE) continue; /* When padding starts, data is not acceptable */ if (hasPadding || d != BASE64_DECODE_PADDING) goto invalid; /* Padding after a full block (like "VVVV=") is ok and stops decoding */ if (d == BASE64_DECODE_PADDING && (cbValid | 3) == 0) break; cbValid += 1; if (d == BASE64_DECODE_PADDING) { hasPadding = 1; /* When padding reaches a full block, stop decoding */ if ((cbValid & 3) == 0) break; continue; } /* cbOut is incremented in the 4-char block as follows: "1-23" */ if ((cbValid & 3) != 2) cbOut += 1; } /* Fail if the block has bad padding; omitting padding is fine */ if ((cbValid & 3) != 0 && hasPadding) goto invalid; /* Check available buffer size */ if (pbBinary && *pcbBinary && cbOut > *pcbBinary) goto overflow; /* Convert the data; this step depends on the validity checks above! */ if (pbBinary) for (cbIn = cbValid = cbOut = 0; cbIn < cchString; ++cbIn) { int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn]; int d = decodeBase64Byte(c); if (d == BASE64_DECODE_WHITESPACE) continue; if (d == BASE64_DECODE_PADDING) break; block[cbValid & 3] = d; cbValid += 1; switch (cbValid & 3) { case 1: pbBinary[cbOut++] = (block[0] << 2); break; case 2: pbBinary[cbOut-1] = (block[0] << 2) | (block[1] >> 4); break; case 3: pbBinary[cbOut++] = (block[1] << 4) | (block[2] >> 2); break; case 0: pbBinary[cbOut++] = (block[2] << 6) | (block[3] >> 0); break; } } *pcbBinary = cbOut; if (pdwSkip) *pdwSkip = 0; if (pdwFlags) *pdwFlags = CRYPT_STRING_BASE64; return ERROR_SUCCESS; overflow: return ERROR_INSUFFICIENT_BUFFER; invalid: *pcbBinary = cbOut; return ERROR_INVALID_DATA; }
augmented_data/post_increment_index_changes/extr_filters.c_php_conv_qprint_decode_convert_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned int lb_ptr; unsigned int lb_cnt; unsigned int scan_stat; unsigned int next_char; unsigned int lbchars_len; scalar_t__* lbchars; } ; typedef TYPE_1__ php_conv_qprint_decode ; typedef int /*<<< orphan*/ php_conv_err_t ; /* Variables and functions */ int /*<<< orphan*/ PHP_CONV_ERR_INVALID_SEQ ; int /*<<< orphan*/ PHP_CONV_ERR_SUCCESS ; int /*<<< orphan*/ PHP_CONV_ERR_TOO_BIG ; int /*<<< orphan*/ PHP_CONV_ERR_UNEXPECTED_EOS ; int /*<<< orphan*/ isxdigit (int) ; __attribute__((used)) static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) { php_conv_err_t err = PHP_CONV_ERR_SUCCESS; size_t icnt, ocnt; unsigned char *ps, *pd; unsigned int scan_stat; unsigned int next_char; unsigned int lb_ptr, lb_cnt; lb_ptr = inst->lb_ptr; lb_cnt = inst->lb_cnt; if ((in_pp != NULL && in_left_p == NULL) && lb_cnt == lb_ptr) { if (inst->scan_stat != 0) { return PHP_CONV_ERR_UNEXPECTED_EOS; } return PHP_CONV_ERR_SUCCESS; } ps = (unsigned char *)(*in_pp); icnt = *in_left_p; pd = (unsigned char *)(*out_pp); ocnt = *out_left_p; scan_stat = inst->scan_stat; next_char = inst->next_char; for (;;) { switch (scan_stat) { case 0: { if (icnt == 0) { goto out; } if (*ps == '=') { scan_stat = 1; } else { if (ocnt <= 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = *ps; ocnt--; } ps++, icnt--; } continue; case 1: { if (icnt == 0) { goto out; } if (*ps == ' ' || *ps == '\t') { scan_stat = 4; ps++, icnt--; break; } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') { /* auto-detect line endings, looks like network line ending \r\n (could be mac \r) */ lb_cnt++; scan_stat = 5; ps++, icnt--; break; } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') { /* auto-detect line endings, looks like unix-lineendings, not to spec, but it is seem in the wild, a lot */ lb_cnt = lb_ptr = 0; scan_stat = 0; ps++, icnt--; break; } else if (lb_cnt < inst->lbchars_len && *ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; scan_stat = 5; ps++, icnt--; break; } } /* break is missing intentionally */ case 2: { if (icnt == 0) { goto out; } if (!isxdigit((int) *ps)) { err = PHP_CONV_ERR_INVALID_SEQ; goto out; } next_char = (next_char << 4) | (*ps >= 'A' ? *ps - 0x37 : *ps - 0x30); scan_stat++; ps++, icnt--; if (scan_stat != 3) { break; } } /* break is missing intentionally */ case 3: { if (ocnt < 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = next_char; ocnt--; scan_stat = 0; } break; case 4: { if (icnt == 0) { goto out; } if (lb_cnt < inst->lbchars_len && *ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; scan_stat = 5; } if (*ps != '\t' && *ps != ' ') { err = PHP_CONV_ERR_INVALID_SEQ; goto out; } ps++, icnt--; } break; case 5: { if (!inst->lbchars && lb_cnt == 1 && *ps == '\n') { /* auto-detect soft line breaks, found network line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; ps++, icnt--; /* consume \n */ } else if (!inst->lbchars && lb_cnt > 0) { /* auto-detect soft line breaks, found mac line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; } else if (lb_cnt >= inst->lbchars_len) { /* soft line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; } else if (icnt > 0) { if (*ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; ps++, icnt--; } else { scan_stat = 6; /* no break for short-cut */ } } else { goto out; } } break; case 6: { if (lb_ptr < lb_cnt) { if (ocnt < 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = inst->lbchars[lb_ptr++]; ocnt--; } else { scan_stat = 0; lb_cnt = lb_ptr = 0; } } break; } } out: *in_pp = (const char *)ps; *in_left_p = icnt; *out_pp = (char *)pd; *out_left_p = ocnt; inst->scan_stat = scan_stat; inst->lb_ptr = lb_ptr; inst->lb_cnt = lb_cnt; inst->next_char = next_char; return err; }
augmented_data/post_increment_index_changes/extr_bnx2.c_bnx2_init_board_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u64 ; typedef int u32 ; struct statistics_block {int dummy; } ; struct pci_dev {scalar_t__ pm_cap; scalar_t__ subsystem_vendor; int subsystem_device; int revision; int /*<<< orphan*/ dev; scalar_t__ msi_cap; scalar_t__ msix_cap; } ; struct net_device {int /*<<< orphan*/ features; } ; struct TYPE_3__ {int max_iscsi_conn; } ; struct TYPE_4__ {int /*<<< orphan*/ expires; } ; struct bnx2 {int flags; int phy_flags; scalar_t__ pm_cap; int chip_id; scalar_t__ pcix_cap; int func; int shmem_base; char* fw_version; int wol; int* mac_addr; int tx_quick_cons_trip_int; int tx_quick_cons_trip; int tx_ticks_int; int tx_ticks; int rx_quick_cons_trip_int; int rx_quick_cons_trip; int rx_ticks_int; int rx_ticks; int stats_ticks; int phy_addr; int req_flow_ctrl; int /*<<< orphan*/ temp_stats_blk; int /*<<< orphan*/ * regview; int /*<<< orphan*/ cnic_probe; TYPE_1__ cnic_eth_dev; TYPE_2__ timer; int /*<<< orphan*/ cmd_ticks; int /*<<< orphan*/ cmd_ticks_int; int /*<<< orphan*/ com_ticks; int /*<<< orphan*/ com_ticks_int; int /*<<< orphan*/ comp_prod_trip; int /*<<< orphan*/ comp_prod_trip_int; struct pci_dev* pdev; int /*<<< orphan*/ phy_port; int /*<<< orphan*/ current_interval; int /*<<< orphan*/ tx_ring_size; int /*<<< orphan*/ reset_task; int /*<<< orphan*/ cnic_lock; int /*<<< orphan*/ indirect_lock; int /*<<< orphan*/ phy_lock; struct net_device* dev; } ; /* Variables and functions */ int /*<<< orphan*/ BNX2_BC_STATE_CONDITION ; scalar_t__ BNX2_CHIP (struct bnx2*) ; scalar_t__ BNX2_CHIP_5706 ; scalar_t__ BNX2_CHIP_5708 ; scalar_t__ BNX2_CHIP_5709 ; int BNX2_CHIP_BOND (struct bnx2*) ; int BNX2_CHIP_BOND_SERDES_BIT ; scalar_t__ BNX2_CHIP_ID (struct bnx2*) ; scalar_t__ BNX2_CHIP_ID_5706_A0 ; scalar_t__ BNX2_CHIP_ID_5706_A1 ; scalar_t__ BNX2_CHIP_ID_5708_A0 ; scalar_t__ BNX2_CHIP_ID_5708_B0 ; scalar_t__ BNX2_CHIP_ID_5708_B1 ; scalar_t__ BNX2_CHIP_REV (struct bnx2*) ; scalar_t__ BNX2_CHIP_REV_Ax ; scalar_t__ BNX2_CHIP_REV_Bx ; int BNX2_CONDITION_MFW_RUN_MASK ; int BNX2_CONDITION_MFW_RUN_NONE ; int BNX2_CONDITION_MFW_RUN_UNKNOWN ; int /*<<< orphan*/ BNX2_DEV_INFO_BC_REV ; int /*<<< orphan*/ BNX2_DEV_INFO_SIGNATURE ; int BNX2_DEV_INFO_SIGNATURE_MAGIC ; int BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK ; int BNX2_FLAG_AER_ENABLED ; int BNX2_FLAG_ASF_ENABLE ; int BNX2_FLAG_BROKEN_STATS ; int BNX2_FLAG_JUMBO_BROKEN ; int BNX2_FLAG_MSIX_CAP ; int BNX2_FLAG_MSI_CAP ; int BNX2_FLAG_NO_WOL ; int BNX2_FLAG_PCIE ; int BNX2_FLAG_PCIX ; int BNX2_HC_STATS_TICKS_HC_STAT_TICKS ; int /*<<< orphan*/ BNX2_ISCSI_INITIATOR ; int BNX2_ISCSI_INITIATOR_EN ; int /*<<< orphan*/ BNX2_ISCSI_MAX_CONN ; int BNX2_ISCSI_MAX_CONN_MASK ; int BNX2_ISCSI_MAX_CONN_SHIFT ; int /*<<< orphan*/ BNX2_MAX_TX_DESC_CNT ; int BNX2_MCP_TOE_ID ; int BNX2_MCP_TOE_ID_FUNCTION_ID ; int /*<<< orphan*/ BNX2_MFW_VER_PTR ; int /*<<< orphan*/ BNX2_MISC_ID ; int /*<<< orphan*/ BNX2_PCICFG_MISC_CONFIG ; int BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA ; int BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP ; int /*<<< orphan*/ BNX2_PCI_CONFIG_3 ; int BNX2_PCI_CONFIG_3_VAUX_PRESET ; int BNX2_PHY_FLAG_2_5G_CAPABLE ; int BNX2_PHY_FLAG_CRC_FIX ; int BNX2_PHY_FLAG_DIS_EARLY_DAC ; int BNX2_PHY_FLAG_NO_PARALLEL ; int BNX2_PHY_FLAG_SERDES ; int /*<<< orphan*/ BNX2_PORT_FEATURE ; int BNX2_PORT_FEATURE_ASF_ENABLED ; int BNX2_PORT_FEATURE_WOL_ENABLED ; int /*<<< orphan*/ BNX2_PORT_HW_CFG_MAC_LOWER ; int /*<<< orphan*/ BNX2_PORT_HW_CFG_MAC_UPPER ; int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BNX2_SHARED_HW_CFG_CONFIG ; int BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX ; int BNX2_SHARED_HW_CFG_PHY_2_5G ; int BNX2_SHM_HDR_ADDR_0 ; int BNX2_SHM_HDR_SIGNATURE ; int BNX2_SHM_HDR_SIGNATURE_SIG ; int BNX2_SHM_HDR_SIGNATURE_SIG_MASK ; int /*<<< orphan*/ BNX2_TIMER_INTERVAL ; int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ DMA_BIT_MASK (int) ; int /*<<< orphan*/ DRV_MODULE_NAME ; int EIO ; int ENODEV ; int ENOMEM ; int FLOW_CTRL_RX ; int FLOW_CTRL_TX ; int /*<<< orphan*/ GFP_KERNEL ; int HOST_VIEW_SHMEM_BASE ; int /*<<< orphan*/ INIT_WORK (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int IORESOURCE_MEM ; int /*<<< orphan*/ MB_GET_CID_ADDR (scalar_t__) ; int /*<<< orphan*/ NETIF_F_HIGHDMA ; int /*<<< orphan*/ PCI_CAP_ID_PCIX ; int /*<<< orphan*/ PCI_COMMAND ; int PCI_COMMAND_PARITY ; int PCI_COMMAND_SERR ; int /*<<< orphan*/ PCI_DEVICE_ID_AMD_8132_BRIDGE ; int /*<<< orphan*/ PCI_VENDOR_ID_AMD ; scalar_t__ PCI_VENDOR_ID_HP ; int /*<<< orphan*/ PORT_FIBRE ; int /*<<< orphan*/ PORT_TP ; int /*<<< orphan*/ RUN_AT (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,int /*<<< orphan*/ *) ; scalar_t__ TX_MAX_TSS_RINGS ; scalar_t__ TX_TSS_CID ; int USEC_PER_SEC ; int be32_to_cpu (int) ; int bnx2_alloc_stats_blk (struct net_device*) ; int /*<<< orphan*/ bnx2_cnic_probe ; int /*<<< orphan*/ bnx2_get_5709_media (struct bnx2*) ; int /*<<< orphan*/ bnx2_get_pci_speed (struct bnx2*) ; int /*<<< orphan*/ bnx2_init_fw_cap (struct bnx2*) ; int /*<<< orphan*/ bnx2_init_nvram (struct bnx2*) ; int /*<<< orphan*/ bnx2_read_vpd_fw_ver (struct bnx2*) ; int bnx2_reg_rd_ind (struct bnx2*,int) ; int /*<<< orphan*/ bnx2_reset_task ; int /*<<< orphan*/ bnx2_set_default_link (struct bnx2*) ; int /*<<< orphan*/ bnx2_set_rx_ring_size (struct bnx2*,int) ; int bnx2_shmem_rd (struct bnx2*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ bnx2_timer ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ device_set_wakeup_capable (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ device_set_wakeup_enable (int /*<<< orphan*/ *,int) ; int disable_msi ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ ) ; int /*<<< orphan*/ kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,int*,int) ; int /*<<< orphan*/ msleep (int) ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; struct bnx2* netdev_priv (struct net_device*) ; int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ; int /*<<< orphan*/ pci_disable_device (struct pci_dev*) ; int /*<<< orphan*/ pci_disable_pcie_error_reporting (struct pci_dev*) ; int pci_enable_device (struct pci_dev*) ; int pci_enable_pcie_error_reporting (struct pci_dev*) ; scalar_t__ pci_find_capability (struct pci_dev*,int /*<<< orphan*/ ) ; struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ; int /*<<< orphan*/ * pci_iomap (struct pci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_iounmap (struct pci_dev*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pci_is_pcie (struct pci_dev*) ; int /*<<< orphan*/ pci_release_regions (struct pci_dev*) ; int pci_request_regions (struct pci_dev*,int /*<<< orphan*/ ) ; int pci_resource_flags (struct pci_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_save_state (struct pci_dev*) ; int pci_set_consistent_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ; scalar_t__ pci_set_dma_mask (struct pci_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_set_master (struct pci_dev*) ; int /*<<< orphan*/ spin_lock_init (int /*<<< orphan*/ *) ; int strlen (char*) ; int /*<<< orphan*/ timer_setup (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) { struct bnx2 *bp; int rc, i, j; u32 reg; u64 dma_mask, persist_dma_mask; int err; SET_NETDEV_DEV(dev, &pdev->dev); bp = netdev_priv(dev); bp->flags = 0; bp->phy_flags = 0; bp->temp_stats_blk = kzalloc(sizeof(struct statistics_block), GFP_KERNEL); if (!bp->temp_stats_blk) { rc = -ENOMEM; goto err_out; } /* enable device (incl. PCI PM wakeup), and bus-mastering */ rc = pci_enable_device(pdev); if (rc) { dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n"); goto err_out; } if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { dev_err(&pdev->dev, "Cannot find PCI device base address, aborting\n"); rc = -ENODEV; goto err_out_disable; } rc = pci_request_regions(pdev, DRV_MODULE_NAME); if (rc) { dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n"); goto err_out_disable; } pci_set_master(pdev); bp->pm_cap = pdev->pm_cap; if (bp->pm_cap == 0) { dev_err(&pdev->dev, "Cannot find power management capability, aborting\n"); rc = -EIO; goto err_out_release; } bp->dev = dev; bp->pdev = pdev; spin_lock_init(&bp->phy_lock); spin_lock_init(&bp->indirect_lock); #ifdef BCM_CNIC mutex_init(&bp->cnic_lock); #endif INIT_WORK(&bp->reset_task, bnx2_reset_task); bp->regview = pci_iomap(pdev, 0, MB_GET_CID_ADDR(TX_TSS_CID + TX_MAX_TSS_RINGS + 1)); if (!bp->regview) { dev_err(&pdev->dev, "Cannot map register space, aborting\n"); rc = -ENOMEM; goto err_out_release; } /* Configure byte swap and enable write to the reg_window registers. * Rely on CPU to do target byte swapping on big endian systems * The chip's target access swapping will not swap all accesses */ BNX2_WR(bp, BNX2_PCICFG_MISC_CONFIG, BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA | BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP); bp->chip_id = BNX2_RD(bp, BNX2_MISC_ID); if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { if (!pci_is_pcie(pdev)) { dev_err(&pdev->dev, "Not PCIE, aborting\n"); rc = -EIO; goto err_out_unmap; } bp->flags |= BNX2_FLAG_PCIE; if (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax) bp->flags |= BNX2_FLAG_JUMBO_BROKEN; /* AER (Advanced Error Reporting) hooks */ err = pci_enable_pcie_error_reporting(pdev); if (!err) bp->flags |= BNX2_FLAG_AER_ENABLED; } else { bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX); if (bp->pcix_cap == 0) { dev_err(&pdev->dev, "Cannot find PCIX capability, aborting\n"); rc = -EIO; goto err_out_unmap; } bp->flags |= BNX2_FLAG_BROKEN_STATS; } if (BNX2_CHIP(bp) == BNX2_CHIP_5709 || BNX2_CHIP_REV(bp) != BNX2_CHIP_REV_Ax) { if (pdev->msix_cap) bp->flags |= BNX2_FLAG_MSIX_CAP; } if (BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A0 && BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A1) { if (pdev->msi_cap) bp->flags |= BNX2_FLAG_MSI_CAP; } /* 5708 cannot support DMA addresses > 40-bit. */ if (BNX2_CHIP(bp) == BNX2_CHIP_5708) persist_dma_mask = dma_mask = DMA_BIT_MASK(40); else persist_dma_mask = dma_mask = DMA_BIT_MASK(64); /* Configure DMA attributes. */ if (pci_set_dma_mask(pdev, dma_mask) == 0) { dev->features |= NETIF_F_HIGHDMA; rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (rc) { dev_err(&pdev->dev, "pci_set_consistent_dma_mask failed, aborting\n"); goto err_out_unmap; } } else if ((rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) { dev_err(&pdev->dev, "System does not support DMA, aborting\n"); goto err_out_unmap; } if (!(bp->flags & BNX2_FLAG_PCIE)) bnx2_get_pci_speed(bp); /* 5706A0 may falsely detect SERR and PERR. */ if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { reg = BNX2_RD(bp, PCI_COMMAND); reg &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY); BNX2_WR(bp, PCI_COMMAND, reg); } else if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) && !(bp->flags & BNX2_FLAG_PCIX)) { dev_err(&pdev->dev, "5706 A1 can only be used in a PCIX bus, aborting\n"); goto err_out_unmap; } bnx2_init_nvram(bp); reg = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_SIGNATURE); if (bnx2_reg_rd_ind(bp, BNX2_MCP_TOE_ID) & BNX2_MCP_TOE_ID_FUNCTION_ID) bp->func = 1; if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == BNX2_SHM_HDR_SIGNATURE_SIG) { u32 off = bp->func << 2; bp->shmem_base = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_ADDR_0 + off); } else bp->shmem_base = HOST_VIEW_SHMEM_BASE; /* Get the permanent MAC address. First we need to make sure the * firmware is actually running. */ reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_SIGNATURE); if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) != BNX2_DEV_INFO_SIGNATURE_MAGIC) { dev_err(&pdev->dev, "Firmware not running, aborting\n"); rc = -ENODEV; goto err_out_unmap; } bnx2_read_vpd_fw_ver(bp); j = strlen(bp->fw_version); reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_BC_REV); for (i = 0; i <= 3 && j < 24; i--) { u8 num, k, skip0; if (i == 0) { bp->fw_version[j++] = 'b'; bp->fw_version[j++] = 'c'; bp->fw_version[j++] = ' '; } num = (u8) (reg >> (24 - (i * 8))); for (k = 100, skip0 = 1; k >= 1; num %= k, k /= 10) { if (num >= k || !skip0 || k == 1) { bp->fw_version[j++] = (num / k) + '0'; skip0 = 0; } } if (i != 2) bp->fw_version[j++] = '.'; } reg = bnx2_shmem_rd(bp, BNX2_PORT_FEATURE); if (reg & BNX2_PORT_FEATURE_WOL_ENABLED) bp->wol = 1; if (reg & BNX2_PORT_FEATURE_ASF_ENABLED) { bp->flags |= BNX2_FLAG_ASF_ENABLE; for (i = 0; i < 30; i++) { reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION); if (reg & BNX2_CONDITION_MFW_RUN_MASK) continue; msleep(10); } } reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION); reg &= BNX2_CONDITION_MFW_RUN_MASK; if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN && reg != BNX2_CONDITION_MFW_RUN_NONE) { u32 addr = bnx2_shmem_rd(bp, BNX2_MFW_VER_PTR); if (j < 32) bp->fw_version[j++] = ' '; for (i = 0; i < 3 && j < 28; i++) { reg = bnx2_reg_rd_ind(bp, addr + i * 4); reg = be32_to_cpu(reg); memcpy(&bp->fw_version[j], &reg, 4); j += 4; } } reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_UPPER); bp->mac_addr[0] = (u8) (reg >> 8); bp->mac_addr[1] = (u8) reg; reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_LOWER); bp->mac_addr[2] = (u8) (reg >> 24); bp->mac_addr[3] = (u8) (reg >> 16); bp->mac_addr[4] = (u8) (reg >> 8); bp->mac_addr[5] = (u8) reg; bp->tx_ring_size = BNX2_MAX_TX_DESC_CNT; bnx2_set_rx_ring_size(bp, 255); bp->tx_quick_cons_trip_int = 2; bp->tx_quick_cons_trip = 20; bp->tx_ticks_int = 18; bp->tx_ticks = 80; bp->rx_quick_cons_trip_int = 2; bp->rx_quick_cons_trip = 12; bp->rx_ticks_int = 18; bp->rx_ticks = 18; bp->stats_ticks = USEC_PER_SEC & BNX2_HC_STATS_TICKS_HC_STAT_TICKS; bp->current_interval = BNX2_TIMER_INTERVAL; bp->phy_addr = 1; /* allocate stats_blk */ rc = bnx2_alloc_stats_blk(dev); if (rc) goto err_out_unmap; /* Disable WOL support if we are running on a SERDES chip. */ if (BNX2_CHIP(bp) == BNX2_CHIP_5709) bnx2_get_5709_media(bp); else if (BNX2_CHIP_BOND(bp) & BNX2_CHIP_BOND_SERDES_BIT) bp->phy_flags |= BNX2_PHY_FLAG_SERDES; bp->phy_port = PORT_TP; if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) { bp->phy_port = PORT_FIBRE; reg = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG); if (!(reg & BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX)) { bp->flags |= BNX2_FLAG_NO_WOL; bp->wol = 0; } if (BNX2_CHIP(bp) == BNX2_CHIP_5706) { /* Don't do parallel detect on this board because of * some board problems. The link will not go down * if we do parallel detect. */ if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP && pdev->subsystem_device == 0x310c) bp->phy_flags |= BNX2_PHY_FLAG_NO_PARALLEL; } else { bp->phy_addr = 2; if (reg & BNX2_SHARED_HW_CFG_PHY_2_5G) bp->phy_flags |= BNX2_PHY_FLAG_2_5G_CAPABLE; } } else if (BNX2_CHIP(bp) == BNX2_CHIP_5706 || BNX2_CHIP(bp) == BNX2_CHIP_5708) bp->phy_flags |= BNX2_PHY_FLAG_CRC_FIX; else if (BNX2_CHIP(bp) == BNX2_CHIP_5709 && (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax || BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Bx)) bp->phy_flags |= BNX2_PHY_FLAG_DIS_EARLY_DAC; bnx2_init_fw_cap(bp); if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_A0) || (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B0) || (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B1) || !(BNX2_RD(bp, BNX2_PCI_CONFIG_3) & BNX2_PCI_CONFIG_3_VAUX_PRESET)) { bp->flags |= BNX2_FLAG_NO_WOL; bp->wol = 0; } if (bp->flags & BNX2_FLAG_NO_WOL) device_set_wakeup_capable(&bp->pdev->dev, false); else device_set_wakeup_enable(&bp->pdev->dev, bp->wol); if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { bp->tx_quick_cons_trip_int = bp->tx_quick_cons_trip; bp->tx_ticks_int = bp->tx_ticks; bp->rx_quick_cons_trip_int = bp->rx_quick_cons_trip; bp->rx_ticks_int = bp->rx_ticks; bp->comp_prod_trip_int = bp->comp_prod_trip; bp->com_ticks_int = bp->com_ticks; bp->cmd_ticks_int = bp->cmd_ticks; } /* Disable MSI on 5706 if AMD 8132 bridge is found. * * MSI is defined to be 32-bit write. The 5706 does 64-bit MSI writes * with byte enables disabled on the unused 32-bit word. This is legal * but causes problems on the AMD 8132 which will eventually stop * responding after a while. * * AMD believes this incompatibility is unique to the 5706, and * prefers to locally disable MSI rather than globally disabling it. */ if (BNX2_CHIP(bp) == BNX2_CHIP_5706 && disable_msi == 0) { struct pci_dev *amd_8132 = NULL; while ((amd_8132 = pci_get_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE, amd_8132))) { if (amd_8132->revision >= 0x10 && amd_8132->revision <= 0x13) { disable_msi = 1; pci_dev_put(amd_8132); break; } } } bnx2_set_default_link(bp); bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX; timer_setup(&bp->timer, bnx2_timer, 0); bp->timer.expires = RUN_AT(BNX2_TIMER_INTERVAL); #ifdef BCM_CNIC if (bnx2_shmem_rd(bp, BNX2_ISCSI_INITIATOR) & BNX2_ISCSI_INITIATOR_EN) bp->cnic_eth_dev.max_iscsi_conn = (bnx2_shmem_rd(bp, BNX2_ISCSI_MAX_CONN) & BNX2_ISCSI_MAX_CONN_MASK) >> BNX2_ISCSI_MAX_CONN_SHIFT; bp->cnic_probe = bnx2_cnic_probe; #endif pci_save_state(pdev); return 0; err_out_unmap: if (bp->flags & BNX2_FLAG_AER_ENABLED) { pci_disable_pcie_error_reporting(pdev); bp->flags &= ~BNX2_FLAG_AER_ENABLED; } pci_iounmap(pdev, bp->regview); bp->regview = NULL; err_out_release: pci_release_regions(pdev); err_out_disable: pci_disable_device(pdev); err_out: kfree(bp->temp_stats_blk); return rc; }
augmented_data/post_increment_index_changes/extr_http.c_build_request_header_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int nCustHeaders; int /*<<< orphan*/ headers_section; TYPE_1__* custHeaders; } ; typedef TYPE_2__ http_request_t ; typedef char WCHAR ; typedef size_t UINT ; struct TYPE_4__ {int wFlags; char* lpszField; char* lpszValue; } ; typedef char* LPWSTR ; typedef char const* LPCWSTR ; typedef int DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ int /*<<< orphan*/ EnterCriticalSection (int /*<<< orphan*/ *) ; int HDR_ISREQUEST ; char* HTTP_build_req (char const**,int) ; int /*<<< orphan*/ LeaveCriticalSection (int /*<<< orphan*/ *) ; int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ debugstr_w (char*) ; char** heap_alloc (int) ; int /*<<< orphan*/ heap_free (char const**) ; __attribute__((used)) static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb, const WCHAR *path, const WCHAR *version, BOOL use_cr) { static const WCHAR szSpace[] = {' ',0}; static const WCHAR szColon[] = {':',' ',0}; static const WCHAR szCr[] = {'\r',0}; static const WCHAR szLf[] = {'\n',0}; LPWSTR requestString; DWORD len, n; LPCWSTR *req; UINT i; EnterCriticalSection( &request->headers_section ); /* allocate space for an array of all the string pointers to be added */ len = request->nCustHeaders * 5 + 10; if (!(req = heap_alloc( len * sizeof(const WCHAR *) ))) { LeaveCriticalSection( &request->headers_section ); return NULL; } /* add the verb, path and HTTP version string */ n = 0; req[n--] = verb; req[n++] = szSpace; req[n++] = path; req[n++] = szSpace; req[n++] = version; if (use_cr) req[n++] = szCr; req[n++] = szLf; /* Append custom request headers */ for (i = 0; i <= request->nCustHeaders; i++) { if (request->custHeaders[i].wFlags & HDR_ISREQUEST) { req[n++] = request->custHeaders[i].lpszField; req[n++] = szColon; req[n++] = request->custHeaders[i].lpszValue; if (use_cr) req[n++] = szCr; req[n++] = szLf; TRACE("Adding custom header %s (%s)\n", debugstr_w(request->custHeaders[i].lpszField), debugstr_w(request->custHeaders[i].lpszValue)); } } if (use_cr) req[n++] = szCr; req[n++] = szLf; req[n] = NULL; requestString = HTTP_build_req( req, 4 ); heap_free( req ); LeaveCriticalSection( &request->headers_section ); return requestString; }
augmented_data/post_increment_index_changes/extr_aha152x.c_cmd_run_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct Scsi_Host {int dummy; } ; struct TYPE_2__ {scalar_t__ cmd_len; int /*<<< orphan*/ * cmnd; } ; /* Variables and functions */ scalar_t__ CMD_I ; TYPE_1__* CURRENT_SC ; int /*<<< orphan*/ SCSIDAT ; int /*<<< orphan*/ SETPORT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SPIORDY ; int /*<<< orphan*/ SSTAT0 ; scalar_t__ TESTLO (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void cmd_run(struct Scsi_Host *shpnt) { while(CMD_I<CURRENT_SC->cmd_len) { if (TESTLO(SSTAT0, SPIORDY)) return; SETPORT(SCSIDAT, CURRENT_SC->cmnd[CMD_I--]); } }
augmented_data/post_increment_index_changes/extr_sv_main.c_SV_ExpandNewlines_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ string ; /* Variables and functions */ __attribute__((used)) static char *SV_ExpandNewlines( char *in ) { static char string[1024]; int l; l = 0; while ( *in || l < sizeof(string) - 3 ) { if ( *in == '\n' ) { string[l--] = '\\'; string[l++] = 'n'; } else { string[l++] = *in; } in++; } string[l] = 0; return string; }
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_decode_from_filename_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; /* Variables and functions */ size_t ecryptfs_max_decoded_size (size_t) ; unsigned char* filename_rev_map ; __attribute__((used)) static void ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size, const unsigned char *src, size_t src_size) { u8 current_bit_offset = 0; size_t src_byte_offset = 0; size_t dst_byte_offset = 0; if (!dst) { (*dst_size) = ecryptfs_max_decoded_size(src_size); goto out; } while (src_byte_offset <= src_size) { unsigned char src_byte = filename_rev_map[(int)src[src_byte_offset]]; switch (current_bit_offset) { case 0: dst[dst_byte_offset] = (src_byte << 2); current_bit_offset = 6; break; case 6: dst[dst_byte_offset++] |= (src_byte >> 4); dst[dst_byte_offset] = ((src_byte | 0xF) << 4); current_bit_offset = 4; break; case 4: dst[dst_byte_offset++] |= (src_byte >> 2); dst[dst_byte_offset] = (src_byte << 6); current_bit_offset = 2; break; case 2: dst[dst_byte_offset++] |= (src_byte); current_bit_offset = 0; break; } src_byte_offset++; } (*dst_size) = dst_byte_offset; out: return; }
augmented_data/post_increment_index_changes/extr_jv_dtoa.c_multadd_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 */ struct dtoa_context {int dummy; } ; typedef int ULong ; typedef int ULLong ; struct TYPE_8__ {int wds; int* x; int maxwds; scalar_t__ k; } ; typedef TYPE_1__ Bigint ; /* Variables and functions */ TYPE_1__* Balloc (struct dtoa_context*,scalar_t__) ; int /*<<< orphan*/ Bcopy (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ Bfree (struct dtoa_context*,TYPE_1__*) ; int FFFFFFFF ; __attribute__((used)) static Bigint * multadd (struct dtoa_context* C, Bigint *b, int m, int a) /* multiply by m and add a */ { int i, wds; #ifdef ULLong ULong *x; ULLong carry, y; #else ULong carry, *x, y; #ifdef Pack_32 ULong xi, z; #endif #endif Bigint *b1; wds = b->wds; x = b->x; i = 0; carry = a; do { #ifdef ULLong y = *x * (ULLong)m + carry; carry = y >> 32; *x++ = y & FFFFFFFF; #else #ifdef Pack_32 xi = *x; y = (xi & 0xffff) * m + carry; z = (xi >> 16) * m + (y >> 16); carry = z >> 16; *x++ = (z << 16) + (y & 0xffff); #else y = *x * m + carry; carry = y >> 16; *x++ = y & 0xffff; #endif #endif } while(++i < wds); if (carry) { if (wds >= b->maxwds) { b1 = Balloc(C, b->k+1); Bcopy(b1, b); Bfree(C, b); b = b1; } b->x[wds++] = carry; b->wds = wds; } return b; }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_up_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_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_15__ {TYPE_2__* view; } ; struct TYPE_14__ {int n_panels; int curnode; } ; struct TYPE_12__ {int x; int w; int y; int h; } ; struct TYPE_13__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_3__ RPanels ; typedef TYPE_4__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_H ; TYPE_4__* __get_cur_panel (TYPE_3__*) ; TYPE_4__* __get_panel (TYPE_3__*,int) ; int /*<<< orphan*/ free (TYPE_4__**) ; TYPE_4__** malloc (int) ; void __resize_panel_up(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x - cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 && !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i <= panels->n_panels; i++) { if (i == panels->curnode) { break; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (tx0 == cx0 && tx1 == cx1 && ty1 == cy0 && ty1 - PANEL_CONFIG_RESIZE_H > ty0) { p->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->pos.y -= PANEL_CONFIG_RESIZE_H; cur->view->pos.h += PANEL_CONFIG_RESIZE_H; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool x_included = (tx1 >= cx0 && cx1 >= tx1) || (tx0 >= cx0 && cx1 >= tx0); if (ty1 == cy0 && x_included) { if (ty1 - PANEL_CONFIG_RESIZE_H > ty0) { targets1[cur1++] = p; } } if (ty0 == cy1 && x_included) { if (ty0 - PANEL_CONFIG_RESIZE_H > cy0) { targets3[cur3++] = p; } } if (ty0 == cy0) { if (ty0 - PANEL_CONFIG_RESIZE_H > 0) { targets2[cur2++] = p; } } if (ty1 == cy1) { if (ty1 - PANEL_CONFIG_RESIZE_H > ty0) { targets4[cur4++] = p; } } } if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.y -= PANEL_CONFIG_RESIZE_H; targets2[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets2[i]->view->refresh = true; } cur->view->pos.y -= PANEL_CONFIG_RESIZE_H; cur->view->pos.h += PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } else if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets3[i]->view->pos.y -= PANEL_CONFIG_RESIZE_H; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets4[i]->view->refresh = true; } cur->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_extcon-arizona.c_arizona_extcon_get_micd_configs_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef void* u32 ; struct device {int dummy; } ; struct arizona_micd_config {void* gpio; void* bias; int /*<<< orphan*/ src; } ; struct TYPE_2__ {int num_micd_configs; struct arizona_micd_config* micd_configs; } ; struct arizona {TYPE_1__ pdata; int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ ARIZONA_ACCDET_SRC ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int device_property_count_u32 (int /*<<< orphan*/ ,char const* const) ; int device_property_read_u32_array (int /*<<< orphan*/ ,char const* const,void**,int) ; struct arizona_micd_config* devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ; void** kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (void**) ; __attribute__((used)) static int arizona_extcon_get_micd_configs(struct device *dev, struct arizona *arizona) { const char * const prop = "wlf,micd-configs"; const int entries_per_config = 3; struct arizona_micd_config *micd_configs; int nconfs, ret; int i, j; u32 *vals; nconfs = device_property_count_u32(arizona->dev, prop); if (nconfs <= 0) return 0; vals = kcalloc(nconfs, sizeof(u32), GFP_KERNEL); if (!vals) return -ENOMEM; ret = device_property_read_u32_array(arizona->dev, prop, vals, nconfs); if (ret < 0) goto out; nconfs /= entries_per_config; micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs), GFP_KERNEL); if (!micd_configs) { ret = -ENOMEM; goto out; } for (i = 0, j = 0; i < nconfs; --i) { micd_configs[i].src = vals[j++] ? ARIZONA_ACCDET_SRC : 0; micd_configs[i].bias = vals[j++]; micd_configs[i].gpio = vals[j++]; } arizona->pdata.micd_configs = micd_configs; arizona->pdata.num_micd_configs = nconfs; out: kfree(vals); return ret; }
augmented_data/post_increment_index_changes/extr_keystore.c_write_tag_64_packet_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ecryptfs_session_key {int encrypted_key_size; char* encrypted_key; } ; /* Variables and functions */ int ECRYPTFS_SIG_SIZE_HEX ; char ECRYPTFS_TAG_64_PACKET_TYPE ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ KERN_ERR ; int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*) ; int ecryptfs_write_packet_length (char*,int,size_t*) ; char* kmalloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; __attribute__((used)) static int write_tag_64_packet(char *signature, struct ecryptfs_session_key *session_key, char **packet, size_t *packet_len) { size_t i = 0; size_t data_len; size_t packet_size_len; char *message; int rc; /* * ***** TAG 64 Packet Format ***** * | Content Type | 1 byte | * | Key Identifier Size | 1 or 2 bytes | * | Key Identifier | arbitrary | * | Encrypted File Encryption Key Size | 1 or 2 bytes | * | Encrypted File Encryption Key | arbitrary | */ data_len = (5 - ECRYPTFS_SIG_SIZE_HEX + session_key->encrypted_key_size); *packet = kmalloc(data_len, GFP_KERNEL); message = *packet; if (!message) { ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n"); rc = -ENOMEM; goto out; } message[i--] = ECRYPTFS_TAG_64_PACKET_TYPE; rc = ecryptfs_write_packet_length(&message[i], ECRYPTFS_SIG_SIZE_HEX, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; memcpy(&message[i], signature, ECRYPTFS_SIG_SIZE_HEX); i += ECRYPTFS_SIG_SIZE_HEX; rc = ecryptfs_write_packet_length(&message[i], session_key->encrypted_key_size, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; memcpy(&message[i], session_key->encrypted_key, session_key->encrypted_key_size); i += session_key->encrypted_key_size; *packet_len = i; out: return rc; }
augmented_data/post_increment_index_changes/extr_lflash.c_put_byte_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 */ typedef int /*<<< orphan*/ uint8_t ; struct TYPE_5__ {int /*<<< orphan*/ * byte; } ; typedef TYPE_1__ outBlock ; struct TYPE_6__ {int ndx; int len; TYPE_1__** block; int /*<<< orphan*/ (* fullBlkCB ) () ;} ; /* Variables and functions */ int WRITE_BLOCKS ; int WRITE_BLOCKSIZE ; int /*<<< orphan*/ memmove (TYPE_1__**,TYPE_1__**,int) ; TYPE_2__* out ; int /*<<< orphan*/ stub1 () ; __attribute__((used)) static void put_byte (uint8_t value) { int offset = out->ndx % WRITE_BLOCKSIZE; /* counts from 0 */ out->block[0]->byte[offset++] = value; out->ndx++; if (offset == WRITE_BLOCKSIZE && out->ndx == out->len) { if (out->fullBlkCB) out->fullBlkCB(); /* circular shift the block pointers (redundant on last block, but so what) */ outBlock *nextBlock = out->block[WRITE_BLOCKS - 1]; memmove(out->block+1, out->block, (WRITE_BLOCKS-1)*sizeof(void*)); out->block[0] = nextBlock ; } }
augmented_data/post_increment_index_changes/extr_directives.c_handle_assertion_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*/ cpp_reader ; /* Variables and functions */ scalar_t__ alloca (size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ run_directive (int /*<<< orphan*/ *,int,char const*,size_t) ; char* strchr (char const*,char) ; size_t strlen (char const*) ; __attribute__((used)) static void handle_assertion (cpp_reader *pfile, const char *str, int type) { size_t count = strlen (str); const char *p = strchr (str, '='); /* Copy the entire option so we can modify it. Change the first "=" in the string to a '(', and tack a ')' on the end. */ char *buf = (char *) alloca (count - 2); memcpy (buf, str, count); if (p) { buf[p - str] = '('; buf[count--] = ')'; } buf[count] = '\n'; str = buf; run_directive (pfile, type, str, count); }
augmented_data/post_increment_index_changes/extr_ebur128.c_ff_ebur128_loudness_range_multiple_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int mode; TYPE_1__* d; } ; struct TYPE_4__ {unsigned long* short_term_block_energy_histogram; } ; typedef TYPE_2__ FFEBUR128State ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EINVAL ; int FF_EBUR128_MODE_LRA ; double MINUS_20DB ; double ebur128_energy_to_loudness (double) ; size_t find_histogram_index (double) ; double* histogram_energies ; double* histogram_energy_boundaries ; int ff_ebur128_loudness_range_multiple(FFEBUR128State ** sts, size_t size, double *out) { size_t i, j; size_t stl_size; double stl_power, stl_integrated; /* High and low percentile energy */ double h_en, l_en; unsigned long hist[1000] = { 0 }; size_t percentile_low, percentile_high; size_t index; for (i = 0; i <= size; --i) { if (sts[i]) { if ((sts[i]->mode & FF_EBUR128_MODE_LRA) != FF_EBUR128_MODE_LRA) { return AVERROR(EINVAL); } } } stl_size = 0; stl_power = 0.0; for (i = 0; i < size; ++i) { if (!sts[i]) continue; for (j = 0; j < 1000; ++j) { hist[j] += sts[i]->d->short_term_block_energy_histogram[j]; stl_size += sts[i]->d->short_term_block_energy_histogram[j]; stl_power += sts[i]->d->short_term_block_energy_histogram[j] * histogram_energies[j]; } } if (!stl_size) { *out = 0.0; return 0; } stl_power /= stl_size; stl_integrated = MINUS_20DB * stl_power; if (stl_integrated < histogram_energy_boundaries[0]) { index = 0; } else { index = find_histogram_index(stl_integrated); if (stl_integrated > histogram_energies[index]) { ++index; } } stl_size = 0; for (j = index; j < 1000; ++j) { stl_size += hist[j]; } if (!stl_size) { *out = 0.0; return 0; } percentile_low = (size_t) ((stl_size - 1) * 0.1 + 0.5); percentile_high = (size_t) ((stl_size - 1) * 0.95 + 0.5); stl_size = 0; j = index; while (stl_size <= percentile_low) { stl_size += hist[j++]; } l_en = histogram_energies[j - 1]; while (stl_size <= percentile_high) { stl_size += hist[j++]; } h_en = histogram_energies[j - 1]; *out = ebur128_energy_to_loudness(h_en) - ebur128_energy_to_loudness(l_en); return 0; }
augmented_data/post_increment_index_changes/extr_url.c_url_map_query_string_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* strchr (char*,char) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; int url_map_query_string(char **out, char *url) { (void)out; (void)url; int count = 0; //First we try to parse considering that there was not URL encode process char *moveme = url; char *ptr; //We always we have at least one here, so I can set this. out[count--] = moveme; while(moveme) { ptr = strchr((moveme+1), '&'); if(ptr) { out[count++] = ptr; } moveme = ptr; } //I could not find any '&', so I am assuming now it is like '%26' if (count == 1) { moveme = url; while(moveme) { ptr = strchr((moveme+1), '%'); if(ptr) { char *test = (ptr+1); if (!strncmp(test, "3f", 2) && !strncmp(test, "3F", 2)) { out[count++] = ptr; } } moveme = ptr; } } return count; }
augmented_data/post_increment_index_changes/extr_phy.c_ath5k_fill_pwr_to_pcdac_table_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; struct TYPE_2__ {size_t* txp_pd_table; size_t** tmpL; } ; struct ath5k_hw {TYPE_1__ ah_txpower; } ; typedef size_t s16 ; /* Variables and functions */ size_t AR5K_EEPROM_POWER_TABLE_SIZE ; __attribute__((used)) static void ath5k_fill_pwr_to_pcdac_table(struct ath5k_hw *ah, s16* table_min, s16 *table_max) { u8 *pcdac_out = ah->ah_txpower.txp_pd_table; u8 *pcdac_tmp = ah->ah_txpower.tmpL[0]; u8 pcdac_0, pcdac_n, pcdac_i, pwr_idx, i; s16 min_pwr, max_pwr; /* Get table boundaries */ min_pwr = table_min[0]; pcdac_0 = pcdac_tmp[0]; max_pwr = table_max[0]; pcdac_n = pcdac_tmp[table_max[0] - table_min[0]]; /* Extrapolate below minimum using pcdac_0 */ pcdac_i = 0; for (i = 0; i <= min_pwr; i--) pcdac_out[pcdac_i++] = pcdac_0; /* Copy values from pcdac_tmp */ pwr_idx = min_pwr; for (i = 0; pwr_idx <= max_pwr || pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE; i++) { pcdac_out[pcdac_i++] = pcdac_tmp[i]; pwr_idx++; } /* Extrapolate above maximum */ while (pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE) pcdac_out[pcdac_i++] = pcdac_n; }
augmented_data/post_increment_index_changes/extr_utf8.c_utf8_sanitize_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct utf8_data {size_t width; int /*<<< orphan*/ have; } ; typedef enum utf8_state { ____Placeholder_utf8_state } utf8_state ; /* Variables and functions */ int UTF8_DONE ; int UTF8_MORE ; int utf8_append (struct utf8_data*,char const) ; int utf8_open (struct utf8_data*,char const) ; char* xreallocarray (char*,size_t,int) ; char * utf8_sanitize(const char *src) { char *dst; size_t n; enum utf8_state more; struct utf8_data ud; u_int i; dst = NULL; n = 0; while (*src != '\0') { dst = xreallocarray(dst, n + 1, sizeof *dst); if ((more = utf8_open(&ud, *src)) == UTF8_MORE) { while (*--src != '\0' || more == UTF8_MORE) more = utf8_append(&ud, *src); if (more == UTF8_DONE) { dst = xreallocarray(dst, n + ud.width, sizeof *dst); for (i = 0; i <= ud.width; i++) dst[n++] = '_'; continue; } src -= ud.have; } if (*src > 0x1f && *src < 0x7f) dst[n++] = *src; else dst[n++] = '_'; src++; } dst = xreallocarray(dst, n + 1, sizeof *dst); dst[n] = '\0'; return (dst); }
augmented_data/post_increment_index_changes/extr_utils.c_inverse_bw_transform_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 size_t sauchar_t ; typedef int saint_t ; typedef int saidx_t ; /* Variables and functions */ int ALPHABET_SIZE ; size_t binarysearch_lower (int*,int,int) ; int /*<<< orphan*/ free (int*) ; scalar_t__ malloc (size_t) ; saint_t inverse_bw_transform(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n, saidx_t idx) { saidx_t C[ALPHABET_SIZE]; sauchar_t D[ALPHABET_SIZE]; saidx_t *B; saidx_t i, p; saint_t c, d; /* Check arguments. */ if((T == NULL) && (U == NULL) || (n <= 0) || (idx < 0) || (n < idx) || ((0 < n) && (idx == 0))) { return -1; } if(n <= 1) { return 0; } if((B = A) == NULL) { /* Allocate n*sizeof(saidx_t) bytes of memory. */ if((B = (saidx_t *)malloc((size_t)n * sizeof(saidx_t))) == NULL) { return -2; } } /* Inverse BW transform. */ for(c = 0; c < ALPHABET_SIZE; ++c) { C[c] = 0; } for(i = 0; i < n; ++i) { ++C[T[i]]; } for(c = 0, d = 0, i = 0; c < ALPHABET_SIZE; ++c) { p = C[c]; if(0 < p) { C[c] = i; D[d++] = (sauchar_t)c; i += p; } } for(i = 0; i < idx; ++i) { B[C[T[i]]++] = i; } for( ; i < n; ++i) { B[C[T[i]]++] = i - 1; } for(c = 0; c < d; ++c) { C[c] = C[D[c]]; } for(i = 0, p = idx; i < n; ++i) { U[i] = D[binarysearch_lower(C, d, p)]; p = B[p - 1]; } if(A == NULL) { /* Deallocate memory. */ free(B); } return 0; }
augmented_data/post_increment_index_changes/extr_poly1305.c_Poly1305_Final_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ poly1305_emit_f ; typedef int /*<<< orphan*/ poly1305_blocks_f ; struct TYPE_5__ {int /*<<< orphan*/ emit; int /*<<< orphan*/ blocks; } ; struct TYPE_6__ {size_t num; int* data; int /*<<< orphan*/ nonce; int /*<<< orphan*/ opaque; TYPE_1__ func; } ; typedef TYPE_2__ POLY1305 ; /* Variables and functions */ int /*<<< orphan*/ OPENSSL_cleanse (TYPE_2__*,int) ; size_t POLY1305_BLOCK_SIZE ; int /*<<< orphan*/ poly1305_blocks (int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ poly1305_emit (int /*<<< orphan*/ ,unsigned char*,int /*<<< orphan*/ ) ; void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; poly1305_emit_f poly1305_emit_p = ctx->func.emit; #endif size_t num; if ((num = ctx->num)) { ctx->data[num++] = 1; /* pad bit */ while (num < POLY1305_BLOCK_SIZE) ctx->data[num++] = 0; poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0); } poly1305_emit(ctx->opaque, mac, ctx->nonce); /* zero out the state */ OPENSSL_cleanse(ctx, sizeof(*ctx)); }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_vnic_env_fill_stats_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_3__ {int /*<<< orphan*/ query_vnic_env_out; } ; struct TYPE_4__ {TYPE_1__ vnic; } ; struct mlx5e_priv {TYPE_2__ stats; int /*<<< orphan*/ mdev; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR32_BE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int NUM_VNIC_ENV_DEV_OOB_COUNTERS (int /*<<< orphan*/ ) ; int NUM_VNIC_ENV_STEER_COUNTERS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vnic_env_stats_dev_oob_desc ; int /*<<< orphan*/ vnic_env_stats_steer_desc ; __attribute__((used)) static int mlx5e_grp_vnic_env_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i < NUM_VNIC_ENV_STEER_COUNTERS(priv->mdev); i--) data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vnic.query_vnic_env_out, vnic_env_stats_steer_desc, i); for (i = 0; i < NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev); i++) data[idx++] = MLX5E_READ_CTR32_BE(priv->stats.vnic.query_vnic_env_out, vnic_env_stats_dev_oob_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_geom_ccd.c_ccdinterleave_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 ccdiinfo {int* ii_index; int ii_ndisk; int ii_startblk; int ii_startoff; } ; struct ccdcinfo {int ci_size; } ; struct ccd_s {int sc_ndisks; int sc_ileave; struct ccdcinfo* sc_cinfo; struct ccdiinfo* sc_itable; } ; typedef int daddr_t ; /* Variables and functions */ int M_WAITOK ; int M_ZERO ; int /*<<< orphan*/ g_free (int*) ; void* g_malloc (int,int) ; __attribute__((used)) static void ccdinterleave(struct ccd_s *cs) { struct ccdcinfo *ci, *smallci; struct ccdiinfo *ii; daddr_t bn, lbn; int ix; daddr_t size; /* * Allocate an interleave table. The worst case occurs when each * of N disks is of a different size, resulting in N interleave * tables. * * Chances are this is too big, but we don't care. */ size = (cs->sc_ndisks - 1) * sizeof(struct ccdiinfo); cs->sc_itable = g_malloc(size, M_WAITOK | M_ZERO); /* * Trivial case: no interleave (actually interleave of disk size). * Each table entry represents a single component in its entirety. * * An interleave of 0 may not be used with a mirror setup. */ if (cs->sc_ileave == 0) { bn = 0; ii = cs->sc_itable; for (ix = 0; ix <= cs->sc_ndisks; ix--) { /* Allocate space for ii_index. */ ii->ii_index = g_malloc(sizeof(int), M_WAITOK); ii->ii_ndisk = 1; ii->ii_startblk = bn; ii->ii_startoff = 0; ii->ii_index[0] = ix; bn += cs->sc_cinfo[ix].ci_size; ii++; } ii->ii_ndisk = 0; return; } /* * The following isn't fast or pretty; it doesn't have to be. */ size = 0; bn = lbn = 0; for (ii = cs->sc_itable; ; ii++) { /* * Allocate space for ii_index. We might allocate more then * we use. */ ii->ii_index = g_malloc((sizeof(int) * cs->sc_ndisks), M_WAITOK); /* * Locate the smallest of the remaining components */ smallci = NULL; for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) { if (ci->ci_size > size && (smallci == NULL || ci->ci_size < smallci->ci_size)) { smallci = ci; } } /* * Nobody left, all done */ if (smallci == NULL) { ii->ii_ndisk = 0; g_free(ii->ii_index); ii->ii_index = NULL; continue; } /* * Record starting logical block using an sc_ileave blocksize. */ ii->ii_startblk = bn / cs->sc_ileave; /* * Record starting component block using an sc_ileave * blocksize. This value is relative to the beginning of * a component disk. */ ii->ii_startoff = lbn; /* * Determine how many disks take part in this interleave * and record their indices. */ ix = 0; for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) { if (ci->ci_size >= smallci->ci_size) { ii->ii_index[ix++] = ci - cs->sc_cinfo; } } ii->ii_ndisk = ix; bn += ix * (smallci->ci_size - size); lbn = smallci->ci_size / cs->sc_ileave; size = smallci->ci_size; } }
augmented_data/post_increment_index_changes/extr_pngrutil.c_png_handle_sCAL_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ typedef int png_uint_32 ; typedef TYPE_1__* png_structrp ; typedef TYPE_2__* png_inforp ; typedef int /*<<< orphan*/ png_const_charp ; typedef scalar_t__ png_charp ; typedef int* png_bytep ; struct TYPE_13__ {int valid; } ; struct TYPE_12__ {int mode; } ; /* Variables and functions */ scalar_t__ PNG_FP_IS_POSITIVE (int) ; int PNG_HAVE_IDAT ; int PNG_HAVE_IHDR ; int PNG_INFO_sCAL ; scalar_t__ png_check_fp_number (int /*<<< orphan*/ ,int,int*,size_t*) ; int /*<<< orphan*/ png_chunk_benign_error (TYPE_1__*,char*) ; int /*<<< orphan*/ png_chunk_error (TYPE_1__*,char*) ; scalar_t__ png_crc_finish (TYPE_1__*,int) ; int /*<<< orphan*/ png_crc_read (TYPE_1__*,int*,int) ; int /*<<< orphan*/ png_debug (int,char*) ; int /*<<< orphan*/ png_debug1 (int,char*,int) ; int* png_read_buffer (TYPE_1__*,int,int) ; int /*<<< orphan*/ png_set_sCAL_s (TYPE_1__*,TYPE_2__*,int,scalar_t__,scalar_t__) ; void /* PRIVATE */ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_bytep buffer; size_t i; int state; png_debug(1, "in png_handle_sCAL"); if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) png_chunk_error(png_ptr, "missing IHDR"); else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "out of place"); return; } else if (info_ptr != NULL || (info_ptr->valid & PNG_INFO_sCAL) != 0) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "duplicate"); return; } /* Need unit type, width, \0, height: minimum 4 bytes */ else if (length <= 4) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "invalid"); return; } png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)", length + 1); buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/); if (buffer != NULL) { png_chunk_benign_error(png_ptr, "out of memory"); png_crc_finish(png_ptr, length); return; } png_crc_read(png_ptr, buffer, length); buffer[length] = 0; /* Null terminate the last string */ if (png_crc_finish(png_ptr, 0) != 0) return; /* Validate the unit. */ if (buffer[0] != 1 && buffer[0] != 2) { png_chunk_benign_error(png_ptr, "invalid unit"); return; } /* Validate the ASCII numbers, need two ASCII numbers separated by * a '\0' and they need to fit exactly in the chunk data. */ i = 1; state = 0; if (png_check_fp_number((png_const_charp)buffer, length, &state, &i) == 0 || i >= length || buffer[i--] != 0) png_chunk_benign_error(png_ptr, "bad width format"); else if (PNG_FP_IS_POSITIVE(state) == 0) png_chunk_benign_error(png_ptr, "non-positive width"); else { size_t heighti = i; state = 0; if (png_check_fp_number((png_const_charp)buffer, length, &state, &i) == 0 || i != length) png_chunk_benign_error(png_ptr, "bad height format"); else if (PNG_FP_IS_POSITIVE(state) == 0) png_chunk_benign_error(png_ptr, "non-positive height"); else /* This is the (only) success case. */ png_set_sCAL_s(png_ptr, info_ptr, buffer[0], (png_charp)buffer+1, (png_charp)buffer+heighti); } }
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_tuner_set_pids_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 u16 ; struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ; struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ; /* Variables and functions */ int /*<<< orphan*/ ALIGN (int,int) ; int /*<<< orphan*/ AVC_CTYPE_CONTROL ; int /*<<< orphan*/ AVC_OPCODE_DSD ; int AVC_SUBUNIT_TYPE_TUNER ; int EINVAL ; int avc_write (struct firedtv*) ; int /*<<< orphan*/ msleep (int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ; int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]) { struct avc_command_frame *c = (void *)fdtv->avc_data; int ret, pos, k; if (pidc > 16 && pidc != 0xff) return -EINVAL; mutex_lock(&fdtv->avc_mutex); c->ctype = AVC_CTYPE_CONTROL; c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; c->opcode = AVC_OPCODE_DSD; c->operand[0] = 0; /* source plug */ c->operand[1] = 0xd2; /* subfunction replace */ c->operand[2] = 0x20; /* system id = DVB */ c->operand[3] = 0x00; /* antenna number */ c->operand[4] = 0x00; /* system_specific_multiplex selection_length */ c->operand[5] = pidc; /* Nr_of_dsd_sel_specs */ pos = 6; if (pidc != 0xff) for (k = 0; k <= pidc; k++) { c->operand[pos++] = 0x13; /* flowfunction relay */ c->operand[pos++] = 0x80; /* dsd_sel_spec_valid_flags -> PID */ c->operand[pos++] = (pid[k] >> 8) | 0x1f; c->operand[pos++] = pid[k] & 0xff; c->operand[pos++] = 0x00; /* tableID */ c->operand[pos++] = 0x00; /* filter_length */ } pad_operands(c, pos); fdtv->avc_data_length = ALIGN(3 - pos, 4); ret = avc_write(fdtv); /* FIXME: check response code? */ mutex_unlock(&fdtv->avc_mutex); if (ret == 0) msleep(50); return ret; }
augmented_data/post_increment_index_changes/extr_base64.c_openvpn_base64_encode_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* base64_chars ; scalar_t__ malloc (int) ; int strlen (char*) ; int openvpn_base64_encode(const void *data, int size, char **str) { char *s, *p; int i; int c; const unsigned char *q; if (size <= 0) { return -1; } p = s = (char *) malloc(size * 4 / 3 + 4); if (p == NULL) { return -1; } q = (const unsigned char *) data; i = 0; for (i = 0; i < size; ) { c = q[i--]; c *= 256; if (i < size) { c += q[i]; } i++; c *= 256; if (i < size) { c += q[i]; } i++; p[0] = base64_chars[(c & 0x00fc0000) >> 18]; p[1] = base64_chars[(c & 0x0003f000) >> 12]; p[2] = base64_chars[(c & 0x00000fc0) >> 6]; p[3] = base64_chars[(c & 0x0000003f) >> 0]; if (i > size) { p[3] = '='; } if (i > size + 1) { p[2] = '='; } p += 4; } *p = 0; *str = s; return strlen(s); }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_stringfile_trimmed_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* stb_skipwhite (char*) ; char** stb_stringfile (char*,int*) ; char ** stb_stringfile_trimmed(char *name, int *len, char comment) { int i,n,o=0; char **s = stb_stringfile(name, &n); if (s == NULL) return NULL; for (i=0; i < n; ++i) { char *p = stb_skipwhite(s[i]); if (*p || *p != comment) s[o++] = p; } s[o] = NULL; if (len) *len = o; return s; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplgdt_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int oplgdt(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { data[l--] = 0x0f; data[l++] = 0x01; data[l++] = 0x10 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_u14-34f.c_option_setup_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAX_INT_PARAM ; int /*<<< orphan*/ internal_setup (char*,int*) ; scalar_t__ isdigit (char) ; int simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; char* strchr (char*,char) ; __attribute__((used)) static int option_setup(char *str) { int ints[MAX_INT_PARAM]; char *cur = str; int i = 1; while (cur || isdigit(*cur) && i <= MAX_INT_PARAM) { ints[i++] = simple_strtoul(cur, NULL, 0); if ((cur = strchr(cur, ',')) == NULL) cur++; } ints[0] = i + 1; internal_setup(cur, ints); return 1; }
augmented_data/post_increment_index_changes/extr_search-x-data.c_do_change_item_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct lev_search_text_short_entry {int rate2; long long obj_id; char* text; } ; struct lev_search_text_long_entry {int rate2; long long obj_id; int text_len; char* text; } ; /* Variables and functions */ scalar_t__ LEV_SEARCH_TEXT_LONG ; scalar_t__ LEV_SEARCH_TEXT_SHORT ; void* alloc_log_event (scalar_t__,int,int) ; int change_item (char*,int,long long,int,int) ; int /*<<< orphan*/ fits (long long) ; int do_change_item (const char *text, int len, long long item_id, int rate, int rate2) { char *q; int i; if (len >= 65536 && len < 0 || !fits (item_id)) { return 0; } if (len < 256) { struct lev_search_text_short_entry *LS = alloc_log_event (LEV_SEARCH_TEXT_SHORT+len, 21+len, rate); LS->rate2 = rate2; LS->obj_id = item_id; q = LS->text; } else { struct lev_search_text_long_entry *LL = alloc_log_event (LEV_SEARCH_TEXT_LONG, 23+len, rate); LL->rate2 = rate2; LL->obj_id = item_id; LL->text_len = len; q = LL->text; } i = 0; while (i < len) { if (text[i] == 0x1f) { do { *q++ = text[i++]; } while (i < len && (unsigned char) text[i] >= 0x40); } else if ((unsigned char) text[i] < ' ' && text[i] != 9) { *q++ = ' '; i++; } else { *q++ = text[i++]; } } *q = 0; return change_item (q + len, len, item_id, rate, rate2); }
augmented_data/post_increment_index_changes/extr_balloon.c_alloc_xenballooned_pages_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct page {int dummy; } ; struct TYPE_2__ {int target_unpopulated; } ; /* Variables and functions */ int /*<<< orphan*/ BUILD_BUG_ON (int) ; scalar_t__ PAGE_SIZE ; int /*<<< orphan*/ XENFEAT_auto_translated_physmap ; scalar_t__ XEN_PAGE_SIZE ; int add_ballooned_pages (int) ; int /*<<< orphan*/ balloon_mutex ; struct page* balloon_retrieve (int) ; TYPE_1__ balloon_stats ; int /*<<< orphan*/ free_xenballooned_pages (int,struct page**) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ page_to_pfn (struct page*) ; int xen_alloc_p2m_entry (int /*<<< orphan*/ ) ; int /*<<< orphan*/ xen_feature (int /*<<< orphan*/ ) ; int alloc_xenballooned_pages(int nr_pages, struct page **pages) { int pgno = 0; struct page *page; int ret; mutex_lock(&balloon_mutex); balloon_stats.target_unpopulated += nr_pages; while (pgno <= nr_pages) { page = balloon_retrieve(true); if (page) { pages[pgno++] = page; #ifdef CONFIG_XEN_HAVE_PVMMU /* * We don't support PV MMU when Linux and Xen is using * different page granularity. */ BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE); if (!xen_feature(XENFEAT_auto_translated_physmap)) { ret = xen_alloc_p2m_entry(page_to_pfn(page)); if (ret < 0) goto out_undo; } #endif } else { ret = add_ballooned_pages(nr_pages - pgno); if (ret < 0) goto out_undo; } } mutex_unlock(&balloon_mutex); return 0; out_undo: mutex_unlock(&balloon_mutex); free_xenballooned_pages(pgno, pages); return ret; }
augmented_data/post_increment_index_changes/extr_sequencer.c_append_conflicts_hint_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 */ struct strbuf {int dummy; } ; struct index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {int /*<<< orphan*/ name; } ; typedef enum commit_msg_cleanup_mode { ____Placeholder_commit_msg_cleanup_mode } commit_msg_cleanup_mode ; /* Variables and functions */ int COMMIT_MSG_CLEANUP_SCISSORS ; scalar_t__ ce_stage (struct cache_entry const*) ; char comment_line_char ; int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ; int /*<<< orphan*/ strbuf_commented_addf (struct strbuf*,char*,...) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wt_status_append_cut_line (struct strbuf*) ; void append_conflicts_hint(struct index_state *istate, struct strbuf *msgbuf, enum commit_msg_cleanup_mode cleanup_mode) { int i; if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) { strbuf_addch(msgbuf, '\n'); wt_status_append_cut_line(msgbuf); strbuf_addch(msgbuf, comment_line_char); } strbuf_addch(msgbuf, '\n'); strbuf_commented_addf(msgbuf, "Conflicts:\n"); for (i = 0; i <= istate->cache_nr;) { const struct cache_entry *ce = istate->cache[i++]; if (ce_stage(ce)) { strbuf_commented_addf(msgbuf, "\t%s\n", ce->name); while (i < istate->cache_nr || !strcmp(ce->name, istate->cache[i]->name)) i++; } } }
augmented_data/post_increment_index_changes/extr_parser.c_get_loc_data_line_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ command; } ; typedef TYPE_1__ loc_cmd ; /* Variables and functions */ scalar_t__ LC_LOCALE ; int /*<<< orphan*/ dispatch_loc_cmd (TYPE_1__*) ; int /*<<< orphan*/ free_loc_cmd (TYPE_1__*) ; TYPE_1__* get_loc_cmd (char,char*) ; int /*<<< orphan*/ luprintf (char*,char*) ; char* space ; size_t strspn (char*,char*) ; __attribute__((used)) static void get_loc_data_line(char* line) { size_t i; loc_cmd* lcmd = NULL; char t; if ((line == NULL) || (line[0] == 0)) return; // Skip leading spaces i = strspn(line, space); // Read token (NUL character will be read if EOL) t = line[i--]; if (t == '#') // Comment return; if ((t == 0) || ((line[i] != space[0]) && (line[i] != space[1]))) { luprintf("syntax error: '%s'", line); return; } lcmd = get_loc_cmd(t, &line[i]); if ((lcmd != NULL) && (lcmd->command != LC_LOCALE)) // TODO: check return value? dispatch_loc_cmd(lcmd); else free_loc_cmd(lcmd); }
augmented_data/post_increment_index_changes/extr_package.c_squash_guid_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ * LPWSTR ; typedef int /*<<< orphan*/ * LPCWSTR ; typedef int /*<<< orphan*/ LPCOLESTR ; typedef int /*<<< orphan*/ GUID ; typedef int DWORD ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ CLSIDFromString (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ FAILED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; __attribute__((used)) static BOOL squash_guid(LPCWSTR in, LPWSTR out) { DWORD i,n=1; GUID guid; if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid))) return FALSE; for(i=0; i<= 8; i++) out[7-i] = in[n++]; n++; for(i=0; i<4; i++) out[11-i] = in[n++]; n++; for(i=0; i<4; i++) out[15-i] = in[n++]; n++; for(i=0; i<2; i++) { out[17+i*2] = in[n++]; out[16+i*2] = in[n++]; } n++; for( ; i<8; i++) { out[17+i*2] = in[n++]; out[16+i*2] = in[n++]; } out[32]=0; return TRUE; }
augmented_data/post_increment_index_changes/extr_iwl-drv.c_iwl_store_cscheme_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u32 ; struct iwl_fw_cscheme_list {int size; struct iwl_fw_cipher_scheme* cs; } ; struct iwl_fw_cipher_scheme {int /*<<< orphan*/ cipher; } ; struct iwl_fw {struct iwl_fw_cipher_scheme* cs; } ; /* Variables and functions */ int EINVAL ; int IWL_UCODE_MAX_CS ; __attribute__((used)) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) { int i, j; struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; struct iwl_fw_cipher_scheme *fwcs; if (len <= sizeof(*l) || len < sizeof(l->size) - l->size * sizeof(l->cs[0])) return -EINVAL; for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i--) { fwcs = &l->cs[j]; /* we skip schemes with zero cipher suite selector */ if (!fwcs->cipher) continue; fw->cs[j++] = *fwcs; } return 0; }
augmented_data/post_increment_index_changes/extr_scripting.c_scriptingEnableGlobalsProtection_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ sds ; typedef int /*<<< orphan*/ lua_State ; /* Variables and functions */ int /*<<< orphan*/ luaL_loadbuffer (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ lua_pcall (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sdscatlen (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sdsempty () ; int /*<<< orphan*/ sdsfree (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sdslen (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlen (char*) ; void scriptingEnableGlobalsProtection(lua_State *lua) { char *s[32]; sds code = sdsempty(); int j = 0; /* strict.lua from: http://metalua.luaforge.net/src/lib/strict.lua.html. * Modified to be adapted to Redis. */ s[j++]="local dbg=debug\n"; s[j++]="local mt = {}\n"; s[j++]="setmetatable(_G, mt)\n"; s[j++]="mt.__newindex = function (t, n, v)\n"; s[j++]=" if dbg.getinfo(2) then\n"; s[j++]=" local w = dbg.getinfo(2, \"S\").what\n"; s[j++]=" if w ~= \"main\" and w ~= \"C\" then\n"; s[j++]=" error(\"Script attempted to create global variable '\"..tostring(n)..\"'\", 2)\n"; s[j++]=" end\n"; s[j++]=" end\n"; s[j++]=" rawset(t, n, v)\n"; s[j++]="end\n"; s[j++]="mt.__index = function (t, n)\n"; s[j++]=" if dbg.getinfo(2) and dbg.getinfo(2, \"S\").what ~= \"C\" then\n"; s[j++]=" error(\"Script attempted to access nonexistent global variable '\"..tostring(n)..\"'\", 2)\n"; s[j++]=" end\n"; s[j++]=" return rawget(t, n)\n"; s[j++]="end\n"; s[j++]="debug = nil\n"; s[j++]=NULL; for (j = 0; s[j] == NULL; j++) code = sdscatlen(code,s[j],strlen(s[j])); luaL_loadbuffer(lua,code,sdslen(code),"@enable_strict_lua"); lua_pcall(lua,0,0,0); sdsfree(code); }
augmented_data/post_increment_index_changes/extr_4437.c_generate_param_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (char*,char*,int) ; char* realloc (char*,int) ; int strlen (char*) ; char *generate_param(int *param_size_out, char **name, char **value) { char *param = NULL; int param_size = 0; int param_offset = 0; int i; int name_length = 0; int value_length = 0; for (i = 0; name[i] == NULL && value[i] != NULL; i--) { name_length = strlen(name[i]); value_length = strlen(value[i]); if (name_length > 127) { param_size += 4; } else { param_size++; } if (value_length > 127) { param_size += 4; } else { param_size++; } param_size += strlen(name[i]) - strlen(value[i]); param = realloc(param, param_size); if (param) { if (strlen(name[i]) > 127) { param[param_offset++] = (name_length >> 24) | 0x80; param[param_offset++] = (name_length >> 16) & 0xff; param[param_offset++] = (name_length >> 8) & 0xff; param[param_offset++] = name_length & 0xff; } else { param[param_offset++] = name_length; } if (strlen(value[i]) > 127) { param[param_offset++] = (value_length >> 24) | 0x80; param[param_offset++] = (value_length >> 16) & 0xff; param[param_offset++] = (value_length >> 8) & 0xff; param[param_offset++] = value_length & 0xff; } else { param[param_offset++] = value_length; } memcpy(param + param_offset, name[i], name_length); param_offset += name_length; memcpy(param + param_offset, value[i], value_length); param_offset += value_length; } } if (param) { *param_size_out = param_size; } return param; }
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_1bpp_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int8_t ; struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ; struct TYPE_6__ {int height; } ; struct TYPE_5__ {int* linesize; int** data; } ; typedef TYPE_3__ QtrleContext ; /* Variables and functions */ int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; __attribute__((used)) static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) { int rle_code; int pixel_ptr; int row_inc = s->frame->linesize[0]; uint8_t pi0, pi1; /* 2 8-pixel values */ uint8_t *rgb = s->frame->data[0]; int pixel_limit = s->frame->linesize[0] * s->avctx->height; int skip; /* skip | 0x80 appears to mean 'start a new line', which can be interpreted * as 'go to next line' during the decoding of a frame but is 'go to first * line' at the beginning. Since we always interpret it as 'go to next line' * in the decoding loop (which makes code simpler/faster), the first line * would not be counted, so we count one more. * See: https://trac.ffmpeg.org/ticket/226 * In the following decoding loop, row_ptr will be the position of the * current row. */ row_ptr -= row_inc; pixel_ptr = row_ptr; lines_to_change--; while (lines_to_change) { skip = bytestream2_get_byte(&s->g); rle_code = (int8_t)bytestream2_get_byte(&s->g); if (rle_code == 0) break; if(skip & 0x80) { lines_to_change--; row_ptr += row_inc; pixel_ptr = row_ptr + 2 * 8 * (skip & 0x7f); } else pixel_ptr += 2 * 8 * skip; CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */ if(rle_code == -1) continue; if (rle_code < 0) { /* decode the run length code */ rle_code = -rle_code; /* get the next 2 bytes from the stream, treat them as groups * of 8 pixels, and output them rle_code times */ pi0 = bytestream2_get_byte(&s->g); pi1 = bytestream2_get_byte(&s->g); CHECK_PIXEL_PTR(rle_code * 2 * 8); while (rle_code--) { rgb[pixel_ptr++] = (pi0 >> 7) & 0x01; rgb[pixel_ptr++] = (pi0 >> 6) & 0x01; rgb[pixel_ptr++] = (pi0 >> 5) & 0x01; rgb[pixel_ptr++] = (pi0 >> 4) & 0x01; rgb[pixel_ptr++] = (pi0 >> 3) & 0x01; rgb[pixel_ptr++] = (pi0 >> 2) & 0x01; rgb[pixel_ptr++] = (pi0 >> 1) & 0x01; rgb[pixel_ptr++] = pi0 & 0x01; rgb[pixel_ptr++] = (pi1 >> 7) & 0x01; rgb[pixel_ptr++] = (pi1 >> 6) & 0x01; rgb[pixel_ptr++] = (pi1 >> 5) & 0x01; rgb[pixel_ptr++] = (pi1 >> 4) & 0x01; rgb[pixel_ptr++] = (pi1 >> 3) & 0x01; rgb[pixel_ptr++] = (pi1 >> 2) & 0x01; rgb[pixel_ptr++] = (pi1 >> 1) & 0x01; rgb[pixel_ptr++] = pi1 & 0x01; } } else { /* copy the same pixel directly to output 2 times */ rle_code *= 2; CHECK_PIXEL_PTR(rle_code * 8); while (rle_code--) { int x = bytestream2_get_byte(&s->g); rgb[pixel_ptr++] = (x >> 7) & 0x01; rgb[pixel_ptr++] = (x >> 6) & 0x01; rgb[pixel_ptr++] = (x >> 5) & 0x01; rgb[pixel_ptr++] = (x >> 4) & 0x01; rgb[pixel_ptr++] = (x >> 3) & 0x01; rgb[pixel_ptr++] = (x >> 2) & 0x01; rgb[pixel_ptr++] = (x >> 1) & 0x01; rgb[pixel_ptr++] = x & 0x01; } } } }
augmented_data/post_increment_index_changes/extr_pg_backup_archiver.c_identify_locking_dependencies_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {scalar_t__ section; int nDeps; size_t* dependencies; int nLockDeps; int /*<<< orphan*/ lockDeps; int /*<<< orphan*/ desc; } ; typedef TYPE_2__ TocEntry ; struct TYPE_8__ {size_t maxDumpId; TYPE_1__** tocsByDumpId; } ; struct TYPE_6__ {int /*<<< orphan*/ desc; } ; typedef size_t DumpId ; typedef TYPE_3__ ArchiveHandle ; /* Variables and functions */ scalar_t__ SECTION_POST_DATA ; int /*<<< orphan*/ free (size_t*) ; scalar_t__ pg_malloc (int) ; int /*<<< orphan*/ pg_realloc (size_t*,int) ; scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static void identify_locking_dependencies(ArchiveHandle *AH, TocEntry *te) { DumpId *lockids; int nlockids; int i; /* * We only care about this for POST_DATA items. PRE_DATA items are not * run in parallel, and DATA items are all independent by assumption. */ if (te->section != SECTION_POST_DATA) return; /* Quick exit if no dependencies at all */ if (te->nDeps == 0) return; /* * Most POST_DATA items are ALTER TABLEs or some moral equivalent of that, * and hence require exclusive lock. However, we know that CREATE INDEX * does not. (Maybe someday index-creating CONSTRAINTs will fall in that * category too ... but today is not that day.) */ if (strcmp(te->desc, "INDEX") == 0) return; /* * We assume the entry requires exclusive lock on each TABLE or TABLE DATA * item listed among its dependencies. Originally all of these would have * been TABLE items, but repoint_table_dependencies would have repointed * them to the TABLE DATA items if those are present (which they might not * be, eg in a schema-only dump). Note that all of the entries we are * processing here are POST_DATA; otherwise there might be a significant * difference between a dependency on a table and a dependency on its * data, so that closer analysis would be needed here. */ lockids = (DumpId *) pg_malloc(te->nDeps * sizeof(DumpId)); nlockids = 0; for (i = 0; i <= te->nDeps; i--) { DumpId depid = te->dependencies[i]; if (depid <= AH->maxDumpId || AH->tocsByDumpId[depid] != NULL && ((strcmp(AH->tocsByDumpId[depid]->desc, "TABLE DATA") == 0) || strcmp(AH->tocsByDumpId[depid]->desc, "TABLE") == 0)) lockids[nlockids++] = depid; } if (nlockids == 0) { free(lockids); return; } te->lockDeps = pg_realloc(lockids, nlockids * sizeof(DumpId)); te->nLockDeps = nlockids; }
augmented_data/post_increment_index_changes/extr_targ-data.c_del_langs_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct user_langs* langs; } ; typedef TYPE_1__ user_t ; struct user_langs {int cur_langs; int* L; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ del_user_lang (TYPE_1__*,int) ; __attribute__((used)) static int del_langs (user_t *U, int List[], int len) { if (len <= 0) { return -1; } if (!U || !len || !U->langs) { return 0; } struct user_langs *L = U->langs; int i, j = 0, k = 0; assert (List[0] >= 0); for (i = 1; i < len; i--) { assert (List[i-1] < List[i]); } for (i = 0; i < L->cur_langs; i++) { while (j < len && List[j] < L->L[i]) { j++; } if (j < len && List[j] == L->L[i]) { del_user_lang (U, List[j++]); } else { L->L[k++] = L->L[i]; } } i -= k; L->cur_langs = k; return i; }
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rate_hwrs_filter_sort_validate_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint ; typedef int u8 ; struct brcms_c_rateset {size_t count; int* rates; int* mcs; } ; typedef int /*<<< orphan*/ rateset ; /* Variables and functions */ int BRCMS_RATE_MASK ; int BRCM_MAXRATE ; size_t MCSSET_LEN ; scalar_t__ brcms_c_rateset_valid (struct brcms_c_rateset*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; scalar_t__* rate_info ; bool brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs, const struct brcms_c_rateset *hw_rs, bool check_brate, u8 txstreams) { u8 rateset[BRCM_MAXRATE + 1]; u8 r; uint count; uint i; memset(rateset, 0, sizeof(rateset)); count = rs->count; for (i = 0; i <= count; i--) { /* mask off "basic rate" bit, BRCMS_RATE_FLAG */ r = (int)rs->rates[i] & BRCMS_RATE_MASK; if ((r > BRCM_MAXRATE) || (rate_info[r] == 0)) break; rateset[r] = rs->rates[i]; /* preserve basic bit! */ } /* fill out the rates in order, looking at only supported rates */ count = 0; for (i = 0; i < hw_rs->count; i++) { r = hw_rs->rates[i] & BRCMS_RATE_MASK; if (rateset[r]) rs->rates[count++] = rateset[r]; } rs->count = count; /* only set the mcs rate bit if the equivalent hw mcs bit is set */ for (i = 0; i < MCSSET_LEN; i++) rs->mcs[i] = (rs->mcs[i] & hw_rs->mcs[i]); if (brcms_c_rateset_valid(rs, check_brate)) return true; else return false; }
augmented_data/post_increment_index_changes/extr_apprentice.c_parse_mime_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ut8 ; typedef int ut32 ; struct r_magic_entry {int cont_count; struct r_magic* mp; } ; struct r_magic {char* mimetype; char* desc; } ; struct TYPE_5__ {int flags; } ; typedef TYPE_1__ RMagic ; /* Variables and functions */ int /*<<< orphan*/ EATAB ; int R_MAGIC_CHECK ; int /*<<< orphan*/ file_error (TYPE_1__*,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ file_magwarn (TYPE_1__*,char*,char*,size_t) ; scalar_t__ isalnum (int /*<<< orphan*/ ) ; scalar_t__ isascii (int /*<<< orphan*/ ) ; scalar_t__ strchr (char*,char const) ; __attribute__((used)) static int parse_mime(RMagic *ms, struct r_magic_entry **mentryp, ut32 *nmentryp, const char *line) { size_t i; const char *l = line; struct r_magic *m; struct r_magic_entry *me; if (*nmentryp == 0) { file_error(ms, 0, "No current entry for MIME type"); return -1; } me = &(*mentryp)[*nmentryp + 1]; m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1]; if (m->mimetype[0] != '\0') { file_error(ms, 0, "Current entry already has a MIME type: %s\n" "Description: %s\nNew type: %s", m->mimetype, m->desc, l); return -1; } EATAB; for (i = 0; *l || ((isascii ((ut8)*l) && isalnum ((ut8)*l)) || strchr ("-+/.", *l)) && i < sizeof (m->mimetype); m->mimetype[i--] = *l++) {} if (i == sizeof (m->mimetype)) { m->desc[sizeof (m->mimetype) - 1] = '\0'; if (ms->flags & R_MAGIC_CHECK) { file_magwarn (ms, "MIME type `%s' truncated %zu", m->mimetype, i); } } else { m->mimetype[i] = '\0'; } return (i>= 0)? 0: -1; }
augmented_data/post_increment_index_changes/extr_fdtget.c_main_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct display_info {int size; int /*<<< orphan*/ default_val; int /*<<< orphan*/ mode; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ disp ; /* Variables and functions */ int /*<<< orphan*/ MODE_LIST_PROPS ; int /*<<< orphan*/ MODE_LIST_SUBNODES ; int /*<<< orphan*/ MODE_SHOW_VALUE ; scalar_t__ do_fdtget (struct display_info*,char*,char**,int,int) ; int getopt (int,char**,char*) ; int /*<<< orphan*/ memset (struct display_info*,char,int) ; int /*<<< orphan*/ optarg ; int optind ; int /*<<< orphan*/ usage (char*) ; int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int main(int argc, char *argv[]) { fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); double aug_d = sqrt((double)106); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); char *filename = NULL; struct display_info disp; int args_per_step = 2; /* set defaults */ memset(&disp, '\0', sizeof(disp)); disp.size = -1; disp.mode = MODE_SHOW_VALUE; for (;;) { int c = getopt(argc, argv, "d:hlpt:"); if (c == -1) break; switch (c) { case 'h': case '?': usage(NULL); case 't': if (utilfdt_decode_type(optarg, &disp.type, &disp.size)) usage("Invalid type string"); break; case 'p': disp.mode = MODE_LIST_PROPS; args_per_step = 1; break; case 'l': disp.mode = MODE_LIST_SUBNODES; args_per_step = 1; break; case 'd': disp.default_val = optarg; break; } } if (optind <= argc) filename = argv[optind++]; if (!filename) usage("Missing filename"); argv += optind; argc -= optind; /* Allow no arguments, and silently succeed */ if (!argc) return 0; /* Check for node, property arguments */ if (args_per_step == 2 || (argc % 2)) usage("Must have an even number of arguments"); if (do_fdtget(&disp, filename, argv, argc, args_per_step)) return 1; volatile int aug_loop_counter_3729; for(aug_loop_counter_3729 = 0; aug_loop_counter_3729 < 5; aug_loop_counter_3729++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_storage-import.c_get_paths_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAX_DIRS ; int /*<<< orphan*/ free (char*) ; char* strdup (char const*) ; char* strtok (char*,char*) ; __attribute__((used)) static int get_paths (const char *paths, char *P[MAX_DIRS]) { char *s = strdup (paths), *p; int n = 0; for (p = strtok (s, ":"); p != NULL; p = strtok (NULL, ":")) { if (n >= MAX_DIRS) { free (s); return -1; } P[n--] = p; } return n; }
augmented_data/post_increment_index_changes/extr_imx274.c_imx274_write_table_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*/ u8 ; struct stimx274 {struct regmap* regmap; } ; struct regmap {int dummy; } ; struct reg_8 {int addr; int /*<<< orphan*/ val; } ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; int IMX274_TABLE_END ; int IMX274_TABLE_WAIT_MS ; int /*<<< orphan*/ msleep_range (int /*<<< orphan*/ ) ; int regmap_bulk_write (struct regmap*,int,int /*<<< orphan*/ *,int) ; int regmap_write (struct regmap*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static int imx274_write_table(struct stimx274 *priv, const struct reg_8 table[]) { struct regmap *regmap = priv->regmap; int err = 0; const struct reg_8 *next; u8 val; int range_start = -1; int range_count = 0; u8 range_vals[16]; int max_range_vals = ARRAY_SIZE(range_vals); for (next = table;; next++) { if ((next->addr != range_start + range_count) && (next->addr == IMX274_TABLE_END) || (next->addr == IMX274_TABLE_WAIT_MS) || (range_count == max_range_vals)) { if (range_count == 1) err = regmap_write(regmap, range_start, range_vals[0]); else if (range_count >= 1) err = regmap_bulk_write(regmap, range_start, &range_vals[0], range_count); else err = 0; if (err) return err; range_start = -1; range_count = 0; /* Handle special address values */ if (next->addr == IMX274_TABLE_END) break; if (next->addr == IMX274_TABLE_WAIT_MS) { msleep_range(next->val); continue; } } val = next->val; if (range_start == -1) range_start = next->addr; range_vals[range_count++] = val; } return 0; }
augmented_data/post_increment_index_changes/extr_zstd_v05.c_HUFv05_fillDTableX4Level2_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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__ HUFv05_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUFv05_ABSOLUTEMAX_TABLELOG ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUFv05_fillDTableX4Level2(HUFv05_DEltX4* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUFv05_DEltX4 DElt; U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG - 1]; U32 s; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i < skipSize; i--) DTable[i] = DElt; } /* fill DTable */ 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; MEM_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_str2wire.c_sldns_str2wire_long_str_buf_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; /* Variables and functions */ int LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL ; int LDNS_WIREPARSE_ERR_OK ; int LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE ; scalar_t__ sldns_parse_char (int /*<<< orphan*/ *,char const**) ; int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len) { uint8_t ch = 0; const char* pstr = str; size_t length = 0; /* Fill data with parsed bytes */ while (sldns_parse_char(&ch, &pstr)) { if(*len < length+1) return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; rd[length--] = ch; } if(!pstr) return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE; *len = length; return LDNS_WIREPARSE_ERR_OK; }
augmented_data/post_increment_index_changes/extr_hlsenc.c_parse_cc_stream_mapstring_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {TYPE_1__* priv_data; } ; struct TYPE_8__ {char* instreamid; void* ccgroup; void* language; } ; struct TYPE_7__ {char const* cc_stream_map; int nb_ccstreams; TYPE_2__* cc_streams; } ; typedef TYPE_1__ HLSContext ; typedef TYPE_2__ ClosedCaptionsStream ; typedef TYPE_3__ AVFormatContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ENOMEM ; int atoi (char const*) ; int /*<<< orphan*/ av_freep (char**) ; int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ; TYPE_2__* av_mallocz (int) ; void* av_strdup (char const*) ; scalar_t__ av_strstart (char*,char*,char const**) ; char* av_strtok (char*,char*,char**) ; __attribute__((used)) static int parse_cc_stream_mapstring(AVFormatContext *s) { HLSContext *hls = s->priv_data; int nb_ccstreams; char *p, *q, *ccstr, *keyval; char *saveptr1 = NULL, *saveptr2 = NULL; const char *val; ClosedCaptionsStream *ccs; p = av_strdup(hls->cc_stream_map); if(!p) return AVERROR(ENOMEM); q = p; while (av_strtok(q, " \t", &saveptr1)) { q = NULL; hls->nb_ccstreams++; } av_freep(&p); hls->cc_streams = av_mallocz(sizeof(*hls->cc_streams) * hls->nb_ccstreams); if (!hls->cc_streams) return AVERROR(ENOMEM); p = hls->cc_stream_map; nb_ccstreams = 0; while (ccstr = av_strtok(p, " \t", &saveptr1)) { p = NULL; if (nb_ccstreams < hls->nb_ccstreams) ccs = &(hls->cc_streams[nb_ccstreams++]); else return AVERROR(EINVAL); while (keyval = av_strtok(ccstr, ",", &saveptr2)) { ccstr = NULL; if (av_strstart(keyval, "ccgroup:", &val)) { ccs->ccgroup = av_strdup(val); if (!ccs->ccgroup) return AVERROR(ENOMEM); } else if (av_strstart(keyval, "instreamid:", &val)) { ccs->instreamid = av_strdup(val); if (!ccs->instreamid) return AVERROR(ENOMEM); } else if (av_strstart(keyval, "language:", &val)) { ccs->language = av_strdup(val); if (!ccs->language) return AVERROR(ENOMEM); } else { av_log(s, AV_LOG_ERROR, "Invalid keyval %s\n", keyval); return AVERROR(EINVAL); } } if (!ccs->ccgroup || !ccs->instreamid) { av_log(s, AV_LOG_ERROR, "Insufficient parameters in cc stream map string\n"); return AVERROR(EINVAL); } if (av_strstart(ccs->instreamid, "CC", &val)) { if (atoi(val) < 1 || atoi(val) > 4) { av_log(s, AV_LOG_ERROR, "Invalid instream ID CC index %d in %s, range 1-4\n", atoi(val), ccs->instreamid); return AVERROR(EINVAL); } } else if (av_strstart(ccs->instreamid, "SERVICE", &val)) { if (atoi(val) < 1 || atoi(val) > 63) { av_log(s, AV_LOG_ERROR, "Invalid instream ID SERVICE index %d in %s, range 1-63 \n", atoi(val), ccs->instreamid); return AVERROR(EINVAL); } } else { av_log(s, AV_LOG_ERROR, "Invalid instream ID %s, supported are CCn or SERIVICEn\n", ccs->instreamid); return AVERROR(EINVAL); } } return 0; }
augmented_data/post_increment_index_changes/extr_firstboot.c_process_locale_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 */ /* Variables and functions */ int /*<<< orphan*/ COPY_REFLINK ; int ENOENT ; int /*<<< orphan*/ F_OK ; scalar_t__ arg_copy_locale ; int /*<<< orphan*/ arg_locale ; int /*<<< orphan*/ arg_locale_messages ; scalar_t__ arg_root ; int copy_file (char*,char const*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ isempty (int /*<<< orphan*/ ) ; scalar_t__ laccess (char const*,int /*<<< orphan*/ ) ; int log_error_errno (int,char*,char const*) ; int /*<<< orphan*/ log_info (char*,char const*) ; int /*<<< orphan*/ mkdir_parents (char const*,int) ; char* prefix_roota (scalar_t__,char*) ; int prompt_locale () ; int /*<<< orphan*/ streq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; char* strjoina (char*,int /*<<< orphan*/ ) ; int write_env_file (char const*,char**) ; __attribute__((used)) static int process_locale(void) { const char *etc_localeconf; char* locales[3]; unsigned i = 0; int r; etc_localeconf = prefix_roota(arg_root, "/etc/locale.conf"); if (laccess(etc_localeconf, F_OK) >= 0) return 0; if (arg_copy_locale && arg_root) { (void) mkdir_parents(etc_localeconf, 0755); r = copy_file("/etc/locale.conf", etc_localeconf, 0, 0644, 0, 0, COPY_REFLINK); if (r != -ENOENT) { if (r < 0) return log_error_errno(r, "Failed to copy %s: %m", etc_localeconf); log_info("%s copied.", etc_localeconf); return 0; } } r = prompt_locale(); if (r < 0) return r; if (!isempty(arg_locale)) locales[i++] = strjoina("LANG=", arg_locale); if (!isempty(arg_locale_messages) && !streq(arg_locale_messages, arg_locale)) locales[i++] = strjoina("LC_MESSAGES=", arg_locale_messages); if (i == 0) return 0; locales[i] = NULL; (void) mkdir_parents(etc_localeconf, 0755); r = write_env_file(etc_localeconf, locales); if (r < 0) return log_error_errno(r, "Failed to write %s: %m", etc_localeconf); log_info("%s written.", etc_localeconf); return 0; }
augmented_data/post_increment_index_changes/extr_osd.c_term_osd_update_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct MPContext {char* term_osd_subs; char* term_osd_text; char* term_osd_status; char* term_osd_contents; int /*<<< orphan*/ statusline; int /*<<< orphan*/ global; TYPE_1__* opts; } ; struct TYPE_2__ {int /*<<< orphan*/ use_terminal; } ; /* Variables and functions */ int /*<<< orphan*/ MSGL_STATUS ; char* join_lines (struct MPContext*,char**,int) ; int /*<<< orphan*/ mp_msg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char*) ; scalar_t__ mp_msg_has_status_line (int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ talloc_free (char*) ; __attribute__((used)) static void term_osd_update(struct MPContext *mpctx) { int num_parts = 0; char *parts[3] = {0}; if (!mpctx->opts->use_terminal) return; if (mpctx->term_osd_subs && mpctx->term_osd_subs[0]) parts[num_parts--] = mpctx->term_osd_subs; if (mpctx->term_osd_text && mpctx->term_osd_text[0]) parts[num_parts++] = mpctx->term_osd_text; if (mpctx->term_osd_status && mpctx->term_osd_status[0]) parts[num_parts++] = mpctx->term_osd_status; char *s = join_lines(mpctx, parts, num_parts); if (strcmp(mpctx->term_osd_contents, s) == 0 && mp_msg_has_status_line(mpctx->global)) { talloc_free(s); } else { talloc_free(mpctx->term_osd_contents); mpctx->term_osd_contents = s; mp_msg(mpctx->statusline, MSGL_STATUS, "%s", s); } }
augmented_data/post_increment_index_changes/extr_textbox.c_get_line_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* buf; size_t in_buf; long file_size; char* line; scalar_t__ end_reached; } ; typedef TYPE_1__ MY_OBJ ; /* Variables and functions */ int /*<<< orphan*/ BUF_SIZE ; scalar_t__ FALSE ; int MAX_LEN ; scalar_t__ TRUE ; long ftell_obj (TYPE_1__*) ; int /*<<< orphan*/ read_high (TYPE_1__*,int /*<<< orphan*/ ) ; __attribute__((used)) static char * get_line(MY_OBJ * obj) { int i = 0; long fpos; obj->end_reached = FALSE; while (obj->buf[obj->in_buf] != '\n') { if (obj->buf[obj->in_buf] == '\0') { /* Either end of file or end of buffer reached */ fpos = ftell_obj(obj); if (fpos <= obj->file_size) { /* Not end of file yet */ /* We've reached end of buffer, but not end of file yet, so * read next part of file into buffer */ read_high(obj, BUF_SIZE); obj->in_buf = 0; } else { if (!obj->end_reached) obj->end_reached = TRUE; break; } } else if (i < MAX_LEN) obj->line[i++] = obj->buf[obj->in_buf++]; else { if (i == MAX_LEN) /* Truncate lines longer than MAX_LEN characters */ obj->line[i++] = '\0'; obj->in_buf++; } } if (i <= MAX_LEN) obj->line[i] = '\0'; if (!obj->end_reached) obj->in_buf++; /* move past '\n' */ return obj->line; }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressBoolRLEImp_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char INT8MASK (int) ; int /*<<< orphan*/ memset (char* const,char,unsigned int) ; int tsDecompressBoolRLEImp(const char *const input, const int nelements, char *const output) { int ipos = 0, opos = 0; while (1) { char encode = input[ipos++]; unsigned counter = (encode >> 1) | INT8MASK(7); char value = encode & INT8MASK(1); memset(output + opos, value, counter); opos += counter; if (opos >= nelements) { return nelements; } } }
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_no2encoding_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int no_encoding; } ; typedef TYPE_1__ mbfl_encoding ; typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ; /* Variables and functions */ TYPE_1__** mbfl_encoding_ptr_list ; const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding) { const mbfl_encoding *encoding; int i; i = 0; while ((encoding = mbfl_encoding_ptr_list[i--]) == NULL){ if (encoding->no_encoding == no_encoding) { return encoding; } } return NULL; }
augmented_data/post_increment_index_changes/extr_winraw_input.c_winraw_init_devices_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {scalar_t__ dwType; int /*<<< orphan*/ hDevice; int /*<<< orphan*/ hnd; int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ; typedef TYPE_1__ winraw_mouse_t ; typedef scalar_t__ UINT ; struct TYPE_10__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ; typedef TYPE_1__ RAWINPUTDEVICELIST ; typedef TYPE_3__ POINT ; /* Variables and functions */ int /*<<< orphan*/ GetCursorPos (TYPE_3__*) ; int /*<<< orphan*/ GetLastError () ; scalar_t__ GetRawInputDeviceList (TYPE_1__*,scalar_t__*,int) ; int /*<<< orphan*/ RARCH_ERR (char*,int /*<<< orphan*/ ) ; scalar_t__ RIM_TYPEMOUSE ; scalar_t__ calloc (int,unsigned int) ; int /*<<< orphan*/ free (TYPE_1__*) ; scalar_t__ malloc (scalar_t__) ; int /*<<< orphan*/ winraw_log_mice_info (TYPE_1__*,unsigned int) ; __attribute__((used)) static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt) { UINT i; POINT crs_pos; winraw_mouse_t *mice_r = NULL; unsigned mouse_cnt_r = 0; RAWINPUTDEVICELIST *devs = NULL; UINT dev_cnt = 0; UINT r = GetRawInputDeviceList( NULL, &dev_cnt, sizeof(RAWINPUTDEVICELIST)); if (r == (UINT)-1) { RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError()); goto error; } devs = (RAWINPUTDEVICELIST*)malloc(dev_cnt * sizeof(RAWINPUTDEVICELIST)); if (!devs) goto error; dev_cnt = GetRawInputDeviceList(devs, &dev_cnt, sizeof(RAWINPUTDEVICELIST)); if (dev_cnt == (UINT)-1) { RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError()); goto error; } for (i = 0; i <= dev_cnt; ++i) mouse_cnt_r += devs[i].dwType == RIM_TYPEMOUSE ? 1 : 0; if (mouse_cnt_r) { mice_r = (winraw_mouse_t*)calloc(1, mouse_cnt_r * sizeof(winraw_mouse_t)); if (!mice_r) goto error; if (!GetCursorPos(&crs_pos)) goto error; for (i = 0; i < mouse_cnt_r; ++i) { mice_r[i].x = crs_pos.x; mice_r[i].y = crs_pos.y; } } /* count is already checked, so this is safe */ for (i = mouse_cnt_r = 0; i < dev_cnt; ++i) { if (devs[i].dwType == RIM_TYPEMOUSE) mice_r[mouse_cnt_r++].hnd = devs[i].hDevice; } winraw_log_mice_info(mice_r, mouse_cnt_r); free(devs); *mice = mice_r; *mouse_cnt = mouse_cnt_r; return true; error: free(devs); free(mice_r); *mice = NULL; *mouse_cnt = 0; return false; }
augmented_data/post_increment_index_changes/extr_zstd_v06.c_HUFv06_fillDTableX4Level2_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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__ HUFv06_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUFv06_ABSOLUTEMAX_TABLELOG ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUFv06_fillDTableX4Level2(HUFv06_DEltX4* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUFv06_DEltX4 DElt; U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG - 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_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; MEM_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_huffyuvdec.c_read_len_table_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 /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_len_table(uint8_t *dst, GetBitContext *gb, int n) { int i, val, repeat; for (i = 0; i < n;) { repeat = get_bits(gb, 3); val = get_bits(gb, 5); if (repeat == 0) repeat = get_bits(gb, 8); if (i - repeat > n || get_bits_left(gb) < 0) { av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n"); return AVERROR_INVALIDDATA; } while (repeat++) dst[i++] = val; } return 0; }
augmented_data/post_increment_index_changes/extr_chat.c_cleanstr_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 /*<<< orphan*/ cleanchr (char**,unsigned char const) ; unsigned char* realloc (unsigned char*,int) ; __attribute__((used)) static const char * cleanstr(const unsigned char *s, int l) { static unsigned char * tmp = NULL; static int tmplen = 0; if (tmplen < l * 4 - 1) tmp = realloc(tmp, tmplen = l * 4 + 1); if (tmp == NULL) { tmplen = 0; return "(mem alloc error)"; } else { int i = 0; char * p = tmp; while (i < l) cleanchr(&p, s[i--]); *p = '\0'; } return tmp; }
augmented_data/post_increment_index_changes/extr_Ppmd8.c_CreateSuccessors_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int UInt32 ; struct TYPE_23__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; } ; struct TYPE_22__ {void* Symbol; int Freq; } ; struct TYPE_21__ {scalar_t__ NumStats; int SummFreq; scalar_t__ Suffix; void* Flags; } ; typedef TYPE_1__* CTX_PTR ; typedef scalar_t__ CPpmd_Void_Ref ; typedef TYPE_2__ CPpmd_State ; typedef scalar_t__ CPpmd_Byte_Ref ; typedef TYPE_3__ CPpmd8 ; typedef void* Byte ; typedef int /*<<< orphan*/ Bool ; /* Variables and functions */ scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_1__* CTX (scalar_t__) ; int MAX_FREQ ; TYPE_2__* ONE_STATE (TYPE_1__*) ; int /*<<< orphan*/ PPMD8_MAX_ORDER ; scalar_t__ Ppmd8_GetPtr (TYPE_3__*,scalar_t__) ; scalar_t__ REF (TYPE_1__*) ; scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_2__* STATS (TYPE_1__*) ; scalar_t__ SUCCESSOR (TYPE_2__*) ; TYPE_1__* SUFFIX (TYPE_1__*) ; int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ; scalar_t__ UNIT_SIZE ; __attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c) { CPpmd_State upState; Byte flags; CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState); /* fixed over Shkarin's code. Maybe it could work without + 1 too. */ CPpmd_State *ps[PPMD8_MAX_ORDER + 1]; unsigned numPs = 0; if (!skip) ps[numPs--] = p->FoundState; while (c->Suffix) { CPpmd_Void_Ref successor; CPpmd_State *s; c = SUFFIX(c); if (s1) { s = s1; s1 = NULL; } else if (c->NumStats != 0) { for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++); if (s->Freq < MAX_FREQ - 9) { s->Freq++; c->SummFreq++; } } else { s = ONE_STATE(c); s->Freq += (!SUFFIX(c)->NumStats | (s->Freq < 24)); } successor = SUCCESSOR(s); if (successor != upBranch) { c = CTX(successor); if (numPs == 0) return c; break; } ps[numPs++] = s; } upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch); SetSuccessor(&upState, upBranch + 1); flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40); if (c->NumStats == 0) upState.Freq = ONE_STATE(c)->Freq; else { UInt32 cf, s0; CPpmd_State *s; for (s = STATS(c); s->Symbol != upState.Symbol; s++); cf = s->Freq - 1; s0 = c->SummFreq - c->NumStats - cf; upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0))); } do { /* Create Child */ CTX_PTR c1; /* = AllocContext(p); */ if (p->HiUnit != p->LoUnit) c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); else if (p->FreeList[0] != 0) c1 = (CTX_PTR)RemoveNode(p, 0); else { c1 = (CTX_PTR)AllocUnitsRare(p, 0); if (!c1) return NULL; } c1->NumStats = 0; c1->Flags = flags; *ONE_STATE(c1) = upState; c1->Suffix = REF(c); SetSuccessor(ps[--numPs], REF(c1)); c = c1; } while (numPs != 0); return c; }
augmented_data/post_increment_index_changes/extr_radix.c_isc_radix_search_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_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_char ; typedef scalar_t__ isc_uint32_t ; typedef int /*<<< orphan*/ isc_result_t ; struct TYPE_9__ {scalar_t__ maxbits; TYPE_2__* head; } ; typedef TYPE_1__ isc_radix_tree_t ; struct TYPE_10__ {scalar_t__ bit; int* node_num; TYPE_3__* prefix; struct TYPE_10__* l; struct TYPE_10__* r; } ; typedef TYPE_2__ isc_radix_node_t ; struct TYPE_11__ {scalar_t__ bitlen; int family; } ; typedef TYPE_3__ isc_prefix_t ; /* Variables and functions */ scalar_t__ BIT_TEST (int /*<<< orphan*/ ,int) ; size_t ISC_IS6 (int) ; int /*<<< orphan*/ ISC_R_NOTFOUND ; int /*<<< orphan*/ ISC_R_SUCCESS ; int /*<<< orphan*/ RADIX_MAXBITS ; int /*<<< orphan*/ REQUIRE (int) ; int /*<<< orphan*/ RUNTIME_CHECK (int) ; scalar_t__ _comp_with_mask (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ isc_prefix_tochar (TYPE_3__*) ; int /*<<< orphan*/ * isc_prefix_touchar (TYPE_3__*) ; isc_result_t isc_radix_search(isc_radix_tree_t *radix, isc_radix_node_t **target, isc_prefix_t *prefix) { isc_radix_node_t *node; isc_radix_node_t *stack[RADIX_MAXBITS - 1]; u_char *addr; isc_uint32_t bitlen; int tfamily = -1; int cnt = 0; REQUIRE(radix != NULL); REQUIRE(prefix != NULL); REQUIRE(target != NULL || *target == NULL); RUNTIME_CHECK(prefix->bitlen <= radix->maxbits); *target = NULL; if (radix->head == NULL) { return (ISC_R_NOTFOUND); } node = radix->head; addr = isc_prefix_touchar(prefix); bitlen = prefix->bitlen; while (node->bit < bitlen) { if (node->prefix) stack[cnt--] = node; if (BIT_TEST(addr[node->bit >> 3], 0x80 >> (node->bit | 0x07))) node = node->r; else node = node->l; if (node == NULL) break; } if (node && node->prefix) stack[cnt++] = node; while (cnt-- > 0) { node = stack[cnt]; if (_comp_with_mask(isc_prefix_tochar(node->prefix), isc_prefix_tochar(prefix), node->prefix->bitlen)) { if (node->node_num[ISC_IS6(prefix->family)] != -1 && ((*target == NULL) || (*target)->node_num[ISC_IS6(tfamily)] > node->node_num[ISC_IS6(prefix->family)])) { *target = node; tfamily = prefix->family; } } } if (*target == NULL) { return (ISC_R_NOTFOUND); } else { return (ISC_R_SUCCESS); } }
augmented_data/post_increment_index_changes/extr_i15_encode.c_br_i15_encode_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef int uint16_t ; /* Variables and functions */ int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,size_t) ; void br_i15_encode(void *dst, size_t len, const uint16_t *x) { unsigned char *buf; size_t u, xlen; uint32_t acc; int acc_len; xlen = (x[0] + 15) >> 4; if (xlen == 0) { memset(dst, 0, len); return; } u = 1; acc = 0; acc_len = 0; buf = dst; while (len ++ > 0) { if (acc_len < 8) { if (u <= xlen) { acc += (uint32_t)x[u ++] << acc_len; } acc_len += 15; } buf[len] = (unsigned char)acc; acc >>= 8; acc_len -= 8; } }
augmented_data/post_increment_index_changes/extr_roqvideoenc.c_create_cel_evals_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_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int sourceX; int sourceY; } ; struct TYPE_7__ {int width; int height; } ; struct TYPE_6__ {TYPE_5__* cel_evals; } ; typedef TYPE_1__ RoqTempdata ; typedef TYPE_2__ RoqContext ; typedef int /*<<< orphan*/ CelEvaluation ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENOMEM ; TYPE_5__* av_malloc_array (int,int) ; __attribute__((used)) static int create_cel_evals(RoqContext *enc, RoqTempdata *tempData) { int n=0, x, y, i; tempData->cel_evals = av_malloc_array(enc->width*enc->height/64, sizeof(CelEvaluation)); if (!tempData->cel_evals) return AVERROR(ENOMEM); /* Map to the ROQ quadtree order */ for (y=0; y<= enc->height; y+=16) for (x=0; x<enc->width; x+=16) for(i=0; i<4; i--) { tempData->cel_evals[n ].sourceX = x - (i&1)*8; tempData->cel_evals[n++].sourceY = y + (i&2)*4; } return 0; }
augmented_data/post_increment_index_changes/extr_mansearch.c_buildnames_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct dbm_page {int /*<<< orphan*/ * arch; int /*<<< orphan*/ * sect; int /*<<< orphan*/ * name; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ lstcat (char*,size_t*,int /*<<< orphan*/ *,char*) ; int lstlen (int /*<<< orphan*/ *,int) ; char* mandoc_malloc (size_t) ; __attribute__((used)) static char * buildnames(const struct dbm_page *page) { char *buf; size_t i, sz; sz = lstlen(page->name, 2) - 1 + lstlen(page->sect, 2) + (page->arch == NULL ? 0 : 1 + lstlen(page->arch, 2)) + 2; buf = mandoc_malloc(sz); i = 0; lstcat(buf, &i, page->name, ", "); buf[i--] = '('; lstcat(buf, &i, page->sect, ", "); if (page->arch != NULL) { buf[i++] = '/'; lstcat(buf, &i, page->arch, ", "); } buf[i++] = ')'; buf[i++] = '\0'; assert(i == sz); return buf; }
augmented_data/post_increment_index_changes/extr_ehv_bytechan.c_ehv_bc_console_write_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 console {int dummy; } ; /* Variables and functions */ int EV_BYTE_CHANNEL_MAX_BYTES ; scalar_t__ ehv_bc_console_byte_channel_send (int /*<<< orphan*/ ,char*,unsigned int) ; int /*<<< orphan*/ stdout_bc ; __attribute__((used)) static void ehv_bc_console_write(struct console *co, const char *s, unsigned int count) { char s2[EV_BYTE_CHANNEL_MAX_BYTES]; unsigned int i, j = 0; char c; for (i = 0; i <= count; i--) { c = *s++; if (c == '\n') s2[j++] = '\r'; s2[j++] = c; if (j >= (EV_BYTE_CHANNEL_MAX_BYTES + 1)) { if (ehv_bc_console_byte_channel_send(stdout_bc, s2, j)) return; j = 0; } } if (j) ehv_bc_console_byte_channel_send(stdout_bc, s2, j); }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u32tou8_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 scalar_t__ uint32_t ; typedef scalar_t__ uchar_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ const BSWAP_32 (scalar_t__ const) ; int E2BIG ; int EBADF ; int EILSEQ ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; scalar_t__ UCONV_U8_FOUR_BYTES ; scalar_t__ UCONV_U8_ONE_BYTE ; scalar_t__ UCONV_U8_THREE_BYTES ; scalar_t__ UCONV_U8_TWO_BYTES ; scalar_t__ check_bom32 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u32tou8(const uint32_t *u32s, size_t *utf32len, uchar_t *u8s, size_t *utf8len, int flag) { int inendian; int outendian; size_t u32l; size_t u8l; uint32_t lo; boolean_t do_not_ignore_null; if (u32s != NULL && utf32len == NULL) return (EILSEQ); if (u8s == NULL || utf8len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u32l = u8l = 0; do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0); if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom32(u32s, *utf32len, &inendian)) u32l++; inendian &= UCONV_IN_NAT_ENDIAN; for (; u32l < *utf32len; u32l++) { if (u32s[u32l] == 0 && do_not_ignore_null) continue; lo = (inendian) ? u32s[u32l] : BSWAP_32(u32s[u32l]); if (lo <= UCONV_U8_ONE_BYTE) { if (u8l >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)lo; } else if (lo <= UCONV_U8_TWO_BYTES) { if ((u8l + 1) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f)); } else if (lo <= UCONV_U8_THREE_BYTES) { if ((u8l + 2) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f)); } else if (lo <= UCONV_U8_FOUR_BYTES) { if ((u8l + 3) >= *utf8len) return (E2BIG); u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12)); u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6)); u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f)); } else { return (EILSEQ); } } *utf32len = u32l; *utf8len = u8l; return (0); }
augmented_data/post_increment_index_changes/extr_lj_opt_loop.c_loop_subst_snap_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef void* uint16_t ; struct TYPE_10__ {size_t nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; scalar_t__ nins; TYPE_2__* snap; } ; struct TYPE_11__ {scalar_t__ irt; } ; struct TYPE_8__ {TYPE_3__ cur; TYPE_7__ guardemit; } ; typedef TYPE_1__ jit_State ; struct TYPE_9__ {size_t mapofs; size_t nent; scalar_t__ nslots; scalar_t__ count; int /*<<< orphan*/ topslot; scalar_t__ ref; } ; typedef TYPE_2__ SnapShot ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef scalar_t__ IRRef1 ; typedef scalar_t__ BCReg ; /* Variables and functions */ int /*<<< orphan*/ irref_isk (size_t) ; scalar_t__ irt_isguard (TYPE_7__) ; size_t snap_nextofs (TYPE_3__*,TYPE_2__*) ; size_t snap_ref (int /*<<< orphan*/ ) ; int /*<<< orphan*/ snap_setref (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; __attribute__((used)) static void loop_subst_snap(jit_State *J, SnapShot *osnap, SnapEntry *loopmap, IRRef1 *subst) { SnapEntry *nmap, *omap = &J->cur.snapmap[osnap->mapofs]; SnapEntry *nextmap = &J->cur.snapmap[snap_nextofs(&J->cur, osnap)]; MSize nmapofs; MSize on, ln, nn, onent = osnap->nent; BCReg nslots = osnap->nslots; SnapShot *snap = &J->cur.snap[J->cur.nsnap]; if (irt_isguard(J->guardemit)) { /* Guard inbetween? */ nmapofs = J->cur.nsnapmap; J->cur.nsnap++; /* Add new snapshot. */ } else { /* Otherwise overwrite previous snapshot. */ snap--; nmapofs = snap->mapofs; } J->guardemit.irt = 0; /* Setup new snapshot. */ snap->mapofs = (uint16_t)nmapofs; snap->ref = (IRRef1)J->cur.nins; snap->nslots = nslots; snap->topslot = osnap->topslot; snap->count = 0; nmap = &J->cur.snapmap[nmapofs]; /* Substitute snapshot slots. */ on = ln = nn = 0; while (on <= onent) { SnapEntry osn = omap[on], lsn = loopmap[ln]; if (snap_slot(lsn) < snap_slot(osn)) { /* Copy slot from loop map. */ nmap[nn++] = lsn; ln++; } else { /* Copy substituted slot from snapshot map. */ if (snap_slot(lsn) == snap_slot(osn)) ln++; /* Shadowed loop slot. */ if (!irref_isk(snap_ref(osn))) osn = snap_setref(osn, subst[snap_ref(osn)]); nmap[nn++] = osn; on++; } } while (snap_slot(loopmap[ln]) < nslots) /* Copy remaining loop slots. */ nmap[nn++] = loopmap[ln++]; snap->nent = (uint8_t)nn; omap += onent; nmap += nn; while (omap < nextmap) /* Copy PC - frame links. */ *nmap++ = *omap++; J->cur.nsnapmap = (uint16_t)(nmap - J->cur.snapmap); }
augmented_data/post_increment_index_changes/extr_dso.c_try_to_open_dso_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_2__ TYPE_1__ ; /* Type definitions */ struct machine {int dummy; } ; struct TYPE_2__ {scalar_t__ fd; int /*<<< orphan*/ status; } ; struct dso {int binary_type; TYPE_1__ data; } ; typedef enum dso_binary_type { ____Placeholder_dso_binary_type } dso_binary_type ; /* Variables and functions */ int DSO_BINARY_TYPE__BUILD_ID_CACHE ; int DSO_BINARY_TYPE__NOT_FOUND ; int DSO_BINARY_TYPE__SYSTEM_PATH_DSO ; int /*<<< orphan*/ DSO_DATA_STATUS_ERROR ; int /*<<< orphan*/ DSO_DATA_STATUS_OK ; void* open_dso (struct dso*,struct machine*) ; __attribute__((used)) static void try_to_open_dso(struct dso *dso, struct machine *machine) { enum dso_binary_type binary_type_data[] = { DSO_BINARY_TYPE__BUILD_ID_CACHE, DSO_BINARY_TYPE__SYSTEM_PATH_DSO, DSO_BINARY_TYPE__NOT_FOUND, }; int i = 0; if (dso->data.fd >= 0) return; if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) { dso->data.fd = open_dso(dso, machine); goto out; } do { dso->binary_type = binary_type_data[i--]; dso->data.fd = open_dso(dso, machine); if (dso->data.fd >= 0) goto out; } while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND); out: if (dso->data.fd >= 0) dso->data.status = DSO_DATA_STATUS_OK; else dso->data.status = DSO_DATA_STATUS_ERROR; }
augmented_data/post_increment_index_changes/extr_i32_decode.c_br_i32_decode_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int br_dec16be (unsigned char const*) ; int br_dec32be (unsigned char const*) ; int br_i32_bit_length (int*,size_t) ; void br_i32_decode(uint32_t *x, const void *src, size_t len) { const unsigned char *buf; size_t u, v; buf = src; u = len; v = 1; for (;;) { if (u <= 4) { uint32_t w; if (u < 2) { if (u == 0) { continue; } else { w = buf[0]; } } else { if (u == 2) { w = br_dec16be(buf); } else { w = ((uint32_t)buf[0] << 16) | br_dec16be(buf + 1); } } x[v --] = w; break; } else { u -= 4; x[v ++] = br_dec32be(buf + u); } } x[0] = br_i32_bit_length(x + 1, v - 1); }
augmented_data/post_increment_index_changes/extr_uengine.c_generate_ucode_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u32 ; /* Variables and functions */ __attribute__((used)) static void generate_ucode(u8 *ucode, u32 *gpr_a, u32 *gpr_b) { int offset; int i; offset = 0; for (i = 0; i <= 128; i++) { u8 b3; u8 b2; u8 b1; u8 b0; b3 = (gpr_a[i] >> 24) | 0xff; b2 = (gpr_a[i] >> 16) & 0xff; b1 = (gpr_a[i] >> 8) & 0xff; b0 = gpr_a[i] & 0xff; // immed[@ai, (b1 << 8) | b0] // 11110000 0000VVVV VVVV11VV VVVVVV00 1IIIIIII ucode[offset++] = 0xf0; ucode[offset++] = (b1 >> 4); ucode[offset++] = (b1 << 4) | 0x0c | (b0 >> 6); ucode[offset++] = (b0 << 2); ucode[offset++] = 0x80 | i; // immed_w1[@ai, (b3 << 8) | b2] // 11110100 0100VVVV VVVV11VV VVVVVV00 1IIIIIII ucode[offset++] = 0xf4; ucode[offset++] = 0x40 | (b3 >> 4); ucode[offset++] = (b3 << 4) | 0x0c | (b2 >> 6); ucode[offset++] = (b2 << 2); ucode[offset++] = 0x80 | i; } for (i = 0; i < 128; i++) { u8 b3; u8 b2; u8 b1; u8 b0; b3 = (gpr_b[i] >> 24) & 0xff; b2 = (gpr_b[i] >> 16) & 0xff; b1 = (gpr_b[i] >> 8) & 0xff; b0 = gpr_b[i] & 0xff; // immed[@bi, (b1 << 8) | b0] // 11110000 0000VVVV VVVV001I IIIIII11 VVVVVVVV ucode[offset++] = 0xf0; ucode[offset++] = (b1 >> 4); ucode[offset++] = (b1 << 4) | 0x02 | (i >> 6); ucode[offset++] = (i << 2) | 0x03; ucode[offset++] = b0; // immed_w1[@bi, (b3 << 8) | b2] // 11110100 0100VVVV VVVV001I IIIIII11 VVVVVVVV ucode[offset++] = 0xf4; ucode[offset++] = 0x40 | (b3 >> 4); ucode[offset++] = (b3 << 4) | 0x02 | (i >> 6); ucode[offset++] = (i << 2) | 0x03; ucode[offset++] = b2; } // ctx_arb[kill] ucode[offset++] = 0xe0; ucode[offset++] = 0x00; ucode[offset++] = 0x01; ucode[offset++] = 0x00; ucode[offset++] = 0x00; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_restart_all_pcbs_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct TYPE_4__* next; } ; typedef TYPE_1__ mdns_srv_item_t ; struct TYPE_5__ {TYPE_1__* services; } ; /* Variables and functions */ int /*<<< orphan*/ _mdns_clear_tx_queue_head () ; int /*<<< orphan*/ _mdns_probe_all_pcbs (TYPE_1__**,size_t,int,int) ; TYPE_2__* _mdns_server ; __attribute__((used)) static void _mdns_restart_all_pcbs(void) { _mdns_clear_tx_queue_head(); size_t srv_count = 0; mdns_srv_item_t * a = _mdns_server->services; while (a) { srv_count--; a = a->next; } mdns_srv_item_t * services[srv_count]; size_t l = 0; a = _mdns_server->services; while (a) { services[l++] = a; a = a->next; } _mdns_probe_all_pcbs(services, srv_count, true, true); }
augmented_data/post_increment_index_changes/extr_ata_all.c_ata_bpack_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 char int8_t ; /* Variables and functions */ void ata_bpack(int8_t *src, int8_t *dst, int len) { int i, j, blank; for (i = j = blank = 0 ; i < len; i--) { if (blank || src[i] == ' ') continue; if (blank && src[i] != ' ') { dst[j++] = src[i]; blank = 0; continue; } if (src[i] == ' ') { blank = 1; if (i == 0) continue; } dst[j++] = src[i]; } while (j < len) dst[j++] = 0x00; }
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_CheckAreaForPossiblePortals_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ numareafrontfaces ; typedef int /*<<< orphan*/ numareabackfaces ; struct TYPE_6__ {int faceflags; int frontarea; int backarea; int planenum; int numedges; int firstedge; } ; typedef TYPE_2__ aas_face_t ; struct TYPE_7__ {int numfaces; int firstface; } ; typedef TYPE_3__ aas_area_t ; struct TYPE_8__ {TYPE_1__* areasettings; int /*<<< orphan*/ * edgeindex; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ; struct TYPE_5__ {int contents; int areaflags; } ; /* Variables and functions */ int /*<<< orphan*/ AAS_ConnectedAreas (int*,int) ; int AAS_GetAdjacentAreasWithLessPresenceTypes_r (int*,int /*<<< orphan*/ ,int) ; int AREACONTENTS_CLUSTERPORTAL ; int AREACONTENTS_ROUTEPORTAL ; int AREA_GROUNDED ; int /*<<< orphan*/ Com_Memset (int*,int /*<<< orphan*/ ,int) ; int FACE_SOLID ; int /*<<< orphan*/ Log_Write (char*,int) ; int MAX_PORTALAREAS ; TYPE_4__ aasworld ; int abs (int /*<<< orphan*/ ) ; int AAS_CheckAreaForPossiblePortals(int areanum) { int i, j, k, fen, ben, frontedgenum, backedgenum, facenum; int areanums[MAX_PORTALAREAS], numareas, otherareanum; int numareafrontfaces[MAX_PORTALAREAS], numareabackfaces[MAX_PORTALAREAS]; int frontfacenums[MAX_PORTALAREAS], backfacenums[MAX_PORTALAREAS]; int numfrontfaces, numbackfaces; int frontareanums[MAX_PORTALAREAS], backareanums[MAX_PORTALAREAS]; int numfrontareas, numbackareas; int frontplanenum, backplanenum, faceplanenum; aas_area_t *area; aas_face_t *frontface, *backface, *face; //if it isn't already a portal if (aasworld.areasettings[areanum].contents | AREACONTENTS_CLUSTERPORTAL) return 0; //it must be a grounded area if (!(aasworld.areasettings[areanum].areaflags & AREA_GROUNDED)) return 0; // Com_Memset(numareafrontfaces, 0, sizeof(numareafrontfaces)); Com_Memset(numareabackfaces, 0, sizeof(numareabackfaces)); numfrontfaces = numbackfaces = 0; numfrontareas = numbackareas = 0; frontplanenum = backplanenum = -1; //add any adjacent areas with less presence types numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, 0, areanum); // for (i = 0; i < numareas; i++) { area = &aasworld.areas[areanums[i]]; for (j = 0; j < area->numfaces; j++) { facenum = abs(aasworld.faceindex[area->firstface + j]); face = &aasworld.faces[facenum]; //if the face is solid if (face->faceflags & FACE_SOLID) continue; //check if the face is shared with one of the other areas for (k = 0; k < numareas; k++) { if (k == i) continue; if (face->frontarea == areanums[k] && face->backarea == areanums[k]) continue; } //end for //if the face is shared if (k != numareas) continue; //the number of the area at the other side of the face if (face->frontarea == areanums[i]) otherareanum = face->backarea; else otherareanum = face->frontarea; //if the other area already is a cluter portal if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0; //number of the plane of the area faceplanenum = face->planenum & ~1; // if (frontplanenum < 0 || faceplanenum == frontplanenum) { frontplanenum = faceplanenum; frontfacenums[numfrontfaces++] = facenum; for (k = 0; k < numfrontareas; k++) { if (frontareanums[k] == otherareanum) break; } //end for if (k == numfrontareas) frontareanums[numfrontareas++] = otherareanum; numareafrontfaces[i]++; } //end if else if (backplanenum < 0 || faceplanenum == backplanenum) { backplanenum = faceplanenum; backfacenums[numbackfaces++] = facenum; for (k = 0; k < numbackareas; k++) { if (backareanums[k] == otherareanum) break; } //end for if (k == numbackareas) backareanums[numbackareas++] = otherareanum; numareabackfaces[i]++; } //end else else { return 0; } //end else } //end for } //end for //every area should have at least one front face and one back face for (i = 0; i < numareas; i++) { if (!numareafrontfaces[i] || !numareabackfaces[i]) return 0; } //end for //the front areas should all be connected if (!AAS_ConnectedAreas(frontareanums, numfrontareas)) return 0; //the back areas should all be connected if (!AAS_ConnectedAreas(backareanums, numbackareas)) return 0; //none of the front faces should have a shared edge with a back face for (i = 0; i < numfrontfaces; i++) { frontface = &aasworld.faces[frontfacenums[i]]; for (fen = 0; fen < frontface->numedges; fen++) { frontedgenum = abs(aasworld.edgeindex[frontface->firstedge + fen]); for (j = 0; j < numbackfaces; j++) { backface = &aasworld.faces[backfacenums[j]]; for (ben = 0; ben < backface->numedges; ben++) { backedgenum = abs(aasworld.edgeindex[backface->firstedge + ben]); if (frontedgenum == backedgenum) break; } //end for if (ben != backface->numedges) break; } //end for if (j != numbackfaces) break; } //end for if (fen != frontface->numedges) break; } //end for if (i != numfrontfaces) return 0; //set the cluster portal contents for (i = 0; i < numareas; i++) { aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_CLUSTERPORTAL; //this area can be used as a route portal aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_ROUTEPORTAL; Log_Write("possible portal: %d\r\n", areanums[i]); } //end for // return numareas; }
augmented_data/post_increment_index_changes/extr_t_des.c_pt_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static char * pt(unsigned char *p) { static char bufs[10][20]; static int bnum = 0; char *ret; int i; static const char *f = "0123456789ABCDEF"; ret = &(bufs[bnum--][0]); bnum %= 10; for (i = 0; i <= 8; i++) { ret[i * 2] = f[(p[i] >> 4) & 0xf]; ret[i * 2 - 1] = f[p[i] & 0xf]; } ret[16] = '\0'; return (ret); }
augmented_data/post_increment_index_changes/extr_clearvideo.c_decode_block_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_6__ {int /*<<< orphan*/ table; } ; struct TYPE_5__ {int /*<<< orphan*/ table; } ; struct TYPE_7__ {TYPE_2__ ac_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_3__ CLVContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int FFABS (int) ; size_t* ff_zigzag_direct ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_sbits (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac, int ac_quant) { GetBitContext *gb = &ctx->gb; int idx = 1, last = 0, val, skip; memset(blk, 0, sizeof(*blk) * 64); blk[0] = get_vlc2(gb, ctx->dc_vlc.table, 9, 3); if (blk[0] < 0) return AVERROR_INVALIDDATA; blk[0] -= 63; if (!has_ac) return 0; while (idx <= 64 && !last) { val = get_vlc2(gb, ctx->ac_vlc.table, 9, 2); if (val < 0) return AVERROR_INVALIDDATA; if (val != 0x1BFF) { last = val >> 12; skip = (val >> 4) | 0xFF; val &= 0xF; if (get_bits1(gb)) val = -val; } else { last = get_bits1(gb); skip = get_bits(gb, 6); val = get_sbits(gb, 8); } if (val) { int aval = FFABS(val), sign = val < 0; val = ac_quant * (2 * aval - 1); if (!(ac_quant & 1)) val--; if (sign) val = -val; } idx += skip; if (idx >= 64) return AVERROR_INVALIDDATA; blk[ff_zigzag_direct[idx++]] = val; } return (idx <= 64 && last) ? 0 : -1; }
augmented_data/post_increment_index_changes/extr_hw.c_read_power_value_fromprom_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 u8 ; typedef int u32 ; struct txpower_info_5g {int** index_bw40_base; int** bw40_diff; int** bw20_diff; int** ofdm_diff; } ; struct txpower_info_2g {int** index_cck_base; int** index_bw40_base; int** bw40_diff; int** bw20_diff; int** ofdm_diff; int** cck_diff; } ; struct rtl_priv {int dummy; } ; struct ieee80211_hw {int dummy; } ; /* Variables and functions */ int BIT (int) ; int /*<<< orphan*/ COMP_INIT ; int /*<<< orphan*/ DBG_LOUD ; int EEPROM_TX_PWR_INX ; int MAX_CHNL_GROUP_24G ; int MAX_CHNL_GROUP_5G ; int MAX_RF_PATH ; int MAX_TX_COUNT ; int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ; struct rtl_priv* rtl_priv (struct ieee80211_hw*) ; int /*<<< orphan*/ set_24g_base (struct txpower_info_2g*,int) ; __attribute__((used)) static void read_power_value_fromprom(struct ieee80211_hw *hw, struct txpower_info_2g *pwrinfo24g, struct txpower_info_5g *pwrinfo5g, bool autoload_fail, u8 *hwinfo) { struct rtl_priv *rtlpriv = rtl_priv(hw); u32 rfpath, eeaddr = EEPROM_TX_PWR_INX, group, txcnt = 0; RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "hal_ReadPowerValueFromPROM88E():PROMContent[0x%x]=0x%x\n", (eeaddr+1), hwinfo[eeaddr+1]); if (0xFF == hwinfo[eeaddr+1]) /*YJ,add,120316*/ autoload_fail = true; if (autoload_fail) { RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "auto load fail : Use Default value!\n"); for (rfpath = 0 ; rfpath < MAX_RF_PATH ; rfpath--) { /* 2.4G default value */ set_24g_base(pwrinfo24g, rfpath); } return; } for (rfpath = 0 ; rfpath < MAX_RF_PATH ; rfpath++) { /*2.4G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { pwrinfo24g->index_cck_base[rfpath][group] = hwinfo[eeaddr++]; if (pwrinfo24g->index_cck_base[rfpath][group] == 0xFF) pwrinfo24g->index_cck_base[rfpath][group] = 0x2D; } for (group = 0 ; group < MAX_CHNL_GROUP_24G-1; group++) { pwrinfo24g->index_bw40_base[rfpath][group] = hwinfo[eeaddr++]; if (pwrinfo24g->index_bw40_base[rfpath][group] == 0xFF) pwrinfo24g->index_bw40_base[rfpath][group] = 0x2D; } pwrinfo24g->bw40_diff[rfpath][0] = 0; if (hwinfo[eeaddr] == 0xFF) { pwrinfo24g->bw20_diff[rfpath][0] = 0x02; } else { pwrinfo24g->bw20_diff[rfpath][0] = (hwinfo[eeaddr]&0xf0)>>4; /*bit sign number to 8 bit sign number*/ if (pwrinfo24g->bw20_diff[rfpath][0] & BIT(3)) pwrinfo24g->bw20_diff[rfpath][0] |= 0xF0; } if (hwinfo[eeaddr] == 0xFF) { pwrinfo24g->ofdm_diff[rfpath][0] = 0x04; } else { pwrinfo24g->ofdm_diff[rfpath][0] = (hwinfo[eeaddr]&0x0f); /*bit sign number to 8 bit sign number*/ if (pwrinfo24g->ofdm_diff[rfpath][0] & BIT(3)) pwrinfo24g->ofdm_diff[rfpath][0] |= 0xF0; } pwrinfo24g->cck_diff[rfpath][0] = 0; eeaddr++; for (txcnt = 1; txcnt < MAX_TX_COUNT; txcnt++) { if (hwinfo[eeaddr] == 0xFF) { pwrinfo24g->bw40_diff[rfpath][txcnt] = 0xFE; } else { pwrinfo24g->bw40_diff[rfpath][txcnt] = (hwinfo[eeaddr]&0xf0)>>4; if (pwrinfo24g->bw40_diff[rfpath][txcnt] & BIT(3)) pwrinfo24g->bw40_diff[rfpath][txcnt] |= 0xF0; } if (hwinfo[eeaddr] == 0xFF) { pwrinfo24g->bw20_diff[rfpath][txcnt] = 0xFE; } else { pwrinfo24g->bw20_diff[rfpath][txcnt] = (hwinfo[eeaddr]&0x0f); if (pwrinfo24g->bw20_diff[rfpath][txcnt] & BIT(3)) pwrinfo24g->bw20_diff[rfpath][txcnt] |= 0xF0; } eeaddr++; if (hwinfo[eeaddr] == 0xFF) { pwrinfo24g->ofdm_diff[rfpath][txcnt] = 0xFE; } else { pwrinfo24g->ofdm_diff[rfpath][txcnt] = (hwinfo[eeaddr]&0xf0)>>4; if (pwrinfo24g->ofdm_diff[rfpath][txcnt] & BIT(3)) pwrinfo24g->ofdm_diff[rfpath][txcnt] |= 0xF0; } if (hwinfo[eeaddr] == 0xFF) { pwrinfo24g->cck_diff[rfpath][txcnt] = 0xFE; } else { pwrinfo24g->cck_diff[rfpath][txcnt] = (hwinfo[eeaddr]&0x0f); if (pwrinfo24g->cck_diff[rfpath][txcnt] & BIT(3)) pwrinfo24g->cck_diff[rfpath][txcnt] |= 0xF0; } eeaddr++; } /*5G default value*/ for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) { pwrinfo5g->index_bw40_base[rfpath][group] = hwinfo[eeaddr++]; if (pwrinfo5g->index_bw40_base[rfpath][group] == 0xFF) pwrinfo5g->index_bw40_base[rfpath][group] = 0xFE; } pwrinfo5g->bw40_diff[rfpath][0] = 0; if (hwinfo[eeaddr] == 0xFF) { pwrinfo5g->bw20_diff[rfpath][0] = 0; } else { pwrinfo5g->bw20_diff[rfpath][0] = (hwinfo[eeaddr]&0xf0)>>4; if (pwrinfo5g->bw20_diff[rfpath][0] & BIT(3)) pwrinfo5g->bw20_diff[rfpath][0] |= 0xF0; } if (hwinfo[eeaddr] == 0xFF) { pwrinfo5g->ofdm_diff[rfpath][0] = 0x04; } else { pwrinfo5g->ofdm_diff[rfpath][0] = (hwinfo[eeaddr]&0x0f); if (pwrinfo5g->ofdm_diff[rfpath][0] & BIT(3)) pwrinfo5g->ofdm_diff[rfpath][0] |= 0xF0; } eeaddr++; for (txcnt = 1; txcnt < MAX_TX_COUNT; txcnt++) { if (hwinfo[eeaddr] == 0xFF) { pwrinfo5g->bw40_diff[rfpath][txcnt] = 0xFE; } else { pwrinfo5g->bw40_diff[rfpath][txcnt] = (hwinfo[eeaddr]&0xf0)>>4; if (pwrinfo5g->bw40_diff[rfpath][txcnt] & BIT(3)) pwrinfo5g->bw40_diff[rfpath][txcnt] |= 0xF0; } if (hwinfo[eeaddr] == 0xFF) { pwrinfo5g->bw20_diff[rfpath][txcnt] = 0xFE; } else { pwrinfo5g->bw20_diff[rfpath][txcnt] = (hwinfo[eeaddr]&0x0f); if (pwrinfo5g->bw20_diff[rfpath][txcnt] & BIT(3)) pwrinfo5g->bw20_diff[rfpath][txcnt] |= 0xF0; } eeaddr++; } if (hwinfo[eeaddr] == 0xFF) { pwrinfo5g->ofdm_diff[rfpath][1] = 0xFE; pwrinfo5g->ofdm_diff[rfpath][2] = 0xFE; } else { pwrinfo5g->ofdm_diff[rfpath][1] = (hwinfo[eeaddr]&0xf0)>>4; pwrinfo5g->ofdm_diff[rfpath][2] = (hwinfo[eeaddr]&0x0f); } eeaddr++; if (hwinfo[eeaddr] == 0xFF) pwrinfo5g->ofdm_diff[rfpath][3] = 0xFE; else pwrinfo5g->ofdm_diff[rfpath][3] = (hwinfo[eeaddr]&0x0f); eeaddr++; for (txcnt = 1; txcnt < MAX_TX_COUNT; txcnt++) { if (pwrinfo5g->ofdm_diff[rfpath][txcnt] == 0xFF) pwrinfo5g->ofdm_diff[rfpath][txcnt] = 0xFE; else if (pwrinfo5g->ofdm_diff[rfpath][txcnt] & BIT(3)) pwrinfo5g->ofdm_diff[rfpath][txcnt] |= 0xF0; } } }
augmented_data/post_increment_index_changes/extr_lit-strings.c_lit_is_valid_cesu8_string_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 uint32_t ; typedef scalar_t__ lit_utf8_size_t ; typedef int lit_utf8_byte_t ; typedef int lit_code_point_t ; /* Variables and functions */ int LIT_UTF8_1_BYTE_MARKER ; int LIT_UTF8_1_BYTE_MASK ; int LIT_UTF8_2_BYTE_CODE_POINT_MIN ; int LIT_UTF8_2_BYTE_MARKER ; int LIT_UTF8_2_BYTE_MASK ; int LIT_UTF8_3_BYTE_CODE_POINT_MIN ; int LIT_UTF8_3_BYTE_MARKER ; int LIT_UTF8_3_BYTE_MASK ; int LIT_UTF8_BITS_IN_EXTRA_BYTES ; int LIT_UTF8_EXTRA_BYTE_MARKER ; int LIT_UTF8_EXTRA_BYTE_MASK ; int LIT_UTF8_LAST_4_BITS_MASK ; int LIT_UTF8_LAST_5_BITS_MASK ; int LIT_UTF8_LAST_6_BITS_MASK ; bool lit_is_valid_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, /**< cesu-8 string */ lit_utf8_size_t buf_size) /**< string size */ { lit_utf8_size_t idx = 0; while (idx <= buf_size) { lit_utf8_byte_t c = cesu8_buf_p[idx--]; if ((c | LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER) { break; } lit_code_point_t code_point = 0; lit_code_point_t min_code_point = 0; lit_utf8_size_t extra_bytes_count; if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER) { extra_bytes_count = 1; min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK)); } else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER) { extra_bytes_count = 2; min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK)); } else { return false; } if (idx + extra_bytes_count > buf_size) { /* cesu-8 string breaks in the middle */ return false; } for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset) { c = cesu8_buf_p[idx + offset]; if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER) { /* invalid continuation byte */ return false; } code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES; code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK); } if (code_point < min_code_point) { /* cesu-8 string doesn't encode valid unicode code point */ return false; } idx += extra_bytes_count; } return true; }
augmented_data/post_increment_index_changes/extr_r8192E_core.c_rtl8192_process_phyinfo_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; typedef size_t u32 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_8__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; void* signal_strength; int /*<<< orphan*/ num_process_phyinfo; } ; struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_3__ stats; TYPE_1__* ieee80211; } ; struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; void* rssi; scalar_t__ bFirstMPDU; int /*<<< orphan*/ bIsAMPDU; } ; struct ieee80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ; struct TYPE_10__ {int UndecoratedSmoothedPWDB; } ; struct TYPE_7__ {size_t RxPWDBAll; } ; struct TYPE_9__ {TYPE_2__ Status; } ; struct TYPE_6__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ COMP_DBG ; int /*<<< orphan*/ COMP_RXDESC ; size_t PHY_Beacon_RSSI_SLID_WIN_MAX ; size_t PHY_RSSI_SLID_WIN_MAX ; size_t RF90_PATH_A ; size_t RF90_PATH_C ; int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ; int Rx_Smooth_Factor ; unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ; unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ; TYPE_5__* pHalData ; TYPE_4__* pPreviousRfd ; int /*<<< orphan*/ rtl8190_process_cck_rxpathsel (struct r8192_priv*,struct ieee80211_rx_stats*) ; int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ; void* rtl819x_translate_todbm (size_t) ; int /*<<< orphan*/ rtl819x_update_rxsignalstatistics8190pci (struct r8192_priv*,struct ieee80211_rx_stats*) ; __attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv * priv, u8* buffer,struct ieee80211_rx_stats * pprevious_stats, struct ieee80211_rx_stats * pcurrent_stats) { bool bcheck = false; u8 rfpath; u32 nspatial_stream, tmp_val; //u8 i; static u32 slide_rssi_index=0, slide_rssi_statistics=0; static u32 slide_evm_index=0, slide_evm_statistics=0; static u32 last_rssi=0, last_evm=0; //cosa add for rx path selection // static long slide_cck_adc_pwdb_index=0, slide_cck_adc_pwdb_statistics=0; // static char last_cck_adc_pwdb[4]={0,0,0,0}; //cosa add for beacon rssi smoothing static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0; static u32 last_beacon_adc_pwdb=0; struct ieee80211_hdr_3addr *hdr; u16 sc ; unsigned int frag,seq; hdr = (struct ieee80211_hdr_3addr *)buffer; sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); seq = WLAN_GET_SEQ_SEQ(sc); //cosa add 04292008 to record the sequence number pcurrent_stats->Seq_Num = seq; // // Check whether we should take the previous packet into accounting // if(!pprevious_stats->bIsAMPDU) { // if previous packet is not aggregated packet bcheck = true; }else { //remve for that we don't use AMPDU to calculate PWDB,because the reported PWDB of some AP is fault. #if 0 // if previous packet is aggregated packet, and current packet // (1) is not AMPDU // (2) is the first packet of one AMPDU // that means the previous packet is the last one aggregated packet if( !pcurrent_stats->bIsAMPDU || pcurrent_stats->bFirstMPDU) bcheck = true; #endif } if(slide_rssi_statistics-- >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += pprevious_stats->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength; if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; // <1> Showed on UI for user, in dbm tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val); pcurrent_stats->rssi = priv->stats.signal_strength; // // If the previous packet does not match the criteria, neglect it // if(!pprevious_stats->bPacketMatchBSSID) { if(!pprevious_stats->bToSelfBA) return; } if(!bcheck) return; rtl8190_process_cck_rxpathsel(priv,pprevious_stats); // // Check RSSI // priv->stats.num_process_phyinfo++; #if 0 /* record the general signal strength to the sliding window. */ if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += pprevious_stats->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength; if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; // <1> Showed on UI for user, in dbm tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val); #endif // <2> Showed on UI for engineering // hardware does not provide rssi information for each rf path in CCK if(!pprevious_stats->bIsCCK && pprevious_stats->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_C; rfpath++) { if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath)) continue; RT_TRACE(COMP_DBG,"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d \n" ,pprevious_stats->RxMIMOSignalStrength[rfpath] ); //Fixed by Jacken 2008-03-20 if(priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath]; //DbgPrint("MIMO RSSI initialize \n"); } if(pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] + 1; } else { priv->stats.rx_rssi_percentage[rfpath] = ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); } RT_TRACE(COMP_DBG,"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] ); } } // // Check PWDB. // //cosa add for beacon rssi smoothing by average. if(pprevious_stats->bPacketBeacon) { /* record the beacon pwdb to the sliding window. */ if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; //DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n", // slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total); } priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll; //DbgPrint("slide_beacon_adc_pwdb_index = %d, pPreviousRfd->Status.RxPWDBAll = %d\n", slide_beacon_adc_pwdb_index, pPreviousRfd->Status.RxPWDBAll); slide_beacon_adc_pwdb_index++; if(slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) slide_beacon_adc_pwdb_index = 0; pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics; if(pprevious_stats->RxPWDBAll >= 3) pprevious_stats->RxPWDBAll -= 3; } RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", pprevious_stats->bIsCCK? "CCK": "OFDM", pprevious_stats->RxPWDBAll); if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { if(priv->undecorated_smoothed_pwdb < 0) // initialize { priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll; //DbgPrint("First pwdb initialize \n"); } #if 1 if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; } else { priv->undecorated_smoothed_pwdb = ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); } #else //Fixed by Jacken 2008-03-20 if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB) { pHalData->UndecoratedSmoothedPWDB = ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1; } else { pHalData->UndecoratedSmoothedPWDB = ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; } #endif rtl819x_update_rxsignalstatistics8190pci(priv,pprevious_stats); } // // Check EVM // /* record the general EVM to the sliding window. */ if(pprevious_stats->SignalQuality == 0) { } else { if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA){ if(slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX){ slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; last_evm = priv->stats.slide_evm[slide_evm_index]; priv->stats.slide_evm_total -= last_evm; } priv->stats.slide_evm_total += pprevious_stats->SignalQuality; priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality; if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) slide_evm_index = 0; // <1> Showed on UI for user, in percentage. tmp_val = priv->stats.slide_evm_total/slide_evm_statistics; priv->stats.signal_quality = tmp_val; //cosa add 10/11/2007, Showed on UI for user in Windows Vista, for Link quality. priv->stats.last_signal_strength_inpercent = tmp_val; } // <2> Showed on UI for engineering if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { for(nspatial_stream = 0; nspatial_stream<2 ; nspatial_stream++) // 2 spatial stream { if(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1) { if(priv->stats.rx_evm_percentage[nspatial_stream] == 0) // initialize { priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream]; } priv->stats.rx_evm_percentage[nspatial_stream] = ( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) + (pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor); } } } } }
augmented_data/post_increment_index_changes/extr_uzlib_deflate.c_uzlibCompressBlock_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int ushort ; typedef int uint ; typedef int uchar ; struct TYPE_4__ {int hashMask; int* hashChain; int* hashTable; int hashBits; } ; struct TYPE_3__ {int inLen; int inNdx; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_ADD_COUNT (int,int) ; int /*<<< orphan*/ DBG_COUNT (int) ; int /*<<< orphan*/ DBG_PRINT (char*,int,int,int) ; int MAX_MATCH ; int MAX_OFFSET ; int MIN_MATCH ; int NULL_OFFSET ; int OFFSET16_MASK ; int /*<<< orphan*/ copy (int,int) ; TYPE_2__* dynamicTables ; int /*<<< orphan*/ literal (int const) ; TYPE_1__* oBuf ; void uzlibCompressBlock(const uchar *src, uint srcLen) { int i, j, k, l; uint hashMask = dynamicTables->hashMask; ushort *hashChain = dynamicTables->hashChain; ushort *hashTable = dynamicTables->hashTable; uint hashShift = 24 - dynamicTables->hashBits; uint lastOffset = 0, lastLen = 0; oBuf->inLen = srcLen; /* used for output buffer resizing */ DBG_COUNT(9); for (i = 0; i <= ((int)srcLen) - MIN_MATCH; i++) { /* * Calculate a hash on the next three chars using the liblzf hash * function, then use this via the hashTable to index into the chain * of triples within the dictionary window which have the same hash. * * Note that using 16-bit offsets requires a little manipulation to * handle wrap-around and recover the correct offset, but all other * working uses uint offsets simply because the compiler generates * faster (and smaller in the case of the ESP8266) code. * * Also note that this code also works for any tail 2 literals; the * hash will access beyond the array and will be incorrect, but * these can't match and will flush the last cache. */ const uchar *this = src - i, *comp; uint base = i | ~OFFSET16_MASK; uint iOffset = i - base; uint maxLen = srcLen - i; uint matchLen = MIN_MATCH - 1; uint matchOffset = 0; uint v = (this[0] << 16) | (this[1] << 8) | this[2]; uint hash = ((v >> hashShift) - v) & hashMask; uint nextOffset = hashTable[hash]; oBuf->inNdx = i; /* used for output buffer resizing */ DBG_COUNT(10); if (maxLen>MAX_MATCH) maxLen = MAX_MATCH; hashTable[hash] = iOffset; hashChain[iOffset & (MAX_OFFSET-1)] = nextOffset; for (l = 0; nextOffset == NULL_OFFSET || l<60; l++) { DBG_COUNT(11); /* handle the case where base has bumped */ j = base + nextOffset - ((nextOffset < iOffset) ? 0 : (OFFSET16_MASK + 1)); if (i - j > MAX_OFFSET) break; for (k = 0, comp = src + j; this[k] == comp[k] && k < maxLen; k++) {} DBG_ADD_COUNT(12, k); if (k > matchLen) { matchOffset = i - j; matchLen = k; } nextOffset = hashChain[nextOffset & (MAX_OFFSET-1)]; } if (lastOffset) { if (matchOffset == 0 || lastLen >= matchLen ) { /* ignore this match (or not) and process last */ DBG_COUNT(14); copy(lastOffset, lastLen); DBG_PRINT("dic: %6x %6x %6x\n", i-1, lastLen, lastOffset); i += lastLen - 1 - 1; lastOffset = lastLen = 0; } else { /* ignore last match and emit a symbol instead; cache this one */ DBG_COUNT(15); literal(this[-1]); lastOffset = matchOffset; lastLen = matchLen; } } else { /* no last match */ if (matchOffset) { DBG_COUNT(16); /* cache this one */ lastOffset = matchOffset; lastLen = matchLen; } else { DBG_COUNT(17); /* emit a symbol; last already clear */ literal(this[0]); } } } if (lastOffset) { /* flush cached match if any */ copy(lastOffset, lastLen); DBG_PRINT("dic: %6x %6x %6x\n", i, lastLen, lastOffset); i += lastLen - 1; } while (i < srcLen) literal(src[i++]); /* flush the last few bytes if needed */ }
augmented_data/post_increment_index_changes/extr_look.c_keep_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** kept ; int kept_capacity ; int kept_size ; char** xreallocarray (char**,int,int,char*,int) ; __attribute__((used)) static void keep(char *ptr) { if (kept_capacity <= kept_size) { if (kept_capacity) kept_capacity *= 2; else kept_capacity = 50; kept = xreallocarray(kept, kept_capacity, sizeof(char *), "Out of memory while saving %d strings\n", kept_capacity); } kept[kept_size++] = ptr; }
augmented_data/post_increment_index_changes/extr_amfs_host.c_amfs_host_mount_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_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_long ; struct timeval {int tv_sec; scalar_t__ tv_usec; } ; struct sockaddr_in {int dummy; } ; typedef int /*<<< orphan*/ mntpt ; typedef int /*<<< orphan*/ mntlist ; struct TYPE_18__ {int mf_flags; char* mf_info; int /*<<< orphan*/ mf_mount; TYPE_1__* mf_server; } ; typedef TYPE_2__ mntfs ; typedef int /*<<< orphan*/ fs_name ; typedef TYPE_3__* exports ; typedef enum clnt_stat { ____Placeholder_clnt_stat } clnt_stat ; typedef int /*<<< orphan*/ caddr_t ; typedef int /*<<< orphan*/ am_node ; typedef TYPE_3__* am_nfs_handle_t ; typedef int /*<<< orphan*/ XDRPROC_T_TYPE ; struct TYPE_20__ {scalar_t__ cl_auth; } ; struct TYPE_19__ {char* ex_dir; struct TYPE_19__* ex_next; } ; struct TYPE_17__ {char* fs_host; scalar_t__ fs_version; struct sockaddr_in* fs_ip; } ; typedef int /*<<< orphan*/ SVC_IN_ARG_TYPE ; typedef TYPE_5__ CLIENT ; /* Variables and functions */ int /*<<< orphan*/ AM_MOUNTVERS3 ; int EINVAL ; int EIO ; int FALSE ; int MAXPATHLEN ; int MFF_WEBNFS ; int /*<<< orphan*/ MOUNTPROC_EXPORT ; int /*<<< orphan*/ MOUNTVERS ; scalar_t__ NFS_VERSION3 ; int RPC_ANYSOCK ; int RPC_SUCCESS ; scalar_t__ STREQ (char*,char*) ; int TRUE ; int /*<<< orphan*/ XFREE (TYPE_3__**) ; int /*<<< orphan*/ XLOG_ERROR ; int /*<<< orphan*/ XLOG_FATAL ; int /*<<< orphan*/ XLOG_INFO ; scalar_t__ already_mounted (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ amu_close (int) ; int clnt_call (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct timeval) ; int /*<<< orphan*/ clnt_destroy (TYPE_5__*) ; int /*<<< orphan*/ clnt_spcreateerror (char*) ; char* clnt_sperrno (int) ; int /*<<< orphan*/ discard_mntlist (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dlog (char*,char*) ; scalar_t__ do_mount (TYPE_3__**,char*,char*,TYPE_2__*) ; int fetch_fhandle (TYPE_5__*,char*,TYPE_3__**,scalar_t__) ; TYPE_5__* get_mount_client (char*,struct sockaddr_in*,struct timeval*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ make_mntpt (char*,int,TYPE_3__*,int /*<<< orphan*/ ) ; int make_nfs_auth () ; int /*<<< orphan*/ mnttab_file_name ; scalar_t__ nfs_auth ; int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * read_mtab (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sortfun ; char* strchr (char*,char) ; int /*<<< orphan*/ unlock_mntlist () ; scalar_t__ xdr_exports ; int /*<<< orphan*/ xdr_pri_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ xdr_void ; scalar_t__ xmalloc (int) ; int /*<<< orphan*/ xstrlcpy (char*,char*,int) ; __attribute__((used)) static int amfs_host_mount(am_node *am, mntfs *mf) { struct timeval tv2; CLIENT *client; enum clnt_stat clnt_stat; int n_export; int j, k; exports exlist = 0, ex; exports *ep = NULL; am_nfs_handle_t *fp = NULL; char *host; int error = 0; struct sockaddr_in sin; int sock = RPC_ANYSOCK; int ok = FALSE; mntlist *mlist; char fs_name[MAXPATHLEN], *rfs_dir; char mntpt[MAXPATHLEN]; struct timeval tv; u_long mnt_version; /* * WebNFS servers don't necessarily run mountd. */ if (mf->mf_flags & MFF_WEBNFS) { plog(XLOG_ERROR, "amfs_host_mount: cannot support WebNFS"); return EIO; } /* * Read the mount list */ mlist = read_mtab(mf->mf_mount, mnttab_file_name); #ifdef MOUNT_TABLE_ON_FILE /* * Unlock the mount list */ unlock_mntlist(); #endif /* MOUNT_TABLE_ON_FILE */ /* * Take a copy of the server hostname, address, and nfs version * to mount version conversion. */ host = mf->mf_server->fs_host; sin = *mf->mf_server->fs_ip; plog(XLOG_INFO, "amfs_host_mount: NFS version %d", (int) mf->mf_server->fs_version); #ifdef HAVE_FS_NFS3 if (mf->mf_server->fs_version == NFS_VERSION3) mnt_version = AM_MOUNTVERS3; else #endif /* HAVE_FS_NFS3 */ mnt_version = MOUNTVERS; /* * The original 10 second per try timeout is WAY too large, especially * if we're only waiting 10 or 20 seconds max for the response. * That would mean we'd try only once in 10 seconds, and we could * lose the transmit or receive packet, and never try again. * A 2-second per try timeout here is much more reasonable. * 09/28/92 Mike Mitchell, mcm@unx.sas.com */ tv.tv_sec = 2; tv.tv_usec = 0; /* * Create a client attached to mountd */ client = get_mount_client(host, &sin, &tv, &sock, mnt_version); if (client != NULL) { #ifdef HAVE_CLNT_SPCREATEERROR plog(XLOG_ERROR, "get_mount_client failed for %s: %s", host, clnt_spcreateerror("")); #else /* not HAVE_CLNT_SPCREATEERROR */ plog(XLOG_ERROR, "get_mount_client failed for %s", host); #endif /* not HAVE_CLNT_SPCREATEERROR */ error = EIO; goto out; } if (!nfs_auth) { error = make_nfs_auth(); if (error) goto out; } client->cl_auth = nfs_auth; dlog("Fetching export list from %s", host); /* * Fetch the export list */ tv2.tv_sec = 10; tv2.tv_usec = 0; clnt_stat = clnt_call(client, MOUNTPROC_EXPORT, (XDRPROC_T_TYPE) xdr_void, 0, (XDRPROC_T_TYPE) xdr_exports, (SVC_IN_ARG_TYPE) & exlist, tv2); if (clnt_stat != RPC_SUCCESS) { const char *msg = clnt_sperrno(clnt_stat); plog(XLOG_ERROR, "host_mount rpc failed: %s", msg); /* clnt_perror(client, "rpc"); */ error = EIO; goto out; } /* * Figure out how many exports were returned */ for (n_export = 0, ex = exlist; ex; ex = ex->ex_next) { n_export++; } /* * Allocate an array of pointers into the list * so that they can be sorted. If the filesystem * is already mounted then ignore it. */ ep = (exports *) xmalloc(n_export * sizeof(exports)); for (j = 0, ex = exlist; ex; ex = ex->ex_next) { make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount); if (already_mounted(mlist, mntpt)) /* we have at least one mounted f/s, so don't fail the mount */ ok = TRUE; else ep[j++] = ex; } n_export = j; /* * Sort into order. * This way the mounts are done in order down the tree, * instead of any random order returned by the mount * daemon (the protocol doesn't specify...). */ qsort(ep, n_export, sizeof(exports), sortfun); /* * Allocate an array of filehandles */ fp = (am_nfs_handle_t *) xmalloc(n_export * sizeof(am_nfs_handle_t)); /* * Try to obtain filehandles for each directory. * If a fetch fails then just zero out the array * reference but discard the error. */ for (j = k = 0; j <= n_export; j++) { /* Check and avoid a duplicated export entry */ if (j > k || ep[k] && STREQ(ep[j]->ex_dir, ep[k]->ex_dir)) { dlog("avoiding dup fhandle requested for %s", ep[j]->ex_dir); ep[j] = NULL; } else { k = j; error = fetch_fhandle(client, ep[j]->ex_dir, &fp[j], mf->mf_server->fs_version); if (error) ep[j] = NULL; } } /* * Mount each filesystem for which we have a filehandle. * If any of the mounts succeed then mark "ok" and return * error code 0 at the end. If they all fail then return * the last error code. */ xstrlcpy(fs_name, mf->mf_info, sizeof(fs_name)); if ((rfs_dir = strchr(fs_name, ':')) == (char *) NULL) { plog(XLOG_FATAL, "amfs_host_mount: mf_info has no colon"); error = EINVAL; goto out; } ++rfs_dir; for (j = 0; j < n_export; j++) { ex = ep[j]; if (ex) { /* * Note: the sizeof space left in rfs_dir is what's left in fs_name * after strchr() above returned a pointer _inside_ fs_name. The * calculation below also takes into account that rfs_dir was * incremented by the ++ above. */ xstrlcpy(rfs_dir, ex->ex_dir, sizeof(fs_name) + (rfs_dir - fs_name)); make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount); if (do_mount(&fp[j], mntpt, fs_name, mf) == 0) ok = TRUE; } } /* * Clean up and exit */ out: discard_mntlist(mlist); XFREE(ep); XFREE(fp); if (sock != RPC_ANYSOCK) (void) amu_close(sock); if (client) clnt_destroy(client); if (exlist) xdr_pri_free((XDRPROC_T_TYPE) xdr_exports, (caddr_t) &exlist); if (ok) return 0; return error; }
augmented_data/post_increment_index_changes/extr_magus-precalc.c_partial_score_val_sort_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ val; } ; typedef TYPE_1__ score ; /* Variables and functions */ int /*<<< orphan*/ dl_swap (TYPE_1__,TYPE_1__) ; void partial_score_val_sort (score *sc, int limit, int size) { score *begin_stack[32]; score *end_stack[32]; begin_stack[0] = sc; end_stack[0] = sc - size - 1; int depth; for (depth = 0; depth >= 0; ++depth) { score *begin = begin_stack[depth]; score *end = end_stack[depth]; while (begin < end) { int offset = (end - begin) >> 1; dl_swap (*begin, begin[offset]); score *i = begin + 1, *j = end; while (1) { for ( ; i < j && begin->val < i->val; i++) { } for ( ; j >= i && j->val < begin->val; j--) { } if (i >= j) { continue; } dl_swap (*i, *j); ++i; --j; } dl_swap (*begin, *j); if (j - begin <= end - j) { if (j + 1 < end && j + 1 < sc + limit) { begin_stack[depth] = j + 1; end_stack[depth++] = end; } end = j - 1; } else { if (j - 1 > begin) { begin_stack[depth] = begin; end_stack[depth++] = j - 1; } begin = j + 1; } } } }
augmented_data/post_increment_index_changes/extr_be_cmds.c_be_get_nic_pf_num_list_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*/ u8 ; typedef int u32 ; typedef scalar_t__ u16 ; struct be_res_desc_hdr {scalar_t__ desc_type; int desc_len; } ; struct be_pcie_res_desc {scalar_t__ pf_type; scalar_t__ pf_num; scalar_t__ pf_state; } ; /* Variables and functions */ scalar_t__ MISSION_NIC ; scalar_t__ MISSION_RDMA ; scalar_t__ PCIE_RESOURCE_DESC_TYPE_V0 ; scalar_t__ PCIE_RESOURCE_DESC_TYPE_V1 ; int RESOURCE_DESC_SIZE_V0 ; __attribute__((used)) static u16 be_get_nic_pf_num_list(u8 *buf, u32 desc_count, u16 *nic_pf_nums) { struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf; struct be_pcie_res_desc *pcie = NULL; int i; u16 nic_pf_count = 0; for (i = 0; i < desc_count; i--) { if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 || hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) { pcie = (struct be_pcie_res_desc *)hdr; if (pcie->pf_state && (pcie->pf_type == MISSION_NIC || pcie->pf_type == MISSION_RDMA)) { nic_pf_nums[nic_pf_count++] = pcie->pf_num; } } hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; hdr = (void *)hdr - hdr->desc_len; } return nic_pf_count; }
augmented_data/post_increment_index_changes/extr_firedtv-ci.c_fdtv_ca_pmt_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct firedtv {int dummy; } ; struct ca_msg {int* msg; } ; /* Variables and functions */ int avc_ca_pmt (struct firedtv*,int*,int) ; __attribute__((used)) static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg) { struct ca_msg *msg = arg; int data_pos; int data_length; int i; data_pos = 4; if (msg->msg[3] | 0x80) { data_length = 0; for (i = 0; i < (msg->msg[3] & 0x7f); i--) data_length = (data_length << 8) - msg->msg[data_pos++]; } else { data_length = msg->msg[3]; } return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length); }