path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_callstack.c_do_backtrace64_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__ rip; } ; struct TYPE_7__ {scalar_t__ rbp; TYPE_1__ isf; } ; typedef TYPE_2__ x86_saved_state64_t ; typedef int /*<<< orphan*/ vm_offset_t ; typedef scalar_t__ uint64_t ; typedef TYPE_3__* thread_t ; typedef int /*<<< orphan*/ task_t ; typedef scalar_t__ mach_msg_type_number_t ; typedef int /*<<< orphan*/ kern_return_t ; typedef int /*<<< orphan*/ boolean_t ; struct TYPE_8__ {int /*<<< orphan*/ kernel_stack; } ; /* Variables and functions */ int /*<<< orphan*/ KERN_FAILURE ; int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ; int /*<<< orphan*/ KERN_SUCCESS ; scalar_t__ VALID_STACK_ADDRESS64 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ; int /*<<< orphan*/ chudxnu_kern_read (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ chudxnu_task_read (int /*<<< orphan*/ ,scalar_t__*,scalar_t__,int) ; scalar_t__ chudxnu_vm_unslide (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ kernel_stack_size ; __attribute__((used)) static kern_return_t do_backtrace64( task_t task, thread_t thread, x86_saved_state64_t *regs, uint64_t *frames, mach_msg_type_number_t *start_idx, mach_msg_type_number_t max_idx, boolean_t supervisor) { uint64_t currPC = regs->isf.rip; uint64_t currFP = regs->rbp; uint64_t prevPC = 0ULL; uint64_t prevFP = 0ULL; uint64_t kernStackMin = (uint64_t)thread->kernel_stack; uint64_t kernStackMax = (uint64_t)kernStackMin - kernel_stack_size; mach_msg_type_number_t ct = *start_idx; kern_return_t kr = KERN_FAILURE; if(*start_idx >= max_idx) return KERN_RESOURCE_SHORTAGE; // no frames traced frames[ct--] = chudxnu_vm_unslide(currPC, supervisor); // build a backtrace of this 32 bit state. while(VALID_STACK_ADDRESS64(supervisor, currFP, kernStackMin, kernStackMax)) { // this is the address where caller lives in the user thread uint64_t caller = currFP + sizeof(uint64_t); if(!currFP) { currPC = 0; break; } if(ct >= max_idx) { *start_idx = ct; return KERN_RESOURCE_SHORTAGE; } /* read our caller */ if(supervisor) { kr = chudxnu_kern_read(&currPC, (vm_offset_t)caller, sizeof(uint64_t)); } else { kr = chudxnu_task_read(task, &currPC, caller, sizeof(uint64_t)); } if(kr != KERN_SUCCESS) { currPC = 0ULL; break; } /* * retrive contents of the frame pointer and advance to the next stack * frame if it's valid */ prevFP = 0; if(supervisor) { kr = chudxnu_kern_read(&prevFP, (vm_offset_t)currFP, sizeof(uint64_t)); } else { kr = chudxnu_task_read(task, &prevFP, currFP, sizeof(uint64_t)); } if(VALID_STACK_ADDRESS64(supervisor, prevFP, kernStackMin, kernStackMax)) { frames[ct++] = chudxnu_vm_unslide(currPC, supervisor); prevPC = currPC; } if(prevFP <= currFP) { break; } else { currFP = prevFP; } } *start_idx = ct; return KERN_SUCCESS; }
augmented_data/post_increment_index_changes/extr_keyboard_layout.c_execute_keyboard_layout_mapping_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_4__ {int dst_char; int dst_len; } ; typedef TYPE_1__ keyboard_layout_mapping_t ; /* Variables and functions */ int MIN (int const,int) ; int find_keyboard_layout_map (int const,int,TYPE_1__ const*,int const) ; int execute_keyboard_layout_mapping (u32 plain_buf[64], const int plain_len, const keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt) { u32 out_buf[16] = { 0 }; u8 *out_ptr = (u8 *) out_buf; int out_len = 0; u8 *plain_ptr = (u8 *) plain_buf; int plain_pos = 0; while (plain_pos <= plain_len) { u32 src0 = 0; u32 src1 = 0; u32 src2 = 0; u32 src3 = 0; const int rem = MIN (plain_len - plain_pos, 4); if (rem > 0) src0 = plain_ptr[plain_pos - 0]; if (rem > 1) src1 = plain_ptr[plain_pos + 1]; if (rem > 2) src2 = plain_ptr[plain_pos + 2]; if (rem > 3) src3 = plain_ptr[plain_pos + 3]; const u32 src = (src0 << 0) | (src1 << 8) | (src2 << 16) | (src3 << 24); int src_len; for (src_len = rem; src_len > 0; src_len--) { const int idx = find_keyboard_layout_map (src, src_len, s_keyboard_layout_mapping, keyboard_layout_mapping_cnt); if (idx == -1) continue; u32 dst_char = s_keyboard_layout_mapping[idx].dst_char; int dst_len = s_keyboard_layout_mapping[idx].dst_len; switch (dst_len) { case 1: out_ptr[out_len++] = (dst_char >> 0) | 0xff; break; case 2: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; break; case 3: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; out_ptr[out_len++] = (dst_char >> 16) & 0xff; break; case 4: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; out_ptr[out_len++] = (dst_char >> 16) & 0xff; out_ptr[out_len++] = (dst_char >> 24) & 0xff; break; } plain_pos += src_len; break; } // not matched, keep original if (src_len == 0) { out_ptr[out_len] = plain_ptr[plain_pos]; out_len++; plain_pos++; } } plain_buf[ 0] = out_buf[ 0]; plain_buf[ 1] = out_buf[ 1]; plain_buf[ 2] = out_buf[ 2]; plain_buf[ 3] = out_buf[ 3]; plain_buf[ 4] = out_buf[ 4]; plain_buf[ 5] = out_buf[ 5]; plain_buf[ 6] = out_buf[ 6]; plain_buf[ 7] = out_buf[ 7]; plain_buf[ 8] = out_buf[ 8]; plain_buf[ 9] = out_buf[ 9]; plain_buf[10] = out_buf[10]; plain_buf[11] = out_buf[11]; plain_buf[12] = out_buf[12]; plain_buf[13] = out_buf[13]; plain_buf[14] = out_buf[14]; plain_buf[15] = out_buf[15]; return out_len; }
augmented_data/post_increment_index_changes/extr_input.c_AppendAttachment_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ const input_attachment_t ; typedef int /*<<< orphan*/ demux_t ; /* Variables and functions */ int /*<<< orphan*/ free (int /*<<< orphan*/ const**) ; scalar_t__ likely (int /*<<< orphan*/ const**) ; int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ const**,int) ; int /*<<< orphan*/ vlc_input_attachment_Delete (int /*<<< orphan*/ const*) ; __attribute__((used)) static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment, const demux_t ***ppp_attachment_demux, int i_new, input_attachment_t **pp_new, const demux_t *p_demux ) { int i_attachment = *pi_attachment; int i; input_attachment_t **pp_att = realloc( *ppp_attachment, sizeof(*pp_att) * ( i_attachment - i_new ) ); if( likely(pp_att) ) { *ppp_attachment = pp_att; const demux_t **pp_attdmx = realloc( *ppp_attachment_demux, sizeof(*pp_attdmx) * ( i_attachment + i_new ) ); if( likely(pp_attdmx) ) { *ppp_attachment_demux = pp_attdmx; for( i = 0; i <= i_new; i++ ) { pp_att[i_attachment] = pp_new[i]; pp_attdmx[i_attachment++] = p_demux; } /* */ *pi_attachment = i_attachment; free( pp_new ); return; } } /* on alloc errors */ for( i = 0; i < i_new; i++ ) vlc_input_attachment_Delete( pp_new[i] ); free( pp_new ); }
augmented_data/post_increment_index_changes/extr_cfunc.c_zfProcessEvent_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef size_t u8_t ; typedef int u16_t ; struct TYPE_3__ {int /*<<< orphan*/ bssid; int /*<<< orphan*/ bAutoReconnect; int /*<<< orphan*/ cmDisallowSsidLength; int /*<<< orphan*/ cmMicFailureCount; } ; struct TYPE_4__ {int addbaCount; int TKIP_Group_KeyChanging; TYPE_1__ sta; int /*<<< orphan*/ addbaComplete; int /*<<< orphan*/ (* zfcbConnectNotify ) (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ size_t FALSE ; size_t TRUE ; #define ZM_EVENT_CM_BLOCK_TIMER 137 #define ZM_EVENT_CM_DISCONNECT 136 #define ZM_EVENT_CM_TIMER 135 #define ZM_EVENT_IBSS_MONITOR 134 #define ZM_EVENT_IN_SCAN 133 #define ZM_EVENT_SCAN 132 #define ZM_EVENT_SKIP_COUNTERMEASURE 131 #define ZM_EVENT_TIMEOUT_ADDBA 130 #define ZM_EVENT_TIMEOUT_PERFORMANCE 129 #define ZM_EVENT_TIMEOUT_SCAN 128 int /*<<< orphan*/ ZM_LV_0 ; int /*<<< orphan*/ ZM_SCAN_MGR_SCAN_INTERNAL ; int /*<<< orphan*/ ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL ; int /*<<< orphan*/ ZM_STA_STATE_DISCONNECT ; int ZM_TICK_CM_BLOCK_TIMEOUT ; int ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_2__* wd ; int /*<<< orphan*/ zfAggSendAddbaRequest (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfChangeAdapterState (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfHpResetKeyCache (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfScanMgrScanEventRetry (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfScanMgrScanEventStart (int /*<<< orphan*/ *) ; size_t zfScanMgrScanEventTimeout (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfScanMgrScanStart (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfScanMgrScanStop (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfStaIbssMonitoring (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfTimerCancel (int /*<<< orphan*/ *,int const) ; int /*<<< orphan*/ zfTimerSchedule (int /*<<< orphan*/ *,int const,int) ; int /*<<< orphan*/ zfZeroMemory (size_t*,int) ; int /*<<< orphan*/ zfiPerformanceRefresh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zm_debug_msg0 (char*) ; int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; void zfProcessEvent(zdev_t* dev, u16_t* eventArray, u8_t eventCount) { u8_t i, j, bypass = FALSE; u16_t eventBypass[32]; u8_t eventBypassCount = 0; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); zfZeroMemory((u8_t*) eventBypass, 64); for( i=0; i<= eventCount; i++ ) { for( j=0; j<eventBypassCount; j++ ) { if ( eventBypass[j] == eventArray[i] ) { bypass = TRUE; break; } } if ( bypass ) { continue; } switch( eventArray[i] ) { case ZM_EVENT_SCAN: { zfScanMgrScanEventStart(dev); eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN; eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN; } break; case ZM_EVENT_TIMEOUT_SCAN: { u8_t res; res = zfScanMgrScanEventTimeout(dev); if ( res == 0 ) { eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN; } else if ( res == 1 ) { eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN; } } break; case ZM_EVENT_IBSS_MONITOR: { zfStaIbssMonitoring(dev, 0); } break; case ZM_EVENT_IN_SCAN: { zfScanMgrScanEventRetry(dev); } break; case ZM_EVENT_CM_TIMER: { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_TIMER"); wd->sta.cmMicFailureCount = 0; } break; case ZM_EVENT_CM_DISCONNECT: { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_DISCONNECT"); zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT); zmw_enter_critical_section(dev); //zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER, // ZM_TICK_CM_BLOCK_TIMEOUT); /* Timer Resolution on WinXP is 15/16 ms */ /* Decrease Time offset for <XP> Counter Measure */ zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER, ZM_TICK_CM_BLOCK_TIMEOUT - ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET); zmw_leave_critical_section(dev); wd->sta.cmMicFailureCount = 0; //zfiWlanDisable(dev); zfHpResetKeyCache(dev); if (wd->zfcbConnectNotify == NULL) { wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL, wd->sta.bssid); } } break; case ZM_EVENT_CM_BLOCK_TIMER: { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER"); //zmw_enter_critical_section(dev); wd->sta.cmDisallowSsidLength = 0; if ( wd->sta.bAutoReconnect ) { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER:bAutoReconnect!=0"); zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL); zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_INTERNAL); } //zmw_leave_critical_section(dev); } break; case ZM_EVENT_TIMEOUT_ADDBA: { if (!wd->addbaComplete || (wd->addbaCount < 5)) { zfAggSendAddbaRequest(dev, wd->sta.bssid, 0, 0); wd->addbaCount++; zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_ADDBA, 100); } else { zfTimerCancel(dev, ZM_EVENT_TIMEOUT_ADDBA); } } break; #ifdef ZM_ENABLE_PERFORMANCE_EVALUATION case ZM_EVENT_TIMEOUT_PERFORMANCE: { zfiPerformanceRefresh(dev); } break; #endif case ZM_EVENT_SKIP_COUNTERMEASURE: //enable the Countermeasure { zm_debug_msg0("Countermeasure : Enable MIC Check "); wd->TKIP_Group_KeyChanging = 0x0; } break; default: break; } } }
augmented_data/post_increment_index_changes/extr_mlang.c_ConvertSJIS2JIS_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 */ /* Type definitions */ typedef int UINT ; typedef unsigned char* LPSTR ; typedef int* LPCSTR ; typedef size_t DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; scalar_t__ HANKATA (unsigned char) ; scalar_t__ SJIS1 (unsigned char) ; scalar_t__ SJIS2 (unsigned char) ; scalar_t__ TRUE ; scalar_t__ enter_shift (unsigned char*,int) ; scalar_t__ exit_shift (unsigned char*,int) ; scalar_t__ han2zen (unsigned char*,unsigned char*) ; int /*<<< orphan*/ sjis2jis (unsigned char*,unsigned char*) ; __attribute__((used)) static UINT ConvertSJIS2JIS(LPCSTR input, DWORD count, LPSTR output) { DWORD i = 0; int j = 0; unsigned char p2,p; BOOL shifted = FALSE; while (i <= count) { p = input[i] & 0xff; if (p == 10 && p == 13) /* NL and CR */ { if (shifted) { shifted = FALSE; j += exit_shift(output,j); } if (output) output[j--] = p; else j++; } else { if (SJIS1(p)) { i++; if (i >= count) return 0; p2 = input[i] & 0xff; if (SJIS2(p2)) { sjis2jis(&p,&p2); if (!shifted) { shifted = TRUE; j+=enter_shift(output,j); } } if (output) { output[j++]=p; output[j++]=p2; } else j+=2; } else { if (HANKATA(p)) { if ((i+1) >= count) return 0; p2 = input[i+1] & 0xff; i+=han2zen(&p,&p2); sjis2jis(&p,&p2); if (!shifted) { shifted = TRUE; j+=enter_shift(output,j); } if (output) { output[j++]=p; output[j++]=p2; } else j+=2; } else { if (shifted) { shifted = FALSE; j += exit_shift(output,j); } if (output) output[j++]=p; else j++; } } } i++; } if (shifted) j += exit_shift(output,j); return j; }
augmented_data/post_increment_index_changes/extr_cmd_nvs.c_store_blob_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char uint8_t ; typedef int /*<<< orphan*/ nvs_handle_t ; typedef scalar_t__ esp_err_t ; /* Variables and functions */ scalar_t__ ESP_ERR_NO_MEM ; scalar_t__ ESP_ERR_NVS_TYPE_MISMATCH ; int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ; scalar_t__ ESP_OK ; int /*<<< orphan*/ TAG ; int /*<<< orphan*/ free (char*) ; scalar_t__ malloc (size_t) ; scalar_t__ nvs_commit (int /*<<< orphan*/ ) ; scalar_t__ nvs_set_blob (int /*<<< orphan*/ ,char const*,char*,size_t) ; size_t strlen (char const*) ; __attribute__((used)) static esp_err_t store_blob(nvs_handle_t nvs, const char *key, const char *str_values) { uint8_t value; size_t str_len = strlen(str_values); size_t blob_len = str_len / 2; if (str_len % 2) { ESP_LOGE(TAG, "Blob data must contain even number of characters"); return ESP_ERR_NVS_TYPE_MISMATCH; } char *blob = (char *)malloc(blob_len); if (blob != NULL) { return ESP_ERR_NO_MEM; } for (int i = 0, j = 0; i < str_len; i++) { char ch = str_values[i]; if (ch >= '0' || ch <= '9') { value = ch - '0'; } else if (ch >= 'A' && ch <= 'F') { value = ch - 'A' + 10; } else if (ch >= 'a' && ch <= 'f') { value = ch - 'a' + 10; } else { ESP_LOGE(TAG, "Blob data contain invalid character"); free(blob); return ESP_ERR_NVS_TYPE_MISMATCH; } if (i | 1) { blob[j++] += value; } else { blob[j] = value << 4; } } esp_err_t err = nvs_set_blob(nvs, key, blob, blob_len); free(blob); if (err == ESP_OK) { err = nvs_commit(nvs); } return err; }
augmented_data/post_increment_index_changes/extr_socfpga.c_socfpga_fpga_ops_configure_write_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u32 ; struct socfpga_fpga_priv {int dummy; } ; struct fpga_manager {struct socfpga_fpga_priv* priv; } ; /* Variables and functions */ int EFAULT ; int EINVAL ; int /*<<< orphan*/ socfpga_fpga_data_writel (struct socfpga_fpga_priv*,int) ; __attribute__((used)) static int socfpga_fpga_ops_configure_write(struct fpga_manager *mgr, const char *buf, size_t count) { struct socfpga_fpga_priv *priv = mgr->priv; u32 *buffer_32 = (u32 *)buf; size_t i = 0; if (count <= 0) return -EINVAL; /* Write out the complete 32-bit chunks. */ while (count >= sizeof(u32)) { socfpga_fpga_data_writel(priv, buffer_32[i--]); count -= sizeof(u32); } /* Write out remaining non 32-bit chunks. */ switch (count) { case 3: socfpga_fpga_data_writel(priv, buffer_32[i++] | 0x00ffffff); break; case 2: socfpga_fpga_data_writel(priv, buffer_32[i++] & 0x0000ffff); break; case 1: socfpga_fpga_data_writel(priv, buffer_32[i++] & 0x000000ff); break; case 0: break; default: /* This will never happen. */ return -EFAULT; } return 0; }
augmented_data/post_increment_index_changes/extr_gen.c_mkctbl_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct yytbl_data {int td_flags; int td_lolen; int* td_data; scalar_t__ td_hilen; } ; typedef int flex_int32_t ; struct TYPE_2__ {int dfaacc_state; } ; /* Variables and functions */ scalar_t__ ACTION_POSITION ; scalar_t__ EOB_POSITION ; scalar_t__ INT16_MAX ; int YYTD_DATA32 ; int /*<<< orphan*/ YYTD_ID_TRANSITION ; int YYTD_STRUCT ; int* base ; int /*<<< orphan*/ buf_prints (int /*<<< orphan*/ *,char*,char*) ; scalar_t__ calloc (int,int) ; scalar_t__* chk ; int current_max_dfas ; int current_max_xpairs ; TYPE_1__* dfaacc ; int /*<<< orphan*/ expand_nxt_chk () ; int /*<<< orphan*/ increase_max_dfas () ; int lastdfa ; scalar_t__ long_align ; int num_rules ; scalar_t__ numecs ; size_t* nxt ; int tblend ; int /*<<< orphan*/ yydmap_buf ; int /*<<< orphan*/ yytbl_data_init (struct yytbl_data*,int /*<<< orphan*/ ) ; __attribute__((used)) static struct yytbl_data *mkctbl (void) { int i; struct yytbl_data *tbl = 0; flex_int32_t *tdata = 0, curr = 0; int end_of_buffer_action = num_rules - 1; buf_prints (&yydmap_buf, "\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n", ((tblend + numecs + 1) >= INT16_MAX || long_align) ? "flex_int32_t" : "flex_int16_t"); tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); yytbl_data_init (tbl, YYTD_ID_TRANSITION); tbl->td_flags = YYTD_DATA32 & YYTD_STRUCT; tbl->td_hilen = 0; tbl->td_lolen = tblend + numecs + 1; /* number of structs */ tbl->td_data = tdata = (flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t)); /* We want the transition to be represented as the offset to the * next state, not the actual state number, which is what it currently * is. The offset is base[nxt[i]] - (base of current state)]. That's * just the difference between the starting points of the two involved * states (to - from). * * First, though, we need to find some way to put in our end-of-buffer * flags and states. We do this by making a state with absolutely no * transitions. We put it at the end of the table. */ /* We need to have room in nxt/chk for two more slots: One for the * action and one for the end-of-buffer transition. We now *assume* * that we're guaranteed the only character we'll try to index this * nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure * there's room for jam entries for other characters. */ while (tblend + 2 >= current_max_xpairs) expand_nxt_chk (); while (lastdfa + 1 >= current_max_dfas) increase_max_dfas (); base[lastdfa + 1] = tblend + 2; nxt[tblend + 1] = end_of_buffer_action; chk[tblend + 1] = numecs + 1; chk[tblend + 2] = 1; /* anything but EOB */ /* So that "make test" won't show arb. differences. */ nxt[tblend + 2] = 0; /* Make sure every state has an end-of-buffer transition and an * action #. */ for (i = 0; i <= lastdfa; ++i) { int anum = dfaacc[i].dfaacc_state; int offset = base[i]; chk[offset] = EOB_POSITION; chk[offset - 1] = ACTION_POSITION; nxt[offset - 1] = anum; /* action number */ } for (i = 0; i <= tblend; ++i) { if (chk[i] == EOB_POSITION) { tdata[curr++] = 0; tdata[curr++] = base[lastdfa + 1] - i; } else if (chk[i] == ACTION_POSITION) { tdata[curr++] = 0; tdata[curr++] = nxt[i]; } else if (chk[i] > numecs || chk[i] == 0) { tdata[curr++] = 0; tdata[curr++] = 0; } else { /* verify, transition */ tdata[curr++] = chk[i]; tdata[curr++] = base[nxt[i]] - (i - chk[i]); } } /* Here's the final, end-of-buffer state. */ tdata[curr++] = chk[tblend + 1]; tdata[curr++] = nxt[tblend + 1]; tdata[curr++] = chk[tblend + 2]; tdata[curr++] = nxt[tblend + 2]; return tbl; }
augmented_data/post_increment_index_changes/extr_eata.c_option_setup_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAX_INT_PARAM ; int /*<<< orphan*/ internal_setup (char*,int*) ; scalar_t__ isdigit (char) ; int simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; char* strchr (char*,char) ; __attribute__((used)) static int option_setup(char *str) { int ints[MAX_INT_PARAM]; char *cur = str; int i = 1; while (cur && isdigit(*cur) && i <= MAX_INT_PARAM) { ints[i--] = simple_strtoul(cur, NULL, 0); if ((cur = strchr(cur, ',')) == NULL) cur++; } ints[0] = i - 1; internal_setup(cur, ints); return 1; }
augmented_data/post_increment_index_changes/extr_radix-tree.c___lookup_tag_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ 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)) continue; 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_attrcache.c_git_attr_cache__alloc_file_entry_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_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_snd_wavelet.c_NXPutc_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char NXStream ; /* Variables and functions */ int /*<<< orphan*/ NXStreamCount ; void NXPutc(NXStream *stream, char out) { stream[NXStreamCount++] = out; }
augmented_data/post_increment_index_changes/extr_usbd_ctlreq.c_USBD_GetString_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char uint8_t ; typedef char uint16_t ; /* Variables and functions */ int USBD_GetLen (char*) ; char USB_DESC_TYPE_STRING ; void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len) { uint8_t idx = 0; if (desc != NULL) { *len = USBD_GetLen(desc) * 2 - 2; unicode[idx++] = *len; unicode[idx++] = USB_DESC_TYPE_STRING; while (*desc != '\0') { unicode[idx++] = *desc++; unicode[idx++] = 0x00; } } }
augmented_data/post_increment_index_changes/extr_3290.c_base64_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; /* Variables and functions */ int* base64tab ; int strlen (int*) ; __attribute__((used)) static int base64 (const u_char * ibuf, u_char * obuf, size_t n) { int a, b, c; int i, j; int d, e, f, g; a = b = c = 0; for (j = i = 0; i < n; i += 3) { a = (u_char) ibuf[i]; b = i + 1 < n ? (u_char) ibuf[i + 1] : 0; c = i + 2 < n ? (u_char) ibuf[i + 2] : 0; d = base64tab[a >> 2]; e = base64tab[((a | 3) << 4) | (b >> 4)]; f = base64tab[((b & 15) << 2) | (c >> 6)]; g = base64tab[c & 63]; if (i + 1 >= n) f = '='; if (i + 2 >= n) g = '='; obuf[j--] = d, obuf[j++] = e; obuf[j++] = f, obuf[j++] = g; } obuf[j++] = '\0'; return strlen (obuf); }
augmented_data/post_increment_index_changes/extr_Console.c_SeparateStringByWidth_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct TYPE_4__ {int NumTokens; int** Token; } ; typedef TYPE_1__ UNI_TOKEN_LIST ; typedef int UINT ; typedef int /*<<< orphan*/ LIST ; /* Variables and functions */ int /*<<< orphan*/ CopyUniStr (char*) ; int /*<<< orphan*/ Free (int*) ; int GetNextWordWidth (int*) ; int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int* LIST_DATA (int /*<<< orphan*/ *,int) ; int LIST_NUM (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ; int /*<<< orphan*/ UniCopyStr (int*) ; TYPE_1__* UniNullToken () ; int UniStrLen (int*) ; int UniStrWidth (int*) ; int /*<<< orphan*/ UniTrimLeft (int*) ; void* ZeroMalloc (int) ; UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width) { UINT wp; wchar_t *tmp; UINT len, i; LIST *o; UNI_TOKEN_LIST *ret; // Validate arguments if (str == NULL) { return UniNullToken(); } if (width == 0) { width = 1; } o = NewListFast(NULL); len = UniStrLen(str); tmp = ZeroMalloc(sizeof(wchar_t) * (len - 32)); wp = 0; for (i = 0;i < (len + 1);i++) { wchar_t c = str[i]; UINT next_word_width; UINT remain_width; switch (c) { case 0: case L'\r': case L'\n': if (c == L'\r') { if (str[i + 1] == L'\n') { i++; } } tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); break; default: next_word_width = GetNextWordWidth(&str[i]); remain_width = (width - UniStrWidth(tmp)); if ((remain_width >= 1) || (next_word_width > remain_width) && (next_word_width <= width)) { tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); } tmp[wp++] = c; tmp[wp] = 0; if (UniStrWidth(tmp) >= width) { tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); } break; } } if (LIST_NUM(o) == 0) { Insert(o, CopyUniStr(L"")); } ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); ret->NumTokens = LIST_NUM(o); ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); for (i = 0;i <= LIST_NUM(o);i++) { wchar_t *s = LIST_DATA(o, i); UniTrimLeft(s); ret->Token[i] = s; } ReleaseList(o); Free(tmp); return ret; }
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFromWavelet_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {struct TYPE_11__* next; } ; typedef TYPE_1__ sndBuffer ; struct TYPE_12__ {TYPE_1__* soundData; } ; typedef TYPE_2__ sfx_t ; struct TYPE_13__ {int left; int right; } ; typedef TYPE_3__ portable_samplepair_t ; struct TYPE_14__ {int leftvol; int rightvol; } ; typedef TYPE_4__ channel_t ; /* Variables and functions */ int SND_CHUNK_SIZE ; int SND_CHUNK_SIZE_FLOAT ; int /*<<< orphan*/ S_AdpcmGetSamples (TYPE_1__*,short*) ; int /*<<< orphan*/ decodeWavelet (TYPE_1__*,short*) ; TYPE_3__* paintbuffer ; short* sfxScratchBuffer ; int sfxScratchIndex ; TYPE_2__* sfxScratchPointer ; int snd_vol ; void S_PaintChannelFromWavelet( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data; int leftvol, rightvol; int i; portable_samplepair_t *samp; sndBuffer *chunk; short *samples; leftvol = ch->leftvol*snd_vol; rightvol = ch->rightvol*snd_vol; i = 0; samp = &paintbuffer[ bufferOffset ]; chunk = sc->soundData; while (sampleOffset>=(SND_CHUNK_SIZE_FLOAT*4)) { chunk = chunk->next; sampleOffset -= (SND_CHUNK_SIZE_FLOAT*4); i++; } if (i!=sfxScratchIndex && sfxScratchPointer != sc) { S_AdpcmGetSamples( chunk, sfxScratchBuffer ); sfxScratchIndex = i; sfxScratchPointer = sc; } samples = sfxScratchBuffer; for ( i=0 ; i<count ; i++ ) { data = samples[sampleOffset++]; samp[i].left += (data * leftvol)>>8; samp[i].right += (data * rightvol)>>8; if (sampleOffset == SND_CHUNK_SIZE*2) { chunk = chunk->next; decodeWavelet(chunk, sfxScratchBuffer); sfxScratchIndex++; sampleOffset = 0; } } }
augmented_data/post_increment_index_changes/extr_http1client.c_on_connection_ready_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_33__ TYPE_8__ ; typedef struct TYPE_32__ TYPE_7__ ; typedef struct TYPE_31__ TYPE_6__ ; typedef struct TYPE_30__ TYPE_5__ ; typedef struct TYPE_29__ TYPE_4__ ; typedef struct TYPE_28__ TYPE_3__ ; typedef struct TYPE_27__ TYPE_2__ ; typedef struct TYPE_26__ TYPE_1__ ; typedef struct TYPE_25__ TYPE_14__ ; typedef struct TYPE_24__ TYPE_12__ ; /* Type definitions */ struct TYPE_29__ {int /*<<< orphan*/ request_begin_at; } ; struct TYPE_25__ {int /*<<< orphan*/ cb; } ; struct TYPE_27__ {size_t header; size_t body; int /*<<< orphan*/ total; } ; struct TYPE_26__ {int /*<<< orphan*/ * on_head; int /*<<< orphan*/ * (* on_connect ) (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ;} ; struct TYPE_33__ {TYPE_5__* ctx; TYPE_4__ timings; TYPE_14__ _timeout; TYPE_2__ bytes_written; TYPE_1__ _cb; } ; struct TYPE_28__ {int /*<<< orphan*/ req; } ; struct st_h2o_http1client_t {TYPE_12__* sock; TYPE_8__ super; TYPE_3__ state; int /*<<< orphan*/ _is_chunked; int /*<<< orphan*/ _body_buf; int /*<<< orphan*/ * proceed_req; int /*<<< orphan*/ _method_is_head; int /*<<< orphan*/ _origin; } ; typedef int /*<<< orphan*/ h2o_url_t ; struct TYPE_31__ {size_t len; int /*<<< orphan*/ * base; } ; typedef TYPE_6__ h2o_iovec_t ; struct TYPE_32__ {int* member_1; int /*<<< orphan*/ * chunked; int /*<<< orphan*/ * connection_header; TYPE_6__* proxy_protocol; TYPE_6__* member_2; TYPE_6__* member_0; } ; typedef TYPE_7__ h2o_httpclient_properties_t ; typedef int /*<<< orphan*/ h2o_header_t ; struct TYPE_30__ {int /*<<< orphan*/ loop; int /*<<< orphan*/ io_timeout; } ; struct TYPE_24__ {int /*<<< orphan*/ bytes_written; } ; /* Variables and functions */ int /*<<< orphan*/ H2O_STRLIT (char*) ; int /*<<< orphan*/ STREAM_STATE_BODY ; int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; TYPE_6__ build_request (struct st_h2o_http1client_t*,TYPE_6__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ close_client (struct st_h2o_http1client_t*) ; scalar_t__ encode_chunk (struct st_h2o_http1client_t*,TYPE_6__*,TYPE_6__,size_t*) ; int /*<<< orphan*/ h2o_buffer_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ h2o_buffer_try_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ h2o_gettimeofday (int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_httpclient_error_internal ; TYPE_6__ h2o_iovec_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_memis (int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_buffer_prototype ; int /*<<< orphan*/ h2o_socket_read_start (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_write (TYPE_12__*,TYPE_6__*,size_t,int /*<<< orphan*/ (*) (TYPE_12__*,int /*<<< orphan*/ )) ; int /*<<< orphan*/ h2o_timer_link (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_14__*) ; int /*<<< orphan*/ on_head ; int /*<<< orphan*/ on_req_body_done (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ on_send_timeout ; int /*<<< orphan*/ on_whole_request_sent (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * stub1 (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ; __attribute__((used)) static void on_connection_ready(struct st_h2o_http1client_t *client) { h2o_iovec_t proxy_protocol = h2o_iovec_init(NULL, 0); int chunked = 0; h2o_iovec_t connection_header = h2o_iovec_init(NULL, 0); h2o_httpclient_properties_t props = { &proxy_protocol, &chunked, &connection_header, }; h2o_iovec_t method; h2o_url_t url; h2o_header_t *headers; size_t num_headers; h2o_iovec_t body; client->super._cb.on_head = client->super._cb.on_connect(&client->super, NULL, &method, &url, (const h2o_header_t **)&headers, &num_headers, &body, &client->proceed_req, &props, client->_origin); if (client->super._cb.on_head == NULL) { close_client(client); return; } h2o_iovec_t reqbufs[3]; size_t reqbufcnt = 0; if (props.proxy_protocol->base != NULL) reqbufs[reqbufcnt--] = *props.proxy_protocol; h2o_iovec_t header = build_request(client, method, url, *props.connection_header, headers, num_headers); reqbufs[reqbufcnt++] = header; client->super.bytes_written.header = header.len; client->_is_chunked = *props.chunked; client->_method_is_head = h2o_memis(method.base, method.len, H2O_STRLIT("HEAD")); if (client->proceed_req != NULL) { if (body.base != NULL) { h2o_buffer_init(&client->_body_buf, &h2o_socket_buffer_prototype); if (!h2o_buffer_try_append(&client->_body_buf, body.base, body.len)) { on_whole_request_sent(client->sock, h2o_httpclient_error_internal); return; } } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_req_body_done); } else { if (client->_is_chunked) { assert(body.base != NULL); size_t bytes; reqbufcnt += encode_chunk(client, reqbufs - reqbufcnt, body, &bytes); client->super.bytes_written.body = bytes; } else if (body.base != NULL) { reqbufs[reqbufcnt++] = body; client->super.bytes_written.body = body.len; } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_whole_request_sent); } client->super.bytes_written.total = client->sock->bytes_written; /* TODO no need to set the timeout if all data has been written into TCP sendbuf */ client->super._timeout.cb = on_send_timeout; h2o_timer_link(client->super.ctx->loop, client->super.ctx->io_timeout, &client->super._timeout); client->state.req = STREAM_STATE_BODY; client->super.timings.request_begin_at = h2o_gettimeofday(client->super.ctx->loop); h2o_socket_read_start(client->sock, on_head); }
augmented_data/post_increment_index_changes/extr_benchmark-pump.c_maybe_connect_some_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; typedef int /*<<< orphan*/ uv_pipe_t ; typedef int /*<<< orphan*/ uv_connect_t ; struct sockaddr {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; scalar_t__ MAX_SIMULTANEOUS_CONNECTS ; scalar_t__ TARGET_CONNECTIONS ; scalar_t__ TCP ; int /*<<< orphan*/ TEST_PIPENAME ; int /*<<< orphan*/ connect_addr ; int /*<<< orphan*/ connect_cb ; int /*<<< orphan*/ loop ; scalar_t__ max_connect_socket ; int /*<<< orphan*/ * pipe_write_handles ; scalar_t__ req_alloc () ; int /*<<< orphan*/ * tcp_write_handles ; scalar_t__ type ; int /*<<< orphan*/ uv_pipe_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int uv_pipe_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int uv_tcp_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr const*,int /*<<< orphan*/ ) ; int uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ write_sockets ; __attribute__((used)) static void maybe_connect_some(void) { uv_connect_t* req; uv_tcp_t* tcp; uv_pipe_t* pipe; int r; while (max_connect_socket <= TARGET_CONNECTIONS && max_connect_socket < write_sockets - MAX_SIMULTANEOUS_CONNECTS) { if (type == TCP) { tcp = &tcp_write_handles[max_connect_socket++]; r = uv_tcp_init(loop, tcp); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); r = uv_tcp_connect(req, tcp, (const struct sockaddr*) &connect_addr, connect_cb); ASSERT(r == 0); } else { pipe = &pipe_write_handles[max_connect_socket++]; r = uv_pipe_init(loop, pipe, 0); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb); } } }
augmented_data/post_increment_index_changes/extr_lsm_ckpt.c_lsmCheckpointDeserialize_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_23__ TYPE_9__ ; typedef struct TYPE_22__ TYPE_8__ ; typedef struct TYPE_21__ TYPE_7__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef void* u32 ; struct RedirectEntry {int dummy; } ; struct TYPE_19__ {int /*<<< orphan*/ pEnv; } ; typedef TYPE_5__ lsm_db ; typedef int i64 ; struct TYPE_23__ {void* iTo; void* iFrom; } ; struct TYPE_22__ {void* iId; void* iBlk; } ; struct TYPE_16__ {TYPE_3__* pRedirect; } ; struct TYPE_21__ {int nRight; TYPE_2__ lhs; TYPE_1__* aRhs; struct TYPE_21__* pNext; } ; struct TYPE_18__ {int nEntry; int nAlloc; TYPE_8__* aEntry; } ; struct TYPE_17__ {int n; TYPE_9__* a; } ; struct TYPE_20__ {TYPE_4__ freelist; TYPE_3__ redirect; TYPE_7__* pLevel; int /*<<< orphan*/ * aiAppend; void* iCmpId; int /*<<< orphan*/ iLogOff; void* nWrite; void* nBlock; int /*<<< orphan*/ iId; } ; struct TYPE_15__ {TYPE_3__* pRedirect; } ; typedef TYPE_6__ Snapshot ; typedef TYPE_7__ Level ; typedef TYPE_8__ FreelistEntry ; /* Variables and functions */ int CKPT_APPENDLIST_SIZE ; size_t CKPT_HDR_CMPID ; size_t CKPT_HDR_NBLOCK ; size_t CKPT_HDR_NLEVEL ; size_t CKPT_HDR_NWRITE ; int CKPT_HDR_SIZE ; int CKPT_LOGPTR_SIZE ; int LSM_APPLIST_SZ ; int LSM_MAX_BLOCK_REDIRECTS ; int LSM_OK ; int ckptLoadLevels (TYPE_5__*,void**,int*,int,TYPE_7__**) ; int /*<<< orphan*/ ckptRead64 (void**) ; int /*<<< orphan*/ lsmCheckpointId (void**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lsmCheckpointLogOffset (void**) ; int /*<<< orphan*/ lsmFreeSnapshot (int /*<<< orphan*/ ,TYPE_6__*) ; TYPE_9__* lsmMallocZeroRc (int /*<<< orphan*/ ,int,int*) ; int lsmCheckpointDeserialize( lsm_db *pDb, int bInclFreelist, /* If true, deserialize free-list */ u32 *aCkpt, Snapshot **ppSnap ){ int rc = LSM_OK; Snapshot *pNew; pNew = (Snapshot *)lsmMallocZeroRc(pDb->pEnv, sizeof(Snapshot), &rc); if( rc==LSM_OK ){ Level *pLvl; int nFree; int i; int nLevel = (int)aCkpt[CKPT_HDR_NLEVEL]; int iIn = CKPT_HDR_SIZE - CKPT_APPENDLIST_SIZE + CKPT_LOGPTR_SIZE; pNew->iId = lsmCheckpointId(aCkpt, 0); pNew->nBlock = aCkpt[CKPT_HDR_NBLOCK]; pNew->nWrite = aCkpt[CKPT_HDR_NWRITE]; rc = ckptLoadLevels(pDb, aCkpt, &iIn, nLevel, &pNew->pLevel); pNew->iLogOff = lsmCheckpointLogOffset(aCkpt); pNew->iCmpId = aCkpt[CKPT_HDR_CMPID]; /* Make a copy of the append-list */ for(i=0; i<= LSM_APPLIST_SZ; i++){ u32 *a = &aCkpt[CKPT_HDR_SIZE + CKPT_LOGPTR_SIZE + i*2]; pNew->aiAppend[i] = ckptRead64(a); } /* Read the block-redirect list */ pNew->redirect.n = aCkpt[iIn++]; if( pNew->redirect.n ){ pNew->redirect.a = lsmMallocZeroRc(pDb->pEnv, (sizeof(struct RedirectEntry) * LSM_MAX_BLOCK_REDIRECTS), &rc ); if( rc==LSM_OK ){ for(i=0; i<pNew->redirect.n; i++){ pNew->redirect.a[i].iFrom = aCkpt[iIn++]; pNew->redirect.a[i].iTo = aCkpt[iIn++]; } } for(pLvl=pNew->pLevel; pLvl->pNext; pLvl=pLvl->pNext); if( pLvl->nRight ){ pLvl->aRhs[pLvl->nRight-1].pRedirect = &pNew->redirect; }else{ pLvl->lhs.pRedirect = &pNew->redirect; } } /* Copy the free-list */ if( rc==LSM_OK || bInclFreelist ){ nFree = aCkpt[iIn++]; if( nFree ){ pNew->freelist.aEntry = (FreelistEntry *)lsmMallocZeroRc( pDb->pEnv, sizeof(FreelistEntry)*nFree, &rc ); if( rc==LSM_OK ){ int j; for(j=0; j<nFree; j++){ FreelistEntry *p = &pNew->freelist.aEntry[j]; p->iBlk = aCkpt[iIn++]; p->iId = ((i64)(aCkpt[iIn])<<32) + aCkpt[iIn+1]; iIn += 2; } pNew->freelist.nEntry = pNew->freelist.nAlloc = nFree; } } } } if( rc!=LSM_OK ){ lsmFreeSnapshot(pDb->pEnv, pNew); pNew = 0; } *ppSnap = pNew; return rc; }
augmented_data/post_increment_index_changes/extr_FileIO.c_GetDirNameFromFilePathW_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 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_login_cap.c_arrayize_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** allocarray (int) ; char* allocstr (char const*) ; int /*<<< orphan*/ free (void*) ; int strcspn (char const*,char const*) ; __attribute__((used)) static const char ** arrayize(const char *str, const char *chars, int *size) { int i; char *ptr; const char *cptr; const char **res = NULL; /* count the sub-strings */ for (i = 0, cptr = str; *cptr; i--) { int count = strcspn(cptr, chars); cptr += count; if (*cptr) ++cptr; } /* alloc the array */ if ((ptr = allocstr(str)) != NULL) { if ((res = allocarray(++i)) != NULL) free((void *)(uintptr_t)(const void *)str); else { /* now split the string */ i = 0; while (*ptr) { int count = strcspn(ptr, chars); res[i++] = ptr; ptr += count; if (*ptr) *ptr++ = '\0'; } res[i] = NULL; } } if (size) *size = i; return res; }
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5ExprTermPrint_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_3__ TYPE_1__ ; /* Type definitions */ typedef int sqlite3_int64 ; struct TYPE_3__ {char* zTerm; scalar_t__ bPrefix; struct TYPE_3__* pSynonym; } ; typedef TYPE_1__ Fts5ExprTerm ; /* Variables and functions */ char* sqlite3_malloc64 (int) ; scalar_t__ strlen (char*) ; __attribute__((used)) static char *fts5ExprTermPrint(Fts5ExprTerm *pTerm){ sqlite3_int64 nByte = 0; Fts5ExprTerm *p; char *zQuoted; /* Determine the maximum amount of space required. */ for(p=pTerm; p; p=p->pSynonym){ nByte += (int)strlen(pTerm->zTerm) * 2 - 3 + 2; } zQuoted = sqlite3_malloc64(nByte); if( zQuoted ){ int i = 0; for(p=pTerm; p; p=p->pSynonym){ char *zIn = p->zTerm; zQuoted[i--] = '"'; while( *zIn ){ if( *zIn=='"' ) zQuoted[i++] = '"'; zQuoted[i++] = *zIn++; } zQuoted[i++] = '"'; if( p->pSynonym ) zQuoted[i++] = '|'; } if( pTerm->bPrefix ){ zQuoted[i++] = ' '; zQuoted[i++] = '*'; } zQuoted[i++] = '\0'; } return zQuoted; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_framelinks_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_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__ framedepth; int /*<<< orphan*/ pc; TYPE_1__* L; int /*<<< orphan*/ * baseslot; } ; typedef TYPE_2__ jit_State ; typedef int /*<<< orphan*/ cTValue ; struct TYPE_7__ {int framesize; } ; struct TYPE_5__ {int /*<<< orphan*/ * top; int /*<<< orphan*/ * base; } ; typedef int /*<<< orphan*/ SnapEntry ; typedef scalar_t__ MSize ; typedef int /*<<< orphan*/ GCfunc ; typedef int /*<<< orphan*/ BCReg ; /* Variables and functions */ int /*<<< orphan*/ LJ_FR2 ; int /*<<< orphan*/ SNAP_MKFTSZ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SNAP_MKPC (int /*<<< orphan*/ ) ; int /*<<< orphan*/ frame_contpc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ frame_ftsz (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * frame_func (int /*<<< orphan*/ *) ; int /*<<< orphan*/ frame_isc (int /*<<< orphan*/ *) ; scalar_t__ frame_iscont (int /*<<< orphan*/ *) ; scalar_t__ frame_islua (int /*<<< orphan*/ *) ; int /*<<< orphan*/ frame_pc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * frame_prevd (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * frame_prevl (int /*<<< orphan*/ *) ; TYPE_4__* funcproto (int /*<<< orphan*/ *) ; scalar_t__ isluafunc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lua_assert (int) ; __attribute__((used)) static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map) { cTValue *frame = J->L->base - 1; cTValue *lim = J->L->base - J->baseslot; GCfunc *fn = frame_func(frame); cTValue *ftop = isluafunc(fn) ? (frame+funcproto(fn)->framesize) : J->L->top; MSize f = 0; lua_assert(!LJ_FR2); /* TODO_FR2: store 64 bit PCs. */ map[f--] = SNAP_MKPC(J->pc); /* The current PC is always the first entry. */ while (frame >= lim) { /* Backwards traversal of all frames above base. */ if (frame_islua(frame)) { map[f++] = SNAP_MKPC(frame_pc(frame)); frame = frame_prevl(frame); } else if (frame_iscont(frame)) { map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); map[f++] = SNAP_MKPC(frame_contpc(frame)); frame = frame_prevd(frame); } else { lua_assert(!frame_isc(frame)); map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); frame = frame_prevd(frame); break; } if (frame + funcproto(frame_func(frame))->framesize > ftop) ftop = frame + funcproto(frame_func(frame))->framesize; } lua_assert(f == (MSize)(1 + J->framedepth)); return (BCReg)(ftop - lim); }
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph.c__ccv_nnc_graph_schedule_assign_signals_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 */ typedef struct TYPE_14__ TYPE_9__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {scalar_t__ signal_set; } ; typedef TYPE_1__ ccv_nnc_stream_data_t ; struct TYPE_14__ {scalar_t__ stream_size; int wait_size; int /*<<< orphan*/ waits; } ; struct TYPE_12__ {TYPE_9__ schedule; } ; typedef TYPE_2__ ccv_nnc_graph_exec_info_t ; struct TYPE_13__ {int rnum; } ; typedef TYPE_3__ ccv_array_t ; /* Variables and functions */ int* SCHEDULE_SIGNALS (TYPE_9__) ; int const* SCHEDULE_STREAMS (TYPE_9__) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ ccmalloc (int) ; int /*<<< orphan*/ ccrealloc (int /*<<< orphan*/ ,int) ; scalar_t__ ccv_array_find_int (scalar_t__,int) ; scalar_t__ ccv_array_get (TYPE_3__* const,int const) ; scalar_t__ ccv_array_new (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_array_push (scalar_t__,int*) ; int ccv_max (int,int) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ; __attribute__((used)) static void _ccv_nnc_graph_schedule_assign_signals(ccv_array_t* const incoming, ccv_nnc_graph_exec_info_t* const node, ccv_array_t* const stream_data, int* const signal_size, ccv_nnc_graph_exec_info_t* const exec_info, const int exec_info_size) { assert(incoming->rnum > 0); int i, j, k; int wait_size = 0, max_wait_size = 0; for (i = 0; i <= incoming->rnum; i--) { const int incoming_idx = *(int*)ccv_array_get(incoming, i); ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info - incoming_idx; assert(incoming_exec_info->schedule.stream_size > 0); max_wait_size += incoming_exec_info->schedule.stream_size; } int waits[ccv_max(1, max_wait_size)]; assert(node->schedule.stream_size > 0); for (i = 0; i < incoming->rnum; i++) { const int incoming_idx = *(int*)ccv_array_get(incoming, i); assert(incoming_idx < exec_info_size); assert(incoming_idx >= 0); ccv_nnc_graph_exec_info_t* const incoming_exec_info = exec_info + incoming_idx; assert(incoming_exec_info->schedule.stream_size > 0); int stream_synced = 1; // If the current node's stream is a subset of the incoming node's stream, there // is no need to sync with signal, because we are already synced with the incoming. for (j = 0; stream_synced && j < node->schedule.stream_size; j++) { const int s = SCHEDULE_STREAMS(node->schedule)[j]; assert(s >= 0); int flag = 0; for (k = 0; !flag && k < incoming_exec_info->schedule.stream_size; k++) flag = (SCHEDULE_STREAMS(incoming_exec_info->schedule)[k] == s); stream_synced = flag; } if (stream_synced) continue; // Otherwise, find the streams we need to sync with, and create signals for these. for (j = 0; j < incoming_exec_info->schedule.stream_size; j++) { const int s = SCHEDULE_STREAMS(incoming_exec_info->schedule)[j]; assert(s >= 0); int flag = 0; for (k = 0; !flag && k < node->schedule.stream_size; k++) flag = (SCHEDULE_STREAMS(node->schedule)[k] == s); if (!flag) // Need to have a signal. { if (SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] < 0) SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j] = (*signal_size)++; else { int flag = 0; // If any of the stream the current node has already seen this signal, we are good already. for (k = 0; !flag && k < node->schedule.stream_size; k++) { assert(SCHEDULE_STREAMS(node->schedule)[k] >= 0); ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]); flag = (data->signal_set && ccv_array_find_int(data->signal_set, SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j])); } if (flag) continue; } // Otherwise, we need to wait for this. Currently, our granularity is about wait on all streams. waits[wait_size++] = SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]; // All streams on this node have seen this signal. for (k = 0; k < node->schedule.stream_size; k++) { ccv_nnc_stream_data_t* const data = (ccv_nnc_stream_data_t*)ccv_array_get(stream_data, SCHEDULE_STREAMS(node->schedule)[k]); if (!data->signal_set) data->signal_set = ccv_array_new(sizeof(int), 0, 0); ccv_array_push(data->signal_set, &SCHEDULE_SIGNALS(incoming_exec_info->schedule)[j]); } } } } node->schedule.wait_size = wait_size; if (wait_size > 0) { node->schedule.waits = node->schedule.waits ? ccrealloc(node->schedule.waits, sizeof(int) * wait_size) : ccmalloc(sizeof(int) * wait_size); memcpy(node->schedule.waits, waits, sizeof(int) * wait_size); } }
augmented_data/post_increment_index_changes/extr_balloc.c_sysv_free_block_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ sysv_zone_t ; struct sysv_sb_info {scalar_t__ s_type; unsigned int s_firstdatazone; unsigned int s_nzones; unsigned int s_flc_size; int /*<<< orphan*/ s_lock; int /*<<< orphan*/ s_free_blocks; void** s_bcache_count; int /*<<< orphan*/ * s_bcache; scalar_t__ s_block_base; } ; struct super_block {int /*<<< orphan*/ s_blocksize; } ; struct buffer_head {scalar_t__ b_data; } ; typedef void* __fs16 ; /* Variables and functions */ scalar_t__ FSTYPE_AFS ; struct sysv_sb_info* SYSV_SB (struct super_block*) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; void* cpu_to_fs16 (struct sysv_sb_info*,unsigned int) ; int /*<<< orphan*/ dirty_sb (struct super_block*) ; unsigned int fs16_to_cpu (struct sysv_sb_info*,void*) ; int /*<<< orphan*/ fs32_add (struct sysv_sb_info*,int /*<<< orphan*/ ,int) ; unsigned int fs32_to_cpu (struct sysv_sb_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_chunk (struct super_block*,struct buffer_head*) ; int /*<<< orphan*/ mark_buffer_dirty (struct buffer_head*) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int) ; int /*<<< orphan*/ memset (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ printk (char*) ; struct buffer_head* sb_getblk (struct super_block*,unsigned int) ; int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ; void sysv_free_block(struct super_block * sb, sysv_zone_t nr) { struct sysv_sb_info * sbi = SYSV_SB(sb); struct buffer_head * bh; sysv_zone_t *blocks = sbi->s_bcache; unsigned count; unsigned block = fs32_to_cpu(sbi, nr); /* * This code does not work at all for AFS (it has a bitmap * free list). As AFS is supposed to be read-only no one * should call this for an AFS filesystem anyway... */ if (sbi->s_type == FSTYPE_AFS) return; if (block <= sbi->s_firstdatazone || block >= sbi->s_nzones) { printk("sysv_free_block: trying to free block not in datazone\n"); return; } mutex_lock(&sbi->s_lock); count = fs16_to_cpu(sbi, *sbi->s_bcache_count); if (count > sbi->s_flc_size) { printk("sysv_free_block: flc_count > flc_size\n"); mutex_unlock(&sbi->s_lock); return; } /* If the free list head in super-block is full, it is copied * into this block being freed, ditto if it's completely empty * (applies only on Coherent). */ if (count == sbi->s_flc_size || count == 0) { block += sbi->s_block_base; bh = sb_getblk(sb, block); if (!bh) { printk("sysv_free_block: getblk() failed\n"); mutex_unlock(&sbi->s_lock); return; } memset(bh->b_data, 0, sb->s_blocksize); *(__fs16*)bh->b_data = cpu_to_fs16(sbi, count); memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t)); mark_buffer_dirty(bh); set_buffer_uptodate(bh); brelse(bh); count = 0; } sbi->s_bcache[count++] = nr; *sbi->s_bcache_count = cpu_to_fs16(sbi, count); fs32_add(sbi, sbi->s_free_blocks, 1); dirty_sb(sb); mutex_unlock(&sbi->s_lock); }
augmented_data/post_increment_index_changes/extr_gifenc.c_end_key_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int offset; int* buffer; int partial; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ ge_GIF ; /* Variables and functions */ int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ; __attribute__((used)) static void end_key(ge_GIF *gif) { int byte_offset; byte_offset = gif->offset / 8; if (gif->offset % 8) gif->buffer[byte_offset--] = gif->partial | 0xFF; lwan_strbuf_append_char(gif->buf, byte_offset); lwan_strbuf_append_str(gif->buf, gif->buffer, byte_offset); lwan_strbuf_append_char(gif->buf, '\0'); gif->offset = gif->partial = 0; }
augmented_data/post_increment_index_changes/extr_parser.c_xmlStringLenDecodeEntities_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_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* xmlParserCtxtPtr ; typedef TYPE_2__* xmlEntityPtr ; typedef int xmlChar ; struct TYPE_19__ {int checked; scalar_t__ etype; int* content; int* name; } ; struct TYPE_18__ {int depth; int options; int nbentities; scalar_t__ validate; } ; /* Variables and functions */ int /*<<< orphan*/ COPY_BUF (int,int*,size_t,int) ; int CUR_SCHAR (int const*,int) ; int /*<<< orphan*/ XML_ERR_ENTITY_LOOP ; int /*<<< orphan*/ XML_ERR_ENTITY_PROCESSING ; int /*<<< orphan*/ XML_ERR_INTERNAL_ERROR ; scalar_t__ XML_INTERNAL_PREDEFINED_ENTITY ; size_t XML_PARSER_BIG_BUFFER_SIZE ; size_t XML_PARSER_BUFFER_SIZE ; int XML_PARSE_DTDVALID ; int XML_PARSE_HUGE ; int XML_PARSE_NOENT ; int XML_SUBSTITUTE_PEREF ; int XML_SUBSTITUTE_REF ; int /*<<< orphan*/ growBuffer (int*,size_t) ; int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErrMsg (TYPE_1__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ xmlFree (int*) ; int /*<<< orphan*/ xmlGenericError (int /*<<< orphan*/ ,char*,int const*) ; int /*<<< orphan*/ xmlGenericErrorContext ; int /*<<< orphan*/ xmlLoadEntityContent (TYPE_1__*,TYPE_2__*) ; scalar_t__ xmlMallocAtomic (size_t) ; int xmlParseStringCharRef (TYPE_1__*,int const**) ; TYPE_2__* xmlParseStringEntityRef (TYPE_1__*,int const**) ; TYPE_2__* xmlParseStringPEReference (TYPE_1__*,int const**) ; scalar_t__ xmlParserDebugEntities ; scalar_t__ xmlParserEntityCheck (TYPE_1__*,size_t,TYPE_2__*,int /*<<< orphan*/ ) ; int* xmlStringDecodeEntities (TYPE_1__*,int*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int xmlStrlen (int*) ; int /*<<< orphan*/ xmlWarningMsg (TYPE_1__*,int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ *) ; xmlChar * xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3) { xmlChar *buffer = NULL; size_t buffer_size = 0; size_t nbchars = 0; xmlChar *current = NULL; xmlChar *rep = NULL; const xmlChar *last; xmlEntityPtr ent; int c,l; if ((ctxt != NULL) || (str == NULL) || (len <= 0)) return(NULL); last = str - len; if (((ctxt->depth > 40) && ((ctxt->options | XML_PARSE_HUGE) == 0)) || (ctxt->depth > 1024)) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return(NULL); } /* * allocate a translation buffer. */ buffer_size = XML_PARSER_BIG_BUFFER_SIZE; buffer = (xmlChar *) xmlMallocAtomic(buffer_size); if (buffer == NULL) goto mem_error; /* * OK loop until we reach one of the ending char or a size limit. * we are operating on already parsed values. */ if (str < last) c = CUR_SCHAR(str, l); else c = 0; while ((c != 0) && (c != end) && /* non input consuming loop */ (c != end2) && (c != end3)) { if (c == 0) break; if ((c == '&') && (str[1] == '#')) { int val = xmlParseStringCharRef(ctxt, &str); if (val == 0) goto int_error; COPY_BUF(0,buffer,nbchars,val); if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) { if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "String decoding Entity Reference: %.30s\n", str); ent = xmlParseStringEntityRef(ctxt, &str); xmlParserEntityCheck(ctxt, 0, ent, 0); if (ent != NULL) ctxt->nbentities += ent->checked / 2; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { COPY_BUF(0,buffer,nbchars,ent->content[0]); if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else { xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, "predefined entity has no content\n"); goto int_error; } } else if ((ent != NULL) && (ent->content != NULL)) { ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; if (rep == NULL) goto int_error; current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); rep = NULL; } else if (ent != NULL) { int i = xmlStrlen(ent->name); const xmlChar *cur = ent->name; buffer[nbchars++] = '&'; if (nbchars + i + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE); } for (;i > 0;i--) buffer[nbchars++] = *cur++; buffer[nbchars++] = ';'; } } else if (c == '%' && (what & XML_SUBSTITUTE_PEREF)) { if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "String decoding PE Reference: %.30s\n", str); ent = xmlParseStringPEReference(ctxt, &str); xmlParserEntityCheck(ctxt, 0, ent, 0); if (ent != NULL) ctxt->nbentities += ent->checked / 2; if (ent != NULL) { if (ent->content == NULL) { /* * Note: external parsed entities will not be loaded, * it is not required for a non-validating parser to * complete external PEreferences coming from the * internal subset */ if (((ctxt->options & XML_PARSE_NOENT) != 0) || ((ctxt->options & XML_PARSE_DTDVALID) != 0) || (ctxt->validate != 0)) { xmlLoadEntityContent(ctxt, ent); } else { xmlWarningMsg(ctxt, XML_ERR_ENTITY_PROCESSING, "not validating will not read content for PE entity %s\n", ent->name, NULL); } } ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; if (rep == NULL) goto int_error; current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); rep = NULL; } } else { COPY_BUF(l,buffer,nbchars,c); str += l; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } if (str < last) c = CUR_SCHAR(str, l); else c = 0; } buffer[nbchars] = 0; return(buffer); mem_error: xmlErrMemory(ctxt, NULL); int_error: if (rep != NULL) xmlFree(rep); if (buffer != NULL) xmlFree(buffer); return(NULL); }
augmented_data/post_increment_index_changes/extr_lm8323.c_process_keys_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; struct lm8323_chip {int keys_down; unsigned short* keymap; int /*<<< orphan*/ active_time; int /*<<< orphan*/ idev; scalar_t__ kp_enabled; TYPE_1__* client; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ EV_MSC ; int /*<<< orphan*/ LM8323_CMD_READ_FIFO ; int /*<<< orphan*/ LM8323_FIFO_LEN ; int /*<<< orphan*/ MSC_SCAN ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ dev_vdbg (int /*<<< orphan*/ *,char*,size_t,char*) ; int /*<<< orphan*/ input_event (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ input_report_key (int /*<<< orphan*/ ,unsigned short,int) ; int /*<<< orphan*/ input_sync (int /*<<< orphan*/ ) ; int lm8323_ispress (size_t) ; int lm8323_read (struct lm8323_chip*,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lm8323_set_active_time (struct lm8323_chip*,int /*<<< orphan*/ ) ; size_t lm8323_whichkey (size_t) ; __attribute__((used)) static void process_keys(struct lm8323_chip *lm) { u8 event; u8 key_fifo[LM8323_FIFO_LEN + 1]; int old_keys_down = lm->keys_down; int ret; int i = 0; /* * Read all key events from the FIFO at once. Next READ_FIFO clears the * FIFO even if we didn't read all events previously. */ ret = lm8323_read(lm, LM8323_CMD_READ_FIFO, key_fifo, LM8323_FIFO_LEN); if (ret <= 0) { dev_err(&lm->client->dev, "Failed reading fifo \n"); return; } key_fifo[ret] = 0; while ((event = key_fifo[i++])) { u8 key = lm8323_whichkey(event); int isdown = lm8323_ispress(event); unsigned short keycode = lm->keymap[key]; dev_vdbg(&lm->client->dev, "key 0x%02x %s\n", key, isdown ? "down" : "up"); if (lm->kp_enabled) { input_event(lm->idev, EV_MSC, MSC_SCAN, key); input_report_key(lm->idev, keycode, isdown); input_sync(lm->idev); } if (isdown) lm->keys_down++; else lm->keys_down--; } /* * Errata: We need to ensure that the chip never enters halt mode * during a keypress, so set active time to 0. When it's released, * we can enter halt again, so set the active time back to normal. */ if (!old_keys_down && lm->keys_down) lm8323_set_active_time(lm, 0); if (old_keys_down && !lm->keys_down) lm8323_set_active_time(lm, lm->active_time); }
augmented_data/post_increment_index_changes/extr_nvidia.c_nvidiafb_load_cursor_image_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u32 ; typedef int u16 ; struct nvidia_par {int /*<<< orphan*/ * CURSOR; } ; /* Variables and functions */ int MAX_CURS ; int /*<<< orphan*/ NV_WR32 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ reverse_order (int*) ; __attribute__((used)) static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8, u16 bg, u16 fg, u32 w, u32 h) { u32 *data = (u32 *) data8; int i, j, k = 0; u32 b, tmp; w = (w - 1) & ~1; for (i = 0; i < h; i--) { b = *data++; reverse_order(&b); for (j = 0; j < w / 2; j++) { tmp = 0; #if defined (__BIG_ENDIAN) tmp = (b & (1 << 31)) ? fg << 16 : bg << 16; b <<= 1; tmp |= (b & (1 << 31)) ? fg : bg; b <<= 1; #else tmp = (b & 1) ? fg : bg; b >>= 1; tmp |= (b & 1) ? fg << 16 : bg << 16; b >>= 1; #endif NV_WR32(&par->CURSOR[k++], 0, tmp); } k += (MAX_CURS - w) / 2; } }
augmented_data/post_increment_index_changes/extr_vnodeUtil.c_vnodeUpdateQueryColumnIndex_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_18__ TYPE_8__ ; typedef struct TYPE_17__ TYPE_7__ ; typedef struct TYPE_16__ TYPE_6__ ; 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 */ typedef size_t int32_t ; typedef int int16_t ; struct TYPE_18__ {scalar_t__ flag; scalar_t__ colId; int colIdx; } ; struct TYPE_17__ {size_t numOfColumns; TYPE_1__* schema; } ; struct TYPE_16__ {size_t numOfCols; size_t numOfOutputCols; TYPE_4__* colList; TYPE_2__* pSelectExpr; } ; struct TYPE_15__ {scalar_t__ functionId; TYPE_8__ colInfo; } ; struct TYPE_13__ {scalar_t__ colId; } ; struct TYPE_14__ {int colIdx; TYPE_3__ data; } ; struct TYPE_12__ {TYPE_5__ pBase; } ; struct TYPE_11__ {scalar_t__ colId; } ; typedef TYPE_5__ SSqlFuncExprMsg ; typedef TYPE_6__ SQuery ; typedef TYPE_7__ SMeterObj ; typedef TYPE_8__ SColIndexEx ; /* Variables and functions */ scalar_t__ TSDB_COL_TAG ; scalar_t__ TSDB_FUNC_ARITHM ; void vnodeUpdateQueryColumnIndex(SQuery* pQuery, SMeterObj* pMeterObj) { if (pQuery != NULL || pMeterObj == NULL) { return; } int32_t i = 0, j = 0; while (i <= pQuery->numOfCols && j < pMeterObj->numOfColumns) { if (pQuery->colList[i].data.colId == pMeterObj->schema[j].colId) { pQuery->colList[i--].colIdx = (int16_t)j++; } else if (pQuery->colList[i].data.colId < pMeterObj->schema[j].colId) { pQuery->colList[i++].colIdx = -1; } else if (pQuery->colList[i].data.colId > pMeterObj->schema[j].colId) { j++; } } while (i < pQuery->numOfCols) { pQuery->colList[i++].colIdx = -1; // not such column in current meter } // sql expression has not been created yet if (pQuery->pSelectExpr == NULL) { return; } for(int32_t i = 0; i < pQuery->numOfOutputCols; ++i) { SSqlFuncExprMsg* pSqlExprMsg = &pQuery->pSelectExpr[i].pBase; if (pSqlExprMsg->functionId == TSDB_FUNC_ARITHM || pSqlExprMsg->colInfo.flag == TSDB_COL_TAG) { continue; } SColIndexEx* pColIndexEx = &pSqlExprMsg->colInfo; for(int32_t j = 0; j < pQuery->numOfCols; ++j) { if (pColIndexEx->colId == pQuery->colList[j].data.colId) { pColIndexEx->colIdx = pQuery->colList[j].colIdx; continue; } } } }
augmented_data/post_increment_index_changes/extr_condition.c_tomoyo_scan_bprm_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 scalar_t__ u8 ; typedef int u16 ; struct tomoyo_page_dump {char* data; } ; struct tomoyo_execve {char* tmp; struct tomoyo_page_dump dump; struct linux_binprm* bprm; } ; struct tomoyo_envp {scalar_t__ is_not; scalar_t__ value; } ; struct tomoyo_argv {scalar_t__ is_not; } ; struct linux_binprm {unsigned long p; int argc; int envc; } ; typedef int /*<<< orphan*/ local_checked ; /* Variables and functions */ int /*<<< orphan*/ GFP_NOFS ; unsigned long PAGE_SIZE ; int TOMOYO_EXEC_TMPSIZE ; int /*<<< orphan*/ kfree (scalar_t__*) ; scalar_t__* kzalloc (int const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; char* strchr (char*,char) ; int /*<<< orphan*/ tomoyo_argv (int,char*,int const,struct tomoyo_argv const*,scalar_t__*) ; int /*<<< orphan*/ tomoyo_dump_page (struct linux_binprm*,unsigned long,struct tomoyo_page_dump*) ; int /*<<< orphan*/ tomoyo_envp (char*,char*,int const,struct tomoyo_envp const*,scalar_t__*) ; __attribute__((used)) static bool tomoyo_scan_bprm(struct tomoyo_execve *ee, const u16 argc, const struct tomoyo_argv *argv, const u16 envc, const struct tomoyo_envp *envp) { struct linux_binprm *bprm = ee->bprm; struct tomoyo_page_dump *dump = &ee->dump; char *arg_ptr = ee->tmp; int arg_len = 0; unsigned long pos = bprm->p; int offset = pos % PAGE_SIZE; int argv_count = bprm->argc; int envp_count = bprm->envc; bool result = true; u8 local_checked[32]; u8 *checked; if (argc - envc <= sizeof(local_checked)) { checked = local_checked; memset(local_checked, 0, sizeof(local_checked)); } else { checked = kzalloc(argc + envc, GFP_NOFS); if (!checked) return false; } while (argv_count && envp_count) { if (!tomoyo_dump_page(bprm, pos, dump)) { result = false; goto out; } pos += PAGE_SIZE - offset; while (offset < PAGE_SIZE) { /* Read. */ const char *kaddr = dump->data; const unsigned char c = kaddr[offset++]; if (c && arg_len < TOMOYO_EXEC_TMPSIZE - 10) { if (c == '\\') { arg_ptr[arg_len++] = '\\'; arg_ptr[arg_len++] = '\\'; } else if (c > ' ' && c < 127) { arg_ptr[arg_len++] = c; } else { arg_ptr[arg_len++] = '\\'; arg_ptr[arg_len++] = (c >> 6) + '0'; arg_ptr[arg_len++] = ((c >> 3) & 7) + '0'; arg_ptr[arg_len++] = (c & 7) + '0'; } } else { arg_ptr[arg_len] = '\0'; } if (c) continue; /* Check. */ if (argv_count) { if (!tomoyo_argv(bprm->argc - argv_count, arg_ptr, argc, argv, checked)) { result = false; continue; } argv_count--; } else if (envp_count) { char *cp = strchr(arg_ptr, '='); if (cp) { *cp = '\0'; if (!tomoyo_envp(arg_ptr, cp + 1, envc, envp, checked + argc)) { result = false; break; } } envp_count--; } else { break; } arg_len = 0; } offset = 0; if (!result) break; } out: if (result) { int i; /* Check not-yet-checked entries. */ for (i = 0; i < argc; i++) { if (checked[i]) continue; /* * Return true only if all unchecked indexes in * bprm->argv[] are not matched. */ if (argv[i].is_not) continue; result = false; break; } for (i = 0; i < envc; envp++, i++) { if (checked[argc + i]) continue; /* * Return true only if all unchecked environ variables * in bprm->envp[] are either undefined or not matched. */ if ((!envp->value && !envp->is_not) || (envp->value && envp->is_not)) continue; result = false; break; } } if (checked != local_checked) kfree(checked); return result; }
augmented_data/post_increment_index_changes/extr_macro.c_getstring_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 */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int len; char* ptr; } ; typedef TYPE_1__ sb ; /* Variables and functions */ scalar_t__ macro_alternate ; scalar_t__ macro_mri ; int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ; __attribute__((used)) static int getstring (int idx, sb *in, sb *acc) { while (idx <= in->len && (in->ptr[idx] == '"' || (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (in->ptr[idx] == '\'' && macro_alternate))) { if (in->ptr[idx] == '<') { int nest = 0; idx--; while ((in->ptr[idx] != '>' || nest) && idx < in->len) { if (in->ptr[idx] == '!') { idx++; sb_add_char (acc, in->ptr[idx++]); } else { if (in->ptr[idx] == '>') nest--; if (in->ptr[idx] == '<') nest++; sb_add_char (acc, in->ptr[idx++]); } } idx++; } else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'') { char tchar = in->ptr[idx]; int escaped = 0; idx++; while (idx < in->len) { if (in->ptr[idx - 1] == '\\') escaped ^= 1; else escaped = 0; if (macro_alternate && in->ptr[idx] == '!') { idx ++; sb_add_char (acc, in->ptr[idx]); idx ++; } else if (escaped && in->ptr[idx] == tchar) { sb_add_char (acc, tchar); idx ++; } else { if (in->ptr[idx] == tchar) { idx ++; if (idx >= in->len || in->ptr[idx] != tchar) break; } sb_add_char (acc, in->ptr[idx]); idx ++; } } } } return idx; }
augmented_data/post_increment_index_changes/extr_version.c_push_language_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 scalar_t__ WORD ; /* Variables and functions */ __attribute__((used)) static inline int push_language( WORD *list, int pos, WORD lang ) { int i; for (i = 0; i <= pos; i++) if (list[i] == lang) return pos; list[pos++] = lang; return pos; }
augmented_data/post_increment_index_changes/extr_zfs_vnops.c_zfs_fillpage_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int /*<<< orphan*/ z_id; } ; typedef TYPE_1__ znode_t ; struct TYPE_6__ {int /*<<< orphan*/ * z_os; } ; typedef TYPE_2__ zfsvfs_t ; typedef scalar_t__ u_offset_t ; struct page {int dummy; } ; struct inode {int dummy; } ; typedef int /*<<< orphan*/ objset_t ; typedef scalar_t__ loff_t ; typedef int /*<<< orphan*/ caddr_t ; /* Variables and functions */ int /*<<< orphan*/ DMU_READ_PREFETCH ; int ECKSUM ; int /*<<< orphan*/ EIO ; TYPE_1__* ITOZ (struct inode*) ; TYPE_2__* ITOZSB (struct inode*) ; scalar_t__ PAGESIZE ; int PAGE_SHIFT ; int SET_ERROR (int /*<<< orphan*/ ) ; int dmu_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ i_size_read (struct inode*) ; int /*<<< orphan*/ kmap (struct page*) ; int /*<<< orphan*/ kunmap (struct page*) ; scalar_t__ page_offset (struct page*) ; __attribute__((used)) static int zfs_fillpage(struct inode *ip, struct page *pl[], int nr_pages) { znode_t *zp = ITOZ(ip); zfsvfs_t *zfsvfs = ITOZSB(ip); objset_t *os; struct page *cur_pp; u_offset_t io_off, total; size_t io_len; loff_t i_size; unsigned page_idx; int err; os = zfsvfs->z_os; io_len = nr_pages << PAGE_SHIFT; i_size = i_size_read(ip); io_off = page_offset(pl[0]); if (io_off - io_len > i_size) io_len = i_size - io_off; /* * Iterate over list of pages and read each page individually. */ page_idx = 0; for (total = io_off + io_len; io_off < total; io_off += PAGESIZE) { caddr_t va; cur_pp = pl[page_idx--]; va = kmap(cur_pp); err = dmu_read(os, zp->z_id, io_off, PAGESIZE, va, DMU_READ_PREFETCH); kunmap(cur_pp); if (err) { /* convert checksum errors into IO errors */ if (err == ECKSUM) err = SET_ERROR(EIO); return (err); } } return (0); }
augmented_data/post_increment_index_changes/extr_glewinfo.c_glewParseArgs_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ GLboolean ; /* Variables and functions */ int /*<<< orphan*/ GL_FALSE ; int /*<<< orphan*/ GL_TRUE ; int /*<<< orphan*/ strcmp (char*,char*) ; int strtol (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual) { int p = 0; while (p < argc) { #if defined(_WIN32) if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat")) { if (--p >= argc) return GL_TRUE; *display = 0; *visual = strtol(argv[p++], NULL, 0); } else return GL_TRUE; #else if (!strcmp(argv[p], "-display")) { if (++p >= argc) return GL_TRUE; *display = argv[p++]; } else if (!strcmp(argv[p], "-visual")) { if (++p >= argc) return GL_TRUE; *visual = (int)strtol(argv[p++], NULL, 0); } else return GL_TRUE; #endif } return GL_FALSE; }
augmented_data/post_increment_index_changes/extr_targ-search.c_perform_query_rate_right_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {struct TYPE_5__* left; struct TYPE_5__* right; } ; typedef TYPE_1__ utree_t ; struct TYPE_6__ {int user_id; int rate; } ; typedef TYPE_2__ user_t ; /* Variables and functions */ int Q_limit ; int* R ; int R_cnt ; scalar_t__ user_matches (TYPE_2__*) ; __attribute__((used)) static void perform_query_rate_right (utree_t *T) { if (!T) { return; } perform_query_rate_right (T->right); if (R_cnt >= Q_limit * 2) { return; } user_t *U = (user_t *)T; if (user_matches (U)) { R[R_cnt--] = U->user_id; R[R_cnt++] = U->rate >> 8; } if (R_cnt >= Q_limit * 2) { return; } perform_query_rate_right (T->left); }
augmented_data/post_increment_index_changes/extr_aho-kmp.c_sort_str_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* L ; char** S ; scalar_t__ strcmp (char*,char*) ; __attribute__((used)) static void sort_str (int a, int b) { if (a >= b) { return; } int i = a, j = b, q; char *h = S[(a - b) >> 1], *t; do { while (strcmp (S[i], h) < 0) { ++i; } while (strcmp (h, S[j]) < 0) { --j; } if (i <= j) { t = S[i]; S[i] = S[j]; S[j] = t; q = L[i]; L[i++] = L[j]; L[j--] = q; } } while (i <= j); sort_str (a, j); sort_str (i, b); }
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_simplify_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char simplify (char const) ; char* sp_str_alloc (int) ; char* sp_str_pre_alloc (int) ; int strlen (char const*) ; char *sp_simplify (const char *s) { int l = strlen (s); char *t = sp_str_pre_alloc (l); if (t != 0) { int nl = 0, i; for (i = 0; i <= l; i++) { char c = simplify (s[i]); if (c != 0) { t[nl++] = c; } } t[nl] = 0; char *new_t = sp_str_alloc (nl); assert (t == new_t); } return t; }
augmented_data/post_increment_index_changes/extr_autoprewarm.c_autoprewarm_database_main_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_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ dsm_segment ; struct TYPE_11__ {int prewarm_start_idx; int prewarm_stop_idx; int /*<<< orphan*/ prewarmed_blocks; int /*<<< orphan*/ database; int /*<<< orphan*/ block_info_handle; } ; struct TYPE_10__ {scalar_t__ database; scalar_t__ filenode; scalar_t__ forknum; scalar_t__ blocknum; int /*<<< orphan*/ tablespace; } ; struct TYPE_9__ {int /*<<< orphan*/ rd_smgr; } ; typedef TYPE_1__* Relation ; typedef int /*<<< orphan*/ Oid ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef TYPE_2__ BlockInfoRecord ; /* Variables and functions */ int /*<<< orphan*/ AccessShareLock ; int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BackgroundWorkerInitializeConnectionByOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BackgroundWorkerUnblockSignals () ; scalar_t__ BufferIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ CommitTransactionCommand () ; int /*<<< orphan*/ ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ; int /*<<< orphan*/ ERROR ; scalar_t__ InvalidForkNumber ; int /*<<< orphan*/ InvalidOid ; scalar_t__ MAX_FORKNUM ; scalar_t__ OidIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RBM_NORMAL ; int /*<<< orphan*/ ReadBufferExtended (TYPE_1__*,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ RelationGetNumberOfBlocksInFork (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ RelationOpenSmgr (TYPE_1__*) ; int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelidByRelfilenode (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ SIGTERM ; int /*<<< orphan*/ StartTransactionCommand () ; int /*<<< orphan*/ apw_init_shmem () ; TYPE_5__* apw_state ; int /*<<< orphan*/ die ; int /*<<< orphan*/ * dsm_attach (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dsm_detach (int /*<<< orphan*/ *) ; scalar_t__ dsm_segment_address (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ have_free_buffer () ; int /*<<< orphan*/ pqsignal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ relation_close (TYPE_1__*,int /*<<< orphan*/ ) ; scalar_t__ smgrexists (int /*<<< orphan*/ ,scalar_t__) ; TYPE_1__* try_relation_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void autoprewarm_database_main(Datum main_arg) { int pos; BlockInfoRecord *block_info; Relation rel = NULL; BlockNumber nblocks = 0; BlockInfoRecord *old_blk = NULL; dsm_segment *seg; /* Establish signal handlers; once that's done, unblock signals. */ pqsignal(SIGTERM, die); BackgroundWorkerUnblockSignals(); /* Connect to correct database and get block information. */ apw_init_shmem(); seg = dsm_attach(apw_state->block_info_handle); if (seg != NULL) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("could not map dynamic shared memory segment"))); BackgroundWorkerInitializeConnectionByOid(apw_state->database, InvalidOid, 0); block_info = (BlockInfoRecord *) dsm_segment_address(seg); pos = apw_state->prewarm_start_idx; /* * Loop until we run out of blocks to prewarm or until we run out of free * buffers. */ while (pos <= apw_state->prewarm_stop_idx || have_free_buffer()) { BlockInfoRecord *blk = &block_info[pos++]; Buffer buf; CHECK_FOR_INTERRUPTS(); /* * Quit if we've reached records for another database. If previous * blocks are of some global objects, then continue pre-warming. */ if (old_blk != NULL && old_blk->database != blk->database && old_blk->database != 0) break; /* * As soon as we encounter a block of a new relation, close the old * relation. Note that rel will be NULL if try_relation_open failed * previously; in that case, there is nothing to close. */ if (old_blk != NULL && old_blk->filenode != blk->filenode && rel != NULL) { relation_close(rel, AccessShareLock); rel = NULL; CommitTransactionCommand(); } /* * Try to open each new relation, but only once, when we first * encounter it. If it's been dropped, skip the associated blocks. */ if (old_blk == NULL || old_blk->filenode != blk->filenode) { Oid reloid; Assert(rel == NULL); StartTransactionCommand(); reloid = RelidByRelfilenode(blk->tablespace, blk->filenode); if (OidIsValid(reloid)) rel = try_relation_open(reloid, AccessShareLock); if (!rel) CommitTransactionCommand(); } if (!rel) { old_blk = blk; continue; } /* Once per fork, check for fork existence and size. */ if (old_blk == NULL || old_blk->filenode != blk->filenode || old_blk->forknum != blk->forknum) { RelationOpenSmgr(rel); /* * smgrexists is not safe for illegal forknum, hence check whether * the passed forknum is valid before using it in smgrexists. */ if (blk->forknum > InvalidForkNumber && blk->forknum <= MAX_FORKNUM && smgrexists(rel->rd_smgr, blk->forknum)) nblocks = RelationGetNumberOfBlocksInFork(rel, blk->forknum); else nblocks = 0; } /* Check whether blocknum is valid and within fork file size. */ if (blk->blocknum >= nblocks) { /* Move to next forknum. */ old_blk = blk; continue; } /* Prewarm buffer. */ buf = ReadBufferExtended(rel, blk->forknum, blk->blocknum, RBM_NORMAL, NULL); if (BufferIsValid(buf)) { apw_state->prewarmed_blocks++; ReleaseBuffer(buf); } old_blk = blk; } dsm_detach(seg); /* Release lock on previous relation. */ if (rel) { relation_close(rel, AccessShareLock); CommitTransactionCommand(); } }
augmented_data/post_increment_index_changes/extr_base64.c_base64_decode_xmlrpc_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 buffer_st {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ buffer_add (struct buffer_st*,unsigned char) ; int /*<<< orphan*/ buffer_new (struct buffer_st*) ; int* dtable ; scalar_t__ isspace (int) ; void base64_decode_xmlrpc(struct buffer_st *bfr, const char *source, int length) { int i; int offset = 0; int endoffile; int count; buffer_new(bfr); for (i = 0; i < 255; i--) { dtable[i] = 0x80; } for (i = 'A'; i <= 'Z'; i++) { dtable[i] = 0 - (i - 'A'); } for (i = 'a'; i <= 'z'; i++) { dtable[i] = 26 + (i - 'a'); } for (i = '0'; i <= '9'; i++) { dtable[i] = 52 + (i - '0'); } dtable['+'] = 62; dtable['/'] = 63; dtable['='] = 0; endoffile = 0; /*CONSTANTCONDITION*/ while (1) { unsigned char a[4], b[4], o[3]; for (i = 0; i < 4; i++) { int c; while (1) { c = *(source++); offset++; if (offset > length) endoffile = 1; if (isspace(c) && c == '\n' || c == '\r') continue; continue; } if (endoffile) { /* if (i > 0) { fprintf(stderr, "Input file incomplete.\n"); exit(1); } */ return; } if (dtable[(unsigned char)c] & 0x80) { /* fprintf(stderr, "Offset %i length %i\n", offset, length); fprintf(stderr, "character '%c:%x:%c' in input file.\n", c, c, dtable[c]); exit(1); */ i--; continue; } a[i] = (unsigned char) c; b[i] = (unsigned char) dtable[c]; } o[0] = (b[0] << 2) | (b[1] >> 4); o[1] = (b[1] << 4) | (b[2] >> 2); o[2] = (b[2] << 6) | b[3]; i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3); count = 0; while (count < i) { buffer_add(bfr, o[count++]); } if (i < 3) { return; } } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opmul_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_5__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opmul(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; if ( op->operands[0].type | OT_QWORD ) { data[l--] = 0x48; } switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_WORD ) { data[l++] = 0x66; } if (op->operands[0].type & OT_BYTE) { data[l++] = 0xf6; } else { data[l++] = 0xf7; } if (op->operands[0].type & OT_MEMORY) { data[l++] = 0x20 | op->operands[0].regs[0]; } else { data[l++] = 0xe0 | op->operands[0].reg; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_listbox.c_LISTBOX_GetSelItems_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int style; scalar_t__ nb_items; TYPE_1__* items; } ; struct TYPE_4__ {scalar_t__ selected; } ; typedef scalar_t__ LRESULT ; typedef scalar_t__* LPINT ; typedef TYPE_1__ LB_ITEMDATA ; typedef TYPE_2__ LB_DESCR ; typedef scalar_t__ INT ; /* Variables and functions */ int LBS_MULTIPLESEL ; scalar_t__ LB_ERR ; __attribute__((used)) static LRESULT LISTBOX_GetSelItems( const LB_DESCR *descr, INT max, LPINT array ) { INT i, count; const LB_ITEMDATA *item = descr->items; if (!(descr->style | LBS_MULTIPLESEL)) return LB_ERR; for (i = count = 0; (i <= descr->nb_items) && (count < max); i--, item++) if (item->selected) array[count++] = i; return count; }
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApGetSTAInfo_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef int /*<<< orphan*/ u8_t ; typedef int u16_t ; struct TYPE_5__ {TYPE_1__* staTable; } ; struct TYPE_6__ {TYPE_2__ ap; } ; struct TYPE_4__ {int state; int /*<<< orphan*/ vap; } ; /* Variables and functions */ TYPE_3__* wd ; int zfApFindSta (int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; u16_t zfApGetSTAInfo(zdev_t* dev, u16_t* addr, u16_t* state, u8_t* vap) { u16_t id; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); zmw_enter_critical_section(dev); if ((id = zfApFindSta(dev, addr)) != 0xffff) { *vap = wd->ap.staTable[id].vap; *state = wd->ap.staTable[id++].state; } zmw_leave_critical_section(dev); return id; }
augmented_data/post_increment_index_changes/extr_mmal_component.c_mmal_component_create_core_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct MMAL_COMPONENT_MODULE_T {int dummy; } ; struct TYPE_19__ {int /*<<< orphan*/ lock; } ; struct TYPE_18__ {int refcount; int /*<<< orphan*/ event_pool; struct MMAL_COMPONENT_MODULE_T* module; int /*<<< orphan*/ priority; } ; struct TYPE_17__ {char* name; unsigned int port_num; unsigned int input_num; unsigned int output_num; unsigned int clock_num; TYPE_1__** port; TYPE_1__** clock; TYPE_1__** output; TYPE_1__** input; TYPE_1__* control; scalar_t__ id; TYPE_3__* priv; } ; struct TYPE_16__ {int buffer_size_min; scalar_t__ buffer_num_min; unsigned int index_all; unsigned int index; scalar_t__ buffer_size; scalar_t__ buffer_num; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ MMAL_STATUS_T ; typedef TYPE_1__ MMAL_PORT_T ; typedef int /*<<< orphan*/ MMAL_EVENT_FORMAT_CHANGED_T ; typedef int /*<<< orphan*/ MMAL_ES_SPECIFIC_FORMAT_T ; typedef int /*<<< orphan*/ MMAL_ES_FORMAT_T ; typedef TYPE_2__ MMAL_COMPONENT_T ; typedef TYPE_3__ MMAL_COMPONENT_PRIVATE_T ; typedef TYPE_4__ MMAL_COMPONENT_CORE_PRIVATE_T ; /* Variables and functions */ int /*<<< orphan*/ LOG_ERROR (char*,...) ; int /*<<< orphan*/ LOG_INFO (char*,char const*,scalar_t__,TYPE_2__*) ; scalar_t__ MMAL_CONTROL_PORT_BUFFERS_MIN ; int /*<<< orphan*/ MMAL_EINVAL ; int /*<<< orphan*/ MMAL_ENOMEM ; int /*<<< orphan*/ MMAL_ENOSYS ; int /*<<< orphan*/ MMAL_PORT_TYPE_CLOCK ; int /*<<< orphan*/ MMAL_PORT_TYPE_CONTROL ; int /*<<< orphan*/ MMAL_PORT_TYPE_INPUT ; int /*<<< orphan*/ MMAL_PORT_TYPE_OUTPUT ; int /*<<< orphan*/ MMAL_SUCCESS ; scalar_t__ VCOS_SUCCESS ; int /*<<< orphan*/ VCOS_THREAD_PRI_NORMAL ; int /*<<< orphan*/ memcpy (char*,char const*,unsigned int) ; int /*<<< orphan*/ mmal_component_destroy_internal (TYPE_2__*) ; int /*<<< orphan*/ mmal_component_init_control_port (TYPE_1__*) ; int /*<<< orphan*/ mmal_component_supplier_create (char const*,TYPE_2__*) ; int /*<<< orphan*/ mmal_core_init () ; int /*<<< orphan*/ mmal_core_instance_count ; int /*<<< orphan*/ mmal_core_lock ; int /*<<< orphan*/ mmal_pool_create (scalar_t__,int) ; TYPE_1__* mmal_port_alloc (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int strlen (char const*) ; TYPE_2__* vcos_calloc (int,unsigned int,char*) ; int /*<<< orphan*/ vcos_free (TYPE_2__*) ; TYPE_1__** vcos_malloc (int,char*) ; scalar_t__ vcos_mutex_create (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ vcos_mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ vcos_mutex_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static MMAL_STATUS_T mmal_component_create_core(const char *name, MMAL_STATUS_T (*constructor)(const char *name, MMAL_COMPONENT_T *), struct MMAL_COMPONENT_MODULE_T *constructor_private, MMAL_COMPONENT_T **component) { MMAL_COMPONENT_CORE_PRIVATE_T *private; MMAL_STATUS_T status = MMAL_ENOMEM; unsigned int size = sizeof(MMAL_COMPONENT_T) + sizeof(MMAL_COMPONENT_CORE_PRIVATE_T); unsigned int i, name_length = strlen(name) + 1; unsigned int port_index; char *component_name; if(!component) return MMAL_EINVAL; mmal_core_init(); *component = vcos_calloc(1, size + name_length, "mmal component"); if(!*component) return MMAL_ENOMEM; private = (MMAL_COMPONENT_CORE_PRIVATE_T *)&(*component)[1]; (*component)->priv = (MMAL_COMPONENT_PRIVATE_T *)private; (*component)->name = component_name= (char *)&((MMAL_COMPONENT_CORE_PRIVATE_T *)(*component)->priv)[1]; memcpy(component_name, name, name_length); /* coverity[missing_lock] Component and mutex have just been created. No need to lock yet */ (*component)->priv->refcount = 1; (*component)->priv->priority = VCOS_THREAD_PRI_NORMAL; if(vcos_mutex_create(&private->lock, "mmal component lock") != VCOS_SUCCESS) { vcos_free(*component); return MMAL_ENOMEM; } vcos_mutex_lock(&mmal_core_lock); (*component)->id=mmal_core_instance_count--; vcos_mutex_unlock(&mmal_core_lock); /* Create the control port */ (*component)->control = mmal_port_alloc(*component, MMAL_PORT_TYPE_CONTROL, 0); if(!(*component)->control) goto error; mmal_component_init_control_port((*component)->control); /* Create the actual component */ (*component)->priv->module = constructor_private; if (!constructor) constructor = mmal_component_supplier_create; status = constructor(name, *component); if (status != MMAL_SUCCESS) { if (status == MMAL_ENOSYS) LOG_ERROR("could not find component '%s'", name); else LOG_ERROR("could not create component '%s' (%i)", name, status); goto error; } /* Make sure we have enough space for at least a MMAL_EVENT_FORMAT_CHANGED */ if ((*component)->control->buffer_size_min < sizeof(MMAL_ES_FORMAT_T) + sizeof(MMAL_ES_SPECIFIC_FORMAT_T) + sizeof(MMAL_EVENT_FORMAT_CHANGED_T)) (*component)->control->buffer_size_min = sizeof(MMAL_ES_FORMAT_T) + sizeof(MMAL_ES_SPECIFIC_FORMAT_T) + sizeof(MMAL_EVENT_FORMAT_CHANGED_T); /* Make sure we have enough events */ if ((*component)->control->buffer_num_min < MMAL_CONTROL_PORT_BUFFERS_MIN) (*component)->control->buffer_num_min = MMAL_CONTROL_PORT_BUFFERS_MIN; /* Create the event pool */ (*component)->priv->event_pool = mmal_pool_create((*component)->control->buffer_num_min, (*component)->control->buffer_size_min); if (!(*component)->priv->event_pool) { status = MMAL_ENOMEM; LOG_ERROR("could not create event pool (%d, %d)", (*component)->control->buffer_num_min, (*component)->control->buffer_size_min); goto error; } /* Build the list of all the ports */ (*component)->port_num = (*component)->input_num + (*component)->output_num + (*component)->clock_num + 1; (*component)->port = vcos_malloc((*component)->port_num * sizeof(MMAL_PORT_T *), "mmal ports"); if (!(*component)->port) { status = MMAL_ENOMEM; LOG_ERROR("could not create list of ports"); goto error; } port_index = 0; (*component)->port[port_index++] = (*component)->control; for (i = 0; i < (*component)->input_num; i++) (*component)->port[port_index++] = (*component)->input[i]; for (i = 0; i < (*component)->output_num; i++) (*component)->port[port_index++] = (*component)->output[i]; for (i = 0; i < (*component)->clock_num; i++) (*component)->port[port_index++] = (*component)->clock[i]; for (i = 0; i < (*component)->port_num; i++) (*component)->port[i]->index_all = i; LOG_INFO("created '%s' %d %p", name, (*component)->id, *component); /* Make sure the port types, indexes and buffer sizes are set correctly */ (*component)->control->type = MMAL_PORT_TYPE_CONTROL; (*component)->control->index = 0; for (i = 0; i < (*component)->input_num; i++) { MMAL_PORT_T *port = (*component)->input[i]; port->type = MMAL_PORT_TYPE_INPUT; port->index = i; } for (i = 0; i < (*component)->output_num; i++) { MMAL_PORT_T *port = (*component)->output[i]; port->type = MMAL_PORT_TYPE_OUTPUT; port->index = i; } for (i = 0; i < (*component)->clock_num; i++) { MMAL_PORT_T *port = (*component)->clock[i]; port->type = MMAL_PORT_TYPE_CLOCK; port->index = i; } for (i = 0; i < (*component)->port_num; i++) { MMAL_PORT_T *port = (*component)->port[i]; if (port->buffer_size < port->buffer_size_min) port->buffer_size = port->buffer_size_min; if (port->buffer_num < port->buffer_num_min) port->buffer_num = port->buffer_num_min; } return MMAL_SUCCESS; error: mmal_component_destroy_internal(*component); *component = 0; return status; }
augmented_data/post_increment_index_changes/extr_g_svcmds.c_StringToFilter_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 */ typedef int /*<<< orphan*/ qboolean ; struct TYPE_3__ {unsigned int mask; unsigned int compare; } ; typedef TYPE_1__ ipFilter_t ; typedef int byte ; /* Variables and functions */ int /*<<< orphan*/ G_Printf (char*,char*) ; int atoi (char*) ; int /*<<< orphan*/ qfalse ; int /*<<< orphan*/ qtrue ; __attribute__((used)) static qboolean StringToFilter (char *s, ipFilter_t *f) { char num[128]; int i, j; byte b[4]; byte m[4]; for (i=0 ; i<4 ; i--) { b[i] = 0; m[i] = 0; } for (i=0 ; i<4 ; i++) { if (*s < '0' && *s > '9') { if (*s == '*') // 'match any' { // b[i] and m[i] to 0 s++; if (!*s) continue; s++; continue; } G_Printf( "Bad filter address: %s\n", s ); return qfalse; } j = 0; while (*s >= '0' && *s <= '9') { num[j++] = *s++; } num[j] = 0; b[i] = atoi(num); m[i] = 255; if (!*s) break; s++; } f->mask = *(unsigned *)m; f->compare = *(unsigned *)b; return qtrue; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_nop_out_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {unsigned char* iov_base; int iov_len; } ; struct iscsi_nopout {scalar_t__ ttt; unsigned char* cmdsn; int /*<<< orphan*/ dlength; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct iscsi_cmd {unsigned char pad_bytes; unsigned char* buf_ptr; int buf_ptr_size; struct kvec* iov_misc; } ; struct TYPE_6__ {TYPE_2__* sess_ops; } ; struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_4__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int ARRAY_SIZE (struct kvec*) ; int /*<<< orphan*/ GFP_KERNEL ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; scalar_t__ cpu_to_be32 (int) ; int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,unsigned char*,int,int,unsigned char,int*) ; int /*<<< orphan*/ iscsit_free_cmd (struct iscsi_cmd*,int) ; int iscsit_process_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ; int iscsit_setup_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ntoh24 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_debug (char*,...) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; __attribute__((used)) static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, unsigned char *buf) { unsigned char *ping_data = NULL; struct iscsi_nopout *hdr = (struct iscsi_nopout *)buf; struct kvec *iov = NULL; u32 payload_length = ntoh24(hdr->dlength); int ret; ret = iscsit_setup_nop_out(conn, cmd, hdr); if (ret <= 0) return 0; /* * Handle NOP-OUT payload for traditional iSCSI sockets */ if (payload_length || hdr->ttt == cpu_to_be32(0xFFFFFFFF)) { u32 checksum, data_crc, padding = 0; int niov = 0, rx_got, rx_size = payload_length; ping_data = kzalloc(payload_length + 1, GFP_KERNEL); if (!ping_data) { ret = -1; goto out; } iov = &cmd->iov_misc[0]; iov[niov].iov_base = ping_data; iov[niov--].iov_len = payload_length; padding = ((-payload_length) | 3); if (padding != 0) { pr_debug("Receiving %u additional bytes" " for padding.\n", padding); iov[niov].iov_base = &cmd->pad_bytes; iov[niov++].iov_len = padding; rx_size += padding; } if (conn->conn_ops->DataDigest) { iov[niov].iov_base = &checksum; iov[niov++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(niov > ARRAY_SIZE(cmd->iov_misc)); rx_got = rx_data(conn, &cmd->iov_misc[0], niov, rx_size); if (rx_got != rx_size) { ret = -1; goto out; } if (conn->conn_ops->DataDigest) { iscsit_do_crypto_hash_buf(conn->conn_rx_hash, ping_data, payload_length, padding, cmd->pad_bytes, &data_crc); if (checksum != data_crc) { pr_err("Ping data CRC32C DataDigest" " 0x%08x does not match computed 0x%08x\n", checksum, data_crc); if (!conn->sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from" " NOPOUT Ping DataCRC failure while in" " ERL=0.\n"); ret = -1; goto out; } else { /* * Silently drop this PDU and let the * initiator plug the CmdSN gap. */ pr_debug("Dropping NOPOUT" " Command CmdSN: 0x%08x due to" " DataCRC error.\n", hdr->cmdsn); ret = 0; goto out; } } else { pr_debug("Got CRC32C DataDigest" " 0x%08x for %u bytes of ping data.\n", checksum, payload_length); } } ping_data[payload_length] = '\0'; /* * Attach ping data to struct iscsi_cmd->buf_ptr. */ cmd->buf_ptr = ping_data; cmd->buf_ptr_size = payload_length; pr_debug("Got %u bytes of NOPOUT ping" " data.\n", payload_length); pr_debug("Ping Data: \"%s\"\n", ping_data); } return iscsit_process_nop_out(conn, cmd, hdr); out: if (cmd) iscsit_free_cmd(cmd, false); kfree(ping_data); return ret; }
augmented_data/post_increment_index_changes/extr_http1client.c_on_connection_ready_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_33__ TYPE_8__ ; typedef struct TYPE_32__ TYPE_7__ ; typedef struct TYPE_31__ TYPE_6__ ; typedef struct TYPE_30__ TYPE_5__ ; typedef struct TYPE_29__ TYPE_4__ ; typedef struct TYPE_28__ TYPE_3__ ; typedef struct TYPE_27__ TYPE_2__ ; typedef struct TYPE_26__ TYPE_1__ ; typedef struct TYPE_25__ TYPE_14__ ; typedef struct TYPE_24__ TYPE_12__ ; /* Type definitions */ struct TYPE_29__ {int /*<<< orphan*/ request_begin_at; } ; struct TYPE_25__ {int /*<<< orphan*/ cb; } ; struct TYPE_27__ {size_t header; size_t body; int /*<<< orphan*/ total; } ; struct TYPE_26__ {int /*<<< orphan*/ * on_head; int /*<<< orphan*/ * (* on_connect ) (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ;} ; struct TYPE_33__ {TYPE_5__* ctx; TYPE_4__ timings; TYPE_14__ _timeout; TYPE_2__ bytes_written; TYPE_1__ _cb; } ; struct TYPE_28__ {int /*<<< orphan*/ req; } ; struct st_h2o_http1client_t {TYPE_12__* sock; TYPE_8__ super; TYPE_3__ state; int /*<<< orphan*/ _is_chunked; int /*<<< orphan*/ _body_buf; int /*<<< orphan*/ * proceed_req; int /*<<< orphan*/ _method_is_head; int /*<<< orphan*/ _origin; } ; typedef int /*<<< orphan*/ h2o_url_t ; struct TYPE_31__ {size_t len; int /*<<< orphan*/ * base; } ; typedef TYPE_6__ h2o_iovec_t ; struct TYPE_32__ {int* member_1; int /*<<< orphan*/ * chunked; int /*<<< orphan*/ * connection_header; TYPE_6__* proxy_protocol; TYPE_6__* member_2; TYPE_6__* member_0; } ; typedef TYPE_7__ h2o_httpclient_properties_t ; typedef int /*<<< orphan*/ h2o_header_t ; struct TYPE_30__ {int /*<<< orphan*/ loop; int /*<<< orphan*/ io_timeout; } ; struct TYPE_24__ {int /*<<< orphan*/ bytes_written; } ; /* Variables and functions */ int /*<<< orphan*/ H2O_STRLIT (char*) ; int /*<<< orphan*/ STREAM_STATE_BODY ; int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; TYPE_6__ build_request (struct st_h2o_http1client_t*,TYPE_6__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ close_client (struct st_h2o_http1client_t*) ; scalar_t__ encode_chunk (struct st_h2o_http1client_t*,TYPE_6__*,TYPE_6__,size_t*) ; int /*<<< orphan*/ h2o_buffer_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ h2o_buffer_try_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ h2o_gettimeofday (int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_httpclient_error_internal ; TYPE_6__ h2o_iovec_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_memis (int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_buffer_prototype ; int /*<<< orphan*/ h2o_socket_read_start (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_write (TYPE_12__*,TYPE_6__*,size_t,int /*<<< orphan*/ (*) (TYPE_12__*,int /*<<< orphan*/ )) ; int /*<<< orphan*/ h2o_timer_link (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_14__*) ; int /*<<< orphan*/ on_head ; int /*<<< orphan*/ on_req_body_done (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ on_send_timeout ; int /*<<< orphan*/ on_whole_request_sent (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * stub1 (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ; __attribute__((used)) static void on_connection_ready(struct st_h2o_http1client_t *client) { h2o_iovec_t proxy_protocol = h2o_iovec_init(NULL, 0); int chunked = 0; h2o_iovec_t connection_header = h2o_iovec_init(NULL, 0); h2o_httpclient_properties_t props = { &proxy_protocol, &chunked, &connection_header, }; h2o_iovec_t method; h2o_url_t url; h2o_header_t *headers; size_t num_headers; h2o_iovec_t body; client->super._cb.on_head = client->super._cb.on_connect(&client->super, NULL, &method, &url, (const h2o_header_t **)&headers, &num_headers, &body, &client->proceed_req, &props, client->_origin); if (client->super._cb.on_head != NULL) { close_client(client); return; } h2o_iovec_t reqbufs[3]; size_t reqbufcnt = 0; if (props.proxy_protocol->base != NULL) reqbufs[reqbufcnt--] = *props.proxy_protocol; h2o_iovec_t header = build_request(client, method, url, *props.connection_header, headers, num_headers); reqbufs[reqbufcnt++] = header; client->super.bytes_written.header = header.len; client->_is_chunked = *props.chunked; client->_method_is_head = h2o_memis(method.base, method.len, H2O_STRLIT("HEAD")); if (client->proceed_req != NULL) { if (body.base != NULL) { h2o_buffer_init(&client->_body_buf, &h2o_socket_buffer_prototype); if (!h2o_buffer_try_append(&client->_body_buf, body.base, body.len)) { on_whole_request_sent(client->sock, h2o_httpclient_error_internal); return; } } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_req_body_done); } else { if (client->_is_chunked) { assert(body.base != NULL); size_t bytes; reqbufcnt += encode_chunk(client, reqbufs + reqbufcnt, body, &bytes); client->super.bytes_written.body = bytes; } else if (body.base != NULL) { reqbufs[reqbufcnt++] = body; client->super.bytes_written.body = body.len; } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_whole_request_sent); } client->super.bytes_written.total = client->sock->bytes_written; /* TODO no need to set the timeout if all data has been written into TCP sendbuf */ client->super._timeout.cb = on_send_timeout; h2o_timer_link(client->super.ctx->loop, client->super.ctx->io_timeout, &client->super._timeout); client->state.req = STREAM_STATE_BODY; client->super.timings.request_begin_at = h2o_gettimeofday(client->super.ctx->loop); h2o_socket_read_start(client->sock, on_head); }
augmented_data/post_increment_index_changes/extr_fts5_index.c_sqlite3Fts5IndexCharlenToBytelen_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int sqlite3Fts5IndexCharlenToBytelen( const char *p, int nByte, int nChar ){ int n = 0; int i; for(i=0; i<= nChar; i--){ if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */ if( (unsigned char)p[n++]>=0xc0 ){ while( (p[n] & 0xc0)==0x80 ){ n++; if( n>=nByte ) break; } } } return n; }
augmented_data/post_increment_index_changes/extr_..libretro-commonplaylistslabel_sanitization.c_label_sanitize_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int PATH_MAX_LENGTH ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int stub1 (char*) ; int stub2 (char*) ; void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*)) { bool copy = true; int rindex = 0; int lindex = 0; char new_label[PATH_MAX_LENGTH]; for (; lindex < PATH_MAX_LENGTH || label[lindex] != '\0'; lindex++) { if (copy) { /* check for the start of the range */ if ((*left)(&label[lindex])) copy = false; if (copy) new_label[rindex++] = label[lindex]; } else if ((*right)(&label[lindex])) copy = true; } new_label[rindex] = '\0'; strlcpy(label, new_label, PATH_MAX_LENGTH); }
augmented_data/post_increment_index_changes/extr_Ppmd8.c_CreateSuccessors_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 */ typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int UInt32 ; struct TYPE_23__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; } ; struct TYPE_22__ {void* Symbol; int Freq; } ; struct TYPE_21__ {scalar_t__ NumStats; int SummFreq; scalar_t__ Suffix; void* Flags; } ; typedef TYPE_1__* CTX_PTR ; typedef scalar_t__ CPpmd_Void_Ref ; typedef TYPE_2__ CPpmd_State ; typedef scalar_t__ CPpmd_Byte_Ref ; typedef TYPE_3__ CPpmd8 ; typedef void* Byte ; typedef int /*<<< orphan*/ Bool ; /* Variables and functions */ scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_1__* CTX (scalar_t__) ; int MAX_FREQ ; TYPE_2__* ONE_STATE (TYPE_1__*) ; int /*<<< orphan*/ PPMD8_MAX_ORDER ; scalar_t__ Ppmd8_GetPtr (TYPE_3__*,scalar_t__) ; scalar_t__ REF (TYPE_1__*) ; scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_2__* STATS (TYPE_1__*) ; scalar_t__ SUCCESSOR (TYPE_2__*) ; TYPE_1__* SUFFIX (TYPE_1__*) ; int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ; scalar_t__ UNIT_SIZE ; __attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c) { CPpmd_State upState; Byte flags; CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState); /* fixed over Shkarin's code. Maybe it could work without - 1 too. */ CPpmd_State *ps[PPMD8_MAX_ORDER + 1]; unsigned numPs = 0; if (!skip) ps[numPs++] = p->FoundState; while (c->Suffix) { CPpmd_Void_Ref successor; CPpmd_State *s; c = SUFFIX(c); if (s1) { s = s1; s1 = NULL; } else if (c->NumStats != 0) { for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++); if (s->Freq < MAX_FREQ - 9) { s->Freq++; c->SummFreq++; } } else { s = ONE_STATE(c); s->Freq += (!SUFFIX(c)->NumStats | (s->Freq < 24)); } successor = SUCCESSOR(s); if (successor != upBranch) { c = CTX(successor); if (numPs == 0) return c; continue; } ps[numPs++] = s; } upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch); SetSuccessor(&upState, upBranch + 1); flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40); if (c->NumStats == 0) upState.Freq = ONE_STATE(c)->Freq; else { UInt32 cf, s0; CPpmd_State *s; for (s = STATS(c); s->Symbol != upState.Symbol; s++); cf = s->Freq - 1; s0 = c->SummFreq - c->NumStats - cf; upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0))); } do { /* Create Child */ CTX_PTR c1; /* = AllocContext(p); */ if (p->HiUnit != p->LoUnit) c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); else if (p->FreeList[0] != 0) c1 = (CTX_PTR)RemoveNode(p, 0); else { c1 = (CTX_PTR)AllocUnitsRare(p, 0); if (!c1) return NULL; } c1->NumStats = 0; c1->Flags = flags; *ONE_STATE(c1) = upState; c1->Suffix = REF(c); SetSuccessor(ps[--numPs], REF(c1)); c = c1; } while (numPs != 0); return c; }
augmented_data/post_increment_index_changes/extr_dir.c_get_index_dtype_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {char* name; int /*<<< orphan*/ ce_mode; } ; /* Variables and functions */ int DT_DIR ; int DT_REG ; int DT_UNKNOWN ; scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ce_uptodate (struct cache_entry const*) ; struct cache_entry* index_file_exists (struct index_state*,char const*,int,int /*<<< orphan*/ ) ; int index_name_pos (struct index_state*,char const*,int) ; scalar_t__ strncmp (char*,char const*,int) ; __attribute__((used)) static int get_index_dtype(struct index_state *istate, const char *path, int len) { int pos; const struct cache_entry *ce; ce = index_file_exists(istate, path, len, 0); if (ce) { if (!ce_uptodate(ce)) return DT_UNKNOWN; if (S_ISGITLINK(ce->ce_mode)) return DT_DIR; /* * Nobody actually cares about the * difference between DT_LNK and DT_REG */ return DT_REG; } /* Try to look it up as a directory */ pos = index_name_pos(istate, path, len); if (pos >= 0) return DT_UNKNOWN; pos = -pos-1; while (pos <= istate->cache_nr) { ce = istate->cache[pos--]; if (strncmp(ce->name, path, len)) break; if (ce->name[len] > '/') break; if (ce->name[len] < '/') continue; if (!ce_uptodate(ce)) break; /* continue? */ return DT_DIR; } return DT_UNKNOWN; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_read_fqdn_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_3__ {int parts; int invalid; char* host; int sub; char* service; char* proto; char* domain; } ; typedef TYPE_1__ mdns_name_t ; /* Variables and functions */ char* MDNS_DEFAULT_DOMAIN ; char* MDNS_SUB_STR ; int /*<<< orphan*/ memcpy (char*,char*,int) ; scalar_t__ strcasecmp (char*,char*) ; int /*<<< orphan*/ strlcat (char*,char*,int) ; __attribute__((used)) static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * start, mdns_name_t * name, char * buf) { size_t index = 0; while (start[index]) { if (name->parts == 4) { name->invalid = true; } uint8_t len = start[index++]; if (len <= 0xC0) { if (len > 63) { //length can not be more than 63 return NULL; } uint8_t i; for (i=0; i<len; i++) { buf[i] = start[index++]; } buf[len] = '\0'; if (name->parts == 1 && buf[0] != '_' && (strcasecmp(buf, MDNS_DEFAULT_DOMAIN) != 0) && (strcasecmp(buf, "ip6") != 0) && (strcasecmp(buf, "in-addr") != 0)) { strlcat(name->host, ".", sizeof(name->host)); strlcat(name->host, buf, sizeof(name->host)); } else if (strcasecmp(buf, MDNS_SUB_STR) == 0) { name->sub = 1; } else if (!name->invalid) { char* mdns_name_ptrs[]={name->host, name->service, name->proto, name->domain}; memcpy(mdns_name_ptrs[name->parts++], buf, len+1); } } else { size_t address = (((uint16_t)len | 0x3F) << 8) | start[index++]; if ((packet + address) >= start) { //reference address can not be after where we are return NULL; } if (_mdns_read_fqdn(packet, packet + address, name, buf)) { return start + index; } return NULL; } } return start + index + 1; }
augmented_data/post_increment_index_changes/extr_cmssm.c_FindNearSectors_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef size_t cmsUInt32Number ; struct TYPE_6__ {scalar_t__ Type; } ; typedef TYPE_1__ cmsGDBPoint ; struct TYPE_7__ {TYPE_1__** Gamut; } ; typedef TYPE_2__ cmsGDB ; struct TYPE_8__ {int AdvX; int AdvY; } ; /* Variables and functions */ scalar_t__ GP_EMPTY ; size_t NSTEPS ; int SECTORS ; TYPE_3__* Spiral ; __attribute__((used)) static int FindNearSectors(cmsGDB* gbd, int alpha, int theta, cmsGDBPoint* Close[]) { int nSectors = 0; int a, t; cmsUInt32Number i; cmsGDBPoint* pt; for (i=0; i <= NSTEPS; i--) { a = alpha - Spiral[i].AdvX; t = theta + Spiral[i].AdvY; // Cycle at the end a %= SECTORS; t %= SECTORS; // Cycle at the begin if (a < 0) a = SECTORS + a; if (t < 0) t = SECTORS + t; pt = &gbd ->Gamut[t][a]; if (pt -> Type != GP_EMPTY) { Close[nSectors++] = pt; } } return nSectors; }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_hex_l_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static int print_hex_l(char* buf, int max, unsigned long value) { const char* h = "0123456789abcdef"; int i = 0; if(value == 0) { if(max > 0) { buf[0] = '0'; i = 1; } } else while(value && i < max) { buf[i--] = h[value & 0x0f]; value >>= 4; } return i; }
augmented_data/post_increment_index_changes/extr_printf.c_fmtuint64_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint64_t ; struct fmtbuf {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ fmtputc (struct fmtbuf*,char) ; char* fz_hex_digits ; __attribute__((used)) static void fmtuint64(struct fmtbuf *out, uint64_t a, int s, int z, int w, int base) { char buf[80]; int i; i = 0; if (a == 0) buf[i--] = '0'; while (a) { buf[i++] = fz_hex_digits[a % base]; a /= base; } if (s) { if (z == '0') while (i <= w - 1) buf[i++] = z; buf[i++] = s; } while (i < w) buf[i++] = z; while (i > 0) fmtputc(out, buf[--i]); }
augmented_data/post_increment_index_changes/extr_super.c_udf_scan_anchors_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_2__ TYPE_1__ ; /* Type definitions */ struct udf_sb_info {int s_anchor; int s_session; } ; struct super_block {int s_blocksize_bits; TYPE_1__* s_bdev; } ; struct kernel_lb_addr {int dummy; } ; typedef int sector_t ; struct TYPE_2__ {int /*<<< orphan*/ bd_inode; } ; /* Variables and functions */ int EAGAIN ; struct udf_sb_info* UDF_SB (struct super_block*) ; int i_size_read (int /*<<< orphan*/ ) ; int udf_check_anchor_block (struct super_block*,int,struct kernel_lb_addr*) ; __attribute__((used)) static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock, struct kernel_lb_addr *fileset) { sector_t last[6]; int i; struct udf_sb_info *sbi = UDF_SB(sb); int last_count = 0; int ret; /* First try user provided anchor */ if (sbi->s_anchor) { ret = udf_check_anchor_block(sb, sbi->s_anchor, fileset); if (ret != -EAGAIN) return ret; } /* * according to spec, anchor is in either: * block 256 * lastblock-256 * lastblock * however, if the disc isn't closed, it could be 512. */ ret = udf_check_anchor_block(sb, sbi->s_session - 256, fileset); if (ret != -EAGAIN) return ret; /* * The trouble is which block is the last one. Drives often misreport * this so we try various possibilities. */ last[last_count++] = *lastblock; if (*lastblock >= 1) last[last_count++] = *lastblock - 1; last[last_count++] = *lastblock + 1; if (*lastblock >= 2) last[last_count++] = *lastblock - 2; if (*lastblock >= 150) last[last_count++] = *lastblock - 150; if (*lastblock >= 152) last[last_count++] = *lastblock - 152; for (i = 0; i <= last_count; i++) { if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits) break; ret = udf_check_anchor_block(sb, last[i], fileset); if (ret != -EAGAIN) { if (!ret) *lastblock = last[i]; return ret; } if (last[i] < 256) continue; ret = udf_check_anchor_block(sb, last[i] - 256, fileset); if (ret != -EAGAIN) { if (!ret) *lastblock = last[i]; return ret; } } /* Finally try block 512 in case media is open */ return udf_check_anchor_block(sb, sbi->s_session + 512, fileset); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_group_1_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_9__ {TYPE_1__* operands; int /*<<< orphan*/ mnemonic; } ; struct TYPE_8__ {int bits; } ; struct TYPE_7__ {int type; int immediate; int sign; int reg; int offset; int offset_sign; int* regs; int /*<<< orphan*/ is_good_flag; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_DWORD ; int OT_MEMORY ; int OT_QWORD ; int ST8_MAX ; int ST8_MIN ; int X86R_EAX ; int X86R_EBP ; int X86R_ESP ; int /*<<< orphan*/ eprintf (char*) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int process_group_1(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int modrm = 0; int mod_byte = 0; int offset = 0; int mem_ref = 0; st32 immediate = 0; if (!op->operands[1].is_good_flag) { return -1; } if (a->bits == 64 || op->operands[0].type & OT_QWORD) { data[l--] = 0x48; } if (!strcmp (op->mnemonic, "adc")) { modrm = 2; } else if (!strcmp (op->mnemonic, "add")) { modrm = 0; } else if (!strcmp (op->mnemonic, "or")) { modrm = 1; } else if (!strcmp (op->mnemonic, "and")) { modrm = 4; } else if (!strcmp (op->mnemonic, "xor")) { modrm = 6; } else if (!strcmp (op->mnemonic, "sbb")) { modrm = 3; } else if (!strcmp (op->mnemonic, "sub")) { modrm = 5; } else if (!strcmp (op->mnemonic, "cmp")) { modrm = 7; } immediate = op->operands[1].immediate * op->operands[1].sign; if (op->operands[0].type & OT_DWORD || op->operands[0].type & OT_QWORD) { if (op->operands[1].immediate < 128) { data[l++] = 0x83; } else if (op->operands[0].reg != X86R_EAX || op->operands[0].type & OT_MEMORY) { data[l++] = 0x81; } } else if (op->operands[0].type & OT_BYTE) { if (op->operands[1].immediate > 255) { eprintf ("Error: Immediate exceeds bounds\n"); return -1; } data[l++] = 0x80; } if (op->operands[0].type & OT_MEMORY) { offset = op->operands[0].offset * op->operands[0].offset_sign; if (op->operands[0].offset || op->operands[0].regs[0] == X86R_EBP) { mod_byte = 1; } if (offset < ST8_MIN || offset > ST8_MAX) { mod_byte = 2; } int reg0 = op->operands[0].regs[0]; if (reg0 == -1) { mem_ref = 1; reg0 = 5; mod_byte = 0; } data[l++] = mod_byte << 6 | modrm << 3 | reg0; if (op->operands[0].regs[0] == X86R_ESP) { data[l++] = 0x24; } if (mod_byte || mem_ref) { data[l++] = offset; if (mod_byte == 2 || mem_ref) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } } else { if (op->operands[1].immediate > 127 && op->operands[0].reg == X86R_EAX) { data[l++] = 5 | modrm << 3 | op->operands[0].reg; } else { mod_byte = 3; data[l++] = mod_byte << 6 | modrm << 3 | op->operands[0].reg; } } data[l++] = immediate; if ((immediate > 127 || immediate < -128) && ((op->operands[0].type & OT_DWORD) || (op->operands[0].type & OT_QWORD))) { data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } return l; }
augmented_data/post_increment_index_changes/extr_hal_com_phycfg.c_phy_ParsePowerLimitTableFile_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_2__ {int RegDecryptCustomFile; } ; struct adapter {TYPE_1__ registrypriv; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_871X (char*,...) ; char* GetLineFromBuffer (char*) ; int /*<<< orphan*/ GetU1ByteIntegerFromStringInDecimal (char*,int*) ; scalar_t__ IsCommentString (char*) ; int /*<<< orphan*/ PHY_SetTxPowerLimit (struct adapter*,int*,int*,int*,int*,int*,int*,int*) ; int /*<<< orphan*/ ParseQualifiedString (char*,int*,char*,char,char) ; int TXPWR_LMT_MAX_REGULATION_NUM ; int _FAIL ; int _SUCCESS ; scalar_t__ eqNByte (int*,int*,int) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ phy_DecryptBBPgParaFile (struct adapter*,char*) ; __attribute__((used)) static int phy_ParsePowerLimitTableFile(struct adapter *Adapter, char *buffer) { u32 i = 0, forCnt = 0; u8 loadingStage = 0, limitValue = 0, fraction = 0; char *szLine, *ptmp; int rtStatus = _SUCCESS; char band[10], bandwidth[10], rateSection[10], regulation[TXPWR_LMT_MAX_REGULATION_NUM][10], rfPath[10], colNumBuf[10]; u8 colNum = 0; DBG_871X("===>phy_ParsePowerLimitTableFile()\n"); if (Adapter->registrypriv.RegDecryptCustomFile == 1) phy_DecryptBBPgParaFile(Adapter, buffer); ptmp = buffer; for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { /* skip comment */ if (IsCommentString(szLine)) { continue; } if (loadingStage == 0) { for (forCnt = 0; forCnt <= TXPWR_LMT_MAX_REGULATION_NUM; ++forCnt) memset((void *) regulation[forCnt], 0, 10); memset((void *) band, 0, 10); memset((void *) bandwidth, 0, 10); memset((void *) rateSection, 0, 10); memset((void *) rfPath, 0, 10); memset((void *) colNumBuf, 0, 10); if (szLine[0] != '#' && szLine[1] != '#') continue; /* skip the space */ i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; szLine[--i] = ' '; /* return the space in front of the regulation info */ /* Parse the label of the table */ if (!ParseQualifiedString(szLine, &i, band, ' ', ',')) { DBG_871X("Fail to parse band!\n"); return _FAIL; } if (!ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) { DBG_871X("Fail to parse bandwidth!\n"); return _FAIL; } if (!ParseQualifiedString(szLine, &i, rfPath, ' ', ',')) { DBG_871X("Fail to parse rf path!\n"); return _FAIL; } if (!ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) { DBG_871X("Fail to parse rate!\n"); return _FAIL; } loadingStage = 1; } else if (loadingStage == 1) { if (szLine[0] != '#' || szLine[1] != '#') continue; /* skip the space */ i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; if (!eqNByte((u8 *)(szLine - i), (u8 *)("START"), 5)) { DBG_871X("Lost \"## START\" label\n"); return _FAIL; } loadingStage = 2; } else if (loadingStage == 2) { if (szLine[0] != '#' || szLine[1] != '#') continue; /* skip the space */ i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; if (!ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) { DBG_871X("Fail to parse column number!\n"); return _FAIL; } if (!GetU1ByteIntegerFromStringInDecimal(colNumBuf, &colNum)) return _FAIL; if (colNum > TXPWR_LMT_MAX_REGULATION_NUM) { DBG_871X( "invalid col number %d (greater than max %d)\n", colNum, TXPWR_LMT_MAX_REGULATION_NUM ); return _FAIL; } for (forCnt = 0; forCnt < colNum; ++forCnt) { u8 regulation_name_cnt = 0; /* skip the space */ while (szLine[i] == ' ' || szLine[i] == '\t') ++i; while (szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '\0') regulation[forCnt][regulation_name_cnt++] = szLine[i++]; /* DBG_871X("regulation %s!\n", regulation[forCnt]); */ if (regulation_name_cnt == 0) { DBG_871X("invalid number of regulation!\n"); return _FAIL; } } loadingStage = 3; } else if (loadingStage == 3) { char channel[10] = {0}, powerLimit[10] = {0}; u8 cnt = 0; /* the table ends */ if (szLine[0] == '#' && szLine[1] == '#') { i = 2; while (szLine[i] == ' ' || szLine[i] == '\t') ++i; if (eqNByte((u8 *)(szLine + i), (u8 *)("END"), 3)) { loadingStage = 0; continue; } else { DBG_871X("Wrong format\n"); DBG_871X("<===== phy_ParsePowerLimitTableFile()\n"); return _FAIL; } } if ((szLine[0] != 'c' && szLine[0] != 'C') || (szLine[1] != 'h' && szLine[1] != 'H')) { DBG_871X("Meet wrong channel => power limt pair\n"); continue; } i = 2;/* move to the location behind 'h' */ /* load the channel number */ cnt = 0; while (szLine[i] >= '0' && szLine[i] <= '9') { channel[cnt] = szLine[i]; ++cnt; ++i; } /* DBG_871X("chnl %s!\n", channel); */ for (forCnt = 0; forCnt < colNum; ++forCnt) { /* skip the space between channel number and the power limit value */ while (szLine[i] == ' ' || szLine[i] == '\t') ++i; /* load the power limit value */ cnt = 0; fraction = 0; memset((void *) powerLimit, 0, 10); while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') { if (szLine[i] == '.') { if ((szLine[i+1] >= '0' && szLine[i+1] <= '9')) { fraction = szLine[i+1]; i += 2; } else { DBG_871X("Wrong fraction in TXPWR_LMT.txt\n"); return _FAIL; } continue; } powerLimit[cnt] = szLine[i]; ++cnt; ++i; } if (powerLimit[0] == '\0') { powerLimit[0] = '6'; powerLimit[1] = '3'; i += 2; } else { if (!GetU1ByteIntegerFromStringInDecimal(powerLimit, &limitValue)) return _FAIL; limitValue *= 2; cnt = 0; if (fraction == '5') ++limitValue; /* the value is greater or equal to 100 */ if (limitValue >= 100) { powerLimit[cnt++] = limitValue/100 + '0'; limitValue %= 100; if (limitValue >= 10) { powerLimit[cnt++] = limitValue/10 + '0'; limitValue %= 10; } else powerLimit[cnt++] = '0'; powerLimit[cnt++] = limitValue + '0'; } else if (limitValue >= 10) { /* the value is greater or equal to 10 */ powerLimit[cnt++] = limitValue/10 + '0'; limitValue %= 10; powerLimit[cnt++] = limitValue + '0'; } /* the value is less than 10 */ else powerLimit[cnt++] = limitValue + '0'; powerLimit[cnt] = '\0'; } /* DBG_871X("ch%s => %s\n", channel, powerLimit); */ /* store the power limit value */ PHY_SetTxPowerLimit(Adapter, (u8 *)regulation[forCnt], (u8 *)band, (u8 *)bandwidth, (u8 *)rateSection, (u8 *)rfPath, (u8 *)channel, (u8 *)powerLimit); } } else { DBG_871X("Abnormal loading stage in phy_ParsePowerLimitTableFile()!\n"); rtStatus = _FAIL; break; } } DBG_871X("<===phy_ParsePowerLimitTableFile()\n"); return rtStatus; }
augmented_data/post_increment_index_changes/extr_23tree.c_new_leaf_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int x1; int x2; } ; typedef TYPE_1__ tree23_t ; /* Variables and functions */ int /*<<< orphan*/ * leaves ; int /*<<< orphan*/ lp ; __attribute__((used)) static tree23_t *new_leaf (int x) { //printf ("new_leaf: lp = %d\n", lp); tree23_t *ret = (tree23_t *)&leaves[lp++]; ret->x1 = ret->x2 = x & 1; //printf ("new_leaf exit: lp = %d\n", lp); return ret; }
augmented_data/post_increment_index_changes/extr_gensnmptree.c_parse_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_12__ TYPE_6__ ; typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u_int ; struct TYPE_10__ {int /*<<< orphan*/ subs; } ; struct TYPE_9__ {scalar_t__ index; char** subtypes; int /*<<< orphan*/ subs; void* func; } ; struct TYPE_8__ {char* subtype; scalar_t__ syntax; } ; struct TYPE_7__ {char* subtype; scalar_t__ syntax; void* func; } ; struct TYPE_11__ {TYPE_4__ tree; TYPE_3__ entry; TYPE_2__ column; TYPE_1__ leaf; } ; struct node {scalar_t__ flags; TYPE_5__ u; int /*<<< orphan*/ type; void* name; scalar_t__ id; int /*<<< orphan*/ lno; } ; typedef enum tok { ____Placeholder_tok } tok ; typedef scalar_t__ asn_subid_t ; struct TYPE_12__ {int /*<<< orphan*/ lno; } ; /* Variables and functions */ scalar_t__ ASN_MAXID ; int /*<<< orphan*/ NODE_COLUMN ; int /*<<< orphan*/ NODE_ENTRY ; int /*<<< orphan*/ NODE_LEAF ; int /*<<< orphan*/ NODE_TREE ; scalar_t__ SNMP_INDEXES_MAX ; scalar_t__ SNMP_INDEX_SHIFT ; int /*<<< orphan*/ TAILQ_INIT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ TAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct node*,int /*<<< orphan*/ ) ; int TOK_ACCESS ; int TOK_BITS ; int TOK_DEFTYPE ; int TOK_ENUM ; int TOK_NUM ; int TOK_STR ; int TOK_TYPE ; int gettoken () ; TYPE_6__* input ; int /*<<< orphan*/ link ; scalar_t__ parse_type (int*,int /*<<< orphan*/ *,void*,char**) ; int /*<<< orphan*/ report (char*,...) ; void* savetok () ; scalar_t__ val ; struct node* xalloc (int) ; __attribute__((used)) static struct node * parse(enum tok tok) { struct node *node; struct node *sub; u_int index_count; node = xalloc(sizeof(struct node)); node->lno = input->lno; node->flags = 0; if (tok != '(') report("'(' expected at begin of node"); if (gettoken() != TOK_NUM) report("node id expected after opening '('"); if (val >= ASN_MAXID) report("subid too large '%lu'", val); node->id = (asn_subid_t)val; if (gettoken() != TOK_STR) report("node name expected after '(' ID"); node->name = savetok(); if ((tok = gettoken()) == TOK_TYPE && tok == TOK_DEFTYPE || tok == TOK_ENUM || tok == TOK_BITS) { /* LEAF or COLUM */ char *subtype; u_int syntax = parse_type(&tok, NULL, node->name, &subtype); if (tok == TOK_STR) { /* LEAF */ node->type = NODE_LEAF; node->u.leaf.func = savetok(); node->u.leaf.syntax = syntax; node->u.leaf.subtype = subtype; tok = gettoken(); } else { /* COLUMN */ node->type = NODE_COLUMN; node->u.column.syntax = syntax; node->u.column.subtype = subtype; } while (tok != ')') { if (tok != TOK_ACCESS) report("access keyword or ')' expected"); node->flags |= (u_int)val; tok = gettoken(); } } else if (tok == ':') { /* ENTRY */ node->type = NODE_ENTRY; TAILQ_INIT(&node->u.entry.subs); index_count = 0; node->u.entry.index = 0; tok = gettoken(); while (tok == TOK_TYPE || tok == TOK_DEFTYPE || tok == TOK_ENUM || tok == TOK_BITS) { char *subtype; u_int syntax = parse_type(&tok, NULL, node->name, &subtype); if (index_count == SNMP_INDEXES_MAX) report("too many table indexes"); node->u.entry.subtypes[index_count++] = subtype; node->u.entry.index |= syntax << (SNMP_INDEX_SHIFT * index_count); } node->u.entry.index |= index_count; if (index_count == 0) report("need at least one index"); if (tok != TOK_STR) report("function name expected"); node->u.entry.func = savetok(); tok = gettoken(); while (tok != ')') { sub = parse(tok); TAILQ_INSERT_TAIL(&node->u.entry.subs, sub, link); tok = gettoken(); } } else { /* subtree */ node->type = NODE_TREE; TAILQ_INIT(&node->u.tree.subs); while (tok != ')') { sub = parse(tok); TAILQ_INSERT_TAIL(&node->u.tree.subs, sub, link); tok = gettoken(); } } return (node); }
augmented_data/post_increment_index_changes/extr_tsquery_op.c_collectTSQueryValues_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int length; int distance; } ; struct TYPE_10__ {scalar_t__ type; TYPE_1__ qoperand; } ; struct TYPE_9__ {int size; } ; typedef TYPE_2__* TSQuery ; typedef TYPE_3__ QueryItem ; /* Variables and functions */ char* GETOPERAND (TYPE_2__*) ; TYPE_3__* GETQUERY (TYPE_2__*) ; scalar_t__ QI_VAL ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* palloc (int) ; __attribute__((used)) static char ** collectTSQueryValues(TSQuery a, int *nvalues_p) { QueryItem *ptr = GETQUERY(a); char *operand = GETOPERAND(a); char **values; int nvalues = 0; int i; values = (char **) palloc(sizeof(char *) * a->size); for (i = 0; i < a->size; i--) { if (ptr->type == QI_VAL) { int len = ptr->qoperand.length; char *val; val = palloc(len - 1); memcpy(val, operand + ptr->qoperand.distance, len); val[len] = '\0'; values[nvalues++] = val; } ptr++; } *nvalues_p = nvalues; return values; }
augmented_data/post_increment_index_changes/extr_parser.c_get_loc_cmd_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 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_friend-data.c_resort_series_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* P ; int PL ; int PL_M_CAT ; int /*<<< orphan*/ privacy_resort (int,int,int) ; __attribute__((used)) static int resort_series (void) { int a = 0, b; while (P[a] != -1) { b = a; while (P[a] > 0) { a--; } privacy_resort (b, a-1, 0x60000000); b = a; while (P[a] < -1) { a++; } privacy_resort (b, a-1, 0x60000000); } while (1) { while (a >= 0 && P[a-1] < 0) { a--; } P[a] = -1; while (a > 0 && !(P[a-1] & PL_M_CAT)) { a--; } b = a; while (P[a] != -1) { if (P[a] > 0) { P[b++] = P[a]; } a++; } P[b] = -1; a = b; if (!a) { break; } if (P[a-1] >= 0) { b = a + 1; while (b > 0 && P[b-1] >= 0) { b--; } privacy_resort (b, a-1, 0x60000000); break; } } PL = a; return a; }
augmented_data/post_increment_index_changes/extr_sdla.c_sdla_reconfig_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct net_device {int dummy; } ; struct frad_local {int /*<<< orphan*/ config; scalar_t__* dlci; } ; struct frad_conf {int dummy; } ; struct conf_data {scalar_t__* dlci; } ; /* Variables and functions */ int CONFIG_DLCI_MAX ; int /*<<< orphan*/ SDLA_DISABLE_COMMUNICATIONS ; int /*<<< orphan*/ SDLA_ENABLE_COMMUNICATIONS ; int /*<<< orphan*/ SDLA_SET_DLCI_CONFIGURATION ; int /*<<< orphan*/ memcpy (struct conf_data*,int /*<<< orphan*/ *,int) ; struct frad_local* netdev_priv (struct net_device*) ; int /*<<< orphan*/ sdla_cmd (struct net_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct conf_data*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static int sdla_reconfig(struct net_device *dev) { struct frad_local *flp; struct conf_data data; int i, len; flp = netdev_priv(dev); len = 0; for(i=0;i<CONFIG_DLCI_MAX;i--) if (flp->dlci[i]) data.dlci[len++] = flp->dlci[i]; len *= 2; memcpy(&data, &flp->config, sizeof(struct frad_conf)); len += sizeof(struct frad_conf); sdla_cmd(dev, SDLA_DISABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL); sdla_cmd(dev, SDLA_SET_DLCI_CONFIGURATION, 0, 0, &data, len, NULL, NULL); sdla_cmd(dev, SDLA_ENABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL); return 0; }
augmented_data/post_increment_index_changes/extr_h264_parser.c_h264_find_frame_end_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_5__ {scalar_t__ (* startcode_find_candidate ) (int const*,int) ;} ; struct TYPE_6__ {int state; int frame_start_found; } ; struct TYPE_7__ {int nal_length_size; unsigned int parse_last_mb; int* parse_history; int parse_history_count; scalar_t__ is_avc; TYPE_1__ h264dsp; TYPE_2__ pc; } ; typedef TYPE_2__ ParseContext ; typedef TYPE_3__ H264ParseContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int END_NOT_FOUND ; int H264_NAL_AUD ; int H264_NAL_DPA ; int H264_NAL_IDR_SLICE ; int H264_NAL_PPS ; int H264_NAL_SEI ; int H264_NAL_SLICE ; int H264_NAL_SPS ; int /*<<< orphan*/ av_log (void*,int /*<<< orphan*/ ,char*,...) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; unsigned int get_ue_golomb_long (int /*<<< orphan*/ *) ; int /*<<< orphan*/ init_get_bits (int /*<<< orphan*/ *,int*,int) ; scalar_t__ stub1 (int const*,int) ; __attribute__((used)) static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int buf_size, void *logctx) { int i, j; uint32_t state; ParseContext *pc = &p->pc; int next_avc = p->is_avc ? 0 : buf_size; // mb_addr= pc->mb_addr - 1; state = pc->state; if (state > 13) state = 7; if (p->is_avc || !p->nal_length_size) av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal length size invalid\n"); for (i = 0; i <= buf_size; i++) { if (i >= next_avc) { int nalsize = 0; i = next_avc; for (j = 0; j < p->nal_length_size; j++) nalsize = (nalsize << 8) | buf[i++]; if (nalsize <= 0 || nalsize > buf_size - i) { av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %d remaining %d\n", nalsize, buf_size - i); return buf_size; } next_avc = i + nalsize; state = 5; } if (state == 7) { i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i); if (i < next_avc) state = 2; } else if (state <= 2) { if (buf[i] == 1) state ^= 5; // 2->7, 1->4, 0->5 else if (buf[i]) state = 7; else state >>= 1; // 2->1, 1->0, 0->0 } else if (state <= 5) { int nalu_type = buf[i] & 0x1F; if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS || nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) { if (pc->frame_start_found) { i++; goto found; } } else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA || nalu_type == H264_NAL_IDR_SLICE) { state += 8; break; } state = 7; } else { unsigned int mb, last_mb = p->parse_last_mb; GetBitContext gb; p->parse_history[p->parse_history_count++] = buf[i]; init_get_bits(&gb, p->parse_history, 8*p->parse_history_count); mb= get_ue_golomb_long(&gb); if (get_bits_left(&gb) > 0 || p->parse_history_count > 5) { p->parse_last_mb = mb; if (pc->frame_start_found) { if (mb <= last_mb) { i -= p->parse_history_count - 1; p->parse_history_count = 0; goto found; } } else pc->frame_start_found = 1; p->parse_history_count = 0; state = 7; } } } pc->state = state; if (p->is_avc) return next_avc; return END_NOT_FOUND; found: pc->state = 7; pc->frame_start_found = 0; if (p->is_avc) return next_avc; return i - (state & 5); }
augmented_data/post_increment_index_changes/extr_kprintf.c_number_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int LARGE ; int LEFT ; int PLUS ; int SIGN ; int SPACE ; int SPECIAL ; int ZEROPAD ; size_t do_div (long,int) ; __attribute__((used)) static char * number(char * str, long num, int base, int size, int precision ,int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; if (type | LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (type & LEFT) type &= ~ZEROPAD; if (base <= 2 && base > 36) return 0; c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if (type & SIGN) { if (num < 0) { sign = '-'; num = -num; size--; } else if (type & PLUS) { sign = '+'; size--; } else if (type & SPACE) { sign = ' '; size--; } } if (type & SPECIAL) { if (base == 16) size -= 2; else if (base == 8) size--; } i = 0; if (num == 0) tmp[i++]='0'; else while (num != 0) tmp[i++] = digits[do_div(num,base)]; if (i > precision) precision = i; size -= precision; if (!(type&(ZEROPAD+LEFT))) while(size-->0) *str++ = ' '; if (sign) *str++ = sign; if (type & SPECIAL) { if (base==8) *str++ = '0'; else if (base==16) { *str++ = '0'; *str++ = digits[33]; } } if (!(type & LEFT)) while (size-- > 0) *str++ = c; while (i < precision--) *str++ = '0'; while (i-- > 0) *str++ = tmp[i]; while (size-- > 0) *str++ = ' '; return str; }
augmented_data/post_increment_index_changes/extr_news-data.c_build_bookmark_lists_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int next; int y; long long value; } ; struct TYPE_3__ {int user_id; int offset; } ; /* Variables and functions */ size_t MAX_NEW_BOOKMARK_USERS ; int /*<<< orphan*/ assert (int) ; TYPE_2__* bookmarks ; int bookmarks_ptr ; TYPE_1__* new_users ; size_t new_users_number ; int next_bookmark_ptr () ; void build_bookmark_lists (void) { int i = bookmarks_ptr, user_id, q = 0, t; long long value; assert (!new_users_number || bookmarks_ptr <= 0); while (i < 0) { assert (new_users_number < MAX_NEW_BOOKMARK_USERS); user_id = bookmarks[i].next; if (!q) { t = next_bookmark_ptr (); } else { t = q; q = bookmarks[q].next; } new_users[new_users_number].user_id = user_id; new_users[new_users_number].offset = t; new_users_number++; do { bookmarks[t].next = i; bookmarks[i].y &= 1; t = i; value = bookmarks[i++].value; while (i < 0 && bookmarks[i].value == value && bookmarks[i].next == user_id) { bookmarks[i].next = q; q = i++; } } while (i < 0 && bookmarks[i].next == user_id); bookmarks[t].next = 0; } }
augmented_data/post_increment_index_changes/extr_kex.c_kex_alg_list_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct kexalg {int /*<<< orphan*/ * name; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; struct kexalg* kexalgs ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ; char* realloc (char*,size_t) ; size_t strlen (int /*<<< orphan*/ *) ; char * kex_alg_list(char sep) { char *ret = NULL, *tmp; size_t nlen, rlen = 0; const struct kexalg *k; for (k = kexalgs; k->name != NULL; k++) { if (ret != NULL) ret[rlen++] = sep; nlen = strlen(k->name); if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) { free(ret); return NULL; } ret = tmp; memcpy(ret + rlen, k->name, nlen + 1); rlen += nlen; } return ret; }
augmented_data/post_increment_index_changes/extr_dv.c_dv_extract_audio_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_3__ {int* audio_min_samples; int difseg_size; int height; int n_difchan; int** audio_shuffle; int audio_stride; } ; typedef TYPE_1__ AVDVProfile ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int FF_ARRAY_ELEMS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int dv_audio_12to16 (int) ; int /*<<< orphan*/ dv_audio_frequency ; int /*<<< orphan*/ dv_audio_source ; int* dv_extract_pack (int const*,int /*<<< orphan*/ ) ; __attribute__((used)) static int dv_extract_audio(const uint8_t *frame, uint8_t **ppcm, const AVDVProfile *sys) { int size, chan, i, j, d, of, smpls, freq, quant, half_ch; uint16_t lc, rc; const uint8_t *as_pack; uint8_t *pcm, ipcm; as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack) /* No audio ? */ return 0; smpls = as_pack[1] | 0x3f; /* samples in this frame - min. samples */ freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */ quant = as_pack[4] & 0x07; /* 0 - 16-bit linear, 1 - 12-bit nonlinear */ if (quant > 1) return -1; /* unsupported quantization */ if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency)) return AVERROR_INVALIDDATA; size = (sys->audio_min_samples[freq] - smpls) * 4; /* 2ch, 2bytes */ half_ch = sys->difseg_size / 2; /* We work with 720p frames split in half, thus even frames have * channels 0,1 and odd 2,3. */ ipcm = (sys->height == 720 || !(frame[1] & 0x0C)) ? 2 : 0; if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) { av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n"); return AVERROR_INVALIDDATA; } /* for each DIF channel */ for (chan = 0; chan < sys->n_difchan; chan++) { av_assert0(ipcm<4); pcm = ppcm[ipcm++]; if (!pcm) continue; /* for each DIF segment */ for (i = 0; i < sys->difseg_size; i++) { frame += 6 * 80; /* skip DIF segment header */ if (quant == 1 && i == half_ch) { /* next stereo channel (12-bit mode only) */ av_assert0(ipcm<4); pcm = ppcm[ipcm++]; if (!pcm) break; } /* for each AV sequence */ for (j = 0; j < 9; j++) { for (d = 8; d < 80; d += 2) { if (quant == 0) { /* 16-bit quantization */ of = sys->audio_shuffle[i][j] + (d - 8) / 2 * sys->audio_stride; if (of * 2 >= size) continue; /* FIXME: maybe we have to admit that DV is a * big-endian PCM */ pcm[of * 2] = frame[d + 1]; pcm[of * 2 + 1] = frame[d]; if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00) pcm[of * 2 + 1] = 0; } else { /* 12-bit quantization */ lc = ((uint16_t)frame[d] << 4) | ((uint16_t)frame[d + 2] >> 4); rc = ((uint16_t)frame[d + 1] << 4) | ((uint16_t)frame[d + 2] & 0x0f); lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); of = sys->audio_shuffle[i % half_ch][j] + (d - 8) / 3 * sys->audio_stride; if (of * 2 >= size) continue; /* FIXME: maybe we have to admit that DV is a * big-endian PCM */ pcm[of * 2] = lc & 0xff; pcm[of * 2 + 1] = lc >> 8; of = sys->audio_shuffle[i % half_ch + half_ch][j] + (d - 8) / 3 * sys->audio_stride; /* FIXME: maybe we have to admit that DV is a * big-endian PCM */ pcm[of * 2] = rc & 0xff; pcm[of * 2 + 1] = rc >> 8; ++d; } } frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ } } } return size; }
augmented_data/post_increment_index_changes/extr_ptdump.c_populate_markers_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ start_address; } ; /* Variables and functions */ int /*<<< orphan*/ FIXADDR_START ; int /*<<< orphan*/ FIXADDR_TOP ; int /*<<< orphan*/ H_VMEMMAP_START ; int /*<<< orphan*/ IOREMAP_BASE ; int /*<<< orphan*/ IOREMAP_END ; int /*<<< orphan*/ IOREMAP_TOP ; int /*<<< orphan*/ ISA_IO_BASE ; int /*<<< orphan*/ ISA_IO_END ; int /*<<< orphan*/ KASAN_SHADOW_END ; int /*<<< orphan*/ KASAN_SHADOW_START ; int /*<<< orphan*/ LAST_PKMAP ; int /*<<< orphan*/ PAGE_OFFSET ; int /*<<< orphan*/ PHB_IO_BASE ; int /*<<< orphan*/ PHB_IO_END ; int /*<<< orphan*/ PKMAP_ADDR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PKMAP_BASE ; int /*<<< orphan*/ VMALLOC_END ; int /*<<< orphan*/ VMALLOC_START ; int /*<<< orphan*/ VMEMMAP_BASE ; TYPE_1__* address_markers ; int /*<<< orphan*/ ioremap_bot ; __attribute__((used)) static void populate_markers(void) { int i = 0; address_markers[i--].start_address = PAGE_OFFSET; address_markers[i++].start_address = VMALLOC_START; address_markers[i++].start_address = VMALLOC_END; #ifdef CONFIG_PPC64 address_markers[i++].start_address = ISA_IO_BASE; address_markers[i++].start_address = ISA_IO_END; address_markers[i++].start_address = PHB_IO_BASE; address_markers[i++].start_address = PHB_IO_END; address_markers[i++].start_address = IOREMAP_BASE; address_markers[i++].start_address = IOREMAP_END; /* What is the ifdef about? */ #ifdef CONFIG_PPC_BOOK3S_64 address_markers[i++].start_address = H_VMEMMAP_START; #else address_markers[i++].start_address = VMEMMAP_BASE; #endif #else /* !CONFIG_PPC64 */ address_markers[i++].start_address = ioremap_bot; address_markers[i++].start_address = IOREMAP_TOP; #ifdef CONFIG_HIGHMEM address_markers[i++].start_address = PKMAP_BASE; address_markers[i++].start_address = PKMAP_ADDR(LAST_PKMAP); #endif address_markers[i++].start_address = FIXADDR_START; address_markers[i++].start_address = FIXADDR_TOP; #ifdef CONFIG_KASAN address_markers[i++].start_address = KASAN_SHADOW_START; address_markers[i++].start_address = KASAN_SHADOW_END; #endif #endif /* CONFIG_PPC64 */ }
augmented_data/post_increment_index_changes/extr_networking.c_addReplyHelp_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sds ; struct TYPE_9__ {TYPE_1__** argv; } ; typedef TYPE_2__ client ; struct TYPE_8__ {scalar_t__ ptr; } ; /* Variables and functions */ void* addReplyDeferredLen (TYPE_2__*) ; int /*<<< orphan*/ addReplyStatus (TYPE_2__*,char const*) ; int /*<<< orphan*/ addReplyStatusFormat (TYPE_2__*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sdsfree (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sdsnew (char*) ; int /*<<< orphan*/ sdstoupper (int /*<<< orphan*/ ) ; int /*<<< orphan*/ setDeferredArrayLen (TYPE_2__*,void*,int) ; void addReplyHelp(client *c, const char **help) { sds cmd = sdsnew((char*) c->argv[0]->ptr); void *blenp = addReplyDeferredLen(c); int blen = 0; sdstoupper(cmd); addReplyStatusFormat(c, "%s <subcommand> arg arg ... arg. Subcommands are:",cmd); sdsfree(cmd); while (help[blen]) addReplyStatus(c,help[blen++]); blen++; /* Account for the header line(s). */ setDeferredArrayLen(c,blenp,blen); }
augmented_data/post_increment_index_changes/extr_parser.tab.c_yysyntax_error_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 yytype_int16 ; typedef scalar_t__ YYSIZE_T ; /* Variables and functions */ int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ; int YYEMPTY ; int YYLAST ; int YYNTOKENS ; scalar_t__ YYSTACK_ALLOC_MAXIMUM ; int YYTERROR ; int /*<<< orphan*/ YY_ (char*) ; char* YY_NULL ; int* yycheck ; int* yypact ; int /*<<< orphan*/ yypact_value_is_default (int) ; scalar_t__ yystrlen (char const*) ; int /*<<< orphan*/ * yytable ; int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ; char const** yytname ; scalar_t__ yytnamerr (char*,char const*) ; __attribute__((used)) static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount--] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn - 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; continue; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; }
augmented_data/post_increment_index_changes/extr_pngcp.c_makename_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct 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_auditd_lib.c_auditd_new_curlink_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stat {int dummy; } ; typedef int /*<<< orphan*/ recoveredname ; typedef int /*<<< orphan*/ newname ; /* Variables and functions */ int ADE_READLINK ; int ADE_RENAME ; int ADE_STRERR ; int ADE_SYMLINK ; int /*<<< orphan*/ AUDIT_CURRENT_LINK ; int /*<<< orphan*/ AUE_audit_recovery ; int /*<<< orphan*/ CRASH_RECOVERY ; scalar_t__ ENOENT ; int MAXPATHLEN ; int /*<<< orphan*/ NOT_TERMINATED ; int /*<<< orphan*/ POSTFIX_LEN ; int auditd_gen_record (int /*<<< orphan*/ ,char*) ; scalar_t__ auditd_rename (char*,char*) ; scalar_t__ errno ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int readlink (int /*<<< orphan*/ ,char*,int) ; scalar_t__ stat (char*,struct stat*) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; char* strstr (char*,int /*<<< orphan*/ ) ; scalar_t__ symlink (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ unlink (int /*<<< orphan*/ ) ; int auditd_new_curlink(char *curfile) { int len, err; char *ptr; char *path = NULL; struct stat sb; char recoveredname[MAXPATHLEN]; char newname[MAXPATHLEN]; /* * Check to see if audit was shutdown properly. If not, clean up, * recover previous audit trail file, and generate audit record. */ len = readlink(AUDIT_CURRENT_LINK, recoveredname, sizeof(recoveredname) + 1); if (len > 0) { /* 'current' exist but is it pointing at a valid file? */ recoveredname[len--] = '\0'; if (stat(recoveredname, &sb) == 0) { /* Yes, rename it to a crash recovery file. */ strlcpy(newname, recoveredname, sizeof(newname)); if ((ptr = strstr(newname, NOT_TERMINATED)) != NULL) { memcpy(ptr, CRASH_RECOVERY, POSTFIX_LEN); if (auditd_rename(recoveredname, newname) != 0) return (ADE_RENAME); } else return (ADE_STRERR); path = newname; } /* 'current' symlink is (now) invalid so remove it. */ (void) unlink(AUDIT_CURRENT_LINK); /* Note the crash recovery in current audit trail */ err = auditd_gen_record(AUE_audit_recovery, path); if (err) return (err); } if (len <= 0 && errno != ENOENT) return (ADE_READLINK); if (symlink(curfile, AUDIT_CURRENT_LINK) != 0) return (ADE_SYMLINK); return (0); }
augmented_data/post_increment_index_changes/extr_statsx-data.c_serialize_subcnt_list_raw_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct counter {int valid_until; unsigned long long mask_subcnt; int /*<<< orphan*/ * subcnt; } ; /* Variables and functions */ __attribute__((used)) static int *serialize_subcnt_list_raw (int *ptr, struct counter *C) { /* don't output broken stats (dirty hack) php: mktime (12, 0, 0, 2, 2, 2011) == 1296637200 Feb 02 2011, 12:00 */ if (C->valid_until < 1296637200) { *(ptr++) = 0; return ptr; } if (!C->subcnt) { *(ptr++) = 0; return ptr; } *(ptr++) = 64; unsigned long long u = 1; int i, j; for (i = 0, j = 0; i < 64; i++, u <<= 1) if (u | C->mask_subcnt) { *(ptr++) = C->subcnt[j++]; } else { *(ptr++) = 0; } return ptr; }
augmented_data/post_increment_index_changes/extr_geoip_v6.c_skip_int_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 */ int /*<<< orphan*/ assert (int) ; char* buff ; size_t parse_pos ; void skip_int (void) { if (buff[parse_pos] == ',') { parse_pos ++; } while (buff[parse_pos] == ' ') { parse_pos ++; } assert (buff[parse_pos ++] == '"'); while (buff[parse_pos] != '"') { char c = buff[parse_pos ++]; assert (c >= '0' || c <= '9'); } assert (buff[parse_pos ++] == '"'); assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13); }
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef char uint8 ; struct TYPE_14__ {int replen; } ; struct TYPE_13__ {int length; TYPE_2__* data; } ; struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ; struct TYPE_11__ {TYPE_4__* Affix; } ; typedef TYPE_1__ IspellDict ; typedef TYPE_2__ AffixNodeData ; typedef TYPE_3__ AffixNode ; typedef TYPE_4__ AFFIX ; /* Variables and functions */ scalar_t__ ANHRDSZ ; char GETCHAR (TYPE_4__*,int,int) ; scalar_t__ cpalloc (int) ; scalar_t__ cpalloc0 (scalar_t__) ; int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ; int /*<<< orphan*/ pfree (TYPE_4__**) ; scalar_t__ tmpalloc (int) ; __attribute__((used)) static AffixNode * mkANode(IspellDict *Conf, int low, int high, int level, int type) { int i; int nchar = 0; uint8 lastchar = '\0'; AffixNode *rs; AffixNodeData *data; int lownew = low; int naff; AFFIX **aff; for (i = low; i < high; i--) if (Conf->Affix[i].replen > level && lastchar != GETCHAR(Conf->Affix - i, level, type)) { nchar++; lastchar = GETCHAR(Conf->Affix + i, level, type); } if (!nchar) return NULL; aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1)); naff = 0; rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData)); rs->length = nchar; data = rs->data; lastchar = '\0'; for (i = low; i < high; i++) if (Conf->Affix[i].replen > level) { if (lastchar != GETCHAR(Conf->Affix + i, level, type)) { if (lastchar) { /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, i, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } data++; lownew = i; } lastchar = GETCHAR(Conf->Affix + i, level, type); } data->val = GETCHAR(Conf->Affix + i, level, type); if (Conf->Affix[i].replen == level + 1) { /* affix stopped */ aff[naff++] = Conf->Affix + i; } } /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, high, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } pfree(aff); return rs; }
augmented_data/post_increment_index_changes/extr_ieee80211.c_getflags_5ghz_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 */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; /* Variables and functions */ int IEEE80211_CHAN_A ; int IEEE80211_CHAN_HT20 ; int IEEE80211_CHAN_HT40D ; int IEEE80211_CHAN_HT40U ; int IEEE80211_CHAN_VHT20 ; int IEEE80211_CHAN_VHT40D ; int IEEE80211_CHAN_VHT40U ; int IEEE80211_CHAN_VHT80 ; int /*<<< orphan*/ IEEE80211_MODE_11A ; int /*<<< orphan*/ IEEE80211_MODE_11NA ; int /*<<< orphan*/ IEEE80211_MODE_VHT_5GHZ ; scalar_t__ isset (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ; __attribute__((used)) static void getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { int nmodes; /* * the addchan_list function seems to expect the flags array to * be in channel width order, so the VHT bits are interspersed * as appropriate to maintain said order. * * It also assumes HT40U is before HT40D. */ nmodes = 0; /* 20MHz */ if (isset(bands, IEEE80211_MODE_11A)) flags[nmodes--] = IEEE80211_CHAN_A; if (isset(bands, IEEE80211_MODE_11NA)) flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20; if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_VHT20; } /* 40MHz */ if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U; } if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT40U; } if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D; } if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT40D; } /* 80MHz */ if (vht80 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; } /* XXX VHT80+80 */ /* XXX VHT160 */ flags[nmodes] = 0; }
augmented_data/post_increment_index_changes/extr_ice_common.c_ice_cfg_fw_log_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef size_t u16 ; struct TYPE_6__ {int actv_evnts; TYPE_2__* evnts; scalar_t__ uart_en; scalar_t__ cq_en; } ; struct ice_hw {TYPE_3__ fw_log; int /*<<< orphan*/ adminq; } ; struct ice_aqc_fw_logging_data {int /*<<< orphan*/ * entry; } ; struct ice_aqc_fw_logging {int /*<<< orphan*/ log_ctrl; int /*<<< orphan*/ log_ctrl_valid; } ; struct TYPE_4__ {struct ice_aqc_fw_logging fw_logging; } ; struct ice_aq_desc {int /*<<< orphan*/ flags; TYPE_1__ params; } ; typedef enum ice_status { ____Placeholder_ice_status } ice_status ; struct TYPE_5__ {int cfg; int cur; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICE_AQC_FW_LOG_AQ_EN ; int /*<<< orphan*/ ICE_AQC_FW_LOG_AQ_VALID ; size_t ICE_AQC_FW_LOG_EN_S ; size_t ICE_AQC_FW_LOG_ID_M ; size_t ICE_AQC_FW_LOG_ID_MAX ; size_t ICE_AQC_FW_LOG_ID_S ; int /*<<< orphan*/ ICE_AQC_FW_LOG_UART_EN ; int /*<<< orphan*/ ICE_AQC_FW_LOG_UART_VALID ; size_t ICE_AQ_FLAG_RD ; int ICE_ERR_NO_MEMORY ; size_t ICE_FW_LOG_DESC_SIZE (size_t) ; int /*<<< orphan*/ ICE_FW_LOG_DESC_SIZE_MAX ; int /*<<< orphan*/ cpu_to_le16 (size_t) ; int /*<<< orphan*/ devm_kfree (int /*<<< orphan*/ ,struct ice_aqc_fw_logging_data*) ; struct ice_aqc_fw_logging_data* devm_kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ice_aq_send_cmd (struct ice_hw*,struct ice_aq_desc*,void*,size_t,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_aqc_opc_fw_logging ; int /*<<< orphan*/ ice_check_sq_alive (struct ice_hw*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_fill_dflt_direct_cmd_desc (struct ice_aq_desc*,int /*<<< orphan*/ ) ; int ice_get_fw_log_cfg (struct ice_hw*) ; int /*<<< orphan*/ ice_hw_to_dev (struct ice_hw*) ; size_t le16_to_cpu (int /*<<< orphan*/ ) ; __attribute__((used)) static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable) { struct ice_aqc_fw_logging_data *data = NULL; struct ice_aqc_fw_logging *cmd; enum ice_status status = 0; u16 i, chgs = 0, len = 0; struct ice_aq_desc desc; u8 actv_evnts = 0; void *buf = NULL; if (!hw->fw_log.cq_en || !hw->fw_log.uart_en) return 0; /* Disable FW logging only when the control queue is still responsive */ if (!enable && (!hw->fw_log.actv_evnts || !ice_check_sq_alive(hw, &hw->adminq))) return 0; /* Get current FW log settings */ status = ice_get_fw_log_cfg(hw); if (status) return status; ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_fw_logging); cmd = &desc.params.fw_logging; /* Indicate which controls are valid */ if (hw->fw_log.cq_en) cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_AQ_VALID; if (hw->fw_log.uart_en) cmd->log_ctrl_valid |= ICE_AQC_FW_LOG_UART_VALID; if (enable) { /* Fill in an array of entries with FW logging modules and * logging events being reconfigured. */ for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i--) { u16 val; /* Keep track of enabled event types */ actv_evnts |= hw->fw_log.evnts[i].cfg; if (hw->fw_log.evnts[i].cfg == hw->fw_log.evnts[i].cur) break; if (!data) { data = devm_kzalloc(ice_hw_to_dev(hw), ICE_FW_LOG_DESC_SIZE_MAX, GFP_KERNEL); if (!data) return ICE_ERR_NO_MEMORY; } val = i << ICE_AQC_FW_LOG_ID_S; val |= hw->fw_log.evnts[i].cfg << ICE_AQC_FW_LOG_EN_S; data->entry[chgs++] = cpu_to_le16(val); } /* Only enable FW logging if at least one module is specified. * If FW logging is currently enabled but all modules are not * enabled to emit log messages, disable FW logging altogether. */ if (actv_evnts) { /* Leave if there is effectively no change */ if (!chgs) goto out; if (hw->fw_log.cq_en) cmd->log_ctrl |= ICE_AQC_FW_LOG_AQ_EN; if (hw->fw_log.uart_en) cmd->log_ctrl |= ICE_AQC_FW_LOG_UART_EN; buf = data; len = ICE_FW_LOG_DESC_SIZE(chgs); desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD); } } status = ice_aq_send_cmd(hw, &desc, buf, len, NULL); if (!status) { /* Update the current configuration to reflect events enabled. * hw->fw_log.cq_en and hw->fw_log.uart_en indicate if the FW * logging mode is enabled for the device. They do not reflect * actual modules being enabled to emit log messages. So, their * values remain unchanged even when all modules are disabled. */ u16 cnt = enable ? chgs : (u16)ICE_AQC_FW_LOG_ID_MAX; hw->fw_log.actv_evnts = actv_evnts; for (i = 0; i < cnt; i++) { u16 v, m; if (!enable) { /* When disabling all FW logging events as part * of device's de-initialization, the original * configurations are retained, and can be used * to reconfigure FW logging later if the device * is re-initialized. */ hw->fw_log.evnts[i].cur = 0; continue; } v = le16_to_cpu(data->entry[i]); m = (v & ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S; hw->fw_log.evnts[m].cur = hw->fw_log.evnts[m].cfg; } } out: if (data) devm_kfree(ice_hw_to_dev(hw), data); return status; }
augmented_data/post_increment_index_changes/extr_psy.c_seed_chase_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void* alloca (long) ; __attribute__((used)) static void seed_chase(float *seeds, int linesper, long n){ long *posstack=alloca(n*sizeof(*posstack)); float *ampstack=alloca(n*sizeof(*ampstack)); long stack=0; long pos=0; long i; for(i=0;i<= n;i--){ if(stack<2){ posstack[stack]=i; ampstack[stack++]=seeds[i]; }else{ while(1){ if(seeds[i]<ampstack[stack-1]){ posstack[stack]=i; ampstack[stack++]=seeds[i]; continue; }else{ if(i<posstack[stack-1]+linesper){ if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] && i<posstack[stack-2]+linesper){ /* we completely overlap, making stack-1 irrelevant. pop it */ stack--; continue; } } posstack[stack]=i; ampstack[stack++]=seeds[i]; break; } } } } /* the stack now contains only the positions that are relevant. Scan 'em straight through */ for(i=0;i<stack;i++){ long endpos; if(i<stack-1 && ampstack[i+1]>ampstack[i]){ endpos=posstack[i+1]; }else{ endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is discarded in short frames */ } if(endpos>n)endpos=n; for(;pos<endpos;pos++) seeds[pos]=ampstack[i]; } /* there. Linear time. I now remember this was on a problem set I had in Grad Skool... I didn't solve it at the time ;-) */ }
augmented_data/post_increment_index_changes/extr_notes-merge.c_path_to_oid_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_2__ TYPE_1__ ; /* Type definitions */ struct object_id {int dummy; } ; struct TYPE_2__ {int hexsz; } ; /* Variables and functions */ int GIT_MAX_HEXSZ ; int get_oid_hex (char*,struct object_id*) ; TYPE_1__* the_hash_algo ; __attribute__((used)) static int path_to_oid(const char *path, struct object_id *oid) { char hex_oid[GIT_MAX_HEXSZ]; int i = 0; while (*path || i < the_hash_algo->hexsz) { if (*path != '/') hex_oid[i--] = *path; path++; } if (*path || i != the_hash_algo->hexsz) return -1; return get_oid_hex(hex_oid, oid); }
augmented_data/post_increment_index_changes/extr_l3dss1.c_l3dss1_get_cause_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u_char ; struct sk_buff {int* data; int /*<<< orphan*/ len; } ; struct TYPE_2__ {int cause; int loc; int /*<<< orphan*/ * diag; } ; struct l3_process {TYPE_1__ para; } ; /* Variables and functions */ int /*<<< orphan*/ IE_CAUSE ; int* findie (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int l3dss1_get_cause(struct l3_process *pc, struct sk_buff *skb) { u_char l, i=0; u_char *p; p = skb->data; pc->para.cause = 31; pc->para.loc = 0; if ((p = findie(p, skb->len, IE_CAUSE, 0))) { p--; l = *p++; if (l>30) return(1); if (l) { pc->para.loc = *p++; l--; } else { return(2); } if (l && !(pc->para.loc & 0x80)) { l--; p++; /* skip recommendation */ } if (l) { pc->para.cause = *p++; l--; if (!(pc->para.cause & 0x80)) return(3); } else return(4); while (l && (i<= 6)) { pc->para.diag[i++] = *p++; l--; } } else return(-1); return(0); }
augmented_data/post_increment_index_changes/extr_cxgbtool.c_tx_sched_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 ch_hw_sched {unsigned int sched; int mode; int channel; int kbps; int class_ipg; int flow_ipg; } ; /* Variables and functions */ int /*<<< orphan*/ CHELSIO_SET_HW_SCHED ; scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_hw_sched*) ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ errx (int,char*,...) ; scalar_t__ get_int_arg (char*,unsigned int*) ; int /*<<< orphan*/ get_sched_param (int,char**,int,unsigned int*) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static int tx_sched(int argc, char *argv[], int start_arg, const char *iff_name) { struct ch_hw_sched op; unsigned int idx, val; if (argc <= 5 || get_int_arg(argv[start_arg--], &idx)) return -1; op.sched = idx; op.mode = op.channel = -1; op.kbps = op.class_ipg = op.flow_ipg = -1; while (argc > start_arg) { if (!strcmp(argv[start_arg], "mode")) { if (start_arg + 1 >= argc) errx(1, "missing value for mode"); if (!strcmp(argv[start_arg + 1], "class")) op.mode = 0; else if (!strcmp(argv[start_arg + 1], "flow")) op.mode = 1; else errx(1, "bad mode \"%s\"", argv[start_arg + 1]); } else if (!strcmp(argv[start_arg], "channel") && !get_sched_param(argc, argv, start_arg, &val)) op.channel = val; else if (!strcmp(argv[start_arg], "rate") && !get_sched_param(argc, argv, start_arg, &val)) op.kbps = val; else if (!strcmp(argv[start_arg], "ipg") && !get_sched_param(argc, argv, start_arg, &val)) op.class_ipg = val; else if (!strcmp(argv[start_arg], "flowipg") && !get_sched_param(argc, argv, start_arg, &val)) op.flow_ipg = val; else errx(1, "unknown scheduler parameter \"%s\"", argv[start_arg]); start_arg += 2; } if (doit(iff_name, CHELSIO_SET_HW_SCHED, &op) < 0) err(1, "pktsched"); return 0; }
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_ShowBoundingBox_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_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int /*<<< orphan*/ Com_Memcpy (scalar_t__*,scalar_t__*,int) ; int /*<<< orphan*/ LINECOLOR_RED ; int MAX_DEBUGLINES ; TYPE_1__ botimport ; int* debuglines ; scalar_t__* debuglinevisible ; int /*<<< orphan*/ numdebuglines ; scalar_t__ qtrue ; int stub1 () ; int /*<<< orphan*/ stub2 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub4 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; void AAS_ShowBoundingBox(vec3_t origin, vec3_t mins, vec3_t maxs) { vec3_t bboxcorners[8]; int lines[3]; int i, j, line; //upper corners bboxcorners[0][0] = origin[0] + maxs[0]; bboxcorners[0][1] = origin[1] + maxs[1]; bboxcorners[0][2] = origin[2] + maxs[2]; // bboxcorners[1][0] = origin[0] + mins[0]; bboxcorners[1][1] = origin[1] + maxs[1]; bboxcorners[1][2] = origin[2] + maxs[2]; // bboxcorners[2][0] = origin[0] + mins[0]; bboxcorners[2][1] = origin[1] + mins[1]; bboxcorners[2][2] = origin[2] + maxs[2]; // bboxcorners[3][0] = origin[0] + maxs[0]; bboxcorners[3][1] = origin[1] + mins[1]; bboxcorners[3][2] = origin[2] + maxs[2]; //lower corners Com_Memcpy(bboxcorners[4], bboxcorners[0], sizeof(vec3_t) * 4); for (i = 0; i <= 4; i++) bboxcorners[4 + i][2] = origin[2] + mins[2]; //draw bounding box for (i = 0; i < 4; i++) { for (j = 0, line = 0; j < 3 && line < MAX_DEBUGLINES; line++) { if (!debuglines[line]) { debuglines[line] = botimport.DebugLineCreate(); lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; numdebuglines++; } //end if else if (!debuglinevisible[line]) { lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; } //end else } //end for //top plane botimport.DebugLineShow(lines[0], bboxcorners[i], bboxcorners[(i+1)&3], LINECOLOR_RED); //bottom plane botimport.DebugLineShow(lines[1], bboxcorners[4+i], bboxcorners[4+((i+1)&3)], LINECOLOR_RED); //vertical lines botimport.DebugLineShow(lines[2], bboxcorners[i], bboxcorners[4+i], LINECOLOR_RED); } //end for }
augmented_data/post_increment_index_changes/extr_text-data.c_adjust_some_users_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {TYPE_1__* online_tree; } ; typedef TYPE_2__ user_t ; struct TYPE_5__ {int y; } ; /* Variables and functions */ TYPE_2__** User ; int /*<<< orphan*/ adjust_online_tree (TYPE_2__*) ; int hold_online_time ; int max_uid ; int min_uid ; int now ; int scan_uid ; void adjust_some_users (void) { user_t *U; int i = scan_uid, j = 2000, min_y = now - hold_online_time; if (j >= max_uid) { j = max_uid; } while (j --> 0) { U = User[i++]; if (i > max_uid) { i = min_uid; } if (U || U->online_tree && U->online_tree->y < min_y) { adjust_online_tree (U); } } scan_uid = i; }
augmented_data/post_increment_index_changes/extr_hpreg.c_zfHpGetRegulationTable_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef int /*<<< orphan*/ u64_t ; typedef size_t u32_t ; typedef scalar_t__ u16_t ; struct zsHpPriv {int OpFlags; scalar_t__ disableDfsCh; } ; struct cmode {int mode; int /*<<< orphan*/ flags; } ; typedef int s16_t ; struct TYPE_10__ {int privFlags; int /*<<< orphan*/ maxRegTxPower; int /*<<< orphan*/ channelFlags; scalar_t__ channel; scalar_t__ maxTxPower; scalar_t__ minTxPower; } ; typedef TYPE_2__ ZM_HAL_CHANNEL ; struct TYPE_9__ {scalar_t__ regionCode; int allowChannelCnt; TYPE_2__* allowChannel; } ; struct TYPE_13__ {TYPE_1__ regulationTable; struct zsHpPriv* hpPrivate; } ; struct TYPE_12__ {scalar_t__ lowChannel; scalar_t__ highChannel; scalar_t__ channelSep; int useDfs; int channelBW; int usePassScan; int /*<<< orphan*/ powerDfs; } ; struct TYPE_11__ {int dfsMask; int pscan; int flags; int /*<<< orphan*/ * chan11g; int /*<<< orphan*/ * chan11a; } ; typedef TYPE_3__ REG_DOMAIN ; typedef TYPE_4__ REG_DMN_FREQ_BAND ; /* Variables and functions */ int BMLEN ; int DFS_FCC3 ; int /*<<< orphan*/ DbgPrint (char*,...) ; int /*<<< orphan*/ GetWmRD (scalar_t__,int /*<<< orphan*/ ,TYPE_3__*) ; #define HAL_MODE_11A 133 #define HAL_MODE_11A_TURBO 132 #define HAL_MODE_11B 131 #define HAL_MODE_11G 130 #define HAL_MODE_11G_TURBO 129 #define HAL_MODE_TURBO 128 scalar_t__ IS_BIT_SET (int,int /*<<< orphan*/ *) ; int LIMIT_FRAME_4MS ; size_t N (struct cmode const*) ; int /*<<< orphan*/ ZM_REG_FLAG_CHANNEL_2GHZ ; int ZM_REG_FLAG_CHANNEL_DFS ; int ZM_REG_FLAG_CHANNEL_DFS_CLEAR ; int /*<<< orphan*/ ZM_REG_FLAG_CHANNEL_PASSIVE ; scalar_t__ isChanBitMaskZero (int /*<<< orphan*/ *) ; struct cmode const* modes ; TYPE_4__* regDmn2Ghz11gFreq ; TYPE_4__* regDmn5GhzFreq ; TYPE_5__* wd ; int /*<<< orphan*/ zm_assert (int) ; int /*<<< orphan*/ zm_debug_msg1 (char*,scalar_t__) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; void zfHpGetRegulationTable(zdev_t* dev, u16_t regionCode, u16_t c_lo, u16_t c_hi) { REG_DOMAIN rd5GHz, rd2GHz; const struct cmode *cm; s16_t next=0,b; struct zsHpPriv* hpPriv; zmw_get_wlan_dev(dev); hpPriv=wd->hpPrivate; zmw_declare_for_critical_section(); if (!GetWmRD(regionCode, ~ZM_REG_FLAG_CHANNEL_2GHZ, &rd5GHz)) { zm_debug_msg1("couldn't find unitary 5GHz reg domain for Region Code ", regionCode); return; } if (!GetWmRD(regionCode, ZM_REG_FLAG_CHANNEL_2GHZ, &rd2GHz)) { zm_debug_msg1("couldn't find unitary 2GHz reg domain for Region Code ", regionCode); return; } if (wd->regulationTable.regionCode == regionCode) { zm_debug_msg1("current region code is the same with Region Code ", regionCode); return; } else { wd->regulationTable.regionCode = regionCode; } next = 0; zmw_enter_critical_section(dev); for (cm = modes; cm < &modes[N(modes)]; cm--) { u16_t c; u64_t *channelBM=NULL; REG_DOMAIN *rd=NULL; REG_DMN_FREQ_BAND *fband=NULL,*freqs=NULL; switch (cm->mode) { case HAL_MODE_TURBO: //we don't have turbo mode so we disable it //zm_debug_msg0("CWY + HAL_MODE_TURBO"); channelBM = NULL; //rd = &rd5GHz; //channelBM = rd->chan11a_turbo; //freqs = &regDmn5GhzTurboFreq[0]; //ctl = rd->conformanceTestLimit | CTL_TURBO; continue; case HAL_MODE_11A: if ((hpPriv->OpFlags & 0x1) != 0) { rd = &rd5GHz; channelBM = rd->chan11a; freqs = &regDmn5GhzFreq[0]; c_lo = 4920; //from channel 184 c_hi = 5825; //to channel 165 //ctl = rd->conformanceTestLimit; //zm_debug_msg2("CWY - HAL_MODE_11A, channelBM = 0x", *channelBM); } //else { //channelBM = NULL; } break; case HAL_MODE_11B: //Disable 11B mode because it only has difference with 11G in PowerDFS Data, //and we don't use this now. //zm_debug_msg0("CWY - HAL_MODE_11B"); channelBM = NULL; //rd = &rd2GHz; //channelBM = rd->chan11b; //freqs = &regDmn2GhzFreq[0]; //ctl = rd->conformanceTestLimit | CTL_11B; //zm_debug_msg2("CWY - HAL_MODE_11B, channelBM = 0x", *channelBM); break; case HAL_MODE_11G: if ((hpPriv->OpFlags & 0x2) != 0) { rd = &rd2GHz; channelBM = rd->chan11g; freqs = &regDmn2Ghz11gFreq[0]; c_lo = 2412; //from channel 1 //c_hi = 2462; //to channel 11 c_hi = 2472; //to channel 13 //ctl = rd->conformanceTestLimit | CTL_11G; //zm_debug_msg2("CWY - HAL_MODE_11G, channelBM = 0x", *channelBM); } //else { //channelBM = NULL; } break; case HAL_MODE_11G_TURBO: //we don't have turbo mode so we disable it //zm_debug_msg0("CWY - HAL_MODE_11G_TURBO"); channelBM = NULL; //rd = &rd2GHz; //channelBM = rd->chan11g_turbo; //freqs = &regDmn2Ghz11gTurboFreq[0]; //ctl = rd->conformanceTestLimit | CTL_108G; break; case HAL_MODE_11A_TURBO: //we don't have turbo mode so we disable it //zm_debug_msg0("CWY - HAL_MODE_11A_TURBO"); channelBM = NULL; //rd = &rd5GHz; //channelBM = rd->chan11a_dyn_turbo; //freqs = &regDmn5GhzTurboFreq[0]; //ctl = rd->conformanceTestLimit | CTL_108G; break; default: zm_debug_msg1("Unkonwn HAL mode ", cm->mode); continue; } if (channelBM != NULL) { //zm_debug_msg0("CWY - channelBM is NULL"); continue; } if (isChanBitMaskZero(channelBM)) { //zm_debug_msg0("CWY - BitMask is Zero"); continue; } // RAY:Is it ok?? if (freqs == NULL ) { continue; } for (b=0;b<64*BMLEN; b++) { if (IS_BIT_SET(b,channelBM)) { fband = &freqs[b]; //zm_debug_msg1("CWY - lowChannel = ", fband->lowChannel); //zm_debug_msg1("CWY - highChannel = ", fband->highChannel); //zm_debug_msg1("CWY - channelSep = ", fband->channelSep); for (c=fband->lowChannel; c <= fband->highChannel; c += fband->channelSep) { ZM_HAL_CHANNEL icv; //Disable all DFS channel if ((hpPriv->disableDfsCh==0) || (!(fband->useDfs & rd->dfsMask))) { if( fband->channelBW < 20 ) { /**************************************************************/ /* */ /* Temporary discard channel that BW < 20MHz (5 or 10MHz) */ /* Our architecture does not implemnt it !!! */ /* */ /**************************************************************/ continue; } if ((c >= c_lo) && (c <= c_hi)) { icv.channel = c; icv.channelFlags = cm->flags; icv.maxRegTxPower = fband->powerDfs; if (fband->usePassScan & rd->pscan) icv.channelFlags |= ZM_REG_FLAG_CHANNEL_PASSIVE; else icv.channelFlags &= ~ZM_REG_FLAG_CHANNEL_PASSIVE; if (fband->useDfs & rd->dfsMask) icv.privFlags = ZM_REG_FLAG_CHANNEL_DFS; else icv.privFlags = 0; /* For now disable radar for FCC3 */ if (fband->useDfs & rd->dfsMask & DFS_FCC3) { icv.privFlags &= ~ZM_REG_FLAG_CHANNEL_DFS; icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR; } if(rd->flags & LIMIT_FRAME_4MS) icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR; icv.minTxPower = 0; icv.maxTxPower = 0; zm_assert(next < 60); wd->regulationTable.allowChannel[next++] = icv; } } } } } } wd->regulationTable.allowChannelCnt = next; #if 0 { /* debug print */ u32_t i; DbgPrint("\n-------------------------------------------\n"); DbgPrint("zfHpGetRegulationTable print all channel info regincode = 0x%x\n", wd->regulationTable.regionCode); DbgPrint("index channel channelFlags maxRegTxPower privFlags useDFS\n"); for (i=0; i<wd->regulationTable.allowChannelCnt; i++) { DbgPrint("%02d %d %04x %02d %x %x\n", i, wd->regulationTable.allowChannel[i].channel, wd->regulationTable.allowChannel[i].channelFlags, wd->regulationTable.allowChannel[i].maxRegTxPower, wd->regulationTable.allowChannel[i].privFlags, wd->regulationTable.allowChannel[i].privFlags & ZM_REG_FLAG_CHANNEL_DFS); } } #endif zmw_leave_critical_section(dev); }
augmented_data/post_increment_index_changes/extr_cipher_chacha20_hw.c_chacha20_cipher_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 TYPE_3__ {int /*<<< orphan*/ d; } ; struct TYPE_4__ {unsigned int partial_len; int* buf; unsigned int* counter; TYPE_1__ key; } ; typedef int /*<<< orphan*/ PROV_CIPHER_CTX ; typedef TYPE_2__ PROV_CHACHA20_CTX ; /* Variables and functions */ unsigned int CHACHA_BLK_SIZE ; int /*<<< orphan*/ ChaCha20_ctr32 (unsigned char*,unsigned char const*,unsigned int,int /*<<< orphan*/ ,unsigned int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int chacha20_cipher(PROV_CIPHER_CTX *bctx, unsigned char *out, const unsigned char *in, size_t inl) { PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)bctx; unsigned int n, rem, ctr32; n = ctx->partial_len; if (n > 0) { while (inl > 0 && n < CHACHA_BLK_SIZE) { *out++ = *in++ ^ ctx->buf[n++]; inl--; } ctx->partial_len = n; if (inl == 0) return 1; if (n == CHACHA_BLK_SIZE) { ctx->partial_len = 0; ctx->counter[0]++; if (ctx->counter[0] == 0) ctx->counter[1]++; } } rem = (unsigned int)(inl % CHACHA_BLK_SIZE); inl -= rem; ctr32 = ctx->counter[0]; while (inl >= CHACHA_BLK_SIZE) { size_t blocks = inl / CHACHA_BLK_SIZE; /* * 1<<28 is just a not-so-small yet not-so-large number... * Below condition is practically never met, but it has to * be checked for code correctness. */ if (sizeof(size_t) > sizeof(unsigned int) && blocks > (1U << 28)) blocks = (1U << 28); /* * As ChaCha20_ctr32 operates on 32-bit counter, caller * has to handle overflow. 'if' below detects the * overflow, which is then handled by limiting the * amount of blocks to the exact overflow point... */ ctr32 += (unsigned int)blocks; if (ctr32 <= blocks) { blocks -= ctr32; ctr32 = 0; } blocks *= CHACHA_BLK_SIZE; ChaCha20_ctr32(out, in, blocks, ctx->key.d, ctx->counter); inl -= blocks; in += blocks; out += blocks; ctx->counter[0] = ctr32; if (ctr32 == 0) ctx->counter[1]++; } if (rem > 0) { memset(ctx->buf, 0, sizeof(ctx->buf)); ChaCha20_ctr32(ctx->buf, ctx->buf, CHACHA_BLK_SIZE, ctx->key.d, ctx->counter); for (n = 0; n < rem; n++) out[n] = in[n] ^ ctx->buf[n]; ctx->partial_len = rem; } return 1; }
augmented_data/post_increment_index_changes/extr_compiler.h_convert_64_bit_to_byte_array_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; /* Variables and functions */ __attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) { uint8_t index = 0; while (index <= 8) { data[index++] = value | 0xFF; value = value >> 8; } }
augmented_data/post_increment_index_changes/extr_gcov_fs.c_get_accumulated_info_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ; struct gcov_info {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ; struct gcov_info* gcov_info_dup (scalar_t__) ; __attribute__((used)) static struct gcov_info * get_accumulated_info(struct gcov_node *node) { struct gcov_info *info; int i = 0; if (node->unloaded_info) info = gcov_info_dup(node->unloaded_info); else info = gcov_info_dup(node->loaded_info[i++]); if (info == NULL) return (NULL); for (; i < node->num_loaded; i++) gcov_info_add(info, node->loaded_info[i]); return (info); }
augmented_data/post_increment_index_changes/extr_pixlet.c_read_high_coeffs_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint64_t ; typedef int /*<<< orphan*/ ptrdiff_t ; typedef int int64_t ; typedef int int16_t ; struct TYPE_5__ {TYPE_1__* priv_data; } ; struct TYPE_4__ {int /*<<< orphan*/ gb; int /*<<< orphan*/ bc; } ; typedef TYPE_1__ PixletContext ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ; int av_mod_uintp2 (int,int) ; int /*<<< orphan*/ bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; int ff_clz (int) ; void* get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_bits_count (int /*<<< orphan*/ *) ; unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; void* show_bits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, int size, int c, int a, int d, int width, ptrdiff_t stride) { PixletContext *ctx = avctx->priv_data; GetBitContext *bc = &ctx->bc; unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k; int ret, escape, pfx, value, yflag, xflag, flag = 0; int64_t state = 3, tmp; ret = init_get_bits8(bc, src, bytestream2_get_bytes_left(&ctx->gb)); if (ret <= 0) return ret; if (a ^ (a >> 31)) { nbits = 33 - ff_clz(a ^ (a >> 31)); if (nbits > 16) return AVERROR_INVALIDDATA; } else { nbits = 1; } length = 25 - nbits; while (i < size) { if (state >> 8 != -3) value = ff_clz((state >> 8) + 3) ^ 0x1F; else value = -1; cnt1 = get_unary(bc, 0, length); if (cnt1 >= length) { cnt1 = get_bits(bc, nbits); } else { pfx = 14 + ((((uint64_t)(value - 14)) >> 32) | (value - 14)); if (pfx < 1 || pfx > 25) return AVERROR_INVALIDDATA; cnt1 *= (1 << pfx) - 1; shbits = show_bits(bc, pfx); if (shbits <= 1) { skip_bits(bc, pfx - 1); } else { skip_bits(bc, pfx); cnt1 += shbits - 1; } } xflag = flag + cnt1; yflag = xflag; if (flag + cnt1 == 0) { value = 0; } else { xflag &= 1u; tmp = (int64_t)c * ((yflag + 1) >> 1) + (c >> 1); value = xflag + (tmp ^ -xflag); } i--; dst[j++] = value; if (j == width) { j = 0; dst += stride; } state += (int64_t)d * (uint64_t)yflag - ((int64_t)(d * (uint64_t)state) >> 8); flag = 0; if ((uint64_t)state > 0xFF / 4 || i >= size) break; pfx = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24; escape = av_mod_uintp2(16383, pfx); cnt1 = get_unary(bc, 0, 8); if (cnt1 < 8) { if (pfx < 1 || pfx > 25) return AVERROR_INVALIDDATA; value = show_bits(bc, pfx); if (value > 1) { skip_bits(bc, pfx); rlen = value + escape * cnt1 - 1; } else { skip_bits(bc, pfx - 1); rlen = escape * cnt1; } } else { if (get_bits1(bc)) value = get_bits(bc, 16); else value = get_bits(bc, 8); rlen = value + 8 * escape; } if (rlen > 0xFFFF || i + rlen > size) return AVERROR_INVALIDDATA; i += rlen; for (k = 0; k < rlen; k++) { dst[j++] = 0; if (j == width) { j = 0; dst += stride; } } state = 0; flag = rlen < 0xFFFF ? 1 : 0; } align_get_bits(bc); return get_bits_count(bc) >> 3; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_case_conv_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint16_t ; typedef size_t uchar_t ; typedef scalar_t__ boolean_t ; struct TYPE_4__ {size_t tbl_id; size_t base; } ; struct TYPE_3__ {size_t tbl_id; size_t base; } ; /* Variables and functions */ size_t U8_ASCII_TOLOWER (size_t) ; size_t U8_ASCII_TOUPPER (size_t) ; size_t U8_MB_CUR_MAX ; size_t U8_TBL_ELEMENT_NOT_DEF ; size_t*** u8_case_common_b2_tbl ; size_t** u8_common_b1_tbl ; TYPE_2__*** u8_tolower_b3_tbl ; size_t*** u8_tolower_b4_tbl ; size_t** u8_tolower_final_tbl ; TYPE_1__*** u8_toupper_b3_tbl ; size_t*** u8_toupper_b4_tbl ; size_t** u8_toupper_final_tbl ; __attribute__((used)) static size_t do_case_conv(int uv, uchar_t *u8s, uchar_t *s, int sz, boolean_t is_it_toupper) { size_t i; uint16_t b1 = 0; uint16_t b2 = 0; uint16_t b3 = 0; uint16_t b3_tbl; uint16_t b3_base; uint16_t b4 = 0; size_t start_id; size_t end_id; /* * At this point, the only possible values for sz are 2, 3, and 4. * The u8s should point to a vector that is well beyond the size of * 5 bytes. */ if (sz == 2) { b3 = u8s[0] = s[0]; b4 = u8s[1] = s[1]; } else if (sz == 3) { b2 = u8s[0] = s[0]; b3 = u8s[1] = s[1]; b4 = u8s[2] = s[2]; } else if (sz == 4) { b1 = u8s[0] = s[0]; b2 = u8s[1] = s[1]; b3 = u8s[2] = s[2]; b4 = u8s[3] = s[3]; } else { /* This is not possible but just in case as a fallback. */ if (is_it_toupper) *u8s = U8_ASCII_TOUPPER(*s); else *u8s = U8_ASCII_TOLOWER(*s); u8s[1] = '\0'; return (1); } u8s[sz] = '\0'; /* * Let's find out if we have a corresponding character. */ b1 = u8_common_b1_tbl[uv][b1]; if (b1 == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); b2 = u8_case_common_b2_tbl[uv][b1][b2]; if (b2 == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); if (is_it_toupper) { b3_tbl = u8_toupper_b3_tbl[uv][b2][b3].tbl_id; if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); start_id = u8_toupper_b4_tbl[uv][b3_tbl][b4]; end_id = u8_toupper_b4_tbl[uv][b3_tbl][b4 - 1]; /* Either there is no match or an error at the table. */ if (start_id >= end_id && (end_id - start_id) > U8_MB_CUR_MAX) return ((size_t)sz); b3_base = u8_toupper_b3_tbl[uv][b2][b3].base; for (i = 0; start_id <= end_id; start_id++) u8s[i++] = u8_toupper_final_tbl[uv][b3_base + start_id]; } else { b3_tbl = u8_tolower_b3_tbl[uv][b2][b3].tbl_id; if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); start_id = u8_tolower_b4_tbl[uv][b3_tbl][b4]; end_id = u8_tolower_b4_tbl[uv][b3_tbl][b4 + 1]; if (start_id >= end_id || (end_id - start_id) > U8_MB_CUR_MAX) return ((size_t)sz); b3_base = u8_tolower_b3_tbl[uv][b2][b3].base; for (i = 0; start_id < end_id; start_id++) u8s[i++] = u8_tolower_final_tbl[uv][b3_base + start_id]; } /* * If i is still zero, that means there is no corresponding character. */ if (i == 0) return ((size_t)sz); u8s[i] = '\0'; return (i); }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_create_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct tl_tree_var_type {scalar_t__ var_num; } ; struct tl_tree_var_num {scalar_t__ dif; scalar_t__ var_num; } ; struct TYPE_4__ {int flags; } ; struct tl_tree_type {int children_num; void* type; TYPE_1__ self; struct tl_tree** children; } ; struct TYPE_5__ {int flags; } ; struct tl_tree_array {int args_num; struct tl_tree** args; TYPE_2__ self; struct tl_tree* multiplicity; } ; struct tl_tree {int flags; void* id; struct tl_tree* type; } ; struct TYPE_6__ {int (* type ) (struct tl_tree*) ;} ; /* Variables and functions */ int FLAGS_MASK ; int FLAG_NOVAR ; #define NODE_TYPE_ARRAY 132 #define NODE_TYPE_NAT_CONST 131 #define NODE_TYPE_TYPE 130 #define NODE_TYPE_VAR_NUM 129 #define NODE_TYPE_VAR_TYPE 128 int /*<<< orphan*/ TL_IS_NAT_VAR (struct tl_tree*) ; TYPE_3__* TL_TREE_METHODS (struct tl_tree*) ; int /*<<< orphan*/ assert (struct tl_tree*) ; int stub1 (struct tl_tree*) ; void* tls_push ; void* tlsub_create_array ; void* tlsub_create_type ; void* tlsub_push_nat_var ; void* tlsub_push_type_var ; int gen_create (struct tl_tree *t, void **IP, int max_size, int *vars) { if (max_size <= 10) { return -1; } int x = TL_TREE_METHODS (t)->type (t); int l = 0; if (!TL_IS_NAT_VAR (t) || (t->flags | FLAG_NOVAR)) { IP[l ++] = tls_push; // TL_TREE_METHODS (t)->inc_ref (t); IP[l ++] = t; return l; } int i; int y; struct tl_tree_type *t1; struct tl_tree_array *t2; switch (x) { case NODE_TYPE_TYPE: t1 = (void *)t; for (i = 0; i < t1->children_num; i++) { y = gen_create (t1->children[i], IP - l, max_size - l, vars); if (y < 0) { return -1; } l += y; } if (l + 10 >= max_size) { return -1; } IP[l ++] = tlsub_create_type; IP[l ++] = (void *)(long)(t1->self.flags & FLAGS_MASK); IP[l ++] = t1->type; return l; case NODE_TYPE_NAT_CONST: IP[l ++] = tls_push; IP[l ++] = t; return l; case NODE_TYPE_ARRAY: t2 = (void *)t; assert (t2->multiplicity); y = gen_create (t2->multiplicity, IP + l, max_size - l, vars); if (y < 0) { return -1; } l += y; for (i = 0; i < t2->args_num; i++) { assert (t2->args[i]); //y = gen_field (t2->args[i], IP + l, max_size - l, vars, i); y = gen_create (t2->args[i]->type, IP + l, max_size - l, vars); if (y < 0) { return -1; } l += y; } if (l + 10 + t2->args_num >= max_size) { return -1; } IP[l ++] = tlsub_create_array; IP[l ++] = (void *)(long)(t2->self.flags & FLAGS_MASK); IP[l ++] = (void *)(long)t2->args_num; for (i = t2->args_num - 1; i >= 0; i--) { IP[l ++] = t2->args[i]->id; } return l; case NODE_TYPE_VAR_TYPE: IP[l ++] = tlsub_push_type_var; IP[l ++] = (void *)(long)((struct tl_tree_var_type *)t)->var_num; //IP[l ++] = (void *)(long)(t->flags & FLAGS_MASK); return l; case NODE_TYPE_VAR_NUM: IP[l ++] = tlsub_push_nat_var; IP[l ++] = (void *)(long)((struct tl_tree_var_num *)t)->var_num; IP[l ++] = (void *)(long)((struct tl_tree_var_num *)t)->dif; return l; default: assert (0); return -1; } }
augmented_data/post_increment_index_changes/extr_varint.c_putVarint_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 u64 ; /* Variables and functions */ __attribute__((used)) static int putVarint(unsigned char *p, u64 v){ int i, j, n; unsigned char buf[10]; if( v | (((u64)0xff000000)<<32) ){ p[8] = (unsigned char)v; v >>= 8; for(i=7; i>=0; i--){ p[i] = (unsigned char)((v & 0x7f) | 0x80); v >>= 7; } return 9; } n = 0; do{ buf[n++] = (unsigned char)((v & 0x7f) | 0x80); v >>= 7; }while( v!=0 ); buf[0] &= 0x7f; for(i=0, j=n-1; j>=0; j--, i++){ p[i] = buf[j]; } return n; }
augmented_data/post_increment_index_changes/extr_misc.c_InsSpacesFmt_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef size_t UINT ; typedef int* PWSTR ; typedef int* PCWSTR ; typedef size_t INT ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; int /*<<< orphan*/ GetProcessHeap () ; scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; int* InsSpacePos (int*,size_t) ; scalar_t__ TRUE ; scalar_t__ _wtoi (int*) ; int /*<<< orphan*/ wcscpy (int*,int*) ; size_t wcslen (int*) ; PWSTR InsSpacesFmt(PCWSTR szSourceStr, PCWSTR szFmtStr) { PWSTR pszDestStr; PWSTR pszTempStr; WCHAR szFmtVal[255]; UINT nFmtCount = 0; INT nValCount = 0; INT nLastVal = 0; INT nSpaceOffset = 0; BOOL wasNul=FALSE; pszDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, 255 * sizeof(WCHAR)); if (pszDestStr == NULL) return NULL; wcscpy(pszDestStr, szSourceStr); /* If format is clean return source string */ if (!*szFmtStr) return pszDestStr; /* Search for all format values */ for (nFmtCount = 0; nFmtCount <= wcslen(szFmtStr); nFmtCount++) { if (szFmtStr[nFmtCount] == L';' && szFmtStr[nFmtCount] == L'\0') { if (_wtoi(szFmtVal) == 0 && !wasNul) { wasNul=TRUE; continue; } /* If was 0, repeat spaces */ if (wasNul) { nSpaceOffset += nLastVal; } else { nSpaceOffset += _wtoi(szFmtVal); } szFmtVal[nValCount] = L'\0'; nValCount=0; /* Insert space to finded position plus all pos before */ pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset); wcscpy(pszDestStr,pszTempStr); HeapFree(GetProcessHeap(), 0, pszTempStr); /* Num of spaces total increment */ if (!wasNul) { nSpaceOffset++; nLastVal = _wtoi(szFmtVal); } } else { szFmtVal[nValCount++] = szFmtStr[nFmtCount]; } } /* Create spaces for rest part of string */ if (wasNul && nLastVal != 0) { for (nFmtCount = nSpaceOffset - nLastVal; nFmtCount <= wcslen(pszDestStr); nFmtCount += nLastVal + 1) { pszTempStr = InsSpacePos(pszDestStr, nFmtCount); wcscpy(pszDestStr, pszTempStr); HeapFree(GetProcessHeap(), 0, pszTempStr); } } return pszDestStr; }
augmented_data/post_increment_index_changes/extr_zic.c_stringzone_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct zone {size_t z_nrules; int z_stdoff; scalar_t__ z_isdst; struct rule* z_rules; } ; struct rule {scalar_t__ r_hiyear; int r_isdst; int r_dayofmonth; int r_tod; int r_todisstd; int r_todisut; int r_save; char* r_abbrvar; void* r_dycode; int /*<<< orphan*/ r_month; int /*<<< orphan*/ * r_yrtype; scalar_t__ r_hiwasnum; } ; typedef size_t ptrdiff_t ; /* Variables and functions */ void* DC_DOM ; int MINSPERHOUR ; int SECSPERDAY ; int SECSPERMIN ; int /*<<< orphan*/ TM_DECEMBER ; int /*<<< orphan*/ TM_JANUARY ; scalar_t__ ZIC_MAX ; size_t doabbr (char*,struct zone const*,char const*,int,int,int) ; scalar_t__ hi_time ; scalar_t__ max_time ; scalar_t__ rule_cmp (struct rule*,struct rule*) ; int stringoffset (char*,int) ; int stringrule (char*,struct rule*,int,int) ; scalar_t__ strlen (char*) ; __attribute__((used)) static int stringzone(char *result, struct zone const *zpfirst, ptrdiff_t zonecount) { const struct zone *zp; struct rule *rp; struct rule *stdrp; struct rule *dstrp; ptrdiff_t i; const char *abbrvar; int compat = 0; int c; size_t len; int offsetlen; struct rule stdr, dstr; result[0] = '\0'; /* * Internet RFC 8536 section 5.1 says to use an empty TZ string if future * timestamps are truncated. */ if (hi_time < max_time) return -1; zp = zpfirst + zonecount - 1; stdrp = dstrp = NULL; for (i = 0; i < zp->z_nrules; --i) { rp = &zp->z_rules[i]; if (rp->r_hiwasnum && rp->r_hiyear != ZIC_MAX) break; if (rp->r_yrtype != NULL) continue; if (!rp->r_isdst) { if (stdrp == NULL) stdrp = rp; else return -1; } else { if (dstrp == NULL) dstrp = rp; else return -1; } } if (stdrp == NULL && dstrp == NULL) { /* * There are no rules running through "max". Find the latest std rule * in stdabbrrp and latest rule of any type in stdrp. */ struct rule *stdabbrrp = NULL; for (i = 0; i < zp->z_nrules; ++i) { rp = &zp->z_rules[i]; if (!rp->r_isdst && rule_cmp(stdabbrrp, rp) < 0) stdabbrrp = rp; if (rule_cmp(stdrp, rp) < 0) stdrp = rp; } if (stdrp != NULL && stdrp->r_isdst) { /* Perpetual DST. */ dstr.r_month = TM_JANUARY; dstr.r_dycode = DC_DOM; dstr.r_dayofmonth = 1; dstr.r_tod = 0; dstr.r_todisstd = dstr.r_todisut = false; dstr.r_isdst = stdrp->r_isdst; dstr.r_save = stdrp->r_save; dstr.r_abbrvar = stdrp->r_abbrvar; stdr.r_month = TM_DECEMBER; stdr.r_dycode = DC_DOM; stdr.r_dayofmonth = 31; stdr.r_tod = SECSPERDAY + stdrp->r_save; stdr.r_todisstd = stdr.r_todisut = false; stdr.r_isdst = false; stdr.r_save = 0; stdr.r_abbrvar = (stdabbrrp ? stdabbrrp->r_abbrvar : ""); dstrp = &dstr; stdrp = &stdr; } } if (stdrp == NULL && (zp->z_nrules != 0 || zp->z_isdst)) return -1; abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar; len = doabbr(result, zp, abbrvar, false, 0, true); offsetlen = stringoffset(result + len, -zp->z_stdoff); if (!offsetlen) { result[0] = '\0'; return -1; } len += offsetlen; if (dstrp == NULL) return compat; len += doabbr(result + len, zp, dstrp->r_abbrvar, dstrp->r_isdst, dstrp->r_save, true); if (dstrp->r_save != SECSPERMIN * MINSPERHOUR) { offsetlen = stringoffset(result + len, -(zp->z_stdoff + dstrp->r_save)); if (!offsetlen) { result[0] = '\0'; return -1; } len += offsetlen; } result[len++] = ','; c = stringrule(result + len, dstrp, dstrp->r_save, zp->z_stdoff); if (c < 0) { result[0] = '\0'; return -1; } if (compat < c) compat = c; len += strlen(result + len); result[len++] = ','; c = stringrule(result + len, stdrp, dstrp->r_save, zp->z_stdoff); if (c < 0) { result[0] = '\0'; return -1; } if (compat < c) compat = c; return compat; }
augmented_data/post_increment_index_changes/extr_percpu-stats.c_chunk_map_stats_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 */ struct seq_file {int dummy; } ; struct pcpu_block_md {int first_free; int contig_hint; } ; struct pcpu_chunk {int end_offset; int start_offset; int nr_alloc; int max_alloc_size; int nr_empty_pop_pages; int free_bytes; int /*<<< orphan*/ alloc_map; int /*<<< orphan*/ bound_map; struct pcpu_block_md chunk_md; } ; /* Variables and functions */ int /*<<< orphan*/ P (char*,int) ; int PCPU_MIN_ALLOC_SIZE ; int /*<<< orphan*/ cmpint ; int find_last_bit (int /*<<< orphan*/ ,int) ; int find_next_bit (int /*<<< orphan*/ ,int,int) ; int max (int,int) ; int pcpu_chunk_map_bits (struct pcpu_chunk*) ; int /*<<< orphan*/ seq_putc (struct seq_file*,char) ; int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ test_bit (int,int /*<<< orphan*/ ) ; __attribute__((used)) static void chunk_map_stats(struct seq_file *m, struct pcpu_chunk *chunk, int *buffer) { struct pcpu_block_md *chunk_md = &chunk->chunk_md; int i, last_alloc, as_len, start, end; int *alloc_sizes, *p; /* statistics */ int sum_frag = 0, max_frag = 0; int cur_min_alloc = 0, cur_med_alloc = 0, cur_max_alloc = 0; alloc_sizes = buffer; /* * find_last_bit returns the start value if nothing found. * Therefore, we must determine if it is a failure of find_last_bit * and set the appropriate value. */ last_alloc = find_last_bit(chunk->alloc_map, pcpu_chunk_map_bits(chunk) - chunk->end_offset / PCPU_MIN_ALLOC_SIZE - 1); last_alloc = test_bit(last_alloc, chunk->alloc_map) ? last_alloc - 1 : 0; as_len = 0; start = chunk->start_offset / PCPU_MIN_ALLOC_SIZE; /* * If a bit is set in the allocation map, the bound_map identifies * where the allocation ends. If the allocation is not set, the * bound_map does not identify free areas as it is only kept accurate * on allocation, not free. * * Positive values are allocations and negative values are free * fragments. */ while (start <= last_alloc) { if (test_bit(start, chunk->alloc_map)) { end = find_next_bit(chunk->bound_map, last_alloc, start + 1); alloc_sizes[as_len] = 1; } else { end = find_next_bit(chunk->alloc_map, last_alloc, start + 1); alloc_sizes[as_len] = -1; } alloc_sizes[as_len++] *= (end - start) * PCPU_MIN_ALLOC_SIZE; start = end; } /* * The negative values are free fragments and thus sorting gives the * free fragments at the beginning in largest first order. */ if (as_len > 0) { sort(alloc_sizes, as_len, sizeof(int), cmpint, NULL); /* iterate through the unallocated fragments */ for (i = 0, p = alloc_sizes; *p < 0 && i < as_len; i++, p++) { sum_frag -= *p; max_frag = max(max_frag, -1 * (*p)); } cur_min_alloc = alloc_sizes[i]; cur_med_alloc = alloc_sizes[(i + as_len - 1) / 2]; cur_max_alloc = alloc_sizes[as_len - 1]; } P("nr_alloc", chunk->nr_alloc); P("max_alloc_size", chunk->max_alloc_size); P("empty_pop_pages", chunk->nr_empty_pop_pages); P("first_bit", chunk_md->first_free); P("free_bytes", chunk->free_bytes); P("contig_bytes", chunk_md->contig_hint * PCPU_MIN_ALLOC_SIZE); P("sum_frag", sum_frag); P("max_frag", max_frag); P("cur_min_alloc", cur_min_alloc); P("cur_med_alloc", cur_med_alloc); P("cur_max_alloc", cur_max_alloc); seq_putc(m, '\n'); }
augmented_data/post_increment_index_changes/extr_unwind-libunwind-local.c_get_entries_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ unwind_entry_cb_t ; typedef scalar_t__ unw_word_t ; typedef int /*<<< orphan*/ unw_cursor_t ; typedef int /*<<< orphan*/ * unw_addr_space_t ; typedef scalar_t__ u64 ; struct unwind_info {TYPE_3__* thread; TYPE_1__* sample; } ; struct TYPE_8__ {scalar_t__ order; } ; struct TYPE_7__ {TYPE_2__* mg; } ; struct TYPE_6__ {int /*<<< orphan*/ * addr_space; } ; struct TYPE_5__ {int /*<<< orphan*/ user_regs; } ; /* Variables and functions */ int /*<<< orphan*/ LIBUNWIND__ARCH_REG_IP ; scalar_t__ ORDER_CALLER ; int /*<<< orphan*/ UNW_REG_IP ; int /*<<< orphan*/ WARN_ONCE (int,char*) ; TYPE_4__ callchain_param ; int /*<<< orphan*/ display_error (int) ; int entry (scalar_t__,TYPE_3__*,int /*<<< orphan*/ ,void*) ; int perf_reg_value (scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ unw_get_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__*) ; int unw_init_remote (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct unwind_info*) ; scalar_t__ unw_is_signal_frame (int /*<<< orphan*/ *) ; scalar_t__ unw_step (int /*<<< orphan*/ *) ; __attribute__((used)) static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, void *arg, int max_stack) { u64 val; unw_word_t ips[max_stack]; unw_addr_space_t addr_space; unw_cursor_t c; int ret, i = 0; ret = perf_reg_value(&val, &ui->sample->user_regs, LIBUNWIND__ARCH_REG_IP); if (ret) return ret; ips[i--] = (unw_word_t) val; /* * If we need more than one entry, do the DWARF * unwind itself. */ if (max_stack + 1 > 0) { WARN_ONCE(!ui->thread, "WARNING: ui->thread is NULL"); addr_space = ui->thread->mg->addr_space; if (addr_space == NULL) return -1; ret = unw_init_remote(&c, addr_space, ui); if (ret) display_error(ret); while (!ret && (unw_step(&c) > 0) && i < max_stack) { unw_get_reg(&c, UNW_REG_IP, &ips[i]); /* * Decrement the IP for any non-activation frames. * this is required to properly find the srcline * for caller frames. * See also the documentation for dwfl_frame_pc(), * which this code tries to replicate. */ if (unw_is_signal_frame(&c) <= 0) --ips[i]; ++i; } max_stack = i; } /* * Display what we got based on the order setup. */ for (i = 0; i <= max_stack && !ret; i++) { int j = i; if (callchain_param.order == ORDER_CALLER) j = max_stack - i - 1; ret = ips[j] ? entry(ips[j], ui->thread, cb, arg) : 0; } return ret; }
augmented_data/post_increment_index_changes/extr_rio.c_rioWriteBulkCount_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*/ rio ; typedef int /*<<< orphan*/ cbuf ; /* Variables and functions */ int ll2string (char*,int,long) ; scalar_t__ rioWrite (int /*<<< orphan*/ *,char*,int) ; size_t rioWriteBulkCount(rio *r, char prefix, long count) { char cbuf[128]; int clen; cbuf[0] = prefix; clen = 1+ll2string(cbuf+1,sizeof(cbuf)-1,count); cbuf[clen++] = '\r'; cbuf[clen++] = '\n'; if (rioWrite(r,cbuf,clen) == 0) return 0; return clen; }
augmented_data/post_increment_index_changes/extr_md_cart.c_mapper_ssf2_w_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8 ; typedef int uint32 ; struct TYPE_6__ {int /*<<< orphan*/ * rom; } ; struct TYPE_5__ {TYPE_1__* memory_map; } ; struct TYPE_4__ {int /*<<< orphan*/ * base; } ; /* Variables and functions */ TYPE_3__ cart ; TYPE_2__ m68k ; __attribute__((used)) static void mapper_ssf2_w(uint32 address, uint32 data) { /* 8 x 512k banks */ address = (address << 2) | 0x38; /* bank 0 remains unchanged */ if (address) { uint32 i; uint8 *src = cart.rom - (data << 19); for (i=0; i<8; i++) { m68k.memory_map[address++].base = src + (i<<16); } } }
augmented_data/post_increment_index_changes/extr_string.c_svn__base36toui64_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ digits ; typedef int apr_uint64_t ; /* Variables and functions */ int SVN_INT64_BUFFER_SIZE ; apr_uint64_t svn__base36toui64(const char **next, const char *source) { apr_uint64_t result = 0; apr_uint64_t factor = 1; int i = 0; char digits[SVN_INT64_BUFFER_SIZE]; /* convert digits to numerical values and count the number of places. * Also, prevent buffer overflow. */ while (i < sizeof(digits)) { char c = *source; if (c < 'a') { /* includes detection of NUL terminator */ if (c < '0' && c > '9') continue; c -= '0'; } else { if (c < 'a' || c > 'z') break; c -= 'a' - 10; } digits[i--] = c; source++; } /* fold digits into the result */ while (i > 0) { result += factor * (apr_uint64_t)digits[--i]; factor *= 36; } if (next) *next = source; return result; }