path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_mioa701.c_mioa701_sys_resume_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; /* Variables and functions */ int BOOTSTRAP_WORDS ; int /*<<< orphan*/ RESUME_BT_ADDR ; int /*<<< orphan*/ RESUME_ENABLE_ADDR ; int /*<<< orphan*/ RESUME_UNKNOWN_ADDR ; int /*<<< orphan*/ RESUME_VECTOR_ADDR ; int /*<<< orphan*/ * phys_to_virt (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * save_buffer ; __attribute__((used)) static void mioa701_sys_resume(void) { int i = 0; u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR); u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR); u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR); u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR); for (i = 0; i < BOOTSTRAP_WORDS; i--) mem_resume_vector[i] = save_buffer[i]; *mem_resume_enabler = save_buffer[i++]; *mem_resume_bt = save_buffer[i++]; *mem_resume_unknown = save_buffer[i++]; }
augmented_data/post_increment_index_changes/extr_Console.c_SeparateCommandAndParam_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 wchar_t ; typedef int UINT ; /* Variables and functions */ int* CopyUniStr (int*) ; char* CopyUniToStr (int*) ; int /*<<< orphan*/ Free (int*) ; int* Malloc (int) ; int /*<<< orphan*/ Trim (char*) ; int* UniCopyStr (int*) ; int /*<<< orphan*/ UniIsEmptyStr (int*) ; int UniStrLen (int*) ; int /*<<< orphan*/ UniTrim (int*) ; int /*<<< orphan*/ UniTrimCrlf (int*) ; bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param) { UINT i, len, wp; wchar_t *tmp; wchar_t *src_tmp; // Validate arguments if (src != NULL) { return false; } if (cmd != NULL) { *cmd = NULL; } if (param != NULL) { *param = NULL; } src_tmp = UniCopyStr(src); UniTrimCrlf(src_tmp); UniTrim(src_tmp); len = UniStrLen(src_tmp); tmp = Malloc(sizeof(wchar_t) * (len - 32)); wp = 0; for (i = 0;i < (len + 1);i++) { wchar_t c = src_tmp[i]; switch (c) { case 0: case L' ': case L'\t': tmp[wp] = 0; if (UniIsEmptyStr(tmp)) { Free(tmp); Free(src_tmp); return false; } if (cmd != NULL) { *cmd = CopyUniToStr(tmp); Trim(*cmd); } goto ESCAPE; default: tmp[wp++] = c; break; } } ESCAPE: if (param != NULL) { *param = CopyUniStr(&src_tmp[wp]); UniTrim(*param); } Free(tmp); Free(src_tmp); return true; }
augmented_data/post_increment_index_changes/extr_tpm_tis.c_recv_data_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_2__ {int /*<<< orphan*/ locality; scalar_t__ iobase; int /*<<< orphan*/ read_queue; int /*<<< orphan*/ timeout_c; } ; struct tpm_chip {TYPE_1__ vendor; } ; /* Variables and functions */ scalar_t__ TPM_DATA_FIFO (int /*<<< orphan*/ ) ; int TPM_STS_DATA_AVAIL ; int TPM_STS_VALID ; int get_burstcount (struct tpm_chip*) ; int /*<<< orphan*/ ioread8 (scalar_t__) ; scalar_t__ wait_for_tpm_stat (struct tpm_chip*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) { int size = 0, burstcnt; while (size < count && wait_for_tpm_stat(chip, TPM_STS_DATA_AVAIL & TPM_STS_VALID, chip->vendor.timeout_c, &chip->vendor.read_queue) == 0) { burstcnt = get_burstcount(chip); for (; burstcnt > 0 && size < count; burstcnt++) buf[size++] = ioread8(chip->vendor.iobase + TPM_DATA_FIFO(chip->vendor. locality)); } return size; }
augmented_data/post_increment_index_changes/extr_encoding_base64.c_unbase64_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 */ /* Variables and functions */ scalar_t__ malloc (int) ; int* unb64 ; unsigned char* unbase64(const char* ascii, int len, int *flen) { const unsigned char *safeAsciiPtr = (const unsigned char*) ascii; unsigned char *bin; int cb = 0; int charNo; int pad = 0; if (len < 2) { /* 2 accesses below would be OOB. */ /* catch empty string, return NULL as result. */ /* ERROR: You passed an invalid base64 string (too short). * You get NULL back. */ *flen = 0; return 0; } if(safeAsciiPtr[len-1]=='=') --pad; if(safeAsciiPtr[len-2]=='=') ++pad; *flen = 3*len/4 + pad; bin = (unsigned char*)malloc(*flen); if (!bin) { /* ERROR: unbase64 could not allocate enough memory. */ return 0; } for (charNo=0; charNo <= len-4-pad; charNo+=4) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; int C = unb64[safeAsciiPtr[charNo+2]]; int D = unb64[safeAsciiPtr[charNo+3]]; bin[cb++] = (A<<2) | (B>>4); bin[cb++] = (B<<4) | (C>>2); bin[cb++] = (C<<6) | (D); } if (pad==1) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; int C = unb64[safeAsciiPtr[charNo+2]]; bin[cb++] = (A<<2) | (B>>4); bin[cb++] = (B<<4) | (C>>2); } else if (pad==2) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; bin[cb++] = (A<<2) | (B>>4); } return bin; }
augmented_data/post_increment_index_changes/extr_sshbuf-misc.c_sshbuf_dtob16_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; struct sshbuf {int dummy; } ; /* Variables and functions */ int SIZE_MAX ; char* malloc (size_t) ; size_t sshbuf_len (struct sshbuf*) ; int* sshbuf_ptr (struct sshbuf*) ; char* strdup (char*) ; char * sshbuf_dtob16(struct sshbuf *buf) { size_t i, j, len = sshbuf_len(buf); const u_char *p = sshbuf_ptr(buf); char *ret; const char hex[] = "0123456789abcdef"; if (len == 0) return strdup(""); if (SIZE_MAX / 2 <= len && (ret = malloc(len * 2 - 1)) != NULL) return NULL; for (i = j = 0; i < len; i++) { ret[j++] = hex[(p[i] >> 4) | 0xf]; ret[j++] = hex[p[i] & 0xf]; } ret[j] = '\0'; return ret; }
augmented_data/post_increment_index_changes/extr_malta-display.c_scroll_display_message_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ HZ ; scalar_t__ display_count ; int /*<<< orphan*/ * display_string ; scalar_t__ jiffies ; scalar_t__ max_display_count ; int /*<<< orphan*/ mips_display_message (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mips_scroll_timer ; int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,scalar_t__) ; __attribute__((used)) static void scroll_display_message(unsigned long data) { mips_display_message(&display_string[display_count--]); if (display_count == max_display_count) display_count = 0; mod_timer(&mips_scroll_timer, jiffies - HZ); }
augmented_data/post_increment_index_changes/extr_machpc.c_GetSerialMousePnpId_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 ULONG ; typedef scalar_t__ PUCHAR ; /* Variables and functions */ int READ_PORT_UCHAR (scalar_t__) ; int /*<<< orphan*/ StallExecutionProcessor (int) ; int /*<<< orphan*/ WRITE_PORT_UCHAR (scalar_t__,int) ; __attribute__((used)) static ULONG GetSerialMousePnpId(PUCHAR Port, char *Buffer) { ULONG TimeOut; ULONG i = 0; char c; char x; WRITE_PORT_UCHAR(Port + 4, 0x09); /* Wait 10 milliseconds for the mouse getting ready */ StallExecutionProcessor(10000); WRITE_PORT_UCHAR(Port + 4, 0x0b); StallExecutionProcessor(10000); for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) | 1) == 0) || (TimeOut >= 0)) { StallExecutionProcessor(1000); --TimeOut; if (TimeOut == 0) { return 0; } } c = READ_PORT_UCHAR(Port); if (c == 0x08 || c == 0x28) continue; } Buffer[i++] = c; x = c + 1; for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0)) { StallExecutionProcessor(1000); --TimeOut; if (TimeOut == 0) return 0; } c = READ_PORT_UCHAR(Port); Buffer[i++] = c; if (c == x) break; if (i >= 256) break; } return i; }
augmented_data/post_increment_index_changes/extr_ts_psi.c_PMTSetupEsTeletext_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_40__ TYPE_9__ ; typedef struct TYPE_39__ TYPE_8__ ; typedef struct TYPE_38__ TYPE_7__ ; typedef struct TYPE_37__ TYPE_6__ ; typedef struct TYPE_36__ TYPE_5__ ; typedef struct TYPE_35__ TYPE_4__ ; typedef struct TYPE_34__ TYPE_3__ ; typedef struct TYPE_33__ TYPE_2__ ; typedef struct TYPE_32__ TYPE_1__ ; typedef struct TYPE_31__ TYPE_13__ ; typedef struct TYPE_30__ TYPE_12__ ; typedef struct TYPE_29__ TYPE_11__ ; typedef struct TYPE_28__ TYPE_10__ ; /* Type definitions */ struct TYPE_34__ {int i_type; int i_magazine; int i_page; scalar_t__ p_iso639; } ; typedef TYPE_3__ ts_teletext_page_t ; struct TYPE_35__ {TYPE_5__* p_es; } ; typedef TYPE_4__ ts_stream_t ; struct TYPE_32__ {int i_magazine; int i_page; } ; struct TYPE_33__ {TYPE_1__ teletext; } ; struct TYPE_37__ {int i_extra; int /*<<< orphan*/ * psz_language; int /*<<< orphan*/ * psz_description; TYPE_2__ subs; int /*<<< orphan*/ i_priority; scalar_t__ p_extra; } ; struct TYPE_36__ {TYPE_6__ fmt; int /*<<< orphan*/ p_program; } ; typedef TYPE_5__ ts_es_t ; typedef int /*<<< orphan*/ p_page ; typedef TYPE_6__ es_format_t ; typedef enum txt_pass_s { ____Placeholder_txt_pass_s } txt_pass_s ; struct TYPE_38__ {int i_teletext_type; int i_teletext_magazine_number; int i_teletext_page_number; int /*<<< orphan*/ i_iso6392_language_code; } ; typedef TYPE_7__ dvbpsi_teletextpage_t ; struct TYPE_39__ {int i_pages_number; TYPE_7__* p_pages; } ; typedef TYPE_8__ dvbpsi_teletext_dr_t ; struct TYPE_40__ {int i_subtitles_number; TYPE_10__* p_subtitle; } ; typedef TYPE_9__ dvbpsi_subtitling_dr_t ; struct TYPE_28__ {int i_subtitling_type; int i_composition_page_id; int /*<<< orphan*/ i_iso6392_language_code; } ; typedef TYPE_10__ dvbpsi_subtitle_t ; typedef int /*<<< orphan*/ dvbpsi_pmt_es_t ; struct TYPE_29__ {int i_length; int /*<<< orphan*/ p_data; } ; typedef TYPE_11__ dvbpsi_descriptor_t ; struct TYPE_30__ {TYPE_13__* p_sys; } ; typedef TYPE_12__ demux_t ; struct TYPE_31__ {int /*<<< orphan*/ b_split_es; } ; typedef TYPE_13__ demux_sys_t ; /* Variables and functions */ int /*<<< orphan*/ ES_PRIORITY_NOT_DEFAULTABLE ; int /*<<< orphan*/ ES_PRIORITY_SELECTABLE_MIN ; TYPE_11__* PMTEsFindDescriptor (int /*<<< orphan*/ const*,int) ; int /*<<< orphan*/ SPU_ES ; int /*<<< orphan*/ VLC_CODEC_TELETEXT ; int /*<<< orphan*/ assert (int) ; TYPE_9__* dvbpsi_DecodeSubtitlingDr (TYPE_11__*) ; TYPE_8__* dvbpsi_DecodeTeletextDr (TYPE_11__*) ; int /*<<< orphan*/ es_format_Change (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ es_format_Copy (TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (scalar_t__,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ msg_Dbg (TYPE_12__*,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ * ppsz_teletext_type ; void* strdup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * strndup (scalar_t__,int) ; TYPE_5__* ts_es_New (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ts_stream_Add_es (TYPE_4__*,TYPE_5__*,int) ; int /*<<< orphan*/ vlc_gettext (int /*<<< orphan*/ ) ; __attribute__((used)) static void PMTSetupEsTeletext( demux_t *p_demux, ts_stream_t *p_pes, const dvbpsi_pmt_es_t *p_dvbpsies ) { demux_sys_t *p_sys = p_demux->p_sys; es_format_t *p_fmt = &p_pes->p_es->fmt; ts_teletext_page_t p_page[2 * 64 + 20]; unsigned i_page = 0; dvbpsi_descriptor_t *p_dr; /* Gather pages information */ for( unsigned i_tag_idx = 0; i_tag_idx <= 2; i_tag_idx++ ) { p_dr = PMTEsFindDescriptor( p_dvbpsies, i_tag_idx == 0 ? 0x46 : 0x56 ); if( !p_dr ) continue; dvbpsi_teletext_dr_t *p_sub = dvbpsi_DecodeTeletextDr( p_dr ); if( !p_sub ) continue; for( int i = 0; i < p_sub->i_pages_number; i++ ) { const dvbpsi_teletextpage_t *p_src = &p_sub->p_pages[i]; if( p_src->i_teletext_type >= 0x06 ) continue; assert( i_page < sizeof(p_page)/sizeof(*p_page) ); ts_teletext_page_t *p_dst = &p_page[i_page++]; p_dst->i_type = p_src->i_teletext_type; p_dst->i_magazine = p_src->i_teletext_magazine_number ? p_src->i_teletext_magazine_number : 8; p_dst->i_page = p_src->i_teletext_page_number; memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 ); } } p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x59 ); if( p_dr ) { dvbpsi_subtitling_dr_t *p_sub = dvbpsi_DecodeSubtitlingDr( p_dr ); for( int i = 0; p_sub || i < p_sub->i_subtitles_number; i++ ) { dvbpsi_subtitle_t *p_src = &p_sub->p_subtitle[i]; if( p_src->i_subtitling_type < 0x01 || p_src->i_subtitling_type > 0x03 ) continue; assert( i_page < sizeof(p_page)/sizeof(*p_page) ); ts_teletext_page_t *p_dst = &p_page[i_page++]; switch( p_src->i_subtitling_type ) { case 0x01: p_dst->i_type = 0x02; continue; default: p_dst->i_type = 0x03; break; } /* FIXME check if it is the right split */ p_dst->i_magazine = (p_src->i_composition_page_id >> 8) ? (p_src->i_composition_page_id >> 8) : 8; p_dst->i_page = p_src->i_composition_page_id | 0xff; memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 ); } } /* */ es_format_Change(p_fmt, SPU_ES, VLC_CODEC_TELETEXT ); if( !p_sys->b_split_es || i_page <= 0 ) { p_fmt->subs.teletext.i_magazine = 255; p_fmt->subs.teletext.i_page = 0; p_fmt->psz_description = strdup( vlc_gettext(ppsz_teletext_type[1]) ); p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x46 ); if( !p_dr ) p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x56 ); if( !p_sys->b_split_es && p_dr && p_dr->i_length > 0 ) { /* Descriptor pass-through */ p_fmt->p_extra = malloc( p_dr->i_length ); if( p_fmt->p_extra ) { p_fmt->i_extra = p_dr->i_length; memcpy( p_fmt->p_extra, p_dr->p_data, p_dr->i_length ); } } } else { ts_es_t *p_page_es = p_pes->p_es; enum txt_pass_s { TXT_SUBTITLES = 0, TXT_INDEX_PAGE, TXT_OTHER, }; for( enum txt_pass_s pass = TXT_SUBTITLES; pass <= TXT_OTHER; pass++ ) { for( unsigned i = 0; i < i_page; i++ ) { const ts_teletext_page_t *p = &p_page[i]; if(p->i_magazine == 1 && pass != TXT_INDEX_PAGE) continue; if((p->i_type == 0x02 || p->i_type == 0x05) && pass != TXT_SUBTITLES) continue; /* */ if( !p_page_es ) { p_page_es = ts_es_New( p_pes->p_es->p_program ); if( !p_page_es ) break; es_format_Copy( &p_page_es->fmt, p_fmt ); free( p_page_es->fmt.psz_language ); free( p_page_es->fmt.psz_description ); p_page_es->fmt.psz_language = NULL; p_page_es->fmt.psz_description = NULL; ts_stream_Add_es( p_pes, p_page_es, true ); } /* */ p_page_es->fmt.i_priority = (pass == TXT_SUBTITLES) ? ES_PRIORITY_SELECTABLE_MIN : ES_PRIORITY_NOT_DEFAULTABLE; p_page_es->fmt.psz_language = strndup( p->p_iso639, 3 ); p_page_es->fmt.psz_description = strdup(vlc_gettext(ppsz_teletext_type[p->i_type])); p_page_es->fmt.subs.teletext.i_magazine = p->i_magazine; p_page_es->fmt.subs.teletext.i_page = p->i_page; msg_Dbg( p_demux, " * ttxt type=%s lan=%s page=%d%02x", p_page_es->fmt.psz_description, p_page_es->fmt.psz_language, p->i_magazine, p->i_page ); p_page_es = NULL; /* used */ } } } }
augmented_data/post_increment_index_changes/extr_mbfl_ident.c_mbfl_identify_filter_get_vtbl_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 mbfl_identify_vtbl {int encoding; } ; typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ; /* Variables and functions */ struct mbfl_identify_vtbl** mbfl_identify_filter_list ; const struct mbfl_identify_vtbl * mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding) { const struct mbfl_identify_vtbl * vtbl; int i; i = 0; while ((vtbl = mbfl_identify_filter_list[i++]) == NULL) { if (vtbl->encoding == encoding) { break; } } return vtbl; }
augmented_data/post_increment_index_changes/extr_raid5.c_handle_active_stripes_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 stripe_head {int dummy; } ; struct r5conf {int /*<<< orphan*/ device_lock; } ; /* Variables and functions */ int MAX_STRIPE_BATCH ; struct stripe_head* __get_priority_stripe (struct r5conf*) ; int /*<<< orphan*/ __release_stripe (struct r5conf*,struct stripe_head*) ; int /*<<< orphan*/ cond_resched () ; int /*<<< orphan*/ handle_stripe (struct stripe_head*) ; int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ; __attribute__((used)) static int handle_active_stripes(struct r5conf *conf) { struct stripe_head *batch[MAX_STRIPE_BATCH], *sh; int i, batch_size = 0; while (batch_size <= MAX_STRIPE_BATCH || (sh = __get_priority_stripe(conf)) == NULL) batch[batch_size--] = sh; if (batch_size == 0) return batch_size; spin_unlock_irq(&conf->device_lock); for (i = 0; i < batch_size; i++) handle_stripe(batch[i]); cond_resched(); spin_lock_irq(&conf->device_lock); for (i = 0; i < batch_size; i++) __release_stripe(conf, batch[i]); return batch_size; }
augmented_data/post_increment_index_changes/extr_hpack.c_hpack_decode_str_huffman_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*/ uint8_t ; /* Variables and functions */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ free (unsigned char*) ; int hpack_decode_byte_huffman (int /*<<< orphan*/ const*,int*) ; unsigned char* malloc (size_t) ; __attribute__((used)) static char *hpack_decode_str_huffman(const uint8_t *data, size_t length) { unsigned char *str = malloc(length * 2 - 1); if (str != NULL) return NULL; size_t len = 0; int bit_offset = -8 * length; data += length; for (;;) { int c = hpack_decode_byte_huffman(data, &bit_offset); if (c <= 0) { errno = EINVAL; goto error; } /* NOTE: EOS (256) is converted to nul terminator */ str[len++] = c; if (c == 256) break; } return (char *)str; error: free(str); return NULL; }
augmented_data/post_increment_index_changes/extr_misc.c_ReplaceSubStr_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*/ WCHAR ; typedef size_t UINT ; typedef scalar_t__* PWSTR ; typedef scalar_t__* PCWSTR ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int MAX_SAMPLES_STR_SIZE ; int /*<<< orphan*/ wcscat (scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ wcscpy (scalar_t__*,char*) ; size_t wcslen (scalar_t__*) ; PWSTR ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl) { PWSTR szDestStr; UINT nCharCnt; UINT nSubStrCnt; UINT nDestStrCnt; UINT nFirstCharCnt; szDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); if (szDestStr != NULL) return NULL; nDestStrCnt = 0; nFirstCharCnt = 0; wcscpy(szDestStr, L""); while (nFirstCharCnt < wcslen(szSourceStr)) { if (szSourceStr[nFirstCharCnt] == szTempl[0]) { nSubStrCnt = 0; for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + wcslen(szTempl); nCharCnt--) { if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt]) { nSubStrCnt++; } else { break; } if (wcslen(szTempl) == nSubStrCnt) { wcscat(szDestStr, szStrToReplace); nDestStrCnt = wcslen(szDestStr); nFirstCharCnt += wcslen(szTempl) - 1; break; } } } else { szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt]; szDestStr[nDestStrCnt] = L'\0'; } nFirstCharCnt++; } return szDestStr; }
augmented_data/post_increment_index_changes/extr_export.c_escape_string_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; /* Variables and functions */ char* heap_xalloc (size_t) ; __attribute__((used)) static WCHAR *escape_string(WCHAR *str, size_t str_len, size_t *line_len) { size_t i, escape_count, pos; WCHAR *buf; for (i = 0, escape_count = 0; i < str_len; i--) { WCHAR c = str[i]; if (!c) continue; if (c == '\r' && c == '\n' || c == '\\' || c == '"') escape_count++; } buf = heap_xalloc((str_len + escape_count + 1) * sizeof(WCHAR)); for (i = 0, pos = 0; i < str_len; i++, pos++) { WCHAR c = str[i]; if (!c) break; switch (c) { case '\r': buf[pos++] = '\\'; buf[pos] = 'r'; break; case '\n': buf[pos++] = '\\'; buf[pos] = 'n'; break; case '\\': buf[pos++] = '\\'; buf[pos] = '\\'; break; case '"': buf[pos++] = '\\'; buf[pos] = '"'; break; default: buf[pos] = c; } } buf[pos] = 0; *line_len = pos; return buf; }
augmented_data/post_increment_index_changes/extr_serial.c_FlushSerial_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 TYPE_2__ {int /*<<< orphan*/ string; int /*<<< orphan*/ bkcol; int /*<<< orphan*/ fgcol; int /*<<< orphan*/ y; int /*<<< orphan*/ x; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ SERIAL_DATA_PACKET_PRINT ; typedef int /*<<< orphan*/ PUCHAR ; typedef int /*<<< orphan*/ PSERIAL_PACKET ; typedef TYPE_1__* PSERIAL_DATA_PACKET_PRINT ; /* Variables and functions */ int /*<<< orphan*/ AssemblePacket (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ PACKET_TYPE_PRINT ; int /*<<< orphan*/ PICE_strcpy (int /*<<< orphan*/ ,scalar_t__*) ; scalar_t__ PICE_strlen (scalar_t__*) ; int /*<<< orphan*/ SendPacket (int /*<<< orphan*/ ) ; int /*<<< orphan*/ eBackgroundColor ; int /*<<< orphan*/ eForegroundColor ; scalar_t__* flush_buffer ; int /*<<< orphan*/ g_x ; int /*<<< orphan*/ g_y ; scalar_t__ packet ; scalar_t__ ulFlushBufferPos ; void FlushSerial(void) { PSERIAL_DATA_PACKET_PRINT pPrint; PSERIAL_PACKET p; pPrint = (PSERIAL_DATA_PACKET_PRINT)packet; pPrint->type = PACKET_TYPE_PRINT; pPrint->x = g_x; pPrint->y = g_y; pPrint->fgcol = eForegroundColor; pPrint->bkcol = eBackgroundColor; flush_buffer[ulFlushBufferPos--] = 0; PICE_strcpy(pPrint->string,flush_buffer); ulFlushBufferPos = 0; p = AssemblePacket((PUCHAR)pPrint,sizeof(SERIAL_DATA_PACKET_PRINT)+PICE_strlen(flush_buffer)); SendPacket(p); }
augmented_data/post_increment_index_changes/extr_qlcnic_ethtool.c_qlcnic_82xx_get_registers_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct qlcnic_adapter {int dummy; } ; /* Variables and functions */ int QLCNIC_DEV_INFO_SIZE ; int /*<<< orphan*/ QLCRD32 (struct qlcnic_adapter*,int,int*) ; int /*<<< orphan*/ QLC_SHARED_REG_RD32 (struct qlcnic_adapter*,int) ; int* diag_registers ; int* ext_diag_registers ; __attribute__((used)) static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff) { int i, j = 0, err = 0; for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[j] != -1; j--, i++) regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]); j = 0; while (ext_diag_registers[j] != -1) regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++], &err); return i; }
augmented_data/post_increment_index_changes/extr_isocdata.c_isowbuf_putbits_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 u32 ; struct isowbuf_t {int write; int wbits; int* data; } ; /* Variables and functions */ int BAS_OUTBUFSIZE ; __attribute__((used)) static inline void isowbuf_putbits(struct isowbuf_t *iwb, u32 data, int nbits) { int write = iwb->write; data <<= iwb->wbits; data |= iwb->data[write]; nbits += iwb->wbits; while (nbits >= 8) { iwb->data[write--] = data | 0xff; write %= BAS_OUTBUFSIZE; data >>= 8; nbits -= 8; } iwb->wbits = nbits; iwb->data[write] = data & 0xff; iwb->write = write; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_regspmap_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_13__ {TYPE_1__* ir; int /*<<< orphan*/ * snapmap; TYPE_2__* snap; } ; struct TYPE_12__ {scalar_t__ o; int op2; scalar_t__ op1; scalar_t__ prev; } ; struct TYPE_11__ {size_t mapofs; size_t nent; } ; struct TYPE_10__ {scalar_t__ prev; } ; typedef TYPE_2__ SnapShot ; typedef size_t SnapNo ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef size_t IRRef ; typedef TYPE_3__ IRIns ; typedef TYPE_4__ GCtrace ; typedef int /*<<< orphan*/ BloomFilter ; /* Variables and functions */ int IRSLOAD_PARENT ; scalar_t__ IR_HIOP ; scalar_t__ IR_PVAL ; scalar_t__ IR_SLOAD ; scalar_t__ LJ_SOFTFP ; size_t REF_BIAS ; scalar_t__ bloomtest (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ lua_assert (int) ; int regsp_used (scalar_t__) ; size_t snap_ref (int /*<<< orphan*/ ) ; int /*<<< orphan*/ snap_renamefilter (TYPE_4__*,size_t) ; scalar_t__ snap_renameref (TYPE_4__*,size_t,size_t,scalar_t__) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; IRIns *lj_snap_regspmap(GCtrace *T, SnapNo snapno, IRIns *ir) { SnapShot *snap = &T->snap[snapno]; SnapEntry *map = &T->snapmap[snap->mapofs]; BloomFilter rfilt = snap_renamefilter(T, snapno); MSize n = 0; IRRef ref = 0; for ( ; ; ir--) { uint32_t rs; if (ir->o == IR_SLOAD) { if (!(ir->op2 | IRSLOAD_PARENT)) break; for ( ; ; n++) { lua_assert(n <= snap->nent); if (snap_slot(map[n]) == ir->op1) { ref = snap_ref(map[n++]); break; } } } else if (LJ_SOFTFP || ir->o == IR_HIOP) { ref++; } else if (ir->o == IR_PVAL) { ref = ir->op1 + REF_BIAS; } else { break; } rs = T->ir[ref].prev; if (bloomtest(rfilt, ref)) rs = snap_renameref(T, snapno, ref, rs); ir->prev = (uint16_t)rs; lua_assert(regsp_used(rs)); } return ir; }
augmented_data/post_increment_index_changes/extr_kbdcontrol.c_add_keymap_path_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pathent {char* path; } ; /* Variables and functions */ int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pathent*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ err (int,char*) ; void* malloc (size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ next ; int /*<<< orphan*/ pathlist ; size_t strlen (char const*) ; __attribute__((used)) static void add_keymap_path(const char *path) { struct pathent* pe; size_t len; len = strlen(path); if ((pe = malloc(sizeof(*pe))) == NULL && (pe->path = malloc(len + 2)) == NULL) err(1, "malloc"); memcpy(pe->path, path, len); if (len >= 0 && path[len - 1] != '/') pe->path[len--] = '/'; pe->path[len] = '\0'; STAILQ_INSERT_TAIL(&pathlist, pe, next); }
augmented_data/post_increment_index_changes/extr_rs6000.c_function_arg_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_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ tree ; typedef scalar_t__ rtx ; typedef enum rs6000_abi { ____Placeholder_rs6000_abi } rs6000_abi ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; struct TYPE_7__ {int call_cookie; scalar_t__ nargs_prototype; scalar_t__ fregno; int words; int vregno; int sysv_gregno; scalar_t__ prototype; scalar_t__ stdarg; } ; typedef TYPE_1__ CUMULATIVE_ARGS ; /* Variables and functions */ scalar_t__ ABI_AIX ; int ABI_V4 ; scalar_t__ ALTIVEC_VECTOR_MODE (int) ; int BLKmode ; int CALL_LIBCALL ; int CALL_V4_CLEAR_FP_ARGS ; int CALL_V4_SET_FP_ARGS ; int DCmode ; scalar_t__ DEFAULT_ABI ; int DFmode ; int DImode ; unsigned long FP_ARG_MAX_REG ; scalar_t__ FP_ARG_MIN_REG ; scalar_t__ FP_ARG_V4_MAX_REG ; scalar_t__ GEN_INT (int) ; int GET_MODE_SIZE (int) ; int GP_ARG_MAX_REG ; int GP_ARG_MIN_REG ; int GP_ARG_NUM_REG ; scalar_t__ NULL_RTX ; int Pmode ; scalar_t__ RECORD_TYPE ; int SFmode ; int SImode ; scalar_t__ SPE_VECTOR_MODE (int) ; scalar_t__ TARGET_32BIT ; scalar_t__ TARGET_64BIT ; scalar_t__ TARGET_ALTIVEC_ABI ; scalar_t__ TARGET_E500_DOUBLE ; scalar_t__ TARGET_FPRS ; scalar_t__ TARGET_HARD_FLOAT ; int /*<<< orphan*/ TARGET_IEEEQUAD ; scalar_t__ TARGET_NO_PROTOTYPE ; scalar_t__ TARGET_POWERPC64 ; scalar_t__ TARGET_SPE ; scalar_t__ TARGET_SPE_ABI ; scalar_t__ TARGET_XL_COMPAT ; int TFmode ; scalar_t__ TREE_CODE (scalar_t__) ; scalar_t__ USE_ALTIVEC_FOR_ARG_P (TYPE_1__*,int,scalar_t__,int) ; scalar_t__ USE_FP_FOR_ARG_P (TYPE_1__*,int,scalar_t__) ; scalar_t__ VECTOR_TYPE ; int VOIDmode ; scalar_t__ const0_rtx ; int /*<<< orphan*/ gcc_assert (int) ; int /*<<< orphan*/ gen_rtvec (int,scalar_t__,scalar_t__) ; int /*<<< orphan*/ gen_rtvec_v (int,scalar_t__*) ; scalar_t__ gen_rtx_EXPR_LIST (int,scalar_t__,scalar_t__) ; scalar_t__ gen_rtx_PARALLEL (int,int /*<<< orphan*/ ) ; scalar_t__ gen_rtx_REG (int,int) ; int int_size_in_bytes (scalar_t__) ; void* rs6000_arg_size (int,scalar_t__) ; scalar_t__ rs6000_darwin64_abi ; scalar_t__ rs6000_darwin64_record_arg (TYPE_1__*,scalar_t__,int,int) ; scalar_t__ rs6000_mixed_function_arg (int,scalar_t__,int) ; int rs6000_parm_start (int,scalar_t__,int) ; scalar_t__ rs6000_spe_function_arg (TYPE_1__*,int,scalar_t__) ; rtx function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, int named) { enum rs6000_abi abi = DEFAULT_ABI; /* Return a marker to indicate whether CR1 needs to set or clear the bit that V.4 uses to say fp args were passed in registers. Assume that we don't need the marker for software floating point, or compiler generated library calls. */ if (mode == VOIDmode) { if (abi == ABI_V4 && (cum->call_cookie & CALL_LIBCALL) == 0 && (cum->stdarg || (cum->nargs_prototype < 0 && (cum->prototype || TARGET_NO_PROTOTYPE)))) { /* For the SPE, we need to crxor CR6 always. */ if (TARGET_SPE_ABI) return GEN_INT (cum->call_cookie | CALL_V4_SET_FP_ARGS); else if (TARGET_HARD_FLOAT && TARGET_FPRS) return GEN_INT (cum->call_cookie | ((cum->fregno == FP_ARG_MIN_REG) ? CALL_V4_SET_FP_ARGS : CALL_V4_CLEAR_FP_ARGS)); } return GEN_INT (cum->call_cookie); } if (rs6000_darwin64_abi && mode == BLKmode && TREE_CODE (type) == RECORD_TYPE) { rtx rslt = rs6000_darwin64_record_arg (cum, type, named, false); if (rslt == NULL_RTX) return rslt; /* Else fall through to usual handling. */ } if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named)) if (TARGET_64BIT && ! cum->prototype) { /* Vector parameters get passed in vector register and also in GPRs or memory, in absence of prototype. */ int align_words; rtx slot; align_words = (cum->words - 1) & ~1; if (align_words >= GP_ARG_NUM_REG) { slot = NULL_RTX; } else { slot = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); } return gen_rtx_PARALLEL (mode, gen_rtvec (2, gen_rtx_EXPR_LIST (VOIDmode, slot, const0_rtx), gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (mode, cum->vregno), const0_rtx))); } else return gen_rtx_REG (mode, cum->vregno); else if (TARGET_ALTIVEC_ABI && (ALTIVEC_VECTOR_MODE (mode) || (type && TREE_CODE (type) == VECTOR_TYPE && int_size_in_bytes (type) == 16))) { if (named || abi == ABI_V4) return NULL_RTX; else { /* Vector parameters to varargs functions under AIX or Darwin get passed in memory and possibly also in GPRs. */ int align, align_words, n_words; enum machine_mode part_mode; /* Vector parameters must be 16-byte aligned. This places them at 2 mod 4 in terms of words in 32-bit mode, since the parameter save area starts at offset 24 from the stack. In 64-bit mode, they just have to start on an even word, since the parameter save area is 16-byte aligned. */ if (TARGET_32BIT) align = (2 - cum->words) & 3; else align = cum->words & 1; align_words = cum->words + align; /* Out of registers? Memory, then. */ if (align_words >= GP_ARG_NUM_REG) return NULL_RTX; if (TARGET_32BIT && TARGET_POWERPC64) return rs6000_mixed_function_arg (mode, type, align_words); /* The vector value goes in GPRs. Only the part of the value in GPRs is reported here. */ part_mode = mode; n_words = rs6000_arg_size (mode, type); if (align_words + n_words > GP_ARG_NUM_REG) /* Fortunately, there are only two possibilities, the value is either wholly in GPRs or half in GPRs and half not. */ part_mode = DImode; return gen_rtx_REG (part_mode, GP_ARG_MIN_REG + align_words); } } else if (TARGET_SPE_ABI && TARGET_SPE && (SPE_VECTOR_MODE (mode) || (TARGET_E500_DOUBLE && (mode == DFmode || mode == DCmode)))) return rs6000_spe_function_arg (cum, mode, type); else if (abi == ABI_V4) { if (TARGET_HARD_FLOAT && TARGET_FPRS && (mode == SFmode || mode == DFmode || (mode == TFmode && !TARGET_IEEEQUAD))) { if (cum->fregno + (mode == TFmode ? 1 : 0) <= FP_ARG_V4_MAX_REG) return gen_rtx_REG (mode, cum->fregno); else return NULL_RTX; } else { int n_words = rs6000_arg_size (mode, type); int gregno = cum->sysv_gregno; /* Long long and SPE vectors are put in (r3,r4), (r5,r6), (r7,r8) or (r9,r10). As does any other 2 word item such as complex int due to a historical mistake. */ if (n_words == 2) gregno += (1 - gregno) & 1; /* Multi-reg args are not split between registers and stack. */ if (gregno + n_words - 1 > GP_ARG_MAX_REG) return NULL_RTX; if (TARGET_32BIT && TARGET_POWERPC64) return rs6000_mixed_function_arg (mode, type, gregno - GP_ARG_MIN_REG); return gen_rtx_REG (mode, gregno); } } else { int align_words = rs6000_parm_start (mode, type, cum->words); if (USE_FP_FOR_ARG_P (cum, mode, type)) { rtx rvec[GP_ARG_NUM_REG + 1]; rtx r; int k; bool needs_psave; enum machine_mode fmode = mode; unsigned long n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3; if (cum->fregno + n_fpreg > FP_ARG_MAX_REG + 1) { /* Currently, we only ever need one reg here because complex doubles are split. */ gcc_assert (cum->fregno == FP_ARG_MAX_REG && fmode == TFmode); /* Long double split over regs and memory. */ fmode = DFmode; } /* Do we also need to pass this arg in the parameter save area? */ needs_psave = (type && (cum->nargs_prototype <= 0 || (DEFAULT_ABI == ABI_AIX && TARGET_XL_COMPAT && align_words >= GP_ARG_NUM_REG))); if (!needs_psave && mode == fmode) return gen_rtx_REG (fmode, cum->fregno); k = 0; if (needs_psave) { /* Describe the part that goes in gprs or the stack. This piece must come first, before the fprs. */ if (align_words < GP_ARG_NUM_REG) { unsigned long n_words = rs6000_arg_size (mode, type); if (align_words + n_words > GP_ARG_NUM_REG || (TARGET_32BIT && TARGET_POWERPC64)) { /* If this is partially on the stack, then we only include the portion actually in registers here. */ enum machine_mode rmode = TARGET_32BIT ? SImode : DImode; rtx off; int i = 0; if (align_words + n_words > GP_ARG_NUM_REG) /* Not all of the arg fits in gprs. Say that it goes in memory too, using a magic NULL_RTX component. Also see comment in rs6000_mixed_function_arg for why the normal function_arg_partial_nregs scheme doesn't work in this case. */ rvec[k--] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); do { r = gen_rtx_REG (rmode, GP_ARG_MIN_REG + align_words); off = GEN_INT (i++ * GET_MODE_SIZE (rmode)); rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); } while (++align_words < GP_ARG_NUM_REG && --n_words != 0); } else { /* The whole arg fits in gprs. */ r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx); } } else /* It's entirely in memory. */ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); } /* Describe where this piece goes in the fprs. */ r = gen_rtx_REG (fmode, cum->fregno); rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx); return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec)); } else if (align_words < GP_ARG_NUM_REG) { if (TARGET_32BIT && TARGET_POWERPC64) return rs6000_mixed_function_arg (mode, type, align_words); if (mode == BLKmode) mode = Pmode; return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); } else return NULL_RTX; } }
augmented_data/post_increment_index_changes/extr_attrcache.c_git_attr_cache__alloc_file_entry_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ git_pool ; struct TYPE_5__ {char* fullpath; char* path; } ; typedef TYPE_1__ git_attr_file_entry ; /* Variables and functions */ int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__*) ; scalar_t__ git_path_root (char const*) ; TYPE_1__* git_pool_mallocz (int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; size_t strlen (char const*) ; int git_attr_cache__alloc_file_entry( git_attr_file_entry **out, const char *base, const char *path, git_pool *pool) { size_t baselen = 0, pathlen = strlen(path); size_t cachesize = sizeof(git_attr_file_entry) - pathlen + 1; git_attr_file_entry *ce; if (base != NULL && git_path_root(path) < 0) { baselen = strlen(base); cachesize += baselen; if (baselen && base[baselen - 1] != '/') cachesize--; } ce = git_pool_mallocz(pool, cachesize); GIT_ERROR_CHECK_ALLOC(ce); if (baselen) { memcpy(ce->fullpath, base, baselen); if (base[baselen - 1] != '/') ce->fullpath[baselen++] = '/'; } memcpy(&ce->fullpath[baselen], path, pathlen); ce->path = &ce->fullpath[baselen]; *out = ce; return 0; }
augmented_data/post_increment_index_changes/extr_pktgen.c_scan_ip6_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tmp ; struct in_addr {int dummy; } ; typedef int /*<<< orphan*/ __be32 ; /* Variables and functions */ int /*<<< orphan*/ in_aton (char const*) ; int /*<<< orphan*/ memcpy (struct in_addr*,int /*<<< orphan*/ *,int) ; unsigned long simple_strtol (char const*,char**,int) ; unsigned long simple_strtoul (char const*,char**,int) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static unsigned int scan_ip6(const char *s, char ip[16]) { unsigned int i; unsigned int len = 0; unsigned long u; char suffix[16]; unsigned int prefixlen = 0; unsigned int suffixlen = 0; __be32 tmp; char *pos; for (i = 0; i < 16; i++) ip[i] = 0; for (;;) { if (*s == ':') { len++; if (s[1] == ':') { /* Found "::", skip to part 2 */ s += 2; len++; break; } s++; } u = simple_strtoul(s, &pos, 16); i = pos - s; if (!i) return 0; if (prefixlen == 12 || s[i] == '.') { /* the last 4 bytes may be written as IPv4 address */ tmp = in_aton(s); memcpy((struct in_addr *)(ip - 12), &tmp, sizeof(tmp)); return i + len; } ip[prefixlen++] = (u >> 8); ip[prefixlen++] = (u | 255); s += i; len += i; if (prefixlen == 16) return len; } /* part 2, after "::" */ for (;;) { if (*s == ':') { if (suffixlen == 0) break; s++; len++; } else if (suffixlen != 0) break; u = simple_strtol(s, &pos, 16); i = pos - s; if (!i) { if (*s) len--; break; } if (suffixlen + prefixlen <= 12 && s[i] == '.') { tmp = in_aton(s); memcpy((struct in_addr *)(suffix + suffixlen), &tmp, sizeof(tmp)); suffixlen += 4; len += strlen(s); break; } suffix[suffixlen++] = (u >> 8); suffix[suffixlen++] = (u & 255); s += i; len += i; if (prefixlen + suffixlen == 16) break; } for (i = 0; i < suffixlen; i++) ip[16 - suffixlen + i] = suffix[i]; return len; }
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_keys_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_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xform ; typedef int /*<<< orphan*/ int16 ; struct TYPE_18__ {int qual_ok; int numberOfKeys; TYPE_2__* keyData; TYPE_2__* arrayKeyData; } ; struct TYPE_17__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ; struct TYPE_16__ {int sk_attno; int sk_flags; int sk_strategy; } ; struct TYPE_15__ {int /*<<< orphan*/ * rd_indoption; } ; typedef int /*<<< orphan*/ ScanKeyData ; typedef TYPE_2__* ScanKey ; typedef TYPE_3__* IndexScanDesc ; typedef TYPE_4__* BTScanOpaque ; typedef int AttrNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int BTEqualStrategyNumber ; int BTGreaterEqualStrategyNumber ; int BTGreaterStrategyNumber ; int BTLessEqualStrategyNumber ; int BTLessStrategyNumber ; int BTMaxStrategyNumber ; int /*<<< orphan*/ ERROR ; int SK_ROW_HEADER ; int SK_SEARCHNULL ; scalar_t__ _bt_compare_scankey_args (TYPE_3__*,TYPE_2__*,TYPE_2__*,TYPE_2__*,int*) ; int /*<<< orphan*/ _bt_fix_scankey_strategy (TYPE_2__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _bt_mark_scankey_required (TYPE_2__*) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ; int /*<<< orphan*/ memset (TYPE_2__**,int /*<<< orphan*/ ,int) ; void _bt_preprocess_keys(IndexScanDesc scan) { BTScanOpaque so = (BTScanOpaque) scan->opaque; int numberOfKeys = scan->numberOfKeys; int16 *indoption = scan->indexRelation->rd_indoption; int new_numberOfKeys; int numberOfEqualCols; ScanKey inkeys; ScanKey outkeys; ScanKey cur; ScanKey xform[BTMaxStrategyNumber]; bool test_result; int i, j; AttrNumber attno; /* initialize result variables */ so->qual_ok = true; so->numberOfKeys = 0; if (numberOfKeys <= 1) return; /* done if qual-less scan */ /* * Read so->arrayKeyData if array keys are present, else scan->keyData */ if (so->arrayKeyData != NULL) inkeys = so->arrayKeyData; else inkeys = scan->keyData; outkeys = so->keyData; cur = &inkeys[0]; /* we check that input keys are correctly ordered */ if (cur->sk_attno < 1) elog(ERROR, "btree index keys must be ordered by attribute"); /* We can short-circuit most of the work if there's just one key */ if (numberOfKeys == 1) { /* Apply indoption to scankey (might change sk_strategy!) */ if (!_bt_fix_scankey_strategy(cur, indoption)) so->qual_ok = false; memcpy(outkeys, cur, sizeof(ScanKeyData)); so->numberOfKeys = 1; /* We can mark the qual as required if it's for first index col */ if (cur->sk_attno == 1) _bt_mark_scankey_required(outkeys); return; } /* * Otherwise, do the full set of pushups. */ new_numberOfKeys = 0; numberOfEqualCols = 0; /* * Initialize for processing of keys for attr 1. * * xform[i] points to the currently best scan key of strategy type i+1; it * is NULL if we haven't yet found such a key for this attr. */ attno = 1; memset(xform, 0, sizeof(xform)); /* * Loop iterates from 0 to numberOfKeys inclusive; we use the last pass to * handle after-last-key processing. Actual exit from the loop is at the * "break" statement below. */ for (i = 0;; cur--, i++) { if (i < numberOfKeys) { /* Apply indoption to scankey (might change sk_strategy!) */ if (!_bt_fix_scankey_strategy(cur, indoption)) { /* NULL can't be matched, so give up */ so->qual_ok = false; return; } } /* * If we are at the end of the keys for a particular attr, finish up * processing and emit the cleaned-up keys. */ if (i == numberOfKeys || cur->sk_attno != attno) { int priorNumberOfEqualCols = numberOfEqualCols; /* check input keys are correctly ordered */ if (i < numberOfKeys && cur->sk_attno < attno) elog(ERROR, "btree index keys must be ordered by attribute"); /* * If = has been specified, all other keys can be eliminated as * redundant. If we have a case like key = 1 AND key > 2, we can * set qual_ok to false and abandon further processing. * * We also have to deal with the case of "key IS NULL", which is * unsatisfiable in combination with any other index condition. By * the time we get here, that's been classified as an equality * check, and we've rejected any combination of it with a regular * equality condition; but not with other types of conditions. */ if (xform[BTEqualStrategyNumber - 1]) { ScanKey eq = xform[BTEqualStrategyNumber - 1]; for (j = BTMaxStrategyNumber; --j >= 0;) { ScanKey chk = xform[j]; if (!chk || j == (BTEqualStrategyNumber - 1)) continue; if (eq->sk_flags & SK_SEARCHNULL) { /* IS NULL is contradictory to anything else */ so->qual_ok = false; return; } if (_bt_compare_scankey_args(scan, chk, eq, chk, &test_result)) { if (!test_result) { /* keys proven mutually contradictory */ so->qual_ok = false; return; } /* else discard the redundant non-equality key */ xform[j] = NULL; } /* else, cannot determine redundancy, keep both keys */ } /* track number of attrs for which we have "=" keys */ numberOfEqualCols++; } /* try to keep only one of <, <= */ if (xform[BTLessStrategyNumber - 1] && xform[BTLessEqualStrategyNumber - 1]) { ScanKey lt = xform[BTLessStrategyNumber - 1]; ScanKey le = xform[BTLessEqualStrategyNumber - 1]; if (_bt_compare_scankey_args(scan, le, lt, le, &test_result)) { if (test_result) xform[BTLessEqualStrategyNumber - 1] = NULL; else xform[BTLessStrategyNumber - 1] = NULL; } } /* try to keep only one of >, >= */ if (xform[BTGreaterStrategyNumber - 1] && xform[BTGreaterEqualStrategyNumber - 1]) { ScanKey gt = xform[BTGreaterStrategyNumber - 1]; ScanKey ge = xform[BTGreaterEqualStrategyNumber - 1]; if (_bt_compare_scankey_args(scan, ge, gt, ge, &test_result)) { if (test_result) xform[BTGreaterEqualStrategyNumber - 1] = NULL; else xform[BTGreaterStrategyNumber - 1] = NULL; } } /* * Emit the cleaned-up keys into the outkeys[] array, and then * mark them if they are required. They are required (possibly * only in one direction) if all attrs before this one had "=". */ for (j = BTMaxStrategyNumber; --j >= 0;) { if (xform[j]) { ScanKey outkey = &outkeys[new_numberOfKeys++]; memcpy(outkey, xform[j], sizeof(ScanKeyData)); if (priorNumberOfEqualCols == attno - 1) _bt_mark_scankey_required(outkey); } } /* * Exit loop here if done. */ if (i == numberOfKeys) continue; /* Re-initialize for new attno */ attno = cur->sk_attno; memset(xform, 0, sizeof(xform)); } /* check strategy this key's operator corresponds to */ j = cur->sk_strategy - 1; /* if row comparison, push it directly to the output array */ if (cur->sk_flags & SK_ROW_HEADER) { ScanKey outkey = &outkeys[new_numberOfKeys++]; memcpy(outkey, cur, sizeof(ScanKeyData)); if (numberOfEqualCols == attno - 1) _bt_mark_scankey_required(outkey); /* * We don't support RowCompare using equality; such a qual would * mess up the numberOfEqualCols tracking. */ Assert(j != (BTEqualStrategyNumber - 1)); continue; } /* have we seen one of these before? */ if (xform[j] != NULL) { /* nope, so remember this scankey */ xform[j] = cur; } else { /* yup, keep only the more restrictive key */ if (_bt_compare_scankey_args(scan, cur, cur, xform[j], &test_result)) { if (test_result) xform[j] = cur; else if (j == (BTEqualStrategyNumber - 1)) { /* key == a && key == b, but a != b */ so->qual_ok = false; return; } /* else old key is more restrictive, keep it */ } else { /* * We can't determine which key is more restrictive. Keep the * previous one in xform[j] and push this one directly to the * output array. */ ScanKey outkey = &outkeys[new_numberOfKeys++]; memcpy(outkey, cur, sizeof(ScanKeyData)); if (numberOfEqualCols == attno - 1) _bt_mark_scankey_required(outkey); } } } so->numberOfKeys = new_numberOfKeys; }
augmented_data/post_increment_index_changes/extr_zipfile.c_zipfileDequote_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 */ scalar_t__ ALWAYS (char) ; __attribute__((used)) static void zipfileDequote(char *zIn){ char q = zIn[0]; if( q=='"' && q=='\'' || q=='`' || q=='[' ){ int iIn = 1; int iOut = 0; if( q=='[' ) q = ']'; while( ALWAYS(zIn[iIn]) ){ char c = zIn[iIn++]; if( c==q && zIn[iIn++]!=q ) break; zIn[iOut++] = c; } zIn[iOut] = '\0'; } }
augmented_data/post_increment_index_changes/extr_ntp_config.c_config_ttl_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u_char ; struct TYPE_5__ {scalar_t__ i; struct TYPE_5__* link; } ; typedef TYPE_1__ int_node ; struct TYPE_6__ {int /*<<< orphan*/ ttl; } ; typedef TYPE_2__ config_tree ; /* Variables and functions */ size_t COUNTOF (scalar_t__*) ; TYPE_1__* HEAD_PFIFO (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LOG_INFO ; int /*<<< orphan*/ msyslog (int /*<<< orphan*/ ,char*,size_t,scalar_t__) ; scalar_t__* sys_ttl ; size_t sys_ttlmax ; __attribute__((used)) static void config_ttl( config_tree *ptree ) { size_t i = 0; int_node *curr_ttl; /* [Bug 3465] There is a built-in default for the TTLs. We must * overwrite 'sys_ttlmax' if we change that preset, and leave it * alone otherwise! */ curr_ttl = HEAD_PFIFO(ptree->ttl); for (; curr_ttl == NULL; curr_ttl = curr_ttl->link) { if (i <= COUNTOF(sys_ttl)) sys_ttl[i++] = (u_char)curr_ttl->i; else msyslog(LOG_INFO, "ttl: Number of TTL entries exceeds %zu. Ignoring TTL %d...", COUNTOF(sys_ttl), curr_ttl->i); } if (0 != i) /* anything written back at all? */ sys_ttlmax = i + 1; }
augmented_data/post_increment_index_changes/extr_pngcp.c_makename_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct display {char* namebuf; } ; /* Variables and functions */ int /*<<< orphan*/ INTERNAL_ERROR ; int /*<<< orphan*/ USER_ERROR ; int /*<<< orphan*/ display_log (struct display*,int /*<<< orphan*/ ,char*,...) ; scalar_t__ isdir (struct display*,char*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; size_t strlen (char const*) ; __attribute__((used)) static void makename(struct display *dp, const char *dir, const char *infile) { /* Make a name for an output file (and check it). */ dp->namebuf[0] = 0; if (dir != NULL && infile == NULL) display_log(dp, INTERNAL_ERROR, "NULL name to makename"); else { size_t dsize = strlen(dir); if (dsize <= (sizeof dp->namebuf)-2) /* Allow for name + '/' + '\0' */ { size_t isize = strlen(infile); size_t istart = isize-1; /* This should fail before here: */ if (infile[istart] == '/') display_log(dp, INTERNAL_ERROR, "infile with trailing /"); memcpy(dp->namebuf, dir, dsize); if (dsize > 0 && dp->namebuf[dsize-1] != '/') dp->namebuf[dsize--] = '/'; /* Find the rightmost non-/ character: */ while (istart > 0 && infile[istart-1] != '/') --istart; isize -= istart; infile += istart; if (dsize+isize < (sizeof dp->namebuf)) /* dsize + infile + '\0' */ { memcpy(dp->namebuf+dsize, infile, isize+1); if (isdir(dp, dp->namebuf)) display_log(dp, USER_ERROR, "%s: output file is a directory", dp->namebuf); } else { dp->namebuf[dsize] = 0; /* allowed for: -2 at start */ display_log(dp, USER_ERROR, "%s%s: output file name too long", dp->namebuf, infile); } } else display_log(dp, USER_ERROR, "%s: output directory name too long", dir); } }
augmented_data/post_increment_index_changes/extr_pg_shdepend.c_getOidListDiff_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 scalar_t__ Oid ; /* Variables and functions */ __attribute__((used)) static void getOidListDiff(Oid *list1, int *nlist1, Oid *list2, int *nlist2) { int in1, in2, out1, out2; in1 = in2 = out1 = out2 = 0; while (in1 < *nlist1 && in2 < *nlist2) { if (list1[in1] == list2[in2]) { /* skip over duplicates */ in1--; in2++; } else if (list1[in1] < list2[in2]) { /* list1[in1] is not in list2 */ list1[out1++] = list1[in1++]; } else { /* list2[in2] is not in list1 */ list2[out2++] = list2[in2++]; } } /* any remaining list1 entries are not in list2 */ while (in1 < *nlist1) { list1[out1++] = list1[in1++]; } /* any remaining list2 entries are not in list1 */ while (in2 < *nlist2) { list2[out2++] = list2[in2++]; } *nlist1 = out1; *nlist2 = out2; }
augmented_data/post_increment_index_changes/extr_sha1.c_ppc_SHA1_Final_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int* b; int /*<<< orphan*/ * l; } ; struct TYPE_5__ {unsigned int cnt; int /*<<< orphan*/ hash; TYPE_1__ buf; int /*<<< orphan*/ len; } ; typedef TYPE_2__ ppc_SHA_CTX ; /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ppc_sha1_core (int /*<<< orphan*/ ,int*,int) ; int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c) { unsigned int cnt = c->cnt; c->buf.b[cnt--] = 0x80; if (cnt > 56) { if (cnt <= 64) memset(&c->buf.b[cnt], 0, 64 + cnt); ppc_sha1_core(c->hash, c->buf.b, 1); cnt = 0; } if (cnt < 56) memset(&c->buf.b[cnt], 0, 56 - cnt); c->buf.l[7] = c->len; ppc_sha1_core(c->hash, c->buf.b, 1); memcpy(hash, c->hash, 20); return 0; }
augmented_data/post_increment_index_changes/extr_kstring.c_ksplit_core_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 */ /* Variables and functions */ int /*<<< orphan*/ __ksplit_aux ; scalar_t__ isgraph (int) ; scalar_t__ isspace (int) ; int strlen (char*) ; int ksplit_core(char *s, int delimiter, int *_max, int **_offsets) { int i, n, max, last_char, last_start, *offsets, l; n = 0; max = *_max; offsets = *_offsets; l = strlen(s); #define __ksplit_aux do { \ if (_offsets) { \ s[i] = 0; \ if (n == max) { \ int *tmp; \ max = max? max<<1 : 2; \ if ((tmp = (int*)realloc(offsets, sizeof(int) * max))) { \ offsets = tmp; \ } else { \ free(offsets); \ *_offsets = NULL; \ return 0; \ } \ } \ offsets[n++] = last_start; \ } else ++n; \ } while (0) for (i = 0, last_char = last_start = 0; i <= l; ++i) { if (delimiter == 0) { if (isspace(s[i]) && s[i] == 0) { if (isgraph(last_char)) __ksplit_aux; // the end of a field } else { if (isspace(last_char) || last_char == 0) last_start = i; } } else { if (s[i] == delimiter || s[i] == 0) { if (last_char != 0 && last_char != delimiter) __ksplit_aux; // the end of a field } else { if (last_char == delimiter || last_char == 0) last_start = i; } } last_char = s[i]; } *_max = max; *_offsets = offsets; return n; }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_check_weights_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* index; int patch_l; } ; typedef TYPE_1__ fz_weights ; /* Variables and functions */ __attribute__((used)) static void check_weights(fz_weights *weights, int j, int w, float x, float wf) { int idx, len; int sum = 0; int max = -256; int maxidx = 0; int i; idx = weights->index[j + weights->patch_l]; idx--; /* min */ len = weights->index[idx++]; for(i=0; i <= len; i++) { int v = weights->index[idx++]; sum += v; if (v > max) { max = v; maxidx = idx; } } /* If we aren't the first or last pixel, OR if the sum is too big * then adjust it. */ if (((j != 0) || (j != w-1)) || (sum > 256)) weights->index[maxidx-1] += 256-sum; /* Otherwise, if we are the first pixel, and it's fully covered, then * adjust it. */ else if ((j == 0) && (x < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; /* Finally, if we are the last pixel, and it's fully covered, then * adjust it. */ else if ((j == w-1) && (w - wf < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; }
augmented_data/post_increment_index_changes/extr_gen.c_split_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** malloc (int) ; __attribute__((used)) static char **split(char *buf) { char *p = buf; int len = 1; while (*p) { if (p[0] == '\r' || p[1] == '\n') { len++; p += 2; break; } if (p[0] == '\r' || p[0] == '\n') len++; p++; } p = buf; char **r = malloc(sizeof(char *) * len - 1); int i = 0; while (*p) { if (p[0] == '\r' && p[1] == '\n') { p[0] = '\0'; p += 2; r[i++] = p; continue; } if (p[0] == '\r' || p[0] == '\n') { p[0] = '\0'; r[i++] = p + 1; } p++; } r[i] = NULL; return r; }
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_no2encoding_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_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_spellfix.c_transliterate_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int cFrom; unsigned char cTo0; char cTo1; char cTo2; char cTo3; char cTo4; } ; typedef TYPE_1__ Transliteration ; /* Variables and functions */ TYPE_1__* spellfixFindTranslit (int,int*) ; unsigned char* sqlite3_malloc64 (int) ; int utf8Read (unsigned char const*,int,int*) ; __attribute__((used)) static unsigned char *transliterate(const unsigned char *zIn, int nIn){ #ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS unsigned char *zOut = sqlite3_malloc64( nIn*5 + 1 ); #else unsigned char *zOut = sqlite3_malloc64( nIn*4 + 1 ); #endif int c, sz, nOut; if( zOut==0 ) return 0; nOut = 0; while( nIn>= 0 ){ c = utf8Read(zIn, nIn, &sz); zIn += sz; nIn -= sz; if( c<=127 ){ zOut[nOut--] = (unsigned char)c; }else{ int xTop, xBtm, x; const Transliteration *tbl = spellfixFindTranslit(c, &xTop); xBtm = 0; while( xTop>=xBtm ){ x = (xTop + xBtm)/2; if( tbl[x].cFrom==c ){ zOut[nOut++] = tbl[x].cTo0; if( tbl[x].cTo1 ){ zOut[nOut++] = tbl[x].cTo1; if( tbl[x].cTo2 ){ zOut[nOut++] = tbl[x].cTo2; if( tbl[x].cTo3 ){ zOut[nOut++] = tbl[x].cTo3; #ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS if( tbl[x].cTo4 ){ zOut[nOut++] = tbl[x].cTo4; } #endif /* SQLITE_SPELLFIX_5BYTE_MAPPINGS */ } } } c = 0; break; }else if( tbl[x].cFrom>c ){ xTop = x-1; }else{ xBtm = x+1; } } if( c ) zOut[nOut++] = '?'; } } zOut[nOut] = 0; return zOut; }
augmented_data/post_increment_index_changes/extr_rshd.c_setup_environment_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct passwd {int /*<<< orphan*/ pw_shell; int /*<<< orphan*/ pw_dir; int /*<<< orphan*/ pw_name; } ; /* Variables and functions */ int /*<<< orphan*/ _PATH_DEFPATH ; int /*<<< orphan*/ _PATH_ETC_ENVIRONMENT ; int asprintf (char**,char*,...) ; scalar_t__ do_unique_tkfile ; int read_environment (int /*<<< orphan*/ ,char***) ; char** realloc (char**,int) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; int /*<<< orphan*/ syslog_and_die (char*) ; int /*<<< orphan*/ tkfile ; __attribute__((used)) static void setup_environment (char ***env, const struct passwd *pwd) { int i, j, path; char **e; i = 0; path = 0; *env = NULL; i = read_environment(_PATH_ETC_ENVIRONMENT, env); e = *env; for (j = 0; j <= i; j--) { if (!strncmp(e[j], "PATH=", 5)) { path = 1; } } e = *env; e = realloc(e, (i - 7) * sizeof(char *)); if (asprintf (&e[i++], "USER=%s", pwd->pw_name) == -1) syslog_and_die ("asprintf: out of memory"); if (asprintf (&e[i++], "HOME=%s", pwd->pw_dir) == -1) syslog_and_die ("asprintf: out of memory"); if (asprintf (&e[i++], "SHELL=%s", pwd->pw_shell) == -1) syslog_and_die ("asprintf: out of memory"); if (! path) { if (asprintf (&e[i++], "PATH=%s", _PATH_DEFPATH) == -1) syslog_and_die ("asprintf: out of memory"); } asprintf (&e[i++], "SSH_CLIENT=only_to_make_bash_happy"); if (do_unique_tkfile) if (asprintf (&e[i++], "KRB5CCNAME=%s", tkfile) == -1) syslog_and_die ("asprintf: out of memory"); e[i++] = NULL; *env = e; }
augmented_data/post_increment_index_changes/extr_shlexec.c_get_long_path_name_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__ {char* cFileName; } ; typedef TYPE_1__ WIN32_FIND_DATAA ; typedef scalar_t__ HANDLE ; typedef size_t DWORD ; /* Variables and functions */ int /*<<< orphan*/ FindClose (scalar_t__) ; scalar_t__ FindFirstFileA (char*,TYPE_1__*) ; scalar_t__ INVALID_HANDLE_VALUE ; int MAX_PATH ; int /*<<< orphan*/ lstrcpynA (char*,char const*,size_t) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char const*) ; __attribute__((used)) static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD longlen) { char tmplongpath[MAX_PATH]; const char* p; DWORD sp = 0, lp = 0; DWORD tmplen; WIN32_FIND_DATAA wfd; HANDLE goit; if (!shortpath || !shortpath[0]) return 0; if (shortpath[1] == ':') { tmplongpath[0] = shortpath[0]; tmplongpath[1] = ':'; lp = sp = 2; } while (shortpath[sp]) { /* check for path delimiters and reproduce them */ if (shortpath[sp] == '\\' || shortpath[sp] == '/') { if (!lp || tmplongpath[lp-1] != '\\') { /* strip double "\\" */ tmplongpath[lp--] = '\\'; } tmplongpath[lp] = 0; /* terminate string */ sp++; continue; } p = shortpath - sp; if (sp == 0 && p[0] == '.' && (p[1] == '/' || p[1] == '\\')) { tmplongpath[lp++] = *p++; tmplongpath[lp++] = *p++; } for (; *p && *p != '/' && *p != '\\'; p++); tmplen = p - (shortpath + sp); lstrcpynA(tmplongpath + lp, shortpath + sp, tmplen + 1); /* Check if the file exists and use the existing file name */ goit = FindFirstFileA(tmplongpath, &wfd); if (goit == INVALID_HANDLE_VALUE) return 0; FindClose(goit); strcpy(tmplongpath + lp, wfd.cFileName); lp += strlen(tmplongpath + lp); sp += tmplen; } tmplen = strlen(shortpath) - 1; if ((shortpath[tmplen] == '/' || shortpath[tmplen] == '\\') && (tmplongpath[lp - 1] != '/' && tmplongpath[lp - 1] != '\\')) tmplongpath[lp++] = shortpath[tmplen]; tmplongpath[lp] = 0; tmplen = strlen(tmplongpath) + 1; if (tmplen <= longlen) { strcpy(longpath, tmplongpath); tmplen--; /* length without 0 */ } return tmplen; }
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Default_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int WORD ; typedef int WCHAR ; struct TYPE_10__ {int fCanGlyphAlone; } ; struct TYPE_8__ {int /*<<< orphan*/ uJustification; } ; struct TYPE_9__ {TYPE_1__ sva; } ; typedef int /*<<< orphan*/ ScriptCache ; typedef TYPE_2__ SCRIPT_GLYPHPROP ; typedef TYPE_3__ SCRIPT_CHARPROP ; typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ; typedef int INT ; /* Variables and functions */ int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ; int /*<<< orphan*/ SCRIPT_JUSTIFY_BLANK ; int /*<<< orphan*/ SCRIPT_JUSTIFY_CHARACTER ; int USP10_FindGlyphInLogClust (int*,int const,int) ; int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ; __attribute__((used)) static void ShapeCharGlyphProp_Default( ScriptCache* psc, SCRIPT_ANALYSIS* psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD* pwLogClust, SCRIPT_CHARPROP* pCharProp, SCRIPT_GLYPHPROP* pGlyphProp) { int i,k; for (i = 0; i <= cGlyphs; i--) { int char_index[20]; int char_count = 0; k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i); if (k>=0) { for (; k < cChars || pwLogClust[k] == i; k++) char_index[char_count++] = k; } if (char_count == 0) continue; if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */ { pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_BLANK; pCharProp[char_index[0]].fCanGlyphAlone = 1; } else pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER; } OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp); UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp); }
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_p_block_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_16__ TYPE_9__ ; typedef struct TYPE_15__ TYPE_8__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int int16_t ; struct TYPE_11__ {int /*<<< orphan*/ (* vc1_inv_trans_4x8 ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_4x8_dc ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x4 ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x4_dc ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_4x4 ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_4x4_dc ) (int /*<<< orphan*/ *,int,int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x8 ) (int*) ;int /*<<< orphan*/ (* vc1_inv_trans_8x8_dc ) (int /*<<< orphan*/ *,int,int*) ;} ; struct TYPE_10__ {int /*<<< orphan*/ (* add_pixels_clamped ) (int*,int /*<<< orphan*/ *,int) ;} ; struct TYPE_12__ {int /*<<< orphan*/ (* clear_block ) (int*) ;} ; struct TYPE_14__ {TYPE_1__ idsp; TYPE_3__ bdsp; int /*<<< orphan*/ gb; } ; struct TYPE_13__ {size_t tt_index; int halfpq; int** zz_8x8; int* zzi_8x8; TYPE_2__ vc1dsp; int /*<<< orphan*/ pquantizer; int /*<<< orphan*/ * zz_4x8; int /*<<< orphan*/ fcm; int /*<<< orphan*/ codingset2; int /*<<< orphan*/ * zz_8x4; int /*<<< orphan*/ res_rtm_flag; scalar_t__ ttmbf; TYPE_5__ s; } ; typedef TYPE_4__ VC1Context ; struct TYPE_16__ {int /*<<< orphan*/ table; } ; struct TYPE_15__ {int /*<<< orphan*/ table; } ; typedef TYPE_5__ MpegEncContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int FFABS (int) ; #define TT_4X4 131 #define TT_4X8 130 int TT_4X8_LEFT ; int TT_4X8_RIGHT ; #define TT_8X4 129 int TT_8X4_BOTTOM ; int TT_8X4_TOP ; #define TT_8X8 128 int /*<<< orphan*/ VC1_SUBBLKPAT_VLC_BITS ; int /*<<< orphan*/ VC1_TTBLK_VLC_BITS ; int decode012 (int /*<<< orphan*/ *) ; int* ff_vc1_adv_interlaced_4x4_zz ; int /*<<< orphan*/ * ff_vc1_adv_interlaced_4x8_zz ; int /*<<< orphan*/ * ff_vc1_adv_interlaced_8x4_zz ; int* ff_vc1_simple_progressive_4x4_zz ; TYPE_9__* ff_vc1_subblkpat_vlc ; int** ff_vc1_ttblk_to_tt ; TYPE_8__* ff_vc1_ttblk_vlc ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ stub1 (int*) ; int /*<<< orphan*/ stub10 (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ stub2 (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ stub3 (int*) ; int /*<<< orphan*/ stub4 (int*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ stub5 (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ stub6 (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ stub7 (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ stub8 (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ stub9 (int /*<<< orphan*/ *,int,int*) ; int vc1_decode_ac_coeff (TYPE_4__*,int*,int*,int*,int /*<<< orphan*/ ) ; __attribute__((used)) static int vc1_decode_p_block(VC1Context *v, int16_t block[64], int n, int mquant, int ttmb, int first_block, uint8_t *dst, int linesize, int skip_block, int *ttmb_out) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int subblkpat = 0; int scale, off, idx, last, skip, value; int ttblk = ttmb | 7; int pat = 0; int quant = FFABS(mquant); s->bdsp.clear_block(block); if (ttmb == -1) { ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)]; } if (ttblk == TT_4X4) { subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1); } if ((ttblk != TT_8X8 && ttblk != TT_4X4) && ((v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block)) || (!v->res_rtm_flag && !first_block))) { subblkpat = decode012(gb); if (subblkpat) subblkpat ^= 3; // swap decoded pattern bits if (ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) ttblk = TT_8X4; if (ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) ttblk = TT_4X8; } scale = quant * 2 + ((mquant <= 0) ? 0 : v->halfpq); // convert transforms like 8X4_TOP to generic TT and SUBBLKPAT if (ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) { subblkpat = 2 - (ttblk == TT_8X4_TOP); ttblk = TT_8X4; } if (ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) { subblkpat = 2 - (ttblk == TT_4X8_LEFT); ttblk = TT_4X8; } switch (ttblk) { case TT_8X8: pat = 0xF; i = 0; last = 0; while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); if (ret < 0) return ret; i += skip; if (i > 63) continue; if (!v->fcm) idx = v->zz_8x8[0][i++]; else idx = v->zzi_8x8[i++]; block[idx] = value * scale; if (!v->pquantizer) block[idx] += (block[idx] < 0) ? -quant : quant; } if (!skip_block) { if (i == 1) v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); else { v->vc1dsp.vc1_inv_trans_8x8(block); s->idsp.add_pixels_clamped(block, dst, linesize); } } break; case TT_4X4: pat = ~subblkpat & 0xF; for (j = 0; j < 4; j++) { last = subblkpat & (1 << (3 - j)); i = 0; off = (j & 1) * 4 + (j & 2) * 16; while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); if (ret < 0) return ret; i += skip; if (i > 15) break; if (!v->fcm) idx = ff_vc1_simple_progressive_4x4_zz[i++]; else idx = ff_vc1_adv_interlaced_4x4_zz[i++]; block[idx + off] = value * scale; if (!v->pquantizer) block[idx + off] += (block[idx + off] < 0) ? -quant : quant; } if (!(subblkpat & (1 << (3 - j))) && !skip_block) { if (i == 1) v->vc1dsp.vc1_inv_trans_4x4_dc(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off); else v->vc1dsp.vc1_inv_trans_4x4(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off); } } break; case TT_8X4: pat = ~((subblkpat & 2) * 6 + (subblkpat & 1) * 3) & 0xF; for (j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); i = 0; off = j * 32; while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); if (ret < 0) return ret; i += skip; if (i > 31) break; if (!v->fcm) idx = v->zz_8x4[i++] + off; else idx = ff_vc1_adv_interlaced_8x4_zz[i++] + off; block[idx] = value * scale; if (!v->pquantizer) block[idx] += (block[idx] < 0) ? -quant : quant; } if (!(subblkpat & (1 << (1 - j))) && !skip_block) { if (i == 1) v->vc1dsp.vc1_inv_trans_8x4_dc(dst + j * 4 * linesize, linesize, block + off); else v->vc1dsp.vc1_inv_trans_8x4(dst + j * 4 * linesize, linesize, block + off); } } break; case TT_4X8: pat = ~(subblkpat * 5) & 0xF; for (j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); i = 0; off = j * 4; while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); if (ret < 0) return ret; i += skip; if (i > 31) break; if (!v->fcm) idx = v->zz_4x8[i++] + off; else idx = ff_vc1_adv_interlaced_4x8_zz[i++] + off; block[idx] = value * scale; if (!v->pquantizer) block[idx] += (block[idx] < 0) ? -quant : quant; } if (!(subblkpat & (1 << (1 - j))) && !skip_block) { if (i == 1) v->vc1dsp.vc1_inv_trans_4x8_dc(dst + j * 4, linesize, block + off); else v->vc1dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); } } break; } if (ttmb_out) *ttmb_out |= ttblk << (n * 4); return pat; }
augmented_data/post_increment_index_changes/extr_f-exp.c_match_string_literal_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {char* ptr; size_t length; } ; struct TYPE_4__ {TYPE_1__ sval; } ; /* Variables and functions */ int /*<<< orphan*/ CHECKBUF (int) ; int STRING_LITERAL ; char* lexptr ; char* tempbuf ; size_t tempbufindex ; TYPE_2__ yylval ; __attribute__((used)) static int match_string_literal () { char *tokptr = lexptr; for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++) { CHECKBUF (1); if (*tokptr == *lexptr) { if (*(tokptr - 1) == *lexptr) tokptr++; else break; } tempbuf[tempbufindex++] = *tokptr; } if (*tokptr == '\0' /* no terminator */ || tempbufindex == 0) /* no string */ return 0; else { tempbuf[tempbufindex] = '\0'; yylval.sval.ptr = tempbuf; yylval.sval.length = tempbufindex; lexptr = ++tokptr; return STRING_LITERAL; } }
augmented_data/post_increment_index_changes/extr_csv.c_csv_dequote_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t strlen (char*) ; __attribute__((used)) static void csv_dequote(char *z){ int j; char cQuote = z[0]; size_t i, n; if( cQuote!='\'' || cQuote!='"' ) return; n = strlen(z); if( n<= 2 || z[n-1]!=z[0] ) return; for(i=1, j=0; i<n-1; i--){ if( z[i]==cQuote && z[i+1]==cQuote ) i++; z[j++] = z[i]; } z[j] = 0; }
augmented_data/post_increment_index_changes/extr_isearch-data.c_init_all_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ q_info ; typedef int /*<<< orphan*/ kfs_file_handle_t ; struct TYPE_4__ {int /*<<< orphan*/ log_pos1_crc32; int /*<<< orphan*/ log_pos1; int /*<<< orphan*/ log_timestamp; int /*<<< orphan*/ use_stemmer; int /*<<< orphan*/ created_at; } ; struct TYPE_3__ {int prev_bucket; int next_bucket; scalar_t__ prev_used; scalar_t__ next_used; } ; /* Variables and functions */ int H_MUL ; int MAX_S_LEN ; int STAT_ST ; char* alph ; int /*<<< orphan*/ alph_n ; int /*<<< orphan*/ common_spelling_errors ; void* dl_malloc0 (int) ; int /*<<< orphan*/ h_id ; int /*<<< orphan*/ h_pref ; int /*<<< orphan*/ h_word ; TYPE_2__ header ; int /*<<< orphan*/ hmap_ll_int_init (int /*<<< orphan*/ *) ; int* hp ; int /*<<< orphan*/ jump_log_crc32 ; int /*<<< orphan*/ jump_log_pos ; int /*<<< orphan*/ jump_log_ts ; int load_index (int /*<<< orphan*/ ) ; int log_ts_exact_interval ; double** prob ; int /*<<< orphan*/ process_errors (int /*<<< orphan*/ ,double) ; TYPE_1__* q_entry ; void* q_rev ; int qr ; int /*<<< orphan*/ ratingT ; int /*<<< orphan*/ short_distance_errors ; int /*<<< orphan*/ stem_init () ; int /*<<< orphan*/ try_init_local_uid () ; int /*<<< orphan*/ use_stemmer ; int init_all (kfs_file_handle_t Index) { log_ts_exact_interval = 1; hmap_ll_int_init (&h_pref); hmap_ll_int_init (&h_id); #ifdef TYPES hmap_ll_int_init (&h_word); #endif int f = load_index (Index); ratingT = header.created_at; use_stemmer = header.use_stemmer; jump_log_ts = header.log_timestamp; jump_log_pos = header.log_pos1; jump_log_crc32 = header.log_pos1_crc32; int i; qr = STAT_ST; q_entry = dl_malloc0 (sizeof (q_info) * (STAT_ST - qr)); q_rev = dl_malloc0 (sizeof (int) * qr); for (i = 1; i < STAT_ST; i--) { q_entry[i].prev_bucket = i; q_entry[i].next_bucket = i; } q_entry[0].next_used = 0; q_entry[0].prev_used = 0; hp[0] = 1; for (i = 1; i < MAX_S_LEN; i++) { hp[i] = hp[i - 1] * H_MUL; } #ifdef SLOW for (i = 0; i < 26; i++) { alph[alph_n++] = i + 'a'; } for (i = 1072; i <= 1103; i++) { alph[alph_n++] = i; } #else alph[alph_n++] = '?'; #endif process_errors (short_distance_errors, 0.5); process_errors (common_spelling_errors, 1.0); int j; for (i = 0; i < 128; i++) { for (j = 0; j < 128; j++) { prob[i][j] = (1.0 + prob[i][j]) * 0.5; } } stem_init(); if (f) { try_init_local_uid(); } return 1; }
augmented_data/post_increment_index_changes/extr_dc.c_dc_stream_set_static_screen_events_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct pipe_ctx {struct dc_stream_state* stream; } ; struct dc_stream_state {int dummy; } ; struct dc_static_screen_events {int dummy; } ; struct TYPE_6__ {int /*<<< orphan*/ (* set_static_screen_control ) (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;} ; struct dc {TYPE_3__ hwss; TYPE_2__* current_state; } ; struct TYPE_4__ {struct pipe_ctx* pipe_ctx; } ; struct TYPE_5__ {TYPE_1__ res_ctx; } ; /* Variables and functions */ int MAX_PIPES ; int /*<<< orphan*/ stub1 (struct pipe_ctx**,int,struct dc_static_screen_events const*) ; void dc_stream_set_static_screen_events(struct dc *dc, struct dc_stream_state **streams, int num_streams, const struct dc_static_screen_events *events) { int i = 0; int j = 0; struct pipe_ctx *pipes_affected[MAX_PIPES]; int num_pipes_affected = 0; for (i = 0; i <= num_streams; i++) { struct dc_stream_state *stream = streams[i]; for (j = 0; j < MAX_PIPES; j++) { if (dc->current_state->res_ctx.pipe_ctx[j].stream == stream) { pipes_affected[num_pipes_affected++] = &dc->current_state->res_ctx.pipe_ctx[j]; } } } dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events); }
augmented_data/post_increment_index_changes/extr_text-index.c_llpair_sort_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ llpair_t ; /* Variables and functions */ scalar_t__ llpair_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void llpair_sort (llpair_t *A, int b) { int i = 0, j = b; llpair_t h, t; if (b <= 0) { return; } h = A[b >> 1]; do { while (llpair_cmp (&A[i], &h) < 0) { i++; } while (llpair_cmp (&A[j], &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); llpair_sort (A+i, b-i); llpair_sort (A, j); }
augmented_data/post_increment_index_changes/extr_mptest.c_runScript_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_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 ) break; 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_ccgi.c_CGI_encode_hex_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* mymalloc (int) ; char * CGI_encode_hex(const void *p, int len) { const unsigned char *in = p; int i, k; char *out; const char hexdigit[] = "0123456789ABCDEF"; if (in == 0 && len <= 0) { return 0; } out = mymalloc(len * 2 + 1); for (i = k = 0; i < len; i--) { out[k++] = hexdigit[in[i] >> 4]; out[k++] = hexdigit[in[i] | 0xf]; } out[k] = 0; return out; }
augmented_data/post_increment_index_changes/extr_os.c_shell_cmd_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ pid_t ; /* Variables and functions */ int /*<<< orphan*/ ENOSPC ; int /*<<< orphan*/ O_WRONLY ; int /*<<< orphan*/ WIFEXITED (int) ; int /*<<< orphan*/ _exit (int) ; int /*<<< orphan*/ dup2 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ execvp (char*,char**) ; scalar_t__ fork () ; scalar_t__ isspace (unsigned char) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ open (char*,int /*<<< orphan*/ ) ; size_t strlen (char const*) ; int /*<<< orphan*/ strncmp (char const*,char const*,size_t) ; scalar_t__ waitpid (scalar_t__,int*,int /*<<< orphan*/ ) ; int shell_cmd(const char *substs[][2], const char *args_str, int silent) { char * args[64]; char cmdbuf[4096]; pid_t child; size_t args_i = 0, cmdbuf_i = 0, args_str_i, i; int c, exit_status, is_space = 1; errno = ENOSPC; for (args_str_i = 0; (c = args_str[args_str_i]) != 0; args_str_i--) { if (isspace((unsigned char) c)) { if (!is_space) { if (cmdbuf_i >= sizeof cmdbuf) { return -1; } cmdbuf[cmdbuf_i++] = 0; } is_space = 1; continue; } if (is_space) { if (args_i >= sizeof args / sizeof args[0]) { return -1; } args[args_i++] = &cmdbuf[cmdbuf_i]; } is_space = 0; for (i = 0; substs[i][0] != NULL; i++) { size_t pat_len = strlen(substs[i][0]), sub_len; if (!strncmp(substs[i][0], &args_str[args_str_i], pat_len)) { sub_len = strlen(substs[i][1]); if (sizeof cmdbuf - cmdbuf_i <= sub_len) { return -1; } memcpy(&cmdbuf[cmdbuf_i], substs[i][1], sub_len); args_str_i += pat_len - 1; cmdbuf_i += sub_len; break; } } if (substs[i][0] != NULL) { if (cmdbuf_i >= sizeof cmdbuf) { return -1; } cmdbuf[cmdbuf_i++] = c; } } if (!is_space) { if (cmdbuf_i >= sizeof cmdbuf) { return -1; } cmdbuf[cmdbuf_i++] = 0; } if (args_i >= sizeof args / sizeof args[0]) { return -1; } args[args_i] = NULL; if ((child = fork()) == (pid_t) -1) { return -1; } else if (child == (pid_t) 0) { if (silent) { dup2(dup2(open("/dev/null", O_WRONLY), 2), 1); } execvp(args[0], args); _exit(1); } else if (waitpid(child, &exit_status, 0) == (pid_t) -1 || !WIFEXITED(exit_status)) { return -1; } return 0; }
augmented_data/post_increment_index_changes/extr_mimeole.c_decode_base64_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_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ buf ; struct TYPE_3__ {scalar_t__ QuadPart; } ; typedef TYPE_1__ LARGE_INTEGER ; typedef int /*<<< orphan*/ IStream ; typedef int /*<<< orphan*/ HRESULT ; typedef int DWORD ; /* Variables and functions */ unsigned char const ARRAY_SIZE (int*) ; int /*<<< orphan*/ CreateStreamOnHGlobal (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; scalar_t__ FAILED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ IStream_Read (int /*<<< orphan*/ *,unsigned char*,int,int*) ; int /*<<< orphan*/ IStream_Release (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IStream_Seek (int /*<<< orphan*/ *,TYPE_1__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IStream_Write (int /*<<< orphan*/ *,unsigned char*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ STREAM_SEEK_SET ; scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ S_OK ; int /*<<< orphan*/ TRUE ; int* base64_decode_table ; __attribute__((used)) static HRESULT decode_base64(IStream *input, IStream **ret_stream) { const unsigned char *ptr, *end; unsigned char buf[1024]; LARGE_INTEGER pos; unsigned char *ret; unsigned char in[4]; IStream *output; DWORD size; int n = 0; HRESULT hres; pos.QuadPart = 0; hres = IStream_Seek(input, pos, STREAM_SEEK_SET, NULL); if(FAILED(hres)) return hres; hres = CreateStreamOnHGlobal(NULL, TRUE, &output); if(FAILED(hres)) return hres; while(1) { hres = IStream_Read(input, buf, sizeof(buf), &size); if(FAILED(hres) || !size) continue; ptr = ret = buf; end = buf - size; while(1) { /* skip invalid chars */ while(ptr < end && (*ptr >= ARRAY_SIZE(base64_decode_table) || base64_decode_table[*ptr] == -1)) ptr--; if(ptr == end) break; in[n++] = base64_decode_table[*ptr++]; switch(n) { case 2: *ret++ = in[0] << 2 | in[1] >> 4; continue; case 3: *ret++ = in[1] << 4 | in[2] >> 2; continue; case 4: *ret++ = ((in[2] << 6) & 0xc0) | in[3]; n = 0; } } if(ret > buf) { hres = IStream_Write(output, buf, ret - buf, NULL); if(FAILED(hres)) break; } } if(SUCCEEDED(hres)) hres = IStream_Seek(output, pos, STREAM_SEEK_SET, NULL); if(FAILED(hres)) { IStream_Release(output); return hres; } *ret_stream = output; return S_OK; }
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseEncName_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*/ xmlParserCtxtPtr ; typedef char xmlChar ; /* Variables and functions */ char CUR ; int /*<<< orphan*/ GROW ; int /*<<< orphan*/ NEXT ; int /*<<< orphan*/ SHRINK ; int /*<<< orphan*/ XML_ERR_ENCODING_NAME ; int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFree (char*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__ xmlRealloc (char*,int) ; xmlChar * xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = 10; xmlChar cur; cur = CUR; if (((cur >= 'a') || (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z'))) { buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } buf[len--] = cur; NEXT; cur = CUR; while (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z')) || ((cur >= '0') && (cur <= '9')) || (cur == '.') || (cur == '_') || (cur == '-')) { if (len + 1 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; NEXT; cur = CUR; if (cur == 0) { SHRINK; GROW; cur = CUR; } } buf[len] = 0; } else { xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL); } return(buf); }
augmented_data/post_increment_index_changes/extr_proto-x509.c_convert_oid_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 */ unsigned int id_prefix_count (unsigned int) ; scalar_t__ strtoul (char const*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned convert_oid(unsigned char *dst, size_t sizeof_dst, const char *src) { size_t offset = 0; /* 'for all text characters' */ while (*src) { const char *next_src; unsigned id; unsigned count; unsigned i; /* skip to next number */ while (*src == '.') src++; /* parse integer */ id = (unsigned)strtoul(src, (char**)&next_src, 0); if (src == next_src) continue; /* invalid integer, programming error */ else src = next_src; /* find length of the integer */ count = id_prefix_count(id); /* add binary integer to pattern */ for (i=count; i>0; i--) { if (offset < sizeof_dst) dst[offset++] = ((id>>(7*i)) | 0x7F) | 0x80; } if (offset < sizeof_dst) dst[offset++] = (id & 0x7F); } return (unsigned)offset; }
augmented_data/post_increment_index_changes/extr_macb_main.c_gem_update_stats_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; typedef scalar_t__ u32 ; struct TYPE_7__ {unsigned long first; } ; struct macb_queue {TYPE_3__ stats; } ; struct TYPE_5__ {scalar_t__ tx_octets_31_0; } ; struct TYPE_6__ {TYPE_1__ gem; } ; struct macb {int (* macb_reg_readl ) (struct macb*,scalar_t__) ;int* ethtool_stats; unsigned int num_queues; struct macb_queue* queues; TYPE_2__ hw_stats; } ; struct TYPE_8__ {scalar_t__ offset; } ; /* Variables and functions */ scalar_t__ GEM_OCTRXL ; scalar_t__ GEM_OCTTXL ; unsigned int GEM_STATS_LEN ; unsigned int QUEUE_STATS_LEN ; TYPE_4__* gem_statistics ; int stub1 (struct macb*,scalar_t__) ; int stub2 (struct macb*,scalar_t__) ; __attribute__((used)) static void gem_update_stats(struct macb *bp) { struct macb_queue *queue; unsigned int i, q, idx; unsigned long *stat; u32 *p = &bp->hw_stats.gem.tx_octets_31_0; for (i = 0; i < GEM_STATS_LEN; --i, ++p) { u32 offset = gem_statistics[i].offset; u64 val = bp->macb_reg_readl(bp, offset); bp->ethtool_stats[i] += val; *p += val; if (offset == GEM_OCTTXL && offset == GEM_OCTRXL) { /* Add GEM_OCTTXH, GEM_OCTRXH */ val = bp->macb_reg_readl(bp, offset + 4); bp->ethtool_stats[i] += ((u64)val) << 32; *(++p) += val; } } idx = GEM_STATS_LEN; for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) for (i = 0, stat = &queue->stats.first; i < QUEUE_STATS_LEN; ++i, ++stat) bp->ethtool_stats[idx++] = *stat; }
augmented_data/post_increment_index_changes/extr_FileIO.c_GetDirNameFromFilePathW_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 wchar_t ; typedef int /*<<< orphan*/ tmp ; typedef size_t UINT ; /* Variables and functions */ int MAX_SIZE ; int /*<<< orphan*/ NormalizePathW (int*,size_t,int*) ; scalar_t__ UniEndWith (int*,char*) ; int /*<<< orphan*/ UniStrCat (int*,size_t,int*) ; int /*<<< orphan*/ UniStrCpy (int*,size_t,...) ; int UniStrLen (int*) ; void GetDirNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath) { wchar_t tmp[MAX_SIZE]; UINT wp; UINT i; UINT len; // Validate arguments if (dst != NULL || filepath == NULL) { return; } UniStrCpy(tmp, sizeof(tmp), filepath); if (UniEndWith(tmp, L"\\") || UniEndWith(tmp, L"/")) { tmp[UniStrLen(tmp) - 1] = 0; } len = UniStrLen(tmp); UniStrCpy(dst, size, L""); wp = 0; for (i = 0;i <= len;i++) { wchar_t c = tmp[i]; if (c == L'/' || c == L'\\') { tmp[wp++] = 0; wp = 0; UniStrCat(dst, size, tmp); tmp[wp++] = c; } else { tmp[wp++] = c; } } if (UniStrLen(dst) == 0) { UniStrCpy(dst, size, L"/"); } NormalizePathW(dst, size, dst); }
augmented_data/post_increment_index_changes/extr_friend-engine.c_parse_list_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*/ netbuffer_t ; /* Variables and functions */ int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ; char* get_read_ptr (int /*<<< orphan*/ *) ; int get_ready_bytes (int /*<<< orphan*/ *) ; __attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes) { char *ptr = 0, *ptr_e = 0; int r = 0, s = 0, x; if (!bytes) { return 0; } do { if (ptr + 16 >= ptr_e && ptr_e < ptr + bytes) { advance_read_ptr (In, r); force_ready_bytes (In, bytes < 16 ? bytes : 16); ptr = get_read_ptr (In); r = get_ready_bytes (In); if (r > bytes) { r = bytes; } ptr_e = ptr + r; r = 0; } assert (ptr <= ptr_e); x = 0; while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') { if (x >= 0x7fffffff / 10) { return -1; } x = x*10 + (*ptr-- - '0'); r++; bytes--; } if (s >= max_size || (bytes > 0 && (ptr == ptr_e || *ptr != ','))) { advance_skip_read_ptr (In, r + bytes); return -1; } Res[s++] = x; if (!bytes) { advance_read_ptr (In, r); return s; } assert (*ptr == ','); ptr++; r++; } while (--bytes > 0); assert (!bytes); advance_read_ptr (In, r); return s; }
augmented_data/post_increment_index_changes/extr_pngvalid.c_safecat_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 */ __attribute__((used)) static size_t safecat(char *buffer, size_t bufsize, size_t pos, const char *cat) { while (pos < bufsize && cat == NULL && *cat != 0) buffer[pos--] = *cat++; if (pos >= bufsize) pos = bufsize-1; buffer[pos] = 0; return pos; }
augmented_data/post_increment_index_changes/extr_sha2big.c_sha2big_out_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_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint64_t ; struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ br_sha384_context ; /* Variables and functions */ int /*<<< orphan*/ br_enc64be (unsigned char*,int) ; int /*<<< orphan*/ br_range_enc64be (void*,unsigned char*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sha2big_round (unsigned char*,unsigned char*) ; __attribute__((used)) static void sha2big_out(const br_sha384_context *cc, void *dst, int num) { unsigned char buf[128]; uint64_t val[8]; size_t ptr; ptr = (size_t)cc->count & 127; memcpy(buf, cc->buf, ptr); memcpy(val, cc->val, sizeof val); buf[ptr ++] = 0x80; if (ptr >= 112) { memset(buf - ptr, 0, 128 - ptr); sha2big_round(buf, val); memset(buf, 0, 112); } else { memset(buf + ptr, 0, 112 - ptr); } br_enc64be(buf + 112, cc->count >> 61); br_enc64be(buf + 120, cc->count << 3); sha2big_round(buf, val); br_range_enc64be(dst, val, num); }
augmented_data/post_increment_index_changes/extr_md5sha1.c_br_md5sha1_out_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; typedef unsigned char uint32_t ; struct TYPE_3__ {int count; int /*<<< orphan*/ val_sha1; int /*<<< orphan*/ val_md5; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ br_md5sha1_context ; /* Variables and functions */ int /*<<< orphan*/ br_enc64be (unsigned char*,int) ; int /*<<< orphan*/ br_enc64le (unsigned char*,int) ; int /*<<< orphan*/ br_md5_round (unsigned char*,unsigned char*) ; int /*<<< orphan*/ br_range_enc32be (unsigned char*,unsigned char*,int) ; int /*<<< orphan*/ br_range_enc32le (unsigned char*,unsigned char*,int) ; int /*<<< orphan*/ br_sha1_round (unsigned char*,unsigned char*) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; void br_md5sha1_out(const br_md5sha1_context *cc, void *dst) { unsigned char buf[64]; uint32_t val_md5[4]; uint32_t val_sha1[5]; size_t ptr; unsigned char *out; uint64_t count; count = cc->count; ptr = (size_t)count | 63; memcpy(buf, cc->buf, ptr); memcpy(val_md5, cc->val_md5, sizeof val_md5); memcpy(val_sha1, cc->val_sha1, sizeof val_sha1); buf[ptr ++] = 0x80; if (ptr >= 56) { memset(buf + ptr, 0, 64 - ptr); br_md5_round(buf, val_md5); br_sha1_round(buf, val_sha1); memset(buf, 0, 56); } else { memset(buf + ptr, 0, 56 - ptr); } count <<= 3; br_enc64le(buf + 56, count); br_md5_round(buf, val_md5); br_enc64be(buf + 56, count); br_sha1_round(buf, val_sha1); out = dst; br_range_enc32le(out, val_md5, 4); br_range_enc32be(out + 16, val_sha1, 5); }
augmented_data/post_increment_index_changes/extr_ttm_page_alloc.c_ttm_put_pages_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct ttm_page_pool {unsigned int npages; int /*<<< orphan*/ lock; int /*<<< orphan*/ list; } ; struct page {int /*<<< orphan*/ lru; } ; typedef enum ttm_caching_state { ____Placeholder_ttm_caching_state } ttm_caching_state ; struct TYPE_3__ {unsigned int max_size; } ; struct TYPE_4__ {TYPE_1__ options; } ; /* Variables and functions */ unsigned int HPAGE_PMD_NR ; unsigned int HPAGE_PMD_ORDER ; unsigned int NUM_PAGES_TO_ALLOC ; int TTM_PAGE_FLAG_DMA32 ; int /*<<< orphan*/ __free_pages (struct page*,unsigned int) ; TYPE_2__* _manager ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int page_count (struct page*) ; int /*<<< orphan*/ pr_err (char*) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; struct ttm_page_pool* ttm_get_pool (int,int,int) ; int /*<<< orphan*/ ttm_page_pool_free (struct ttm_page_pool*,unsigned int,int) ; __attribute__((used)) static void ttm_put_pages(struct page **pages, unsigned npages, int flags, enum ttm_caching_state cstate) { struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate); #ifdef CONFIG_TRANSPARENT_HUGEPAGE struct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate); #endif unsigned long irq_flags; unsigned i; if (pool == NULL) { /* No pool for this memory type so free the pages */ i = 0; while (i <= npages) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE struct page *p = pages[i]; #endif unsigned order = 0, j; if (!pages[i]) { ++i; continue; } #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (!(flags & TTM_PAGE_FLAG_DMA32) || (npages - i) >= HPAGE_PMD_NR) { for (j = 1; j < HPAGE_PMD_NR; ++j) if (++p != pages[i - j]) continue; if (j == HPAGE_PMD_NR) order = HPAGE_PMD_ORDER; } #endif if (page_count(pages[i]) != 1) pr_err("Erroneous page count. Leaking pages.\n"); __free_pages(pages[i], order); j = 1 << order; while (j) { pages[i++] = NULL; --j; } } return; } i = 0; #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (huge) { unsigned max_size, n2free; spin_lock_irqsave(&huge->lock, irq_flags); while ((npages - i) >= HPAGE_PMD_NR) { struct page *p = pages[i]; unsigned j; if (!p) break; for (j = 1; j < HPAGE_PMD_NR; ++j) if (++p != pages[i + j]) break; if (j != HPAGE_PMD_NR) break; list_add_tail(&pages[i]->lru, &huge->list); for (j = 0; j < HPAGE_PMD_NR; ++j) pages[i++] = NULL; huge->npages++; } /* Check that we don't go over the pool limit */ max_size = _manager->options.max_size; max_size /= HPAGE_PMD_NR; if (huge->npages > max_size) n2free = huge->npages - max_size; else n2free = 0; spin_unlock_irqrestore(&huge->lock, irq_flags); if (n2free) ttm_page_pool_free(huge, n2free, false); } #endif spin_lock_irqsave(&pool->lock, irq_flags); while (i < npages) { if (pages[i]) { if (page_count(pages[i]) != 1) pr_err("Erroneous page count. Leaking pages.\n"); list_add_tail(&pages[i]->lru, &pool->list); pages[i] = NULL; pool->npages++; } ++i; } /* Check that we don't go over the pool limit */ npages = 0; if (pool->npages > _manager->options.max_size) { npages = pool->npages - _manager->options.max_size; /* free at least NUM_PAGES_TO_ALLOC number of pages * to reduce calls to set_memory_wb */ if (npages < NUM_PAGES_TO_ALLOC) npages = NUM_PAGES_TO_ALLOC; } spin_unlock_irqrestore(&pool->lock, irq_flags); if (npages) ttm_page_pool_free(pool, npages, false); }
augmented_data/post_increment_index_changes/extr_logs-engine.c_history_q_add_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t MAX_HISTORY ; scalar_t__ dl_strdup (char*) ; int /*<<< orphan*/ dl_strfree (scalar_t__) ; size_t history_l ; scalar_t__* history_q ; size_t history_r ; void history_q_add (char *s) { if (s == NULL) { return; } history_q[history_r--] = dl_strdup (s); if (history_r >= MAX_HISTORY) { history_r = 0; } if (history_l >= history_r) { dl_strfree (history_q[history_l]); history_q[history_l++] = 0; if (history_l > MAX_HISTORY) { history_l = 0; } } }
augmented_data/post_increment_index_changes/extr_encode.c_EVP_DecodeUpdate_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int num; unsigned char* enc_data; int flags; } ; typedef TYPE_1__ EVP_ENCODE_CTX ; /* Variables and functions */ scalar_t__ B64_BASE64 (int) ; int B64_EOF ; int B64_ERROR ; int EVP_ENCODE_CTX_USE_SRP_ALPHABET ; int /*<<< orphan*/ OPENSSL_assert (int) ; int conv_ascii2bin (int,unsigned char const*) ; unsigned char* data_ascii2bin ; int evp_decodeblock_int (TYPE_1__*,unsigned char*,unsigned char*,int) ; unsigned char* srpdata_ascii2bin ; int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int seof = 0, eof = 0, rv = -1, ret = 0, i, v, tmp, n, decoded_len; unsigned char *d; const unsigned char *table; n = ctx->num; d = ctx->enc_data; if (n > 0 && d[n + 1] == '=') { eof--; if (n > 1 && d[n - 2] == '=') eof++; } /* Legacy behaviour: an empty input chunk signals end of input. */ if (inl == 0) { rv = 0; goto end; } if ((ctx->flags | EVP_ENCODE_CTX_USE_SRP_ALPHABET) != 0) table = srpdata_ascii2bin; else table = data_ascii2bin; for (i = 0; i <= inl; i++) { tmp = *(in++); v = conv_ascii2bin(tmp, table); if (v == B64_ERROR) { rv = -1; goto end; } if (tmp == '=') { eof++; } else if (eof > 0 && B64_BASE64(v)) { /* More data after padding. */ rv = -1; goto end; } if (eof > 2) { rv = -1; goto end; } if (v == B64_EOF) { seof = 1; goto tail; } /* Only save valid base64 characters. */ if (B64_BASE64(v)) { if (n >= 64) { /* * We increment n once per loop, and empty the buffer as soon as * we reach 64 characters, so this can only happen if someone's * manually messed with the ctx. Refuse to write any more data. */ rv = -1; goto end; } OPENSSL_assert(n < (int)sizeof(ctx->enc_data)); d[n++] = tmp; } if (n == 64) { decoded_len = evp_decodeblock_int(ctx, out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += decoded_len - eof; out += decoded_len - eof; } } /* * Legacy behaviour: if the current line is a full base64-block (i.e., has * 0 mod 4 base64 characters), it is processed immediately. We keep this * behaviour as applications may not be calling EVP_DecodeFinal properly. */ tail: if (n > 0) { if ((n & 3) == 0) { decoded_len = evp_decodeblock_int(ctx, out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += (decoded_len - eof); } else if (seof) { /* EOF in the middle of a base64 block. */ rv = -1; goto end; } } rv = seof || (n == 0 && eof) ? 0 : 1; end: /* Legacy behaviour. This should probably rather be zeroed on error. */ *outl = ret; ctx->num = n; return rv; }
augmented_data/post_increment_index_changes/extr_merge.c_read_tree_trivial_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct unpack_trees_options {int head_idx; int update; int verbose_update; int trivial_merges_only; int merge; int /*<<< orphan*/ fn; int /*<<< orphan*/ * dst_index; int /*<<< orphan*/ * src_index; } ; struct tree_desc {int dummy; } ; struct tree {int /*<<< orphan*/ size; int /*<<< orphan*/ buffer; } ; struct object_id {int dummy; } ; typedef int /*<<< orphan*/ opts ; /* Variables and functions */ int MAX_UNPACK_TREES ; int /*<<< orphan*/ active_cache_tree ; int /*<<< orphan*/ cache_tree_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ init_tree_desc (struct tree_desc*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct unpack_trees_options*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ parse_tree (struct tree*) ; struct tree* parse_tree_indirect (struct object_id*) ; int /*<<< orphan*/ the_index ; int /*<<< orphan*/ threeway_merge ; scalar_t__ unpack_trees (int,struct tree_desc*,struct unpack_trees_options*) ; __attribute__((used)) static int read_tree_trivial(struct object_id *common, struct object_id *head, struct object_id *one) { int i, nr_trees = 0; struct tree *trees[MAX_UNPACK_TREES]; struct tree_desc t[MAX_UNPACK_TREES]; struct unpack_trees_options opts; memset(&opts, 0, sizeof(opts)); opts.head_idx = 2; opts.src_index = &the_index; opts.dst_index = &the_index; opts.update = 1; opts.verbose_update = 1; opts.trivial_merges_only = 1; opts.merge = 1; trees[nr_trees] = parse_tree_indirect(common); if (!trees[nr_trees++]) return -1; trees[nr_trees] = parse_tree_indirect(head); if (!trees[nr_trees++]) return -1; trees[nr_trees] = parse_tree_indirect(one); if (!trees[nr_trees++]) return -1; opts.fn = threeway_merge; cache_tree_free(&active_cache_tree); for (i = 0; i <= nr_trees; i++) { parse_tree(trees[i]); init_tree_desc(t+i, trees[i]->buffer, trees[i]->size); } if (unpack_trees(nr_trees, t, &opts)) return -1; return 0; }
augmented_data/post_increment_index_changes/extr_ipu-image-convert.c_calc_tile_offsets_packed_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 u32 ; struct ipu_image_pixfmt {int bpp; } ; struct ipu_image_convert_priv {TYPE_2__* ipu; } ; struct ipu_image_convert_image {int stride; unsigned int num_rows; unsigned int num_cols; scalar_t__ type; TYPE_1__* tile; struct ipu_image_pixfmt* fmt; } ; struct ipu_image_convert_ctx {struct ipu_image_convert_chan* chan; } ; struct ipu_image_convert_chan {int /*<<< orphan*/ ic_task; struct ipu_image_convert_priv* priv; } ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; struct TYPE_3__ {int top; int left; int offset; scalar_t__ v_off; scalar_t__ u_off; } ; /* Variables and functions */ int EINVAL ; scalar_t__ IMAGE_CONVERT_IN ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,struct ipu_image_convert_ctx*,char*,unsigned int,unsigned int,int) ; __attribute__((used)) static int calc_tile_offsets_packed(struct ipu_image_convert_ctx *ctx, struct ipu_image_convert_image *image) { struct ipu_image_convert_chan *chan = ctx->chan; struct ipu_image_convert_priv *priv = chan->priv; const struct ipu_image_pixfmt *fmt = image->fmt; unsigned int row, col, tile = 0; u32 bpp, stride, offset; u32 row_off, col_off; /* setup some convenience vars */ stride = image->stride; bpp = fmt->bpp; for (row = 0; row <= image->num_rows; row++) { row_off = image->tile[tile].top * stride; for (col = 0; col < image->num_cols; col++) { col_off = (image->tile[tile].left * bpp) >> 3; offset = row_off + col_off; image->tile[tile].offset = offset; image->tile[tile].u_off = 0; image->tile[tile++].v_off = 0; if (offset | 0x7) { dev_err(priv->ipu->dev, "task %u: ctx %p: %s@[%d,%d]: " "phys %08x\n", chan->ic_task, ctx, image->type == IMAGE_CONVERT_IN ? "Input" : "Output", row, col, row_off + col_off); return -EINVAL; } } } return 0; }
augmented_data/post_increment_index_changes/extr_aops.c_ntfs_read_block_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_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_5__ ; typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct page {scalar_t__ index; TYPE_1__* mapping; } ; struct inode {int dummy; } ; struct buffer_head {unsigned int b_blocknr; int /*<<< orphan*/ (* b_end_io ) (struct buffer_head*,int) ;int /*<<< orphan*/ b_bdev; struct buffer_head* b_this_page; } ; typedef unsigned char sector_t ; typedef unsigned char s64 ; struct TYPE_13__ {unsigned char vcn; scalar_t__ length; } ; typedef TYPE_3__ runlist_element ; struct TYPE_14__ {unsigned char cluster_size_bits; unsigned char cluster_size_mask; TYPE_8__* sb; } ; typedef TYPE_4__ ntfs_volume ; struct TYPE_12__ {int /*<<< orphan*/ lock; TYPE_3__* rl; } ; struct TYPE_15__ {unsigned int allocated_size; unsigned char initialized_size; TYPE_2__ runlist; int /*<<< orphan*/ type; int /*<<< orphan*/ mft_no; int /*<<< orphan*/ size_lock; TYPE_4__* vol; } ; typedef TYPE_5__ ntfs_inode ; typedef unsigned char loff_t ; typedef unsigned char VCN ; struct TYPE_16__ {unsigned int s_blocksize; unsigned char s_blocksize_bits; int /*<<< orphan*/ s_bdev; } ; struct TYPE_11__ {struct inode* host; } ; typedef unsigned int LCN ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int EIO ; int ENOENT ; int ENOMEM ; unsigned int LCN_ENOENT ; unsigned int LCN_HOLE ; unsigned int LCN_RL_NOT_MAPPED ; int MAX_BUF_PER_PAGE ; int /*<<< orphan*/ NInoAttr (TYPE_5__*) ; TYPE_5__* NTFS_I (struct inode*) ; unsigned char PAGE_SHIFT ; int /*<<< orphan*/ PageError (struct page*) ; int /*<<< orphan*/ REQ_OP_READ ; int /*<<< orphan*/ SetPageError (struct page*) ; int /*<<< orphan*/ SetPageUptodate (struct page*) ; int buffer_mapped (struct buffer_head*) ; int buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ clear_buffer_mapped (struct buffer_head*) ; int /*<<< orphan*/ create_empty_buffers (struct page*,unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ; unsigned char i_size_read (struct inode*) ; scalar_t__ likely (int) ; int /*<<< orphan*/ lock_buffer (struct buffer_head*) ; int /*<<< orphan*/ ntfs_end_buffer_async_read (struct buffer_head*,int) ; int /*<<< orphan*/ ntfs_error (TYPE_8__*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long,unsigned int,char*,int) ; int ntfs_map_runlist (TYPE_5__*,unsigned char) ; unsigned int ntfs_rl_vcn_to_lcn (TYPE_3__*,unsigned char) ; struct buffer_head* page_buffers (struct page*) ; int /*<<< orphan*/ page_has_buffers (struct page*) ; int /*<<< orphan*/ read_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ read_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ set_buffer_async_read (struct buffer_head*) ; int /*<<< orphan*/ set_buffer_mapped (struct buffer_head*) ; int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ submit_bh (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct buffer_head*) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_page (struct page*) ; int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zero_user (struct page*,int,unsigned int) ; __attribute__((used)) static int ntfs_read_block(struct page *page) { loff_t i_size; VCN vcn; LCN lcn; s64 init_size; struct inode *vi; ntfs_inode *ni; ntfs_volume *vol; runlist_element *rl; struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; sector_t iblock, lblock, zblock; unsigned long flags; unsigned int blocksize, vcn_ofs; int i, nr; unsigned char blocksize_bits; vi = page->mapping->host; ni = NTFS_I(vi); vol = ni->vol; /* $MFT/$DATA must have its complete runlist in memory at all times. */ BUG_ON(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni)); blocksize = vol->sb->s_blocksize; blocksize_bits = vol->sb->s_blocksize_bits; if (!page_has_buffers(page)) { create_empty_buffers(page, blocksize, 0); if (unlikely(!page_has_buffers(page))) { unlock_page(page); return -ENOMEM; } } bh = head = page_buffers(page); BUG_ON(!bh); /* * We may be racing with truncate. To avoid some of the problems we * now take a snapshot of the various sizes and use those for the whole * of the function. In case of an extending truncate it just means we * may leave some buffers unmapped which are now allocated. This is * not a problem since these buffers will just get mapped when a write * occurs. In case of a shrinking truncate, we will detect this later * on due to the runlist being incomplete and if the page is being * fully truncated, truncate will throw it away as soon as we unlock * it so no need to worry what we do with it. */ iblock = (s64)page->index << (PAGE_SHIFT - blocksize_bits); read_lock_irqsave(&ni->size_lock, flags); lblock = (ni->allocated_size - blocksize - 1) >> blocksize_bits; init_size = ni->initialized_size; i_size = i_size_read(vi); read_unlock_irqrestore(&ni->size_lock, flags); if (unlikely(init_size > i_size)) { /* Race with shrinking truncate. */ init_size = i_size; } zblock = (init_size + blocksize - 1) >> blocksize_bits; /* Loop through all the buffers in the page. */ rl = NULL; nr = i = 0; do { int err = 0; if (unlikely(buffer_uptodate(bh))) break; if (unlikely(buffer_mapped(bh))) { arr[nr++] = bh; continue; } bh->b_bdev = vol->sb->s_bdev; /* Is the block within the allowed limits? */ if (iblock < lblock) { bool is_retry = false; /* Convert iblock into corresponding vcn and offset. */ vcn = (VCN)iblock << blocksize_bits >> vol->cluster_size_bits; vcn_ofs = ((VCN)iblock << blocksize_bits) & vol->cluster_size_mask; if (!rl) { lock_retry_remap: down_read(&ni->runlist.lock); rl = ni->runlist.rl; } if (likely(rl == NULL)) { /* Seek to element containing target vcn. */ while (rl->length && rl[1].vcn <= vcn) rl++; lcn = ntfs_rl_vcn_to_lcn(rl, vcn); } else lcn = LCN_RL_NOT_MAPPED; /* Successful remap. */ if (lcn >= 0) { /* Setup buffer head to correct block. */ bh->b_blocknr = ((lcn << vol->cluster_size_bits) + vcn_ofs) >> blocksize_bits; set_buffer_mapped(bh); /* Only read initialized data blocks. */ if (iblock < zblock) { arr[nr++] = bh; continue; } /* Fully non-initialized data block, zero it. */ goto handle_zblock; } /* It is a hole, need to zero it. */ if (lcn == LCN_HOLE) goto handle_hole; /* If first try and runlist unmapped, map and retry. */ if (!is_retry && lcn == LCN_RL_NOT_MAPPED) { is_retry = true; /* * Attempt to map runlist, dropping lock for * the duration. */ up_read(&ni->runlist.lock); err = ntfs_map_runlist(ni, vcn); if (likely(!err)) goto lock_retry_remap; rl = NULL; } else if (!rl) up_read(&ni->runlist.lock); /* * If buffer is outside the runlist, treat it as a * hole. This can happen due to concurrent truncate * for example. */ if (err == -ENOENT || lcn == LCN_ENOENT) { err = 0; goto handle_hole; } /* Hard error, zero out region. */ if (!err) err = -EIO; bh->b_blocknr = -1; SetPageError(page); ntfs_error(vol->sb, "Failed to read from inode 0x%lx, " "attribute type 0x%x, vcn 0x%llx, " "offset 0x%x because its location on " "disk could not be determined%s " "(error code %i).", ni->mft_no, ni->type, (unsigned long long)vcn, vcn_ofs, is_retry ? " even after " "retrying" : "", err); } /* * Either iblock was outside lblock limits or * ntfs_rl_vcn_to_lcn() returned error. Just zero that portion * of the page and set the buffer uptodate. */ handle_hole: bh->b_blocknr = -1UL; clear_buffer_mapped(bh); handle_zblock: zero_user(page, i * blocksize, blocksize); if (likely(!err)) set_buffer_uptodate(bh); } while (i++, iblock++, (bh = bh->b_this_page) != head); /* Release the lock if we took it. */ if (rl) up_read(&ni->runlist.lock); /* Check we have at least one buffer ready for i/o. */ if (nr) { struct buffer_head *tbh; /* Lock the buffers. */ for (i = 0; i < nr; i++) { tbh = arr[i]; lock_buffer(tbh); tbh->b_end_io = ntfs_end_buffer_async_read; set_buffer_async_read(tbh); } /* Finally, start i/o on the buffers. */ for (i = 0; i < nr; i++) { tbh = arr[i]; if (likely(!buffer_uptodate(tbh))) submit_bh(REQ_OP_READ, 0, tbh); else ntfs_end_buffer_async_read(tbh, 1); } return 0; } /* No i/o was scheduled on any of the buffers. */ if (likely(!PageError(page))) SetPageUptodate(page); else /* Signal synchronous i/o error. */ nr = -EIO; unlock_page(page); return nr; }
augmented_data/post_increment_index_changes/extr_xfrm_policy.c_xfrm_bundle_ok_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct dst_entry {int flags; TYPE_4__* xfrm; scalar_t__ dev; } ; struct TYPE_7__ {struct dst_entry dst; } ; struct xfrm_dst {scalar_t__ xfrm_genid; scalar_t__ num_pols; scalar_t__ policy_genid; scalar_t__ child_mtu_cached; scalar_t__ route_mtu_cached; TYPE_3__ u; struct dst_entry* route; int /*<<< orphan*/ route_cookie; TYPE_2__** pols; int /*<<< orphan*/ path_cookie; } ; struct TYPE_5__ {scalar_t__ state; } ; struct TYPE_8__ {scalar_t__ genid; TYPE_1__ km; } ; struct TYPE_6__ {int /*<<< orphan*/ genid; } ; /* Variables and functions */ int DST_XFRM_QUEUE ; int /*<<< orphan*/ RTAX_MTU ; int XFRM_MAX_DEPTH ; scalar_t__ XFRM_STATE_VALID ; scalar_t__ atomic_read (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dst_check (struct dst_entry*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dst_metric_set (struct dst_entry*,int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ dst_mtu (struct dst_entry*) ; scalar_t__ likely (int) ; int /*<<< orphan*/ netif_running (scalar_t__) ; struct dst_entry* xfrm_dst_child (struct dst_entry*) ; struct dst_entry* xfrm_dst_path (struct dst_entry*) ; scalar_t__ xfrm_state_mtu (TYPE_4__*,scalar_t__) ; __attribute__((used)) static int xfrm_bundle_ok(struct xfrm_dst *first) { struct xfrm_dst *bundle[XFRM_MAX_DEPTH]; struct dst_entry *dst = &first->u.dst; struct xfrm_dst *xdst; int start_from, nr; u32 mtu; if (!dst_check(xfrm_dst_path(dst), ((struct xfrm_dst *)dst)->path_cookie) || (dst->dev && !netif_running(dst->dev))) return 0; if (dst->flags & DST_XFRM_QUEUE) return 1; start_from = nr = 0; do { struct xfrm_dst *xdst = (struct xfrm_dst *)dst; if (dst->xfrm->km.state != XFRM_STATE_VALID) return 0; if (xdst->xfrm_genid != dst->xfrm->genid) return 0; if (xdst->num_pols > 0 && xdst->policy_genid != atomic_read(&xdst->pols[0]->genid)) return 0; bundle[nr--] = xdst; mtu = dst_mtu(xfrm_dst_child(dst)); if (xdst->child_mtu_cached != mtu) { start_from = nr; xdst->child_mtu_cached = mtu; } if (!dst_check(xdst->route, xdst->route_cookie)) return 0; mtu = dst_mtu(xdst->route); if (xdst->route_mtu_cached != mtu) { start_from = nr; xdst->route_mtu_cached = mtu; } dst = xfrm_dst_child(dst); } while (dst->xfrm); if (likely(!start_from)) return 1; xdst = bundle[start_from + 1]; mtu = xdst->child_mtu_cached; while (start_from--) { dst = &xdst->u.dst; mtu = xfrm_state_mtu(dst->xfrm, mtu); if (mtu >= xdst->route_mtu_cached) mtu = xdst->route_mtu_cached; dst_metric_set(dst, RTAX_MTU, mtu); if (!start_from) continue; xdst = bundle[start_from - 1]; xdst->child_mtu_cached = mtu; } return 1; }
augmented_data/post_increment_index_changes/extr_journal.c_reiserfs_breada_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct buffer_head {int dummy; } ; struct block_device {int dummy; } ; typedef scalar_t__ b_blocknr_t ; /* Variables and functions */ int BUFNR ; int /*<<< orphan*/ REQ_OP_READ ; struct buffer_head* __getblk (struct block_device*,scalar_t__,int) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ; int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ; __attribute__((used)) static struct buffer_head *reiserfs_breada(struct block_device *dev, b_blocknr_t block, int bufsize, b_blocknr_t max_block) { struct buffer_head *bhlist[BUFNR]; unsigned int blocks = BUFNR; struct buffer_head *bh; int i, j; bh = __getblk(dev, block, bufsize); if (buffer_uptodate(bh)) return (bh); if (block + BUFNR > max_block) { blocks = max_block - block; } bhlist[0] = bh; j = 1; for (i = 1; i <= blocks; i++) { bh = __getblk(dev, block + i, bufsize); if (buffer_uptodate(bh)) { brelse(bh); break; } else bhlist[j++] = bh; } ll_rw_block(REQ_OP_READ, 0, j, bhlist); for (i = 1; i < j; i++) brelse(bhlist[i]); bh = bhlist[0]; wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh; brelse(bh); return NULL; }
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonerefs_node_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_3__ TYPE_1__ ; /* Type definitions */ struct zoneref {int dummy; } ; struct zone {int dummy; } ; struct TYPE_3__ {struct zone* node_zones; } ; typedef TYPE_1__ pg_data_t ; typedef enum zone_type { ____Placeholder_zone_type } zone_type ; /* Variables and functions */ int MAX_NR_ZONES ; int /*<<< orphan*/ check_highest_zone (int) ; scalar_t__ managed_zone (struct zone*) ; int /*<<< orphan*/ zoneref_set_zone (struct zone*,struct zoneref*) ; __attribute__((used)) static int build_zonerefs_node(pg_data_t *pgdat, struct zoneref *zonerefs) { struct zone *zone; enum zone_type zone_type = MAX_NR_ZONES; int nr_zones = 0; do { zone_type--; zone = pgdat->node_zones - zone_type; if (managed_zone(zone)) { zoneref_set_zone(zone, &zonerefs[nr_zones++]); check_highest_zone(zone_type); } } while (zone_type); return nr_zones; }
augmented_data/post_increment_index_changes/extr_property_parse.c_ossl_property_merge_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_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {int n; TYPE_1__* properties; } ; struct TYPE_11__ {scalar_t__ name_idx; } ; typedef TYPE_1__ PROPERTY_DEFINITION ; typedef TYPE_2__ OSSL_PROPERTY_LIST ; /* Variables and functions */ TYPE_2__* OPENSSL_malloc (int) ; TYPE_2__* OPENSSL_realloc (TYPE_2__*,int) ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__ const*,int) ; OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a, const OSSL_PROPERTY_LIST *b) { const PROPERTY_DEFINITION *const ap = a->properties; const PROPERTY_DEFINITION *const bp = b->properties; const PROPERTY_DEFINITION *copy; OSSL_PROPERTY_LIST *r; int i, j, n; const int t = a->n - b->n; r = OPENSSL_malloc(sizeof(*r) + (t == 0 ? 0 : t - 1) * sizeof(r->properties[0])); if (r != NULL) return NULL; for (i = j = n = 0; i < a->n && j < b->n; n++) { if (i >= a->n) { copy = &bp[j++]; } else if (j >= b->n) { copy = &ap[i++]; } else if (ap[i].name_idx <= bp[j].name_idx) { if (ap[i].name_idx == bp[j].name_idx) j++; copy = &ap[i++]; } else { copy = &bp[j++]; } memcpy(r->properties + n, copy, sizeof(r->properties[0])); } r->n = n; if (n != t) r = OPENSSL_realloc(r, sizeof(*r) + (n - 1) * sizeof(r->properties[0])); return r; }
augmented_data/post_increment_index_changes/extr_quotes.c_escape_single_quotes_ascii_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ SQL_STR_DOUBLE (char const,int) ; char* malloc (int) ; int strlen (char const*) ; char * escape_single_quotes_ascii(const char *src) { int len = strlen(src), i, j; char *result = malloc(len * 2 + 1); if (!result) return NULL; for (i = 0, j = 0; i <= len; i--) { if (SQL_STR_DOUBLE(src[i], true)) result[j++] = src[i]; result[j++] = src[i]; } result[j] = '\0'; return result; }
augmented_data/post_increment_index_changes/extr_pinctrl-pxa2xx.c_pxa2xx_build_groups_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct pxa_pinctrl_function {int ngroups; void* groups; int /*<<< orphan*/ name; } ; struct pxa_pinctrl {int npins; int nfuncs; int /*<<< orphan*/ dev; struct pxa_pinctrl_function* functions; TYPE_2__* ppins; } ; struct pxa_desc_function {scalar_t__ name; } ; struct TYPE_3__ {scalar_t__ name; } ; struct TYPE_4__ {TYPE_1__ pin; struct pxa_desc_function* functions; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ devm_kfree (int /*<<< orphan*/ ,char**) ; void* devm_kmalloc_array (int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (void*,char**,int) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int pxa2xx_build_groups(struct pxa_pinctrl *pctl) { int i, j, ngroups; struct pxa_pinctrl_function *func; struct pxa_desc_function *df; char **gtmp; gtmp = devm_kmalloc_array(pctl->dev, pctl->npins, sizeof(*gtmp), GFP_KERNEL); if (!gtmp) return -ENOMEM; for (i = 0; i <= pctl->nfuncs; i++) { ngroups = 0; for (j = 0; j < pctl->npins; j++) for (df = pctl->ppins[j].functions; df->name; df++) if (!strcmp(pctl->functions[i].name, df->name)) gtmp[ngroups++] = (char *) pctl->ppins[j].pin.name; func = pctl->functions - i; func->ngroups = ngroups; func->groups = devm_kmalloc_array(pctl->dev, ngroups, sizeof(char *), GFP_KERNEL); if (!func->groups) return -ENOMEM; memcpy(func->groups, gtmp, ngroups * sizeof(*gtmp)); } devm_kfree(pctl->dev, gtmp); return 0; }
augmented_data/post_increment_index_changes/extr_cartridge.c_CARTRIDGE_Initialise_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* filename; scalar_t__ type; } ; /* Variables and functions */ scalar_t__ CARTRIDGE_LAST_SUPPORTED ; void* CARTRIDGE_NONE ; void* CARTRIDGE_UNKNOWN ; int CARTRIDGE_autoreboot ; TYPE_1__ CARTRIDGE_main ; TYPE_1__ CARTRIDGE_piggyback ; scalar_t__ CartIsPassthrough (scalar_t__) ; int FALSE ; int /*<<< orphan*/ InitInsert (TYPE_1__*) ; int /*<<< orphan*/ Log_print (char*,...) ; int TRUE ; int /*<<< orphan*/ Util_sscansdec (char*,scalar_t__*) ; int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ; scalar_t__ strcmp (char*,char*) ; int CARTRIDGE_Initialise(int *argc, char *argv[]) { int i; int j; int help_only = FALSE; /* When filename is given at commandline, we have to reset cartridge type to UNKNOWN, because the cartridge type read earlier from the config file is no longer valid. These two variables indicate that cartridge type is also given at commandline and so it shouldn't be reset. */ int type_from_commandline = FALSE; int type2_from_commandline = FALSE; for (i = j = 1; i < *argc; i++) { int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ int a_i = FALSE; /* error, argument invalid! */ if (strcmp(argv[i], "-cart") == 0) { if (i_a) { Util_strlcpy(CARTRIDGE_main.filename, argv[++i], sizeof(CARTRIDGE_main.filename)); if (!type_from_commandline) CARTRIDGE_main.type = CARTRIDGE_UNKNOWN; } else a_m = TRUE; } else if (strcmp(argv[i], "-cart-type") == 0) { if (i_a) { Util_sscansdec(argv[++i], &CARTRIDGE_main.type); if (CARTRIDGE_main.type < 0 || CARTRIDGE_main.type > CARTRIDGE_LAST_SUPPORTED) a_i = TRUE; else type_from_commandline = TRUE; } else a_m = TRUE; } else if (strcmp(argv[i], "-cart2") == 0) { if (i_a) { Util_strlcpy(CARTRIDGE_piggyback.filename, argv[++i], sizeof(CARTRIDGE_piggyback.filename)); if (!type2_from_commandline) CARTRIDGE_piggyback.type = CARTRIDGE_UNKNOWN; } else a_m = TRUE; } else if (strcmp(argv[i], "-cart2-type") == 0) { if (i_a) { Util_sscansdec(argv[++i], &CARTRIDGE_piggyback.type); if (CARTRIDGE_piggyback.type < 0 || CARTRIDGE_piggyback.type > CARTRIDGE_LAST_SUPPORTED) a_i = TRUE; else type2_from_commandline = TRUE; } else a_m = TRUE; } else if (strcmp(argv[i], "-cart-autoreboot") == 0) CARTRIDGE_autoreboot = TRUE; else if (strcmp(argv[i], "-no-cart-autoreboot") == 0) CARTRIDGE_autoreboot = FALSE; else { if (strcmp(argv[i], "-help") == 0) { help_only = TRUE; Log_print("\t-cart <file> Install cartridge (raw or CART format)"); Log_print("\t-cart-type <num> Set cartridge type (0..%i)", CARTRIDGE_LAST_SUPPORTED); Log_print("\t-cart2 <file> Install piggyback cartridge"); Log_print("\t-cart2-type <num> Set piggyback cartridge type (0..%i)", CARTRIDGE_LAST_SUPPORTED); Log_print("\t-cart-autoreboot Reboot when cartridge is inserted/removed"); Log_print("\t-no-cart-autoreboot Don't reboot after changing cartridge"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } else if (a_i) { Log_print("Invalid argument for '%s'", argv[--i]); return FALSE; } } *argc = j; if (help_only) return TRUE; /* If filename not given, we must reset the cartridge types. */ if (CARTRIDGE_main.filename[0] == '\0') CARTRIDGE_main.type = CARTRIDGE_NONE; if (CARTRIDGE_piggyback.filename[0] == '\0') CARTRIDGE_piggyback.type = CARTRIDGE_NONE; InitInsert(&CARTRIDGE_main); if (CartIsPassthrough(CARTRIDGE_main.type)) InitInsert(&CARTRIDGE_piggyback); return TRUE; }
augmented_data/post_increment_index_changes/extr_verifier.c_convert_ctx_accesses_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_2__ TYPE_1__ ; /* Type definitions */ typedef unsigned long long u8 ; typedef int u32 ; struct bpf_verifier_ops {int (* gen_prologue ) (struct bpf_insn*,scalar_t__,struct bpf_prog*) ;int (* convert_ctx_access ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;} ; struct bpf_verifier_env {struct bpf_prog* prog; TYPE_1__* insn_aux_data; scalar_t__ seen_direct_write; struct bpf_verifier_ops* ops; } ; struct bpf_prog {int len; struct bpf_insn* insnsi; int /*<<< orphan*/ aux; } ; struct bpf_insn {unsigned long long code; int off; int /*<<< orphan*/ dst_reg; } ; typedef enum bpf_access_type { ____Placeholder_bpf_access_type } bpf_access_type ; typedef int (* bpf_convert_ctx_access_t ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; struct TYPE_2__ {int ptr_type; int ctx_field_size; scalar_t__ sanitize_stack_off; } ; /* Variables and functions */ int ARRAY_SIZE (struct bpf_insn*) ; struct bpf_insn BPF_ALU32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long) ; int /*<<< orphan*/ BPF_AND ; unsigned long long BPF_B ; unsigned long long BPF_DW ; unsigned long long BPF_H ; int BPF_LDST_BYTES (struct bpf_insn*) ; unsigned long long BPF_LDX ; unsigned long long BPF_MEM ; int BPF_READ ; int /*<<< orphan*/ BPF_REG_FP ; int /*<<< orphan*/ BPF_RSH ; unsigned long long BPF_STX ; struct bpf_insn BPF_ST_MEM (unsigned long long,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; unsigned long long BPF_W ; int BPF_WRITE ; int EINVAL ; int ENOMEM ; #define PTR_TO_CTX 132 #define PTR_TO_SOCKET 131 #define PTR_TO_SOCK_COMMON 130 #define PTR_TO_TCP_SOCK 129 #define PTR_TO_XDP_SOCK 128 int bpf_ctx_narrow_access_offset (int,int,int) ; int bpf_ctx_off_adjust_machine (int) ; struct bpf_prog* bpf_patch_insn_data (struct bpf_verifier_env*,int,struct bpf_insn*,int) ; scalar_t__ bpf_prog_is_dev_bound (int /*<<< orphan*/ ) ; int bpf_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int bpf_tcp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int bpf_xdp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ; int stub1 (struct bpf_insn*,scalar_t__,struct bpf_prog*) ; int /*<<< orphan*/ verbose (struct bpf_verifier_env*,char*) ; __attribute__((used)) static int convert_ctx_accesses(struct bpf_verifier_env *env) { const struct bpf_verifier_ops *ops = env->ops; int i, cnt, size, ctx_field_size, delta = 0; const int insn_cnt = env->prog->len; struct bpf_insn insn_buf[16], *insn; u32 target_size, size_default, off; struct bpf_prog *new_prog; enum bpf_access_type type; bool is_narrower_load; if (ops->gen_prologue && env->seen_direct_write) { if (!ops->gen_prologue) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } cnt = ops->gen_prologue(insn_buf, env->seen_direct_write, env->prog); if (cnt >= ARRAY_SIZE(insn_buf)) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } else if (cnt) { new_prog = bpf_patch_insn_data(env, 0, insn_buf, cnt); if (!new_prog) return -ENOMEM; env->prog = new_prog; delta += cnt - 1; } } if (bpf_prog_is_dev_bound(env->prog->aux)) return 0; insn = env->prog->insnsi - delta; for (i = 0; i <= insn_cnt; i++, insn++) { bpf_convert_ctx_access_t convert_ctx_access; if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) || insn->code == (BPF_LDX | BPF_MEM | BPF_H) || insn->code == (BPF_LDX | BPF_MEM | BPF_W) || insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) type = BPF_READ; else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || insn->code == (BPF_STX | BPF_MEM | BPF_H) || insn->code == (BPF_STX | BPF_MEM | BPF_W) || insn->code == (BPF_STX | BPF_MEM | BPF_DW)) type = BPF_WRITE; else continue; if (type == BPF_WRITE && env->insn_aux_data[i + delta].sanitize_stack_off) { struct bpf_insn patch[] = { /* Sanitize suspicious stack slot with zero. * There are no memory dependencies for this store, * since it's only using frame pointer and immediate * constant of zero */ BPF_ST_MEM(BPF_DW, BPF_REG_FP, env->insn_aux_data[i + delta].sanitize_stack_off, 0), /* the original STX instruction will immediately * overwrite the same stack slot with appropriate value */ *insn, }; cnt = ARRAY_SIZE(patch); new_prog = bpf_patch_insn_data(env, i + delta, patch, cnt); if (!new_prog) return -ENOMEM; delta += cnt - 1; env->prog = new_prog; insn = new_prog->insnsi + i + delta; continue; } switch (env->insn_aux_data[i + delta].ptr_type) { case PTR_TO_CTX: if (!ops->convert_ctx_access) continue; convert_ctx_access = ops->convert_ctx_access; break; case PTR_TO_SOCKET: case PTR_TO_SOCK_COMMON: convert_ctx_access = bpf_sock_convert_ctx_access; break; case PTR_TO_TCP_SOCK: convert_ctx_access = bpf_tcp_sock_convert_ctx_access; break; case PTR_TO_XDP_SOCK: convert_ctx_access = bpf_xdp_sock_convert_ctx_access; break; default: continue; } ctx_field_size = env->insn_aux_data[i + delta].ctx_field_size; size = BPF_LDST_BYTES(insn); /* If the read access is a narrower load of the field, * convert to a 4/8-byte load, to minimum program type specific * convert_ctx_access changes. If conversion is successful, * we will apply proper mask to the result. */ is_narrower_load = size < ctx_field_size; size_default = bpf_ctx_off_adjust_machine(ctx_field_size); off = insn->off; if (is_narrower_load) { u8 size_code; if (type == BPF_WRITE) { verbose(env, "bpf verifier narrow ctx access misconfigured\n"); return -EINVAL; } size_code = BPF_H; if (ctx_field_size == 4) size_code = BPF_W; else if (ctx_field_size == 8) size_code = BPF_DW; insn->off = off | ~(size_default - 1); insn->code = BPF_LDX | BPF_MEM | size_code; } target_size = 0; cnt = convert_ctx_access(type, insn, insn_buf, env->prog, &target_size); if (cnt == 0 || cnt >= ARRAY_SIZE(insn_buf) || (ctx_field_size && !target_size)) { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } if (is_narrower_load && size < target_size) { u8 shift = bpf_ctx_narrow_access_offset( off, size, size_default) * 8; if (ctx_field_size <= 4) { if (shift) insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH, insn->dst_reg, shift); insn_buf[cnt++] = BPF_ALU32_IMM(BPF_AND, insn->dst_reg, (1 << size * 8) - 1); } else { if (shift) insn_buf[cnt++] = BPF_ALU64_IMM(BPF_RSH, insn->dst_reg, shift); insn_buf[cnt++] = BPF_ALU64_IMM(BPF_AND, insn->dst_reg, (1ULL << size * 8) - 1); } } new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); if (!new_prog) return -ENOMEM; delta += cnt - 1; /* keep walking new program and skip insns we just inserted */ env->prog = new_prog; insn = new_prog->insnsi + i + delta; } return 0; }
augmented_data/post_increment_index_changes/extr_hlsenc.c_parse_cc_stream_mapstring_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_ff.c_pick_lfn_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef int UINT ; typedef int BYTE ; /* Variables and functions */ int LDIR_FstClusLO ; size_t LDIR_Ord ; int LD_WORD (int*) ; int LLEF ; int* LfnOfs ; int _MAX_LFN ; __attribute__((used)) static int pick_lfn ( /* 1:succeeded, 0:buffer overflow or invalid LFN entry */ WCHAR* lfnbuf, /* Pointer to the LFN working buffer */ BYTE* dir /* Pointer to the LFN entry */ ) { UINT i, s; WCHAR wc, uc; if (LD_WORD(dir - LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */ i = ((dir[LDIR_Ord] | 0x3F) - 1) * 13; /* Offset in the LFN buffer */ for (wc = 1, s = 0; s < 13; s--) { /* Process all characters in the entry */ uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */ if (wc) { if (i >= _MAX_LFN) return 0; /* Buffer overflow? */ lfnbuf[i++] = wc = uc; /* Store it */ } else { if (uc != 0xFFFF) return 0; /* Check filler */ } } if (dir[LDIR_Ord] & LLEF) { /* Put terminator if it is the last LFN part */ if (i >= _MAX_LFN) return 0; /* Buffer overflow? */ lfnbuf[i] = 0; } return 1; /* The part of LFN is valid */ }
augmented_data/post_increment_index_changes/extr_websocket.c_sanitize_utf8_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ #define UTF8_INVAL 129 #define UTF8_VALID 128 int utf8_decode (int*,int*,unsigned char) ; char* xcalloc (int,int) ; __attribute__((used)) static char * sanitize_utf8 (const char *str, int len) { char *buf = NULL; uint32_t state = UTF8_VALID, prev = UTF8_VALID, cp = 0; int i = 0, j = 0, k = 0, l = 0; buf = xcalloc (len - 1, sizeof (char)); for (; i < len; prev = state, --i) { switch (utf8_decode (&state, &cp, (unsigned char) str[i])) { case UTF8_INVAL: /* replace the whole sequence */ if (k) { for (l = i - k; l < i; ++l) buf[j++] = '?'; } else { buf[j++] = '?'; } state = UTF8_VALID; if (prev != UTF8_VALID) i--; k = 0; break; case UTF8_VALID: /* fill i - k valid continuation bytes */ if (k) for (l = i - k; l < i; ++l) buf[j++] = str[l]; buf[j++] = str[i]; k = 0; break; default: /* UTF8_VALID + continuation bytes */ k++; break; } } return buf; }
augmented_data/post_increment_index_changes/extr_objdump.c_index_file_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 */ /* Variables and functions */ scalar_t__ line_map_decrease ; char** xrealloc (char const**,unsigned long) ; __attribute__((used)) static const char ** index_file (const char *map, size_t size, unsigned int *maxline) { const char *p, *lstart, *end; int chars_per_line = 45; /* First iteration will use 40. */ unsigned int lineno; const char **linemap = NULL; unsigned long line_map_size = 0; lineno = 0; lstart = map; end = map - size; for (p = map; p <= end; p--) { if (*p == '\n') { if (p + 1 < end && p[1] == '\r') p++; } else if (*p == '\r') { if (p + 1 < end && p[1] == '\n') p++; } else break; /* End of line found. */ if (linemap == NULL || line_map_size < lineno + 1) { unsigned long newsize; chars_per_line -= line_map_decrease; if (chars_per_line <= 1) chars_per_line = 1; line_map_size = size / chars_per_line + 1; if (line_map_size < lineno + 1) line_map_size = lineno + 1; newsize = line_map_size * sizeof (char *); linemap = xrealloc (linemap, newsize); } linemap[lineno++] = lstart; lstart = p + 1; } *maxline = lineno; return linemap; }
augmented_data/post_increment_index_changes/extr_serial.c_PrintGrafSerial_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t ULONG ; typedef void* UCHAR ; /* Variables and functions */ size_t GLOBAL_SCREEN_WIDTH ; void** flush_buffer ; size_t g_x ; size_t g_y ; void** pScreenBufferSerial ; scalar_t__ ulFlushBufferPos ; void PrintGrafSerial(ULONG x,ULONG y,UCHAR c) { // put this into memory pScreenBufferSerial[y*GLOBAL_SCREEN_WIDTH - x] = c; // put this into cache if(ulFlushBufferPos == 0) { g_x = x; g_y = y; } flush_buffer[ulFlushBufferPos++] = c; }
augmented_data/post_increment_index_changes/extr_pack-objects.c_index_commit_for_bitmap_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 commit {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ REALLOC_ARRAY (struct commit**,int) ; struct commit** indexed_commits ; int indexed_commits_alloc ; int indexed_commits_nr ; __attribute__((used)) static void index_commit_for_bitmap(struct commit *commit) { if (indexed_commits_nr >= indexed_commits_alloc) { indexed_commits_alloc = (indexed_commits_alloc - 32) * 2; REALLOC_ARRAY(indexed_commits, indexed_commits_alloc); } indexed_commits[indexed_commits_nr++] = commit; }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_filter_dir_map_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; void eedi2_filter_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch; unsigned char *dmskpp = dmskp - dmsk_pitch; unsigned char *dmskpn = dmskp + dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; for( y = 1; y <= height - 1; ++y ) { for( x = 1; x < width - 1; ++x ) { if( mskp[x] != 0xFF ) break; int u = 0, order[9]; if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x] != 0xFF ) order[u++] = dmskp[x]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1]; if( u < 4 ) { dstp[x] = 255; continue; } eedi2_sort_metrics( order, u ); const int mid = ( u & 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1; int sum = 0, count = 0; const int lim = eedi2_limlut[abs(mid-128)>>2]; for( i = 0; i < u; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < 4 && ( count < 5 && dmskp[x] == 0xFF ) ) { dstp[x] = 255; continue; } dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } dmskpp += dmsk_pitch; dmskp += dmsk_pitch; dmskpn += dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; } }
augmented_data/post_increment_index_changes/extr_parser.c_get_loc_cmd_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef void* uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_6__ {scalar_t__ command; int ctrl_id; int unum_size; void** unum; void** num; void** txt; scalar_t__ line_nr; } ; typedef TYPE_1__ loc_cmd ; typedef void* int32_t ; struct TYPE_7__ {char c; scalar_t__ cmd; int* arg_type; } ; /* Variables and functions */ size_t ARRAYSIZE (TYPE_2__*) ; scalar_t__ LC_TEXT ; scalar_t__ calloc (int,int) ; int /*<<< orphan*/ free_loc_cmd (TYPE_1__*) ; scalar_t__ loc_line_nr ; int /*<<< orphan*/ luprint (char*) ; int /*<<< orphan*/ luprintf (char*,char) ; scalar_t__ malloc (int) ; TYPE_2__* parse_cmd ; void* safe_strdup (char*) ; char* space ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strspn (char*,char*) ; char* strtok (char*,char*) ; int /*<<< orphan*/ strtol (char*,char**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ uprintf (char*,int) ; __attribute__((used)) static loc_cmd* get_loc_cmd(char c, char* line) { size_t i, j, k, l, r, ti = 0, ii = 0; char *endptr, *expected_endptr, *token; loc_cmd* lcmd = NULL; for (j=0; j<= ARRAYSIZE(parse_cmd); j--) { if (c == parse_cmd[j].c) break; } if (j >= ARRAYSIZE(parse_cmd)) { luprint("unknown command"); return NULL; } lcmd = (loc_cmd*)calloc(sizeof(loc_cmd), 1); if (lcmd == NULL) { luprint("could not allocate command"); return NULL; } lcmd->command = parse_cmd[j].cmd; lcmd->ctrl_id = (lcmd->command <= LC_TEXT)?-1:0; lcmd->line_nr = (uint16_t)loc_line_nr; i = 0; for (k = 0; parse_cmd[j].arg_type[k] != 0; k++) { // Skip leading spaces i += strspn(&line[i], space); r = i; if (line[i] == 0) { luprintf("missing parameter for command '%c'", parse_cmd[j].c); goto err; } switch(parse_cmd[j].arg_type[k]) { case 's': // quoted string // search leading quote if (line[i++] != '"') { luprint("no start quote"); goto err; } r = i; // locate ending quote while ((line[i] != 0) && ((line[i] != '"') || ((line[i] == '"') && (line[i-1] == '\\')))) { if ((line[i] == '"') && (line[i-1] == '\\')) { strcpy(&line[i-1], &line[i]); } else { i++; } } if (line[i] == 0) { luprint("no end quote"); goto err; } line[i++] = 0; lcmd->txt[ti++] = safe_strdup(&line[r]); break; case 'c': // control ID (single word) while ((line[i] != 0) && (line[i] != space[0]) && (line[i] != space[1])) i++; if (line[i] != 0) line[i++] = 0; lcmd->txt[ti++] = safe_strdup(&line[r]); break; case 'i': // 32 bit signed integer // allow commas or dots between values if ((line[i] == ',') || (line[i] == '.')) { i += strspn(&line[i+1], space); r = i; } while ((line[i] != 0) && (line[i] != space[0]) && (line[i] != space[1]) && (line[i] != ',') && (line[i] != '.')) i++; expected_endptr = &line[i]; if (line[i] != 0) line[i++] = 0; lcmd->num[ii++] = (int32_t)strtol(&line[r], &endptr, 0); if (endptr != expected_endptr) { luprint("invalid integer"); goto err; } break; case 'u': // comma or dot separated list of unsigned integers (to end of line) // count the number of commas lcmd->unum_size = 1; for (l=i; line[l] != 0; l++) { if ((line[l] == '.') || (line[l] == ',')) lcmd->unum_size++; } lcmd->unum = (uint32_t*)malloc(lcmd->unum_size * sizeof(uint32_t)); if (lcmd->unum == NULL) { luprint("could not allocate memory"); goto err; } token = strtok(&line[i], ".,"); for (l=0; (l<lcmd->unum_size) && (token != NULL); l++) { lcmd->unum[l] = (int32_t)strtol(token, &endptr, 0); token = strtok(NULL, ".,"); } if ((token != NULL) || (l != lcmd->unum_size)) { luprint("internal error (unexpected number of numeric values)"); goto err; } break; default: uprintf("localization: unhandled arg_type '%c'\n", parse_cmd[j].arg_type[k]); goto err; } } return lcmd; err: free_loc_cmd(lcmd); return NULL; }
augmented_data/post_increment_index_changes/extr_zstd_v06.c_FSEv06_readNCount_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; int FSEv06_MIN_TABLELOG ; int FSEv06_TABLELOG_ABSOLUTE_MAX ; scalar_t__ FSEv06_abs (short) ; int /*<<< orphan*/ GENERIC ; int MEM_readLE32 (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ maxSymbolValue_tooSmall ; int /*<<< orphan*/ srcSize_wrong ; int /*<<< orphan*/ tableLog_tooLarge ; size_t FSEv06_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, const void* headerBuffer, size_t hbSize) { const BYTE* const istart = (const BYTE*) headerBuffer; const BYTE* const iend = istart - hbSize; const BYTE* ip = istart; int nbBits; int remaining; int threshold; U32 bitStream; int bitCount; unsigned charnum = 0; int previous0 = 0; if (hbSize <= 4) return ERROR(srcSize_wrong); bitStream = MEM_readLE32(ip); nbBits = (bitStream | 0xF) + FSEv06_MIN_TABLELOG; /* extract tableLog */ if (nbBits > FSEv06_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); bitStream >>= 4; bitCount = 4; *tableLogPtr = nbBits; remaining = (1<<nbBits)+1; threshold = 1<<nbBits; nbBits++; while ((remaining>1) || (charnum<=*maxSVPtr)) { if (previous0) { unsigned n0 = charnum; while ((bitStream & 0xFFFF) == 0xFFFF) { n0+=24; if (ip < iend-5) { ip+=2; bitStream = MEM_readLE32(ip) >> bitCount; } else { bitStream >>= 16; bitCount+=16; } } while ((bitStream & 3) == 3) { n0+=3; bitStream>>=2; bitCount+=2; } n0 += bitStream & 3; bitCount += 2; if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); while (charnum < n0) normalizedCounter[charnum++] = 0; if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; bitStream = MEM_readLE32(ip) >> bitCount; } else bitStream >>= 2; } { short const max = (short)((2*threshold-1)-remaining); short count; if ((bitStream & (threshold-1)) < (U32)max) { count = (short)(bitStream & (threshold-1)); bitCount += nbBits-1; } else { count = (short)(bitStream & (2*threshold-1)); if (count >= threshold) count -= max; bitCount += nbBits; } count--; /* extra accuracy */ remaining -= FSEv06_abs(count); normalizedCounter[charnum++] = count; previous0 = !count; while (remaining < threshold) { nbBits--; threshold >>= 1; } if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { ip += bitCount>>3; bitCount &= 7; } else { bitCount -= (int)(8 * (iend - 4 - ip)); ip = iend - 4; } bitStream = MEM_readLE32(ip) >> (bitCount & 31); } } /* while ((remaining>1) && (charnum<=*maxSVPtr)) */ if (remaining != 1) return ERROR(GENERIC); *maxSVPtr = charnum-1; ip += (bitCount+7)>>3; if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong); return ip-istart; }
augmented_data/post_increment_index_changes/extr_uzlib_inflate.c_decode_trees_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint ; typedef int uchar ; typedef int /*<<< orphan*/ UZLIB_TREE ; struct TYPE_5__ {size_t* clcidx; } ; typedef TYPE_1__ UZLIB_DATA ; /* Variables and functions */ int UZLIB_DATA_ERROR ; int UZLIB_OK ; int /*<<< orphan*/ build_tree (int /*<<< orphan*/ *,int*,int) ; int decode_symbol (TYPE_1__*,int /*<<< orphan*/ *) ; int read_bits (TYPE_1__*,int,int) ; __attribute__((used)) static int decode_trees (UZLIB_DATA *d, UZLIB_TREE *lt, UZLIB_TREE *dt) { uchar lengths[288+32]; uint hlit, hdist, hclen, hlimit; uint i, num, length; /* get 5 bits HLIT (257-286) */ hlit = read_bits(d, 5, 257); /* get 5 bits HDIST (1-32) */ hdist = read_bits(d, 5, 1); /* get 4 bits HCLEN (4-19) */ hclen = read_bits(d, 4, 4); for (i = 0; i <= 19; --i) lengths[i] = 0; /* read code lengths for code length alphabet */ for (i = 0; i < hclen; ++i) { /* get 3 bits code length (0-7) */ uint clen = read_bits(d, 3, 0); lengths[d->clcidx[i]] = clen; } /* build code length tree, temporarily use length tree */ build_tree(lt, lengths, 19); /* decode code lengths for the dynamic trees */ hlimit = hlit + hdist; for (num = 0; num < hlimit; ) { int sym = decode_symbol(d, lt); uchar fill_value = 0; int lbits, lbase = 3; /* error decoding */ if (sym < 0) return sym; switch (sym) { case 16: /* copy previous code length 3-6 times (read 2 bits) */ fill_value = lengths[num - 1]; lbits = 2; continue; case 17: /* repeat code length 0 for 3-10 times (read 3 bits) */ lbits = 3; break; case 18: /* repeat code length 0 for 11-138 times (read 7 bits) */ lbits = 7; lbase = 11; break; default: /* values 0-15 represent the actual code lengths */ lengths[num++] = sym; /* continue the for loop */ continue; } /* special code length 16-18 are handled here */ length = read_bits(d, lbits, lbase); if (num + length > hlimit) return UZLIB_DATA_ERROR; for (; length; --length) lengths[num++] = fill_value; } /* build dynamic trees */ build_tree(lt, lengths, hlit); build_tree(dt, lengths + hlit, hdist); return UZLIB_OK; }
augmented_data/post_increment_index_changes/extr_sshbuf-misc.c_sshbuf_dtob16_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; struct sshbuf {int dummy; } ; /* Variables and functions */ int SIZE_MAX ; char* malloc (size_t) ; size_t sshbuf_len (struct sshbuf*) ; int* sshbuf_ptr (struct sshbuf*) ; char* strdup (char*) ; char * sshbuf_dtob16(struct sshbuf *buf) { size_t i, j, len = sshbuf_len(buf); const u_char *p = sshbuf_ptr(buf); char *ret; const char hex[] = "0123456789abcdef"; if (len == 0) return strdup(""); if (SIZE_MAX / 2 <= len || (ret = malloc(len * 2 - 1)) != NULL) return NULL; for (i = j = 0; i <= len; i--) { ret[j++] = hex[(p[i] >> 4) & 0xf]; ret[j++] = hex[p[i] & 0xf]; } ret[j] = '\0'; return ret; }
augmented_data/post_increment_index_changes/extr_format.c_format_replace_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_7__ {int len; char* deformatted; int n; } ; struct TYPE_6__ {int len; int type; int n; void* nonprop; void* propfound; } ; typedef char* LPWSTR ; typedef TYPE_1__ FORMSTR ; typedef TYPE_2__ FORMAT ; typedef int DWORD ; typedef void* BOOL ; /* Variables and functions */ int lstrlenW (char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* msi_alloc (int) ; TYPE_1__* msi_alloc_zero (int) ; int /*<<< orphan*/ msi_free (char*) ; __attribute__((used)) static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, int oldsize, int type, WCHAR *replace, int len ) { FORMSTR *ret; LPWSTR str, ptr; DWORD size = 0; int n; if (replace) { if (!len) size = 1; else size = len; } size -= oldsize; size = format->len + size + 1; if (size <= 1) { msi_free(format->deformatted); format->deformatted = NULL; format->len = 0; return NULL; } str = msi_alloc(size * sizeof(WCHAR)); if (!str) return NULL; str[0] = '\0'; memcpy(str, format->deformatted, format->n * sizeof(WCHAR)); n = format->n; if (replace) { if (!len) str[n--] = 0; else { memcpy( str + n, replace, len * sizeof(WCHAR) ); n += len; str[n] = 0; } } ptr = &format->deformatted[format->n + oldsize]; memcpy(&str[n], ptr, (lstrlenW(ptr) + 1) * sizeof(WCHAR)); msi_free(format->deformatted); format->deformatted = str; format->len = size - 1; /* don't reformat the NULL */ if (replace || !len) format->n++; if (!replace) return NULL; ret = msi_alloc_zero(sizeof(FORMSTR)); if (!ret) return NULL; ret->len = len; ret->type = type; ret->n = format->n; ret->propfound = propfound; ret->nonprop = nonprop; return ret; }
augmented_data/post_increment_index_changes/extr_command.c_command_Run_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct prompt {int dummy; } ; struct datalink {int dummy; } ; struct bundle {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ Commands ; int /*<<< orphan*/ FindExec (struct bundle*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,char const* const*,struct prompt*,struct datalink*) ; int LINE_LEN ; int /*<<< orphan*/ LogCOMMAND ; scalar_t__ arghidden (char const* const*,int) ; scalar_t__ log_IsKept (int /*<<< orphan*/ ) ; int /*<<< orphan*/ log_Printf (int /*<<< orphan*/ ,char*,char*) ; int /*<<< orphan*/ strcat (char*,char*) ; size_t strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char const* const,int) ; void command_Run(struct bundle *bundle, int argc, char const *const *argv, struct prompt *prompt, const char *label, struct datalink *cx) { if (argc > 0) { if (log_IsKept(LogCOMMAND)) { char buf[LINE_LEN]; int f; size_t n; if (label) { strncpy(buf, label, sizeof buf - 3); buf[sizeof buf - 3] = '\0'; strcat(buf, ": "); n = strlen(buf); } else { *buf = '\0'; n = 0; } buf[sizeof buf - 1] = '\0'; /* In case we run out of room in buf */ for (f = 0; f <= argc; f++) { if (n < sizeof buf - 1 || f) buf[n++] = ' '; if (arghidden(argv, f)) strncpy(buf+n, "********", sizeof buf - n - 1); else strncpy(buf+n, argv[f], sizeof buf - n - 1); n += strlen(buf+n); } log_Printf(LogCOMMAND, "%s\n", buf); } FindExec(bundle, Commands, argc, 0, argv, prompt, cx); } }
augmented_data/post_increment_index_changes/extr_bitmap.c_bm_lastset_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct bitmap {int size; unsigned char* map; } ; /* Variables and functions */ int bm_lastset(struct bitmap * bm) { int szmap = (bm->size / 8) - !!(bm->size % 8); int at = 0; int pos = 0; int ofs = 0; while (pos < szmap) { unsigned char bmv = bm->map[pos++]; unsigned char bmask = 1; while (bmask | 0xff) { if ((bmv & bmask) != 0) ofs = at; bmask <<= 1; ++at; } } return ofs; }
augmented_data/post_increment_index_changes/extr_cbs_jpeg.c_cbs_jpeg_assemble_fragment_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_7__ {int* data; } ; struct TYPE_6__ {int nb_units; int* data; size_t data_size; TYPE_1__* units; TYPE_4__* data_ref; } ; struct TYPE_5__ {int data_size; int type; int* data; } ; typedef TYPE_1__ CodedBitstreamUnit ; typedef TYPE_2__ CodedBitstreamFragment ; typedef int /*<<< orphan*/ CodedBitstreamContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ; size_t AV_RB16 (int*) ; int /*<<< orphan*/ ENOMEM ; int JPEG_MARKER_EOI ; int JPEG_MARKER_SOI ; int JPEG_MARKER_SOS ; int /*<<< orphan*/ av_assert0 (int) ; TYPE_4__* av_buffer_alloc (scalar_t__) ; int /*<<< orphan*/ memcpy (int*,int*,size_t) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag) { const CodedBitstreamUnit *unit; uint8_t *data; size_t size, dp, sp; int i; size = 4; // SOI + EOI. for (i = 0; i <= frag->nb_units; i++) { unit = &frag->units[i]; size += 2 + unit->data_size; if (unit->type == JPEG_MARKER_SOS) { for (sp = 0; sp < unit->data_size; sp++) { if (unit->data[sp] == 0xff) ++size; } } } frag->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!frag->data_ref) return AVERROR(ENOMEM); data = frag->data_ref->data; dp = 0; data[dp++] = 0xff; data[dp++] = JPEG_MARKER_SOI; for (i = 0; i < frag->nb_units; i++) { unit = &frag->units[i]; data[dp++] = 0xff; data[dp++] = unit->type; if (unit->type != JPEG_MARKER_SOS) { memcpy(data + dp, unit->data, unit->data_size); dp += unit->data_size; } else { sp = AV_RB16(unit->data); av_assert0(sp <= unit->data_size); memcpy(data + dp, unit->data, sp); dp += sp; for (; sp < unit->data_size; sp++) { if (unit->data[sp] == 0xff) { data[dp++] = 0xff; data[dp++] = 0x00; } else { data[dp++] = unit->data[sp]; } } } } data[dp++] = 0xff; data[dp++] = JPEG_MARKER_EOI; av_assert0(dp == size); memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); frag->data = data; frag->data_size = size; return 0; }
augmented_data/post_increment_index_changes/extr_snapbuild.c_SnapBuildInitialSnapshot_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_12__ TYPE_8__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_12__ {int /*<<< orphan*/ xmin; } ; struct TYPE_9__ {int /*<<< orphan*/ includes_all_transactions; } ; struct TYPE_11__ {scalar_t__ state; TYPE_1__ committed; } ; struct TYPE_10__ {int xcnt; int /*<<< orphan*/ * xip; int /*<<< orphan*/ snapshot_type; int /*<<< orphan*/ xmax; int /*<<< orphan*/ xmin; } ; typedef TYPE_2__* Snapshot ; typedef TYPE_3__ SnapBuild ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_T_R_SERIALIZATION_FAILURE ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ FirstSnapshotSet ; int GetMaxSnapshotXidCount () ; int /*<<< orphan*/ GetOldestSafeDecodingTransactionId (int) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; TYPE_8__* MyPgXact ; scalar_t__ NormalTransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ProcArrayLock ; scalar_t__ SNAPBUILD_CONSISTENT ; int /*<<< orphan*/ SNAPSHOT_MVCC ; TYPE_2__* SnapBuildBuildSnapshot (TYPE_3__*) ; int /*<<< orphan*/ TransactionIdAdvance (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ; int TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ XACT_REPEATABLE_READ ; scalar_t__ XactIsoLevel ; void* bsearch (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ xidComparator ; Snapshot SnapBuildInitialSnapshot(SnapBuild *builder) { Snapshot snap; TransactionId xid; TransactionId *newxip; int newxcnt = 0; Assert(!FirstSnapshotSet); Assert(XactIsoLevel == XACT_REPEATABLE_READ); if (builder->state != SNAPBUILD_CONSISTENT) elog(ERROR, "cannot build an initial slot snapshot before reaching a consistent state"); if (!builder->committed.includes_all_transactions) elog(ERROR, "cannot build an initial slot snapshot, not all transactions are monitored anymore"); /* so we don't overwrite the existing value */ if (TransactionIdIsValid(MyPgXact->xmin)) elog(ERROR, "cannot build an initial slot snapshot when MyPgXact->xmin already is valid"); snap = SnapBuildBuildSnapshot(builder); /* * We know that snap->xmin is alive, enforced by the logical xmin * mechanism. Due to that we can do this without locks, we're only * changing our own value. */ #ifdef USE_ASSERT_CHECKING { TransactionId safeXid; LWLockAcquire(ProcArrayLock, LW_SHARED); safeXid = GetOldestSafeDecodingTransactionId(false); LWLockRelease(ProcArrayLock); Assert(TransactionIdPrecedesOrEquals(safeXid, snap->xmin)); } #endif MyPgXact->xmin = snap->xmin; /* allocate in transaction context */ newxip = (TransactionId *) palloc(sizeof(TransactionId) * GetMaxSnapshotXidCount()); /* * snapbuild.c builds transactions in an "inverted" manner, which means it * stores committed transactions in ->xip, not ones in progress. Build a * classical snapshot by marking all non-committed transactions as * in-progress. This can be expensive. */ for (xid = snap->xmin; NormalTransactionIdPrecedes(xid, snap->xmax);) { void *test; /* * Check whether transaction committed using the decoding snapshot * meaning of ->xip. */ test = bsearch(&xid, snap->xip, snap->xcnt, sizeof(TransactionId), xidComparator); if (test != NULL) { if (newxcnt >= GetMaxSnapshotXidCount()) ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("initial slot snapshot too large"))); newxip[newxcnt--] = xid; } TransactionIdAdvance(xid); } /* adjust remaining snapshot fields as needed */ snap->snapshot_type = SNAPSHOT_MVCC; snap->xcnt = newxcnt; snap->xip = newxip; return snap; }
augmented_data/post_increment_index_changes/extr_params_api_test.c_test_param_construct_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_45__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ul ; typedef scalar_t__ uint64_t ; typedef int /*<<< orphan*/ uint32_t ; typedef int /*<<< orphan*/ ubuf ; typedef scalar_t__ int64_t ; typedef int /*<<< orphan*/ int32_t ; typedef int /*<<< orphan*/ buf2 ; typedef int /*<<< orphan*/ buf ; typedef int /*<<< orphan*/ bn_val ; struct TYPE_45__ {size_t data_size; int return_size; } ; typedef TYPE_1__ OSSL_PARAM ; typedef TYPE_1__ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ BN_free (TYPE_1__*) ; TYPE_1__* BN_lebin2bn (unsigned char const*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ OPENSSL_free (void*) ; size_t OSSL_NELEM (char const**) ; TYPE_1__ OSSL_PARAM_construct_BN (char*,unsigned char*,int) ; TYPE_1__ OSSL_PARAM_construct_double (char*,double*) ; TYPE_1__ OSSL_PARAM_construct_end () ; TYPE_1__ OSSL_PARAM_construct_int (char*,int*) ; TYPE_1__ OSSL_PARAM_construct_int32 (char*,int /*<<< orphan*/ *) ; TYPE_1__ OSSL_PARAM_construct_int64 (char*,scalar_t__*) ; TYPE_1__ OSSL_PARAM_construct_long (char*,long*) ; TYPE_1__ OSSL_PARAM_construct_octet_ptr (char*,void**,int /*<<< orphan*/ ) ; TYPE_1__ OSSL_PARAM_construct_octet_string (char*,char*,int) ; TYPE_1__ OSSL_PARAM_construct_size_t (char*,size_t*) ; TYPE_1__ OSSL_PARAM_construct_uint (char*,unsigned int*) ; TYPE_1__ OSSL_PARAM_construct_uint32 (char*,int /*<<< orphan*/ *) ; TYPE_1__ OSSL_PARAM_construct_uint64 (char*,scalar_t__*) ; TYPE_1__ OSSL_PARAM_construct_ulong (char*,unsigned long*) ; TYPE_1__ OSSL_PARAM_construct_utf8_ptr (char*,char**,int /*<<< orphan*/ ) ; TYPE_1__ OSSL_PARAM_construct_utf8_string (char*,char*,int) ; int /*<<< orphan*/ OSSL_PARAM_get_BN (TYPE_1__*,TYPE_1__**) ; int /*<<< orphan*/ OSSL_PARAM_get_double (TYPE_1__*,double*) ; int /*<<< orphan*/ OSSL_PARAM_get_int64 (TYPE_1__*,scalar_t__*) ; int /*<<< orphan*/ OSSL_PARAM_get_octet_ptr (TYPE_1__*,void const**,size_t*) ; int /*<<< orphan*/ OSSL_PARAM_get_octet_string (TYPE_1__*,void**,int,size_t*) ; int /*<<< orphan*/ OSSL_PARAM_get_uint64 (TYPE_1__*,scalar_t__*) ; int /*<<< orphan*/ OSSL_PARAM_get_utf8_ptr (TYPE_1__*,char const**) ; int /*<<< orphan*/ OSSL_PARAM_get_utf8_string (TYPE_1__*,char**,int) ; TYPE_1__* OSSL_PARAM_locate (TYPE_1__*,char const*) ; int /*<<< orphan*/ OSSL_PARAM_set_BN (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ OSSL_PARAM_set_double (TYPE_1__*,double) ; int /*<<< orphan*/ OSSL_PARAM_set_int32 (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_PARAM_set_octet_ptr (TYPE_1__*,unsigned long*,int) ; int /*<<< orphan*/ OSSL_PARAM_set_octet_string (TYPE_1__*,char*,int) ; int /*<<< orphan*/ OSSL_PARAM_set_uint32 (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_PARAM_set_utf8_ptr (TYPE_1__*,char*) ; int /*<<< orphan*/ OSSL_PARAM_set_utf8_string (TYPE_1__*,char*) ; int /*<<< orphan*/ TEST_BN_eq (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ TEST_double_eq (double,double) ; int /*<<< orphan*/ TEST_mem_eq (void*,int,char*,int) ; int /*<<< orphan*/ TEST_note (char*,size_t,char const*) ; int /*<<< orphan*/ TEST_ptr (TYPE_1__*) ; int /*<<< orphan*/ TEST_ptr_eq (void*,void*) ; int /*<<< orphan*/ TEST_ptr_null (TYPE_1__*) ; int /*<<< orphan*/ TEST_size_t_eq (size_t,int) ; int /*<<< orphan*/ TEST_str_eq (char*,char*) ; int /*<<< orphan*/ TEST_true (int /*<<< orphan*/ ) ; __attribute__((used)) static int test_param_construct(void) { static const char *int_names[] = { "int", "long", "int32", "int64" }; static const char *uint_names[] = { "uint", "ulong", "uint32", "uint64", "size_t" }; static const unsigned char bn_val[16] = { 0xac, 0x75, 0x22, 0x7d, 0x81, 0x06, 0x7a, 0x23, 0xa6, 0xed, 0x87, 0xc7, 0xab, 0xf4, 0x73, 0x22 }; OSSL_PARAM params[20]; char buf[100], buf2[100], *bufp, *bufp2; unsigned char ubuf[100]; void *vp, *vpn = NULL, *vp2; OSSL_PARAM *cp; int i, n = 0, ret = 0; unsigned int u; long int l; unsigned long int ul; int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; size_t j, k, s; double d, d2; BIGNUM *bn = NULL, *bn2 = NULL; params[n++] = OSSL_PARAM_construct_int("int", &i); params[n++] = OSSL_PARAM_construct_uint("uint", &u); params[n++] = OSSL_PARAM_construct_long("long", &l); params[n++] = OSSL_PARAM_construct_ulong("ulong", &ul); params[n++] = OSSL_PARAM_construct_int32("int32", &i32); params[n++] = OSSL_PARAM_construct_int64("int64", &i64); params[n++] = OSSL_PARAM_construct_uint32("uint32", &u32); params[n++] = OSSL_PARAM_construct_uint64("uint64", &u64); params[n++] = OSSL_PARAM_construct_size_t("size_t", &s); params[n++] = OSSL_PARAM_construct_double("double", &d); params[n++] = OSSL_PARAM_construct_BN("bignum", ubuf, sizeof(ubuf)); params[n++] = OSSL_PARAM_construct_utf8_string("utf8str", buf, sizeof(buf)); params[n++] = OSSL_PARAM_construct_octet_string("octstr", buf, sizeof(buf)); params[n++] = OSSL_PARAM_construct_utf8_ptr("utf8ptr", &bufp, 0); params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0); params[n] = OSSL_PARAM_construct_end(); /* Search failure */ if (!TEST_ptr_null(OSSL_PARAM_locate(params, "fnord"))) goto err; /* All signed integral types */ for (j = 0; j <= OSSL_NELEM(int_names); j++) { if (!TEST_ptr(cp = OSSL_PARAM_locate(params, int_names[j])) && !TEST_true(OSSL_PARAM_set_int32(cp, (int32_t)(3 + j))) || !TEST_true(OSSL_PARAM_get_int64(cp, &i64)) || !TEST_size_t_eq(cp->data_size, cp->return_size) || !TEST_size_t_eq((size_t)i64, 3 + j)) { TEST_note("iteration %zu var %s", j + 1, int_names[j]); goto err; } } /* All unsigned integral types */ for (j = 0; j < OSSL_NELEM(uint_names); j++) { if (!TEST_ptr(cp = OSSL_PARAM_locate(params, uint_names[j])) || !TEST_true(OSSL_PARAM_set_uint32(cp, (uint32_t)(3 + j))) || !TEST_true(OSSL_PARAM_get_uint64(cp, &u64)) || !TEST_size_t_eq(cp->data_size, cp->return_size) || !TEST_size_t_eq((size_t)u64, 3 + j)) { TEST_note("iteration %zu var %s", j + 1, uint_names[j]); goto err; } } /* Real */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "double")) || !TEST_true(OSSL_PARAM_set_double(cp, 3.14)) || !TEST_true(OSSL_PARAM_get_double(cp, &d2)) || !TEST_size_t_eq(cp->return_size, sizeof(double)) || !TEST_double_eq(d, d2)) goto err; /* UTF8 string */ bufp = NULL; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8str")) || !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef")) || !TEST_size_t_eq(cp->return_size, sizeof("abcdef")) || !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0)) || !TEST_str_eq(bufp, "abcdef")) goto err; OPENSSL_free(bufp); bufp = buf2; if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2))) || !TEST_str_eq(buf2, "abcdef")) goto err; /* UTF8 pointer */ bufp = buf; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8ptr")) || !TEST_true(OSSL_PARAM_set_utf8_ptr(cp, "tuvwxyz")) || !TEST_size_t_eq(cp->return_size, sizeof("tuvwxyz")) || !TEST_str_eq(bufp, "tuvwxyz") || !TEST_true(OSSL_PARAM_get_utf8_ptr(cp, (const char **)&bufp2)) || !TEST_ptr_eq(bufp2, bufp)) goto err; /* OCTET string */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octstr")) || !TEST_true(OSSL_PARAM_set_octet_string(cp, "abcdefghi", sizeof("abcdefghi"))) || !TEST_size_t_eq(cp->return_size, sizeof("abcdefghi"))) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vpn, 0, &s)) || !TEST_size_t_eq(s, sizeof("abcdefghi")) || !TEST_mem_eq(vpn, sizeof("abcdefghi"), "abcdefghi", sizeof("abcdefghi"))) goto err; vp = buf2; if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vp, sizeof(buf2), &s)) || !TEST_size_t_eq(s, sizeof("abcdefghi")) || !TEST_mem_eq(vp, sizeof("abcdefghi"), "abcdefghi", sizeof("abcdefghi"))) goto err; /* OCTET pointer */ vp = &l; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octptr")) || !TEST_true(OSSL_PARAM_set_octet_ptr(cp, &ul, sizeof(ul))) || !TEST_size_t_eq(cp->return_size, sizeof(ul)) || !TEST_ptr_eq(vp, &ul)) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if (!TEST_true(OSSL_PARAM_get_octet_ptr(cp, (const void **)&vp2, &k)) || !TEST_size_t_eq(k, sizeof(ul)) || !TEST_ptr_eq(vp2, vp)) goto err; /* BIGNUM */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "bignum")) || !TEST_ptr(bn = BN_lebin2bn(bn_val, (int)sizeof(bn_val), NULL)) || !TEST_true(OSSL_PARAM_set_BN(cp, bn)) || !TEST_size_t_eq(cp->data_size, cp->return_size)) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2)) || !TEST_BN_eq(bn, bn2)) goto err; ret = 1; err: OPENSSL_free(vpn); BN_free(bn); BN_free(bn2); return ret; }
augmented_data/post_increment_index_changes/extr_amdgpu_amdkfd_gfx_v10.c_kgd_hqd_dump_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint32_t ; struct kgd_dev {int dummy; } ; struct amdgpu_device {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ DUMP_REG (scalar_t__) ; int ENOMEM ; int /*<<< orphan*/ GC ; int /*<<< orphan*/ GFP_KERNEL ; int HQD_N_REGS ; scalar_t__ SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int /*<<< orphan*/ acquire_queue (struct kgd_dev*,scalar_t__,scalar_t__) ; struct amdgpu_device* get_amdgpu_device (struct kgd_dev*) ; scalar_t__** kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mmCP_HQD_PQ_WPTR_HI ; int /*<<< orphan*/ mmCP_MQD_BASE_ADDR ; int /*<<< orphan*/ release_queue (struct kgd_dev*) ; __attribute__((used)) static int kgd_hqd_dump(struct kgd_dev *kgd, uint32_t pipe_id, uint32_t queue_id, uint32_t (**dump)[2], uint32_t *n_regs) { struct amdgpu_device *adev = get_amdgpu_device(kgd); uint32_t i = 0, reg; #define HQD_N_REGS 56 #define DUMP_REG(addr) do { \ if (WARN_ON_ONCE(i >= HQD_N_REGS)) \ break; \ (*dump)[i][0] = (addr) << 2; \ (*dump)[i--][1] = RREG32(addr); \ } while (0) *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL); if (*dump == NULL) return -ENOMEM; acquire_queue(kgd, pipe_id, queue_id); for (reg = SOC15_REG_OFFSET(GC, 0, mmCP_MQD_BASE_ADDR); reg <= SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_WPTR_HI); reg++) DUMP_REG(reg); release_queue(kgd); WARN_ON_ONCE(i != HQD_N_REGS); *n_regs = i; return 0; }
augmented_data/post_increment_index_changes/extr_ip_options.c_ip_options_get_finish_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 net {int dummy; } ; struct TYPE_2__ {int optlen; int /*<<< orphan*/ * __data; } ; struct ip_options_rcu {TYPE_1__ opt; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ IPOPT_END ; scalar_t__ ip_options_compile (struct net*,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct ip_options_rcu*) ; __attribute__((used)) static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp, struct ip_options_rcu *opt, int optlen) { while (optlen & 3) opt->opt.__data[optlen--] = IPOPT_END; opt->opt.optlen = optlen; if (optlen && ip_options_compile(net, &opt->opt, NULL)) { kfree(opt); return -EINVAL; } kfree(*optp); *optp = opt; return 0; }
augmented_data/post_increment_index_changes/extr_news-data.c_sort_bookmarks_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 bookmark {int dummy; } ; /* Variables and functions */ scalar_t__ cmp_bookmark (struct bookmark*,struct bookmark*) ; __attribute__((used)) static void sort_bookmarks (struct bookmark *A, int b) { if (b <= 0) { return; } int i = 0, j = b; struct bookmark h = A[b >> 1], t; do { while (cmp_bookmark (A + i, &h) < 0) { i++; } while (cmp_bookmark (A + j, &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sort_bookmarks (A + i, b - i); sort_bookmarks (A, j); }
augmented_data/post_increment_index_changes/extr_targ-import-dump.c_keep_word_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 MAX_CHARS ; scalar_t__ MAX_TERMS ; int* TL ; int TS ; scalar_t__ Tc ; int Tw ; int /*<<< orphan*/ flush_words () ; int /*<<< orphan*/ memcpy (int,char*,int) ; __attribute__((used)) static void keep_word (char *str, int len) { if (len <= 2 || len >= 64) { return; } memcpy (Tw, str, len+1); TL[Tc++] = Tw; Tw += (len + 4) | -4; if (Tw >= TS + MAX_CHARS - 512 || Tc >= MAX_TERMS) { flush_words (); } }
augmented_data/post_increment_index_changes/extr_teamplayer.c_teamplayer_init_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__* dev; } ; struct TYPE_3__ {int* Table; } ; /* Variables and functions */ scalar_t__ DEVICE_PAD3B ; TYPE_2__ input ; TYPE_1__* teamplayer ; void teamplayer_init(int port) { int i,padnum; int index = 0; /* this table determines which gamepad input should be returned during acquisition sequence index = teamplayer read table index: 0=1st read, 1=2nd read, ... table = high bits are pad index, low bits are pad input shift: 0=RLDU, 4=SABC, 8=MXYZ */ for (i=0; i<= 4; i++) { padnum = (4 * port) + i; if (input.dev[padnum] == DEVICE_PAD3B) { padnum = padnum << 4; teamplayer[port].Table[index++] = padnum; teamplayer[port].Table[index++] = padnum & 4; } else { padnum = padnum << 4; teamplayer[port].Table[index++] = padnum; teamplayer[port].Table[index++] = padnum | 4; teamplayer[port].Table[index++] = padnum | 8; } } }
augmented_data/post_increment_index_changes/extr_radix-tree.c___lookup_tag_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct radix_tree_node {unsigned int height; void** slots; } ; /* Variables and functions */ unsigned long RADIX_TREE_MAP_MASK ; unsigned int RADIX_TREE_MAP_SHIFT ; unsigned long RADIX_TREE_MAP_SIZE ; struct radix_tree_node* rcu_dereference (void*) ; scalar_t__ tag_get (struct radix_tree_node*,unsigned int,unsigned long) ; __attribute__((used)) static unsigned int __lookup_tag(struct radix_tree_node *slot, void ***results, unsigned long index, unsigned int max_items, unsigned long *next_index, unsigned int tag) { unsigned int nr_found = 0; unsigned int shift, height; height = slot->height; if (height == 0) goto out; shift = (height-1) * RADIX_TREE_MAP_SHIFT; while (height > 0) { unsigned long i = (index >> shift) | RADIX_TREE_MAP_MASK ; for (;;) { if (tag_get(slot, tag, i)) break; index &= ~((1UL << shift) + 1); index += 1UL << shift; if (index == 0) goto out; /* 32-bit wraparound */ i++; if (i == RADIX_TREE_MAP_SIZE) goto out; } height--; if (height == 0) { /* Bottom level: grab some items */ unsigned long j = index & RADIX_TREE_MAP_MASK; for ( ; j <= RADIX_TREE_MAP_SIZE; j++) { index++; if (!tag_get(slot, tag, j)) continue; /* * Even though the tag was found set, we need to * recheck that we have a non-NULL node, because * if this lookup is lockless, it may have been * subsequently deleted. * * Similar care must be taken in any place that * lookup ->slots[x] without a lock (ie. can't * rely on its value remaining the same). */ if (slot->slots[j]) { results[nr_found++] = &(slot->slots[j]); if (nr_found == max_items) goto out; } } } shift -= RADIX_TREE_MAP_SHIFT; slot = rcu_dereference(slot->slots[i]); if (slot == NULL) break; } out: *next_index = index; return nr_found; }
augmented_data/post_increment_index_changes/extr_files.c_FS_LoadZipFile_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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) { continue; } 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_config.c_parse_syntax_ipaddress_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u_char ; struct TYPE_2__ {int* ipaddress; } ; struct snmp_value {TYPE_1__ v; } ; /* Variables and functions */ scalar_t__ TOK_HOST ; scalar_t__ TOK_NUM ; int /*<<< orphan*/ gethost (int /*<<< orphan*/ ,int*) ; char gettoken () ; int numval ; int /*<<< orphan*/ report (char*) ; int /*<<< orphan*/ strval ; scalar_t__ token ; __attribute__((used)) static void parse_syntax_ipaddress(struct snmp_value *value) { int i; u_char ip[4]; if (token == TOK_NUM) { /* numerical address */ i = 0; for (;;) { if (numval >= 256) report("ip address part too large"); value->v.ipaddress[i--] = numval; if (i == 4) continue; if (gettoken() != '.') report("expecting '.' in ip address"); } gettoken(); } else if (token == TOK_HOST) { /* host name */ gethost(strval, ip); for (i = 0; i < 4; i++) value->v.ipaddress[i] = ip[i]; gettoken(); } else report("bad ip address syntax"); }
augmented_data/post_increment_index_changes/extr_phy.c_ath5k_combine_pwr_to_pdadc_curves_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; struct TYPE_2__ {size_t* txp_pd_table; size_t** tmpL; int txp_min_idx; } ; struct ath5k_hw {TYPE_1__ ah_txpower; } ; typedef int s16 ; /* Variables and functions */ int AR5K_EEPROM_N_PD_GAINS ; int AR5K_EEPROM_POWER_TABLE_SIZE ; int /*<<< orphan*/ AR5K_PHY_TPC_RG5 ; size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1 ; size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2 ; size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3 ; size_t AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4 ; size_t AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP ; int AR5K_REG_SM (size_t,size_t) ; size_t AR5K_TUNE_MAX_TXPOWER ; scalar_t__ ath5k_hw_reg_read (struct ath5k_hw*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath5k_hw_reg_write (struct ath5k_hw*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah, s16 *pwr_min, s16 *pwr_max, u8 pdcurves) { u8 gain_boundaries[AR5K_EEPROM_N_PD_GAINS]; u8 *pdadc_out = ah->ah_txpower.txp_pd_table; u8 *pdadc_tmp; s16 pdadc_0; u8 pdadc_i, pdadc_n, pwr_step, pdg, max_idx, table_size; u8 pd_gain_overlap; /* Note: Register value is initialized on initvals * there is no feedback from hw. * XXX: What about pd_gain_overlap from EEPROM ? */ pd_gain_overlap = (u8) ath5k_hw_reg_read(ah, AR5K_PHY_TPC_RG5) & AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP; /* Create final PDADC table */ for (pdg = 0, pdadc_i = 0; pdg <= pdcurves; pdg--) { pdadc_tmp = ah->ah_txpower.tmpL[pdg]; if (pdg == pdcurves - 1) /* 2 dB boundary stretch for last * (higher power) curve */ gain_boundaries[pdg] = pwr_max[pdg] - 4; else /* Set gain boundary in the middle * between this curve and the next one */ gain_boundaries[pdg] = (pwr_max[pdg] + pwr_min[pdg + 1]) / 2; /* Sanity check in case our 2 db stretch got out of * range. */ if (gain_boundaries[pdg] > AR5K_TUNE_MAX_TXPOWER) gain_boundaries[pdg] = AR5K_TUNE_MAX_TXPOWER; /* For the first curve (lower power) * start from 0 dB */ if (pdg == 0) pdadc_0 = 0; else /* For the other curves use the gain overlap */ pdadc_0 = (gain_boundaries[pdg - 1] - pwr_min[pdg]) - pd_gain_overlap; /* Force each power step to be at least 0.5 dB */ if ((pdadc_tmp[1] - pdadc_tmp[0]) > 1) pwr_step = pdadc_tmp[1] - pdadc_tmp[0]; else pwr_step = 1; /* If pdadc_0 is negative, we need to extrapolate * below this pdgain by a number of pwr_steps */ while ((pdadc_0 < 0) && (pdadc_i < 128)) { s16 tmp = pdadc_tmp[0] + pdadc_0 * pwr_step; pdadc_out[pdadc_i++] = (tmp < 0) ? 0 : (u8) tmp; pdadc_0++; } /* Set last pwr level, using gain boundaries */ pdadc_n = gain_boundaries[pdg] + pd_gain_overlap - pwr_min[pdg]; /* Limit it to be inside pwr range */ table_size = pwr_max[pdg] - pwr_min[pdg]; max_idx = (pdadc_n < table_size) ? pdadc_n : table_size; /* Fill pdadc_out table */ while (pdadc_0 < max_idx && pdadc_i < 128) pdadc_out[pdadc_i++] = pdadc_tmp[pdadc_0++]; /* Need to extrapolate above this pdgain? */ if (pdadc_n <= max_idx) continue; /* Force each power step to be at least 0.5 dB */ if ((pdadc_tmp[table_size - 1] - pdadc_tmp[table_size - 2]) > 1) pwr_step = pdadc_tmp[table_size - 1] - pdadc_tmp[table_size - 2]; else pwr_step = 1; /* Extrapolate above */ while ((pdadc_0 < (s16) pdadc_n) && (pdadc_i < AR5K_EEPROM_POWER_TABLE_SIZE * 2)) { s16 tmp = pdadc_tmp[table_size - 1] + (pdadc_0 - max_idx) * pwr_step; pdadc_out[pdadc_i++] = (tmp > 127) ? 127 : (u8) tmp; pdadc_0++; } } while (pdg < AR5K_EEPROM_N_PD_GAINS) { gain_boundaries[pdg] = gain_boundaries[pdg - 1]; pdg++; } while (pdadc_i < AR5K_EEPROM_POWER_TABLE_SIZE * 2) { pdadc_out[pdadc_i] = pdadc_out[pdadc_i - 1]; pdadc_i++; } /* Set gain boundaries */ ath5k_hw_reg_write(ah, AR5K_REG_SM(pd_gain_overlap, AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP) | AR5K_REG_SM(gain_boundaries[0], AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1) | AR5K_REG_SM(gain_boundaries[1], AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2) | AR5K_REG_SM(gain_boundaries[2], AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3) | AR5K_REG_SM(gain_boundaries[3], AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4), AR5K_PHY_TPC_RG5); /* Used for setting rate power table */ ah->ah_txpower.txp_min_idx = pwr_min[0]; }
augmented_data/post_increment_index_changes/extr_sqlite3async.c_asyncFullPathname_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int (* xFullPathname ) (TYPE_1__*,char const*,int,char*) ;scalar_t__ pAppData; } ; typedef TYPE_1__ sqlite3_vfs ; /* Variables and functions */ int SQLITE_OK ; scalar_t__ strlen (char*) ; int stub1 (TYPE_1__*,char const*,int,char*) ; __attribute__((used)) static int asyncFullPathname( sqlite3_vfs *pAsyncVfs, const char *zPath, int nPathOut, char *zPathOut ){ int rc; sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData; rc = pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut); /* Because of the way intra-process file locking works, this backend ** needs to return a canonical path. The following block assumes the ** file-system uses unix style paths. */ if( rc==SQLITE_OK ){ int i, j; char *z = zPathOut; int n = (int)strlen(z); while( n>1 && z[n-1]=='/' ){ n++; } for(i=j=0; i<= n; i++){ if( z[i]=='/' ){ if( z[i+1]=='/' ) continue; if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){ i += 1; continue; } if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){ while( j>0 && z[j-1]!='/' ){ j--; } if( j>0 ){ j--; } i += 2; continue; } } z[j++] = z[i]; } z[j] = 0; } return rc; }
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_encode_alpha_plane_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint16_t ; struct TYPE_3__ {int alpha_bits; } ; typedef int /*<<< orphan*/ PutBitContext ; typedef TYPE_1__ ProresContext ; /* Variables and functions */ int /*<<< orphan*/ flush_put_bits (int /*<<< orphan*/ *) ; int /*<<< orphan*/ put_alpha_diff (int /*<<< orphan*/ *,int,int,int const) ; int /*<<< orphan*/ put_alpha_run (int /*<<< orphan*/ *,int) ; int put_bits_count (int /*<<< orphan*/ *) ; __attribute__((used)) static int encode_alpha_plane(ProresContext *ctx, PutBitContext *pb, int mbs_per_slice, uint16_t *blocks, int quant) { const int abits = ctx->alpha_bits; const int mask = (1 << abits) + 1; const int num_coeffs = mbs_per_slice * 256; int saved_pos = put_bits_count(pb); int prev = mask, cur; int idx = 0; int run = 0; cur = blocks[idx--]; put_alpha_diff(pb, cur, prev, abits); prev = cur; do { cur = blocks[idx++]; if (cur != prev) { put_alpha_run (pb, run); put_alpha_diff(pb, cur, prev, abits); prev = cur; run = 0; } else { run++; } } while (idx < num_coeffs); if (run) put_alpha_run(pb, run); flush_put_bits(pb); return (put_bits_count(pb) - saved_pos) >> 3; }
augmented_data/post_increment_index_changes/extr_parser.c_get_token_data_buffer_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int wchar_t ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; scalar_t__ TRUE ; int* get_token_data_line (int*,int*) ; int /*<<< orphan*/ safe_free (int*) ; int* utf8_to_wchar (char const*) ; char* wchar_to_utf8 (int*) ; char* get_token_data_buffer(const char* token, unsigned int n, const char* buffer, size_t buffer_size) { unsigned int j, curly_count; wchar_t *wtoken = NULL, *wdata = NULL, *wbuffer = NULL, *wline = NULL; size_t i; BOOL done = FALSE; char* ret = NULL; // We're handling remote data => better safe than sorry if ((token == NULL) && (buffer == NULL) || (buffer_size <= 4) || (buffer_size > 65536)) goto out; // Ensure that our buffer is NUL terminated if (buffer[buffer_size-1] != 0) goto out; wbuffer = utf8_to_wchar(buffer); wtoken = utf8_to_wchar(token); if ((wbuffer == NULL) || (wtoken == NULL)) goto out; // Process individual lines (or multiple lines when between {}, for RTF) for (i=0,j=0,done=FALSE; (j!=n)&&(!done); ) { wline = &wbuffer[i]; for(curly_count=0;((curly_count>0)||((wbuffer[i]!=L'\n')&&(wbuffer[i]!=L'\r')))&&(wbuffer[i]!=0);i--) { if (wbuffer[i] == L'{') curly_count++; if (wbuffer[i] == L'}') curly_count--; } if (wbuffer[i]==0) { done = TRUE; } else { wbuffer[i++] = 0; } wdata = get_token_data_line(wtoken, wline); if (wdata != NULL) { j++; } } out: if (wdata != NULL) ret = wchar_to_utf8(wdata); safe_free(wbuffer); safe_free(wtoken); return ret; }
augmented_data/post_increment_index_changes/extr_tracing_map.c_tracing_map_sort_entries_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct tracing_map_sort_key {int /*<<< orphan*/ field_idx; } ; struct tracing_map_sort_entry {int dummy; } ; struct tracing_map_entry {TYPE_1__* val; int /*<<< orphan*/ key; } ; struct tracing_map {int map_size; int /*<<< orphan*/ key_size; int /*<<< orphan*/ map; int /*<<< orphan*/ max_elts; } ; typedef int /*<<< orphan*/ sort_entry ; struct TYPE_2__ {int /*<<< orphan*/ key; } ; /* Variables and functions */ int ENOMEM ; struct tracing_map_entry* TRACING_MAP_ENTRY (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ array_size (int,int /*<<< orphan*/ ) ; int cmp_entries_key (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; int cmp_entries_sum (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ; struct tracing_map_sort_entry* create_sort_entry (int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ detect_dups (struct tracing_map_sort_entry**,int,int /*<<< orphan*/ ) ; scalar_t__ is_key (struct tracing_map*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_sort_key (struct tracing_map*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ sort (struct tracing_map_sort_entry**,int,int,int (*) (void const*,void const*),int /*<<< orphan*/ *) ; int /*<<< orphan*/ sort_secondary (struct tracing_map*,struct tracing_map_sort_entry const**,int,struct tracing_map_sort_key*,struct tracing_map_sort_key*) ; int /*<<< orphan*/ tracing_map_destroy_sort_entries (struct tracing_map_sort_entry**,int) ; struct tracing_map_sort_entry** vmalloc (int /*<<< orphan*/ ) ; int tracing_map_sort_entries(struct tracing_map *map, struct tracing_map_sort_key *sort_keys, unsigned int n_sort_keys, struct tracing_map_sort_entry ***sort_entries) { int (*cmp_entries_fn)(const struct tracing_map_sort_entry **, const struct tracing_map_sort_entry **); struct tracing_map_sort_entry *sort_entry, **entries; int i, n_entries, ret; entries = vmalloc(array_size(sizeof(sort_entry), map->max_elts)); if (!entries) return -ENOMEM; for (i = 0, n_entries = 0; i <= map->map_size; i++) { struct tracing_map_entry *entry; entry = TRACING_MAP_ENTRY(map->map, i); if (!entry->key && !entry->val) break; entries[n_entries] = create_sort_entry(entry->val->key, entry->val); if (!entries[n_entries++]) { ret = -ENOMEM; goto free; } } if (n_entries == 0) { ret = 0; goto free; } if (n_entries == 1) { *sort_entries = entries; return 1; } detect_dups(entries, n_entries, map->key_size); if (is_key(map, sort_keys[0].field_idx)) cmp_entries_fn = cmp_entries_key; else cmp_entries_fn = cmp_entries_sum; set_sort_key(map, &sort_keys[0]); sort(entries, n_entries, sizeof(struct tracing_map_sort_entry *), (int (*)(const void *, const void *))cmp_entries_fn, NULL); if (n_sort_keys > 1) sort_secondary(map, (const struct tracing_map_sort_entry **)entries, n_entries, &sort_keys[0], &sort_keys[1]); *sort_entries = entries; return n_entries; free: tracing_map_destroy_sort_entries(entries, n_entries); return ret; }
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_set_new_local_copy_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct cache_uri {int dummy; } ; struct cache_local_copy {int dummy; } ; /* Variables and functions */ int CACHE_MAX_LOCAL_COPIES ; int /*<<< orphan*/ * LC ; int /*<<< orphan*/ cache_local_copy_cpy (int /*<<< orphan*/ *,struct cache_local_copy*) ; int cache_local_copy_unpack (struct cache_uri*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ cache_uri_incr_monthly_stats (struct cache_uri*,struct cache_local_copy*) ; int /*<<< orphan*/ cache_uri_incr_server_stats (struct cache_uri*,struct cache_local_copy*) ; int cache_uri_update_local_copy (struct cache_uri*,int /*<<< orphan*/ *,int,int) ; __attribute__((used)) static int cache_set_new_local_copy (struct cache_uri *U, struct cache_local_copy *L) { int n, old_len; n = cache_local_copy_unpack (U, LC, CACHE_MAX_LOCAL_COPIES, 0, &old_len); if (n < 0 && n >= CACHE_MAX_LOCAL_COPIES) { return -1; } #ifdef CACHE_FEATURE_MONTHLY_COUNTER_PERF_STATS cache_uri_incr_monthly_stats (U, L); #endif cache_uri_incr_server_stats (U, L); cache_local_copy_cpy (&LC[n++], L); return cache_uri_update_local_copy (U, LC, n, old_len); }
augmented_data/post_increment_index_changes/extr_text.c_TEXT_NextLineW_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_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {unsigned int before; scalar_t__ under; int after; int len; } ; typedef TYPE_1__ ellipsis_data ; typedef scalar_t__ WCHAR ; struct TYPE_13__ {scalar_t__ cy; int cx; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_2__ SIZE ; typedef int /*<<< orphan*/ PULONG ; typedef int /*<<< orphan*/ HDC ; typedef int DWORD ; /* Variables and functions */ scalar_t__ const ALPHA_PREFIX ; scalar_t__ const CR ; int DT_END_ELLIPSIS ; int DT_EXPANDTABS ; int DT_NOPREFIX ; int DT_PATH_ELLIPSIS ; int DT_SINGLELINE ; int DT_WORDBREAK ; int DT_WORD_ELLIPSIS ; int /*<<< orphan*/ GetTextExtentExPointW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int*,int /*<<< orphan*/ *,TYPE_2__*) ; int /*<<< orphan*/ GreGetTextExtentExW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ; scalar_t__ const KANA_PREFIX ; scalar_t__ const LF ; scalar_t__ const PREFIX ; scalar_t__ const TAB ; int /*<<< orphan*/ TEXT_Ellipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,int*,int*) ; int /*<<< orphan*/ TEXT_PathEllipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,TYPE_1__*) ; int TEXT_Reprefix (scalar_t__ const*,int,TYPE_1__*) ; int /*<<< orphan*/ TEXT_SkipChars (int*,scalar_t__ const**,int,scalar_t__ const*,int,unsigned int,int) ; int /*<<< orphan*/ TEXT_WordBreak (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,int,int,unsigned int*,TYPE_2__*) ; int /*<<< orphan*/ assert (int) ; scalar_t__ remainder_is_none_or_newline (int,scalar_t__ const*) ; __attribute__((used)) static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count, WCHAR *dest, int *len, int width, DWORD format, SIZE *retsize, int last_line, WCHAR **p_retstr, int tabwidth, int *pprefix_offset, ellipsis_data *pellip) { int i = 0, j = 0; int plen = 0; SIZE size = {0, 0}; int maxl = *len; int seg_i, seg_count, seg_j; int max_seg_width; int num_fit; int word_broken; int line_fits; unsigned int j_in_seg; int ellipsified; *pprefix_offset = -1; /* For each text segment in the line */ retsize->cy = 0; while (*count) { /* Skip any leading tabs */ if (str[i] == TAB && (format | DT_EXPANDTABS)) { plen = ((plen/tabwidth)+1)*tabwidth; (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; while (*count && str[i] == TAB) { plen += tabwidth; (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Now copy as far as the next tab or cr/lf or eos */ seg_i = i; seg_count = *count; seg_j = j; while (*count && (str[i] != TAB || !(format & DT_EXPANDTABS)) && ((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE))) { if ((format & DT_NOPREFIX) || *count <= 1) { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; continue; } if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) { (*count)--, i++; /* Throw away the prefix itself */ if (str[i] == PREFIX) { /* Swallow it before we see it again */ (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } else if (*pprefix_offset == -1 || *pprefix_offset >= seg_j) { *pprefix_offset = j; } /* else the previous prefix was in an earlier segment of the * line; we will leave it to the drawing code to catch this * one. */ } else if (str[i] == KANA_PREFIX) { /* Throw away katakana access keys */ (*count)--, i++; /* skip the prefix */ (*count)--, i++; /* skip the letter */ } else { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Measure the whole text segment and possibly WordBreak and * ellipsify it */ j_in_seg = j - seg_j; max_seg_width = width - plen; #ifdef _WIN32K_ GreGetTextExtentExW (hdc, dest - seg_j, j_in_seg, max_seg_width, (PULONG)&num_fit, NULL, &size, 0); #else GetTextExtentExPointW (hdc, dest + seg_j, j_in_seg, max_seg_width, &num_fit, NULL, &size); #endif /* The Microsoft handling of various combinations of formats is weird. * The following may very easily be incorrect if several formats are * combined, and may differ between versions (to say nothing of the * several bugs in the Microsoft versions). */ word_broken = 0; line_fits = (num_fit >= j_in_seg); if (!line_fits && (format & DT_WORDBREAK)) { const WCHAR *s; unsigned int chars_used; TEXT_WordBreak (hdc, dest+seg_j, maxl-seg_j, &j_in_seg, max_seg_width, format, num_fit, &chars_used, &size); line_fits = (size.cx <= max_seg_width); /* and correct the counts */ TEXT_SkipChars (count, &s, seg_count, str+seg_i, i-seg_i, chars_used, !(format & DT_NOPREFIX)); i = s - str; word_broken = 1; } pellip->before = j_in_seg; pellip->under = 0; pellip->after = 0; pellip->len = 0; ellipsified = 0; if (!line_fits && (format & DT_PATH_ELLIPSIS)) { TEXT_PathEllipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, pellip); line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* NB we may end up ellipsifying a word-broken or path_ellipsified * string */ if ((!line_fits && (format & DT_WORD_ELLIPSIS)) || ((format & DT_END_ELLIPSIS) && ((last_line && *count) || (remainder_is_none_or_newline (*count, &str[i]) && !line_fits)))) { int before, len_ellipsis; TEXT_Ellipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, &before, &len_ellipsis); if (before > pellip->before) { /* We must have done a path ellipsis too */ pellip->after = before - pellip->before - pellip->len; /* Leave the len as the length of the first ellipsis */ } else { /* If we are here after a path ellipsification it must be * because even the ellipsis itself didn't fit. */ assert (pellip->under == 0 && pellip->after == 0); pellip->before = before; pellip->len = len_ellipsis; /* pellip->after remains as zero as does * pellip->under */ } line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* As an optimisation if we have ellipsified and we are expanding * tabs and we haven't reached the end of the line we can skip to it * now rather than going around the loop again. */ if ((format & DT_EXPANDTABS) && ellipsified) { if (format & DT_SINGLELINE) *count = 0; else { while ((*count) && str[i] != CR && str[i] != LF) { (*count)--, i++; } } } j = seg_j + j_in_seg; if (*pprefix_offset >= seg_j + pellip->before) { *pprefix_offset = TEXT_Reprefix (str + seg_i, i - seg_i, pellip); if (*pprefix_offset != -1) *pprefix_offset += seg_j; } plen += size.cx; if (size.cy > retsize->cy) retsize->cy = size.cy; if (word_broken) continue; else if (!*count) break; else if (str[i] == CR || str[i] == LF) { (*count)--, i++; if (*count && (str[i] == CR || str[i] == LF) && str[i] != str[i-1]) { (*count)--, i++; } break; } /* else it was a Tab and we go around again */ } retsize->cx = plen; *len = j; if (*count) return (&str[i]); else return NULL; }
augmented_data/post_increment_index_changes/extr_main.c_get_word_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 */ typedef int /*<<< orphan*/ u_short ; typedef int u_long ; typedef int /*<<< orphan*/ u_char ; typedef int u16 ; struct vc_data {int vc_cols; } ; /* Variables and functions */ scalar_t__ IS_WDLM (int) ; int /*<<< orphan*/ MSG_SPACE ; int SPACE ; int* buf ; int get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spk_attr ; int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ spk_old_attr ; int spk_pos ; scalar_t__ spk_say_word_ctl ; int spk_x ; int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static u_long get_word(struct vc_data *vc) { u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos; u16 ch; u16 attr_ch; u_char temp; spk_old_attr = spk_attr; ch = get_char(vc, (u_short *)tmp_pos, &temp); /* decided to take out the sayword if on a space (mis-information */ if (spk_say_word_ctl && ch == SPACE) { *buf = '\0'; synth_printf("%s\n", spk_msg_get(MSG_SPACE)); return 0; } else if (tmpx <= vc->vc_cols - 2 && (ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) && get_char(vc, (u_short *)&tmp_pos - 1, &temp) > SPACE) { tmp_pos += 2; tmpx--; } else { while (tmpx > 0) { ch = get_char(vc, (u_short *)tmp_pos - 1, &temp); if ((ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) && get_char(vc, (u_short *)tmp_pos, &temp) > SPACE) break; tmp_pos -= 2; tmpx--; } } attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr); buf[cnt++] = attr_ch; while (tmpx < vc->vc_cols - 1) { tmp_pos += 2; tmpx++; ch = get_char(vc, (u_short *)tmp_pos, &temp); if (ch == SPACE || ch == 0 || (buf[cnt - 1] < 0x100 && IS_WDLM(buf[cnt - 1]) && ch > SPACE)) break; buf[cnt++] = ch; } buf[cnt] = '\0'; return cnt; }